@vizzly/dashboard 0.10.0 → 0.11.0-dev-ae01bcc1ecb66522b652b944f32bb87d8f9ba688
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/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("@vizzly/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"),j=require("@visx/responsive"),C=require("@visx/xychart"),S=require("@visx/gradient"),F=require("@visx/legend"),k=require("@visx/scale"),_=e(require("@visx/legend/lib/legends/Ordinal")),T=require("@visx/curve"),A=require("d3-time-format"),D=require("@visx/shape"),I=require("@visx/group"),O=e(require("@visx/shape/lib/shapes/Pie")),P=require("@react-spring/web"),E=require("@visx/tooltip"),M=require("@visx/geo"),R=require("topojson-client"),L=e(require("@visx/responsive/lib/components/ParentSize")),N=require("@visx/zoom"),z=e(require("react-visibility-sensor")),q=e(require("copy-to-clipboard")),B=require("react-dnd-html5-backend"),W=require("file-saver"),V=e(require("html2canvas")),H=e(require("jspdf"));function Y(e,t,n){if(U())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&$(i,n.prototype),i}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}function G(){G=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),a=new A(r||[]);return i(o,"_invoke",{value:F(e,n,a)}),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="executing",m="completed",h={};function v(){}function g(){}function b(){}var x={};u(x,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(D([])));w&&w!==n&&r.call(w,a)&&(x=w);var j=b.prototype=v.prototype=Object.create(x);function C(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,l){var s=c(e[i],e,o);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function F(t,n,r){var i=p;return function(o,a){if(i===f)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var l=r.delegate;if(l){var s=k(l,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var u=c(t,n,r);if("normal"===u.type){if(i=r.done?m:"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=m,r.method="throw",r.arg=u.arg)}}}function k(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=c(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,h):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function _(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 T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function D(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=b,i(j,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(j),e},t.awrap=function(e){return{__await:e}},C(S.prototype),u(S.prototype,l,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(d(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(j),u(j,s,"Generator"),u(j,a,(function(){return this})),u(j,"toString",(function(){return"[object Generator]"})),t.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}},t.values=D,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return l.type="throw",l.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.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,h):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),h},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),T(n),h}},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;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:D(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),h}},t}function K(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 X(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){K(o,r,i,a,l,"next",e)}function l(e){K(o,r,i,a,l,"throw",e)}a(void 0)}))}}function Q(){return(Q=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 J(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,$(e,t)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){var t="function"==typeof Map?new Map:void 0;return(ee=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))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 Y(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(n,e)})(e)}function te(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 ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(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 ie(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 re(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)?re(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 oe={">":{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[]"]}},ae=function(e,t){return[].concat(Object.keys(t.supportedOperators)).filter((function(t){return se[t].validDataTypes.includes(e.dataType)}))},le=function(e,t){return"countDistinct"==e?t("count_distinct","Count distinct"):i.capitalize(e)},se=oe,ue=function(e){var t=i.cloneDeep(se);if(!e)return t;var n={};return e.forEach((function(e){if(!se[e])throw"Operator "+e+" not managed by Vizzly";n[e]=se[e]})),n},de=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:Q({},e,{value:[e.value]})}))}))},ce=function(e,t){return e.map((function(e){var n=Q({},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}))},pe=function(e){return e.map((function(e){var t=Q({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t}))},fe=function(e){return"auto"===e||0===e||2===e?e:"auto"},me=function(e){if(!e)return{};var t={};return e.measure&&Object.entries(e.measure).forEach((function(e){t&&(t[e[0]]=pe(e[1]))})),{measure:i.isEmpty(t)?void 0:t,group:e.group}},he={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"]},median:{publicName:"Median",validDataTypes:["number"]}},ve=he,ge=function(e){var t=i.cloneDeep(ve);if(!e)return t;var n={};return e.forEach((function(e){if(!ve[e])throw"Aggregate "+e+" not managed by Vizzly";n[e]=ve[e]})),n};function be(e,t,n){if(void 0===t&&(t=!0),1==e.length)return t?"'"+e[0]+"'":""+e[0];var r=[].concat(e),i=r.pop();return r.map((function(e){return t?"'"+e+"'":""+e})).join(", ")+" "+(n?n("list_of_values_and","and"):"and")+" "+(t?"'"+i+"'":""+i)}var xe=function(e){for(var t=0,n=0;n<e.length;n++)t+=e.charCodeAt(n);return t},ye=["debug","info","warning","error","properties"],we="error",je=function(e,t){return we=e,t&&t(we),{logDebug:Fe,logError:Ae,logInfo:ke,logWarning:Te,logProperties:_e}},Ce=function(e){return ye.findIndex((function(e){return we==e}))<=ye.findIndex((function(t){return e==t}))},Se=function(e){return e instanceof Error?e:i.isObject(e)||i.isArray(e)?JSON.stringify(e):e},Fe=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("debug")&&(e=console).info.apply(e,["[VIZZLY DEBUG]"].concat(n.map(Se)))},ke=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("info")&&(e=console).info.apply(e,["[VIZZLY INFO]"].concat(n.map(Se)))},_e=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Ce("properties")&&console.info("[VIZZLY Dashboard Properties]",t)},Te=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("warning")&&(e=console).warn.apply(e,["[VIZZLY WARNING]"].concat(n.map(Se)))},Ae=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("error")&&(e=console).error.apply(e,["[VIZZLY ERROR]"].concat(n.map(Se)))},De=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},Ie=function(e,t){return void 0===t&&(t="No value"),null===e?t:e instanceof Date?e.toISOString():e},Oe=function(e,t){return Pe(e,t)[0]},Pe=function(e,t){var n,r=null!=(n=e.supportedAggregateOptions)?n:[],i=r.filter((function(n){return Object.keys(t).includes(n)&&t[n].validDataTypes.includes(e.dataType)}));return 0===i.length?i=Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)})):i.sort((function(e,t){return r.indexOf(e)-r.indexOf(t)})),i},Ee=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},Me=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"}},Re=function(e,t){var n=Me(e,t);return{fieldId:n.field,function:n.function}},Le=function(e,t){var n=new Set(t.map((function(e){return e.field})));return e.filter((function(e){return!n.has(e.id)}))},Ne=function(e){return e.map((function(e){return"string"==typeof e?{field:e,function:"none"}:e}))},ze=function(e){return"string[]"==e.dataType},qe={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}},Be=function(e){var t=i.cloneDeep(qe);if(!e)return t;var n={};return e.forEach((function(e){if(!qe[e])throw"Transformation function "+e+" is not managed by Vizzly";n[e]=qe[e]})),n},We=function(e,t,n){var r=e.supportedAggregates,i=Object.keys(r).filter((function(e){return r[e].validDataTypes.includes(t)}));null==n||n.forEach((function(e){r.hasOwnProperty(e)||Te("Unsupported aggregate option: "+e+" on "+t)}));var o=n&&n.length>0?n.filter((function(e){return i.includes(e)})):i;return n&&n.length>0&&0===o.length&&(o=i),o},Ve=function(e){return r.object({filters:r.array().items(r.array().items(tt(e)).required().max(1)).required().max(1),ruleValue:r.string().allow("").required(),ruleValueEnd:r.string().allow(""),ruleType:r.valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view.")},He=r.object({field:r.string().required().description("ID of the field in the data set to add a prefix too."),prefix:r.string().required().description("The prefix to be applied.")}),Ye=r.object({fieldId:r.string().required(),dataSetId:r.string().required()}),Ue=function(e){return r.object().pattern(r.string(),r.array().items(tt(e)).optional())},Ge=function(e){return{title:r.string().allow(""),managedByConfiguration:r.boolean().optional(),requiresValue:r.boolean().optional(),optionsFilters:Ue(e).optional(),appliesToFields:r.array().items(Ye).required(),optionsPulledFrom:r.array().items(Ye).optional()}},Ke=function(e,t){return r.object(Q({},Ge(e),{type:r.valid("singleSelectFilter").required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.valid.apply(r,t?[]:[null]))}))},Xe=function(e,t){return r.object(Q({},Ge(e),{type:r.valid("multiSelectFilter").required(),value:r.alternatives(r.array().items(r.string(),r.number()).single(),r.valid.apply(r,t?[]:[null]))}))},Qe=function(e,t,n){return r.object(Q({},Ge(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()}))}))},Je=function(e,t){var n=function(e,t){return r.object({field:e.required(),function:t.required().description("Which if any, aggregate function should be applied to the field?")})};return null!=t&&t.restrictFields?r.alternatives.apply(r,t.restrictFields.filter((function(e){return e.canBeMeasure})).map((function(t){var i,o=function(e,t){return Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)}))}(t,e);return n(r.string().valid(t.id).description(t.publicName+", "+(t.description||"")+"."),(i=r.string()).valid.apply(i,o.concat(["none"])))}))):n(r.string().description("The ID of the field from the data set to reference."),r.valid.apply(r,Object.keys(e).concat(["none"])))},Ze=function(e){var t;return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),direction:r.string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which if any, function should be applied to the field?")})},$e=function(e){return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),truncate:r.valid.apply(r,Object.keys(e).concat(["none"])),bucketFill:r.boolean()})},et=function(e,t){var n=function(t,n){return r.object({field:t.required(),pivot:r.string().valid("x","y").optional(),function:n?r.valid.apply(r,Object.keys(e).concat(["none"])).required():r.valid("none").required()})};return null!=t&&t.restrictFields?r.array().items(r.alternatives.apply(r,t.restrictFields.filter((function(e){return e.canBeDimension})).map((function(e){return n(r.string().valid(e.id).description(e.publicName+", "+(e.description||"")+"."),"date_time"===e.dataType)})))).description("Fields to group the data by"):r.array().items(n(r.string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},tt=function(e){var t,n;return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),op:(t=r.string()).valid.apply(t,Object.keys(e.supportedOperators)).required(),value:r.alternatives(r.string().allow(null),r.number(),r.boolean(),r.array().items(r.string(),r.number())).required(),function:(n=r.string()).valid.apply(n,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which function should be applied to the field?")})},nt=function(e){return r.array().items(r.array().items(tt(e)))},rt=function(){return r.number().description("Limit the number of results returned after the query has been ran.")},it=function(e){var t,n=null!=e&&e.restrictDataSetIds?(t=r.string()).valid.apply(t,e.restrictDataSetIds):r.string();return{viewId:r.string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:r.string().allow("").description("A title that explains what is being displayed."),displaySubject:r.string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:n.description("The ID of the data set that is being used by the view."),protectedByOrganisation:r.boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},ot=r.valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),at=function(e,t){return{measure:r.array().items(Je(e.supportedAggregates,t)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:et(e.supportedTimeTruncFunctions,t).required(),drilldown:r.alternatives(et(e.supportedTimeTruncFunctions,t).required(),r.string()),order:r.array().items(Ze(e)),timeDimension:r.alternatives($e(e.supportedTimeTruncFunctions),r.valid(null)).required(),limit:rt(),offset:r.number().min(0).description("Paginate results by using this property with limit."),filter:r.array().items(r.array().items(tt(e))),xAxisPrefix:r.string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:r.string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:r.string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:r.string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:r.alternatives(r.string(),r.valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:r.alternatives(r.string(),r.valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:ot,approxXAxisLabelCount:ot}},lt=r.string().valid("natural","straight","step","stepBefore","stepAfter"),st=function(e){var t;return r.array().items(r.object({function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),field:r.string().required().description("The ID of the field from the data set to reference.")}))},ut=function(e){var t;return r.array().items(r.object({function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),truncate:r.string(),field:r.string().required().description("The ID of the field from the data set to reference."),bucketFill:r.boolean().optional(),pivot:r.string().valid("x","y").optional()}))},dt=function(e,t){return r.object().pattern(r.string(),r.alternatives().try(r.array().items($e(e.supportedTimeTruncFunctions)).min(1),et(e.supportedTimeTruncFunctions,t))).unknown(!0)},ct=function(e,t){return r.object().pattern(r.string(),r.array().items(Je(e.supportedAggregates,t)).min(1)).unknown(!0)},pt=function(e,t){return r.object({measure:ct(e,t),group:dt(e,t)})},ft=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()})},mt=function(){return r.array().items(ft())},ht=function(){return r.object({func:r.string().valid("mean","sum","current").allow(null).optional()})},vt=function(){return r.object({x:r.string().allow(""),y:r.string().allow("")})},gt=r.object().pattern(r.string(),r.object({width:r.number().min(0),height:r.number().min(0)})),bt=function(e){return r.array().items(Ve(e)).description("Apply formatting based on a set of defined rules.")},xt=r.object({field:r.string().required(),function:r.valid("none").required()}),yt=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("basicTable").required(),measure:r.array().items(xt).required(),dimension:r.array().max(0),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.valid(null),limit:rt().required(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),prefixes:r.array().items(He),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:bt(e.queryEngineConfig),dateTimeFormat:r.string(),protectedFields:r.object({measure:st(e.queryEngineConfig)}).unknown(!0),sizing:gt}))},wt={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"}},jt=function(e){return null!=e&&e.truncate&&"none"!=(null==e?void 0:e.truncate)?e.field+"_"+e.truncate:null==e?void 0:e.field},Ct=function(e,t){var n=e.split("_"),r=n.pop();return r&&!kt(t,r)?null:{field:n.join("_"),truncate:null!=r?r:""}},St=wt,Ft=function(e){var t=i.cloneDeep(St);if(!e)return t;var n={};return e.forEach((function(e){if(!St[e])throw"Time trunc function "+e+" not managed by Vizzly";n[e]=St[e]})),n},kt=function(e,t){return[].concat(Object.keys(e),["none"]).includes(t)},_t=Ee,Tt=Me,At=function(e){return"none"!=e.function};function Dt(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 It=function(e,t){return Q({},e,{order:i.remove(e.order,(function(e){return i.some(t,(function(t){return t.function==e.function&&t.field==e.field}))}))})},Ot=function(e,t,n){var r,o,a,l=Q({},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=Tt(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=_t(r);delete e.measure[i]}e.measure=Dt(e.measure,t)}if("group"in e&&e.group){var o=function(e,t){return Object.keys(e).map((function(e){var n=Ct(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=jt(o);delete e.group[a]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=Dt(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},Pt=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}),It(e,t)},Et=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},Mt=function(e){return function(t,n){var r=Et(t,n,yt(e));return It(r,[].concat(r.measure))}},Rt=function(e,t){var n=[];return i.isEmpty(t)||void 0===t?[]:(null==t||t.map((function(t){if(null!=t&&t.ruleType&&null!=t&&t.ruleValue){var r=[],i="field"in t&&"string"==typeof t.field&&"operator"in t&&"string"==typeof t.operator&&"value"in t;if(null!=t&&t.filters){var o=t.filters.map((function(t){return t.map((function(t){return Lt(t,e)}))}));r.push.apply(r,o)}else i&&r.push([Lt({field:t.field,op:t.operator,value:t.value},e)]);n.push({filters:r,ruleValueEnd:null==t?void 0:t.ruleValueEnd,ruleValue:t.ruleValue,ruleType:t.ruleType})}})),n)},Lt=function(e,t){var n,r=Me(e.field,t),i="none"!==r.function?r.function:null!=(n=e.function)?n:"none";return{field:r.field,op:e.op,value:e.value,function:i}},Nt=function(e,t){return t.length>0&&t[0].length>0?{type:"function",function:e.aggregate,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:t},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}:{type:"field",function:e.aggregate,value:e.fieldId}},zt=function(e,t,n){return e.map((function(e){return{returns:{type:"string",value:e.name},filter:Zt(e.rule,t,n)}}))},qt=function(){return l.v4().replace(/-/g,"")},Bt=function(e){return"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e},Wt=function(e){return"roundToDecimalPlaces"in e},Vt=function(e){return"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e},Ht=function(e){return"denominatorFieldId"in e||"numeratorFieldId"in e},Yt=function(e){return"rules"in e},Ut=function(e){if(Ht(e))return"percentage";if(Bt(e))return"math";if(Vt(e))return"math";if(Yt(e))return"rules";if(Wt(e))return"roundedNumber";throw"Unrecognised custom field type for custom field; "+JSON.stringify(e)},Gt=function(e){return Ht(e)||Bt(e)||Vt(e)||Yt(e)||Wt(e)},Kt=function(e,t,n,r,i,o){if(Ht(t))return function(e,t,n,r,i){var o,a,l,s,u=function(e,t){var n,r;return{combinedNominatorFilters:t.numeratorFilter&&$t(t.numeratorFilter)?Jt(null!=e?e:[],null!=(n=t.numeratorFilter[0])?n:[]):null!=e?e:[],combinedDenominatorFilters:t.denominatorFilter&&$t(t.denominatorFilter)?Jt(null!=e?e:[],null!=(r=t.denominatorFilter[0])?r:[]):null!=e?e:[]}}(i,e),d=u.combinedNominatorFilters,c=u.combinedDenominatorFilters,p={fieldId:null!=(o=e.numeratorFieldId)?o:e.denominatorFieldId,aggregate:null!=(a=e.numeratorAggregate)?a:e.denominatorAggregate},f={fieldId:null!=(l=e.denominatorFieldId)?l:e.numeratorFieldId,aggregate:null!=(s=e.denominatorAggregate)?s:e.numeratorFieldId},m={type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Zt(c||[],t,n)}},h=Nt(f,$t(e.denominatorFilter)?Zt(c,t,n):[]);return{type:"maths",left:Nt(p,$t(e.numeratorFilter)?Zt(d,t,n):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:m}}(t,n,r,0,o);if(Yt(t))return function(e,t,n,r){var i={type:"switchField",value:{cases:zt(t.rules,n,r)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}}(e,t,n,r);if(Vt(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(Bt(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 Xt(e,t);throw"Unsupported custom field type; "+JSON.stringify(t)},Xt=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}},Qt=function(e){if("leftAggregate"in e||"rightAggregate"in e){var t=Q({},e,{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?Q({},e.leftNested,{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?Q({},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}if("numeratorFieldId"in e&&!("version"in e)){var n,r,i=[].concat((null==(n=e.numeratorFilter)?void 0:n[0])||[],(null==(r=e.denominatorFilter)?void 0:r[0])||[]);return Q({},e,{version:2,denominatorScope:e.denominatorScope||"all",denominatorFilter:(null==e?void 0:e.denominatorFilter)||[],numeratorFilter:i.length>0?[i]:[]})}return e},Jt=function(e,t){return e&&!i.isEmpty(e)||(e=[[]]),[].concat(e).map((function(e){return[].concat(e,t)}))},Zt=function(e,t,n){return e.map((function(r){return[].concat(r).flatMap((function(r){var i;if(r.function&&!kt(t.supportedTimeTruncFunctions,r.function))throw"Query engine does not support the query function "+r.function+".";var o,a=Yr(n,r.field),l={type:"field",value:r.field,function:null!=(i=r.function)?i:"none"};return Gt(a)&&(l=Kt({field:a.id,function:null!=(o=r.function)?o:"none"},a,t,n,0,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){return e&&i.isArray(e)&&i.isArray(e[0])},en=function(e,t){return[[].concat(e,[t]),e.length]},tn=function(e,t,n,r,i,o,a,l,s){var u=[],d=[],c=[],p=[],f=[];if(o){var m;if(!kt(s.supportedTimeTruncFunctions,o.truncate))throw"Query engine does not support the time trunc function "+o.truncate+".";var h=en(d,{type:"field",value:o.field,function:o.truncate});d=h[0],m=h[1],u=[].concat(u,[{functionId:o.truncate,field:Yr(e,o.field)}]),c=[].concat(c,[{index:m}])}return i.forEach((function(t){var n,r=en(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:Yr(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=en(d,{type:"field",value:t.field,function:t.function});d=r[0],u=[].concat(u,[{functionId:t.function,field:Yr(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=Zt([t],s,e);f=[].concat(f,[n[0]])})),d=d.map((function(t){if("field"==t.type&&"string"==typeof t.value){var n=Yr(e,t.value);if(Gt(n))return Kt({function:t.function,field:t.value},n,s,e,rn({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}},nn=tn,rn=function(e){return e.group.length>0},on=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}]}},an=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}},ln=function(e,t){return e.supportedFeatures.includes(t)},sn=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ValidationError",n}return J(t,e),t}(ee(Error)),un=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 J(t,e),t.prototype.getMissingFieldId=function(){return this.missingFieldId},t}(sn),dn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("barChart","horizontalBarChart").required(),conditionalFormattingRules:bt(e.queryEngineConfig),protectedFields:r.object({dimension:ut(e.queryEngineConfig),measure:st(e.queryEngineConfig)}).unknown(!0),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:mt(),axisTitles:vt(),headline:ht()}))},cn=function(e){return function(t,n){var r=Et(t,n,dn(e));return Pt(r)}},pn=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 J(t,e),t}(sn),fn=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 J(t,e),t}(sn),mn=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},hn=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},vn=function(e){var t=[];return mn(e).forEach((function(e){t=[].concat(t,[e.field])})),hn(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},gn={allowUnknown:!0,stripUnknown:!0},bn=function(e,t,n){var r=Br(e.type,{queryEngineConfig:n}).schema.validate(e,gn).error;if(r)return[new pn(r)];var i=Vr(t,e.dataSetId);if(!i)return[new fn(t,e.dataSetId)];var o=vn(e);try{o.forEach((function(e){Yr(i,e)}))}catch(e){if(e instanceof un)return[e];throw e}return[]},xn=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},yn=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)},wn=function(e){return!!yn(e)||xn(e)},jn=["parentDimension"],Cn=function(e){return e||"view_"+l.v4()};function Sn(e){return te(e,jn)}var Fn=function(e,t,n){var r=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["boolean","string"]})),o=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["date_time"]})),a=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["number"]})),l=null;return o[0]&&(l={field:o[0].id,truncate:"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})},kn=function(e,t){var n=null,r=i.cloneDeep(e);return r.forEach((function(e){var r=Yr(t,e.field);"date_time"==r.dataType&&(n={field:r.id,truncate:e.function})})),r=r.filter((function(e){return"date_time"!=Yr(t,e.field).dataType})),{timeDimension:n,dimension:r}},_n=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},Tn=function(e){if(e){var t=i.cloneDeep(e);return t.measure=pe(e.measure||[]),t}},An={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}};function Dn(e,t){return function(t){return t in e.format_panel}(t)?Q({},e.format_panel[t],{namespace:t}):Q({},e.data_panel[t],{namespace:t})}function In(e,t){var n;return null==(n=e.format_panel.axis_labels)?void 0:n.subSectionDefinition[t]}function On(e){return Q({},Dn(e,"heading"),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function Pn(e){return Q({},Dn(e,"axis_labels"),{y:Q({},In(e,"y"),{prefix:In(e,"y.prefix"),postfix:In(e,"y.postfix"),format:In(e,"y.format"),count:In(e,"y.count"),axisTitle:In(e,"y.axis_title")}),x:Q({},In(e,"x"),{prefix:In(e,"x.prefix"),postfix:In(e,"x.postfix"),format:In(e,"x.format"),count:In(e,"x.count"),axisTitle:In(e,"x.axis_title")})})}function En(e,t,n){var r,i,o,a,l;return Q({},Dn(e,"chart_styles"),t?{subSection:[null==(i=e.format_panel.chart_styles)?void 0:i.subSectionDefinition.curve,null==(o=e.format_panel.chart_styles)?void 0:o.subSectionDefinition.legend]}:n?{subSection:[null==(a=e.format_panel.chart_styles)?void 0:a.subSectionDefinition.stacked,null==(l=e.format_panel.chart_styles)?void 0:l.subSectionDefinition.legend]}:{subSection:[null==(r=e.format_panel.chart_styles)?void 0:r.subSectionDefinition.legend]})}function Mn(e,t){var n;return Q({},null==(n=e.format_panel.stats_labels)?void 0:n.subSectionDefinition[t],{namespace:t})}var Rn=function(e,t){if("current"===(null==e?void 0:e.func)&&t)return e},Ln=function(e){return{title:An.title,description:An.description,servicesClass:"BarChart",namespace:An.namespace,dump:function(e){return e},load:function(t){return Q({},t,{measure:pe(t.measure),order:ce(t.order,t.timeDimension),filter:de(t.filter),protectedFields:Tn(t.protectedFields),viewId:Cn(t.viewId),dimension:Ne(t.dimension),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),parameters:me(t.parameters),conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),headline:Rn(t.headline,t.timeDimension)})},setAttributes:cn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:dn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(An,"data_set"),Dn(An,"views"),Q({},Dn(An,"field_y_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(An,"drilldown"),Q({},Dn(An,"field_x_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(An,"sort"),Dn(An,"filter"),Dn(An,"custom_metrics"),Dn(An,"limit")]},formatPanelConfig:function(){return[On(An),En(An,!1,!0),Pn(An),Q({},Dn(An,"conditional_formatting"),{ruleType:"backgroundColor"}),Dn(An,"goal_line"),Dn(An,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},Nn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("lineChart").required(),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:lt,conditionalFormattingRules:bt(e.queryEngineConfig),goalLines:mt(),axisTitles:vt(),headline:ht()}))},zn=function(e){return function(t,n){var r=Et(t,n,Nn(e));return Pt(r)}},qn={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Bn=function(e){return{title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension),dimension:Ne(t.dimension),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:Cn(t.viewId),filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:Rn(t.headline,t.timeDimension),parameters:me(t.parameters),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),axisTitles:t.axisTitles}},setAttributes:zn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:Nn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(qn,"data_set"),Dn(qn,"views"),Q({},Dn(qn,"field_y_axis"),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(qn,"field_x_axis"),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(qn,"sort"),Dn(qn,"filter"),Dn(qn,"custom_metrics"),Dn(qn,"limit")]},formatPanelConfig:function(){return[On(qn),En(qn,!0,!1),Pn(qn),Q({},Dn(qn,"conditional_formatting"),{ruleType:"lineColor"}),Dn(qn,"goal_line"),Dn(qn,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},Wn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),filter:nt(e.queryEngineConfig),timeDimension:r.valid(null),order:r.array().items(Ze(e.queryEngineConfig)),type:r.valid("pieChart").required(),legend:r.valid(!0,!1),limit:rt(),labelsAsPercentage:r.boolean(),conditionalFormattingRules:bt(e.queryEngineConfig),labelFormat:r.alternatives(r.string(),r.valid(null)),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions)}))},Vn={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Hn=function(e){return{title:Vn.title,description:Vn.description,servicesClass:"PieChart",namespace:Vn.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension),dimension:Ne(t.dimension),viewId:Cn(t.viewId),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),labelsAsPercentage:t.labelsAsPercentage,legend:t.legend,labelFormat:t.labelFormat,parameters:me(t.parameters)}},setAttributes:function(t,n){return Et(t,n,Wn(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{}},t)},createFeedback:wn,schema:Wn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(Vn,"data_set"),Dn(Vn,"views"),Q({},Dn(Vn,"field_metrics"),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(Vn,"field_grouping"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(Vn,"sort"),Dn(Vn,"filter"),Dn(Vn,"custom_metrics"),Dn(Vn,"limit")]},formatPanelConfig:function(){var e,t;return[On(Vn),Q({},Dn(Vn,"conditional_formatting"),{ruleType:"backgroundColor"}),Q({},Dn(Vn,"chart_styles"),{subSection:[null==(e=Vn.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend,null==(t=Vn.format_panel.chart_styles)?void 0:t.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}},Yn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{xMeasure:Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),yMeasure:Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:r.array().items(Ze(e.queryEngineConfig)),limit:rt(),legend:r.valid(!0,!1),offset:r.number().min(0),filter:nt(e.queryEngineConfig),type:r.valid("scatterChart").required(),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:ot,approxXAxisLabelCount:ot,goalLines:mt(),axisTitles:vt()}))},Un=function(e){return function(t,n){var r=Et(t,n,Yn(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})})),It(r,i)}},Gn={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Kn=function(e){return{title:Gn.title,description:Gn.description,servicesClass:"ScatterChart",namespace:Gn.namespace,dump:function(e){return e},load:function(e){return{type:e.type,xMeasure:pe(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:pe(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:Ne(e.dimension),viewId:Cn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:de(e.filter),order:ce(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:fe(e.approxXAxisLabelCount),approxYAxisLabelCount:fe(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles}},setAttributes:Un(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(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:wn,schema:Yn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"scatterChart"),r=n.measure;return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n.dimension})},dataPanelConfig:function(){var e,t;return[Dn(Gn,"data_set"),Dn(Gn,"views"),Q({},Dn(Gn,"labelled_metrics"),{subSection:[Q({},null==(e=Gn.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.xAxis,{propKey:"xMeasure",allowsMultiple:!1}),Q({},null==(t=Gn.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.yAxis,{propKey:"yMeasure",allowsMultiple:!1})]}),Q({},Dn(Gn,"field_grouping"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(Gn,"filter"),Dn(Gn,"custom_metrics"),Dn(Gn,"limit")]},formatPanelConfig:function(){var e;return[On(Gn),Q({},Dn(Gn,"chart_styles"),{subSection:[null==(e=Gn.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend]}),Pn(Gn),Dn(Gn,"goal_line")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},Xn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),barMeasure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),lineMeasure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),barDimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),lineDimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:rt(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),type:r.valid("comboChart").required(),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:ot,approxXAxisLabelCount:ot,goalLines:mt(),conditionalFormattingRules:r.object({bar:r.array().items(Ve(e.queryEngineConfig)),line:r.array().items(Ve(e.queryEngineConfig))}),axisTitles:vt()}))},Qn=function(e){return function(t,n){var r=Et(t,n,Xn(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}),It(r,i)}},Jn={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Zn=function(e){return{title:Jn.title,description:Jn.description,servicesClass:"ComboChart",namespace:Jn.namespace,dump:function(e){return e},load:function(t){return r=e.queryEngineConfig,Q({},n=t,{lineMeasure:pe(n.lineMeasure),barMeasure:pe(n.barMeasure),order:ce(n.order,n.timeDimension||null),filter:de(n.filter),lineDimension:Ne(n.lineDimension||n.dimension||[]),barDimension:Ne(n.barDimension||n.dimension||[]),viewId:Cn(n.viewId),approxXAxisLabelCount:fe(n.approxXAxisLabelCount),approxYAxisLabelCount:fe(n.approxYAxisLabelCount),conditionalFormattingRules:{bar:Rt(r,null==(i=n.conditionalFormattingRules)?void 0:i.bar),line:Rt(r,null==(o=n.conditionalFormattingRules)?void 0:o.line)}});var n,r,i,o},setAttributes:Qn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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:wn,schema:Xn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.lineMeasure.length>0||e.barMeasure.length>0},autoGenerate:function(t){var n=Zr(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(){var e,t;return[Dn(Jn,"data_set"),Dn(Jn,"views"),Q({},Dn(Jn,"labelled_metrics"),{subSection:[Q({},null==(e=Jn.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.line,{propKey:"lineMeasure",allowsMultiple:!0}),Q({},null==(t=Jn.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.bar,{propKey:"barMeasure",allowsMultiple:!0})]}),Dn(Jn,"combo_chart_dimension"),Dn(Jn,"sort"),Dn(Jn,"filter"),Dn(Jn,"custom_metrics"),Dn(Jn,"limit")]},formatPanelConfig:function(){var e,t,n,r,i,o;return[On(Jn),En(Jn,!1,!0),Pn(Jn),Q({},Dn(Jn,"conditional_formatting"),{ruleType:"backgroundColor",subSection:[{title:null!=(e=null==(t=Jn.format_panel.conditional_formatting)||null==(t=t.subSectionDefinition)?void 0:t.bar.title)?e:"",namespace:null==(n=Jn.format_panel.conditional_formatting)||null==(n=n.subSectionDefinition)?void 0:n.bar.namespace,propKey:"bar"},{title:null!=(r=null==(i=Jn.format_panel.conditional_formatting)||null==(i=i.subSectionDefinition)?void 0:i.line.title)?r:"",namespace:null==(o=Jn.format_panel.conditional_formatting)||null==(o=o.subSectionDefinition)?void 0:o.line.namespace,propKey:"line"}]}),Dn(Jn,"goal_line")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},$n=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("dataTable").required(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)).required(),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions).required(),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:rt().required(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),prefixes:r.array().items(He),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:bt(e.queryEngineConfig),dateTimeFormat:r.string(),protectedFields:r.object({dimension:ut(e.queryEngineConfig),measure:st(e.queryEngineConfig)}).unknown(!0),sizing:gt,tableDrilldown:r.array().items(r.object({subsetDimension:r.string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table.")}))},er=function(e){return function(t,n){var r=Et(t,n,$n(e));return Pt(r)}},tr={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{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",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},nr=[3,5,10,20,50,100,200],rr=function(e,t){return e.filter((function(e){return e.pivot==t}))},ir=function(e){return{title:tr.title,description:tr.description,servicesClass:"PivotTable",namespace:tr.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension||null),displayTitle:t.displayTitle,dimension:(r=_n({timeDimension:t.timeDimension,dimension:Ne(t.dimension)}),r.map((function(e){return Q({},e,{pivot:e.pivot?e.pivot:"x"})}))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:Tn(t.protectedFields),viewId:Cn(t.viewId),filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),dateTimeFormat:t.dateTimeFormat,prefixes:t.prefixes,exportNames:t.exportNames,numberFormat:t.numberFormat,sizing:t.sizing,tableDrilldown:(n=t.tableDrilldown,n&&n.length>0?n.map(Sn):n||[])};var n,r},setAttributes:er(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},t)},schema:$n(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"dataTable"),r=n.dimension;return this.init(t.id,{measure:n.measure.slice(0,5),dimension:r})},dataPanelConfig:function(){return[Dn(tr,"data_set"),Dn(tr,"views"),Q({},Dn(tr,"field_columns"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return Q({},e,{pivot:"y"})})),rr(n.dimension,"x"))}},getValues:function(e){return rr(e.dimension,"y")},testId:"add-pivot-dimension"}),Q({},Dn(tr,"field_rows"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return Q({},e,{pivot:"x"})})),rr(n.dimension,"y"))}},getValues:function(e){return rr(e.dimension,"x")},testId:"add-dimension"}),Dn(tr,"drilldown"),Q({},Dn(tr,"field_metrics"),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(tr,"sort"),Q({},Dn(tr,"pagination"),{options:nr}),Dn(tr,"filter"),Dn(tr,"custom_metrics")]},formatPanelConfig:function(){var e;return[On(tr),Q({},Dn(tr,"format"),{subSection:[null==(e=tr.format_panel.format)?void 0:e.subSectionDefinition.time]}),Dn(tr,"prefixes"),Q({},Dn(tr,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}},or=function(e){return function(t,n){var r=Et(t,n,dn(e));return Pt(r)}},ar={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},lr=function(e){return{title:ar.title,description:ar.description,servicesClass:"HorizontalBarChart",namespace:ar.namespace,dump:function(e){return e},load:function(e){return Q({},e,{measure:pe(e.measure),order:ce(e.order,e.timeDimension),dimension:Ne(e.dimension),viewId:Cn(e.viewId),filter:de(e.filter),approxXAxisLabelCount:fe(e.approxXAxisLabelCount),approxYAxisLabelCount:fe(e.approxYAxisLabelCount),protectedFields:Tn(e.protectedFields)})},setAttributes:or(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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:wn,schema:dn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(ar,"data_set"),Dn(ar,"views"),Q({},Dn(ar,"field_y_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(ar,"drilldown"),Q({},Dn(ar,"field_x_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(ar,"sort"),Dn(ar,"filter"),Dn(ar,"custom_metrics"),Dn(ar,"limit")]},formatPanelConfig:function(){return[On(ar),En(ar,!1,!0),Pn(ar),Q({},Dn(ar,"conditional_formatting"),{ruleType:"backgroundColor"}),Dn(ar,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},sr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("areaChart").required(),lineCurve:lt,conditionalFormattingRules:bt(e.queryEngineConfig),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:mt(),axisTitles:vt(),headline:ht()}))},ur=function(e){return function(t,n){var r=Et(t,n,sr(e));return Pt(r)}},dr={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},cr=function(e){return{title:dr.title,description:dr.description,servicesClass:"AreaChart",namespace:dr.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),displayTitle:t.displayTitle,dimension:Ne(t.dimension),timeDimension:t.timeDimension,displaySubject:t.displaySubject,viewId:Cn(t.viewId),filter:de(t.filter),order:ce(t.order,t.timeDimension),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,lineCurve:t.lineCurve,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),protectedByOrganisation:t.protectedByOrganisation,stacked:t.stacked,drilldown:t.drilldown,legend:t.legend,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,goalLines:t.goalLines,parameters:me(t.parameters),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),headline:Rn(t.headline,t.timeDimension)}},setAttributes:ur(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:sr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(dr,"data_set"),Dn(dr,"views"),Q({},Dn(dr,"field_y_axis"),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(dr,"field_x_axis"),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(dr,"sort"),Dn(dr,"filter"),Dn(dr,"custom_metrics"),Dn(dr,"limit")]},formatPanelConfig:function(){var e,t,n;return[On(dr),Q({},Dn(dr,"chart_styles"),{subSection:[null==(e=dr.format_panel.chart_styles)?void 0:e.subSectionDefinition.stacked,null==(t=dr.format_panel.chart_styles)?void 0:t.subSectionDefinition.legend,null==(n=dr.format_panel.chart_styles)?void 0:n.subSectionDefinition.curve]}),Pn(dr),Q({},Dn(dr,"conditional_formatting"),{ruleType:"areaColor"}),Dn(dr,"goal_line"),Dn(dr,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}},pr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{fontSize:r.string().allow(""),formatter:r.object(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),prefixes:r.object(),postfixes:r.object(),type:r.valid("singleStat").required(),limit:rt(),conditionalFormattingRules:bt(e.queryEngineConfig),deltaTimeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions)}))},fr=function(e){if("singleMeasure"in e){var t={},n={},r=[],i={};return e.singleMeasure&&(r=[e.singleMeasure],t[_t(e.singleMeasure)]=e.prefix,n[_t(e.singleMeasure)]=e.postfix,i[_t(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:n,measure:r,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,filter:de(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:me(e.parameters)}}return Q({},e,{filter:de(e.filter)})},mr={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"}}}}},hr=function(e){return{title:mr.title,description:mr.description,servicesClass:"SingleStat",namespace:mr.namespace,dump:function(e){return e},load:function(e){var t=fr(e);return{type:"singleStat",prefixes:t.prefixes,postfixes:t.postfixes,formatter:t.formatter,fontSize:t.fontSize,measure:pe(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:Cn(e.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:me(t.parameters)}},setAttributes:function(t,n){return Et(t,n,pr(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{}},t)},schema:pr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[n.measure[0]]})},dataPanelConfig:function(){return[Dn(mr,"data_set"),Dn(mr,"views"),Q({},Dn(mr,"field_metrics"),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(mr,"filter"),Dn(mr,"custom_metrics"),Dn(mr,"comparison")]},formatPanelConfig:function(){var e;return[On(mr),Q({},Dn(mr,"stats_labels"),{prefix:Mn(mr,"prefix"),postfix:Mn(mr,"postfix"),format:Mn(mr,"format"),count:Mn(mr,"count")}),Q({},Dn(mr,"format"),{subSection:[null==(e=mr.format_panel.format)?void 0:e.subSectionDefinition.font_size]}),Q({},Dn(mr,"conditional_formatting"),{ruleType:"fontColor"})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){var n=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["number"]}));return Q({},e,{type:"singleStat",protectedByOrganisation:!0,measure:[].concat(n).map((function(e){return{function:"none",field:e.id}}))})}}},vr={title:"Custom",servicesClass:"",namespace:"custom",description:"",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:{percentages:!1,simpleMaths:!0,rules:!1,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{colorGradient:!1,parameters:!1}},gr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("mercatorMap").required(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),limit:rt(),dimension:et({},e.attributesSchemaOptions),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()})}))},br=function(e){return function(t,n){return Et(t,n,gr(e))}},xr={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},yr=function(e){return{title:xr.title,description:xr.description,servicesClass:"MercatorMap",namespace:xr.namespace,dump:function(e){return e},load:function(e){return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:Cn(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:pe(e.measure),labelFormat:e.labelFormat,position:e.position,filter:de(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0"}},setAttributes:br(e),validate:function(){return[]},init:function(e,t){return Q({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Cn(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0"},t)},schema:gr(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[Dn(xr,"data_set"),Dn(xr,"views"),Q({},Dn(xr,"field_metrics"),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(xr,"field_country"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(xr,"filter"),Dn(xr,"custom_metrics"),Dn(xr,"limit")]},formatPanelConfig:function(){var e;return[On(xr),Q({},Dn(xr,"chart_styles"),{subSection:[null==(e=xr.format_panel.chart_styles)?void 0:e.subSectionDefinition.number_format]}),Dn(xr,"map_colors")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},wr=function(e){return e.Linear="linear",e.Circular="circular",e}({}),jr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),type:r.valid("progress").required(),limit:rt(),conditionalFormattingRules:bt(e.queryEngineConfig),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goals:r.array().items(r.object({field:r.string().required().description("ID of the field in the data set to which the goal applies too"),value:r.number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:r.array().items(r.object({field:r.string().required().description("ID of the field to set the progress type of"),value:r.valid(wr.Linear,wr.Circular).required()})).description("Set the display type of the progress view"),formatter:r.object().pattern(r.string(),r.string()),prefixes:r.object().pattern(r.string(),r.string()),postfixes:r.object().pattern(r.string(),r.string())}))},Cr={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},Sr=function(e){return{title:Cr.title,description:Cr.description,dump:function(e){return e},namespace:Cr.namespace,servicesClass:"Progress",load:function(e){var t=fr(e);return{type:"progress",measure:pe(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:Cn(t.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,parameters:t.parameters,prefixes:t.prefixes,postfixes:t.postfixes,formatter:t.formatter,goals:t.goals,progressType:t.progressType}},setAttributes:function(t,n){return Et(t,n,jr(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{}},t)},schema:jr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[Dn(Cr,"data_set"),Dn(Cr,"views"),Dn(Cr,"progress_goals"),Dn(Cr,"filter"),Dn(Cr,"custom_metrics")]},formatPanelConfig:function(){return[On(Cr),Dn(Cr,"progress_type"),Q({},Dn(Cr,"stats_labels"),{prefix:Mn(Cr,"prefix"),postfix:Mn(Cr,"postfix"),format:Mn(Cr,"format"),count:Mn(Cr,"count")})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},Fr=["title","description","data_panel","format_panel"],kr=["title","description","callToAction"],_r=r.alternatives().try(r.string(),r.object({sentence:r.string().custom((function(e,t){for(var n,r=/\{\{(\w+)\}\}/g;null!==(n=r.exec(e));){var i=n[1];if(!t.state.ancestors[0][i+"_singular"]||!t.state.ancestors[0][i+"_plural"])return t.error("any.invalid",{message:'"textOverride": "'+i+'" found in sentence but corresponding "'+i+'_singular" and "'+i+'_plural" fields are missing'})}return e}))}).pattern(/.+_(singular|plural)$/,r.string())).messages({"any.custom":"{{#message}}"}),Tr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Ar=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,Dr=/on[a-z]+\s*=\s*["'][^"']*["']/gi,Ir=/javascript:[^\s"']+/gi,Or=new RegExp("^(?:"+/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source+"|"+/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source+"|[^*_<>])*$","m"),Pr=function(e){if(Tr.test(e)||Ar.test(e)||Dr.test(e)||Ir.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return Or.test(e)},Er=function(e,t,n,r){return Mr(e,t,n,void 0,r)},Mr=function(e,t,n,r,i){if(i)return"[key: "+e+"]";var o,a=r?function(e,t){var n=e[t],r=_r.validate(n);return r.error&&r.error.details.forEach((function(e){var t;Ae(null==(t=e.context)?void 0:t.message)})),function(){if("string"==typeof n)return Pr(n);if("object"==typeof n)return Pr(n.sentence);if(void 0===n)return!0;throw new Error("Invalid translation type")}()?n:void 0}(r,e):void 0;return o=function(e,t){return t?e.replace(/\[\[([^\]]+)\]\]/g,(function(e,n){for(var r,i=ie(n.split("|"));!(r=i()).done;){var o=t[r.value];if("string"==typeof o&&""!==o)return o;if("number"==typeof o)return o.toString()}return""})):e}(o="object"==typeof a&&null!==a?a.sentence:"string"==typeof a?a:t,n),n&&(o=function(e,t,n){return Object.entries(t).forEach((function(t){var r=t[0],i=t[1];if(i&&"object"==typeof i&&"count"in i){var o=1===i.count?n&&n[r+"_singular"]||i.singular:n&&n[r+"_plural"]||i.plural;e=e.replace(new RegExp("{{"+r+"}}","g"),o)}})),e}(o,n,a)),function(e,t){if(!t)return e;for(var n=0,r=Object.entries(t);n<r.length;n++){var i=r[n],o=i[1];if("string"==typeof o||"number"==typeof o){var a=new RegExp("\\[\\["+i[0]+"\\]\\]","g");e=e.replace(a,String(o))}}return e}(o,n)},Rr=function(e,t){var n=null!=t?t:Mr,r=e,i=e.namespace;return Fr.forEach((function(t){if("title"===t||"description"===t){var o,a=n(i+"."+t,e[t]);r=Q({},r,((o={})[t]=a,o))}if("data_panel"===t){var l=i+"."+t,s=[];e.dataPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Nr(e,n,l)),zr(e).forEach((function(t){var r=n(l+"."+t.key,t.defaultValue);e[t.property]=r})),s.push(e)})),r=Q({},r,{dataPanelConfig:function(){return s}})}if("format_panel"===t){var u=i+"."+t,d=[];e.formatPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Nr(e,n,u)),function(e,t,n){function r(n,r){n&&zr(n).forEach((function(i){var o=e(t+"."+r+"."+i.key,i.defaultValue);n[i.property]=o}))}function i(e,t,n){t.forEach((function(t){var i=e[t];i&&r(i,n)}))}n.x&&(i(n.x,Lr,"axis_labels"),r(n.x,"axis_labels")),n.y&&(i(n.y,Lr,"axis_labels"),r(n.y,"axis_labels")),function(e){return"prefix"in e}(n)&&i(n,Lr,"stats_labels")}(n,u,e),zr(e).forEach((function(t){var r=n(u+"."+t.key,t.defaultValue);e[t.property]=r})),d.push(e)})),r=Q({},r,{formatPanelConfig:function(){return d}})}})),r},Lr=["count","axisTitle","format","postfix","prefix"];function Nr(e,t,n){var r;return null==(r=e.subSection)?void 0:r.map((function(r){return zr(r).forEach((function(i){var o=t(n+"."+e.namespace+"."+i.key,i.defaultValue);r[i.property]=o})),r}))}function zr(e){var t=e.namespace||e.type;if(!t)return[];var n=[];return kr.forEach((function(r){if(e[r]){var i=r;"callToAction"===r&&(i="call_to_action"),n.push({key:t+"."+i,defaultValue:e[r],property:r})}})),n}var qr={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function Br(e,t){if("custom"==e)return vr;if("barChart"==e)return Rr(Ln(t||qr),null==t?void 0:t.textOverride);if("areaChart"==e)return Rr(cr(t||qr),null==t?void 0:t.textOverride);if("lineChart"==e)return Rr(Bn(t||qr),null==t?void 0:t.textOverride);if("pieChart"==e)return Rr(Hn(t||qr),null==t?void 0:t.textOverride);if("scatterChart"==e)return Rr(Kn(t||qr),null==t?void 0:t.textOverride);if("comboChart"==e)return Rr(Zn(t||qr),null==t?void 0:t.textOverride);if("dataTable"==e)return Rr(ir(t||qr),null==t?void 0:t.textOverride);if("basicTable"==e)return Rr(si(t||qr),null==t?void 0:t.textOverride);if("singleStat"==e)return Rr(hr(t||qr),null==t?void 0:t.textOverride);if("progress"==e)return Rr(Sr(t||qr),null==t?void 0:t.textOverride);if("mercatorMap"==e)return Rr(yr(t||qr),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return Rr(lr(t||qr),null==t?void 0:t.textOverride);throw"Cannot get interface for "+e+". Please implement it."}function Wr(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=Br(t);return[].concat(e).filter((function(e){var t=!0;return Ht(e)&&!n.supportedCustomFields.percentages&&(t=!1),Bt(e)&&!n.supportedCustomFields.simpleMaths&&(t=!1),Yt(e)&&!n.supportedCustomFields.rules&&(t=!1),Wt(e)&&!n.supportedCustomFields.roundedNumbers&&(t=!1),t}))}(n,t.forComponent)),null!=t&&t.removePercentage&&(n=n.filter((function(e){return!Ht(e)}))),null!=t&&t.removeRuleGrouping&&(n=n.filter((function(e){return!Yt(e)}))),null!=t&&t.removeSimpleMaths&&(n=n.filter((function(e){return!Bt(e)}))),null!=t&&t.removeAggregateMaths&&(n=n.filter((function(e){return!Vt(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 Vr=function(e,t){return e.find((function(e){return e.id==t}))||null},Hr=function(e,t){return e.find((function(e){return e.name==t}))||null},Yr=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n;throw new un(e,t)},Ur=function(e,t){var n=[].concat(e.fields).find((function(e){return e.publicName==t}));if(n)return n;throw"Failed to find field by name in data set. Looking for "+t},Gr=function(e,t){var n=i.findIndex(e,(function(e){return e.id==t}));return[e[n]||null,n]},Kr=function(e,t){return Q({},e,{fields:[].concat(e.fields).map((function(e){return function(e,t,n){var r,o=(r=function e(t,n,r){var o=i.replace(t,n,r);return o.indexOf(n)>=0?e(o,n,r):o}(e.id,"_"," ")).charAt(0).toUpperCase()+r.slice(1);return{id:e.id,dataType:e.dataType,publicName:e.publicName||o,dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],description:e.description||void 0,canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?ae(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities,supportedAggregateOptions:We(t,e.dataType,e.supportedAggregateOptions)}}(e,t)}))})},Xr=function(e,t){var n=[].concat(e.fields).filter(Gt);return t&&(n=Wr(n,{forComponent:t})),n},Qr=function(e){return Q({},e,{fields:[].concat(e.fields).filter((function(e){return!Gt(e)}))})},Jr=function(e,t){return[].concat(e).map((function(e){return e.id==t.id?t:e}))},Zr=function(e,t,n){var r="horizontalBarChart"===n?void 0:"x",i=function(e){return[].concat(Wr(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0}))}(e)[0],o=[].concat(function(e,t){return[].concat(Wr(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t}))}(e,n)).map((function(e){var n=Oe(e,t.supportedAggregates);return{field:e.id,function:n}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:r}]:[]}},$r=function(e,t,n){var r=Wr(e.fields,{removeAggregateMaths:!0,removePercentage:!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}},ei=function(e){if(!e.preAggregated)throw"buildViewOnlyQuery function should only be used for single-view datasets";return{dataSetId:e.id,preparedQueryType:"preAggregated",type:"preparedQuery",filter:{}}},ti=function(e,t){if(!t)return e;e=e.map(Qr);var n=[].concat(e).map((function(e){var n=(t[e.id]||[]).map(Qt);return Q({},e,{fields:[].concat(e.fields,n)})}));return[].concat(n)},ni=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:ae({dataType:t},e)}},ri=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"string",t,n,r)},ii=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"number",t,n,r)},oi=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"boolean",t,n,r)},ai=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:ae({dataType:"date_time"},e),canBeDimension:null==(a=r.canBeDimension)||a,canBeMeasure:null!=(l=r.canBeMeasure)&&l}},li={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},si=function(e){return{title:li.title,description:li.description,servicesClass:"BasicTable",namespace:li.namespace,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(t){return Q({},t,{measure:pe(t.measure),order:ce(t.order,t.timeDimension),filter:de(t.filter),dimension:Ne(t.dimension),viewId:Cn(t.viewId),protectedFields:Tn(t.protectedFields),conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules)})},setAttributes:Mt(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(t,n){var r={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],dataSetId:t,viewId:Cn(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 Mt(e)(r,n||{})},schema:yt(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},setFields:function(t,n){var r=[].concat(n).map((function(e){return{field:e,function:"none"}}));return Mt(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=Wr(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!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[Dn(li,"data_set"),Dn(li,"views"),Dn(li,"fields"),Dn(li,"sort"),Q({},Dn(li,"pagination"),{options:nr}),Dn(li,"filter"),Dn(li,"custom_metrics")]},formatPanelConfig:function(){var e;return[On(li),Q({},Dn(li,"format"),{subSection:[null==(e=li.format_panel.format)?void 0:e.subSectionDefinition.time]}),Dn(li,"prefixes"),Q({},Dn(li,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}},ui=function(e,t){return s.scale(e).colors(t)},di=function(e,t){var n;return(null!=t?t:0)<=(null!=(n=null==e?void 0:e.length)?n:0)?e:fi(ui(e,t))},ci={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},pi=function(e){var t=1e4*Math.sin(e++);return t-Math.floor(t)},fi=function(e,t){void 0===t&&(t=5);for(var n,r,i=e.length;i;)r=Math.floor(pi(t)*i--),n=e[i],e[i]=e[r],e[r]=n,++t;return e},mi=function(e){return"displayTitle"in e},hi=[].concat(["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","custom"]).filter((function(e){return"custom"!=e})),vi=function(e){return{attributes:e,localFilters:[],results:[],colSpan:1,reports:[],updatesFromParameters:{}}},gi=function(e,t){if("dateFilter"==e)return t("date_filter","Date filter");if("dateAndTimeFilter"==e)return t("date_time_filter","Date Time filter");if("singleSelectFilter"==e)return t("single_select_filter","Single select filter");if("multiSelectFilter"==e)return t("multi_select_filter","Multi select filter");throw"Unrecognised additional filter type "+e},bi=function(e){return Q({},e,{managedByConfiguration:!1})},xi=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):Q({},e,{type:Si(e.type)})},yi=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[]"==Yr(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)}))},wi=function(e,t,n){var r=[];return(e.globalFilters||[]).forEach((function(e){r=[].concat(r,yi(t,e,n))})),Object.values(e.localFilters||{}).flat().forEach((function(e){r=[].concat(r,yi(t,e,n))})),r},ji=function(e,t,n){if(e.title)return e.title;var r=n?n("untitled","Untitled"):"Untitled";return t.forEach((function(t){try{var n=e.appliesToFields[0],i=Yr(t,n.fieldId);t.id==n.dataSetId&&n.fieldId==i.id&&(r=i.publicName)}catch(e){}})),r},Ci=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}))},Si=function(e){return"dateTimeFilter"===e?"dateFilter":e};function Fi(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=Vr(t,o);e[o]||(e[o]=[]),null!==a&&(e[o]=[].concat(e[o],yi(a,r,n)))}))}return e}),{});return 0===Object.keys(i).length?void 0:i}}var ki=function(e){return"optionsPulledFrom"in e&&e.optionsPulledFrom&&0!==e.optionsPulledFrom.length?Q({},e,{appliesToFields:[].concat(e.optionsPulledFrom)}):e},_i=function(e,t){if("isEmpty"in e||mi(e))return e;var n=(0,Br(e.attributes.type,t).load)(e.attributes),r=[];return i.isArray(e.localFilters)&&(r=[].concat(e.localFilters?e.localFilters:[]).map((function(e){return xi(e)}))),"addOns"in e.attributes&&i.isEmpty(r)&&e.attributes.addOns.forEach((function(e){r=[].concat(r,[{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:n.dataSetId}]}])})),delete e.addOns,delete n.addOns,Q({},e,{localFilters:r,attributes:n,results:[]})},Ti=function(e){if(Li(e)||mi(e))return e;var t=[].concat(e.localFilters&&i.isArray(e.localFilters)?e.localFilters:[]).map(bi);return Q({},e,{results:void 0,queries:void 0,attributes:Q({},e.attributes,{offset:void 0}),localFilters:t})},Ai=function(e){return r.alternatives().conditional(".type",{is:"barChart",then:Ln(e).schema}).conditional(".type",{is:"mercatorMap",then:yr(e).schema}).conditional(".type",{is:"horizontalBarChart",then:lr(e).schema}).conditional(".type",{is:"lineChart",then:Bn(e).schema}).conditional(".type",{is:"comboChart",then:Zn(e).schema}).conditional(".type",{is:"areaChart",then:cr(e).schema}).conditional(".type",{is:"pieChart",then:Hn(e).schema}).conditional(".type",{is:"scatterChart",then:Kn(e).schema}).conditional(".type",{is:"singleStat",then:hr(e).schema}).conditional(".type",{is:"dataTable",then:ir(e).schema}).conditional(".type",{is:"basicTable",then:si(e).schema}).conditional(".type",{is:"progress",then:Sr(e).schema})},Di=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},Ii=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},Oi=function(e){return{colSpan:e,isEmpty:!0}};function Pi(e){return 1===e?12:e<5?12/e:2}var Ei=function(e,t){for(var n,r=i.cloneDeep(e),o=[].concat(r[t].components),a=Oi(Pi(o.length+1)),l=(o=[].concat(o,[a])).length-1,s=0;s<((n=o.length)>2&&n<5?3:2);s++){var u=Di(r,t,l,"left");o.length<5?o[s].colSpan=Pi(o.length):o[u].colSpan=o[u].colSpan-1,r[t]={components:[].concat(o),height:r[t].height}}return r},Mi=function(e,t,n,r){var i=[].concat(e),o=[].concat(i[n].components);return o[r]=Q({},t,{colSpan:o[r].colSpan}),i[n]={components:o,height:i[n].height},i},Ri=function(e,t){return{components:e,height:null!=t?t:350}},Li=function(e){return"isEmpty"in e};function Ni(e){for(var t,n=ie(e);!(t=n()).done;)for(var r,i=ie(t.value.components);!(r=i()).done;){var o=r.value;if(!("isEmpty"in o)||!0!==o.isEmpty)return!1}return!0}var zi=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},qi=function(e,t){return e.map((function(e){return function(e,t){var n=function(e){return"components"in e?e:{components:e,height:350}}(e),r=i.sumBy(n.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}:Li(e)||mi(e)?e:_i(Q({},e,{colSpan:e.colSpan}),t)}));return{components:zi(l),height:n.height||350}}(e,t)}))},Bi=function(e){return{display:e.display,componentLibrary:e.componentLibrary,isPlayground:!1,globalFilters:[],customFields:{}}},Wi={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},Vi={emptyDashboard:function(){var e=new Date;return{id:void 0,parentDashboardId:void 0,createdAt:e,updatedAt:e,metadata:{},display:[],globalFilters:[],componentLibrary:[]}},insertRow:function(e,t,n){return Q({},e,{display:Ii(e.display,t,null==n?void 0:n.height)})},setComponentOnDisplay:function(e,t,n,r){return Q({},e,{display:Mi(e.display,vi(t),n,r)})},listComponentTypesUsed:function(e){return t=[],e.display.forEach((function(e){e.components.forEach((function(e){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.type]))}))})),i.uniq(t);var t},appendEmptyCell:function(e,t){return Q({},e,{display:Ei(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){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t)}},Hi={setComponent:Mi,newEmptyCell:Oi,initRow:Ri,init:function(){return[]}},Yi=function e(t){return t.startsWith("/")?e(t.slice(1)):t.endsWith("/")?e(t.slice(0,-1)):t},Ui=function(e,t){var n=Yi(e),r=Yi(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},Gi=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},r&&(o.auth="Bearer "+r),a="",i&&(a="filter="+i.join(",")),t.next=6,e({path:"/api/v2/auth/project/"+n+"/access_token?"+a,method:"get",headers:o});case 6:if(s=(l=t.sent).body,200!=l.status){t.next=11;break}return t.abrupt("return",s.token.token);case 11:return t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Ki=function(){var e=X(G().mark((function e(t,n){var r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.dashboardAccessToken){e.next=3;break}return Fe("Using dashboard access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.dashboardAccessToken});case 3:if(!t.projectAccessToken){e.next=6;break}return Fe("Using project access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.projectAccessToken});case 6:if(!t.apiKey){e.next=11;break}return Fe("Using API Key for auth header"),e.abrupt("return",{auth:"Api-Key "+t.apiKey});case 11:if(!n.preFetchProjectAccessTokens||!t.useCookieAuth&&!t.appSessionAuthToken){e.next=24;break}return Fe("Fetching project access token from the Vizzly API",n.preFetchProjectAccessTokens.projectId,"Filtering by",n.preFetchProjectAccessTokens.resourceFilters),e.next=15,Gi(Xi(t))(n.preFetchProjectAccessTokens.projectId,t.appSessionAuthToken,n.preFetchProjectAccessTokens.resourceFilters);case 15:if(!(r=e.sent)){e.next=21;break}return Fe("Project access token received."),e.abrupt("return",{auth:"Bearer "+r});case 21:Fe("Failed to receive project access token.");case 22:e.next=25;break;case 24:Fe("Not pre-fetching project access token.");case 25:return e.abrupt("return",{});case 26:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Xi=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Ki(e,n);case 3:return r=t.sent,i=n.headers||{},o=Ui(e.host,n.path),t.next=8,u(o,{method:n.method,headers:Q({"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,Fe("HTTP Client Response",{host:e.host,path:n.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),t.abrupt("return",{body:l,status:a.status,headers:a.headers});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"},headers:null});case 21:throw t.t0;case 22:case"end":return t.stop()}}),t,null,[[0,16]])})));return function(e){return t.apply(this,arguments)}}()},Qi=function(e){return X(G().mark((function t(){var n,r;return G().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{id:e.id,created_at:e.created_at,updated_at:e.updated_at,webhook_id:e.webhook_id}})));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})))},Ji=function(e){return function(){var t=X(G().mark((function t(n){return G().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)}}()},Zi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboardAccess",n}return J(t,e),t}(ee(Error)),$i=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a;return G().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 Zi("Failed to fetch dashboard access");case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},eo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToGetDashboard",n}return J(t,e),t}(ee(Error)),to=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o;return G().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:r});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",o);case 7:throw new eo("Failed to get dashboard from POST /api/v2/multi-get-dashboard.");case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},no=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i);case 7:throw new eo("Failed to get potentially encrypted dashboard from POST /api/v2/multi-get-dashboard.");case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ro=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboard",n}return J(t,e),t}(ee(Error)),io=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="DashboardQuotaReached",n}return J(t,e),t}(ee(Error)),oo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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.metadata||n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 2:if(i=(r=t.sent).body,200!=(o=r.status)){t.next=7;break}return t.abrupt("return",{dashboard:i.dashboard,permissions:i.permissions});case 7:if(422!=o){t.next=9;break}throw new io("Dashboard quota reached; "+JSON.stringify(i));case 9:throw new ro("Failed to update the dashboard from POST /api/v2/dashboard");case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ao=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToUpdateDashboard",n}return J(t,e),t}(ee(Error)),lo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.metadata||n.meta||{},t.next=3,e({path:"/api/v2/dashboard",method:"put",body:Q({},n,{meta:r})});case 3:if(o=(i=t.sent).body,200!=i.status){t.next=8;break}return t.abrupt("return",o);case 8:throw new ao("Failed to update dashboard from PUT /api/v2/dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},so=function(e){return e.map((function(e){return{name:e.name,description:e.description||"",fields:e.fields.map((function(e){var t=[],n=["none"];return"date_time"==e.dataType?n=[].concat(n,e.allowedGranularities||[]):t=[].concat(t,e.supportedAggregateOptions||[]),{name:e.publicName,description:e.description||"",canBeDimension:e.canBeDimension,canBeMeasure:e.canBeMeasure,availableFunctionsInSelect:t,availableFunctionsInGrouping:n}}))}}))},uo=function(e){function t(){var n;return(n=e.call(this,"There has been an error with the AI. Please try again.")||this).name="AIContainsErrors",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error)),co=function(e,t){var n=i.cloneDeep(t);if("custom"===n.type)throw"Custom views are not supported by Vizzly AI.";var r,o,a,l=[],s=[],u=[],d={orWhereClauses:[]},c=[],p=[],f=n.displayTitle,m=n.displaySubject,h=n.limit;return"goalLines"in n&&(c=null==(r=n.goalLines)?void 0:r.map((function(e){return{value:e.value,color:e.color,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth}}))),"conditionalFormattingRules"in n&&Array.isArray(n.conditionalFormattingRules)&&(p=null==(o=n.conditionalFormattingRules)?void 0:o.map((function(e){return{color:e.ruleValue,field:e.filters[0][0].field,function:e.filters[0][0].function,op:e.filters[0][0].op,value:e.filters[0][0].value}}))),"measure"in n&&(l=n.measure.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function}}))),"dimension"in n&&(s=n.dimension.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function}}))),"order"in n&&(u=n.order.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function,direction:t.direction}}))),"filter"in n&&(d={orWhereClauses:null==(a=n.filter||[])?void 0:a.map((function(t){return{andWhereClauses:t.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function,op:t.op,value:t.value}}))}}))}),{title:f,subtitle:m,type:n.type,dataSetName:e.name,select:l,group:s,order:u,goalLines:c,conditionalFormatting:p,filter:d,limit:h}},po=function(e,t,n,r){var o,a,l,s,u=i.cloneDeep(t),d=Hr(e,n.dataSetName);if(!d)throw"Failed to find data set by name";return"title"in n&&(u.displayTitle=n.title||u.displayTitle),"limit"in u&&"limit"in n&&(u.limit=n.limit),"filter"in u&&"filter"in n&&(u.filter=null==(o=(null==(a=n.filter)?void 0:a.orWhereClauses)||[])?void 0:o.map((function(e){return e.andWhereClauses.map((function(e){return{field:Ur(d,e.field).id,function:e.function,op:e.op,value:e.value}}))}))),"subtitle"in n&&(u.displaySubject=n.subtitle||u.displaySubject),"measure"in u&&"select"in n&&(u.measure=(n.select||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function}}))),"dimension"in u&&"group"in n&&(u.dimension=(n.group||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function}}))),"goalLines"in u&&"goalLines"in n&&(u.goalLines=null==(l=n.goalLines)?void 0:l.map((function(e){return{strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,color:e.color,value:e.value}}))),"order"in u&&"order"in n&&(u.order=(n.order||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function,direction:e.direction}}))),"conditionalFormattingRules"in u&&"conditionalFormatting"in n&&(u.conditionalFormattingRules=null==(s=n.conditionalFormatting)?void 0:s.map((function(e){var t=Ur(d,e.field);return{ruleType:"backgroundColor",ruleValue:e.color,filters:[[{field:t.id,function:e.function,op:e.op,value:e.value}]]}}))),n.type&&t.type!=n.type&&(u=Br(n.type,{queryEngineConfig:r}).init(d.id,Q({},u,{type:n.type}))),function(e,t){var n=Br(e.type,{queryEngineConfig:t}).schema.validate(e,{stripUnknown:{arrays:!0,objects:!0},allowUnknown:!1,abortEarly:!1}),r=n.error,i=n.value;return r&&Te("AI attribute errors",r),i}(u,r)},fo=function(e,t,n,r){if(!Hr(r,e.ai_view.dataSetName))throw Te("The AI returned an invalid data set ID. This is likely due to a bug in the AI. Please contact support."),new uo;return{conversationId:e.conversation_id,attributes:po(r,t,e.ai_view,n),messageHistory:e.conversation_content.messages.map((function(e){return{id:e.id,content:e.content,reaction:e.reaction,sender_type:e.sender_type,sent_at:new Date(e.sent_at),status:e.status}}))}},mo=function(e){function t(n){var r;return void 0===n&&(n="AI usage limit reached"),(r=e.call(this,n)||this).name="AIUsageLimitReached",Object.setPrototypeOf(ne(r),t.prototype),r}return J(t,e),t}(ee(Error)),ho=function(e){function t(){var n;return(n=e.call(this,"Something went wrong while fetching data from the AI.")||this).name="AIFailedToFetch",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error)),vo=function(e){function t(){var n;return(n=e.call(this,"User aborted AI request.")||this).name="AIAborted",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error));function go(e,t){if(200!=e){if(422==e||429==e)throw Fe("askAi","AI usage limit reached",t),new mo(t.quota+" queries per hour allowed.");if(500===e&&t&&"reason"in t&&"Aborted"===t.reason)throw new vo;throw new ho}}var bo=function(e){return function(){var t=X(G().mark((function t(n,r,i,o,a,l,s){var u,d,c,p;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=co(Vr(a,r.dataSetId),r),t.next=3,e({path:"/api/ai",method:"post",body:{question:i,conversationId:n,currentAttributes:u,dataSets:so(a),dashboardAccessToken:o},abortSignal:s});case 3:return go((d=t.sent).status,c=d.body),p=fo(c,r,l,a),t.abrupt("return",p);case 9:case"end":return t.stop()}}),t)})));return function(e,n,r,i,o,a,l){return t.apply(this,arguments)}}()},xo=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 J(t,e),t}(ee(Error)),yo=function(e){return e.ConfigStore="cnf_",e.Project="prj_",e.KeyPair="kyp_",e.Dashboard="dsh_",e.ProjectApiKey="vizzly_project_api_key_",e}({}),wo=function(e){return function(){var t=X(G().mark((function t(n,r){var i;return G().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:[yo.Project,yo.ConfigStore]}:void 0});case 2:if(200==(i=t.sent.status)){t.next=6;break}throw new xo(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)}}()},jo=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 J(t,e),t}(ee(Error)),Co=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o;return G().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:[yo.Project]}});case 2:if(200==(o=t.sent.status)){t.next=6;break}throw new jo(o);case 6:return t.abrupt("return",200==o);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},So=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a;return G().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:[yo.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 Fe("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)}}()},Fo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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:[yo.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)}}()},ko=function(e){return function(){var t=X(G().mark((function t(n){return G().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:[yo.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)}}()},_o=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:Q({},i),preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project,yo.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)}}()},To=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/question-suggestions",method:"post",body:{dataSets:so(r),dashboardAccessToken:n}});case 2:if(go(a=(i=t.sent).status,o=i.body),200!=a){t.next=8;break}return t.abrupt("return",{suggestions:o.suggestions});case 8:throw"Failed to fetch question suggestions from AI.";case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},Ao=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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:[yo.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)}}()},Do=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:[yo.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)}}()},Io=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:"put",body:{query_engine_user_id:r,password:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project]}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Oo=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o;return G().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:[yo.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)}}()},Po=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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)}}()},Eo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Mo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Ro=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Lo=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a,l;return G().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)}}()},No=function(e){function t(t){var n;return(n=e.call(this,"Failed to save an encrypted secret for "+t)||this).name="FailedToSaveProjectEncryptedEncryptionSecret",n}return J(t,e),t}(sn),zo=function(e){function t(t){var n;return(n=e.call(this,"An encrypted secret has already been saved for "+t)||this).name="ProjectEncryptedSecretAlreadySaved",n}return J(t,e),t}(sn),qo=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i=!1),t.next=3,e({path:"/api/v3/project/"+n+"/encrypted-encryption-secret",method:"post",body:{projectId:n,encryptedEncryptionSecret:r,allowRotation:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project]}});case 3:if(400!=(o=t.sent.status)||!i){t.next=9;break}throw new No(n);case 9:if(400!=o||i){t.next=11;break}throw new zo(n);case 11:return t.abrupt("return",200==o);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Bo=function(e){return function(){var t=X(G().mark((function t(n,r,i,o){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/conversation/"+n+"/message/"+r,method:"post",body:{reaction:o.reaction,dashboardAccessToken:i}});case 2:return t.abrupt("return",Wo(t.sent));case 4:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},Wo=function(e){if(200===e.status)return{success:!0};throw new Error("AI Action failed")},Vo=function(e){var t=Xi(e);return{config:e,getParentDashboards:Qi(t),saveScheduledReport:Ji(t),createDashboardAccess:$i(t),multiGetDashboards:to(t),multiGetEncryptedDashboards:no(t),createDashboard:oo(t),updateDashboard:lo(t),askAi:bo(t),aiActions:Bo(t),askAiForQuestionSuggestions:To(t),createVizzlyConfigVersion:wo(t),getVizzlyConfig:So(t),saveConnection:Co(t),getConnection:Fo(t),createProjectApiKey:ko(t),updateProjectApiKey:_o(t),getProjectAccessToken:Gi(t),getProject:Ao(t),createQueryEngineUser:Do(t),updateQueryEngineUser:Io(t),getQueryEngineUser:Oo(t),getProjectTeamMembers:Po(t),createSelfHostedQueryEngineProject:Eo(t),createSelfHostedDynamicQueryEngineProject:Mo(t),createSelfHostedInBrowserQueryEngineProject:Ro(t),getManagedQueryEngineKeyPair:Lo(t),saveEncryptedProjectEncryptionSecret:qo(t)}},Ho=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadIdentity",n}return J(t,e),t}(ee(Error)),Yo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="InvalidIdentityReturn",n}return J(t,e),t}(ee(Error)),Uo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadQueryEngineConfig",n}return J(t,e),t}(ee(Error)),Go=function(e){function t(){return e.apply(this,arguments)||this}return J(t,e),t}(ee(Error)),Ko=function(e,t){return[].concat(e.supportedFeatures).includes(t)},Xo=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 J(t,e),t}(ee(Error)),Qo=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 J(t,e),t}(ee(Error)),Jo=function(e){return"string"==typeof e?{}:e.customHeaders?e.customHeaders():{}},Zo=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={host:na(e)},i=Q({},n,{headers:Q({},n.headers,Jo(e))}),t.abrupt("return",Xi(r)(i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},$o=function(){var e=X(G().mark((function e(t){var n,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Zo(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:Q({},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)}}(),ea={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards"],supportedTimeTruncFunctions:Ft(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:ge(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:ue([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:Be(["round_to_0_dp","round_to_2_dp"])},ta=function(){var e=X(G().mark((function e(t){var n,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"in-browser"!==t){e.next=5;break}return e.abrupt("return",ea);case 5:if(!("string"==typeof t||"object"==typeof t&&"endpoint"in t)){e.next=16;break}if(o=void 0,(o="string"==typeof(i=t)?i:i.endpoint).startsWith("http://")||o.startsWith("https://")||o.startsWith("/")){e.next=8;break}throw new Xo(t);case 8:return e.next=10,$o(t);case 10:if(n=e.sent){e.next=13;break}throw new Uo("Failed to load query engine config.");case 13:return e.abrupt("return",n);case 16:if("function"!=typeof t){e.next=25;break}return e.next=19,t();case 19:if(r=e.sent){e.next=22;break}throw new Uo("Failed to load query engine config.");case 22:return e.abrupt("return",Q({},r));case 25:throw new Qo;case 26:e.next=35;break;case 28:if(e.prev=28,e.t0=e.catch(0),!(e.t0 instanceof Xo)){e.next=32;break}throw e.t0;case 32:if(!(e.t0 instanceof Qo)){e.next=34;break}throw e.t0;case 34:throw new Uo("Failed to load query engine config.");case 35:case"end":return e.stop()}var i,o}),e,null,[[0,28]])})));return function(t){return e.apply(this,arguments)}}(),na=function(e){return"string"==typeof e?e:e.endpoint},ra=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToResolveDataSets",n}return J(t,e),t}(ee(Error)),ia=function(e){function t(){var t;return(t=e.call(this,"Identity prop type is invalid.")||this).name="InvalidIdentityPropType",t}return J(t,e),t}(ee(Error)),oa=function(e){function t(){var t;return(t=e.call(this,"dataSets property is not valid")||this).name="InvalidDataSetsPropType",t}return J(t,e),t}(ee(Error)),aa=function(e){return Q({},(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},la=function(e,t,n,r){var i=aa(e);"scope"in i||(i.scope="read_write");var o={dashboardAccess:i,dataAccess:t?aa(t):void 0,queryEngineAccessConfig:n?aa(n):void 0,dashboardAdminOverride:r?aa(r):void 0};return sa(o),o},sa=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)},ua=function(e){if(!e)throw new Yo("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 Yo(t.message);return e},da=function(){var e=X(G().mark((function e(t){var n,r,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:if(n=ua(n=e.sent)){e.next=6;break}throw new Ho("Failed to fetch identity config.");case 6:return r=ca()&&((o=window.location.href).split("#vizzly_")[1]||new URLSearchParams(new URL(o).search).get("_vizzlyDashboardAdmin"))||null,i=la(n.dashboardAccessToken,n.dataAccessToken,n.queryEngineAccessToken,r),e.abrupt("return",{identityConfig:i,tokens:n});case 9:case"end":return e.stop()}var o}),e)})));return function(t){return e.apply(this,arguments)}}(),ca=function(){return"undefined"!=typeof window},pa=[{namespace:"config.supported_operator",constants:oe},{namespace:"config.supported_aggregate",constants:he},{namespace:"config.supported_time",constants:wt}],fa=function(e,t,n){var r={};return Object.entries(e).forEach((function(e){var i=e[0],o=e[1];r[i]=Q({},o,{publicName:t(n+"."+i,o.publicName)})})),r},ma=function(e,t){var n=Q({},e);return n.supportedAggregates&&(n.supportedAggregates=fa(n.supportedAggregates,t,pa[1].namespace)),n.supportedTimeTruncFunctions&&(n.supportedTimeTruncFunctions=fa(n.supportedTimeTruncFunctions,t,pa[2].namespace)),n.supportedOperators&&(n.supportedOperators=fa(n.supportedOperators,t,pa[0].namespace)),n},ha=function(e,n,r,i){var o,a,l=t.useState(),s=l[0],u=l[1],d=t.useState({dataSets:void 0,queryEngineConfig:void 0,identityConfig:void 0}),c=d[0],p=d[1];return o=X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,Fe("Fetching identity config."),t.next=4,da(e);case 4:p(Q({},c,{identityConfig:t.sent.identityConfig})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),Te("Failed to refresh identity tokens.");case 12:case"end":return t.stop()}}),t,null,[[0,9]])}))),a=t.useRef(),t.useEffect((function(){a.current=o})),t.useEffect((function(){var e=setInterval((function(){a.current&&a.current()}),12e5);return function(){return clearInterval(e)}}),[12e5]),t.useEffect((function(){!function(){var t=X(G().mark((function t(){var o,a,l;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof e){t.next=3;break}throw new ia;case 3:return t.next=5,Promise.all([ta(r),da(e)]);case 5:return l=(o=t.sent)[1].identityConfig,a=ma(a=o[0],i),t.next=11,n(l,a);case 11:p({dataSets:t.sent,queryEngineConfig:a,identityConfig:l}),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),t.t0 instanceof Ho||t.t0 instanceof Uo||t.t0 instanceof Go||t.t0 instanceof Yo||t.t0 instanceof ra||t.t0 instanceof Xo||t.t0 instanceof Qo||t.t0 instanceof ia||t.t0 instanceof oa?u(t.t0):(Ae("Unknown error",t.t0),u(new Ho("Failed to load identity")));case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}()()}),[]),Q({},c,{error:s})},va=r.string().required(),ga=r.object({dataSetId:va,fieldId:r.string().required()}),ba=r.object({field:ga.required(),op:r.string().required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.array()).required(),function:r.string().optional()}),xa=r.object().pattern(va,r.array().items(ba)),ya=r.object({type:r.string().valid("fixedRange").required(),before:r.date().allow(null),after:r.date().allow(null)}),wa=r.object({type:r.string().valid("relative").required(),value:r.string().required()}),ja=r.alternatives().try(ya,wa),Ca=function(e){return r.object({type:e.required(),appliesToFields:r.array().items(ga).required(),managedByConfiguration:r.boolean().required(),requiresValue:r.boolean().required(),title:r.string().allow("").optional(),optionsFilters:xa.optional(),hidden:r.boolean().optional()})},Sa=Ca(r.string().valid("dateFilter")).keys({value:ja.allow(null)}),Fa=Ca(r.string().valid("dateAndTimeFilter")).keys({value:ja.allow(null)}),ka=Ca(r.string().valid("singleSelectFilter")).keys({value:r.alternatives().try(r.string(),r.number(),r.boolean()).allow(null),optionsPulledFrom:r.array().items(ga).optional()}),_a=Ca(r.string().valid("multiSelectFilter")).keys({value:r.alternatives().try(r.array().items(r.string()),r.array().items(r.number())).allow(null),optionsPulledFrom:r.array().items(ga).optional()}),Ta=r.alternatives().try(Sa,Fa,ka,_a),Aa=r.array().items(Ta).optional(),Da=r.object({displayTitle:r.string().min(1).required(),colSpan:r.number().valid(12).required()}),Ia=r.number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),Oa=r.object({isEmpty:r.valid(!0).required(),colSpan:Ia}),Pa=function(e){return r.object({attributes:Ai({queryEngineConfig:e}),colSpan:Ia})};function Ea(e){return r.array().required().items(r.object({height:r.number().required(),components:r.array().required().min(1).items(r.alternatives(Oa,Pa(e),Da))}))}var Ma=function(e,t){var n=t?{queryEngineConfig:t}:void 0;if("string"==typeof e.definition)throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:!1,globalFilters:[].concat(e.definition.globalFilters||[]).map((function(e){return xi(e)})),componentLibrary:[].concat(e.definition.componentLibrary||[]).map((function(e){return _i(Q({},e,{colSpan:(null==e?void 0:e.colSpan)||1}),n)})),theme:Q({},ci,e.theme),display:qi(e.definition.display,n),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},Ra=function(e,t){return e.dataSets.findIndex((function(e){return e.id==t}))},La=function(e,t){return Vr(e.dataSets,t)},Na=function(e,t){return Ra(e,t)>=0},za=function(e){var t=Q({},e),n={};e.dataSets.forEach((function(e){n[e.id]=Xr(e)}));var r,i=null===t.parentDashboardId?t.componentLibrary:Qa(t),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})).map(bi);return{isPlayground:e.isPlayground,globalFilters:o,componentLibrary:[].concat(i).map(Ti),display:(r=e.display,r.map((function(e){return{components:[].concat(e.components).map(Ti),height:e.height}}))),customFields:n}},qa=function(e,t,n){return Q({},e,{dataSets:ti(t,n)})},Ba=function(e){var t=[];return e.display.forEach((function(e){e.components.forEach((function(e){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t).flatMap((function(t){var n=Vr(e.dataSets,t);return n?[n]:[]}))},Wa=function(e){var t=Ba(e),n=function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),i.uniq(t).flatMap((function(t){var n=Vr(e.dataSets,t);return n?[n]:[]}))}(e);return i.uniqBy([].concat(n,t),(function(e){return e.id}))},Va=function(e,t){return[].concat(t).filter((function(t){return t.parentDashboardId==e}))},Ha=function(e){return[].concat(e).filter((function(e){return null==e.parentDashboardId}))},Ya=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]},Ua=function(e){return[].concat(e).sort((function(e,t){var n=new Date(e.updatedAt);return new Date(t.updatedAt).getTime()-n.getTime()}))},Ga=function(e){return Ua(e)[0]||null},Ka=function(e,t){return e.find((function(e){return e.id==t}))||null},Xa=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?Q({},e,{componentLibrary:[].concat(Qa(e),i)}):e}))},Qa=function(e){return e.componentLibrary.filter((function(e){return!e.attributes.protectedByOrganisation}))};function Ja(e,t,n){var r=t.find((function(e){return e.id===n}));return void 0===r?e:Q({},r,{id:e.id,createdAt:e.createdAt,updatedAt:new Date})}var Za=function(e,t){var n=new Map;return e.forEach((function(e){var t=e.attributes.viewId;n.set(null!=t?t:"",e)})),t.forEach((function(e){var t=e.attributes.viewId;n.has(null!=t?t:"")||n.set(null!=t?t:"",e)})),Array.from(n.values())},$a=function(e){var t=e.filter((function(e){return e.isProgrammatic}));if(0!==t.length){if(t.length>1)throw new Error("There should only be one programmatic dashboard");return t[0].id}},el={__proto__:null,indexOfDataSet:Ra,getDataSet:La,hasDataSet:Na,getComponentsUsingDataSet:function(e,t){return i.flatMap([].concat(e.display),(function(e){return i.flatMap(e.components,(function(e){return Li(e)||mi(e)?[]:(null==e?void 0:e.attributes.dataSetId)==t?[e]:[]}))}))},toSaveableDefinition:za,setDataSets:qa,newSaveable:function(e){return Q({isPlayground:!1,display:[{components:[Oi(8),Oi(4)],height:350},{components:[Oi(4),Oi(4),Oi(4)],height:350}],componentLibrary:[],globalFilters:[],customFields:{}},e)},takePlaygroundDashboards:function(e){return i.filter([].concat(e),(function(e){return e.isPlayground}))},takeLiveDashboards:function(e){return i.filter([].concat(e),(function(e){return!e.isPlayground}))},getDataSetsUsedOnDisplay:Ba,getDataSetsUsedOnDashboard:Wa,getCopiesOfParentDashboard:Va,getParentDashboards:Ha,getFirstCreated:Ya,orderByLastUpdated:Ua,takeMostRecentlyUpdated:Ga,find:Ka,updateLibraryWithProtectedComponents:Xa,resetToParentDashboard:Ja,buildProgrammaticDashboard:function(e,t){var n=[];return e.map((function(e){var r;if(void 0===e.id)throw new Error("Dashboard id is undefined");var i=qa(e,t,e.customFields||{});n.push({id:i.id,dataSets:i.dataSets,display:null!=(r=i.display)?r:[],globalFilters:[],componentLibrary:i.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})})),n},updateWithProgrammaticDashboard:function(e,t){var n=new Map(t.map((function(e){return[e.id,e]})));return e.map((function(e){var t=n.get(e.id);if(null!==e.parentDashboardId){var r=n.get(e.parentDashboardId);if((null==r?void 0:r.id)===e.parentDashboardId)return Q({},e,{componentLibrary:Za(null==r?void 0:r.componentLibrary,e.componentLibrary)})}return null!=t?t:e}))},addUniqueLibraryComponents:Za,checkAndReturnProgrammaticDashboardId:$a,colSpanSchema:Ia,saveableDashboardDefinitionSchema:function(e){return r.object({id:r.string(),display:Ea(e),componentLibrary:r.array().required().items(Ai({queryEngineConfig:e})),globalFilters:Aa,customFields:r.object().required()})},displaySchema:Ea,fromRaw:Ma,Dashboard:void 0},tl=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.defaultParentDashboardId,i=Ka(e.dashboards,n.parentDashboardId||r)){t.next=4;break}throw"Cannot create a child dashboard from a parent dashboard which does not exist.";case 4:return o=Bi(i),a=n.dashboard?Bi(n.dashboard):o,l={definition:a,metadata:n.metadata,parentDashboardId:i.id,permissions:[{scope:"read_write"}]},t.next=9,e.createDashboard(l);case 9:if(!(s=t.sent)){t.next=12;break}return t.abrupt("return",s.id);case 12:return t.abrupt("return",null);case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},nl=function(e){return function(){var t=X(G().mark((function t(n){return G().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)}}()},rl=function(e){return function(){var t=X(G().mark((function t(n,r){return G().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)}}()},il=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadOnlyPermissionNotFound",n}return J(t,e),t}(ee(Error)),ol=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadPermissionNotFound",n}return J(t,e),t}(ee(Error)),al=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="WritePermissionNotFound",n}return J(t,e),t}(ee(Error)),ll=function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read_write"==t.scope}));if(!n)throw new al("Cannot find write permission for dashboard "+e);return n},sl=function(e,t){try{return!!ll(e,t)}catch(e){if(e instanceof al)return!1;throw e}},ul=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Zo(e),t.next=3,i({path:"/api/v1/get-dashboards",method:"post",body:{dashboardAccessTokens:n},abortSignal:r});case 3:if(a=(o=t.sent).body,200!=o.status){t.next=8;break}return t.abrupt("return",a);case 8:throw new eo("Failed to get dashboard from POST /api/v1/get-dashboards");case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},dl=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zo(e),t.next=3,r({path:"/api/v1/dashboard",method:"post",body:{dashboardAccessToken:n.dashboardAccessToken,definition:n.definition,meta:n.metadata||n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 3:if(o=(i=t.sent).body,200!=(a=i.status)){t.next=8;break}return t.abrupt("return",{dashboard:o.dashboard,permissions:o.permissions});case 8:if(422!=a){t.next=10;break}throw new io("Dashboard quota reached; "+JSON.stringify(o));case 10:throw new ro("Failed to update the dashboard from POST /api/v2/dashboard");case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};function cl(e,t,n){var r=Ma(e.dashboard,n);return{createdDashboard:qa(r,t,e.dashboard.definition.customFields||{}),formattedPermissions:e.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}}))}}function pl(e,t,n,r){return fl.apply(this,arguments)}function fl(){return(fl=X(G().mark((function e(t,n,r,i){var o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Q({},t,{dashboardAccessToken:n.dashboardAccess.signature}),"vizzlyApi"!==r.strategy){e.next=7;break}return e.next=4,i.createDashboard(a);case 4:o=e.sent,e.next=15;break;case 7:if("queryEngine"!==r.strategy){e.next=14;break}return l=dl(r.endpoint),e.next=11,l(a);case 11:o=e.sent,e.next=15;break;case 14:throw"Unsupported strategy for creating dashboard "+JSON.stringify(r);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ml=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zo(e),t.next=3,r({path:"/api/v1/dashboard",method:"put",body:Q({},n)});case 3:if(o=(i=t.sent).body,200!=i.status){t.next=8;break}return t.abrupt("return",o);case 8:throw new ao("Failed to update dashboard from PUT /api/v1/dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};function hl(e,t,n){return vl.apply(this,arguments)}function vl(){return(vl=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyApi"!==t.strategy){e.next=6;break}return e.next=3,n.updateDashboard(r);case 3:i=e.sent,e.next=14;break;case 6:if("queryEngine"!==t.strategy){e.next=13;break}return o=ml(t.endpoint),e.next=10,o(r);case 10:i=e.sent,e.next=14;break;case 13:throw"Unsupported strategy for updating dashboard "+JSON.stringify(t);case 14:return e.abrupt("return",i);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gl(e,t,n,r,i){var o=Ma(e.dashboard,i),a=qa(o,t,e.dashboard.definition.customFields||{});return{newDashboards:[].concat(n).flatMap((function(e){return e.id==a.id?r.deleted?[]:[a]:[e]})),updatedDashboard:a}}function bl(e,t,n){return(Array.isArray(e.found)?e.found:[]).map((function(e){var r,i=Ma(e,n);return qa(i,t,(null==(r=e.definition)?void 0:r.customFields)||{})}))}function xl(e,t,n,r){return yl.apply(this,arguments)}function yl(){return(yl=X(G().mark((function e(t,n,r,i){var o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyApi"!=t.strategy){e.next=6;break}return e.next=3,n.multiGetDashboards(r,i.signal);case 3:o=e.sent,e.next=14;break;case 6:if("queryEngine"!==t.strategy){e.next=13;break}return a=ul(t.endpoint),e.next=10,a(r,i.signal);case 10:o=e.sent,e.next=14;break;case 13:throw"Unsupported strategy for fetching dashboards "+JSON.stringify(t);case 14:return e.abrupt("return",o);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var wl={strategy:"vizzlyApi"},jl=function(e,t){return"function"!=typeof e&&e&&t&&t.supportedFeatures.includes("encryptedDashboards")&&"in-browser"!==e?{strategy:"queryEngine",endpoint:e}:wl};function Cl(e){return function(e,t){return[].concat(e).map((function(e){return function(e,t){var n=t.find((function(t){return t.dashboardId==e}));if(!n)throw new ol("Cannot find read permission for dashboard "+e);return n}(e,t).token}))}((t=[].concat(e).map((function(e){return e.dashboardId})),i.uniq(t)),e);var t}var Sl=function(e,n,r,i,o,a,l){var s=t.useState(),u=s[0],d=s[1],c=t.useState(),p=c[0],f=c[1],m=function(){var t=X(G().mark((function t(i){var s,u,c,p,m;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e||!n){t.next=41;break}return t.prev=1,t.next=4,r.createDashboardAccess(e.dashboardAccess.signature,null==(s=e.dashboardAdminOverride)?void 0:s.signature,i.signal);case 4:return c=Cl(u=t.sent.permissions),t.next=9,xl(o,r,c,i);case 9:if(p=bl(t.sent,n,a),i.signal.aborted){t.next=24;break}if(m=Xa(p),!l){t.next=23;break}return t.t0=el,t.t1=m,t.t2=el,t.next=19,l(n);case 19:t.t3=t.sent,t.t4=n,t.t5=t.t2.buildProgrammaticDashboard.call(t.t2,t.t3,t.t4),m=t.t0.updateWithProgrammaticDashboard.call(t.t0,t.t1,t.t5);case 23:f({dashboards:m,permissions:u});case 24:t.next=41;break;case 26:if(t.prev=26,t.t6=t.catch(1),!(t.t6 instanceof eo)){t.next=32;break}d(t.t6),t.next=41;break;case 32:if(!(t.t6 instanceof Zi)){t.next=36;break}d(t.t6),t.next=41;break;case 36:if(!(t.t6 instanceof Go)){t.next=40;break}d(t.t6),t.next=41;break;case 40:throw t.t6;case 41:case"end":return t.stop()}}),t,null,[[1,26]])})));return function(e){return t.apply(this,arguments)}}();if(t.useEffect((function(){var e=new AbortController;return void 0===p&&m(e),function(){return e.abort()}}),[e,i]),!p||!e)return{isLoading:!0,error:u};var h=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=ll(t.dashboardId,p.permissions),e.next=3,r.saveScheduledReport(Q({},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)}}(),v=function(){var t=X(G().mark((function t(i){var l,s,u;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=7;break}return t.next=3,pl(i,e,o,r);case 3:return l=cl(t.sent,n,a),u=l.formattedPermissions,f({dashboards:[].concat(p.dashboards,[s=l.createdDashboard]),permissions:[].concat(p.permissions,u)}),t.abrupt("return",s);case 7:throw"Unable to create a dashboard when the data sets have not been loaded.";case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=function(){var e=X(G().mark((function e(t,i){var l,s,u,d;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=9;break}return l=ll(t,p.permissions),s=Q({},i,{dashboardSessionToken:l.token}),e.next=5,hl(o,r,s);case 5:return u=gl(e.sent,n,p.dashboards,i,a),d=u.updatedDashboard,f({dashboards:u.newDashboards,permissions:[].concat(p.permissions)}),e.abrupt("return",d);case 9:throw"Unable to update a dashboard when the data sets have not been loaded.";case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),b=[].concat(p.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 il("Cannot find read-only permission for dashboard "+e);return n}(e,t)}catch(e){if(e instanceof il)return!1;throw e}}(e.id,p.permissions)})),x=[].concat(p.dashboards).filter((function(e){return sl(e.id,p.permissions)})),y=function(e,t,n){if(e){var r=Ka(n,e);if(null!=r&&r.parentDashboardId)throw"[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.";return e}var i=Ha(n);return $a(i)||t||Ya(i).id}(i,e.dashboardAccess.dashboardId,p.dashboards);return{childDashboardCount:[].concat(p.dashboards||[]).filter((function(e){return!!e.parentDashboardId})).length,defaultParentDashboardId:y,createDashboard:v,updateDashboard:g,saveScheduledReport:h,permissions:p.permissions,writeAccessDashboards:x,readOnlyAccessDashboards:b,dashboards:p.dashboards,error:u,accessType:e.dashboardAdminOverride?"admin":e.dashboardAccess.accessType}};function Fl(e){return r.object({id:r.string().required(),display:e?Ea(e):r.object().required(),parentDashboardId:r.string().required().allow(null),metadata:r.object(),componentLibrary:r.array().required(),globalFilters:Aa.required(),createdAt:r.date().required(),updatedAt:r.date().required()})}var kl={convert:!1,stripUnknown:!1,allowUnknown:!0},_l=function(e,t){var n=i.cloneDeep(t).filter((function(t){return t.parentDashboardId==e}));return i.sortBy(n,(function(e){return e.updatedAt})).reverse()};function Tl(e){return i.cloneDeep(e).filter((function(e){return null==e.parentDashboardId}))}var Al=function(e,t,n,r){var o=ha(e,X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[]);case 1:case"end":return e.stop()}}),e)}))),t,Er),a=o.identityConfig,l=o.dataSets,s=o.queryEngineConfig,u=Vo(r||{host:"https://api.vizzly.co"}),d=Sl(a,l,u,n,jl(t,s),s);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,f=function(e,t){try{if(!Array.isArray(e))throw new Error("dashboards must be an array");for(var n,r=[],i=ie(e);!(n=i()).done;){var o=n.value,a=Fl(t).validate(o,kl);if(a.error)throw Ae("There is an error with Dashboard "+o.id+". It has been removed from the array.",a.error.message),new Error("Validation error for dashboard "+o.id+": "+a.error.message);r.push({id:o.id,parentDashboardId:o.parentDashboardId,globalFilters:o.globalFilters,display:o.display,componentLibrary:o.componentLibrary,createdAt:o.createdAt,updatedAt:o.updatedAt,metadata:o.metadata})}return r}catch(e){throw Ae("Error building client-facing dashboards: "+e),e}}(d.dashboards,s);return{VizzlySDK:(p={queryEngineConfig:s},Q({},function(e){return{BasicTable:{init:si(e).init,setAttributes:si(e).setAttributes,setFields:si(e).setFields,validate:si(e).validate,setDateTimeFormat:si(e).setDateTimeFormat},DataTable:{init:ir(e).init,setAttributes:ir(e).setAttributes,validate:ir(e).validate},HorizontalBarChart:{init:lr(e).init,setAttributes:lr(e).setAttributes,validate:lr(e).validate},BarChart:{init:Ln(e).init,setAttributes:Ln(e).setAttributes,validate:Ln(e).validate},AreaChart:{init:cr(e).init,setAttributes:cr(e).setAttributes,validate:cr(e).validate},SingleStat:{init:hr(e).init,setAttributes:hr(e).setAttributes,validate:hr(e).validate},PieChart:{init:Hn(e).init,setAttributes:Hn(e).setAttributes,validate:Hn(e).validate},LineChart:{init:Bn(e).init,setAttributes:Bn(e).setAttributes,validate:Bn(e).validate},ComboChart:{init:Zn(e).init,setAttributes:Zn(e).setAttributes,validate:Zn(e).validate}}}(p),{displayPositions:Wi,Display:Hi,Dashboard:Vi})),loading:!1,getChildDashboards:function(e){return _l(e,f)},dashboards:_l(d.defaultParentDashboardId,f),allChildDashboards:(c=f,i.cloneDeep(c).filter((function(e){return null!=e.parentDashboardId}))),parentDashboards:Tl(f),createDashboard:tl(d),deleteDashboard:nl(d),updateDashboardMeta:rl(d),isAdmin:"admin"==d.accessType,defaultParentDashboardId:d.defaultParentDashboardId}},Dl=function(e,t,n){return Al(e,X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ea);case 1:case"end":return e.stop()}}),e)}))),t,n)},Il=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={error:void 0,tryCount:0},n}J(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),Ol={string:function(e,t,n){return void 0===n&&(n={}),ri(ea,e,t,n)},number:function(e,t,n){return void 0===n&&(n={}),ii(ea,e,t,n)},boolean:function(e,t,n){return void 0===n&&(n={}),oi(ea,e,t,n)},stringArray:function(e,t,n){return void 0===n&&(n={}),function(e,t,n,r){return void 0===r&&(r={}),ni(ea,"string[]",t,n,r)}(0,e,t,n)},dateTime:function(e,t,n){return void 0===n&&(n={}),ai(ea,e,t,n)}},Pl={__proto__:null,number:ii,string:ri,boolean:oi,dateTime:ai,InBrowser:Ol},El=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}(),Ml=["vizzly-studio","vizzly-toolbar","vizzly-modals","vizzly-popover"].map((function(e){return"\n ."+e+" hr {"+Ll({height:"0",color:"inherit",borderTopWidth:"1px"})+"}\n ."+e+" svg {"+Ll({display:"block",verticalAlign:"middle"})+"}\n "})).join(""),Rl=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{",Ll(El),";}",Ml,";","")})};function Ll(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}var Nl=new(function(){function e(){this.subscribers={}}var t=e.prototype;return t.get=function(e,t){var n=this;return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),function(){n.subscribers[e]=n.subscribers[e].filter((function(e){return e!==t}))}},t.set=function(e,t){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e(t)}))},t.reload=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({reload:!0})}))},e}()),zl=require("../package.json");if("undefined"!=typeof window&&"undefined"!=typeof localStorage){var ql=localStorage.getItem("__VIZZLY__LOG_LEVEL_STORED");ql&&je(ql),window.VizzlyDev={version:(null==zl?void 0:zl.version)||"dev",setLogLevel:function(e){if(ye.includes(e))return je(e,(function(e){localStorage.setItem("__VIZZLY__LOG_LEVEL_STORED",e)})),"Log level set to "+e+".";console.warn("Invalid log level. Please set one of",ye)}}}var Bl={year:"numeric",month:"short",day:"numeric"},Wl={year:"numeric",month:"short"},Vl={weekday:"long",year:"numeric",month:"long",day:"numeric"},Hl=function(e,t,n){if(!e)return"";var r=e.toLocaleDateString("en-GB",n);return t&&t!=Intl.DateTimeFormat().resolvedOptions().timeZone?r+" ("+t+")":r},Yl=function(e,t){var n={hour:"2-digit",minute:"2-digit"};return t&&(n.seconds="2-digit"),e.toLocaleTimeString("en-GB",n)},Ul=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"+Kl(e)+", "+e.getFullYear().toString():"week"==t?"Week "+Xl(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=Q({},Bl,{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=Q({},Vl,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"hh:mm"==t?Yl(e):"hh:mm:ss"==t?Yl(e,!0):"DD MMMM YYYY"==t?function(e,t){return Hl(e,void 0,Bl)}(e):"MMMM YYYY"==t?Hl(e,null,Wl):"YYYY-MM-DD[T]HH:mm:ss"==t?e.getFullYear()+"-"+r+"-"+i+"T"+Yl(e):"YYYY"==t?e.getFullYear().toString():null},Gl=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Kl=function(e){return Math.floor((e.getMonth()+3)/3)},Xl=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)},Ql=function(e,t){return e/t*100},Jl=function(e,t){return(Math.round(100*e)/100).toFixed(t)},Zl=function(e,t){return new Intl.NumberFormat(void 0,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e)},$l=function(e){return Array(e).fill(void 0)},es=function(e,t){var n=i.cloneDeep(e);return n.splice(t,1),n},ts=function(e,t,n,r){return JSON.stringify({dimensionKeys:e,dimensionValues:t,fieldId:n,function:r})},ns=function(e){if(!e)return!1;try{return rs(e),!0}catch(e){return!1}},rs=function(e){var t=JSON.parse(e);return{dimensionKeys:t.dimensionKeys,dimensionValues:t.dimensionValues,fieldId:t.fieldId,function:t.function}},is=function(e){var t=rs(e);return Ee({function:t.function,field:t.fieldId})},os=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}),{})}))},as=function(e,t,n,r,o){if(void 0===r&&(r=!1),!e)return[];var a=os(e),l=[].concat(a).map((function(e){var r=[].concat(n.x).map((function(t){return Ie(e[t],o)})),i={},a=[].concat(n.y).map((function(t){return e[t]}));t.forEach((function(t){var r=_t(t),o=ts(n.y,a,t.field,t.function);i[o]=e[r]}));var l={};return[].concat(n.x).forEach((function(t){l[t]=e[t]})),Q({},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?fs(d):d},ls=function(e,t,n){if(!n)return[];var r=os(n),i={};return r.forEach((function(n){var r=[].concat(e.y).map((function(e){return n[e]}));t.forEach((function(t){var n=ts(e.y,r,t.field,t.function);i[n]=!0}))})),Object.keys(i)},ss=function(e,t){return i.findIndex(e.fields,(function(e){return e.id==t}))},us=function(e,t){return e.fields[ss(e,t)]},ds=function(e){return void 0===e},cs=function(e){return null===e},ps=function(e){return!!ds(e)||!!cs(e)||i.isEmpty(e.content)},fs=function(e){var t=["x","xValues"];return e.map((function(e){var n=Q({},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)?Ql(n[o],r):e}))}))},ms=["contains_substring","does_not_contain_substring","ends_with","starts_with","<","<=",">",">="],hs=function(e,t){return function(e,t){if(null==t&&ms.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."}(e,t)},vs=function(e){var t=e("number_format_option.noValueReplacement","No value"),n=e("number_format_option.formattingError","Formatting error");return{_vizzly_compact:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Intl.NumberFormat(void 0,{notation:"compact"}).format(e)},description:e("number_format_option.compact","Compact")},_vizzly_to_2_dp:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Jl(e,2)},description:e("number_format_option.to_2_dp","2 decimal places")},_vizzly_to_gbp:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"GBP")},description:e("number_format_option.currency_gbp","Currency £")},_vizzly_to_usd:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"USD")},description:e("number_format_option.currency_usd","Currency $")},_vizzly_to_eur:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"EUR")},description:e("number_format_option.currency_eur","Currency €")},_vizzly_to_percentage:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:function(e,t){var n=(100*e).toFixed(2);return n.endsWith(".00")?parseInt(n)+"%":n+"%"}(e)},description:e("number_format_option.percentage","Percentage")},_vizzly_separated:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:e.toLocaleString()},description:e("number_format_option.separated","Separated")},_vizzly_number:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:""+e},description:e("number_format_option.number","Number")},_vizzly_hours_and_minutes_from_minutes:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Math.floor(e/60)+" H : "+Jl(e%60,0)+" M"},description:e("number_format_option.minutes_to_hours_minutes","Minutes to hours & minutes")}}},gs=function(e,t,n){return void 0===n&&(n=[]),[].concat(n,[e,"NONE"===(null==t?void 0:t.toUpperCase())?null:t]).filter((function(e){return null!=e})).join(" • ")},bs=function(e,t,n){var r=i.merge({},t,e);return i.merge({},n,r)},xs=function(e,t){return JSON.stringify(e)==JSON.stringify(t)},ys=function(e,t,n){var r=rs(n);return[].concat(t).flatMap((function(t){var n,i,o,a,l,s,u=Ee({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(i=null==(o=t.filters)?void 0:o[0][0].function)?i:"none"}),d=e.some((function(e){return e.field===u}))&&("string"==typeof(null==(a=t.filters)?void 0:a[0][0].value)||"boolean"==typeof(null==(l=t.filters)?void 0:l[0][0].value)||"number"==typeof(null==(s=t.filters)?void 0:s[0][0].value));return d||_t({field:r.fieldId,function:r.function})==u?[{rule:t,isRuleOnDimension:d}]:[]}))},ws=function(e,t,n,r,i){return ys(e,t,n).map((function(e){var t,n,o,a,l,s,u,d=Ee({field:null==(t=e.rule.filters)?void 0:t[0][0].field,function:null!=(n=null==(o=e.rule.filters)?void 0:o[0][0].function)?n:"none"}),c=Re(d,{supportedAggregates:r,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),p=c.function,f=Yr(i,c.fieldId),m="When "+f.publicName+" "+(p&&"none"!=p?"("+p+")":"")+" "+(null==(a=e.rule.filters)?void 0:a[0][0].op)+" "+(null==(l=e.rule.filters)?void 0:l[0][0].value);return{isRuleOnDimension:e.isRuleOnDimension,color:e.rule.ruleValue,explanation:m,value:null==(s=e.rule.filters)?void 0:s[0][0].value,operator:null==(u=e.rule.filters)?void 0:u[0][0].op,conditionIsMet:function(t){var n,r;return hs({value:null==(n=e.rule.filters)?void 0:n[0][0].value,op:null==(r=e.rule.filters)?void 0:r[0][0].op},_s(f,t))}}}))},js=function(e,t,n,r,o){if(n){var a=ys(e,t,r),l=rs(r),u=a.find((function(e){var t,a,s,u=e.rule,d=e.isRuleOnDimension;if(!i.isEmpty(u.filters)&&0!==u.filters.length){var c=Ee({field:null==(t=u.filters)?void 0:t[0][0].field,function:null!=(a=null==(s=u.filters)?void 0:s[0][0].function)?a:"none"}),p=d?Yr(o,c):void 0,f=d?[].concat(l.dimensionValues,null!=n[c]?[n[c]]:[]):[n[r]];return i.some(f,(function(e){var t,n;return null==e?null:hs({op:null==(t=u.filters)?void 0:t[0][0].op,value:null==(n=u.filters)?void 0:n[0][0].value},p?_s(p,e):e)}))}}));if(u){var d=u.rule,c=d.ruleValue;return{value:c=function(e,t,n){if(e.boundaries&&2===e.boundaries.length&&e.ruleValueEnd){var r=e.boundaries[0],i="number"==typeof r?r:Number(r),o=e.boundaries[1],a="number"==typeof o?o:Number(o);t=s.scale([e.ruleValue,e.ruleValueEnd]).domain([i,a])(n).hex()}return t}(d,c,n[r]),type:u.rule.ruleType}}}},Cs=function(e,t,n){return function(r){if(e){var i,o=new Date(r);if(isNaN(o.getTime()))return"";var a,l=n.dateTimeFormatOptions[null==t||null==(i=t[null==e?void 0:e.truncate])?void 0:i.dateFormat],s=n.dateTimeFormatOptions[(null==n?void 0:n.format)||""];return a=null!=s&&s.formatter?s.formatter(new Date(r)):null!=l&&l.formatter?l.formatter(new Date(r)):Ul(new Date(r),"DD MMMM YYYY, hh:mm")||new Date(r).toISOString(),""+(n.prefix||"")+a+(n.postfix||"")}return r=ks(r,n.numberFormatOptions,n.format),""+(n.prefix||"")+r+(n.postfix||"")}},Ss=function(e,t){return function(n){var r;return"number"==typeof n?(n=ks(n,function(e,t){var n;return Q({},t,((n={}).default=function(e){return{description:"Default",formatter:vs(e)._vizzly_compact.formatter}}(e),n))}(e,null==t?void 0:t.numberFormatOptions),null!=(r=null==t?void 0:t.format)?r:"default"),""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")):""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")}},Fs=function(e,t,n,r,i){return function(o){if(e){var a=rs(o),l=_t({function:a.function,field:a.fieldId}),s=us(e,l),u=le(a.function,t);if(s){var d=gs(null==s?void 0:s.publicName,u,a.dimensionValues),c=i({fieldId:a.fieldId,func:a.function,type:null!=n?n:"barChart",defaultLabel:d,viewId:null!=r?r:"",values:[null==s?void 0:s.publicName]});return null!=c?c:d}}}},ks=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 _s(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 Ts={transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)"},As=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=Q({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=Q({},r,n.variants&&n.variants[e]&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=Q({},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=Q({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t};function Ds(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 Is(e){for(var t,n={},r=ie(e);!(t=r()).done;){var i=t.value;n[i.toString()]=100-i}return n}var Os=Is([5,8,20,80,90]),Ps={base:Rs("55, 65, 81",0)};for(var Es in Os)Ps[Es]=Rs("55, 65, 81",Os[Es]);var Ms={font:{header:16,standard:13,bold:400,sanSerif:"Inter, sans-serif",color:"rgb(55, 65, 81)"},size:{borderRadius:"0.5rem"},colors:{brand:Ps,blue:"rgb(48, 116, 217)",contrast:"rgb(249, 247, 250)",success:"#43BA73"}};function Rs(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))+")"}var Ls={backgroundColor:"transparent",backgroundImage:"none",WebkitAppearance:"button",border:"none",cursor:"pointer",padding:0},Ns=As(Ls),zs=As(Q({},Ls,{color:Ds(10),borderRadius:8,padding:4,"&:hover":{background:Ds(90),color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}})),qs={margin:0},Bs={margin:0,textDecoration:"underline",color:"rgb(47, 129, 247)",cursor:"pointer"},Ws={listStyle:"none",padding:0,margin:0},Vs={padding:0,margin:0},Hs=As(qs),Ys='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Us=As({fontFamily:Ys,fontSize:"1em"}),Gs=As(Bs),Ks=As(Ws),Xs=As(Vs),Qs=As({height:"100%"}),Js=As({fontWeight:700}),Zs={xs:"0.75rem",sm:"0.8rem"},$s=As({whiteSpace:"nowrap"}),eu=As({position:"absolute",left:-9999,width:1,height:1,overflow:"hidden"}),tu=Object.assign((function(){return null}),{iconButton:zs,ml:function(e){return As({marginLeft:e})},bw:function(e){return As({borderWidth:e})},pt:function(e){return As({paddingTop:e})},pl:function(e){return As({paddingLeft:e})},pr:function(e){return As({paddingRight:e})},pb:function(e){return As({paddingBottom:e})},py:function(e){return As({paddingTop:e,paddingBottom:e})},p:function(e){return As({padding:e})},mt:function(e){return As({marginTop:e})},mb:function(e){return As({marginBottom:e})},mr:function(e){return As({marginRight:e})},m:function(e){return As({margin:e})},my:function(e){return As({marginTop:e,marginBottom:e})},codeText:Us,bold:Js,button:Ns,text:Hs,link:Gs,srOnly:eu,liReset:Ks,ulReset:Xs,textSize:function(e){return As({fontSize:Zs[e]||"1rem"})},opacity:function(e){return As({opacity:e})},color:function(e){return As({color:e})},align:function(e){return As({textAlign:e})},height100:Qs,nowrap:$s}),nu=Object.assign((function(){return null}),{button:Ls,text:qs,link:Bs,codeFontFamily:Ys}),ru=As({display:"block",verticalAlign:"middle"}),iu=Object.assign((function(){return null}),{selectedComponent:function(e){return As(Q({},Ts,nu.button,{borderRadius:null==e?void 0:e.borderRadius,"&:hover":Q({},Ts,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),"&:focus":Q({},Ts,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),variants:{componentSelect:{true:Q({},Ts,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius,"&:focus-visible":{outline:0},"&:focus":{outline:0},"&:hover":Q({},Ts,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius})})}}}))},tableWrapper:As({display:"flex",height:268,width:"100%",flexDirection:"column",position:"relative"})}),ou={name:"n8i3ag",styles:"position:relative;height:100%;width:100%;flex-grow:1;overflow-x:hidden"},au={name:"4hfwcq",styles:"height:100%;width:100%;flex-grow:1"},lu=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{css:ou,"aria-disabled":!0,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx("div",{css:au,children:null==e?void 0:e.children})},su=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{className:""+iu.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})},uu={name:"c1vcec",styles:"display:inline-block;height:1rem;width:1rem"},du=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:e.active?"black":"none",css:uu,viewBox:"0 0 24 24",strokeWidth:2.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"})})},cu={name:"6r56vi",styles:"height:1rem;width:1rem"},pu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:cu,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"})})},fu={name:"3vy5qs",styles:"height:1.25rem;width:1.25rem;opacity:0.7"},mu=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:fu,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"})})},hu={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},vu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:hu,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"})})},gu={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},bu={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},xu=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:gu,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:bu,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"})})]})},yu={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},wu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:yu,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"})})},ju={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Cu=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:ju,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"})})},Su={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Fu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Su,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"})})},ku={name:"6r56vi",styles:"height:1rem;width:1rem"},_u=function(e){return c.jsx("svg",{onClick:e.onClick,css:ku,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"})})},Tu={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},Au=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Tu,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"})})},Du={name:"6r56vi",styles:"height:1rem;width:1rem"},Iu={name:"6r56vi",styles:"height:1rem;width:1rem"},Ou=function(e){return c.jsxs(c.Fragment,{children:[e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Du,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:Iu,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"})})]})},Pu={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},Eu=function(e){return c.jsx("svg",{onClick:e.onClick,css:Pu,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"})})},Mu=function(e){return c.jsx("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"24",height:null!=e&&e.height?""+(null==e?void 0:e.height):"24",viewBox:"0 0 160 160",fill:"rgb(55, 65, 81)",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"})})},Ru={name:"37ue6p",styles:"display:inline-block;height:1.25rem;width:1.25rem"},Lu=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",css:Ru,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"})})},Nu=function(e){return c.jsx("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"16",height:null!=e&&e.height?""+(null==e?void 0:e.height):"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),children:c.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",clipRule:"evenodd"})})},zu=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:c.jsx("path",{fillRule:"evenodd",d:"M7.28 7.72a.75.75 0 0 1 0 1.06l-2.47 2.47H21a.75.75 0 0 1 0 1.5H4.81l2.47 2.47a.75.75 0 1 1-1.06 1.06l-3.75-3.75a.75.75 0 0 1 0-1.06l3.75-3.75a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},qu=function(e){return c.jsxs("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"24",height:null!=e&&e.height?""+(null==e?void 0:e.height):"24",viewBox:"0 0 20 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M17.5007 4.66663C16.2923 4.66663 15.6173 5.86663 15.8923 6.75829L12.934 9.72496C12.684 9.64996 12.3173 9.64996 12.0673 9.72496L9.94232 7.59996C10.2257 6.70829 9.55065 5.49996 8.33398 5.49996C7.12565 5.49996 6.44232 6.69996 6.72565 7.59996L2.92565 11.3916C2.03398 11.1166 0.833984 11.7916 0.833984 13C0.833984 13.9166 1.58398 14.6666 2.50065 14.6666C3.70898 14.6666 4.38398 13.4666 4.10898 12.575L7.90065 8.77496C8.15065 8.84996 8.51732 8.84996 8.76732 8.77496L10.8923 10.9C10.609 11.7916 11.284 13 12.5007 13C13.709 13 14.3923 11.8 14.109 10.9L17.0757 7.94163C17.9673 8.21663 19.1673 7.54163 19.1673 6.33329C19.1673 5.41663 18.4173 4.66663 17.5007 4.66663Z",fill:"url(#paint0_linear_2169_391)"}),c.jsx("path",{d:"M12.5 5.5L13.2833 3.775L15 3L13.2833 2.225L12.5 0.5L11.7333 2.225L10 3L11.7333 3.775L12.5 5.5Z",fill:"url(#paint1_linear_2169_391)"}),c.jsx("path",{d:"M2.91732 7.16667L3.33398 5.5L5.00065 5.08333L3.33398 4.66667L2.91732 3L2.50065 4.66667L0.833984 5.08333L2.50065 5.5L2.91732 7.16667Z",fill:"url(#paint2_linear_2169_391)"}),c.jsxs("defs",{children:[c.jsxs("linearGradient",{id:"paint0_linear_2169_391",x1:"0.833984",y1:"4.66663",x2:"19.4886",y2:"5.49589",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),c.jsxs("linearGradient",{id:"paint1_linear_2169_391",x1:"10",y1:"0.5",x2:"15.0947",y2:"0.623532",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),c.jsxs("linearGradient",{id:"paint2_linear_2169_391",x1:"0.833984",y1:"3",x2:"5.07954",y2:"3.10294",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]})]})]})},Bu=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:c.jsx("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})})},Wu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"})})},Vu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"})})},Hu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{d:"M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z"})})},Yu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"})})},Uu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},Gu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 0 1-1.313-1.313V9.564Z",clipRule:"evenodd"})})},Ku=function(e){var t,n;return c.jsx("svg",{fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",viewBox:"0 0 32 32",id:"icon",xmlns:"http://www.w3.org/2000/svg",stroke:"inherit",strokeWidth:"0.736",children:c.jsx("path",{d:"M18,28A12,12,0,1,0,6,16v6.2L2.4,18.6,1,20l6,6,6-6-1.4-1.4L8,22.2V16H8A10,10,0,1,1,18,26Z"})})},Xu={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,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0},Qu={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,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0},Ju=function(e,t,n,r){var i=Q({},Qu,e);return"admin"==n&&(i=Q({},Xu,Zu(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),Ko(t,"simpleMaths")||(i.allowSimpleMathsCustomField=!1),Ko(t,"aggregateMaths")||(i.allowAggregateMathsCustomField=!1),Ko(t,"subquery")||(i.allowPercentagesCustomField=!1),Ko(t,"switchField")||(i.allowRulesCustomField=!1),Ko(t,"roundedNumbers")||(i.allowRoundedNumberCustomField=!1),i},Zu=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,canDownloadViewData:void 0===e.canDownloadViewData||e.canDownloadViewData,canDownloadDataSet:void 0===e.canDownloadDataSet||e.canDownloadDataSet}},$u={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},ed=function(e,t){return{description:t,range:{before:Gl(e),after:Gl((n=e,r=new Date(n.getTime()-864e5),new Date(r.getFullYear(),r.getMonth(),r.getDate())))}};var n,r},td=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}}},nd=function(e){return{today:(t=new Date,n=e("filter.today","Today"),r=Gl(t),i=new Date(r),i.setDate(i.getDate()+1),i.setMilliseconds(i.getMilliseconds()-1),{description:n,range:{before:i,after:r}}),past_1_day:td(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:ed(new Date,e("filter.yesterday","Yesterday")),past_3_days:td(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:td(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:td(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:td(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:td(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:td(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:td(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:td(0,18,e("filter.past_18_months","Last 18 months"))};var t,n,r,i},rd=function(){for(var e=nd(Er),t={},n=0,r=Object.entries($u);n<r.length;n++){var i=r[n],o=i[0];i[1]&&o in e&&(t["_vizzly_"+o]=e[o])}return t},id=function(e,t){var n=nd(e),r=Object.keys($u).map((function(e){return e in n?"_vizzly_"+e:e})),i=r.indexOf("_vizzly_today");i>-1&&(r.splice(i,1),r.unshift("_vizzly_today"));for(var o,a={},l={},s=ie(r);!(o=s()).done;){var u=o.value,d=u.replace("_vizzly_",""),c=n[d],p=null==t?void 0:t[d];"boolean"==typeof p?p&&(l[u]=c):null!=p?l[u]=p:!1!==$u[d]&&(l[u]=c)}if(t)for(var f=0,m=Object.entries(t);f<m.length;f++){var h=m[f],v=h[0],g=h[1];v in $u||(r.push(v),l[v]=g)}for(var b,x=ie(r);!(b=x()).done;){var y=b.value;y in l&&(a[y]=l[y])}return a},od=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingDateTimeFormatOption",n}return J(t,e),t}(ee(Error)),ad={"DD/MM/YYYY":{description:"DD/MM/YYYY",formatter:function(e){return Ul(e,"DD/MM/YYYY")}},"MM/DD/YYYY":{description:"MM/DD/YYYY",formatter:function(e){return Ul(e,"MM/DD/YYYY")}},"DD-MM-YYYY":{description:"DD-MM-YYYY",formatter:function(e){return Ul(e,"DD-MM-YYYY")}},"MM-DD-YYYY":{description:"MM-DD-YYYY",formatter:function(e){return Ul(e,"MM-DD-YYYY")}},"DD MMMM YYYY, hh:mm":{description:"DD MMMM YYYY, hh:mm",formatter:function(e){return Ul(e,"DD MMMM YYYY, hh:mm")}},"dddd DD MMMM YYYY, hh:mm":{description:"dddd DD MMMM YYYY, hh:mm",formatter:function(e){return Ul(e,"dddd DD MMMM YYYY, hh:mm")}},"hh:mm":{description:"hh:mm",formatter:function(e){return Ul(e,"hh:mm")}},"hh:mm:ss":{description:"hh:mm:ss",formatter:function(e){return Ul(e,"hh:mm:ss")}},"DD MMMM YYYY":{description:"DD MMMM YYYY",formatter:function(e){return Ul(e,"DD MMMM YYYY")}},"MMMM YYYY":{description:"MMMM YYYY",formatter:function(e){return Ul(e,"MMMM YYYY")}},YYYY:{description:"YYYY",formatter:function(e){return Ul(e,"YYYY")}},"YYYY-MM-DD[T]HH:mm:ss":{description:"YYYY-MM-DD[T]HH:mm:ss",formatter:function(e){return Ul(e,"YYYY-MM-DD[T]HH:mm:ss")}},quarter:{description:"Quarter",formatter:function(e){return Ul(e,"quarter")}},week:{description:"Week",formatter:function(e){return Ul(e,"week")}}},ld=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 od("Date format option "+r+" is required by the query engine, but it has not been set on the dateTimeFormatOptions.")})),n},sd={mode:"endUser",scope:"read_write",maxCSVDownloadLimit:1e4,featureToggles:Q({},Qu),developerTools:!1,componentOverrides:{},customComponents:[],reportScheduleOptions:[],overrideDeveloperInfo:null,disableToolbar:!1,onlyViewTypes:function(){return[]},dataPanel:function(e){return e},formatPanel:function(e){return e},isProgrammaticParent:!1,dashboardFilters:function(){return[]},onDashboardFilterChange:function(){},dateFilterOptions:rd(),dateTimeFormatOptions:ad,numberFormatOptions:vs(Er),textOverrides:{},queryEngineConfig:ea,organizationName:void 0,onEditorUpdate:function(e){return e},onSave:function(){return Te("Save functionality not set.")},onScheduledReportChange:function(){var e=X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Te("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.")},textOverride:function(e,t){return t},labelFormat:function(){}},ud=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&&dd(),r&&cd()}),[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})},dd=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;}"})},cd=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;}"})},pd=n.createContext(Q({},sd,{setOverrideDeveloperInfo:function(){throw"Not initiated."}})),fd=function(e){var n,r,a=e.textOverride||Er,l=t.useState(null),s=l[0],u=l[1],d=function(e,t,n,r){var a,l=e.mode||sd.mode,s=e.scope||sd.scope,u=e.isProgrammaticParent||sd.isProgrammaticParent,d="admin"==l?{}:Q({},e.componentOverrides),c=e.queryEngineConfig?e.queryEngineConfig:sd.queryEngineConfig;return Q({},sd,{isProgrammaticParent:u,mode:l,scope:s,reportScheduleOptions:e.reportScheduleOptions||sd.reportScheduleOptions,customComponents:e.customComponents||sd.customComponents,componentOverrides:d,onlyViewTypes:function(e){var r,o,a;return(r=hi,o=n,a=[].concat(t||r),o&&(a=i.reject(a,(function(e){return o.includes(e)}))),a).filter((function(t){var n=!!Br(t).setDataAttributesFromPreAggregatedDataSet;return!(e.preAggregated&&!n)}))},developerTools:null!=(a=e.developerTools)&&a,featureToggles:Ju(o.merge({},sd.featureToggles,e.featureToggles),c,l,s),textOverrides:e.textOverrides||sd.textOverrides,maxCSVDownloadLimit:e.maxCSVDownloadLimit?e.maxCSVDownloadLimit:sd.maxCSVDownloadLimit,queryEngineConfig:c,dataPanel:e.dataPanel?e.dataPanel:sd.dataPanel,formatPanel:e.formatPanel?e.formatPanel:sd.formatPanel,numberFormatOptions:Q({},vs(r),e.numberFormatOptions),onEditorUpdate:e.onEditorUpdate?e.onEditorUpdate:sd.onEditorUpdate,dateFilterOptions:id(r,e.dateFilterOptions),onSave:e.onSave?e.onSave:sd.onSave,onScheduledReportChange:e.onScheduledReportChange?e.onScheduledReportChange:sd.onScheduledReportChange,dashboardFilters:e.dashboardFilters?e.dashboardFilters:sd.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange?e.onDashboardFilterChange:sd.onDashboardFilterChange,onOpenConfigManagerUi:e.onOpenConfigManagerUi,organizationName:e.organizationName,dateTimeFormatOptions:ld(Q({},sd.dateTimeFormatOptions,e.dateTimeFormatOptions?e.dateTimeFormatOptions:{}),c),disableToolbar:e.disableToolbar})}(Q({},e.dashboardBehaviour||{},{mode:e.mode}),e.includeComponentTypes,e.excludeComponentTypes,a);return c.jsx(ud,{developerTools:null==(n=e.dashboardBehaviour)?void 0:n.developerTools,children:c.jsx(pd.Provider,{value:Q({},d,{isProgrammaticParent:e.isProgrammaticParent,setOverrideDeveloperInfo:u,overrideDeveloperInfo:s,onError:e.onError,onReset:e.onReset,onViewClick:e.onViewClick,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:a,labelFormat:e.labelFormat?(r=e.labelFormat,function(e){if(r){var t,n=r(e);if("string"==typeof(t=n)||void 0===t)return n;console.error("labelFormat function returned an invalid type",e)}}):function(){},pdfSettings:e.pdfSettings,id:e.id,containerWidth:e.containerWidth}),children:e.children})})},md=function(){return n.useContext(pd)},hd=function(e){var t=md(),n=t.developerTools,r=t.setOverrideDeveloperInfo,i=t.componentOverrides[e.renderOverrideKey];if(i){var o=Q({},e.componentProps,{testId:void 0,onClickWithDevToolCheck:void 0,activeDevToolHighlight:void 0});return delete o.testId,delete o.onClickWithDevToolCheck,delete o.activeDevToolHighlight,i(o)}var a=!0===n||"object"==typeof n&&n.componentOverride;return c.jsx(e.Element,Q({},e.componentProps,{activeDevToolHighlight:a,onClickWithDevToolCheck:function(t){return function(n){if(!n.shiftKey||!a)return t&&t(n);r({overrideKey:e.renderOverrideKey,componentProps:e.componentProps}),n.stopPropagation()}}}))},vd=function(e,t,n){return function(r){return c.jsx(hd,{Element:e,renderOverrideKey:t,componentProps:n?n(r):r})}},gd=function(e,t,n){return vd((function(n){return c.jsx(xd,{activeDevToolHighlight:n.activeDevToolHighlight,onClickWithDevToolCheck:n.onClickWithDevToolCheck,renderOverrideKey:t,children:c.jsx(e,Q({},n))})}),t,n)},bd={name:"bjn8wh",styles:"position:relative"},xd=function(e){var t;return c.jsx("div",Q({style:{display:"inherit"},css:bd,onClick:e.onClickWithDevToolCheck()},((t={})["data-componentoverride"]=null==e?void 0:e.renderOverrideKey,t),{"data-testid":e.renderOverrideKey,children:e.children}))},yd=gd((function(e){return c.jsx(du,{active:e.active})}),"renderFilterIcon"),wd=gd((function(){return c.jsx(Eu,{})}),"renderReportIcon"),jd=gd((function(){return c.jsx(Lu,{active:!0})}),"renderParametersIcon"),Cd=gd((function(){return c.jsx(pu,{})}),"renderCloseIcon"),Sd=gd((function(){return c.jsx(mu,{})}),"renderUndoIcon"),Fd=gd((function(){return c.jsx(vu,{})}),"renderCompletedIcon"),kd=gd((function(e){return c.jsx(xu,{purpose:e.purpose})}),"renderDeleteIcon"),_d=gd((function(){return c.jsx(wu,{})}),"renderEditIcon"),Td=gd((function(){return c.jsx(Cu,{})}),"renderLockedIcon"),Ad=gd((function(){return c.jsx(Fu,{})}),"renderDownloadIcon"),Dd=gd((function(){return c.jsx(_u,{})}),"renderComponentOptionsMenuIcon"),Id=gd((function(){return c.jsx(Au,{})}),"renderLibraryIcon"),Od=gd((function(e){return c.jsx(Ou,{isOpen:e.isOpen})}),"renderAccordionIcon"),Pd=gd((function(){return c.jsx(Bu,{})}),"renderSendIcon"),Ed=gd((function(){return c.jsx(Gu,{})}),"renderStopIcon"),Md=gd((function(){return c.jsx(Nu,{})}),"renderUserIcon"),Rd=gd((function(){return c.jsx(Mu,{width:20,height:20})}),"renderAIChatIcon"),Ld=gd((function(){return c.jsx(qu,{width:20,height:20})}),"renderAIIcon"),Nd=gd((function(){return c.jsx(Vu,{width:20,height:20})}),"renderThumbsUpUnselectedIcon"),zd=gd((function(){return c.jsx(Wu,{width:20,height:20})}),"renderThumbsUpSelectedIcon"),qd=gd((function(){return c.jsx(Yu,{width:20,height:20})}),"renderThumbsDownUnselectedIcon"),Bd=gd((function(){return c.jsx(Hu,{width:20,height:20})}),"renderThumbsDownSelectedIcon"),Wd=gd((function(){return c.jsx(Uu,{width:20,height:20})}),"renderSelectIcon"),Vd=gd((function(){return c.jsx(zu,{})}),"renderBackButtonArrowIcon");function Hd(){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 Yd=function(e){var t,n;return As({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,justifyContent:null==e?void 0:e.justifyContent,alignItems:null==e?void 0:e.alignItems,alignContent:null==e?void 0:e.alignContent,gridTemplateAreas:null==e?void 0:e.areas,minWidth:null==e?void 0:e.minWidth})},Ud=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"div";return c.jsx(r,{className:Hd(""+Yd(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})},Gd=Object.assign((function(){return null}),{container:function(e){return As({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 As(Q({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"},Ts,{variants:{clickable:(r={},r.true={cursor:"pointer","&:hover":Q({background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},Ts),"&: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:As({marginRight:"0.5rem",color:"inherit","&:hover":{opacity:.7}})});function Kd(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 Xd=function(){return t.useContext(Qd)},Qd=t.createContext(void 0);function Jd(e,t){if(void 0!==e)return s(e).brighten(t).css()}var Zd=function(e){return 1===e?$d:tc},$d={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,forms:{label:{fontSize:Ms.font.standard,fontWeight:Ms.font.bold,margin:"0 0 0.3rem 0"},input:{border:"2px "+Ms.colors.brand[8]+" solid",background:"#fff",borderRadius:Ms.size.borderRadius,padding:"0.35rem 0.5rem",fontSize:Ms.font.standard,color:Ms.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+Ms.colors.brand[8]+" solid",background:"#fff",borderRadius:Ms.size.borderRadius,padding:"0.35rem 0.5rem",color:Ms.colors.brand.base,fontSize:Ms.font.standard,fontWeight:"inherit",indicatorColor:Ms.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:Ms.size.borderRadius,padding:"0.26rem 0.5rem",fontSize:Ms.font.standard,color:Ms.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:Ms.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:Ms.font.header,fontWeight:Ms.font.bold,color:Ms.font.color}}}},dropdowns:{fontSize:Ms.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:Ms.size.borderRadius,border:"0px solid transparent",separatorBorder:"1px solid "+Ms.colors.brand[8],"&:hover":{background:Ms.colors.brand[5]},padding:"0.5rem"},buttons:{primary:{borderRadius:Ms.size.borderRadius,border:"1px solid rgb(48, 116, 217)",background:Ms.colors.blue,padding:"0.30rem 0.75rem",boxShadow:"0 2px 0 rgb(0 0 0 / 5%)",color:"#fff",fontSize:Ms.font.standard,"&:hover":{background:"#5795e6"}},secondary:{borderRadius:Ms.size.borderRadius,border:"1px solid "+Ms.colors.brand[20],background:"rgb(255, 255, 255)",padding:"0.30rem 0.75rem",color:Ms.font.color,fontSize:Ms.font.standard,"&:hover":{border:"1px solid rgb(209, 209, 209, 0.8)",color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}},add:{border:"2px dashed rgba(143, 143, 145, 0.2)",borderRadius:Ms.size.borderRadius,color:"#8f8f91",background:"transparent","&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:"0.75rem"},medium:{fontSize:Ms.font.standard},large:{fontSize:Ms.font.standard}},grid:{selected:{borderRadius:Ms.size.borderRadius,fontWeight:Ms.font.bold,background:"rgb(243 244 246)",fontSize:Ms.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:Ms.size.borderRadius,fontWeight:Ms.font.bold,background:"transparent",fontSize:Ms.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:Ms.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:Ms.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:Ms.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:Ms.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:Ms.font.bold,fontSize:Ms.font.standard},content:{fontSize:Ms.font.standard}},tabs:{selected:{borderRadius:Ms.size.borderRadius,padding:"0.5rem 0",fontSize:Ms.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:Ms.size.borderRadius,padding:"0.5rem 0",fontSize:Ms.font.standard,fontWeight:600,color:"rgba(0, 0, 0, 0.4)"}},lists:{title:{fontSize:14,fontWeight:Ms.font.bold},fontSize:Ms.font.standard,border:"2px solid rgb(229 231 235 / 0.6)",borderRadius:Ms.size.borderRadius,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"}},popoverMenu:{borderRadius:Ms.size.borderRadius,fontSize:Ms.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:Ms.font.bold,fontSize:Ms.font.header,color:Ms.colors.brand[90]},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Ds(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"}},tables:{th:{background:Ds(95),borderTop:0,borderBottom:"3px solid "+Ds(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+Ds(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:Ms.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Ds(70)},row:{borderBottom:"1px solid "+Ds(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}}},accordion:{iconColor:Ms.colors.blue,button:{fontWeight:Ms.font.bold,fontSize:Ms.font.standard,color:Ms.colors.blue}},dashboard:{borderColor:Ds(80),borderStyle:"solid",borderWidth:2,borderRadius:Ms.size.borderRadius,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:Ms.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 "+Ds(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Jd("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Ds(15),background:"#fff"}},icons:{borderRadius:8,color:Ds(5),padding:4,"&:hover":{color:Jd(Ds(5),.95),background:Ds(95)}}},ec=Ds(82),tc={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,version:2,forms:{label:{fontSize:14,color:Ds(0),fontWeight:500,margin:"0 0 0.3rem 0"},input:{fontSize:14,padding:"7px 1rem",color:Ds(0),fontWeight:400,border:"2px "+ec+" solid",background:"#fff",borderRadius:8,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+ec+" solid",background:"#fff",borderRadius:8,indicatorColor:Ms.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:Ds(0),fontWeight:400},dateTime:{input:{border:"2px "+ec+" solid",background:"#fff",borderRadius:8,padding:"0.26rem 0.5rem",fontSize:14,color:Ds(0),"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},date:{width:90},time:{width:40},indicatorColor:Ms.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:Ms.font.header,fontWeight:Ms.font.bold,color:Ms.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 transparent solid","&:hover":{background:Ds(95)},padding:"0.5rem 1rem"},buttons:{primary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,fontWeight:500,background:Ds(0),color:"#fff",border:"0",boxShadow:"unset",narrowPadding:"0.46rem 1rem 0.5rem","&:hover":{background:Ds(10),border:0,boxShadow:"unset"},"&:disabled":{opacity:1,background:Ds(50),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(50),border:"0"}},secondary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,background:"rgb(255, 255, 255)",fontWeight:500,color:Ds(0),border:"0",boxShadow:"unset","&:hover":{background:"#e9ebf0",border:0,boxShadow:"unset"},"&:disabled":{opacity:.7,background:"transparent",border:0},"&:hover:disabled":{opacity:.7,background:"transparent",border:0}},add:{border:"2px dashed "+Ds(70),color:Ds(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:Ms.font.bold,fontSize:Ms.font.standard},content:{fontSize:Ms.font.standard}},tabs:{selected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,background:Ds(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:Ds(50),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(50),border:"0"}},unselected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,color:Ds(25),"&:hover":{background:Ds(90)},"&:disabled":{opacity:1,background:Ds(90),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(90),border:"0"}}},lists:{title:{fontSize:14,fontWeight:Ms.font.bold},subTitle:{fontSize:14,fontWeight:Ms.font.bold,color:Ds(20),margin:"0 0 0.5rem 0"},fontSize:Ms.font.standard,borderRadius:8,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"},border:"2px solid "+ec},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:Ms.font.bold,fontSize:Ms.font.header,color:Ds(10)},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Ds(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"}},tables:{th:{background:"transparent",borderTop:0,borderBottom:"2px solid "+Ds(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid transparent",last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:Ms.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Ds(70)},row:{borderBottom:"1px solid transparent",padding:"0.5rem",borderRight:"1px solid "+Ds(70),borderLeft:"1px solid "+Ds(70)},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}},body:{cells:{padding:"7.3px 8px",fontSize:13,borderBottom:"1px solid "+Ms.colors.brand[8]},odd:{"&:hover":{background:Ms.colors.brand[5]}},even:{"&:hover":{background:Ms.colors.brand[5]}}}},accordion:{iconColor:Ms.colors.blue,button:{fontWeight:Ms.font.bold,fontSize:Ms.font.standard,color:Ms.colors.blue}},dashboard:{borderColor:Ds(80),borderStyle:"solid",borderWidth:2,borderRadius:8,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:Ds(20),fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid "+ec,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 "+Ds(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Jd("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Ds(15),background:"#fff"}},icons:{borderRadius:8,color:Ds(5),padding:4,"&:hover":{color:Jd(Ds(5),.95),background:Ds(95)}}},nc=f({key:"css"}),rc=function(e){var t,n,r=null!=(t=null==(n=e.theme)?void 0:n.version)?t:2,o=i.defaultsDeep({},ic(r,null==e?void 0:e.theme,null==e?void 0:e.storedTheme),Zd(r));return c.jsx(Qd.Provider,{value:o,children:c.jsx(d.CacheProvider,{value:nc,children:null==e?void 0:e.children})})},ic=function(e,t,n){var r,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,j,C,S,F,k,_,T,A,D,I={baseFont:{fontSize:null!=(r=null!=(o=null==t||null==(a=t.baseFont)?void 0:a.fontSize)?o:null==n?void 0:n.fontSize)?r:Ms.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:Ms.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:Ms.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:Zd(e).colors,rowLimit:null!=(y=null!=(w=null==t?void 0:t.rowLimit)?w:null==n?void 0:n.rowLimit)?y:Zd(e).rowLimit,detail:null!=(j=null!=(C=null==t?void 0:t.detail)?C:null==n?void 0:n.detail)?j:Zd(e).detail,fontFamily:null!=(S=null!=(F=null==t?void 0:t.fontFamily)?F:null==n?void 0:n.fontFamily)?S:Ms.font.sanSerif,fontSize:null!=(k=null!=(_=null==t?void 0:t.fontSize)?_:null==n?void 0:n.fontSize)?k:Ms.font.sanSerif,dashboard:{icon:{color:null!=(T=null==t||null==(A=t.dashboard)||null==(A=A.icon)?void 0:A.color)?T:null==(D=Zd(e))||null==(D=D.dashboard)||null==(D=D.icon)?void 0:D.color}}};return i.merge({},t,I)},oc=t.createContext(!1);function ac(e){return c.jsx(oc.Provider,{value:e.force,children:e.children})}function lc(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,lc),a}var sc=["static"],uc=["unmount"],dc=["as","children","refName"],cc=function(e){return e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e}({}),pc=function(e){return e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e}({});function fc(e){var t=e.slot,n=e.defaultTag,r=e.features,i=e.visible,o=void 0===i||i,a=e.name,l=hc(e.theirProps,e.ourProps);if(o)return mc(l,t,n,a);var s=null!=r?r:cc.None;if(s&cc.Static){var u=l.static,d=void 0!==u&&u,c=te(l,sc);if(d)return mc(c,t,n,a)}if(s&cc.RenderStrategy){var p,f=l.unmount,m=void 0===f||f,h=te(l,uc);return lc(m?pc.Unmount:pc.Hidden,((p={})[pc.Unmount]=function(){return null},p[pc.Hidden]=function(){return mc(Q({},h,{hidden:!0,style:{display:"none"}}),t,n,a)},p))}return mc(l,t,n,a)}function mc(e,n,r,i){var o;void 0===n&&(n={});var a=bc(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=te(a,dc),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(gc(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({},hc(m.props,gc(bc(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=ie(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({},bc(p,["ref"]),s!==t.Fragment&&f,s!==t.Fragment&&h),m)}function hc(){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=ie(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 vc(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function gc(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}function bc(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),i=ie(t);!(n=i()).done;){var o=n.value;o in r&&delete r[o]}return r}var xc="undefined"==typeof window||"undefined"==typeof document,yc=xc?t.useEffect:t.useLayoutEffect;function wc(e){var n=t.useRef(e);return yc((function(){n.current=e}),[e]),n}var jc=function(e){var t=wc(e);return n.useCallback((function(){return t.current.apply(t,arguments)}),[t])},Cc=Symbol();function Sc(){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=jc((function(e){for(var t,n=ie(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[Cc])}))?void 0:o}var Fc,kc=function(e){return 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",e}({}),_c={serverHandoffComplete:!1};function Tc(){var e=t.useState(_c.serverHandoffComplete),n=e[0],r=e[1];return t.useEffect((function(){!0!==n&&r(!0)}),[n]),t.useEffect((function(){!1===_c.serverHandoffComplete&&(_c.serverHandoffComplete=!0)}),[]),n}var Ac=0;function Dc(){return++Ac}var Ic=null!=(Fc=n.useId)?Fc:function(){var e=Tc(),t=n.useState(e?Dc:null),r=t[0],i=t[1];return yc((function(){null===r&&i(Dc())}),[r]),null!=r?""+r:void 0},Oc=["features"],Pc=function(e){return e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e}({}),Ec=vc((function(e,t){var n=e.features,r=void 0===n?Pc.None:n,i=te(e,Oc);return fc({ourProps:{ref:t,"aria-hidden":(r&Pc.Focusable)===Pc.Focusable||void 0,style:Q({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&Pc.Hidden)===Pc.Hidden&&!((r&Pc.Focusable)===Pc.Focusable)&&{display:"none"})},theirProps:i,slot:{},defaultTag:"div",name:"Hidden"})}));function Mc(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}function Rc(){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 Mc((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=ie(e.splice(0));!(t=n()).done;)(0,t.value)()},workQueue:function(){return X(G().mark((function e(){var n,r,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=ie(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 Lc(e){return xc?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}var Nc=["[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(","),zc=function(e){return 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",e}({}),qc=function(e){return e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e}({}),Bc=function(e){return e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e}(Bc||{}),Wc=function(e){return e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e}({});function Vc(e){null==e||e.focus({preventScroll:!0})}var Hc=["textarea","input"].join(",");function Yc(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 Uc(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?Yc(e):e:function(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(Nc))}(e);r=null!=(i=r)?i:o.activeElement;var l,s,u=function(){if(t&(zc.First|zc.Next))return Bc.Next;if(t&(zc.Previous|zc.Last))return Bc.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),d=function(){if(t&zc.First)return 0;if(t&zc.Previous)return Math.max(0,a.indexOf(r))-1;if(t&zc.Next)return Math.max(0,a.indexOf(r))+1;if(t&zc.Last)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),c=t&zc.NoScroll?{preventScroll:!0}:{},p=0,f=a.length,m=void 0;do{var h;if(p>=f||p+f<=0)return qc.Error;var v=d+p;if(t&zc.WrapAround)v=(v+f)%f;else{if(v<0)return qc.Underflow;if(v>=f)return qc.Overflow}null==(h=m=a[v])||h.focus(c),p+=u}while(m!==o.activeElement);return t&(zc.Next|zc.Previous)&&null!=(s=null==(l=m)||null==l.matches?void 0:l.matches(Hc))&&s&&m.select(),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0"),qc.Success}var Gc=function(e){return e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e}({});function Kc(){var e=t.useRef(!1);return yc((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function Xc(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((function(){return Lc.apply(void 0,n)}),[].concat(n))}function Qc(e,n,r,i){var o=wc(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 Jc(e,n){var r=t.useRef([]),i=jc(e);t.useEffect((function(){for(var e,t=[].concat(r.current),o=ie(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))}var Zc=["initialFocus","containers","features"],$c=function(e){return 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",e}($c||{}),ep=Object.assign(vc((function(e,n){var r=t.useRef(null),i=Sc(r,n),o=e.initialFocus,a=e.containers,l=e.features,s=void 0===l?$c.All:l,u=te(e,Zc);Tc()||(s=$c.None);var d=Xc(r);!function(e,n){var r=e.ownerDocument,i=t.useRef(null);Qc(null==r?void 0:r.defaultView,"focusout",(function(e){n&&(i.current||(i.current=e.target))}),!0),Jc((function(){n||((null==r?void 0:r.activeElement)===(null==r?void 0:r.body)&&Vc(i.current),i.current=null)}),[n]);var o=t.useRef(!1);t.useEffect((function(){return o.current=!1,function(){o.current=!0,Mc((function(){o.current&&(Vc(i.current),i.current=null)}))}}),[])}({ownerDocument:d},Boolean(s&$c.RestoreFocus));var p=function(e,n){var r=e.ownerDocument,i=e.container,o=e.initialFocus,a=t.useRef(null),l=Kc();return Jc((function(){if(n){var e=i.current;e&&Mc((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?Vc(o.current):Uc(e,zc.First)===qc.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&$c.InitialFocus));!function(e,t){var n=e.ownerDocument,r=e.container,i=e.containers,o=e.previousActiveElement,a=Kc();Qc(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=ie(e);!(n=r()).done;){var i;if(null!=(i=n.value.current)&&i.contains(t))return!0}return!1}(n,s)?(o.current=s,Vc(s)):(e.preventDefault(),e.stopPropagation(),Vc(l)):Vc(o.current)}}}),!0)}({ownerDocument:d,container:r,containers:a,previousActiveElement:p},Boolean(s&$c.FocusLock));var f=function(){var e,n=t.useRef(Gc.Forwards);return e=wc((function(e){"Tab"===e.key&&(n.current=e.shiftKey?Gc.Backwards:Gc.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=jc((function(){var e,t=r.current;t&&lc(f.current,((e={})[Gc.Forwards]=function(){return Uc(t,zc.First)},e[Gc.Backwards]=function(){return Uc(t,zc.Last)},e))})),h={ref:i};return c.jsxs(c.Fragment,{children:[Boolean(s&$c.TabLock)&&c.jsx(Ec,{as:"button",type:"button",onFocus:m,features:Pc.Focusable}),fc({ourProps:h,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(s&$c.TabLock)&&c.jsx(Ec,{as:"button",type:"button",onFocus:m,features:Pc.Focusable})]})})),{features:$c}),tp=new Set,np=new Map;function rp(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function ip(e){var t=np.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var op=["target"],ap="headlessui-portal-root",lp=t.Fragment,sp=vc((function(e,n){var r,i,o=e,a=t.useRef(null),l=Sc((void 0===r&&(r=!0),Object.assign((function(e){a.current=e}),((i={})[Cc]=r,i))),n),s=Xc(a),u=function(e){var n=t.useContext(oc),r=t.useContext(dp),i=Xc(e),o=t.useState((function(){if(!n&&null!==r)return null;if(xc)return null;var e=null==i?void 0:i.getElementById(ap);if(e)return e;if(null===i)return null;var t=i.createElement("div");return t.setAttribute("id",ap),t.setAttribute("data-testid",ap),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 xc?null:null!=(e=null==s?void 0:s.createElement("div"))?e:null}))[0],c=Tc(),p=t.useRef(!1);return yc((function(){if(p.current=!1,u&&d)return u.contains(d)||(d.setAttribute("data-headlessui-portal",""),u.appendChild(d)),function(){p.current=!0,Mc((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(fc({ourProps:{ref:l},theirProps:o,defaultTag:lp,name:"Portal"}),d):null})),up=t.Fragment,dp=t.createContext(null),cp=Object.assign(sp,{Group:vc((function(e,t){var n=e.target,r=te(e,op),i=Sc(t);return c.jsx(dp.Provider,{value:n,children:fc({ourProps:{ref:i},theirProps:r,defaultTag:up,name:"Popover.Group"})})}))}),pp=t.createContext(null);function fp(){var e=t.useContext(pp);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,fp),n}return e}var mp=vc((function(e,t){var n=fp(),r="headlessui-description-"+Ic(),i=Sc(t);yc((function(){return n.register(r)}),[r,n.register]);var o=e;return fc({ourProps:Q({ref:i},n.props,{id:r}),theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})})),hp=t.createContext(null);hp.displayName="OpenClosedContext";var vp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}({});function gp(){return t.useContext(hp)}function bp(e){return c.jsx(hp.Provider,{value:e.value,children:e.children})}var xp=t.createContext((function(){}));xp.displayName="StackContext";var yp=function(e){return e[e.Add=0]="Add",e[e.Remove=1]="Remove",e}({});function wp(e){var n=e.children,r=e.onUpdate,i=e.type,o=e.element,a=e.enabled,l=t.useContext(xp),s=jc((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 yc((function(){var e=void 0===a||!0===a;return e&&s(yp.Add,i,o),function(){e&&s(yp.Remove,i,o)}}),[s,i,o,a]),c.jsx(xp.Provider,{value:s,children:n})}function jp(e,n,r){var i=wc(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])}var Cp,Sp=["open","onClose","initialFocus","__demoMode"],Fp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(Fp||{}),kp=function(e){return e[e.SetTitleId=0]="SetTitleId",e}(kp||{}),_p=((Cp={})[kp.SetTitleId]=function(e,t){return e.titleId===t.id?e:Q({},e,{titleId:t.id})},Cp),Tp=t.createContext(null);function Ap(e){var n=t.useContext(Tp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ap),r}return n}function Dp(e,t){return lc(t.type,_p,e,t)}Tp.displayName="DialogContext";var Ip,Op=cc.RenderStrategy|cc.Static,Pp=vc((function(e,n){var r,i=e.open,o=e.onClose,a=e.initialFocus,l=e.__demoMode,s=void 0!==l&&l,u=te(e,Sp),d=t.useState(0),p=d[0],f=d[1],m=gp();void 0===i&&null!==m&&(i=lc(m,((r={})[vp.Open]=!0,r[vp.Closed]=!1,r)));var h=t.useRef(new Set),v=t.useRef(null),g=Sc(v,n),b=t.useRef(null),x=Xc(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 j=i?Fp.Open:Fp.Closed,C=t.useReducer(Dp,{titleId:null,descriptionId:null,panelRef:t.createRef()}),S=C[0],F=C[1],k=jc((function(){return o(!1)})),_=jc((function(e){return F({type:kp.SetTitleId,id:e})})),T=!!Tc()&&!s&&j===Fp.Open,A=p>1,D=null!==t.useContext(Tp),I=A?"parent":"leaf";!function(e,t){void 0===t&&(t=!0),yc((function(){if(t&&e.current){var n=e.current,r=Lc(n);if(r){tp.add(n);for(var i,o=ie(np.keys());!(i=o()).done;){var a=i.value;a.contains(n)&&(ip(a),np.delete(a))}return r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=ie(tp);!(t=n()).done;)if(e.contains(t.value))return;1===tp.size&&(np.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),rp(e))}})),function(){if(tp.delete(n),tp.size>0)r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!np.has(e)){for(var t,n=ie(tp);!(t=n()).done;)if(e.contains(t.value))return;np.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),rp(e)}}));else for(var e,t=ie(np.keys());!(e=t()).done;){var i=e.value;ip(i),np.delete(i)}}}}}),[t])}(v,!!A&&T),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=ie(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=Wc.Loose)&&(p=Wc.Strict),(c=a)!==(null==(f=Lc(c))?void 0:f.body)&&lc(p,((m={})[Wc.Strict]=function(){return c.matches(Nc)},m[Wc.Loose]=function(){for(var e=c;null!==e;){if(e.matches(Nc))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);jp("mousedown",(function(e){var t;i.current&&(a.current=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target)}),!0),jp("click",(function(e){a.current&&(o(e,(function(){return a.current})),a.current=null)}),!0),jp("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,T&&!A),Qc(null==x?void 0:x.defaultView,"keydown",(function(e){e.defaultPrevented||e.key===kc.Escape&&j===Fp.Open&&(A||(e.preventDefault(),e.stopPropagation(),k()))})),function(e,n){t.useEffect((function(){var t;if(n&&e){var r=Rc(),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,j===Fp.Open&&!D),t.useEffect((function(){if(j===Fp.Open&&v.current){var e=new IntersectionObserver((function(e){for(var t,n=ie(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()}}}),[j,v,k]);var O=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=jc((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(pp.Provider,{value:i,children:e.children})}}),[r])]}(),P=O[0],E=O[1],M="headlessui-dialog-"+Ic(),R=t.useMemo((function(){return[{dialogState:j,close:k,setTitleId:_},S]}),[j,S,k,_]),L=t.useMemo((function(){return{open:j===Fp.Open}}),[j]),N={ref:g,id:M,role:"dialog","aria-modal":j===Fp.Open||void 0,"aria-labelledby":S.titleId,"aria-describedby":P};return c.jsxs(wp,{type:"Dialog",enabled:j===Fp.Open,element:v,onUpdate:jc((function(e,t,n){var r;"Dialog"===t&&lc(e,((r={})[yp.Add]=function(){h.current.add(n),f((function(e){return e+1}))},r[yp.Remove]=function(){h.current.add(n),f((function(e){return e-1}))},r))})),children:[c.jsx(ac,{force:!0,children:c.jsx(cp,{children:c.jsx(Tp.Provider,{value:R,children:c.jsx(cp.Group,{target:v,children:c.jsx(ac,{force:!1,children:c.jsx(E,{slot:L,name:"Dialog.Description",children:c.jsx(ep,{initialFocus:a,containers:h,features:T?lc(I,{parent:ep.features.RestoreFocus,leaf:ep.features.All&~ep.features.FocusLock}):ep.features.None,children:fc({ourProps:N,theirProps:u,slot:L,defaultTag:"div",features:Op,visible:j===Fp.Open,name:"Dialog"})})})})})})})}),c.jsx(Ec,{features:Pc.Hidden,ref:b})]})})),Ep=vc((function(e,n){var r=Ap("Dialog.Overlay")[0],i=r.dialogState,o=r.close;return fc({ourProps:{ref:Sc(n),id:"headlessui-dialog-overlay-"+Ic(),"aria-hidden":!0,onClick:jc((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===Fp.Open}}),[i]),defaultTag:"div",name:"Dialog.Overlay"})})),Mp=Object.assign(Pp,{Backdrop:vc((function(e,n){var r=Ap("Dialog.Backdrop"),i=r[0].dialogState,o=r[1],a=Sc(n),l="headlessui-dialog-backdrop-"+Ic();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===Fp.Open}}),[i]);return c.jsx(ac,{force:!0,children:c.jsx(cp,{children:fc({ourProps:{ref:a,id:l,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})})})})),Panel:vc((function(e,n){var r=Ap("Dialog.Panel"),i=r[0].dialogState,o=Sc(n,r[1].panelRef),a="headlessui-dialog-panel-"+Ic(),l=t.useMemo((function(){return{open:i===Fp.Open}}),[i]);return fc({ourProps:{ref:o,id:a,onClick:jc((function(e){e.stopPropagation()}))},theirProps:e,slot:l,defaultTag:"div",name:"Dialog.Panel"})})),Overlay:Ep,Title:vc((function(e,n){var r=Ap("Dialog.Title")[0],i=r.dialogState,o=r.setTitleId,a="headlessui-dialog-title-"+Ic(),l=Sc(n);t.useEffect((function(){return o(a),function(){return o(null)}}),[a,o]);var s=t.useMemo((function(){return{open:i===Fp.Open}}),[i]);return fc({ourProps:{ref:l,id:a},theirProps:e,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),Description:mp});function Rp(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 Lp(e,n){var r=t.useState((function(){return Rp(e)})),i=r[0],o=r[1];return yc((function(){o(Rp(e))}),[e.type,e.as]),yc((function(){i||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[i,n]),i}var Np,zp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(zp||{}),qp=function(e){return 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",e}(qp||{});(Ip={})[qp.ToggleDisclosure]=function(e){var t;return Q({},e,{disclosureState:lc(e.disclosureState,(t={},t[zp.Open]=zp.Closed,t[zp.Closed]=zp.Open,t))})},Ip[qp.CloseDisclosure]=function(e){return e.disclosureState===zp.Closed?e:Q({},e,{disclosureState:zp.Closed})},Ip[qp.LinkPanel]=function(e){return!0===e.linkedPanel?e:Q({},e,{linkedPanel:!0})},Ip[qp.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:Q({},e,{linkedPanel:!1})},Ip[qp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:Q({},e,{buttonId:t.buttonId})},Ip[qp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:Q({},e,{panelId:t.panelId})},t.createContext(null).displayName="DisclosureContext",t.createContext(null).displayName="DisclosureAPIContext",t.createContext(null).displayName="DisclosurePanelContext";var Bp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(Bp||{}),Wp=function(e){return 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",e}(Wp||{});function Vp(e){var n=e.onFocus,r=t.useState(!0),i=r[1];return r[0]?c.jsx(Ec,{as:"button",type:"button",features:Pc.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}(Np={})[Wp.TogglePopover]=function(e){var t;return Q({},e,{popoverState:lc(e.popoverState,(t={},t[Bp.Open]=Bp.Closed,t[Bp.Closed]=Bp.Open,t))})},Np[Wp.ClosePopover]=function(e){return e.popoverState===Bp.Closed?e:Q({},e,{popoverState:Bp.Closed})},Np[Wp.SetButton]=function(e,t){return e.button===t.button?e:Q({},e,{button:t.button})},Np[Wp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:Q({},e,{buttonId:t.buttonId})},Np[Wp.SetPanel]=function(e,t){return e.panel===t.panel?e:Q({},e,{panel:t.panel})},Np[Wp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:Q({},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 Hp,Yp=["defaultIndex","vertical","manual","onChange","selectedIndex"],Up=function(e){return 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",e}(Up||{}),Gp=((Hp={})[Up.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 Q({},e,{selectedIndex:e.tabs.indexOf(n[0])});if(t.index>e.tabs.length)return Q({},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?Q({},e,{selectedIndex:e.tabs.indexOf(o)}):e},Hp[Up.RegisterTab]=function(e,t){var n;if(e.tabs.includes(t.tab))return e;var r=e.tabs[e.selectedIndex],i=Yc([].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),Q({},e,{tabs:i,selectedIndex:o})},Hp[Up.UnregisterTab]=function(e,t){return Q({},e,{tabs:e.tabs.filter((function(e){return e!==t.tab}))})},Hp[Up.RegisterPanel]=function(e,t){return e.panels.includes(t.panel)?e:Q({},e,{panels:Yc([].concat(e.panels,[t.panel]),(function(e){return e.current}))})},Hp[Up.UnregisterPanel]=function(e,t){return Q({},e,{panels:e.panels.filter((function(e){return e!==t.panel}))})},Hp),Kp=t.createContext(null);function Xp(e){var n=t.useContext(Kp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Xp),r}return n}Kp.displayName="TabsSSRContext";var Qp=t.createContext(null);function Jp(e){var n=t.useContext(Qp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Jp),r}return n}Qp.displayName="TabsDataContext";var Zp=t.createContext(null);function $p(e){var n=t.useContext(Zp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,$p),r}return n}function ef(e,t){return lc(t.type,Gp,e,t)}Zp.displayName="TabsActionsContext";var tf=t.Fragment,nf=vc((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=te(e,Yp),m=a?"vertical":"horizontal",h=s?"manual":"auto",v=null!==p,g=Sc(n),b=t.useReducer(ef,{selectedIndex:null!=p?p:i,tabs:[],panels:[]}),x=b[0],y=b[1],w=t.useMemo((function(){return{selectedIndex:x.selectedIndex}}),[x.selectedIndex]),j=wc(u||function(){}),C=wc(x.tabs),S=t.useMemo((function(){return Q({orientation:m,activation:h},x)}),[m,h,x]),F=wc(v?e.selectedIndex:x.selectedIndex),k=t.useMemo((function(){return{registerTab:function(e){return y({type:Up.RegisterTab,tab:e}),function(){return y({type:Up.UnregisterTab,tab:e})}},registerPanel:function(e){return y({type:Up.RegisterPanel,panel:e}),function(){return y({type:Up.UnregisterPanel,panel:e})}},change:function(e){F.current!==e&&j.current(e),v||y({type:Up.SetSelectedIndex,index:e})}}}),[y,v]);yc((function(){y({type:Up.SetSelectedIndex,index:null!=p?p:i})}),[p]);var _=t.useRef({tabs:[],panels:[]}),T={ref:g};return c.jsx(Kp.Provider,{value:_,children:c.jsx(Zp.Provider,{value:k,children:c.jsxs(Qp.Provider,{value:S,children:[S.tabs.length<=0&&c.jsx(Vp,{onFocus:function(){for(var e,t=ie(C.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}}),fc({ourProps:T,theirProps:f,slot:w,defaultTag:tf,name:"Tabs"})]})})})})),rf=vc((function(e,t){var n=Jp("Tab.List"),r=n.orientation,i=n.selectedIndex;return fc({ourProps:{ref:Sc(t),role:"tablist","aria-orientation":r},theirProps:e,slot:{selectedIndex:i},defaultTag:"div",name:"Tabs.List"})})),of=cc.RenderStrategy|cc.Static,af=Object.assign(vc((function(e,n){var r,i="headlessui-tabs-tab-"+Ic(),o=Jp("Tab"),a=o.orientation,l=o.activation,s=o.selectedIndex,u=o.tabs,d=o.panels,c=$p("Tab"),p=Jp("Tab"),f=Xp("Tab"),m=t.useRef(null),h=Sc(m,n);yc((function(){return c.registerTab(m)}),[c,m]);var v=f.current.tabs.indexOf(i);-1===v&&(v=f.current.tabs.push(i)-1);var g=u.indexOf(m);-1===g&&(g=v);var b=g===s,x=jc((function(e){var t=e();if(t===qc.Success&&"auto"===l){var n,r=null==(n=Lc(m))?void 0:n.activeElement,i=p.tabs.findIndex((function(e){return e.current===r}));-1!==i&&c.change(i)}return t})),y=jc((function(e){var t=u.map((function(e){return e.current})).filter(Boolean);if(e.key===kc.Space||e.key===kc.Enter)return e.preventDefault(),e.stopPropagation(),void c.change(g);switch(e.key){case kc.Home:case kc.PageUp:return e.preventDefault(),e.stopPropagation(),x((function(){return Uc(t,zc.First)}));case kc.End:case kc.PageDown:return e.preventDefault(),e.stopPropagation(),x((function(){return Uc(t,zc.Last)}))}return x((function(){return lc(a,{vertical:function(){return e.key===kc.ArrowUp?Uc(t,zc.Previous|zc.WrapAround):e.key===kc.ArrowDown?Uc(t,zc.Next|zc.WrapAround):qc.Error},horizontal:function(){return e.key===kc.ArrowLeft?Uc(t,zc.Previous|zc.WrapAround):e.key===kc.ArrowRight?Uc(t,zc.Next|zc.WrapAround):qc.Error}})}))===qc.Success?e.preventDefault():void 0})),w=t.useRef(!1),j=jc((function(){var e;w.current||(w.current=!0,null==(e=m.current)||e.focus(),c.change(g),Mc((function(){w.current=!1})))})),C=jc((function(e){e.preventDefault()})),S=t.useMemo((function(){return{selected:b}}),[b]),F=e;return fc({ourProps:{ref:h,onKeyDown:y,onMouseDown:C,onClick:j,id:i,role:"tab",type:Lp(e,m),"aria-controls":null==(r=d[g])||null==(r=r.current)?void 0:r.id,"aria-selected":b,tabIndex:b?0:-1},theirProps:F,slot:S,defaultTag:"button",name:"Tabs.Tab"})})),{Group:nf,List:rf,Panels:vc((function(e,n){var r=Jp("Tab.Panels").selectedIndex;return fc({ourProps:{ref:Sc(n)},theirProps:e,slot:t.useMemo((function(){return{selectedIndex:r}}),[r]),defaultTag:"div",name:"Tabs.Panels"})})),Panel:vc((function(e,n){var r,i,o,a=Jp("Tab.Panel"),l=a.selectedIndex,s=a.tabs,u=a.panels,d=$p("Tab.Panel"),p=Xp("Tab.Panel"),f="headlessui-tabs-panel-"+Ic(),m=t.useRef(null),h=Sc(m,n);yc((function(){return d.registerPanel(m)}),[d,m]);var v=p.current.panels.indexOf(f);-1===v&&(v=p.current.panels.push(f)-1);var g=u.indexOf(m);-1===g&&(g=v);var b=g===l,x=t.useMemo((function(){return{selected:b}}),[b]),y={ref:h,id:f,role:"tabpanel","aria-labelledby":null==(r=s[g])||null==(r=r.current)?void 0:r.id,tabIndex:b?0:-1};return b||null!=(i=e.unmount)&&!i||null!=(o=e.static)&&o?fc({ourProps:y,theirProps:e,slot:x,defaultTag:"div",features:of,visible:b,name:"Tabs.Panel"}):c.jsx(Ec,Q({as:"span"},y))}))});function lf(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 sf(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)}var uf=function(e){return e.Ended="ended",e.Cancelled="cancelled",e}({});function df(){var e=t.useState(Rc)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}var cf=["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"],pf=["show","appear","unmount"];function ff(e){return void 0===e&&(e=""),e.split(" ").filter((function(e){return e.trim().length>1}))}var mf=t.createContext(null);mf.displayName="TransitionContext";var hf=function(e){return e.Visible="visible",e.Hidden="hidden",e}(hf||{}),vf=t.createContext(null);function gf(e){return"children"in e?gf(e.children):e.current.filter((function(e){return null!==e.el.current})).filter((function(e){return e.state===hf.Visible})).length>0}function bf(e,n){var r=wc(e),i=t.useRef([]),o=Kc(),a=df(),l=jc((function(e,t){var n;void 0===t&&(t=pc.Hidden);var l=i.current.findIndex((function(t){return t.el===e}));-1!==l&&(lc(t,((n={})[pc.Unmount]=function(){i.current.splice(l,1)},n[pc.Hidden]=function(){i.current[l].state=hf.Hidden},n)),a.microTask((function(){!gf(i)&&o.current&&(null==r.current||r.current())})))})),s=jc((function(e){var t=i.current.find((function(t){return t.el===e}));return t?t.state!==hf.Visible&&(t.state=hf.Visible):i.current.push({el:e,state:hf.Visible}),function(){return l(e,pc.Unmount)}})),u=t.useRef([]),d=t.useRef(Promise.resolve()),c=t.useRef({enter:[],leave:[],idle:[]}),p=jc((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=jc((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 xf(){}vf.displayName="NestingContext";var yf=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function wf(e){for(var t={},n=0,r=yf;n<r.length;n++){var i,o=r[n];t[o]=null!=(i=e[o])?i:xf}return t}var jf=cc.RenderStrategy,Cf=vc((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=te(e,cf),g=t.useRef(null),b=Sc(g,n),x=v.unmount?pc.Unmount:pc.Hidden,y=function(){var e=t.useContext(mf);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,j=y.appear,C=y.initial,S=t.useState(w?hf.Visible:hf.Hidden),F=S[0],k=S[1],_=function(){var e=t.useContext(vf);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=_.register,A=_.unregister,D=t.useRef(null);t.useEffect((function(){return T(g)}),[T,g]),t.useEffect((function(){var e;if(x===pc.Hidden&&g.current){if(!w||F===hf.Visible)return lc(F,((e={})[hf.Hidden]=function(){return A(g)},e[hf.Visible]=function(){return T(g)},e));k(hf.Visible)}}),[F,g,T,A,w,x]);var I=wc({enter:ff(s),enterFrom:ff(u),enterTo:ff(d),entered:ff(p),leave:ff(f),leaveFrom:ff(m),leaveTo:ff(h)}),O=function(e){var n=t.useRef(wf(e));return t.useEffect((function(){n.current=wf(e)}),[e]),n}({beforeEnter:i,afterEnter:o,beforeLeave:a,afterLeave:l}),P=Tc();t.useEffect((function(){if(P&&F===hf.Visible&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,F,P]);var E=C&&!j,M=P?E||D.current===w?"idle":w?"enter":"leave":"idle",R=jc((function(e){return lc(e,{enter:function(){return O.current.beforeEnter()},leave:function(){return O.current.beforeLeave()},idle:function(){}})})),L=jc((function(e){return lc(e,{enter:function(){return O.current.afterEnter()},leave:function(){return O.current.afterLeave()},idle:function(){}})})),N=bf((function(){k(hf.Hidden),A(g)}),_);!function(e){var t=e.container,n=e.direction,r=e.classes,i=e.onStart,o=e.onStop,a=Kc(),l=df(),s=wc(n);yc((function(){var e=Rc();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=Rc(),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=lc(i,{enter:function(){return t.enter},leave:function(){return t.leave}}),s=lc(i,{enter:function(){return t.enterTo},leave:function(){return t.leaveTo}}),u=lc(i,{enter:function(){return t.enterFrom},leave:function(){return t.leaveFrom}});return sf.apply(void 0,[e].concat(t.enter,t.enterTo,t.enterFrom,t.leave,t.leaveFrom,t.leaveTo,t.entered)),lf.apply(void 0,[e].concat(l,u)),o.nextFrame((function(){sf.apply(void 0,[e].concat(u)),lf.apply(void 0,[e].concat(s)),function(e,t){var n=Rc();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(uf.Ended),o.splice(0).forEach((function(e){return e()})))})),n.addEventListener(e,"transitioncancel",(function(e){e.target===e.currentTarget&&(t(uf.Cancelled),o.splice(0).forEach((function(e){return e()})))}))))})))}else t(uf.Ended);n.add((function(){return t(uf.Cancelled)}))}(e,(function(n){return n===uf.Ended&&(sf.apply(void 0,[e].concat(l)),lf.apply(void 0,[e].concat(t.entered))),a(n)}))})),o.dispose}(n,r.current,"enter"===s.current,(function(t){var n;e.dispose(),lc(t,((n={})[uf.Ended]=function(){o.current(s.current)},n[uf.Cancelled]=function(){},n))}))),e.dispose}),[n])}({container:g,classes:I,direction:M,onStart:wc((function(e){N.onStart(g,e,R)})),onStop:wc((function(e){N.onStop(g,e,L),"leave"!==e||gf(N)||(k(hf.Hidden),A(g))}))}),t.useEffect((function(){E&&(D.current=x===pc.Hidden?null:w)}),[w,E,F]);var z=v,q={ref:b};return c.jsx(vf.Provider,{value:N,children:c.jsx(bp,{value:lc(F,(r={},r[hf.Visible]=vp.Open,r[hf.Hidden]=vp.Closed,r)),children:fc({ourProps:q,theirProps:z,defaultTag:"div",features:jf,visible:F===hf.Visible,name:"Transition.Child"})})})})),Sf=vc((function(e,n){var r=e.show,i=e.appear,o=void 0!==i&&i,a=e.unmount,l=te(e,pf),s=t.useRef(null),u=Sc(s,n);Tc();var d,p=gp();if(void 0===r&&null!==p&&(r=lc(p,((d={})[vp.Open]=!0,d[vp.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?hf.Visible:hf.Hidden),m=f[0],h=f[1],v=bf((function(){h(hf.Hidden)})),g=t.useState(!0),b=g[0],x=g[1],y=t.useRef([r]);yc((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(hf.Visible);else if(gf(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(hf.Hidden)}else h(hf.Hidden)}),[r,v]);var j={unmount:a};return c.jsx(vf.Provider,{value:v,children:c.jsx(mf.Provider,{value:w,children:fc({ourProps:Q({},j,{as:t.Fragment,children:c.jsx(Cf,Q({ref:u},j,l))}),theirProps:{},defaultTag:t.Fragment,features:jf,visible:m===hf.Visible,name:"Transition"})})})})),Ff=Object.assign(Sf,{Child:vc((function(e,n){var r=null!==t.useContext(mf),i=null!==gp();return c.jsx(c.Fragment,{children:c.jsx(!r&&i?Sf:Cf,Q({ref:n},e))})})),Root:Sf}),kf=function(e){var t,n,r,i,o,a,l,s;return As(Q({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,gridArea:null==e?void 0:e.area,bottom:null==e?void 0:e.bottom,lineHeight:null==e?void 0:e.lineHeight,whiteSpace:null!=e&&e.nowrap?"nowrap":void 0,borderTop:null==e?void 0:e.borderTop},function(e){var t={};return null!=e&&e.mdWidth&&(t=Q({},t,{"@media (max-width: 1366px)":{width:null==e?void 0:e.mdWidth}})),null!=e&&e.smWidth&&(t=Q({},t,{"@media (max-width: 920px)":{width:null==e?void 0:e.smWidth}})),t}(e)))},_f=function(e){var t,n,r,i,o,a=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=Q({padding:0,border:0,marginY:0,marginX:0},e)),c.jsx(a,{className:Hd(""+kf(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=e["data-component"])?i:"View","data-themeapi":e["data-themeapi"],"data-testid":e["data-testid"],role:e.role,children:null==(o=e)?void 0:o.children})},Tf=function(e){var n=e.width,r=void 0===n?170:n,i=t.useRef(null);function o(){null==e||e.onClose()}Kd(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=Xd();return null!=e&&e.position?c.jsx(ac,{force:!0,children:c.jsx(cp,{children:c.jsx("div",{style:Df(r,null==e?void 0:e.position,null==e?void 0:e.align),"data-component":"popover-menu-container",ref:i,className:Gd.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})})}):c.jsx("div",{className:Gd.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})},Af=Object.assign(Tf,{Options:function(e){return c.jsx(Ud,{rows:["auto"],gap:"0.5rem",children:c.jsx(_f,{paddingY:null!=e&&e.padding?"0.5rem":void 0,children:null==e?void 0:e.children})})},Option:function(e){var t=Xd();return c.jsx("li",{className:""+Gd.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:Tf,DisplayWrapper:function(e){var t=e.width,n=void 0===t?160:t,r=Xd();return c.jsx("div",{className:""+Gd.container(null==r?void 0:r.popoverMenu),style:{width:n},children:null==e?void 0:e.children})}});function Df(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 If(){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 Of={convert:!1,stripUnknown:!0},Pf=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}},Ef={"&::-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"}},Mf=As({width:"100%"}),Rf=Object.assign((function(){return null}),{dropdown:function(e,t){return As({marginTop:8,width:null!=e?e:void 0,minWidth:null!=t?t:void 0,position:"absolute",top:"100%",zIndex:40,left:0,variants:{fixedHeight:{on:{maxHeight:328},withAction:{maxHeight:288}}}})},optionWrappper:function(e,t){return As(Q({fontSize:null==e?void 0:e.fontSize,position:"relative",top:"100%",left:0,overflow:"overlay",borderRadius:t||null==e?void 0:e.borderRadius,borderTopLeftRadius:t?null==e?void 0:e.borderRadius:void 0,borderTopRightRadius:t?null==e?void 0:e.borderRadius:void 0,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:328},withAction:{maxHeight:288}}}},Ef))},option:function(e){return As({position:"relative",width:"100%",cursor:"pointer",borderBottom:null==e?void 0:e.separatorBorder,"&:hover":null==e?void 0:e["&:hover"]})},button:function(e){return As({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:Q({fontWeight:500,gridTemplateColumns:"1fr 24px"},null==e?void 0:e.selected),off:{gridTemplateColumns:"1fr"}}}})},selectedIcon:As({height:"1.25rem",width:"1.25rem"}),layout:Mf,subtext:As({color:"inherit",opacity:.6,fontWeight:400}),action:function(e){return As({fontSize:null==e?void 0:e.fontSize,color:Ds(15),position:"relative",bottom:0,width:"100%",textAlign:"left",background:Ds(90),padding:"0.65rem 0.5rem",borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius,boxShadow:null==e?void 0:e.boxShadow,border:null==e?void 0:e.border,"&:hover":{background:Ds(95)},marginBottom:"0.5rem"})}}),Lf={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))"},Nf=function(e){var t,n,r,i,o;return As({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,gridArea:null==e?void 0:e.gridArea})},zf=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=Q({padding:0,border:0,margin:0},e)),c.jsx(s,{className:Hd(""+Nf(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})},qf=As({position:"relative",display:"flex",flex:1,flexDirection:"row"}),Bf=As({width:16,zIndex:999,top:0,bottom:0,left:-3,position:"absolute",alignSelf:"flex-start",cursor:"pointer"}),Wf=Object.assign((function(){return null}),{itemWrapper:qf,item:function(e){var t;return As({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:"#3074d9"},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 As(Q({},nu.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em"}))},metadata:function(e){var t;return As(Q({},nu.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em",color:"inherit",opacity:.6}))},right:As({display:"flex",placeContent:"center"}),edit:As({marginRight:"0.75rem",display:"grid",placeContent:"center",color:"inherit",opacity:.5}),deleteWrapper:function(e){var t,n;return As({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 As(Q({},nu.button,{height:16,color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":{color:Jd(null==e||null==(n=e.icon)?void 0:n.color,1.5)}}))},iconSize:As({height:"1rem",width:"1rem"}),addWrapper:As(Q({position:"relative",width:"100%"},Ts)),title:function(e){return As(Q({padding:0},Ts,e))},titleContainer:function(){return As({variants:{hasBorder:{true:{borderBottom:"2px solid #e5e7eb"}}}})},dragHandleContainer:Bf}),Vf=Object.assign((function(){return null}),{item:As({opacity:.5}),string:As({fontSize:"0.55rem",transform:"scaleX(1.2)",marginLeft:1}),bool:As({fontSize:"0.65rem",fontWeight:"bold"}),icon:function(e){return As({"& > *":{fill:null!=e?e:"#2d2f31"}})}}),Hf=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(_f,{as:"code",children:c.jsxs(Ud,{columns:["1fr","1fr"],className:""+tu.codeText,children:[c.jsx("span",{className:""+tu.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Hd(""+Vf.string({}),""+tu.bold),children:"A"})]})}),"string[]"===(null==e?void 0:e.icon)&&c.jsx(_f,{as:"code",className:""+tu.codeText,children:c.jsxs(Ud,{columns:["1fr","1fr"],children:[c.jsx("span",{className:""+tu.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Hd(""+Vf.string({}),""+tu.bold),children:"[]"})]})}),"boolean"===(null==e?void 0:e.icon)&&c.jsx(_f,{as:"code",className:Hd(""+Vf.bool({}),""+Yf),"data-component":"true-false",children:c.jsxs(Ud,{columns:["1fr","1fr","1fr"],height:"20px",children:[c.jsx(_f,{alignSelf:"start",children:"T"}),c.jsx(_f,{alignSelf:"center",marginLeft:-.5,children:"/"}),c.jsx(_f,{alignSelf:"end",children:"F"})]})})]})},Yf=As({fontSize:11,lineHeight:1.3,fontFamily:nu.codeFontFamily}),Uf=function(e){var t,r,i;return c.jsx(_f,{width:24,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:"0.30rem",alignSelf:null==e?void 0:e.alignSelf,"data-component":"item-icon",marginLeft:-2,children:c.jsxs(zf,{justifyContent:"center",alignItems:"center",className:""+Vf.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(Gf,{icon:null==e?void 0:e.icon,width:null==e?void 0:e.iconWidth})),c.jsx(Hf,{icon:null==e?void 0:e.icon})]})})},Gf=function(e){var t,n,r=Xd();return c.jsx(_f,{width:null!=(t=null==e?void 0:e.width)?t:"75%",className:""+Vf.icon(null==r||null==(n=r.charts)?void 0:n.iconColor),"data-themeapi":"charts.iconColor",children:null==e?void 0:e.icon})},Kf={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Xf=Object.assign((function(e){var n=Xd();return c.jsx(t.Fragment,{children:(null==e?void 0:e.open)&&c.jsx("div",{className:""+Rf.dropdown(null==e?void 0:e.width,null==e?void 0:e.minWidth)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsxs(_f,{position:"relative",children:[c.jsx("div",{className:""+Rf.optionWrappper(null==n?void 0:n.dropdowns,!!e.onFreeTextSelected)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsx(_f,{role:"list","data-component":"dropdown-options",maxHeight:e.onFreeTextSelected?360:400,children:null==e?void 0:e.children})}),e.onFreeTextSelected&&c.jsx("button",{onClick:function(){return e.onFreeTextSelected&&e.onFreeTextSelected()},className:tu.button+" "+Rf.action(null==n?void 0:n.dropdowns),children:e.textOverride?e.textOverride("dropdown.free_text","Enter Custom Value..."):"Enter Custom Value..."})]})})})}),{Option:function(e){var n=e.label,r=Xd();return c.jsx("div",{className:""+Rf.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:""+Rf.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(zf,{direction:"row",gap:"0.5rem",children:[(null==e?void 0:e.icon)&&c.jsx(Uf,{icon:null==e?void 0:e.icon,paddingTop:"0"}),c.jsxs(_f,{flexGrow:1,paddingTop:"0.1rem",children:[c.jsx(_f,{children:i.isFunction(n)?n():n}),(null==e?void 0:e.subtext)&&c.jsx(_f,{className:""+Rf.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(zf,{alignItems:"center",justifyContent:"center",alignSelf:"start",paddingTop:"0.25rem",children:c.jsx("div",{className:""+Rf.selectedIcon,children:c.jsx(v.CheckIcon,{css:Kf,"aria-hidden":"true"})})})]})})},Empty:function(e){return c.jsx("div",{css:Lf,children:e.label})},Title:function(e){var t,n=e.label,r=Xd();return c.jsx("div",{className:""+(t=null==r?void 0:r.dropdowns,As({padding:null==t?void 0:t.padding,paddingTop:0,paddingBottom:0,fontSize:"0.75rem",variants:{index:{true:{borderTop:"1px solid #dbdcdf",marginTop:"0.25rem"}}}}))({index:0!==e.index}),role:"listitem","data-component":"dropdown-title",children:c.jsx("p",{className:""+As({marginBottom:0,fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.05em"}),children:i.isFunction(n)?n():n})})}}),Qf=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(" ")},Jf=function(e,t,n){var r=[].concat(n).flatMap((function(e){if(i.isFunction(e)){var n=e();if(n)return[Qf(n)]}return i.isString(e)&&t[e]?[Qf(e)]:[]})).join(" ");return Qf(e)+" "+r},Zf=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);}"}),$f=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:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;}&:nth-of-type(2){-moz-animation:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;-webkit-animation-delay:0.25s;animation-delay:0.25s;}&:nth-of-type(3){-moz-animation:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;-webkit-animation-delay:0.5s;animation-delay:0.5s;}",""),"",""]})},em=gd((function(e){var t=e.color,n=e.mAuto;return c.jsxs("div",{className:Qf("loading"),css:["margin-top:-0.5rem;margin-bottom:-0.5rem;",n&&{margin:"auto"},"",""],children:[c.jsx($f,{color:t}),c.jsx($f,{color:t}),c.jsx($f,{color:t})]})}),"renderLoadingComponent"),tm={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},nm=function(e){var t;return c.jsx("div",{css:tm,style:{width:"100%",height:"100%",minHeight:null!=(t=null==e?void 0:e.minHeight)?t:"200px"},children:e.override?e.override({}):c.jsx(em,{mAuto:!0,color:"#e5e5e5"})})},rm={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},im=function(e){return c.jsx("div",{css:rm,style:{width:"100%",height:"100%"},children:c.jsx(em,{mAuto:!0,color:e.color})})},om=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:Hd(null==e?void 0:e.className,""+tu.button),"aria-label":null!=(t=null==e?void 0:e["aria-label"])?t:null!=e&&e.textOverride?null==e?void 0:e.textOverride("clear","Clear"):"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:""+ru,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"})})})})},am={height:"1.5rem",width:"1.5rem",cursor:"pointer",paddingTop:1,outline:"2px solid transparent",outlineOffset:2},lm=Object.assign((function(e){return As({width:"100%",minWidth:null!=e?e:void 0})}),{inputComponent:function(e,t){var n,r;return As(Q({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?Q({},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 As({width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==e?void 0:e.padding,paddingRight:0,gridArea:"1 / 1 / 2 / 3",variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},multiple:function(e,t){return As({display:"inline-grid",gridArea:"1 / 1 / 2 / 3",padding:null==e?void 0:e.padding,paddingLeft:0,paddingRight:0,width:null!=t?t:void 0,variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},input:As({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:As({paddingLeft:"0.25rem",paddingRight:0,width:100,alignSelf:"center"}),clearContainer:As({display:"flex",width:32,alignItems:"center",paddingLeft:"0.5rem",paddingRight:"0.25rem"}),clearButton:function(e){return As(Q({},am,{color:null==e?void 0:e.indicatorColor}))},controlGrid:As({paddingBottom:1}),arrowContainer:function(e){return As({display:"flex",width:32,alignItems:"center",justifyContent:"center",padding:0,margin:0,color:"rgb(209 213 219)",variants:{subtle:{off:{borderLeft:null==e?void 0:e.border}}}})}}),sm=As({variants:{open:{up:{},off:{transform:"rotate(180deg)"},side:{transform:"rotate(90deg)"}}}}),um=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,As(Q({},nu.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:Hd(""+sm({open:null==e||!e.expanded||null!=e&&e.disabled?null==e?void 0:e.arrowStart:"off"}),""+ru),children:c.jsx("polyline",{points:"18 15 12 9 6 15"})})});var t},dm=function(e){var n,r,o,a,l,s,u,d,p,f=e.disabled,m=e.placeholder,h=e.onClear,v=e.isLoading,g=t.useRef(null),b=function(){null==e||e.setOpen(!0),null!==g.current&&g.current.focus()},x=i.isString(null==e?void 0:e.selectedValue)?null==e?void 0:e.selectedValue:void 0;t.useEffect((function(){null!=e&&e.open&&null!==g.current&&!v&&g.current.focus()}),[null==e?void 0:e.open]);var y=Xd(),w=null!=e&&e.open?null!=e&&e.textOverride?null==e?void 0:e.textOverride("close","Close"):"Close":null!=e&&e.textOverride?null==e?void 0:e.textOverride("open","Open"):"Open";return c.jsx("div",{className:""+lm(e.fixedWidth),"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:""+lm.inputComponent(null==y||null==(n=y.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(zf,{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?33: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(_f,{flex:1,"data-component":"control-view",children:c.jsxs(Ud,{"data-component":"control-grid",className:""+lm.controlGrid,minWidth:e.fixedWidth,children:[c.jsx(t.Fragment,{children:null!=e&&e.open?c.jsx(t.Fragment,{children:0===e.value.length&&x&&c.jsx("div",{className:lm.clickableArea(null==y||null==(o=y.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:x})}):c.jsx("div",{onClick:function(){return b()},onKeyUp:function(){return b()},"data-testid":e.testId,className:Hd(""+lm.clickableArea(null==y||null==(r=y.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:lm.multiple(null==y||null==(a=y.forms)?void 0:a.select,e.fixedWidth)({small:null!=e&&e.sm?"on":"off"}),"data-component":"control-multiple",children:c.jsx("input",{style:{minWidth:m?9*(null==m?void 0:m.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:f,ref:g,className:lm.input({rightAligned:null!=e&&e.rightAligned?"on":"off"}),autoComplete:"off"})})]})})]}),v&&c.jsx("div",{className:""+lm.loading,children:c.jsx(im,{color:"#3074d9"})}),h&&(null==e?void 0:e.clearable)&&c.jsx("div",{className:""+lm.clearContainer,children:c.jsx(om,{onClear:function(){return h&&h()},className:""+lm.clearButton(null==y||null==(l=y.forms)?void 0:l.select),fill:null==y||null==(s=y.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==y||null==(u=y.forms)||null==(u=u.select)?void 0:u.indicatorColor,testId:e.testId?e.testId+"-clear":void 0,textOverride:e.textOverride})}),c.jsx("div",{className:lm.arrowContainer(null==y||null==(d=y.forms)?void 0:d.select)({subtle:null!=e&&e.subtle?"on":"off"}),children:c.jsx(um,{label:w,arrowStart:"up",disabled:f,onClick:function(){return null==e?void 0:e.setOpen(!(null!=e&&e.open))},styled:null==y||null==(p=y.forms)?void 0:p.select,expanded:null==e?void 0:e.open})})]})})},cm=Object.assign(As({display:"flex",position:"relative",alignItems:"start",flexDirection:"column",variants:{dynamicWidth:{true:{width:"100%"}}}})),pm=function(e){var n=t.useState(!1),r=n[0],i=n[1];return t.useEffect((function(){var t;return e?t=setTimeout((function(){return i(!0)}),500):i(!1),function(){t&&clearTimeout(t)}}),[e]),r},fm=vd((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=e.textOverride,v=null===e.selected?null:s[e.selected],g=v?v.label:e.placeholder||(h?h("select_empty","Select..."):"Select..."),b=n.useRef(null);Kd(b,(function(){return u(!1)}));var x=Object.keys(s[0]||{}),y=Pf(s,x),w=y.values,j=y.setSearch,C=y.searchString,S=function(t){t!=l&&e.onChange(null===t?null:t),u(!1)},F=pm(e.isLoading);return c.jsxs("div",Q({className:""+cm({dynamicWidth:null==e?void 0:e.dynamicWidth}),ref:b,"data-component":null==e?void 0:e["data-component"]},((r={})["data-componentoverride"]="renderSelectComponent",r),{children:[c.jsx(dm,{onClick:null==e?void 0:e.onClick,value:null!=e&&e.selectOptionsAreOpen?C:i.isFunction(g)?g():g,onChange:function(e){return j(e)},open:p,setOpen:f((function(){u(!p),j("")})),onClear:function(){v&&e.canBeCleared&&S(null),v&&e.canBeCleared&&j("")},clearable:!(!v||!e.canBeCleared),subtle:null==e?void 0:e.subtle,selectedValue:null==(o=w.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,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e["aria-labelledby"],className:null==e?void 0:e.controlClassName,textOverride:e.textOverride,fixedWidth:e.fixedWidth,children:null!=e&&e.renderSelected?null==e?void 0:e.renderSelected(v):c.jsxs(t.Fragment,{children:[v&&e.selectedLabelPrefix,i.isFunction(g)?g():g]})}),c.jsxs(Xf,{open:p,fixedHeight:!0,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?158:void 0,onFreeTextSelected:e.onFreeTextSelected,textOverride:e.textOverride,children:[d&&c.jsx(_f,{height:80,children:F&&c.jsx(im,{color:"#3074d9"})}),!d&&w.map((function(t,n){return t.item.title?c.jsx(Xf.Title,{label:t.item.label,index:n},"option_"+t.refIndex+"_"+t.item.label):c.jsx(Xf.Option,Q({onChange:function(){return S(t.refIndex)},label:t.item.label,subtext:t.item.subText,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)})),!d&&!F&&0===w.length&&c.jsx(_f,{padding:8,width:200,children:null!=(a=e.noOptionsMessage)?a:e.textOverride?e.textOverride("no_options","No Options"):"No Options"})]})]}))}),"renderSelectComponent",(function(e){return Q({},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],Of);if(n.error)throw n.error;r[t]=n.value})),t.apply(void 0,r)})});var t,n})),mm=function(e,t,n,r){return As(Q({},e,{margin:null!=n?n:null==e?void 0:e.margin,fontWeight:null!=r?r:null==e?void 0:e.fontWeight,display:t?"none":"block",padding:0,position:"relative",width:"100%"}))},hm=As({color:"#7D7D7E"}),vm=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"label",i=Xd(),o={className:""+(e.classNameOverride?e.classNameOverride:mm(null==i||null==(n=i.forms)?void 0:n.label,null==e?void 0:e.labelHidden,null==e?void 0:e.margin,null==e?void 0:e.fontWeight)),"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(zf,{gap:"0.25rem",children:[c.jsx(r,Q({},o,{children:null==e?void 0:e.children})),c.jsx(_f,{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:""+tu.srOnly,children:null==e?void 0:e.tooltip.label}),c.jsx(v.QuestionMarkCircleIcon,{className:Hd("help-icon",""+hm)})]})})]}):c.jsx(r,Q({},o,{children:null==e?void 0:e.children}))},gm=function(e,t){return As(Q({},e,{boxSizing:"border-box"},t?{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}:{outline:"2px solid transparent",outlineOffset:-2},{position:"relative"}))},bm=["labelHidden","onClear","textOverride"],xm=["sm","error"],ym={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"},wm={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"},jm=n.forwardRef((function(e,n){var r,i,o,a,l,s,u,d=Xd(),p=te(e,bm);return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),!e.onClear&&c.jsx("input",Q({css:ym,id:null==e?void 0:e.id,ref:n},p,{className:Hd(Jf("input",e,xm),""+gm(null!=(r=null==e?void 0:e.inputTheme)?r:null==d||null==(i=d.forms)?void 0:i.input,null==e?void 0:e.error)),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled})),e.onClear&&c.jsxs(zf,{alignItems:"center",position:"relative","data-component":"input",children:[c.jsx("input",Q({css:wm,id:null==e?void 0:e.id,ref:n},p,{className:Hd(Jf("input",e,xm),""+gm(null!=(o=null==e?void 0:e.inputTheme)?o:null==d||null==(a=d.forms)?void 0:a.input,null==e?void 0:e.error)),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled})),c.jsx(om,{onClear:function(){return e.onClear&&e.onClear()},className:lm.clearButton(null==d||null==(l=d.forms)?void 0:l.select)+" "+Cm,fill:null==d||null==(s=d.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==d||null==(u=d.forms)||null==(u=u.select)?void 0:u.indicatorColor})]})]})})),Cm=As({position:"absolute",right:6,display:"flex",alignItems:"center",justifyCntent:"center"}),Sm=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=X(G().mark((function n(){var r;return G().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}):Ae("[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]);var f=t.useState(!1),m=f[0],h=f[1];t.useEffect((function(){if(!a.loading&&e.hasFreeText&&Array.isArray(s)&&e.selected){var t=s.some((function(t){return t.value===e.selected}));h(!t)}}),[a.loading,e.hasFreeText,s,e.selected]),t.useEffect((function(){i.isArray(e.options)&&l({loading:!1,options:e.options})}),[e.options]);var v=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(vm,{labelHidden:null==e?void 0:e.labelHidden,id:m||null==e?void 0:e.id,htmlFor:m?e.id:void 0,tooltip:null==e?void 0:e.tooltip,children:null==e?void 0:e.label}),!m&&c.jsx(fm,{"data-component":null==e?void 0:e["data-component"],testId:e.testId,dynamicWidth:e.dynamicWidth,onChange:function(t){null===t?e.onChange(null,null):e.onChange(a.options[t].value,t)},onClick:e.onClick,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===v?null:v,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,textOverride:e.textOverride,fixedWidth:e.fixedWidth,dropdownForFilter:e.dropdownForFilter,onFreeTextSelected:e.hasFreeText?function(){h(!0),e.onChange("",null)}:void 0}),m&&c.jsx(jm,{type:"string",onChange:function(t){e.onChange(t.target.value,null)},id:null==e?void 0:e.id,autoFocus:!0,onClear:function(){var t;h(!1),e.onChange(null==a||null==(t=a.options[0])?void 0:t.value,null)},value:e.selected,textOverride:e.textOverride})]})},Fm=function(e){return c.jsx("div",{"data-component":"select-input",children:null==e?void 0:e.children})},km=function(e){var t=e.placeholder,n=e.showClearBtn;return c.jsx(Sm,{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",textOverride:e.textOverride,label:t,labelHidden:!0,id:e.id,dropdownForFilter:!0,fixedWidth:e.labelWidth})},_m=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=Br(e.attributes.type).removeField(e.attributes,t),n}(e,t.id)}),e)},Tm=[];function Am(e){for(var t,n=[],r=ie(e);!(t=r()).done;){var i=t.value;n.push("dateTimeFilter"===i.type?Q({},i,{type:"dateFilter"}):i)}return n}function Dm(e,t){var n=Q({},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 Im=function(e,t,n,r){var i=[].concat(e.dashboard.componentLibrary);return i[n]=Q({},t,{attributes:Q({},t.attributes,{protectedByOrganisation:!!r||void 0})}),Q({},e,{componentEditor:null,dashboard:Q({},e.dashboard,{componentLibrary:i})})},Om=function(e,t,n,r){var i=Mi(e.dashboard.display,t,n,r);return Q({},e,{dashboard:Q({},e.dashboard,{display:i})})},Pm=function(e,t){var n=t.rowIndex,r=i.cloneDeep(e.dashboard.display);return r.length>1?(r.splice(n,1),Q({},e,{dashboard:Q({},e.dashboard,{display:r})})):e},Em=n.createContext(null),Mm=function(e){var r,o,a=e.dashboard,l=e.children,s=e.trackEvent,u=function(e){var t,r=md(),o=r.dashboardFilters,a=r.onDashboardFilterChange,l=Q({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=t.dashboardFilters,l=[].concat(e.dashboard.globalFilters).filter((function(e){return!e.managedByConfiguration})),s=(r=e.dashboard.dataSets,o={},r.forEach((function(e){e.fields.forEach((function(t){[].concat(t.dashboardRequiredFilterGroups||[]).forEach((function(n){var r=n.publicName+" - "+t.dataType;o[r]=[].concat(o[r]||[],[{publicName:n.publicName,dataSetField:t,dataSetId:e.id}])}))}))})),Object.values(o)).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}})),u=a(Wa(e.dashboard),Tm).map((function(e){return Q({},e,{managedByConfiguration:!0})})),d=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(Am(s),Am(u),Am(l)),e.dashboard.dataSets).map((function(t){var n=Ci(e.dashboard.globalFilters,t);return Q({},t,{value:n?n.value:t.value||null})}));return i.some(n=d,(function(e,t){var r=[].concat(n);return r.splice(t,1),!!Ci(r,e)}))&&Te("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."),Q({},e,{dashboard:Q({},e.dashboard,{globalFilters:d})})}(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=Ii(e.dashboard.display,t.rowIndex);return Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"appendCell":return function(e,t){var n=Ei(e.dashboard.display,t.rowIndex);return Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"addHeaderRow":return function(e,t){var n,r,i,o,a=(n=t.rowIndex,r=t.initialTitle,i=[].concat(e.dashboard.display),o=Ri([{displayTitle:r,colSpan:12}],52),i.splice(n,0,o),i);return Q({},e,{dashboard:Q({},e.dashboard,{display:a})})}(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,Q({},e,{dashboard:Q({},e.dashboard,{display:o})})):Pm(e,Q({},t,{type:"removeRow"}))}(e,n);case"removeRow":return Pm(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]=Oi(o[n].components[r].colSpan),Q({},e,{dashboard:Q({},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),Q({},e,{dashboard:Q({},e.dashboard,{dataSets:r})})}(e,n);case"removeDataSet":return function(e,t){var n=t.dataSetId;if(!Na(e.dashboard,n))return e;var r=Ra(e.dashboard,n),i=[].concat(e.dashboard.dataSets);return i.splice(r,1),Q({},e,{dashboard:Q({},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=Vr(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||mi(e)||(e.attributes=Br(e.attributes.type).removeField(e.attributes,t)),e}));return Q({},e,{components:n})})),n}(e,t.id)}),e.dashboard.display);return Q({},e,{componentEditor:(n=e.componentEditor,r=l,o=(null==n?void 0:n.component)||null,o=_m(o,r),n?Q({},n,{component:o}):null),dashboard:Q({},e.dashboard,{componentLibrary:[].concat(e.dashboard.componentLibrary).map((function(e){return _m(e,l)})),dataSets:[].concat(a),display:s})})}(e,n);case"startPickingComponentFromLibraryForDisplay":return function(e,t){return Q({},e,{pickFromComponentLibrary:{cellIndex:t.cellIndex,rowIndex:t.rowIndex}})}(e,n);case"startEditingComponent":return function(e,t){return Q({},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=Q({},e);return null!=e.componentEditor.target.libraryIndex&&(r=Im(e,e.componentEditor.component,e.componentEditor.target.libraryIndex,t.protectedComponent)),e.componentEditor.target.displayTarget&&!e.componentEditor.target.libraryIndex&&(r=Om(r,e.componentEditor.component,e.componentEditor.target.displayTarget.rowIndex,e.componentEditor.target.displayTarget.cellIndex)),Q({},r,{componentEditor:null,pickFromComponentLibrary:e.pickFromComponentLibrary})}(e,n);case"addCustomComponent":return function(e,t){var n=Q({},e);return null!=t.target.libraryIndex&&(n=Im(e,t.component,t.target.libraryIndex)),t.target.displayTarget&&!t.target.libraryIndex&&(n=Om(n,t.component,t.target.displayTarget.rowIndex,t.target.displayTarget.cellIndex)),Q({},n,{componentEditor:null})}(e,n);case"clearModal":return function(e,t){return Q({},e,{pickFromComponentLibrary:null,componentEditor:null})}(e);case"updateEditorComponent":return function(e,t){return e.componentEditor?Q({},e,{componentEditor:Q({},e.componentEditor,{component:t.component})}):Q({},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=Q({},i,{results:t.results});return Q({},Om(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]=Q({},i[n],{results:r}),Q({},e,{dashboard:Q({},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 Q({},e,{componentEditor:Q({},e.componentEditor,{component:Q({},e.componentEditor.component,{results:t.results})})})}(e,n);case"pickComponentFromLibraryForDisplay":return function(e,t){var n=Q({},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 Q({},Om(e,n,r.rowIndex,r.cellIndex),{pickFromComponentLibrary:null})}(e,n);case"setDashboard":return function(e,t){return Q({},e,{dashboard:t.dashboard})}(e,n);case"setTheme":return function(e,t){return Q({},e,{dashboard:Q({},e.dashboard,{theme:t.theme})})}(e,n);case"setGlobalFilters":return function(e,t){return Q({},e,{dashboard:Q({},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,Q({},e,{dashboard:Q({},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,Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"changePreviewMode":return function(e,t){return Q({},e,{inPreviewMode:t.inPreviewMode})}(e,n);case"updateDisplayComponentAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=Q({},e.dashboard.display[n].components[r],{attributes:Q({},t.attributes)});return Om(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]=Q({},i[n],{attributes:r}),Q({},e,{dashboard:Q({},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),Q({},e,{dashboard:Q({},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=Q({},i,{reports:t.reports});return Q({},Om(e,o,n,r))}(e,n);case"swapComponents":return function(e,t){var n,r,i,o,a,l=(i=t.positionB,o=Q({},(n=e.dashboard.display)[(r=t.positionA).rowIndex].components[r.cellIndex]),a=Q({},n[i.rowIndex].components[i.cellIndex]),n=Mi(n,o,i.rowIndex,i.cellIndex),n=Mi(n,a,r.rowIndex,r.cellIndex));return Q({},e,{dashboard:Q({},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=Q({},i,{attributes:t.attributes});return Q({},Om(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||Li(i)||mi(i))throw"We can only set parameters on an existing component on the dashboard.";return Dm(i,r)}(e.dashboard.display,n,r,t.payload);return Q({},Om(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=Q({},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=Q({},l,{localFilters:n});a=Om(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=Q({},u,{localFilters:n});a=Im(e,d,o)}return Q({},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?Lm(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(Em.Provider,{value:Q({},d,{dispatch:p,trackEvent:s||function(){},runQueriesCallback:(o=X(G().mark((function t(n,r,i){return G().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(rc,{theme:null==e?void 0:e.theme,storedTheme:null==d||null==(r=d.dashboard)?void 0:r.theme,children:l})})},Rm=function(){return n.useContext(Em)},Lm=function(e,t){var n,r,i,o,a,l,s,u,d,c,p,f;return Q({},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}})},Nm=function(){var e=X(G().mark((function e(t,n,r,i){return G().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)}}(),zm=function(e,t){return function(){var n=X(G().mark((function n(r){var o,a;return G().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,Nm(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:De(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)}}()};function qm(e,t){var n=function(e,t,n){var r=document.createElement("div"),i=document.createElement("span");i.textContent=e,null!=n&&n.fontSize&&(i.style.fontSize="number"==typeof n.fontSize?n.fontSize+"px":""+n.fontSize),null!=n&&n.fontWeight&&(i.style.fontWeight=""+n.fontWeight),r.appendChild(i),r.style.display="inline-block",r.style.visibility="hidden",document.body.appendChild(r);var o=i.offsetWidth;return document.body.removeChild(r),o}(e,0,{fontSize:null==t?void 0:t.fontSize,fontWeight:null==t?void 0:t.fontWeight});return(n>100?n:100)+24}var Bm=function(e){var n,r,i=Rm().runQueriesCallback,o=md(),a=o.cascadeFilterSelection,l=o.textOverride,s=e.filter,u=e.filterIndex,d=e.dataSets,p=e.onChange,f=t.useState(null),m=f[0],h=f[1],v=Xd(),g=t.useRef(void 0),b=function(){var e=X(G().mark((function e(t){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zm(ki(s),i)(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)}}();t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t,n;return G().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,b(t.signal);case 4:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),h(n),p(Q({},s,{value:n[0].value}))):Te("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)]),t.useEffect((function(){a&&null!==g.current&&JSON.stringify(g.current)!==JSON.stringify(s.optionsFilters)&&h(null),g.current=s.optionsFilters}),[s.optionsFilters]);var x=qm(ji(s,d,l),null==v||null==(n=v.forms)?void 0:n.select);return e.filter.hidden?null:c.jsx(km,{showClearBtn:e.showClearBtn,anchorLeft:!0,placeholder:ji(s,d,l),options:m||b,currentValue:s.value,setSelected:function(t){e.onChange(Q({},s,{value:t}))},textOverride:l,id:xe(null!=(r=e.filter.title)?r:"")+"_"+e.filter.type,labelWidth:x},"filter-"+u)},Wm=Object.assign((function(){return null}),{button:function(e){return As(Q({},nu.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 As({"& > *":{fill:null==e?void 0:e.iconColor}})}}),Vm=["sm"],Hm={name:"1hl83va",styles:"margin-bottom:0.75rem"},Ym={name:"jf4xqj",styles:"position:absolute;top:0px;right:2rem"},Um={name:"duftww",styles:"position:absolute;top:0.25rem;right:0px"},Gm={name:"1e4sizb",styles:"margin-top:0.5rem"},Km=function(e){var n,r=t.useState(e.defaultOpen||!1),i=r[0],o=r[1],a=Xd();return c.jsxs("div",{css:Hm,className:Hd(Jf("accordion",e,Vm)),children:[c.jsxs("button",{"data-testid":e.testId,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:Hd(""+Wm.button(null==a||null==(n=a.accordion)?void 0:n.button)),"data-themeapi":"accordion.button","data-chipposition":"top.left",children:[c.jsx(zf,{gap:"0.25rem",alignItems:"center",children:null==e?void 0:e.title}),e.renderAction&&c.jsx("div",{css:Ym,children:e.renderAction(i)}),e.showAccordionIcon&&c.jsx("span",{css:Um,className:Hd(""+Wm.icon(null==a?void 0:a.accordion)),"data-themeapi":"accordion.iconColor",children:c.jsx(e.Icon,{isOpen:i})})]}),i&&c.jsx("div",{className:Qf("accordion-content"),css:Gm,children:e.children})]})},Xm=function(e){return c.jsx(Km,Q({},e,{Icon:Od}))},Qm=n.forwardRef((function(e,t){return c.jsxs(c.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsx("input",Q({className:""+Jm(),type:"checkbox",ref:t},e))]})})),Jm=function(){return As({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:Ds(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}})},Zm=t.forwardRef((function(e,t){var n=Xd();return c.jsx("div",{className:Hd(Qf("listview-item"),""+Wf.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})})),$m=As(Q({},Ts,{opacity:0,cursor:"pointer",variants:{active:{true:Q({},Ts,{opacity:1})}}})),eh=As({width:"100%",display:"flex",cursor:"pointer",height:16}),th=As(Q({},Ts,{width:12,color:"#1f293799",variants:{active:{true:Q({},Ts,{color:"rgba(93,103,119,0.6)"})}}})),nh=As({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:Ms.size.borderRadius,borderTopLeftRadius:Ms.size.borderRadius}}}}}),rh=Object.assign((function(){return null}),{popover:function(e){return As(Q({background:Ds(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}))}}),ih=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:Hd((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:Hd((null==e?void 0:e.classNameTrigger)&&""+(null==e?void 0:e.classNameTrigger)),children:e.children}),a&&c.jsx("div",Q({ref:f,className:""+rh.popover(null==e?void 0:e.tooltipMinWidth),style:Q({},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})}}),oh=function(e){var t,n;return As(Q({},Ts,{cursor:"pointer",color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":Q({},Ts,{color:Jd(null==e||null==(n=e.icon)?void 0:n.color,1.5)})}))},ah=function(e){return c.jsx("div",{ref:e.dragSource,className:""+nh({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(lh,{active:null==e?void 0:e.active,top:null==e?void 0:e.top})})},lh=function(e){var n,r=md().textOverride,i=t.useState(!1),o=i[0],a=i[1],l=Xd();return c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:r("drag_to_move","Drag to move")})},className:""+(n=null==e?void 0:e.top,As(Q({},Ts,{position:"absolute",left:1,top:n})))({active:null!=e&&e.active?"true":"false"}),tooltipMinWidth:110,children:c.jsx("div",{className:""+$m({active:null!=e&&e.active?"true":"false"}),children:c.jsxs("div",{className:""+eh,onMouseOver:function(){return a(!0)},onMouseLeave:function(){return a(!1)},"data-themeapi":"dashboard.icon",children:[c.jsx(v.DotsVerticalIcon,{className:th({active:o?"true":"false"})+" "+oh(null==l?void 0:l.dashboard)}),c.jsx(v.DotsVerticalIcon,{className:th({active:o?"true":"false"})+" "+oh(null==l?void 0:l.dashboard),style:{marginLeft:-8}})]})})})},sh=function(e){return c.jsx(null!=e&&e.onOrderChange?dh:ch,Q({},e))},uh=function(){},dh=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||uh,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(ch,Q({},e,{ref:p[0]}))},ch=t.forwardRef((function(e,n){var r=e.item,i=e.index,o=e.onDeleteItem,a=e.onOrderChange&&e.totalItemsCount>1,l=md().textOverride,s=Xd(),u=t.useState(!1),d=u[1];return c.jsx(zf,{"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:""+Wf.itemWrapper,onMouseOver:function(){return!!a&&d(!0)},onMouseLeave:function(){return!!a&&d(!1)},children:[c.jsx(Zm,{clickable:!!r.onClick,highlight:r.highlight,ref:n,children:c.jsxs(zf,{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:""+Wf.dragHandleContainer,children:!!a&&c.jsx(lh,{active:u[0],top:9})}),c.jsx(_f,{flex:1,paddingLeft:0,children:c.jsxs(zf,{gap:"0.5rem",children:[(null==r?void 0:r.icon)&&c.jsx(Uf,{icon:null==r?void 0:r.icon}),c.jsxs(_f,{flexGrow:1,paddingY:"5.5px","data-component":"list-title-subtext",children:["string"==typeof r.title?c.jsx("p",{className:""+Wf.label(null==s?void 0:s.lists),children:r.title}):c.jsx(t.Fragment,{children:r.title}),r.subtext&&c.jsx("p",{className:""+Wf.metadata(null==s?void 0:s.lists),children:r.subtext})]})]})}),r.select&&c.jsx("div",{className:""+Wf.right,children:c.jsx(Sm,{labelHidden:!0,label:l("function","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:""+Wf.right,children:r.renderRight()}),r.editIcon&&c.jsx("div",{className:""+Wf.edit,children:c.jsx(_d,{})}),r.preventDelete&&c.jsx("div",{className:""+Wf.edit,children:c.jsx(Td,{})})]})}),o&&!r.preventDelete&&c.jsx("div",{className:""+Wf.deleteWrapper(null==s?void 0:s.lists),children:c.jsxs("button",{type:"button",className:""+Wf.deleteButton(null==s?void 0:s.lists),"data-testid":e.testId&&e.testId+"-"+i+"-remove",onClick:function(e){e.stopPropagation(),o&&o(i)},"aria-label":l("remove","Remove"),"data-themeapi":"lists.icon",children:[c.jsxs("span",{className:""+eu,children:[l("remove","Remove")," ",r.title]}),c.jsx(Cd,{})]})})]})})})),ph=function(e){return c.jsx(_f,{paddingRight:null==e?void 0:e.paddingRight,as:null==e?void 0:e.as,children:c.jsx(Ud,{gap:"0.5rem",children:null==e?void 0:e.children})})},fh=function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x;return As({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":mh(e.theme),variants:{size:{small:{fontSize:null==(s=e.theme)||null==(s=s.small)?void 0:s.fontSize,fontWeight:null==(u=e.theme)||null==(u=u.small)?void 0:u.fontWeight,padding:null!=(d=null==(c=e.theme)||null==(c=c.small)?void 0:c.padding)?d:"2px 8px 3px",height:"auto",width:"auto"},medium:{fontSize:null==(p=e.theme)||null==(p=p.medium)?void 0:p.fontSize,fontWeight:null==(f=e.theme)||null==(f=f.medium)?void 0:f.fontWeight,padding:null!=(m=null==(h=e.theme)||null==(h=h.medium)?void 0:h.padding)?m:"0 12px"},large:{fontSize:null==(v=e.theme)||null==(v=v.large)?void 0:v.fontSize,fontWeight:null==(g=e.theme)||null==(g=g.large)?void 0:g.fontWeight,padding:null!=(b=null==(x=e.theme)||null==(x=x.large)?void 0:x.padding)?b:"0 12px"}},isHovering:{true:mh(e.theme)}}})};function mh(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 hh=function(e){var t,n,r,i=Xd();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:Hd(fh({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})})},vh=function(e){return c.jsx(_f,{children:c.jsx(hh,{testId:e.testId,onChange:function(){return null==e?void 0:e.onChange()},height:36,align:"left",disabled:e.disabled,children:c.jsxs(zf,{children:["+ ",e.label]})})})},gh=function(e){return void 0===(null==e?void 0:e.children)?null:c.jsx(Ud,{gap:e.hasDeleteIcon?"0.9rem":"0.5rem",className:Qf("listview"),columns:["repeat(1,minmax(0,1fr))"],"data-component":"list-view",role:"list",children:null==e?void 0:e.children})};function bh(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=Pf(r,["title","subtext"]),u=s.setSearch,d=s.values,p=s.searchString,f=n.useRef(null);return Kd(f,(function(){return l(!1)})),e.hide?null:c.jsxs("div",{className:""+Wf.addWrapper,ref:f,children:[c.jsx(_f,{marginTop:e.marginTop,"data-component":"new-item",children:c.jsx(vh,{testId:e.testId,onChange:function(){var t=!a;t&&e.onOpenDropdown&&e.onOpenDropdown(),l(t)},label:e.callToAction})}),c.jsxs(Xf,{open:a,fixedHeight:!0,width:"calc(100% - 2px)",children:[c.jsx(_f,{padding:8,children:c.jsx(jm,{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(Xf.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 xh(e){var n,r;return c.jsxs(ph,{paddingRight:null!=(n=null==e?void 0:e.paddingRight)?n:"0.25rem",children:[e.items.length>0&&c.jsx(gh,{children:[].concat(e.items).map((function(t,n){return c.jsx(sh,{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(bh,Q({},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(vh,{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 yh=function(e){var t=e.children;return c.jsx("div",{id:e.id,className:""+wh({queriesAreChanging:e.queriesAreChanging,overflowScroll:e.overflowScroll,justifyCenter:e.justifyCenter}),"data-component":"view-wrapper",children:t})},wh=As({display:"flex",width:"100%",height:"100%",flexDirection:"column",variants:{queriesAreChanging:{false:{},true:{filter:"blur(1px)"}},overflowScroll:{false:{},true:Q({overflow:"auto"},Ef)},justifyCenter:{false:{},true:{justifyContent:"center"}}}}),jh=["sm","primary","secondary","disabled","loading","suppressed"],Ch=vd((function(e){var n,r,i,o,a,l,s=Xd(),u=null!=e&&e.primary?"primary":null!=e&&e.secondary?"secondary":e.suppressed?"suppressed":"secondary";return c.jsx("button",Q({},((n={})["data-componentoverride"]="renderButtonComponent",n),{"data-component":null==e?void 0:e["data-component"],"data-testid":e.testId,onClick:e.onClickWithDevToolCheck&&e.onClickWithDevToolCheck(e.onClick),disabled:e.disabled,className:Hd(Jf("button",e,jh),null==e?void 0:e.className,""+(r=null==s?void 0:s.buttons,i=e.themeOverride,As(Q({},nu.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:{},suppressed:{}},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:Q({},null==r?void 0:r.primary,i)},{type:"secondary",css:Q({},null==r?void 0:r.secondary,{"&:hover":Q({opacity:.7,background:"transparent"},null==r||null==(o=r.secondary)?void 0:o["&:disabled"]),"&:disabled":Q({opacity:.7,background:"transparent"},null==r||null==(a=r.secondary)?void 0:a["&:disabled"]),"&:hover:disabled":Q({opacity:.7,background:"transparent"},null==r||null==(l=r.secondary)?void 0:l["&:hover:disabled"])},i)},{type:"suppressed",css:Q({},null==r?void 0:r.secondary,i,{background:"transparent",paddingLeft:4,paddingRight:4,"&:disabled":{background:"transparent"}})}]})))({type:u,highlight:!(null==e||!e.highlight),block:null==e?void 0:e.block})),onMouseEnter:e.onMouseEnter,"data-themeapi":e.internal?void 0:"buttons."+u,children:e.icon?c.jsxs(zf,{gap:"0.25rem",alignItems:"center",children:[c.jsx(_f,{width:20,children:e.icon.Icon()}),c.jsx("span",{children:e.children})]}):c.jsx(t.Fragment,{children:e.children})}))}),"renderButtonComponent"),Sh={name:"t91scv",styles:"display:grid;place-content:center"},Fh=function(e){var n=t.useState("initial"),r=n[0],i=n[1],o=e.autoFeedback?X(G().mark((function t(){var n;return G().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(Ch,{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,icon:e.icon,onMouseEnter:e.onMouseEnter,children:[c.jsx("div",{css:["loading"==a&&{visibility:"hidden"},"",""],children:e.children}),"loading"==a&&c.jsx("div",{css:Sh,children:c.jsx(em,{color:"white"})})]})},kh=t.createContext({addToast:function(){throw"not implemented."}}),_h={name:"zjik7",styles:"display:flex"},Th={name:"1x3jg5i",styles:"margin-left:0.75rem"},Ah=function(e){return c.jsxs("div",{css:_h,children:[c.jsx("span",{children:e.renderIcon()}),c.jsx("span",{css:Th,children:e.message})]})},Dh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Ih=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Dh,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"})})}})},Oh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Ph=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Oh,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"#e86f7f",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"})})}})},Eh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Mh=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:Eh,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"})})}})},Rh={name:"6u431h",styles:"position:fixed;left:1.25rem;bottom:1.25rem"},Lh={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 Nh(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(kh.Provider,{value:{addToast:s},children:[c.jsx("div",{css:Rh,style:{zIndex:2147483647},children:o.map((function(e,t){return c.jsx("div",{css:Lh,children:e()},"toast_"+t)}))}),n]})}function zh(){return t.useContext(kh)}var qh,Bh=function(e){var t=md(),n=t.textOverrides,r=t.developerTools,i=zh().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!0===r||"object"==typeof r&&r.translationKeys?c.jsx("span",{onMouseEnter:function(){i((function(){return c.jsx(Ih,{message:"Change the text with 'textOverride' property '"+e.override+"'"})}),"unique-text-override-"+e.override)},children:a}):c.jsx(c.Fragment,{children:a})},Wh=As({display:"grid",height:"100%",width:"100%",alignContent:"center"}),Vh=As({margin:"auto",textAlign:"center"}),Hh=As(Q({},nu.text,{fontSize:"1.5rem",lineHeight:"2rem",color:"inherit",variants:{textOpacity:(qh={},qh[60]={opacity:60},qh[40]={opacity:40},qh)}})),Yh=As({marginTop:"0.75rem",fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1rem",opacity:.8}),Uh=Object.assign((function(e){var t;return c.jsx("div",{className:""+Wh,children:c.jsxs("div",{className:""+Vh,children:[c.jsx("h1",{className:""+Hh({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:""+Yh,children:null==e?void 0:e.children})}}),Gh=function(e){return c.jsx(Uh,{opacity:40,title:null==e?void 0:e.title,children:e.renderExtra&&e.renderExtra()})},Kh={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"},Xh={name:"akdqam",styles:"margin-top:1rem"},Qh=function(){return c.jsx(Uh,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:Kh,className:""+tu.text,children:"An internal error occurred, please try again soon."}),c.jsx("div",{css:Xh,children:c.jsx(Fh,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},Jh=function(){return c.jsx(Uh,{title:"There is an issue with your configuration settings.",renderExtra:function(){return c.jsx("p",{className:""+tu.text,children:"See logs for more details."})}})},Zh={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"},$h={name:"akdqam",styles:"margin-top:1rem"},ev=function(){return c.jsx(Uh,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:Zh,className:""+tu.text,children:"We were unable to verify your identity"}),c.jsx("div",{css:$h,children:c.jsx(Fh,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},tv={name:"12dms0z",styles:"margin-top:1rem;width:100%"},nv=function(e){return c.jsx(Uh,{title:"This view has changed",renderExtra:function(){return c.jsx(Uh.Extra,{children:c.jsxs(Bh,{override:"view.data-set-changed",children:["A field this view was using has been removed.",c.jsx("div",{css:tv,children:c.jsx(Fh,{"data-component":"remove-missing-field",onClick:function(){return e.removeMissingField()},children:"Auto fix"})})]})})}})},rv=function(e){var t;return c.jsx(Uh,{title:null!=(t=null==e?void 0:e.title)?t:"Query under construction 🏗",renderExtra:function(){var t;return c.jsx(Uh.Extra,{children:null!=(t=null==e?void 0:e.children)?t:"Not all required properties have been set to render this component"})}})},iv=function(){return c.jsx(Uh,{title:c.jsx(Bh,{override:"view.failed-to-fetch-results",children:"Failed to fetch the data 🤔"})})},ov=function(){return c.jsx(Uh,{title:"This view is not available"})},av=function(e){return c.jsxs(yh,{queriesAreChanging:!1,children:[c.jsx(Pg,Q({},e)),c.jsx(Uh,{title:c.jsx(Bh,{override:"view.empty-results",children:"No data to show"})}),e.children]})},lv={name:"1g0vxgi",styles:"margin-top:0.75rem"},sv=function(e){return c.jsx(Uh,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(Fh,{onClick:e.onManualRetry,css:lv,children:"retry"})}})},uv={name:"1g0vxgi",styles:"margin-top:0.75rem"},dv=function(e){return c.jsx(Uh,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(Fh,{onClick:e.onManualRetry,css:uv,children:"retry"})}})},cv=function(e){return c.jsx("h3",Q({},e,{children:e.children}))},pv=function(e){return c.jsx("p",Q({},e,{children:e.children}))},fv=function(e){return c.jsx("p",Q({},e,{className:Hd(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}))},mv=As(Q({overflow:"overlay"},Ef)),hv=function(e){return As(Q({},e,{variants:{buttons:{end:{display:"grid",justifyContent:"end"}}}}))},vv=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=Xd();return c.jsx("div",{className:Hd(Qf("modal-header"),""+(l=null==m||null==(t=m.modals)?void 0:t.header,As(Q({width:"100%",lineHeight:"1.5rem"},l,{"& h3":nu.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.jsx(zf,{className:Hd(null!=d?d:void 0),alignItems:"center",gap:"0.25rem",children:e.children||c.jsxs(c.Fragment,{children:[c.jsx(cv,{children:s}),(null==e?void 0:e.tooltip)&&c.jsx(_f,{width:18,children:c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",color:Ds(30)})})})]})})})},gv=function(e){var t,n,r,i,o,a=null!=(t=null==e?void 0:e.buttons)?t:"end",l=Xd();return c.jsx("div","space-between"===(null==e?void 0:e.buttons)?{className:Hd(Qf("modal-footer"),""+hv(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(zf,{gap:"0.75rem",justifyContent:"space-between",children:null==e?void 0:e.children})}:{className:Hd(Qf("modal-footer"),""+hv(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})},bv=function(e){var t,n,r,i=e.children,o=e.className,a=Xd();return c.jsx("div",{className:Hd(null!=e&&e.scrollable?""+mv:void 0,Qf("modal-content"),""+(r=null==a||null==(t=a.modals)?void 0:t.content,As({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:Q({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})},xv={name:"1px9jck",styles:"min-height:100vh;padding-left:1rem;padding-right:1rem;text-align:center"},yv={name:"8pnu7z",styles:"display:inline-block;height:100vh;vertical-align:middle"},wv=function(e){var n,r,i,o,a,l,s,u=t.useRef();e.width&&(u.current=e.width);var d,f=null==(n=Xd())?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(Ff,{appear:!0,show:e.isOpen,children:c.jsxs(Mp,{style:{zIndex:null!=(o=null==f||null==(a=f.base)?void 0:a.zIndex)?o:2147483147},"data-themeapi":"modals.base",className:Hd(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(Mp.Overlay,{className:Hd(Qf("modal-overlay"),""+(d=null==f?void 0:f.overlay,As(Q({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:xv,children:[c.jsx("span",{css:yv,"aria-hidden":"true",children:""}),c.jsxs(Ff.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(Fv,{onClick:e.onClose}),c.jsx(jv,{vizzlyPrefix:Qf("modal-wrapper",e.namespace),children:e.children})]})]})]})})})},jv=function(e){var t,n,r,i=Xd();return c.jsx("div",{className:Hd(null==e?void 0:e.vizzlyPrefix,""+(r=null==i||null==(t=i.modals)?void 0:t.base,As(Q({},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})},Cv={name:"1f0fr1j",styles:"position:absolute;top:-1.5rem;right:-1.5rem"},Sv={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Fv=function(e){var t,n,r=null==(t=Xd())?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:Cv,className:Hd(Qf("modal-close"),""+tu.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:Sv,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})},kv=Object.assign(wv,{Header:vv,Footer:gv,Content:bv}),_v=Object.assign((function(){return null}),{list:function(e){var t;return As({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,j,C,S,F,k,_;return As(Q({lineHeight:"1rem",letterSpacing:"0.1em",whiteSpace:"nowrap"},Ts,{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":Q({},Ts,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==(j=e.selected)?void 0:j.border,borderRight:null==e||null==(C=e.selected)?void 0:C.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":Q({},Ts,null==e||null==(_=e.selected)?void 0:_["&:hover"])}},button:{true:{cursor:"pointer",padding:"0.5rem",border:0,whiteSpace:"nowrap"}}}}))},panel:function(e,t){return As({paddingLeft:null!=e?e:"0.5rem",paddingRight:null!=t?t:"0.5rem"})},hasChanges:As({fontSize:8})}),Tv=["children","paddingLeft","paddingRight"],Av=Object.assign((function(){return null}),{Group:function(e){return c.jsx(af.Group,Q({},e,{children:c.jsx("div",{className:Qf("tab-group"),children:e.children})}))},Button:function(e){var t=Xd();return c.jsx(af,Q({},e,{className:""+tu.button,children:function(n){var r=n.selected;return c.jsx("div",{className:Hd(Jf("tab-button",{selected:r},["selected"]),""+_v.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=te(e,Tv);return c.jsx(af.Panel,Q({className:Hd(Qf("tab-panel"),""+_v.panel(n,r))},i,{children:t}))},Panels:function(e){return c.jsx(af.Panels,Q({},e,{children:e.children}))},List:function(e){var t=Xd();return c.jsx(af.List,Q({className:Hd(Qf("tab-button-list"),""+_v.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}))}}),Dv=function(e){var t;return c.jsx(zf,{className:Hd(Jf("button-group",e,[])),gap:e.gap||"0.75rem",justifyContent:null!=(t=null==e?void 0:e.buttons)?t:"start","data-component":e["data-component"],children:e.children})},Iv=As({borderWidth:0,padding:0,marginLeft:0,marginRight:0}),Ov=function(e){var t,n;return c.jsx(_f,{className:Hd(Qf("panel-property"),""+Iv),marginBottom:null!=(t=e.marginBottom)?t:"0.75rem",as:null!=(n=null==e?void 0:e.as)?n:"div",children:e.children})},Pv=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!Gt(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}}))}))},Ev=function(e,t){switch(t.type){case"setSelectedFields":return function(e,t){return Q({},e,{selectedFieldIndexes:t.selectedFieldIndexes})}(e,t);case"setSelectedDataSets":return function(e,t){var n=t.selectedDataSetIndexes,r=e.dataSets,o=e.selectedFieldIndexes,a=Pv(e.type,r,e.selectedDataSetIndexes);return o=i.remove(o,(function(e){var t=Gr(r,a[e].value.dataSetId);return n.includes(t[1])})),Q({},e,{selectedDataSetIndexes:n,selectedFieldIndexes:o})}(e,t);case"setTitle":return function(e,t){return Q({},e,{title:t.title})}(e,t);case"setType":return function(e,t){return Q({},e,{selectedFieldIndexes:[],type:t.filterType})}(e,t);default:return Q({},e)}},Mv={type:"singleSelectFilter",appliesToFields:[],title:"",value:null,requiresValue:!1,managedByConfiguration:!1},Rv=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=Pv(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(Ev,{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).filter((function(e){return!e.hide})).map((function(e){return{label:e.name,value:e.id}})),d=Pv(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||Mv,e.dataSets),a=o.fieldOptions,l=o.dataSetOptions,s=o.globalFilter,u=o.dispatch,d=o.selectedDataSetIndexes,p=o.selectedFieldIndexes,f=md(),m=f.featureToggles,h=f.textOverride;return t.useEffect((function(){1===e.dataSets.length&&u({type:"setSelectedDataSets",selectedDataSetIndexes:[0]})}),[]),c.jsxs(c.Fragment,{children:[c.jsx(kv.Header,{title:h("new_filter","New filter"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{label:h("title","Title"),id:"title",placeholder:h("title","Title"),value:s.title,onChange:function(e){u({type:"setTitle",title:e.target.value})}})}),l.length>1&&c.jsx(Ov,{children:c.jsx(Gv,{id:"data-set",label:h("data_sets","Data sets"),placeholder:h("data_sets_placeholder","Which data sets will this filter impact?"),options:l,selected:d,setSelected:function(e){u({type:"setSelectedDataSets",selectedDataSetIndexes:e})},textOverride:h})}),c.jsx(Ov,{children:c.jsx(Sm,{id:"filter-type",label:h("filter_type","Filter type"),anchorLeft:!0,selected:s.type,onChange:function(e){u({type:"setType",filterType:e})},options:(r=[{label:h("single_select","Single select"),value:"singleSelectFilter"},{label:h("multi_select","Multi select"),value:"multiSelectFilter"}],m.showDateFilter&&r.push({label:h("date_picker","Date picker"),value:"dateFilter"}),m.showDateAndTimeFilter&&r.push({label:h("date_time_picker","Date Time picker"),value:"dateAndTimeFilter"}),r),textOverride:h})}),c.jsx(Ov,{children:c.jsx(Gv,{label:h("fields","Fields"),id:"data-set-fields",placeholder:h("fields_placeholder","Which fields will this filter impact?"),options:a,selected:p,setSelected:function(e){u({type:"setSelectedFields",selectedFieldIndexes:e})},textOverride:h})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:function(){return e.onCancel()},children:h("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){e.setFilter(s)},children:h("confirm","Confirm")})]})})]})},Lv=Object.assign((function(){}),{svg:function(e){var t,n,r;return As({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:As({paddingTop:0,display:"block",height:"1rem",width:"1rem"})}),Nv=function(e){var t,n=Xd();return c.jsxs("div",{className:Hd(""+Lv.icon,null==e?void 0:e.className),role:"alert",children:[c.jsx("span",{className:""+eu,children:null==e?void 0:e.title}),c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+Lv.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:""+Lv.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"})})]})},zv=function(e){var r=e.filters,i=e.show,o=e.onClose,a=e.source,l=e.onDeleteItem,s=e.onUpdate,u=e.dataSets.filter((function(e){return!e.preAggregated})),d=t.useState([])[1],p=md(),f=p.textOverride,m=p.mode,h=n.useState(null),v=h[0],g=h[1],b=Array.isArray(r)?[].concat(r).filter((function(e){return!e.hidden})).map((function(e,t){var n={};0===e.appliesToFields.length&&(n={renderRight:function(){return c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added.")})},children:c.jsx(Nv,{title:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added."),type:"warning",className:""+Bv})})}});var r=f("additional_filters.filter_type_subtext","[[filterType]] for [[numberOfFields]] {{field}} [[listOfFields]]",{field:{count:e.appliesToFields.length,singular:"field",plural:"fields"},listOfFields:be([].concat(e.appliesToFields).map((function(e){var t=Vr(u,e.dataSetId);return t?Yr(t,e.fieldId).publicName:""})),!0,f),numberOfFields:e.appliesToFields.length,filterType:gi(e.type,f)});return Q({preventDelete:e.managedByConfiguration,title:ji(e,u,f),subtext:r},n,{editIcon:!e.managedByConfiguration,onClick:e.managedByConfiguration?function(){}:function(){return g({draftFilter:e,filterIndex:t})}})})):[];return c.jsxs(c.Fragment,{children:[c.jsxs(kv,{width:"xl","data-testid":"manage-filters-modal",isOpen:i,onClose:function(){return o()},children:[c.jsx(kv.Header,{title:""+("global"===a?f("dashboard_filters","Dashboard filters"):f("add_local_filters","Add Local filters")),show:!0}),c.jsx(kv.Content,{children:c.jsx(xh,{mode:m,onDeleteItem:l,newItemBtn:{callToAction:"global"===a?f("new_dashboard_filter","New dashboard filter"):f("new_local_filter","New local filter"),onClick:function(){g({filterIndex:void 0,draftFilter:Mv}),d(r)}},items:b})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Fh,{onClick:function(){return o()},secondary:!0,children:f("close","Close")})})]}),c.jsx(kv,{width:"xl","data-testid":"edit-filter",isOpen:null!=v,onClose:function(){},hideCloseIcon:!0,children:c.jsx(Rv,{onCancel:function(){return g(null)},current:(null==v?void 0:v.draftFilter)||null,setFilter:function(e){d(r),s({filter:e,index:null==v?void 0:v.filterIndex}),g(null)},dataSets:u})})]})};function qv(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 Bv=As({paddingTop:0}),Wv=function(){var e=Rm(),t=e.dashboard,r=e.dispatch,i=e.trackEvent,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(Vv,{onChange:function(){i("manageGlobalFilters.open"),l(!0)},disabled:Ni(t.display)}),c.jsx(zv,{dataSets:t.dataSets,filters:t.globalFilters,show:a,onUpdate:function(e){var n=qv(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)}})]})},Vv=function(e){var t,n=Xd(),r=md().textOverride;return c.jsx("div",{className:""+Hv,"data-themeapi":"filters.filterBy",children:c.jsx(Fh,{testId:"manage-global-filters-open",onClick:null==e?void 0:e.onChange,disabled:null==e?void 0:e.disabled,className:Hd("filter-by-button"),themeOverride:null==n||null==(t=n.filters)?void 0:t.filterBy,secondary:!0,children:c.jsxs(zf,{as:"span",justifyContent:"center",alignItems:"center",gap:"0.25rem",children:[c.jsx("span",{className:"filter-by-button-icon",children:c.jsx(du,{active:!1})}),c.jsx("span",{className:"filter-by-button-text",children:r("dashboard-filters.call-to-action","Add filter")})]})})})},Hv=As({minWidth:"100px",position:"relative"}),Yv={name:"1d3w5wq",styles:"width:100%"},Uv={name:"1egouu6",styles:"position:relative;display:flex;width:100%;flex-direction:column;align-items:center"},Gv=function(e){var r,o,a,l,s,u,d=null!=(r=null==e?void 0:e.showableChips)?r:2,p=e.selected,f=e.textOverride,m=t.useState([]),h=m[0],v=m[1];t.useEffect((function(){i.isArray(e.options)&&v(e.options)}),[e.options]);var g=t.useState(null!=(o=null==e?void 0:e.isLoading)&&o),b=g[0],x=g[1],y=t.useState(i.isFunction(e.options)?"unloaded":void 0),w=y[0],j=y[1],C=n.useState(!1),S=C[0],F=C[1];t.useEffect((function(){var t=function(){var t=X(G().mark((function t(){var n;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(x(!0),n=new AbortController,j("loading"),!i.isFunction(e.options)){t.next=9;break}return e.options(n.signal).then((function(e){j("loaded"),e&&(v(e),x(!1))})),t.abrupt("return",(function(){n.abort(),j("failed")}));case 9:x(!1),v(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 k=Pf(h,["label","value"]),_=k.values,T=k.searchString,A=k.setSearch,D=t.useRef(null);Kd(D,(function(){F(!1),M(d)}));var I=function(t){A("");var n=[].concat(p);n=p.includes(t)?i.filter([].concat(p),(function(e){return e!=t})):[].concat(p,[t]),e.setSelected(n)},O=i.sumBy(h,(function(e){return e.hide?0:1})),P=t.useState(d),E=P[0],M=P[1];t.useEffect((function(){M(S?p.length:d)}),[p.length,h.length]);var R=Xd(),L=pm(e.isLoading);return c.jsxs("div",{css:Yv,"data-fetchstatus":null!=w?w:void 0,children:[(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&c.jsx(vm,{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:Uv,ref:D,children:[c.jsxs(dm,{value:T,onChange:function(e){return A(e)},open:S,setOpen:function(e){F(e),M(e?p.length:d)},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===p.length&&F(!0)},testId:"multi-select",textOverride:f,fixedWidth:null==e?void 0:e.labelWidth,children:[(null==e?void 0:e.selectedPrefix)&&c.jsx(_f,{"data-component":"selected-prefix",padding:null!=(a=null==R||null==(l=R.forms)||null==(l=l.select)?void 0:l.padding)?a:"0.30rem 0.5rem",paddingRight:0,children:null==e?void 0:e.selectedPrefix}),(null==e?void 0:e.placeholder)&&0===p.length&&c.jsx(_f,{padding:"0.35rem 0.5rem",as:"span",children:c.jsx("span",{style:{color:"#A1A8B3"},children:null==e?void 0:e.placeholder})}),c.jsxs(zf,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,minWidth:S?0===p.length?void 0:190:void 0,wrap:!0,padding:null!=(s=null==R||null==(u=R.forms)||null==(u=u.select)?void 0:u.padding)?s:"0.30rem","data-component":"selected-chips",children:[p.length<=E&&p.map((function(t,n){var r=h[t];return r?c.jsx(Jv,{onRemove:function(){return I(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:f},n):null})),E<=d&&p.length>d&&c.jsxs(t.Fragment,{children:[p.map((function(t,n){var r=h[t];return n>d-1?null:r?c.jsx(Jv,{onRemove:function(){return I(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:f},n):null})),c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:p.map((function(e,n){var r;return n<=d-1?null:c.jsxs(t.Fragment,{children:[null==(r=h[e])?void 0:r.label,p.length!==n+1&&", "]},n)}))})},children:c.jsx(Jv,{onRemove:function(){},label:p.length-d+" more",disableClear:!0,textOverride:f})})]})]})]}),c.jsxs(Xf,{open:S,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?192:void 0,children:[b&&c.jsx(_f,{height:80,children:L&&c.jsx(im,{color:"#3074d9"})}),p.length!==O&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{padding:8,children:c.jsx(jm,{id:(null==e?void 0:e.id)+"-add-item",label:"Add "+e.placeholder,labelHidden:!0,autoFocus:!0,defaultValue:T,onChange:function(e){return A(e.target.value)}})}),_.map((function(e,n){return c.jsx(t.Fragment,{children:!e.item.hide&&!p.includes(e.refIndex)&&c.jsx(Xf.Option,{onChange:function(){return I(e.refIndex)},label:e.item.label})},n)}))]}),!b&&p.length===O&&c.jsx(_f,{padding:8,children:f?f("no_options","No Options"):"No Options"})]})]})]})},Kv={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))"},Xv={name:"1ho1ybk",styles:"max-width:100%;flex:0 1 auto;font-size:0.75rem;line-height:1;font-weight:400"},Qv={name:"10bts8a",styles:"display:flex;flex:1 1 auto;flex-direction:row-reverse"},Jv=function(e){var t=e.textOverride,n=t?t("remove_pill","Remove [[label]]",{label:e.label}):"Remove "+(null==e?void 0:e.label);return c.jsxs("div",{css:Kv,children:[c.jsx("div",{css:Xv,children:e.label}),c.jsx("div",{css:Qv,children:c.jsxs("button",{onClick:function(t){t.preventDefault(),e.onRemove()},className:""+tu.button,children:[c.jsx("span",{className:""+tu.srOnly,children:n}),!(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:Hd(p.css({name:"13h9wtn",styles:"margin-left:0.5rem;height:1rem;width:1rem;cursor:pointer;border-radius:9999px;opacity:0.7;:hover{opacity:1;}"}),""+ru),"aria-label":n,children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})})]})},Zv=function(e){var n,r,i,o,a=Xd(),l=t.useRef(void 0),s=md(),u=s.cascadeFilterSelection,d=s.textOverride,p=Rm().runQueriesCallback,f=e.filter,m=e.filterIndex,h=e.dataSets,v=e.onChange,g=t.useState(null),b=g[0],x=g[1],y=t.useState(!1),w=y[0],j=y[1],C=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zm(ki(f),p)(t);case 2:return x(n=e.sent),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b){e.next=7;break}return j(!0),t=new AbortController,e.next=5,C(t.signal);case 5:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),j(!1),x(n)):Te("Ran select filter options to force a value, but no results were returned.");case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!f.requiresValue||null!==f.value){e.next=6;break}return t=new AbortController,e.next=4,C(t.signal);case 4:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),x(n),v(Q({},f,{value:n[0].value}))):Te("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(f)]);var F=ji(f,h,d),k=t.useState([]),_=k[0],T=k[1];t.useEffect((function(){var e;null!=f&&f.value&&(b&&(null==b?void 0:b.length)>0?T((e=null==f?void 0:f.value,b.reduce((function(t,n,r){return e.includes(n.value)&&t.push(r),t}),[]))):S())}),[f,b]),t.useEffect((function(){u&&null!==l.current&&JSON.stringify(l.current)!==JSON.stringify(f.optionsFilters)&&x(null),l.current=f.optionsFilters}),[f.optionsFilters]);var A=qm(F,null==a||null==(n=a.forms)?void 0:n.select);return e.filter.hidden?null:c.jsx(_f,{minWidth:A+36,"data-component":"multi-select-filter",children:c.jsx(Gv,{options:b||C,setSelected:function(t){b&&e.onChange(Q({},f,{value:t.map((function(e){var t;return null==(t=b[e])?void 0:t.value})).filter((function(e){return void 0!==e}))}))},selected:_,isLoading:w,id:"filter-"+m,disableClearAll:!(null!=e&&e.showClearBtn)&&1===(null==(r=f.value)?void 0:r.length),selectedPrefix:F+(null!=(i=f.value)&&i.length&&(null==(o=f.value)?void 0:o.length)>0?" · ":""),showableChips:1,textOverride:d,labelWidth:A,label:F,labelHidden:!0,dropdownForFilter:!0},"filter-"+m)})},$v=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"}}),eg=As({position:"relative",display:"inline-flex",height:"100%"}),tg=As({display:"flex",width:"100%",height:"100%",alignItems:"center"}),ng=As({width:18,display:"flex",verticalAlign:"middle",color:"rgb(72, 72, 72)",alignSelf:"center",justifyContent:"center"}),rg=Object.assign((function(){return null}),{picker:As(Q({},$v.input,{appearance:"searchfield"})),prefixStyle:function(e){var t,n,r;return As({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;return As({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==(a=a["&:hover"])?void 0:a.border,background:null==e||null==(l=e.input)||null==(l=l["&:hover"])?void 0:l.background,boxShadow:null==e||null==(s=e.input)||null==(s=s["&:hover"])?void 0:s.boxShadow},"&:focus":{border:null==e||null==(u=e.input)||null==(u=u["&:focus"])?void 0:u.border,background:null==e||null==(d=e.input)||null==(d=d["&:focus"])?void 0:d.background,boxShadow:null==e||null==(c=e.input)||null==(c=c["&:focus"])?void 0:c.boxShadow}})},inputs:tg,separator:ng,dateInput:function(e){var t,n,r,i,o,a;return As({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 As({width:null==e||null==(t=e.time)?void 0:t.width,paddingLeft:0,paddingRight:0})},clearContainer:function(){return As({width:18,alignSelf:"center"})},wrapper:eg,separatorIcon:function(e){return As({verticalAlign:"middle",display:"block",fill:null==e?void 0:e.indicatorColor,height:18,width:18})},clearButton:function(e){return As(Q({},am,{fill:null==e?void 0:e.indicatorColor}))}}),ig=function(e,t){var n,r,i,o,a,l,s,u,d,c,f,m,h,v,g,b,x,y,w,j,C,S,F,k,_,T,A,D,I,O,P;return p.css("position:absolute;top:",t?t+16:40,"px;margin-right:0;border:1px solid ",Ms.colors.brand[20],";border-radius:",Ms.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==(l=l["&:hover"])?void 0:l.border,";background:",null==e||null==(s=e.input)||null==(s=s["&:hover"])?void 0:s.background,";}}.DateInput_input__focused input{border:",null==e||null==(u=e.input)||null==(u=u["&:focus"])?void 0:u.border,";background:",null==e||null==(d=e.input)||null==(d=d["&:focus"])?void 0:d.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==(c=e.input)?void 0:c.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==(f=e.calendar)||null==(f=f.selected)?void 0:f.background,";opacity:0.8;color:",null==e||null==(m=e.calendar)||null==(m=m.selected)?void 0:m.color,";}.CalendarDay__selected_span{background:",null==e||null==(h=e.calendar)||null==(h=h.selected)?void 0:h.background,";opacity:0.8;border:1px double ",null==e||null==(v=e.calendar)||null==(v=v.selected)?void 0:v.background,";color:",null==e||null==(g=e.calendar)||null==(g=g.selected)?void 0:g.color,";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:",null==e||null==(b=e.calendar)||null==(b=b.selected)?void 0:b.background,";opacity:0.7;border:1px double ",null==e||null==(x=e.calendar)||null==(x=x.selected)?void 0:x.background,";color:",null==e||null==(y=e.calendar)||null==(y=y.selected)?void 0:y.color,";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:",null==e||null==(w=e.calendar)||null==(w=w.selected)?void 0:w.background,";border:1px double ",null==e||null==(j=e.calendar)||null==(j=j.selected)?void 0:j.background,";color:",null==e||null==(C=e.calendar)||null==(C=C.selected)?void 0:C.color,";}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:",null==e||null==(S=e.calendar)||null==(S=S.selected)?void 0:S.background,";border:1px double ",null==e||null==(F=e.calendar)||null==(F=F.selected)?void 0:F.background,";opacity:0.8;color:",null==e||null==(k=e.calendar)||null==(k=k.selected)?void 0:k.color,";}.CalendarDay__hovered_span:active{background:",null==e||null==(_=e.calendar)||null==(_=_.selected)?void 0:_.background,";border:1px double ",null==e||null==(T=e.calendar)||null==(T=T.selected)?void 0:T.background,";color:",null==e||null==(A=e.calendar)||null==(A=A.selected)?void 0:A.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==(D=e.calendar)||null==(D=D.title)?void 0:D.color,";font-size:",(P=null==e||null==(I=e.calendar)||null==(I=I.title)?void 0:I.fontSize)+("number"==typeof P?"px":""),";text-align:center;padding-top:22px;padding-bottom:37px;caption-side:initial;}.CalendarMonth_caption>strong{font-weight:",null==e||null==(O=e.calendar)||null==(O=O.title)?void 0:O.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;}","")},og=function(e){var t,n=Xd();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:""+rg.dateInput(null==n||null==(t=n.forms)?void 0:t.dateTime),onChange:function(t){return null==e?void 0:e.onChange(t.currentTarget.value)}})})},ag=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 Kd(d,(function(){u(!1)})),t.useEffect((function(){if(i){var t=lg(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(Xf,{open:s,fixedHeight:!0,width:"calc(100% - 2px)",children:p.map((function(t,n){return c.jsx(Xf.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)},lg=function(e,t){var n=y(e,"HH:mm:ss",!0);return y(e,"HH:mm",!0).isValid()||n.isValid()?y(e,t):null},sg=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:""+tu.bold,children:[n.format("MMMM")," "]}),c.jsx("select",{value:n.year(),onChange:function(e){return r(n,e.target.value)},className:""+rg.picker,"data-testid":"year-select",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)})))})]})}})},ug=vd((function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v=e.startDate,g=e.endDate,b=e.startTime,x=e.endTime,w=e.onChange,j=e.id,C=e.prefix,S=e.onClear,F=e.label,k=e.type,_=e.textOverride,T=null!=(n=e.dateFormat)?n:"DD/MM/YYYY",A=null!=(r=e.timeFormat)?r:"HH:mm",D=t.useState({start:b?lg(b,A):null,end:x?lg(x,A):null}),I=D[0],O=D[1],P=t.useState(!1),E=P[0],M=P[1],R=t.useState(v?y(v):null),L=R[0],N=R[1],z=t.useState(!1),q=z[0],B=z[1];t.useEffect((function(){q&&B(!1)}),[q]);var W=t.useState(g?y(g):null),V=W[0],H=W[1],Y=t.useState(void 0),U=Y[0],G=Y[1],K=t.useState(void 0),X=K[0],Q=K[1],J=t.useState("startDate"),Z=J[0],$=J[1],ee=t.useRef(null),te=t.useRef(null),ne=Xd(),re=t.useCallback((function(e){var t=e.startDate,n=e.endDate;y(t).isSame(ee.current)&&y(n).isSame(te.current)||(O({start:t?lg("00:00",A):null,end:n?lg("23:59",A):null}),N(t),H(n),w(t&&n?pg("date_time"===k?y("00:00",A):null,t.toDate(),"date_time"===k?y("23:59",A):null,n.toDate()):null),t&&n&&M(!1))}),[w]),ie=t.useCallback((function(e){O({start:e.start,end:e.end}),w(L&&V?pg("date_time"===k?y(e.start,"HH:mm"):null,L.toDate(),"date_time"===k?y(e.end,"HH:mm"):null,V.toDate()):null)}),[w]);t.useEffect((function(){ee.current=L}),[L]),t.useEffect((function(){te.current=V}),[V]);var oe=t.useRef(null);Kd(oe,(function(){M(!1),$("startDate")}));var ae=L?L.format(T):"",le=V?V.format(T):"",se=t.useCallback((function(){M(!1),N(null),H(null),G(void 0),Q(void 0),w(null),S(),O({start:null,end:null}),B(!0)}),[w,S]);t.useEffect((function(){if(U){var e=dg(U,T),t=dg(X||"",T);null===e&&null===t||re({startDate:e||L,endDate:t||V})}}),[U,X]);var ue=t.useRef(null),de=t.useState(0),ce=de[0],pe=de[1];return t.useEffect((function(){ue.current&&pe(ue.current.getBoundingClientRect().height)}),[ue.current]),c.jsxs("div",{className:""+rg.wrapper,id:""+(null!=j?j:"date-picker"),"data-component":"date-picker",children:[c.jsx("div",{className:""+rg.inputsWrapper(null==ne||null==(i=ne.forms)?void 0:i.dateTime),"data-themeapi":"forms.dateTime.input",onClick:function(){M(!0),G(void 0),Q(void 0),$("startDate"),H(null)},ref:ue,children:c.jsxs("div",{className:""+rg.inputs,children:[C&&c.jsxs("div",{className:""+rg.prefixStyle(null==ne||null==(o=ne.forms)?void 0:o.dateTime),children:[null!=F?F:"Custom"," ·"]}),c.jsxs(zf,{gap:0,alignItems:"center",children:[c.jsx(og,{name:"start_date",value:null!=U?U:ae,label:_?_("start_date","Start Date"):"Start Date",onChange:function(e){return G(e)},dateFormat:T}),"date_time"===k&&c.jsx(t.Fragment,{children:c.jsx(ag,{label:_?_("time","Time"):"Time",name:"start_time",onChange:function(e){ie({start:e,end:I.end})},className:rg.dateInput(null==ne||null==(a=ne.forms)?void 0:a.dateTime)+" "+rg.timeInput(null==ne||null==(l=ne.forms)?void 0:l.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:A,value:I.start,shouldClear:q})})]}),c.jsx("div",{"aria-hidden":"true",role:"presentation",className:""+rg.separator,children:c.jsx("svg",{focusable:"false",viewBox:"0 0 1000 1000",className:""+rg.separatorIcon(null==ne||null==(s=ne.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(zf,{gap:0,children:[c.jsx(og,{name:"end_date",value:null!=X?X:le,label:_?_("end_date","End Date"):"End Date",onChange:function(e){return Q(e)},dateFormat:T}),"date_time"===k&&c.jsx(ag,{label:_?_("time","Time"):"Time",name:"end_time",onChange:function(e){ie({start:I.start,end:e})},className:rg.dateInput(null==ne||null==(u=ne.forms)?void 0:u.dateTime)+" "+rg.timeInput(null==ne||null==(d=ne.forms)?void 0:d.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:A,value:I.end,shouldClear:q})]}),c.jsx("div",{className:""+rg.clearContainer(),children:c.jsx(om,{onClear:se,className:""+rg.clearButton(null==ne||null==(p=ne.forms)?void 0:p.dateTime),"aria-label":_?_("clear_date","Clear Dates"):"Clear Dates",fill:null==ne||null==(f=ne.forms)||null==(f=f.select)?void 0:f.indicatorColor,stroke:null==ne||null==(m=ne.forms)||null==(m=m.select)?void 0:m.indicatorColor})})]})}),E&&c.jsx("div",{className:""+ig(null==ne||null==(h=ne.forms)?void 0:h.dateTime,ce),"data-themeapi":"forms.dateTime.calendar",ref:oe,children:c.jsx(sg,{startDate:L,endDate:V,onDatesChange:function(e){G(void 0),Q(void 0),re(e)},focusedInput:Z,onFocusChange:function(e){return $(e)},textOverride:_})})]})}),"renderDateTimeRangeInput",(function(e){return Q({},e)})),dg=function(e,t){return y(e,t,!0).isValid()?y(e,t):null},cg=function(e,t){if(!t)throw new Error("time is null or undefined");var n=y(e),r=y(t);return(n=n.hour(r.hour()).minute(r.minute()).second(r.second())).toDate()};function pg(e,t,n,r){return{start:cg(t,e||y("00:00","HH:mm")),end:cg(r,n||y("23:59","HH:mm"))}}var fg=function(e){var n=e.placeholder,r=e.dateFilterOptions,i=e.onChangeToTimeRange,o=e.showClearBtn,a=e.textOverride,l=t.useState(e.currentValue),s=l[0],u=l[1],d=Object.keys(r).map((function(e){return{value:e,label:r[e].description}}));return i&&(d=[].concat(d,[{label:a?a("custom_range","Custom range"):"Custom range",value:"__vizzly_custom"}])),c.jsx(Sm,{showClearBtn:void 0===o||o,options:d,onChange:function(t){"__vizzly_custom"===t?(u(t),e.onChangeToTimeRange&&e.onChangeToTimeRange()):(u(t),e.onChange&&e.onChange(t))},selected:s,anchorLeft:!0,placeholder:n,selectedPrefix:null!=e&&e.hasSelectedPrefix?n+" · ":void 0,maintainOptionOrder:!0,textOverride:a,fixedWidth:null==e?void 0:e.fixedWidth,label:n,labelHidden:!0,id:null==e?void 0:e.id,dropdownForFilter:e.dropdownForFilter})},mg=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(fg,{showClearBtn:e.showClearBtn,dateFilterOptions:e.dateFilterOptions,placeholder:null==e?void 0:e.placeholder,fixedWidth:null==e?void 0:e.fixedWidth,dropdownForFilter:!0,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,textOverride:e.textOverride,id:null==e?void 0:e.id}),n&&l&&c.jsx(ug,{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){null===t||null===t.start&&null===t.end?e.onChange(null):null!==t.start&&null!==t.end&&e.onChange({startDate:t.start,endDate:t.end})},prefix:!0,onClear:function(){null==e||e.onChange(null),s(!1)},type:"dateAndTimeFilter"===o?"date_time":"date",textOverride:e.textOverride})]})},hg=function(e){var t,n,r=Xd(),i=md().textOverride,o=e.onChange,a=e.filter,l=e.showClearBtn,s=e.type,u=ji(a,e.dataSets,i),d=qm(u,null==r||null==(t=r.forms)?void 0:t.select);return e.filter.hidden?null:c.jsx(_f,{minWidth:d,children:c.jsx(mg,{hasCustomPicker:!0,showClearBtn:l,fixedWidth:d,dateFilterOptions:null==e?void 0:e.dateFilterOptions,onChange:function(e){"string"==typeof e?o({type:s,appliesToFields:a.appliesToFields,title:a.title,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,value:{type:"relative",value:e}}):e&&e.endDate&&e.startDate?o({type:s,appliesToFields:a.appliesToFields,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,title:a.title,value:{type:"fixedRange",before:e.endDate,after:e.startDate}}):null===e&&o({type:s,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,appliesToFields:a.appliesToFields,title:a.title,value:null})},currentValue:a,placeholder:u,textOverride:i,id:xe(null!=(n=e.filter.title)?n:"")+"_"+e.filter.type})})},vg=function(e){var t=e.filter,n=e.filterIndex,i=e.onChange,o=e.shouldAlwaysHaveValue,a=md().queryEngineConfig,l=function(e){var t=function(e,t){return r.alternatives().conditional(".type",{is:"singleSelectFilter",then:Ke(e,t)}).conditional(".type",{is:"dateFilter",then:Qe(e,t,"dateFilter")}).conditional(".type",{is:"dateAndTimeFilter",then:Qe(e,t,"dateAndTimeFilter")}).conditional(".type",{is:"multiSelectFilter",then:Xe(e,t)})}(a,e.requiresValue).validate(e).error;t?Ae("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(Bm,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets},JSON.stringify(e.filter.value)):"multiSelectFilter"==t.type?c.jsx(Zv,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"dateFilter"==t.type||"dateAndTimeFilter"==t.type?c.jsx(hg,{showClearBtn:!o,dateFilterOptions:null==e?void 0:e.dateFilterOptions,filter:t,onChange:s,dataSets:e.dataSets,type:t.type},JSON.stringify(e.filter.value)):null:null},gg={name:"1gqeage",styles:"margin-right:0.75rem"},bg=function(e){var n,r=If(),o=r.ref,a=r.show,l=r.position,s=r.close,u=r.open,d=md().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:gg,onClick:e.zoomControl.onReset,children:c.jsx(Sd,{})}),e.localFilters.length>0&&c.jsx("button",{onClick:function(){return u()},"aria-label":"Show Local Filter",className:""+tu.button,children:c.jsx(yd,{active:(n=e.localFilters,i.some(n,(function(e){var t=e.value;return!(i.isArray(t)&&0===t.length||!t)})))})})]}),a&&c.jsx(Af,{onClose:function(){return s()},width:320,position:l,children:c.jsx(Af.Options,{padding:!0,children:c.jsx(_f,{padding:"0.5rem",children:c.jsx(zf,{direction:"column",gap:"0.5rem","data-component":"filters",children:[].concat(e.localFilters).map((function(t,n){return c.jsx(_f,{children:c.jsx(vg,{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)}))})})})})]})},xg=Object.assign((function(){return null}),{title:function(e){var t,n,r,i,o,a,l,s,u;return As({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,variants:{canFlex:{true:{flex:1},false:{flex:"none"}}}})},subject:function(e){var t,n,r,i,o,a,l,s,u;return As({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,flex:1})},verified:function(e){var t;return As({height:18,color:null==e||null==(t=e.verified)?void 0:t.color})}}),yg=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span";return c.jsx(n,{className:""+tu.srOnly,htmlFor:null==e?void 0:e.htmlFor,children:null==e?void 0:e.children})},wg=function(e){var n=e.measures,r=md();return c.jsx(t.Fragment,{children:n&&(null==e?void 0:e.activeMeasures)&&c.jsx(zf,{direction:"column",gap:"1rem",children:Object.keys(n).map((function(t,i){var a=function(e,t,n,r,i,o,a){try{var l,s,u=Tt(e,{supportedAggregates:t,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),d=Yr(n,u.field),c=null!=(l=gs(d.publicName,null==(s=t[u.function])?void 0:s.publicName))?l:"",p=i({fieldId:u.field,func:u.function,type:o,defaultLabel:c,viewId:a,values:[d.publicName]}),f=[{label:null!=p?p:c,value:u}];return r[e].map((function(e){var r,l=gs(Yr(n,e.field).publicName,null==(r=t[e.function])?void 0:r.publicName),s=i({fieldId:e.field,func:e.function,type:o,defaultLabel:l,viewId:a,values:[Yr(n,e.field).publicName]});f.push({label:null!=s?s:l,value:e})})),f}catch(e){if(e instanceof un)return[];throw e}}(t,r.queryEngineConfig.supportedAggregates,e.dataSet,n,r.labelFormat,e.componentType,e.viewId),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(Sm,{label:"Replace Parameter "+(i+1),labelHidden:!0,id:"replace-parameter-"+i,selected:l,onChange:function(t){return e.setMeasure(t,l)},options:a},t)}))})})},jg=function(e,t){return!!Br(e).supportedFeatures.parameters&&!(i.isEmpty(t)||!Sg(t)&&!Cg(t))},Cg=function(e){return!i.isEmpty(null==e?void 0:e.group)},Sg=function(e){return!i.isEmpty(null==e?void 0:e.measure)},Fg=function(e){var n=e.activeDimensions,r=e.group,i=e.dataSet,o=md().queryEngineConfig;return c.jsx(t.Fragment,{children:r&&n&&c.jsx(zf,{direction:"column",gap:"1rem",children:Object.keys(r).map((function(t,n){var a=Ct(t,o.supportedTimeTruncFunctions),l=a?function(e,t,n,r){if(!t||!n[r])return[];var i=Yr(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=Yr(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=Yr(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=Yr(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?kg(l,null==e?void 0:e.activeTimeDimension):_g(l,null==e?void 0:e.activeDimensions);return c.jsx(Sm,{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)}))})})},kg=function(e,t){var n;return null==(n=e.find((function(e){return o.isEqual(e.value,t)})))?void 0:n.value},_g=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},Tg=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?Q({},t):n}))},Ag=function(e,t,n){return null==n?void 0:n.map((function(n){return o.isEqual(n,e)?t:n}))},Dg=function(e){var n=If(),r=n.ref,i=n.show,o=n.position,a=n.close,l=n.open,s=e.parameters;return jg(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:""+tu.button,children:[c.jsx("span",{className:""+eu,children:"Change Parameters"}),c.jsx(ih,{tooltipContent:function(){return"Change Parameters"},children:c.jsx(jd,{})})]})}),i&&c.jsx(Af,{onClose:function(){return a()},width:320,position:o,children:c.jsx(Af.Options,{padding:!0,children:c.jsx(_f,{padding:"0.5rem",children:c.jsxs(zf,{direction:"column",gap:"0.5rem","data-component":"parameters",children:[Cg(s)&&Sg(s)&&c.jsx(fv,{marginBottom:0,children:"Measures"}),c.jsx(wg,{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:Ag(n,t,e.activeMeasures)})},componentType:null==e?void 0:e.componentType,viewId:null==e?void 0:e.viewId}),Cg(s)&&Sg(s)&&c.jsx(fv,{marginBottom:0,children:"Groups"}),c.jsx(Fg,{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:Tg(n,t,null==e?void 0:e.activeDimension)}),"truncate"in t&&(null==e||e.setParameterUpdate({updatedTimeDimension:t}))}})]})})})})]}):null},Ig={name:"18pw007",styles:"position:absolute;top:0px;right:0px;z-index:2"},Og={name:"195ggdj",styles:"position:absolute;top:0.75rem;right:0.75rem;display:flex;flex-direction:row;gap:0.625rem"},Pg=function(e){var n,r,o,a,l,s,u=Xd(),d=md(),p=d.organizationName,f=d.textOverride;if(!e.displayTitle&&!e.displaySubject&&i.isEmpty(e.localFilters)&&!jg(null==e?void 0:e.componentType,e.parameters)&&(null==e||!e.verified))return c.jsx(_f,{paddingBottom:null!=(s=e.paddingBottom)?s:"0.75rem","data-component":"empty-titles"});var m,h=(m=0,i.isEmpty(e.localFilters)||(m+=1.25),jg(null==e?void 0:e.componentType,e.parameters)&&(m+=1.25),jg(null==e?void 0:e.componentType,e.parameters)&&!i.isEmpty(e.localFilters)&&(m+=.5),m+"rem"),g=p?f("verified_by_with_organization","Verified by [[organizationName]]",{organizationName:p}):f("verified","Verified");return c.jsxs(c.Fragment,{children:[c.jsxs(zf,{direction:"column",gap:"0.25rem",paddingBottom:null!=(n=e.paddingBottom)?n:"0.75rem","data-component":"titles",children:[c.jsxs(zf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(r=u.charts)||null==(r=r.title)?void 0:r.textAlign)?h:void 0,children:[e.displayTitle&&c.jsx(cv,{style:{fontFamily:null==u||null==(o=u.titles)?void 0:o.fontFamily},className:""+xg.title(null==u?void 0:u.charts)({canFlex:null!=e&&e.library?"false":"true"}),"data-themeapi":"charts.title",children:e.displayTitle}),(null==e?void 0:e.verified)&&(null==e?void 0:e.library)&&c.jsxs(ih,{tooltipContent:function(){return c.jsx(t.Fragment,{children:g})},children:[c.jsx(v.BadgeCheckIcon,{className:""+xg.verified(null==u?void 0:u.library),"data-testid":"badge","data-themeapi":"library.verified.icon"}),c.jsx(yg,{children:g})]})]}),e.displaySubject&&c.jsx(zf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(a=u.charts)||null==(a=a.subject)?void 0:a.textAlign)?h:void 0,children:c.jsx(pv,{style:{fontFamily:null==u||null==(l=u.baseFont)?void 0:l.fontFamily},className:""+xg.subject(null==u?void 0:u.charts),"data-themeapi":"charts.subject",children:e.displaySubject})})]}),!(null!=e&&e.library)&&c.jsx("div",{css:Ig,children:c.jsxs("div",{css:Og,children:[c.jsx(Dg,{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)},viewId:e.viewId}),c.jsx(bg,{setLocalFilters:e.setLocalFilters,localFilters:e.localFilters,zoomControl:e.zoomControl,dataSet:e.dataSet})]})})]})};function Eg(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 Mg=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)})),Rg=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(Mg,{dataKey:t,annotations:r})},Lg=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=Q({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=Q({},r,n.variants&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=Q({},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=Q({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t},Ng="\n.visx-tooltip {\n z-index: 14294967294; /* or whatever height is appropriate */\n}",zg=function(e,t){return t?e-40:e},qg=p.css({display:"inline-flex",position:"relative",flexDirection:"row",gap:24,padding:0,height:40},"",""),Bg=p.css({name:"um88o8",styles:"color:inherit;margin:0 0 0 4px;flex:1;display:flex;justify-content:left;font-family:inherit;font-size:0.75rem;opacity:1;font-weight:400"}),Wg=Object.assign((function(){return null}),{icon:function(e){return Lg({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:qg,label:Bg,scrollbar:p.css({name:"1azakc",styles:"text-align:center"}),reason:function(e){return p.css(Bg,{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)"},"","")}}),Vg=function(e){var n,r,i=t.useState(!1),o=i[1];return c.jsx("div",{className:(r=i[0],p.css(Q({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})},Hg=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:Wg.icon(null!=(n=e.color)?n:"#5d4e8c")({type:null==e?void 0:e.type}),children:o&&e.reason&&c.jsx("div",{className:Wg.reason(null!=(r=e.color)?r:"#5d4e8c"),children:e.reason})})})},Yg={natural:T.curveNatural,monotoneX:T.curveMonotoneX,monotoneY:T.curveMonotoneY,straight:T.curveLinear,step:T.curveStep,stepBefore:T.curveStepBefore,stepAfter:T.curveStepAfter},Ug="-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif";function Gg(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 Kg(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=Q({},a,{domain:o})),"x"===e?(i&&(l=Q({},l,{type:"band"})),r&&(l=Q({},l,{type:"pow"})),t?a:l):t?l:a}function Xg(e,t,n,r){return function(i){var o;return null!=(o=t(i,e))?o:n[r]}}function Qg(e,t,n){return function(r){var i;return null!=(i=e(r))?i:t[n]}}var Jg,Zg=function(e,t){return function(n){return e?e(n):t?eb(n):n}},$g=function(e){return function(t){return null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(t):t}},eb=function(e){return A.timeFormat("%b %d, %y")(new Date(e))},tb=function(e){return c.jsx(Vg,{className:null!=e&&e.alignCenter?""+Wg.scrollbar:void 0,x:!0,children:c.jsx(_,{scale:k.scaleOrdinal({domain:null==e?void 0:e.keys,range:null==e?void 0:e.colors}),children:function(t){return c.jsx("div",{className:Wg.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?Xg(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(Hg,{type:null==i?void 0:i.type,color:a()}),c.jsxs(F.LegendItem,{margin:"0",children:[l.map((function(e,t){return c.jsx(Hg,{type:null==i?void 0:i.type,color:e.color,reason:e.explanation},t)})),c.jsx(Hg,{type:null==i?void 0:i.type,color:a(),reason:l.length>0?"Original color":void 0}),c.jsx(F.LegendLabel,{className:Wg.label,style:{},children:null!=e&&e.formatSeriesName?null==e?void 0:e.formatSeriesName(null==t?void 0:t.text):t.text})]},"legend-quantile-"+n)}))})}})})},nb=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},rb=function(e,t){var n=-Infinity;if(t&&e)for(var r,i=ie(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},ib=function(e,t){var n=Infinity;if(t&&e)for(var r,i=ie(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 ob(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?Kg("y",r,i,void 0,void 0,[1.0005*a,1.0005*o]):o&&o>t?Kg("y",r,i,void 0,void 0,[n,1.0005*o]):a&&a<n?Kg("y",r,i,void 0,void 0,[1.0005*a,t]):Kg("y",r,i)}var ab=Lg({margin:0,fontSize:"0.9rem",padding:0}),lb=Lg({borderBottom:"1px dotted rgba(0,0,0,0.025)"}),sb=Lg({display:"flex",alignItems:"center",gap:6}),ub=Lg({display:"block",padding:0,margin:0,textAlign:"right"}),db=Lg({display:"grid",gridTemplateRows:"auto 1fr",gridRowGap:12,variants:{displayGrid:(Jg={},Jg.true={gridTemplateColumns:"1fr 1fr",gridColumnGap:48},Jg.false={gridTemplateColumns:"1fr"},Jg)}}),cb=Lg({borderTop:"1px solid rgba(200, 200, 200, 0.4)"}),pb=Lg({display:"grid",gridTemplateColumns:"auto 1fr",gap:12,fontSize:"0.75rem",fontWeight:500,color:"inherit",alignItems:"center"}),fb=Lg({display:"block",padding:0,margin:0}),mb=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"),Lg({display:"grid",gridTemplateRows:r,gap:12,padding:6})},heading:ab,total:cb,highlighted:Lg({wordBreak:"break-all"}),row:lb,rowLabel:sb,resultGrid:db,rowValue:ub,tooltipRowContainer:pb,totalLabel:fb,sectionTitle:Lg({color:"#7d838d",fontSize:12,marginTop:"0.25rem",marginBottom:0})}),hb=As({color:Ds(35)}),vb=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(gb,{total:o.showTotalOnTooltip,title:!0,sections:void 0!==d&&u.length>1?2:1,children:[c.jsx("p",{className:""+mb.heading,children:null==e?void 0:e.heading}),void 0!==d&&c.jsxs("div",{className:""+mb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[u.length>1&&c.jsx("p",{className:mb.sectionTitle+" "+hb,children:"Active"}),c.jsx(xb,{datumKey:a,keyString:l,chartProps:o,chartTooltipProps:e})]}),u.length>1&&c.jsxs("div",{className:""+mb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[c.jsx("p",{className:mb.sectionTitle+" "+hb,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(xb,{datumKey:a,keyString:t,chartProps:o,chartTooltipProps:e},"chart_"+t)}))]}),o.showTotalOnTooltip&&c.jsxs("div",{className:mb.total+" "+mb.tooltipRowContainer,children:[c.jsx("p",{className:""+mb.totalLabel,children:"Rounded total: "}),c.jsx("p",{className:mb.row+" "+mb.rowValue,children:null==e?void 0:e.total})]})]})},gb=function(e){return c.jsx("div",{className:""+mb.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})},bb=function(e){var t,n;return c.jsxs("div",{className:""+mb.tooltipRowContainer,children:[c.jsxs("span",{className:mb.row+" "+mb.rowLabel,children:[(null==e?void 0:e.icon)&&c.jsx(Hg,{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:""+mb.highlighted,children:null==e?void 0:e.label})]}),c.jsx("p",{className:mb.row+" "+mb.rowValue,children:null==e?void 0:e.value})]})},xb=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;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==(r=r.keys)||!r.find((function(t){return t===e}))?null!=t&&t.areas&&null!=t&&null!=(i=t.areas)&&null!=(i=i.keys)&&i.find((function(t){return t===e}))?"area":null!=t&&t.lines&&null!=t&&t.lines.scatter&&null!=t&&null!=(o=t.lines)&&null!=(o=o.keys)&&o.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(bb,{icon:{type:a,color:l},label:s,value:"undefined"===u?"-":u})})};function yb(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*((null==e?void 0: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 wb(e,t,n){if(1===e.length)return null==t?void 0: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 jb=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new Error("Invalid font size type")},Cb=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 Sb(e,t,n){var r=(t-n)/3;return r*e+(n-9*r)}function Fb(e,t,n,r){var i=0,o=function(e,t){var n,r;return{fontFamily:null!=(n=null!=(r=null==e?void 0:e.fontFamily)?r:t)?n:Ug,fontWeight:null!=e&&e.fontWeight?Cb(e.fontWeight):"700",fontSize:null!=e&&e.fontSize?jb(e.fontSize):9,letterSpacing:"normal"}}(n,null==r?void 0:r.fontFamily),a=o.fontFamily,l=o.fontWeight,s=o.fontSize,u=o.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),a,""+l,""+s,u);i=Math.max(i,n)})),i}var kb=function(e){var t,n,r,i,o,a,l={fontFamily:null!=(t=null==e||null==(n=e.theme)?void 0:n.fontFamily)?t:Ug,fontWeight:null==e||null==(r=e.theme)?void 0:r.fontWeight,fontSize:null==e||null==(i=e.theme)?void 0:i.fontSize,style:{fill:null!=(o=null==(a=e.theme)?void 0:a.color)?o:Ds(10)}};if("y"===(null==e?void 0:e.axis)){var s,u,d=-((null==e?void 0:e.axisFromPoint.y)+e.axisToPoint.y)/2;return c.jsx("svg",{x:"-1.25em",y:"0",fontSize:null==e||null==(s=e.theme)?void 0:s.fontSize,style:{overflow:"visible"},className:"vizzly-axis-title vizzly-axis-title-y",children:c.jsx("text",Q({transform:"rotate(-90)",x:d,y:"-"+(e.horizontal?null!=(u=e.leftPanelWidth)?u:82:38)},l,{textAnchor:"middle",children:c.jsx("tspan",{x:d,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",Q({x:((null==e?void 0:e.axisFromPoint.x)+e.axisToPoint.x)/2,y:"34",textAnchor:"middle",dominantBaseline:"middle"},l,{children:null==e?void 0:e.label}))})},_b=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 Fb(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=(null==t?void 0: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(Tb,Q({},t,{width:wb(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(Tb,Q({},t,{width:wb(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:(null==t?void 0: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(kb,Q({},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(Tb,Q({},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(kb,Q({},e,{theme:null==e||null==(l=e.theme)?void 0:l.axisTitles,axis:"y",horizontal:null!=(s=e.axisHorizontal)&&s}))]})},Tb=function(e){var n,r,i,o,a,l,s,u,d,p,f,m=e.type,h=null!=(n=e.theme)&&n.fontSize?jb(null==(r=e.theme)?void 0:r.fontSize):9,v=null!=(i=e.theme)&&i.fontWeight?""+Cb(null==(o=e.theme)?void 0:o.fontWeight):"700",g=null!=(a=null==(l=e.theme)?void 0:l.fontFamily)?a:Ug,b=e.width/6,x=yb(e.formattedValue,e.horizontal&&e.last?e.width-Sb(h,40,5):e.width-Sb(h,4,0),g,""+h,v,b),y="end2end"===m?e.last?e.right:null==e?void 0:e.left:e.horizontal?null!=e&&e.last?(null==e||null==(s=e.from)?void 0:s.x)-5:null==e||null==(u=e.from)?void 0:u.x:-5,w=null==e||null==(d=e.from)?void 0:d.y;return c.jsxs(t.Fragment,{children:[!e.horizontal&&c.jsx("line",{className:"visx-line",x1:"0",y1:w,x2:"0",y2:w,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:y,y:e.horizontal?"16":w,fontFamily:g,fontWeight:v,fontSize:""+h,letterSpacing:.4,stroke:"none",textAnchor:"end2end"===m?e.last?"end":"start":e.horizontal?"middle":"end",style:{fill:null!=(p=null==(f=e.theme)?void 0:f.color)?p:"rgba(0, 0, 0, 0.6)"},"data-horizontal":e.horizontal?"true":"false","data-axisistime":e.xAxisIsTime?"true":"false","data-type":"type-"+m,children:c.jsx("tspan",{x:y,dy:e.horizontal?0:2,children:"end2end"===m||e.xAxisIsTime?e.formattedValue:x})})})]})},Ab=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(Db,Q({},n,{width:null!=e&&e.horizontal?wb(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(Db,Q({},n,{width:null!=e&&e.horizontal?wb(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(Db,Q({},t,{width:null!=e&&e.horizontal?wb(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(kb,Q({},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}))]})},Db=function(e){var t,n,r,i,o,a,l,s,u,d=null!=(t=e.theme)&&t.fontSize?jb(null==(n=e.theme)?void 0:n.fontSize):"9",p=null!=(r=e.theme)&&r.fontWeight?""+Cb(null==(i=e.theme)?void 0:i.fontWeight):"700",f=null!=(o=null==(a=e.theme)?void 0:a.fontFamily)?o:Ug,m=yb(null!=(l=null==e?void 0:e.maxValueOfYAxis)?l:e.formattedValue,e.width,f,""+d,p,5),h=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:h,y:e.horizontal?"16":null!=e&&e.last?e.top:e.from.y,fontFamily:f,fontWeight:p,fontSize:d,letterSpacing:.4,stroke:"none",textAnchor:e.horizontal&&"end2end"===e.type?e.last?"end":"start":"middle",style:{fill:null!=(s=null==(u=e.theme)?void 0:u.color)?s:"rgba(0, 0, 0, 0.6)"},children:c.jsx("tspan",{x:h,dy:e.horizontal?0:2,children:m})})})},Ib=t.memo((function(e){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=ie(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:Ug,fontSize:9,fill:Ob(r.color,["#fff",Ds(0)]),children:n})]})]})})),Ob=function(e,t){return i.maxBy(t,(function(t){return s.contrast(t,e)}))||e},Pb=function(e,t,n){return(n+"_"+t+"_"+btoa(e.key+"_"+e.value+"_"+e.direction)).replace(/=/g,"")};function Eb(e,t){return null==t?void 0:t.filter((function(t){return t.key===e}))}function Mb(e,t){return Pb(e,t,">="===e.direction?"above":"below")}var Rb=function(e){var n=t.useContext(C.DataContext)||{},r=n.yScale,i=n.width;if(!r||!i)return null;var o=e.height-e.margin.top;return c.jsxs(t.Fragment,{children:[c.jsx("g",{transform:"translate(50, 0)",children:e.threshold.map((function(t,n){var o=r(t.value);return c.jsx("g",{children:c.jsx("line",{x1:0,y1:o,x2:i-e.margin.right-e.margin.left,y2:o,stroke:"#F4F4F4",strokeWidth:"1",fill:"transparent"})},"threshold-"+n)}))}),c.jsx("defs",{children:e.threshold.map((function(n,i){var a=r(n.value);return c.jsxs(t.Fragment,{children:[c.jsx("clipPath",{id:Pb(n,e.idPrefix,"above"),children:c.jsx("rect",{x:"0",y:"0",width:"100%",height:a})}),c.jsx("clipPath",{id:Pb(n,e.idPrefix,"intermediate"),children:c.jsx("rect",{x:"0",y:a,width:"100%",height:0})}),c.jsx("clipPath",{id:Pb(n,e.idPrefix,"below"),children:c.jsx("rect",{x:"0",y:a,width:"100%",height:o-a})})]},"threshold-"+i)}))})]})},Lb=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}}},Nb=function(e){var n,r,o,a,l,s,u,p,f,m,h,v,g,b,x,y,w,j,F,k,_,T,A,D,I,O,P,E,M,R=zg(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),L=e.approxYAxisLabelCount,N=void 0===L?"auto":L,z=e.approxXAxisLabelCount,q=void 0===z?"auto":z,B=e.removeStroke,W=void 0!==B&&B,V=e.horizontal,H=void 0!==V&&V,Y=e.theme,U=e.x,G=(P=e.x,E=e.bars,e.forceXAxisAsTime&&!E||i.isDate(null==(M=Gg({bars:E,lines:e.lines,areas:e.areas},"data")[0])?void 0:M[P])),K=Yg[function(e,t){var n=e||"natural";return"natural"===n&&(n=t?"monotoneY":"monotoneX"),n}(e.lineCurve,H)],X=function(e,t){var n,r,i,o;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,fontFamily:null!=(o=null==t?void 0:t.fontFamily)?o:Ug,textAnchor:e?"end":"middle",scaleToFit:"shrink-only"}},J=function(e,n){var r=t.useRef(null),o=t.useState(0),a=o[0],l=o[1];t.useEffect((function(){var e=i.throttle((function(){l(r.current?r.current.clientWidth:0)}),100);return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}));var s=Math.min(a<1e3?parseInt((""+a)[0]):12,12);return"auto"!=e?[r,e]:[r,s*(n?4:1)]}(q,!(null!=e&&e.horizontal)&&(null==e?void 0:e.forceXAxisAsTime)),Z=J[0],$=J[1],ee=t.useState(void 0),te=ee[0],ne=ee[1],re=t.useState(void 0),ie=re[0],oe=re[1],ae=Gg(e,"colors"),le=C.buildChartTheme(Q({},C.lightTheme,{colors:ae,tickLength:0,gridColor:"",gridColorDark:""})),se=null!=(r=null==Y||null==(o=Y.axis)?void 0:o.stroke)?r:"#eaeaea",ue=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"}}(q,N),de=ue.xAxisType,ce=ue.xAxisAttributes,pe=ue.yAxisType,fe=null!=(a=null!=(l=null==e||null==(s=e.lines)?void 0:s.data.length)?l:null==e||null==(u=e.areas)||null==(u=u.data)?void 0:u.length)?a:null==(p=e.bars)?void 0:p.data.length,me=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=rb(s,u),c=ib(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),he=me.maxValue,ve=me.minValue,ge=null!=(f=null==(m=e.lines)?void 0:m.threshold)?f:null==(h=e.areas)?void 0:h.threshold,be=function(e,t,n,r,i,o){if(e&&t)return Fb(i,(function(e){return n.formatXAxisLabel?n.formatXAxisLabel(e[o]):String(e[o])}),null==r?void 0:r.labels)}(H,null!=(v=e.forceXAxisAsTime)&&v,e,Y,Gg(e,"data"),e.x),xe=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:8,bottom:o?40:25,left:e?("none"!==n?i?i+10:82:25)+(a?24:0):t?50+(a?24:0):25,right:25}}(H,"right"!==e.yAxisOrientation,de,null==e?void 0:e.axisTitles,be);return c.jsxs("div",{ref:Z,style:{position:"relative",height:R},children:[c.jsxs(C.XYChart,{theme:le,margin:xe,height:R,xScale:Kg("x",H,G,null==e||null==(g=e.lines)?void 0:g.scatter,!(null==e||!e.lines)||!(null==e||!e.areas)),yScale:ob(null==e?void 0:e.goalLine,he,ve,H,G),horizontal:H,onPointerUp:function(){return null==e?void 0:e.onClick(te,ie)},children:[c.jsx(C.Grid,{columns:H,rows:!H,stroke:"black",strokeDasharray:"0.5 5",strokeWidth:W?0:2,lineStyle:{strokeLinecap:"round",stroke:null!=(b=null==Y||null==(x=Y.grid)?void 0:x.stroke)?b:"rgba(200, 200, 200, 0.2)"}}),!(null!=e&&e.sparkline)&&c.jsxs(c.Fragment,{children:["none"!==de&&c.jsx(C.Axis,Q({},ce,{tickLabelProps:function(){var e=Q({},X(H,null==Y?void 0:Y.labels));return H||(e.y=15),e},numTicks:"end2end"===de?fe:$,strokeWidth:W?0:1,tickStroke:"#eaeaea",stroke:H?"transparent":se,orientation:H?"left":"bottom",tickFormat:Zg(e.formatXAxisLabel,e.forceXAxisAsTime||G),label:H?null==e||null==(y=e.axisTitles)?void 0:y.y:null==e||null==(w=e.axisTitles)?void 0:w.x,children:function(t){return c.jsx(_b,Q({},t,{theme:Y,type:de,uniqueId:null==e?void 0:e.uniqueId,chartWidth:null==e?void 0:e.width,xAxisIsTime:!!e.forceXAxisAsTime,leftPanelWidth:be,axisHorizontal:null==e?void 0:e.horizontal}))}})),c.jsx(C.Axis,{labelOffset:50,tickLabelProps:function(){var t=Q({},X(H,null==Y?void 0:Y.labels));return H||"right"===e.yAxisOrientation||(t.width=50,t.textAnchor="middle"),t},hideAxisLine:!0,numTicks:"auto"===N?5:N,strokeWidth:W?0:1,hideTicks:!0,tickLength:e.horizontal||"right"===e.yAxisOrientation?10:25,stroke:se,orientation:H?"bottom":e.yAxisOrientation||"left",tickFormat:$g(e),label:H?null==e||null==(j=e.axisTitles)?void 0:j.x:null==e||null==(F=e.axisTitles)?void 0:F.y,children:function(t){return c.jsx(Ab,Q({},t,{theme:Y,type:pe,horizontal:H,maxValueOfYAxis:null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(he):he,uniqueId:null==e?void 0:e.uniqueId}))}})]}),ge&&ge.length>0&&c.jsx(Rb,{threshold:ge,height:R,margin:xe,idPrefix:e.idPrefix}),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 "+Ng+"\n "}),(null==e?void 0:e.areas)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(n,r){var i,o,a,l,s,u=(null==(i=e.areas)?void 0:i.formatter)&&(null==(o=e.areas)?void 0:o.formatter(n))||(null==(a=e.areas)?void 0:a.colors[r]);return c.jsxs(t.Fragment,{children:[c.jsx(S.LinearGradient,{id:"g"+e.uniqueId+r,from:u,to:u,fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+r),null==(l=Eb(n,null==(s=e.areas)?void 0:s.threshold))?void 0:l.map((function(t,n){return c.jsx(S.LinearGradient,{id:"g"+e.uniqueId+r+"_"+n,from:t.color,to:t.color,clipPath:"url(#"+Mb(t,e.idPrefix)+")",fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+r+"_"+n)}))]})}))}),(null==e?void 0:e.areas)&&!(null!=e&&null!=(k=e.areas)&&k.stacked)&&[].concat(e.areas.keys).map((function(n,r){var i,o,a,l=Q({curve:K,dataKey:n,data:null==(i=e.areas)?void 0:i.data},Lb(G,U,n,H),{renderLine:!1});return c.jsxs(t.Fragment,{children:[d.createElement(C.AreaSeries,Q({},l,{key:"grouped_area_"+e.uniqueId+"_"+r,fill:"url(#g"+e.uniqueId+r+")"})),null==(o=Eb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return c.jsx(C.AreaSeries,Q({},l,{clipPath:"url(#"+Mb(t,e.idPrefix)+")",fill:"url(#g"+e.uniqueId+r+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+r+"_threshold_"+n)}))]})})),(null==e?void 0:e.areas)&&e.areas.stacked&&c.jsx(C.AreaStack,{curve:K,renderLine:!0,children:[].concat(e.areas.keys).map((function(n,r){var i,o,a,l=Q({dataKey:n,data:null==(i=e.areas)?void 0:i.data},Lb(G,U,n,H));return c.jsxs(t.Fragment,{children:[c.jsx(C.AreaSeries,Q({fill:"url(#g"+e.uniqueId+r+")",lineProps:{strokeWidth:4,strokeLinecap:"round"}},l),"areas_stacked_"+e.uniqueId+"_"+r),null==(o=Eb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return c.jsx(C.AreaSeries,Q({},l,{clipPath:"url(#"+Mb(t,e.idPrefix)+")",fill:"url(#g"+e.uniqueId+r+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+r+"_threshold_"+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,o,a;return c.jsx(C.BarSeries,Q({radiusAll:!0,radius:null!=(r=null==(i=e.bars)||null==(i=i.styles)?void 0:i.cornerRadius)?r:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(a=e.bars)?void 0:a.formatter)&&Xg(t,null==e?void 0:e.bars.formatter,ae,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,o,a;return c.jsx(C.BarSeries,Q({radiusAll:!0,radius:null!=(r=null==(i=e.bars)||null==(i=i.styles)?void 0:i.cornerRadius)?r:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(a=e.bars)?void 0:a.formatter)&&Xg(t,null==e?void 0:e.bars.formatter,ae,n)}),"stacked_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.lines)&&!(null!=e&&null!=(_=e.lines)&&_.scatter)&&e.lines.keys.map((function(t,n){var r,i,o,a,l=Q({strokeWidth:3,curve:K,dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H));return c.jsxs(c.Fragment,{children:[d.createElement(C.LineSeries,Q({},l,{key:"line_on_line_chart_"+e.uniqueId+"_"+n,colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Qg(null==e?void 0:e.lines.formatter,ae,n)})),null==(o=Eb(t,null==(a=e.lines)?void 0:a.threshold))?void 0:o.map((function(t,r){return d.createElement(C.LineSeries,Q({},l,{key:"line_on_line_chart_"+e.uniqueId+"_"+n+"_threshold_"+r,clipPath:"url(#"+Mb(t,e.idPrefix)+")",stroke:t.color}))}))]})})),e.lines&&(null==e||null==(T=e.lines)?void 0:T.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,Q({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Xg(t,null==e?void 0:e.lines.formatter,ae,n)}),"scatter_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(A=e.lines)?void 0:A.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,Q({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Xg(t,null==e?void 0:e.lines.formatter,ae,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(Rg,{show:(null==te?void 0:te.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;oe(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==te?void 0:te.key);te&&!t||ne(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":Zg(e,t)(n)}(e.formatXAxisLabel,G,null==l?void 0:l.datum[U]);return c.jsx(vb,{heading:p,total:d,chartProps:e,datumKey:a,tooltipNearestDatum:l,typeIndex:nb(e),getColor:function(e){return null==o?void 0:o(e)},formatSeriesName:e.formatSeriesName,formatValue:$g(e)})}}),e.goalLine&&(null==(D=e.goalLine)?void 0:D.length)>0&&!H&&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(Ib,{axisProps:t,goalLine:n,value:n.value,toX:(null!=(i=null==e?void 0:e.width)?i:0)-xe.left-xe.right,marginRight:xe.right,maxValueOfYAxis:he,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel},(null==e?void 0:e.uniqueId)+"-"+r)}))}})]}),(null==e?void 0:e.legend)&&c.jsx(tb,{keys:Gg(e,"keys"),colors:ae,typeIndex:nb(e),formatSeriesName:null==e?void 0:e.formatSeriesName,formatter:null==e||null==(I=e.bars)?void 0:I.formatter,data:null==(O=e.bars)?void 0:O.data,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities})]})},zb=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,threshold:e.threshold},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,idPrefix:null==e?void 0:e.idPrefix})}})})),qb=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 Ee(e)})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return Ee(e)}))}};function Bb(e){var n=e.title,r=e.subject,i=e.headline,o=t.useRef(null),a=t.useState(n),l=a[0],s=a[1],u=t.useState(null==i?void 0:i.func),d=u[0],c=u[1],p=t.useState(r),f=p[0],m=p[1];return t.useEffect((function(){var e;0===l.length&&n.length>=1&&o.current&&o.current.resetSize(),0===f.length&&r.length>=1&&o.current&&o.current.resetSize(),0===(null==d?void 0:d.length)&&null!=i&&i.func&&(null==i||null==(e=i.func)?void 0:e.length)>=1&&o.current&&o.current.resetSize(),s(n),m(r),c(null==i?void 0:i.func)}),[n,r,i]),o}var Wb=function(e,t){return!(!1!==e&&void 0!==e||!t)||!0===e},Vb=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=vn(t).flatMap((function(t){var n=Yr(e,t);return Gt(n)?[n]:[]}));return JSON.stringify(n)}return""}(o,e);return t.useEffect((function(){var t=new AbortController;return function(){var o=X(G().mark((function o(){var a;return G().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return u(!0),o.next=3,Nm(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 un)return{queriesAreChanging:!1};throw e}};function Hb(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 Yb(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 Ub=As({padding:"2px 6px",borderRadius:6,variants:{positive:{yes:{color:"rgb(4, 120, 87)",background:"#D1FAE5"},no:{color:"rgb(190, 18, 60)",background:"#FFE4E6"}}}}),Gb=As({fontSize:"12px",display:"flex",alignItems:"center",rowGap:"0.5rem",position:"relative",cursor:"pointer"}),Kb=Object.assign((function(){return null}),{deltaPill:Ub,deltaText:As({padding:0,borderRadius:6,variants:{positive:{yes:{color:"rgb(23, 171, 92)",background:"transparent"},no:{color:"rgb(190, 18, 60)",background:"transparent"}}}}),arrow:As({height:"1rem",width:"1rem",variants:{percentageIncrease:{yes:{transform:"rotate(315deg)"},no:{transform:"rotate(45deg)"}},delteStyle:{pill:{},text:{position:"absolute",right:"-1rem"}}}}),delta:Gb});function Xb(e,t){var n;return null==e||null==(n=e.content)||null==(n=n[e.content.length-1])?void 0:n[t]}var Qb=function(e){var n,r,i,o=md().textOverride,a=Xd(),l=t.useState(!0),s=l[0],u=l[1],d="supporting"===e.viewFor||"text"===(null==a||null==(i=a.charts)||null==(i=i.singleStat)?void 0:i.delteStyle)?"text":"pill",p=e.result;if(!p||0===p.content.length||1===p.content.length)return null;var f,m,h,v=p.content[p.content.length-2][e.index],g=Xb(p,e.index),b=(f=v,0!==(m=g)?0!==f?(m-f)/f*100:100*m:100*-f),x=(h={positive:b>=0?"yes":"no"},"text"===d?Kb.deltaText(h):Kb.deltaPill(h)),y=-1*(v-g);return c.jsxs(t.Fragment,{children:[c.jsx(_f,{as:"hr",margin:0,border:0,borderTop:"1px solid "+Ds(85)}),c.jsxs(Ud,{gap:"0.15rem",children:["standalone"===e.viewFor&&c.jsxs(_f,{as:"p",className:Hd(""+tu.textSize("xs"),tu.opacity(.7)+" "+tu.align("left")),margin:0,children:[o("single_stat.current","Current")," ",null==e||null==(n=e.deltaTimeDimension)?void 0:n.truncate]}),c.jsxs(zf,{gap:"0.5rem",alignItems:"end",children:["standalone"===e.viewFor&&c.jsx(_f,{as:"p",margin:0,nowrap:!0,children:c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:g,measure:null==e?void 0:e.measure})}),c.jsx(zf,{alignSelf:"supporting"===e.viewFor?"flex-end":"text"===(null==a||null==(r=a.charts)||null==(r=r.singleStat)?void 0:r.delteStyle)?"center":"flex-end",gap:"0.5rem",children:c.jsx(ih,{tooltipContent:function(){var t;return c.jsxs(ih.Content,{children:[o("single_stat.previous","Previous")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate,":"," ",c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:v,measure:null==e?void 0:e.measure})]})},children:c.jsxs("button",{onClick:function(){return u(!s)},className:Hd(x,""+tu.bw(0),""+Kb.delta),"aria-label":s?o("single_stat.show_as_value","Show as value"):o("single_stat.show_as_percentage","Show as percentage"),children:[s?Jl(b,2)+"%":c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:y,measure:null==e?void 0:e.measure}),c.jsx("svg",{className:""+Kb.arrow({percentageIncrease:b>=0?"yes":"no",delteStyle:d}),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"})})]})})})]})]})]})},Jb=function(e){var t=md().textOverride,n=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===n?c.jsx("p",{className:Hd(""+tu.textSize("xs"),""+tu.opacity(.5)),children:t("single_stat.no_data_for_delta_description","No data available for [[deltaTimeDimension]] comparison",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})}):null===(null==e?void 0:e.deltaTimeDimension)||!1===n?null:c.jsx(_f,{margin:0,className:Hd(""+tu.textSize("xs"),""+tu.opacity(.5)),children:t("single_stat.delta_description","Comparing [[deltaTimeDimension]] over [[deltaTimeDimension]]",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})})};function Zb(e,t,n,r,i,o){var a=e[_t(r)]||"_vizzly_to_2_dp",l=t[_t(r)]||"",s=n[_t(r)]||"";return{formattedValue:o[a].formatter(i),prefix:l,postfix:s}}var $b=function(e,t,n){var r="";return t&&(r=""+t),r=""+r+e,n&&(r=""+r+n),r},ex=function(e){var n=t.useRef(null),r=t.useState(0),i=r[0],o=r[1];return t.useEffect((function(){var e,t,r=function(){n.current&&o(n.current.offsetWidth)},i=(e=r,function(){clearTimeout(t),t=setTimeout((function(){e()}),50)});requestAnimationFrame((function(){return r()}));var a=new ResizeObserver(i);return n.current&&a.observe(n.current),window.addEventListener("resize",i),function(){window.removeEventListener("resize",i),a&&a.disconnect()}}),[e]),[n,i]},tx={standalone:{smallFonts:"sm",direction:"column",gap:"1rem",statGap:80},supporting:{smallFonts:"xs",direction:"row",gap:"0.25rem",statGap:40}},nx={name:"12ayaws",styles:"position:relative;display:flex;white-space:nowrap;padding-top:0.25rem;text-align:left;font-size:3rem;line-height:1;font-weight:600;letter-spacing:0.025em"},rx={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"},ix=function(e){var n,r,o,a,l,s=md(),u=s.textOverride,d=s.labelFormat,p=e.results[0],f=e.results[1],m=t.useState(null),h=m[0],v=m[1];if(t.useEffect((function(){if(p&&e.measure){var t=ss(p,_t(e.measure));-1!==t&&v(t)}}),[p,e.measure]),null===h)return null;var g=e.displayCurrent?Xb(f,h):null==p||null==(n=p.content)||null==(n=n[0])?void 0:n[h],b=function(e,t){var n={};return t.forEach((function(t){var r,i;if("fontColor"==t.ruleType&&hs({op:null==(r=t.filters)?void 0:r[0][0].op,value:null==(i=t.filters)?void 0:i[0][0].value},e))return n.color=t.ruleValue})),n}(g,i.filter(e.conditionalFormattingRules,(function(t){var n,r,i;return Ee({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(r=null==(i=t.filters)?void 0:i[0][0].function)?r:"none"})==_t(e.measure)}))),x=gs(null==p||null==(r=p.fields[h])?void 0:r.publicName,null==(o=e.supportedAggregates[e.measure.function])?void 0:o.publicName),y=d({fieldId:e.measure.field,func:e.measure.function,type:"singleStat",defaultLabel:x,viewId:e.viewId,values:[null!=(a=null==p||null==(l=p.fields[h])?void 0:l.publicName)?a:""]});return c.jsxs("div",{children:[c.jsx("div",{className:""+tu.align("left"),children:(e.showAggregateText||"supporting"===e.viewFor)&&c.jsx("span",{className:tu.textSize(tx[e.viewFor].smallFonts)+" "+tu.nowrap,children:null!=y?y:x})}),c.jsxs(zf,{gap:"0.35rem",direction:tx[e.viewFor].direction,children:[c.jsx(_f,{children:e.displayCurrent&&"supporting"===e.viewFor?c.jsx(ih,{tooltipContent:function(){var t;return c.jsxs(ih.Content,{children:[u("single_stat.current","Current")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate]})},children:c.jsx("p",{style:Q({},b,{fontSize:e.fontSize}),css:nx,className:""+tu.text,children:c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:g,measure:null==e?void 0:e.measure})})}):c.jsx("p",{style:Q({},b,{fontSize:e.fontSize}),css:rx,className:tu.text+" "+tu.align("left"),children:c.jsx(ox,{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:g})})}),c.jsx(Qb,{index:h,result:f,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,viewFor:e.viewFor})]})]})},ox=function(e){var n=md(),r=n.textOverride,i=Zb(e.formatter,e.prefixes,e.postfixes,e.measure,e.value,n.numberFormatOptions),o=i.formattedValue,a=i.prefix,l=i.postfix;return o===r("single_stat.no_value","No value")?c.jsx(t.Fragment,{children:o}):c.jsx(t.Fragment,{children:$b(o,a,l)})},ax={type:"singleStat",prefixes:{},postfixes:{},fontSize:"30px",measure:[],displayTitle:"",displaySubject:"",formatter:{},filter:[],limit:500,conditionalFormattingRules:[],deltaTimeDimension:null},lx={name:"1kzq5ms",styles:"height:100%;width:100%"},sx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g={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,viewId:null!=(a=null==(l=e)?void 0:l.viewId)?a:""},b=ex(e.queriesAreChanging),x=b[0],y=b[1],w=ex(e.queriesAreChanging),j=w[0],C=w[1];if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb({measure:e.measure,order:[],dimension:[]})});var S=void 0!==e.results?e.results[0]:void 0;if(ds(S))return c.jsx(nm,{});if(cs(S))return c.jsx(iv,{});if(ps(S))return c.jsx(av,Q({},g));var F=(e=bs(e,{},ax)).measure.length,k=tx[e.viewFor].statGap,_=e.leftAlign?"flex-start":(F-1)*k+C*F<y-32?"center":void 0;return c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[!e.hideHeader&&c.jsx(Pg,Q({},g,{paddingBottom:0})),F>1?c.jsxs(t.Fragment,{children:[c.jsx("div",{css:lx,ref:x,children:c.jsx(zf,{direction:"row",height:"100%",gap:k,"data-component":"stat-container",alignItems:"center",justifyContent:_,paddingTop:"0.5rem",children:[].concat(e.measure).map((function(t,n){var r,i;return c.jsx("div",{ref:j,children:c.jsx(ix,{index:n,showAggregateText:F>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,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(i=e.viewId)?i:""})},n)}))})}),(null==(s=e)?void 0:s.deltaTimeDimension)&&c.jsx(_f,{marginTop:tx[e.viewFor].gap,children:c.jsx(Jb,{deltaTimeDimension:null==(u=e)?void 0:u.deltaTimeDimension,results:null==(d=e)?void 0:d.results})})]}):c.jsxs(Ud,{placeContent:e.leftAlign?"left":"center","data-component":"stat-container",height:"100%",children:[c.jsx(ix,{index:1,showAggregateText:F>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==(p=e)?void 0:p.deltaTimeDimension,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(f=e.viewId)?f:""},1),(null==(m=e)?void 0:m.deltaTimeDimension)&&c.jsx(_f,{marginTop:tx[e.viewFor].gap,children:c.jsx(Jb,{deltaTimeDimension:null==(h=e)?void 0:h.deltaTimeDimension,results:null==(v=e)?void 0:v.results})})]})]})};function ux(e,t){return e.reduce((function(e,n){return t&&"string"==typeof t&&(e[Ee(n)]=t),e}),{})}function dx(e,t){return(null===t||"object"!=typeof t||0!==Object.keys(t).length)&&e.length>0&&"asc"===e[0].direction&&!!t}function cx(e,t,n){return!(null==t||!t.func)&&dx(e,n)}sx.defaultProps=ax;var px=function(e){var n,r,i,o,a=md().queryEngineConfig,l=t.useState([]),s=l[0],u=l[1],d=0!==Object.keys(e.component.attributes.timeDimension||{}).length&&"current"===(null==(n=e.component.attributes.headline)?void 0:n.func),p=d&&e.component.attributes.timeDimension?Q({},e.component.attributes.timeDimension,{bucketFill:!1}):null,f=function(e,t,n,r){return e.map((function(e){var i;return Q({},e,{function:(null==(i=Pe(Yr(n,e.field),t))?void 0:i.includes(r))?r:e.function})}))}(e.component.attributes.measure,a.supportedAggregates,e.dataSet,null==(r=e.component.attributes.headline)?void 0:r.func),m=hr({queryEngineConfig:a}).init(e.dataSet.id,{prefixes:ux(f,e.component.attributes.yAxisPrefix),postfixes:ux(f,e.component.attributes.yAxisPostfix),formatter:ux(f,e.component.attributes.yAxisFormat),fontSize:"1.1rem",viewId:e.component.attributes.viewId+"-stats",deltaTimeDimension:p,measure:f}),h=Vb(m,e.runQueriesCallback,u,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(_f,{minHeight:d?80:56,children:c.jsx(sx,Q({},m,{id:null!=(i=m.viewId)?i:"",dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:function(){},setParameterUpdate:function(){},results:s,queriesAreChanging:h.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(o=e.dashboardBehaviour)||null==(o=o.queryEngineConfig)?void 0:o.supportedTransformationFunctions,library:null==e?void 0:e.library,leftAlign:!0,viewFor:"supporting",displayCurrent:d}))})},fx=function(e){var t=[];return e?(e.forEach((function(e){var n;t.push({key:ts([],[],e.filters[0][0].field,null!=(n=e.filters[0][0].function)?n:"none"),value:e.filters[0][0].value,direction:e.filters[0][0].op,color:e.ruleValue})})),t):t},mx=function(e){var n,r,i,o,a=Bb({title:null==e?void 0:e.displayTitle,subject:null==e?void 0:e.displaySubject,headline:null==e?void 0:e.headline}),l=md(),s=l.textOverride,u=l.labelFormat,d=Xd(),p={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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},p));var f=qb(e),m=ls(f,e.measure,e.result),h=as(e.result,e.measure,f,"100%"==e.stacked),v=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},p,{paddingBottom:v?"0.5rem":void 0})),v&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(zb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:a,uniqueId:e.id,x:"x",keys:m,colors:di(null==d?void 0:d.colors,m.length),data:h,legend:Wb(null==e?void 0:e.legend,"verbose"===(null==d?void 0:d.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,showTotalOnTooltip:!!e.stacked,stacked:!!e.stacked,formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatYAxisLabel:Ss(s,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),annotate:"verbose"==(null==d?void 0:d.detail)?["high_and_low"]:[],lineCurve:e.lineCurve,theme:null==d?void 0:d.charts,formatSeriesName:Fs(e.result,s,e.type,null!=(o=e.viewId)?o:"",u),formatter:function(t){var n=js(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},onPointerUp:null==e?void 0:e.onPointerUp,sparkline:e.sm,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,threshold:fx(e.conditionalFormattingRules)})})]})})};mx.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,headline:{}};var hx=t.memo(mx,xs),vx=function(){return null},gx=function(e){var t;return(null==e||null==(t=e.component)||null==(t=t.attributes)||null==(t=t.drilldown)?void 0:t.length)>0},bx=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=a.localFilters,d=Vb(s,e.runQueriesCallback,e.setResults,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(hx,Q({id:e.id},s,{dataSet:e.dataSet,localFilters:u,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:l[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,onPointerUp:function(t){return gx(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},xx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,styles:e.styles},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,idPrefix:e.idPrefix})}})}));function yx(e,t,n){var r=wx(e,t);return null!=n&&n.grouping?jx(r,null==n?void 0:n.grouping):r}var wx=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}}))},jx=function(e,t){return t.forEach((function(t){var n=e.findIndex((function(e){return e.fieldId===t.fieldId}));n>-1?e[n]=Q({},e[n],t):e.push(t)})),e};function Cx(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(ns(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=Me(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 Sx=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))},Fx={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"},kx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b,x,y,w,j=e.displayTitle,C=e.displaySubject,S=md(),F=S.textOverride,k=S.labelFormat,_=Bb({title:j,subject:C,headline:e.headline}),T=Xd(),A={displayTitle:j,displaySubject:C,localFilters:(e=bs(e,{},Fx)).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,viewId:null!=(u=null==(d=e)?void 0:d.viewId)?u:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},A));var D=qb(e),I=ls(D,e.measure,e.result),O=as(e.result,e.measure,D,"100%"==e.stacked),P=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},A,{paddingBottom:P?"0.5rem":void 0})),P&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(p=null==(f=e)?void 0:f.library)&&p,children:c.jsx(xx,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:_,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:Ss(F,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(m=e)?void 0:m.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(h=e)?void 0:h.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatter:function(t,n){var r,i=js(e.dimension,e.conditionalFormattingRules,t,n,null==(r=e)?void 0:r.dataSet);if(i)return i.value},styles:null==T||null==(v=T.charts)?void 0:v.barChart,keys:I,colors:di(null==T?void 0:T.colors,I.length),data:O,legend:Wb(null==(g=e)?void 0:g.legend,"verbose"===(null==T?void 0:T.detail)),horizontal:"horizontalBarChart"==e.type,removeStroke:!1,type:e.stacked?"stacked":"grouped",showTotalOnTooltip:!!e.stacked,forceXAxisAsTime:!!e.timeDimension,theme:null==T?void 0:T.charts,axisTitles:null==(b=e)?void 0:b.axisTitles,formatSeriesName:Fs(e.result,F,e.type,null!=(x=e.viewId)?x:"",k),onPointerUp:null==(y=e)?void 0:y.onPointerUp,conditionalFormattingPossibilities:function(t){return ws(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)&&Sx(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 rs(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==(w=e)?void 0:w.goalLines,idPrefix:e.idPrefix})})]})})};kx.defaultProps=Fx;var _x=t.memo(kx,xs),Tx=function(e,n,r,i,o,a,l){var s=e;return n.preAggregated&&(s=[ei(n)]),function(e,n,r,i){t.useEffect((function(){var t=Br(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:Vb(s,a,l,i,n,e.type).queriesAreChanging}},Ax=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=Tx(s,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(_x,Q({id:e.id},s,{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:l[0],queriesAreChanging:u.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,onPointerUp:function(t){return gx(e)&&o(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,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},Dx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,threshold:e.threshold},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,idPrefix:null==e?void 0:e.idPrefix})}})})),Ix=function(e){var n,r,i,o,a=md(),l=a.textOverride,s=a.labelFormat,u=e.displayTitle,d=e.displaySubject,p=Bb({title:u,subject:d,headline:null==e?void 0:e.headline}),f={displayTitle:u,displaySubject:d,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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},m=Xd();if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},f));var h=qb(e),v=ls(h,e.measure,e.result),g=as(e.result,e.measure,h,"100%"==e.stacked),b=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},f,{paddingBottom:b?"0.5rem":void 0})),b&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(Dx,{ref:p,uniqueId:e.id,x:"x",approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,formatYAxisLabel:Ss(l,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),keys:v,colors:di(null==m?void 0:m.colors,v.length),data:g,sparkline:e.sm,legend:Wb(null==e?void 0:e.legend,"verbose"===(null==m?void 0:m.detail)),horizontal:!1,annotate:"verbose"==(null==m?void 0:m.detail)?["high_and_low"]:[],forceXAxisAsTime:!!e.timeDimension,lineCurve:e.lineCurve,theme:null==m?void 0:m.charts,formatSeriesName:Fs(e.result,l,e.type,null!=(o=e.viewId)?o:"",s),formatter:function(t){var n=js(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},onPointerUp:null==e?void 0:e.onPointerUp,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,threshold:fx(e.conditionalFormattingRules),idPrefix:e.idPrefix})})]})})};Ix.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,headline:void 0};var Ox=t.memo(Ix,xs),Px=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=Tx(s,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(Ox,Q({id:e.id},s,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,result:l[0],queriesAreChanging:u.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,onPointerUp:function(t){return gx(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},Ex=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,idPrefix:null==e?void 0:e.idPrefix})}})})),Mx={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"},Rx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h=e.displayTitle,v=e.displaySubject,g=md(),b=g.textOverride,x=g.labelFormat,y=Bb({title:h,subject:v}),w={displayTitle:h,displaySubject:v,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,viewId:null!=(i=null==(o=e)?void 0:o.viewId)?i:""},j=Xd();if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Yb(e)});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},w));var C=(e=bs(e,{},Mx)).result&&e.xMeasure?function(e,t,n){var r={};return os(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=ts(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 S=[];e.xMeasure&&S.push(e.xMeasure),e.yMeasure&&S.push(e.yMeasure);var F=qb(e),k=e.result?as(e.result,S,F):[],_=ts([],[],e.xMeasure.field,e.xMeasure.function);return k.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=ts([],[],r.field,r.function),a=ts(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(nm,{}),children:c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},w)),c.jsx(lu,{disabledFeatures:null!=(a=null==(l=e)?void 0:l.library)&&a,children:c.jsx(Ex,{ref:y,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,x:_,keys:C,colors:di(null==j?void 0:j.colors,C.length),data:k,legend:Wb(null==(s=e)?void 0:s.legend,"verbose"===(null==j?void 0:j.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!1,sparkline:!1,formatYAxisLabel:Ss(b,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(u=e)?void 0:u.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(null,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(d=e)?void 0:d.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),theme:null==j?void 0:j.charts,formatSeriesName:Fs(e.result,b,e.type,null!=(p=e.viewId)?p:"",x),goalLine:null==(f=e)?void 0:f.goalLines,axisTitles:null==(m=e)?void 0:m.axisTitles,idPrefix:e.idPrefix})})]})})};Rx.defaultProps=Mx;var Lx=t.memo(Rx,xs),Nx=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=n.localFilters,a=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:o,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(Lx,Q({id:e.id},i,{dataSet:e.dataSet,localFilters:o,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:r[0],queriesAreChanging:a.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==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,idPrefix:e.idPrefix}))},zx=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}),{})}))},qx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,Q({},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}))}})})),Bx=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}},Wx=function(e){return{startAngle:e.startAngle,endAngle:e.endAngle,opacity:1}};function Vx(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 P.useTransition(e.arcs,{from:t?Bx:Wx,enter:Wx,update:Wx,leave:t?Bx:Wx,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(P.animated.path,{d:P.interpolate([e.startAngle,e.endAngle],(function(e,r){return n(Q({},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(P.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 Hx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){return c.jsx(Yx,Q({width:null==t?void 0:t.width,height:null==t?void 0:t.height},e))}})})),Yx=function(e){var n,r,i,o,a,l=e.width,s=e.labelKey,u=e.valueKey,d=e.formatValue,p=e.formatLabel,f=zg(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),m=E.useTooltip({tooltipOpen:!1,tooltipLeft:l/2,tooltipTop:f,tooltipData:"Move me with your mouse or finger"}),h=m.showTooltip,v=m.hideTooltip,g=m.tooltipOpen,b=m.tooltipData,x=m.tooltipLeft,y=void 0===x?0:x,w=m.tooltipTop,j=void 0===w?0:w,C=E.useTooltipInPortal({scroll:!0,detectBounds:!0}),S=C.containerRef,F=C.containerBounds,_=C.TooltipInPortal,T=Ux(null==e?void 0:e.data,s,p),A=k.scaleOrdinal({domain:T,range:null==e?void 0:e.colors}),D=l-25-25,P=f-8-25,M=Math.min(D,P)/2,R=P/2,L=D/2,N=f/5.5,z=t.useCallback((function(e){var t,n,r=(null==e||null==(t=e.coords)?void 0:t.x)-F.left+l/2,i=(null==e||null==(n=e.coords)?void 0:n.y)-F.top+f/2;h({tooltipLeft:r,tooltipTop:i,tooltipData:JSON.stringify(e.arc.data)})}),[h,f,l]);if(l<10)return null;var q=function(){if(b){var e=JSON.parse(b);return{label:p?p(e[s]):e[s],value:d(e[u])}}return{label:"",value:""}};return c.jsxs("div",{ref:S,style:{position:"relative",height:f,width:l},children:[c.jsx("style",{children:""+Ng}),c.jsx("svg",{width:l,height:f,children:c.jsxs(I.Group,{top:R+8,left:L+25,children:[c.jsx(O,{data:null==e?void 0:e.data,pieValue:function(e){return e[u]},outerRadius:M,innerRadius:null!=(r=e.styles)&&r.hole?M-N:void 0,cornerRadius:null!=(i=null==(o=e.styles)?void 0:o.cornerRadius)?i:5,padAngle:null!=(a=e.styles)&&a.gap?.005:void 0,pieSort:null,pieSortValues:null,children:function(t){return c.jsx(Vx,Q({},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,u)||A(t.data[s])},onMouseOver:z,onMouseOut:function(){return v()},showLabel:null==e?void 0:e.showLabel,valueKey:u,formatValue:function(e){return d(e)}}))}}),g&&c.jsx(_,{top:j,left:y,children:c.jsx(gb,{sections:1,children:c.jsx(bb,{label:q().label,value:q().value.toString()})})},Math.random())]})}),(null==e?void 0:e.legend)&&c.jsx(tb,{colors:null==e?void 0:e.colors,keys:T,typeIndex:Gx(null==e?void 0:e.data),alignCenter:!0,replaceDimensionColorsIfPossible:!0,conditionalFormattingPossibilities:function(t){return e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(u):[]}})]})},Ux=function(e,t,n){return e.map((function(e){return n?n(e[t]):e[t]}))},Gx=function(e){return e.map((function(e,t){return{index:t,type:"pie"}}))},Kx={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"},Xx={worldCountries:{id:"worldCountries",fetchTopoJSON:function(){var e=X(G().mark((function e(){var t;return G().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=this,r=(null==e||null==(t=e.objects)||null==(t=t.countries1)?void 0:t.geometries)||[];return i.reduce(r,(function(e,t){return e[n.geographicAreaId(t)]={publicName:n.geographicAreaPublicName(t)},e}),{})},resolveUserDataToVizzlyAreaCode:function(e){var t={};return Object.keys(e).forEach((function(n){t[Kx[n]||n]=e[n]})),t}}},Qx=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=Xx[e];return t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t;return G().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,j=function(e,t){var n=E.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=E.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),C=j.showTooltip,S=j.containerRef,F=j.tooltipData,_=j.containerBounds,T=j.tooltipOpen,A=j.TooltipInPortal,D=j.tooltipTop,I=j.tooltipLeft,O=j.hideTooltip;if(!w)return null;var P=y.resolveUserDataToVizzlyAreaCode(l),L=R.feature(w,w.objects.countries1),z=Object.values(l),q=k.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:""+Ng}),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(){O(),e.isDragging&&e.dragEnd()},children:[c.jsx("rect",{x:0,y:0,width:o,height:a,fill:s,rx:14}),c.jsx(M.Mercator,{data:L.features,scale:e.transformMatrix.scaleX,translate:[e.transformMatrix.translateX,e.transformMatrix.translateY],children:function(e){return c.jsxs("g",{children:[c.jsx(M.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),P[n]?q(P[n]):p),stroke:s,strokeWidth:.5,onMouseEnter:function(e){r.id!=(null==F?void 0:F.areaId)&&C({tooltipLeft:e.clientX-_.left,tooltipTop:e.clientY-_.top,tooltipData:{areaId:r.id,publicName:y.geographicAreaPublicName(r),value:P[r.id]}})}},"map-feature-"+t)}))]})}}),T&&c.jsx(A,{top:D,left:I,children:c.jsx(gb,{sections:1,children:c.jsx(bb,{label:null==F?void 0:F.publicName,value:null!=F&&F.value?""+f(F.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:"-"})]})]})}})]})},Jx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(L,{children:function(t){return c.jsx(Qx,Q({},e,{width:t.width,height:t.height}))}})})),Zx=function(e){var n,r,o,a,l=e.displayTitle,s=e.displaySubject,u=Xd(),d=Bb({title:l,subject:s}),p={displayTitle:l,displaySubject:s,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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},f={dataSetId:e.dataSetId,measure:e.measure,dimension:e.dimension,timeDimension:null,order:e.order,filter:e.filter},m=e.measure.length>0&&e.dimension.length>0;if(ds(e.result))return c.jsx(nm,{});if(!m)return c.jsx(rv,{title:"Missing parameters",children:Hb(f)});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},p));var h=qb({dimension:e.dimension}),v=function(e,t,n,r){void 0===r&&(r=!1);var o=zx(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 Ie(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=_t(t),r=ts(l,s,t.field,t.function);a[r]=e[n]}));var u={};return r.forEach((function(t){u[t]=e[t]})),Q({},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=Q({},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)?Ql(n[o],r):e}))}))}(u):u}(e.result,h,f),g=function(e,t,n){var r=zx(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=_t(e),o=ts(n.y,r,e.field,e.function);i[o]={key:o,yValues:[].concat(r,[t]),name:[].concat(r,[t]).join(", ")}}))})),Object.values(i)}(f,e.result,h).map((function(t){return{data:v.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(nm,{}),children:c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},p)),c.jsx(lu,{disabledFeatures:null!=(o=null==e?void 0:e.library)&&o,children:c.jsx(Hx,{ref:d,data:g[0].data,labelKey:g[0].labelKey,valueKey:g[0].valueKey,colors:di(null==u?void 0:u.colors,v.length),styles:null==u||null==(a=u.charts)?void 0:a.pie,conditionalFormattingPossibilities:function(t){return ws(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},formatColor:function(t,n){var r=js(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(r)return r.value},showLabel:"verbose"===(null==u?void 0:u.detail),legend:Wb(null==e?void 0:e.legend,"verbose"===(null==u?void 0:u.detail)),formatValue:function(t){return ks(Jl(t,2),null==e?void 0:e.numberFormatOptions,null==e?void 0:e.labelFormat)}})})]})})};Zx.defaultProps={type:"pieChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!1,labelFormat:null};var $x=t.memo(Zx,xs),ey=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx($x,Q({id:e.id},i,{dataSet:e.dataSet,localFilters:e.component.localFilters,setParameterUpdate:e.setParameterUpdate,setLocalFilters:e.setLocalFilters,result:r[0],queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},ty=Object.assign((function(){}),{wrapper:function(e){return As({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 As(Q({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"},Ts,{"&:hover":Q({},Ts,{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":Q({},Ts,{outline:0,boxShadow:e?null==(r=e["&:focus"])?void 0:r.boxShadow:void 0})}))},icon:function(e){var t,n;return As({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:As({top:8,right:12,position:"absolute",display:"flex",gap:"0.5rem"})}),ny=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=Xd();return c.jsx("form",{autoComplete:"off",children:c.jsxs("div",{role:"search",className:""+ty.wrapper(null==f?void 0:f.search),"data-themeapi":"search","data-chipposition":"top.left",children:[c.jsx(yg,{as:"label",htmlFor:"fuzzy-search-input",children:"Search"}),c.jsx("input",{value:s,onChange:function(e){return u(e.target.value)},id:"fuzzy-search-input",name:"fuzzy-search-input",className:""+ty.input(null==f?void 0:f.search),placeholder:r,ref:a,"data-testid":"fuzzy-search-input"}),c.jsxs("span",{className:""+ty.iconWrapper,children:[s&&c.jsx(om,{onClear:function(){return p&&p()},className:""+ty.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"}),c.jsx(g.SearchIcon,{className:""+ty.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"})]})]})})})),ry=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})})},iy=function(e,t,n){return As(Q({transform:t?"translate3d(0, 0, 0)":void 0,position:"relative",height:"100%",width:null!=n?n:"100%"},e))},oy=n.forwardRef((function(e,t){var n,r,i=e.transform,o=void 0===i||i,a=Xd();return c.jsx("div",{role:null==e?void 0:e.role,"data-testid":null==e?void 0:e.testId,className:Hd(null==e?void 0:e.vizzlyPrefix,""+iy(Q({},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})})),ay=function(e,t,n){try{if(!Vr(t,e.attributes.dataSetId))throw new fn(t,e.attributes.dataSetId);var r=Br(e.attributes.type,{queryEngineConfig:n.queryEngineConfig}).validate(e.attributes,t);return r.length>0&&Te(r),r[0]}catch(e){if(e instanceof un)return e;if(e instanceof fn)return e;if(e instanceof pn)return e;throw e}},ly=Object.assign((function(){return null}),{label:function(e){return As({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 As({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight})},input:As({margin:0,padding:0,alignSelf:"flex-start",marginTop:2}),fieldset:function(e){return void 0===e&&(e=!1),As({border:"none",margin:0,padding:0,width:"auto",opacity:e?.6:1,cursor:e?"not-allowed":"pointer"})}});function sy(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:""+ly.fieldset(l),children:[!a&&c.jsx(vm,{as:"legend",children:o}),c.jsx(zf,{direction:s||"column",gap:"0.5rem","data-component":"radio-group",maxWidth:u||"100%",children:t.map((function(e,t){return c.jsx(uy,{option:e,name:n,onChange:function(e){return r&&!l&&r(e.target.value)},selected:i},t)}))})]})}function uy(e){return c.jsx(dy,Q({},e,{type:"radio"}))}function dy(e){var t,n,r=e.name,i=e.option,o=e.selected,a=e.onChange,l=e.type,s=Xd();return c.jsxs(zf,{as:"label",gap:"0.5rem",alignItems:"self-start","data-component":"input",cursor:"inherit",className:""+py,children:[c.jsx("input",{type:l,name:r,value:i.value,checked:JSON.stringify(o)===JSON.stringify(i.value),onChange:a,className:Hd("checkbox"===l?Jm()+" "+cy:""+ly.input)}),c.jsxs(zf,{direction:"column","data-component":"label",children:[c.jsx("p",{className:""+ly.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:""+ly.description(null==s||null==(n=s.radioGroup)?void 0:n.description),children:null==i?void 0:i.description})]})]})}var cy=As({marginRight:0,marginTop:1}),py=As({userSelect:"none"}),fy=function(e){return As({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}}})},my=As({display:"block",alignSelf:"flex-start"}),hy=Object.assign(fy,{svg:function(e){var t,n,r;return As({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:As({paddingTop:3,display:"block",height:"1rem",width:"1rem"}),content:function(e){var t,n;return As({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 As({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:my}),vy=function(e){var n,r,i=Xd();return c.jsxs("div",{role:"alert",className:""+hy(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:""+hy.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:""+hy.icon,children:c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+hy.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:""+hy.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:""+hy.content(null==i?void 0:i.alerts),children:[(null==e?void 0:e.title)&&c.jsx("div",{className:""+hy.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})]})]})},gy=function(e){var n=md(),r=n.maxCSVDownloadLimit,i=n.textOverride,o=n.featureToggles,a=t.useState(function(e){return e.canDownloadDataSet&&e.canDownloadViewData?"data-set-download-type":e.canDownloadViewData&&!e.canDownloadDataSet?"view-download-type":e.canDownloadDataSet&&!e.canDownloadViewData?"data-set-download-type":void 0}(o)),l=a[0],s=a[1],u=[];if(o.canDownloadDataSet){var d=r&&"number"==typeof r?i("full_data_set_desription","Download the underlying data that this view has used. Up to [[maxCSVDownloadLimit]] rows.",{maxCSVDownloadLimit:r.toLocaleString()}):"";u.push({label:i("full_data_set","Full data set"),value:"data-set-download-type",description:d})}return o.canDownloadViewData&&u.push({label:i("view_data_set","View data set"),value:"view-download-type",description:i("view_data_set_description","Download the data that you see in this view.")}),c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:i("data_download","Data download"),show:!0}),c.jsxs(kv.Content,{children:[u.length>1?c.jsx(sy,{options:u,name:"download-type",label:i("select_download_type","Select Download Type"),selected:l,labelHidden:!0,onChange:function(e){return s(e)}}):1===u.length&&c.jsx("p",{className:""+tu.my(0),children:u[0].description}),0===u.length&&c.jsx(vy,{children:i("data_download.not_enabled","Downloads for this view have not been made available")})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:i("cancel","Cancel")}),c.jsx(Ch,{primary:!0,onClick:function(){l&&e.onDownload(l),null==e||e.onClose(!0)},disabled:0===u.length,children:i("download","Download")})]})})]})},by=gd((function(e){var t=md().textOverride,n=e.onClose,r={editComponentsOnDashboard:t("edit_components_on_dashboard","Edit"),editComponentsOnLibrary:t("edit_components_on_library","Edit"),downloadComponentData:t("download","Download"),increaseColSpan:t("merge","Merge"),decreaseColSpan:t("unmerge","Unmerge"),removeComponentFromLibrary:t("remove_component_from_library","Remove"),removeComponentFromDashboard:t("remove_component_from_dashboard","Remove"),removeCellFromDashboard:t("remove_cell_from_dashboard","Remove"),manageReport:t("manage_reports","Reports"),parameters:t("add_parameters","Add Parameters"),localFilter:t("add_local_filters","Add Local Filters"),clickSettings:t("click_settings","Click Settings"),viewRawResults:t("view_raw_results","JSON Results"),viewRawAttributes:t("view_view_attributes","JSON Attributes")};return c.jsx(Af.Options,{children:c.jsx("div",{children:e.cellOptions.map((function(e,t){return c.jsxs(Af.Option,{"data-testid":e.testId,onChange:function(){e.onClick(),n()},children:[e.renderIcon&&e.renderIcon(),c.jsx("span",{children:r[e.purpose]||""})]},"option_"+t+"_"+e.purpose+e.testId)}))})})}),"renderComponentOptions"),xy={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},yy=function(e){var t=md().textOverride,n=If(),r=n.ref,i=n.open,o=n.position,a=n.show,l=n.close,s=Xd();return c.jsxs("div",{css:xy,ref:r,children:[c.jsx("button",{"data-testid":"open-component-options","aria-label":null!=e&&e.chartLabel?t("cell_options","Options")+": "+(null==e?void 0:e.chartLabel):t("cell_options","Options"),onClick:function(){i()},className:oh(null==s?void 0:s.dashboard)+" "+tu.button,"data-themeapi":"dashboard.icon",children:c.jsx(Dd,{})}),a&&c.jsx(Af,{onClose:function(){return l()},position:o,children:c.jsx(by,{onClose:function(){return i()},cellOptions:e.cellOptions})})]})},wy=function(e){var n,r=t.useState(!1),o=r[0],a=r[1],l=Rm().dashboard,s=(null==e?void 0:e.component.attributes).type,u=md(),d=Br(e.component.attributes.type),p=ay(e.component,l.dataSets,u),f=Vr(l.dataSets,e.component.attributes.dataSetId),m=[];return!e.canEditComponentsOnDashboard||p instanceof un||m.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Sy,{})},onClick:function(){return e.onEdit()},testId:"edit"}),e.canSetupReportSchedule&&"basicTable"==s&&m.push({purpose:"manageReport",renderIcon:function(){return c.jsx(wd,{})},onClick:function(){return e.onManageReport()},testId:"manage-report"}),"admin"!==u.mode||"basicTable"!=s&&"dataTable"!=s&&"barChart"!=s&&"horizontalBarChart"!=s||m.push({purpose:"clickSettings",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CogIcon,{})})},onClick:function(){return e.onClickSettings()},testId:"click-settings"}),e.canDownloadComponentData&&"custom"!=s&&m.push({purpose:"downloadComponentData",renderIcon:function(){return c.jsx(Ad,{})},onClick:function(){return a(!0)},testId:"download"}),u.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(yd,{active:!1})})},onClick:function(){return e.onAddFilter()},testId:"filterBy"}),!u.featureToggles.parameters||null==(n=d.supportedFeatures)||!n.parameters||"read_write"!==u.scope||null!=f&&f.preAggregated||m.push({purpose:"parameters",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(jd,{})})},onClick:function(){return e.onSetParameters()},testId:"parameters"}),e.canViewRawJSONResults&&m.push({purpose:"viewRawResults",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CodeIcon,{})})},onClick:function(){return e.onViewRawJSONResults()},testId:"view-raw-results"}),e.canViewRawViewAttributes&&m.push({purpose:"viewRawAttributes",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CodeIcon,{})})},onClick:function(){return e.onViewRawAttributes()},testId:"view-view-attributes"}),e.canRemoveComponentsFromDashboard&&m.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Cy,{})},onClick:function(){return e.onRemove()},testId:"remove"}),i.isEmpty(m)?null:c.jsxs(c.Fragment,{children:[c.jsx(yy,{cellOptions:m,chartLabel:null==e?void 0:e.chartLabel}),c.jsx(gy,{onDownload:e.onDownload,show:o,onClose:function(){return a(!1)}})]})},jy=function(e){var t=[];return md().featureToggles.canRemoveComponentsFromDashboard&&(t=[].concat(t,[{purpose:"removeCellFromDashboard",renderIcon:function(){return c.jsx(kd,{purpose:"removeCellFromDashboard"})},onClick:function(){return e.onRemoveCell()},testId:"deleteCell"}])),i.isEmpty(t)?null:c.jsx(yy,{chartLabel:e.chartLabel,cellOptions:t})},Cy=function(){return c.jsx(kd,{purpose:"removeComponentFromDashboard"})},Sy=function(){return c.jsx(_d,{})},Fy={group:void 0,measure:void 0},ky=function(e,t){if(!e.group&&!e.measure&&!t)return!0},_y=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};function Ty(e,t){var n=[],r=[],i=!1,o=!1;return e.forEach((function(e){var t={value:e.id,label:e.name,subText:e.description};e.preAggregated?(i=!0,r.push(t)):(o=!0,n.push(t))})),i&&o?(n.unshift({label:t("dataSets.data","Data"),title:!0,value:""}),r.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""})):i&&r.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""}),[].concat(n,r)}var Ay=function(e){var t=e.dataSets,n=e.setDataSet,r=md().textOverride;return c.jsxs(c.Fragment,{children:[t.length>1&&c.jsx(Fm,{children:c.jsx(Sm,{label:r("dataset","Dataset"),labelHidden:!0,id:"select-data-set",testId:"select-data-set",anchorLeft:!0,placeholder:r("dataset","Dataset"),onChange:n,selected:e.dataSet.id,options:Ty(t,r)})}),e.dataSet.preAggregated&&c.jsx(_f,{paddingX:0,paddingTop:16,children:c.jsx(vy,{icon:c.jsx(c.Fragment,{}),type:"info",children:r("pre-aggregated_data_set_description","Please note; this data set is pre-aggregated, therefore customization options on the data panel are limited.")})})]})},Dy=function(e,t,n,r){var i,o=[].concat(n);return o.splice(r,1),(i={})[e]=t(o),i},Iy=function(e,t,n){var r=[].concat(e),i=e[t];return r[t]=e[n],r[n]=i,r},Oy=function(e){var t=md(),n=t.textOverride,r=t.organizationName;return c.jsxs(kv,{width:"sm","data-testid":"cannot-delete-modal",isOpen:!0,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:n("field_protected","Field Protected"),show:!0}),c.jsx(kv.Content,{children:c.jsx("p",{children:r?n("cannot_delete_modal_content_with_org_name","This field has been protected by [[organizationName]] and cannot be removed.",{organizationName:r}):n("cannot_delete_modal_content_without_org_name","This field has been protected by the administrator and cannot be removed.")})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Dv,{children:c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:n("close","Close")})})})]})},Py=["barChart","dataTable","basicTable"],Ey=function(e,t){if(!t)return!1;if(!(e&&"type"in e&&e.type&&Py.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},My=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=Yr(d,e.field);return{title:t.publicName,icon:t.dataType}})),h=[].concat(Wr(d.fields,null!=(n=e.filterFieldOptions)?n:{onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})),v=Le(h,[].concat(f)),g=[].concat(v).map((function(e){return{title:e.publicName,icon:e.dataType,value:e.id}})),b=md();return c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:b.mode,testId:null!=(r=null==e?void 0:e.testId)?r:"add-dimension",onDeleteItem:e.dataSet.preAggregated?void 0:function(t){if(Ey(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=Iy([].concat(f),t,n);e.setPartialAttributes({dimension:r})}:void 0,newItem:{callToAction:null!=(o=null==e?void 0:e.label)?o:(0,b.textOverride)("add_comparison","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(Oy,{onClose:function(){return s(!1)}})]})},Ry=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=Yr(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]=Q({},n[t],{truncate:e}),a({timeDimensions:n})}(e,t)},options:Ly(l,i),selected:t.truncate}:void 0;r.push({title:Yr(o,t.field).publicName,icon:"date_time",value:t.field,select:u})})),r),d=Wr(o.fields,{onlyFieldTypes:["date_time"]}).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),p=!!l&&s.length===l,f=md();return c.jsx(xh,{mode:f.mode,testId:"time-dimension",onOrderChange:l?void 0:function(e,t){var n=Iy([].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:(0,f.textOverride)("add_time_dimension","Add time dimension"),onNew:function(e){var t=[].concat(s,[{field:e.id,truncate:Object.keys(St)[0]}]);a({timeDimensions:t})},initValues:d,hide:p},items:e.filterOptions?e.filterOptions(u):u})};function Ly(e,t){return e.filter((function(e){return t.hasOwnProperty(e.value)}))}var Ny=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=Yr(t,e.field),i={onChange:function(e,t){!function(e,t){!function(e,t,n){var r,i,o=[].concat(b);o[n]=Q({},o[n],((r={}).function=t,r)),m(((i={})[d]=p(o),i))}(0,e,t)}(e,t)},options:function(e,t){var n=Pe(e,t);return[].concat(n).map((function(e){return{value:e,label:t[e].publicName}}))}(r,n),selected:e.function};return{title:r.publicName,icon:r.dataType,value:e.field,select:Ht(r)||"none"===e.function?void 0:i}}))}(b,h,v),y=[].concat(Wr(h.fields,e.fieldFilterOptions)).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}})),w=md(),j=w.mode,C=w.textOverride,S=!1;return e.allowsMultiple||(S=!e.allowsMultiple&&!!g[d]),i.isArray(g[d])&&e.maxAllowed&&e.maxAllowed<=g[d].length&&(S=!0),e.dataSet.preAggregated&&(S=!0),c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:j,onOrderChange:e.allowsMultiple?function(e,t){var n,r=Iy([].concat(b),e,t);m(((n={})[d]=p(r),n))}:void 0,onDeleteItem:e.disableRemove||e.dataSet.preAggregated?void 0:function(e){Ey(f,b[e])?u(!0):m(Dy(d,p,b,e))},items:e.filterOptions?e.filterOptions(x):x,newItem:{callToAction:null!=(n=null==e?void 0:e.label)?n:C("add_metric","Add metric"),onNew:function(t){var n,r=null!=e&&e.onNewMeasureFilterAggregate?e.onNewMeasureFilterAggregate(t):e.supportedAggregates,i=Oe(t,r),o=[].concat(b,[{field:t.id,function:Ht(t)?t.denominatorAggregate:i}]);m(((n={})[d]=p(o),n))},initValues:y,hide:S},id:null==e?void 0:e.id,testId:null!=(r=null==e?void 0:e.testId)?r:"metric-input"}),s&&c.jsx(Oy,{onClose:function(){return u(!1)}})]})},zy=function(e){var n=e.attributes,r=e.setPartialAttributes,i=e.dataSet,o=t.useState(!1),a=o[0],l=o[1],s=md(),u=n.measure,d=[].concat(u).map((function(e){var t=Yr(i,e.field);return{title:t.publicName,icon:t.dataType}})),p=[].concat(Wr(i.fields,{removeAggregateMaths:!0,removePercentage:!0})).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}));return c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:s.mode,onOrderChange:function(e,t){var n=Iy([].concat(u),e,t);r({measure:n})},onDeleteItem:function(e){Ey(n,n.measure[e])?l(!0):r(Dy("measure",(function(e){return e}),u,e))},items:d,newItem:{callToAction:s.textOverride("add_field","Add field"),onNew:function(e){var t=[].concat(u,[{field:e.id,function:"none"}]);r({measure:t})},initValues:p}}),a&&c.jsx(Oy,{onClose:function(){return l(!1)}})]})},qy=function(e,t){return t?e+" ("+t+")":e},By=function(e){var t=e.attributes,n=e.setPartialAttributes,r=e.dataSet,i=md().textOverride,o=[].concat(t.order).map((function(e){var t={onChange:function(e,t){a(e,t)},options:[{label:i("asc","Asc"),value:"asc"},{label:i("desc","Desc"),value:"desc"}],selected:e.direction},n=Yr(r,e.field);return{title:qy(n.publicName,e.function&&"none"!=e.function&&le(e.function,i)),icon:n.dataType,select:t}})),a=function(e,r){var i=[].concat(t.order);i[r].direction=e,n({order:i})},l=md().mode,s=function(e,t,n,r,i,o){var a=[];if(a=a.concat([].concat(r||[]).flatMap((function(t){var n=Yr(e,t.field);return ze(n)?[]:[{title:n.publicName,icon:n.dataType,value:n,onSelected:function(e){i(e.id,t.function)}}]}))),t){var l=Yr(e,t.field);a.push({title:l.publicName,icon:l.dataType,value:l,onSelected:function(e){i(e.id,t.truncate)}})}return a.concat([].concat(n||[]).flatMap((function(t){var n=Yr(e,t.field);return ze(n)?[]:[{title:qy(n.publicName,At(t)&&le(t.function,o)),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})}),i);return c.jsx(xh,{mode:l,onOrderChange:function(e,r){var i=Iy([].concat(t.order),e,r);n({order:i})},onDeleteItem:function(e){var r=[].concat(t.order);r.splice(e,1),n({order:r})},items:o,newItem:{callToAction:i("add_sort","Add sort"),initValues:s},testId:"sort-input"})},Wy=function(e,t){return!(!e.field||!e.op||!t&&[void 0,NaN,""].includes(e.value))},Vy=function(e){var t;if(!e.field)return null;var n=md().textOverride,r=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),i=[].concat(Object.keys(r)).flatMap((function(t,n){return null!=e&&e.isAList||!["is_one_of","is_not_one_of"].includes(t)?[{label:r[t].publicName,value:t,testId:e.testId+"-pick-op-"+n}]:[]}));"allowedOperators"in e.field&&e.field.allowedOperators.includes("=")&&i.push({label:n("math_op_is_null","Is null"),value:"is_null",testId:"is-null"}),"allowedOperators"in e.field&&e.field.allowedOperators.includes("!=")&&i.push({label:n("math_op_is_not_null","Is not null"),value:"is_not_null",testId:"is-not-null"});var o=e.selected;return"!="==e.selected&&null===e.value?o="is_not_null":"="==e.selected&&null===e.value&&(o="is_null"),c.jsx(Sm,{label:n("operator","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:null!=(t=e.supportedQueryOperators)?t:i,selected:o,textOverride:n})},Hy=gd((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"),Yy=Object.assign((function(){return null}),{remove:function(e){return As(Q({"& svg":Q({},Ts,{fill:"#e5e7eb"})},e?{}:{"&:hover svg":Q({},Ts,{fill:"#de0938",cursor:"pointer"})}))},complete:function(e){return As(Q({},e?{}:{"& svg":Q({},Ts,{fill:"rgb(229, 231, 235)"})}))}}),Uy=function(e,t,n,r,i,o){var a=Br(t,{queryEngineConfig:r}),l=n.preAggregated&&a.setDataAttributesFromPreAggregatedDataSet?a.setDataAttributesFromPreAggregatedDataSet(a.init(n.id),n):a.autoGenerate(n);if(o)try{var s=function(e,t,n,r){var i={},o=Gy.includes("measure")?"measure":null;return Gy.forEach((function(a){if(a in e&&a in t){var l=e[a];if(a!==o||!Array.isArray(l))return void(i[a]=l);i[o]=l.map((function(e){if(At(e))return e;var t=Yr(n,e.field);return Q({},e,{function:We(r,t.dataType)[0]})}))}})),i}(o.attributes,l,n,r);ke("Swapping component type");var u=a.setAttributes(l,Q({type:t},s));return i(u,n,"initial"),vi(u)}catch(e){ke("Component properties are not compatible with new type",e)}var d=i(l,n,"initial");return vi(a.setAttributes(l,d))},Gy=["measure","order","timeDimension","dimension","filter","displayTitle","displaySubject","limit"],Ky=function(){var e,n,r=md(),i=r.onlyViewTypes,o=r.queryEngineConfig,a=r.textOverride;t.useState(null);var l=Rm(),s=l.dashboard,u=l.componentEditor,d=l.runQueriesCallback,c=l.dispatch,p=l.trackEvent,f=md(),m=f.featureToggles,h=f.numberFormatOptions,v=f.mode,g=f.dataPanel,b=f.formatPanel,x=f.onEditorUpdate,y=(null==u?void 0:u.component)||null;if(t.useEffect((function(){var e=function(){var e=X(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Uy(0,i(s.dataSets[0])[0],s.dataSets[0],o,x);case 2:t=e.sent,u&&c(Q({type:"startEditingComponent",component:t},u.target));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();y||e()}),[]),!y)return null;var w=Br(y.attributes.type,{queryEngineConfig:o}),j=Vr(s.dataSets,y.attributes.dataSetId);if(!j)return null;var C=null!=u&&null!=(e=u.target)&&e.libraryIndex||0===(null==u||null==(n=u.target)?void 0:n.libraryIndex)?"library":"dashboard",S=function(e){if(y&&w){var t,n=x(e,j,"edit");e.type!==y.attributes.type&&(w=Br(e.type,{queryEngineConfig:o}));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=Q({},y,{attributes:t});c({type:"updateEditorComponent",component:r})}};return{setLocalFilters:function(e){c({type:"updateEditorComponent",component:Q({},y,{localFilters:e})})},setParameterUpdate:function(e){var t=Dm(y,e);c({type:"updateEditorComponent",component:Q({},t)})},queryEngineConfig:o,selectedComponent:y.attributes.type,onSelectViewType:function(e){var t=Uy(0,e,j,o,x,y);c({type:"updateEditorComponent",component:t})},dataPanel:g,formatPanel:b,setDataSet:function(){var e=X(G().mark((function e(t){var n,r,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u&&u.component&&t)){e.next=10;break}if(n=Gr(s.dataSets,t),!(r=n[0])){e.next=10;break}return(a=i(r)).includes(l=u.component.attributes.type)||(l=a[0]),e.next=8,Uy(0,l,r,o,x);case 8:c({type:"updateEditorComponent",component:e.sent});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),featureToggles:m,dashboard:s,setDataSets:function(e){c({type:"setDataSets",dataSets:e})},dataSet:j,viewOptions:i,numberFormatOptions:h,setAttributes:S,setPartialAttributes:function(e){w&&S(w.setAttributes(y.attributes,e))},setResults:function(e){c({type:"setResultsForComponentInEditor",results:e})},mode:v,origin:C,componentEditor:u,component:y,trackEvent:p,runQueriesCallback:d,dispatch:c,textOverride:a}},Xy=Ds(85),Qy=function(e){return c.jsx("div",{"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:c.jsxs(zf,{direction:"column",gap:"0.25rem",children:[c.jsxs(zf,{justifyContent:"space-between",alignItems:"end",children:[c.jsx("span",{className:""+tu.textSize("sm"),children:e.showTitle?e.title:""}),e.showValue&&c.jsx(_f,{as:"p",margin:0,children:null==e?void 0:e.displayValueNow})]}),c.jsx("div",{className:""+Jy,"data-percentage":e.percentage,children:c.jsx("div",{className:""+Zy(e.color,e.percentage)})})]})})},Jy=As({height:10,backgroundColor:Xy,borderRadius:"9999px",position:"relative",overflow:"hidden",width:"100%"}),Zy=function(e,t){var n=Math.max(0,Math.min(100,t));return As({height:"100%",width:n+"%",backgroundColor:"string"==typeof e?e:null==e?void 0:e[0],borderRadius:"inherit",transition:"width 0.3s ease"})},$y=function(e){var t,n,r,i,o=null!=(t=e.radius)?t:120,a=null!=(n=e.stroke)?n:15,l=o-2*a,s=2*l*Math.PI,u=s-e.percentage/100*s,d="gradient-"+Math.random().toString(36).substr(2,9);return c.jsxs(zf,{direction:"column",alignItems:"center",children:[c.jsxs("div",{style:{position:"relative"},"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:[c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:1.25*o,height:1.25*o,viewBox:"0 0 "+2*o+" "+2*o,children:[c.jsx("defs",{children:c.jsx("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:(i=e.color,Array.isArray(i)?i.map((function(e,t,n){return c.jsx("stop",{offset:t/(n.length-1)*100+"%",stopColor:e},t)})):[c.jsx("stop",{offset:"0%",stopColor:i},"0"),c.jsx("stop",{offset:"100%",stopColor:i},"1")])})}),c.jsx("circle",{stroke:Xy,fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,r:l,cx:o,cy:o}),c.jsx("circle",{stroke:"url(#"+d+")",fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,style:{strokeDashoffset:u},r:l,cx:o,cy:o,transform:"rotate(-90 "+o+" "+o+")",strokeLinecap:"round"})]}),e.showValue&&c.jsx("p",{className:""+ew,children:null!=(r=null==e?void 0:e.displayValueNow)?r:e.percentage+"%"})]}),e.showTitle&&c.jsx("div",{className:tu.textSize("sm")+" "+tw,children:e.title})]})},ew=As({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",margin:0}),tw=As({textAlign:"center",height:20}),nw=function(e){var t=Number(Ql(e.valueNow,e.valueMax).toFixed(2));return c.jsx(e.type===wr.Circular?$y:Qy,Q({},e,{percentage:t}))},rw=Object.assign(nw,{View:nw,Circular:$y,Linear:Qy}),iw={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))"},ow=function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))},aw={areaChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))}(e)},barChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{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"})}))}(e)},horizontalBarChart:function(e){return function(e){return c.jsx("svg",Q({css:iw,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{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"})}))}(e)},lineChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))}(e)},pieChart:function(e){return function(e){return c.jsxs("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},e,{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"})]}))}(e)},scatterChart:function(e){return function(e){return c.jsxs("svg",Q({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"}})]}))}(e)},singleStat:function(e){return function(e){return c.jsx("svg",Q({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"})}))}(e)},dataTable:function(e){return ow(e)},basicTable:function(e){return ow(e)},comboChart:function(e){return function(e){return c.jsx("svg",Q({},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"})]})}))}(e)},mercatorMap:function(e){return function(e){return c.jsx("svg",Q({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"},e,{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"})}))}(e)},progress:function(e){return c.jsx(rw,{valueMax:100,valueNow:64,type:wr.Circular,title:"Progress type",color:(null==(t=e)?void 0:t.color)||"#2d2f31",radius:19,stroke:5});var t},custom:function(e){return c.jsx(c.Fragment,{})}},lw=function(){var e=md(),t=e.textOverride,n=e.queryEngineConfig,r=Ky();if(!r)return null;var i=[].concat(r.viewOptions(r.dataSet)).flatMap((function(e){var i=Br(e,{textOverride:t,queryEngineConfig:n});return!i.setDataAttributesFromPreAggregatedDataSet&&r.dataSet.preAggregated?[]:[{value:e,label:i.title,icon:aw[e]()}]}));return c.jsx(Fm,{children:c.jsx(Sm,{label:t("view","View"),labelHidden:!0,id:"select-view",testId:"select-view",anchorLeft:!0,onChange:function(e){return r.onSelectViewType(e)},selected:r.component.attributes.type,renderOption:function(e){return c.jsx(sw,Q({},e,{option:"option"}))},renderSelected:function(e){return c.jsx(sw,Q({},e,{option:"view"}))},options:i})})},sw=function(e){return c.jsxs(zf,{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(Uf,{flexPaddingTop:"0",paddingTop:"0",icon:null==e?void 0:e.icon,iconWidth:"horizontalBarChart"===e.value[0]||"barChart"===e.value[0]?"66%":void 0,alignSelf:"center"}),c.jsx(_f,{as:"span",marginY:"0.15rem",children:null==e?void 0:e.label})]})},uw=function(e,t){return("!="==e||"="==e)&&null===t},dw={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"},cw={name:"1jjvu4g",styles:"margin-left:0.5rem;width:1.75rem;flex:none;text-align:right"},pw={name:"xioa8z",styles:"width:1.75rem;flex:none;text-align:right"},fw=function(e){var n,r,i=e.textOverride,o=e.filter,a=o.field,l=o.op,s=o.value,u=Wy(e.filter),d=function(t){e.onChange(Q({},e.filter,t))},p=(r=[],Wr(e.dataSet.fields,{removeAggregateMaths:!0,removePercentage:!0}).forEach((function(t,n){r.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n,icon:c.jsx(Uf,{icon:t.dataType,paddingTop:0})})})),r);return c.jsxs("div",{css:["display:flex;",u&&{"--tw-border-opacity":"1",borderColor:"rgb(74 222 128 / var(--tw-border-opacity))"},"",""],children:[c.jsxs("div",{css:dw,children:[c.jsx("div",{children:c.jsx(Sm,{label:i("field","Field"),id:e.testId+"-pick-field",labelHidden:!0,testId:e.testId+"-pick-field",onChange:function(t,n){var r=void 0;"number"==typeof n&&null!=e&&e.overrideFieldOptions&&(r=null==e?void 0:e.overrideFieldOptions[n].function),d({value:void 0,op:void 0,field:t,function:r})},options:null!=(n=null==e?void 0:e.overrideFieldOptions)?n:p,selected:a,renderSelected:a?function(e){return c.jsx(sw,Q({},e,{option:"inline"}))}:void 0,controlClassName:""+tu.pl("0.5rem"),textOverride:i})}),c.jsx("div",{css:[a?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:c.jsx(Vy,{queryEngineConfig:e.queryEngineConfig,onChange:function(e){return d(Q({},e))},field:a,testId:e.testId,selected:l,value:s,id:"percentage-operator-"+(null==e?void 0:e.rowIndex),isAList:a&&"string"==a.dataType,supportedQueryOperators:e.supportedQueryOperators})}),c.jsx("div",{css:[l?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:!uw(l,s)&&c.jsxs(c.Fragment,{children:[a&&"number"==a.dataType&&c.jsx(jm,{id:e.testId+"-value",label:i("value","Value"),labelHidden:!0,"data-testid":e.testId+"-value",type:"number",onChange:function(e){var t=parseFloat(e.target.value);d({value:t})},defaultValue:s}),a&&("string"==a.dataType||"string[]"==a.dataType)&&c.jsx(t.Fragment,{children:"="===l||"!="===l||"array_contains"===l||"is_one_of"===l||"is_not_one_of"===l?c.jsx(mw,{onChange:function(e){return d({value:e})},testId:e.testId+"-value",value:s,dataSet:e.dataSet,field:a,multiple:"is_one_of"===l||"is_not_one_of"===l||"array_contains"===l,filter:e.filter}):c.jsx(jm,{label:i("value","Value"),labelHidden:!0,id:e.testId+"-value","data-testid":e.testId+"-value",type:"text",onChange:function(e){d({value:e.target.value})},defaultValue:s})}),a&&"boolean"==a.dataType&&c.jsx(Sm,{label:i("value","Value"),labelHidden:!0,id:e.testId+"-value",selected:s,onChange:function(e){return d({value:e})},options:[{label:"True",value:!0},{label:"False",value:!1}],textOverride:i}),a&&"date_time"==a.dataType&&c.jsx(Hy,{value:s?Ul(new Date(s),"YYYY-MM-DD[T]HH:mm:ss"):void 0,onChange:function(e){var t=e?e.toISOString():null;d({value:t})},testId:""+e.testId})]})||c.jsx("p",{children:"-"})})]}),c.jsx("div",{css:cw,className:""+Yy.complete(u),children:c.jsx(Fd,{})}),!e.hideRemove&&c.jsx("div",{css:pw,children:c.jsx("button",{onClick:function(){return e.onDelete()},className:Hd(""+Yy.remove(!(null==e||!e.removeDisabled)),""+tu.button),"aria-label":i("remove_filter","Remove filter: [[filterNumber]]",{filterNumber:e.rowIndex+1}),disabled:null==e?void 0:e.removeDisabled,children:c.jsx(kd,{purpose:"removeFilter"})})})]})},mw=function(e){var n,r=e.value,i=function(e,n){var r,i=Rm().runQueriesCallback,o=t.useState(void 0),a=o[0],l=o[1],s=Yr(e,n);return r="string[]"==s.dataType?[on(e.id,s).query]:[an(e,n)],Vb(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=md().textOverride,a=(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(Gv,{label:o("values","Values"),id:"select-multiple-value",labelHidden:!0,setSelected:function(t){return null==e?void 0:e.onChange(t.map((function(e){return a[e].value})))},selected:(n=[],a.forEach((function(e,t){null!=r&&r.includes(e.value)&&n.push(t)})),n),options:a,textOverride:o}):c.jsx(Sm,{testId:null==e?void 0:e.testId,label:o("value","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:a,textOverride:o,hasFreeText:!0})},hw={name:"1v017vf",styles:"margin-top:1.5rem;margin-bottom:1.5rem;text-align:left"},vw={name:"151yjvf",styles:"margin-bottom:0.5rem;font-weight:500;text-transform:uppercase;letter-spacing:0.1em"},gw={name:"zjik7",styles:"display:flex"},bw={name:"1sul1dv",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem"},xw={name:"1x4tmz9",styles:"width:3.5rem;flex:none"},yw={name:"1gok8e8",styles:"margin-bottom:0.5rem"},ww=function(e){var t=e.textOverride;return c.jsx(c.Fragment,{children:e.wipFilters.map((function(n,r){var i=null!=e&&e.maxOrFilters?Math.min(null==e?void 0:e.maxOrFilters,n.length):n.length;return c.jsxs("div",{children:[0!=r&&c.jsx("div",{css:hw,children:c.jsx("span",{css:vw,children:t("filter_or","or")})}),c.jsxs("div",{children:[!e.removeHeadings&&c.jsxs("div",{css:gw,children:[c.jsxs("div",{css:bw,children:[c.jsx("div",{children:c.jsx(vm,{as:"span",children:e.fieldHeadingOverride||t("field","Field")})}),c.jsx("div",{children:c.jsx(vm,{as:"span",children:t("operator","Operator")})}),c.jsx("div",{children:c.jsx(vm,{as:"span",children:t("value","Value")})})]}),c.jsx("div",{css:xw})]}),n.slice(0,i).map((function(i,o){return c.jsx("div",{css:yw,children:c.jsx(fw,{queryEngineConfig:e.queryEngineConfig,testId:"filter-"+r+"-"+o,filter:i,dataSet:e.dataSet,onChange:function(t){e.updateWipFilter(t,r,o)},onDelete:function(){e.deleteWipFilter(r,o)},rowIndex:o,removeDisabled:void 0!==e.removeLastEnabled?!e.removeLastEnabled:n.length<=1||n.length===o+1,overrideFieldOptions:null==e?void 0:e.overrideFieldOptions,hideRemove:1===e.maxOrFilters,textOverride:t,supportedQueryOperators:e.supportedQueryOperators})},"filter_"+r+"_"+o)}))]})]},"filter_"+r)}))})},jw=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"span",i=Xd();return c.jsx(r,{className:""+Wf.title(null==i||null==(n=i.lists)?void 0:n.title),"data-themeapi":"list.title",children:null==e?void 0:e.children})},Cw=Object.assign((function(){return null}),{wrapper:As({position:"relative","&:hover .help-icon":{opacity:1}}),fadeIn:function(e){return As(Q({opacity:0,maxWidth:18,color:e},Ts))}}),Sw=function(e){var t,n=Xd();return c.jsx(jw,{as:"legend",children:c.jsxs(zf,{gap:"0.25rem",alignItems:"center",children:[null==e?void 0:e.title,(null==e?void 0:e.tooltip)&&c.jsx(_f,{width:"18px",children:c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:null==e?void 0:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+Cw.fadeIn(null==n||null==(t=n.dashboard)||null==(t=t.icon)?void 0:t.color)})})})]})})},Fw=Object.assign((function(e){return c.jsxs("fieldset",{className:Hd(""+Cw.wrapper,""+tu.bw(0),""+tu.m(0),""+tu.p(0)),children:[(null==e?void 0:e.title)&&c.jsx(Sw,Q({},e)),c.jsx(_f,{marginTop:"0.25rem",children:e.children})]})}),{Grid:function(e){return c.jsx(Ud,{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,n,r=Xd();return c.jsx(_f,{as:null!=(t=null==e?void 0:e.as)?t:"fieldset","data-component":"list-panel",children:c.jsxs(Zm,{padding:!0,children:[(null==e?void 0:e.title)&&c.jsx(_f,{"data-component":"section-panel",children:c.jsx(vm,{as:"legend",classNameOverride:""+mm(null==r||null==(n=r.lists)?void 0:n.subTitle),children:null==e?void 0:e.title})}),c.jsx(Ud,{gap:"0.5rem",children:null==e?void 0:e.children})]})})},Container:function(e){return c.jsx(zf,{direction:"column",gap:"0.75rem","data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Title:Sw});function kw(e,t,n,r){return Q({},e,r&&!!(i=n[t])&&i.validDataTypes.includes(e.dataType)&&function(e,t){return"string"==typeof e&&t.hasOwnProperty(e)}(t,n)&&{dataType:"number",allowedOperators:[">","<","=","!=",">=","<=","is_one_of","is_not_one_of"]});var i}function _w(e,t,n,r){return[].concat(e).map((function(e){return[].concat(e).map((function(e){var i;return Q({},e,{field:kw(Yr(t,e.field),null!=(i=e.function)?i:"none",n,r)})}))}))}function Tw(e,t){return[].concat(e).map((function(e){return[].concat(e).flatMap((function(e){var n;return Wy(e,1===t.maxFilters)?[{op:e.op,value:e.value,field:null==(n=e.field)?void 0:n.id,function:e.function}]:[]}))})).filter((function(e){return!i.isEmpty(e)}))}var Aw=function(e,r,o,a){var l;void 0===a&&(a={startWithEmptyField:!1,maxFilters:void 0,enableChangeToNumber:!1});var s=_w(e,r,o,a.enableChangeToNumber),u=n.useState(s),d=u[0],c=u[1];t.useEffect((function(){c(_w(e,r,o,a.enableChangeToNumber))}),[JSON.stringify(e)]);var p={field:null!=(l=a)&&l.startWithEmptyField?void 0:r.fields[0],op:void 0,value:void 0};i.isEmpty(d)&&(d=[[p]]);var f=[].concat(d).map((function(e){var t=e[e.length-1];return t&&Wy(t)?[].concat(e,[p]):[].concat(e)}));return{addOrFilter:function(){var e=[].concat(d);e.push([p]),c(e)},deleteWipFilter:function(e,t){var n=d;return n[e].splice(t,1),i.isEmpty(n[e])&&n.splice(e,1),c([].concat(n)),Tw(d,a)},updateWipFilter:function(e,t,n){var r=d;r[t][n]=e,c([].concat(r))},completedFilters:Tw(d,a),wipFilters:f}},Dw={publicName:"",numerator:null,numeratorFilter:!1,denominatorFilter:!1,denominator:null,denominatorScope:"all"},Iw=function(e,t){return!(e.denominator&&e.publicName&&(t[0]&&t[0].length>0||e.numerator))};function Ow(e,t){return{math:{title:t("custom_metric_title.math","Math"),subtext:t("custom_metric_description.math","Calculate from multiple values")},"rules-based_groups":{title:t("custom_metric_title.rules_based_groups","Rules-based Groups"),subtext:t("custom_metric_description.rules_based_group","Create groups based on conditions")},percentage:{title:t("custom_metric_title.percentage","Percentage"),subtext:t("custom_metric_description.percentage","Calculate a percentage in a field")},number_formatting:{title:t("custom_metric_title.number_formatting","Rounded Number"),subtext:t("custom_metric_description.number_formatting","Round a number field")}}[e]}function Pw(e,t){return t("custom_metric_modal_title","[[custom_metric_title]] Custom Metric",{custom_metric_title:Ow(e,t).title})}var Ew={publicName:"",mathType:"simple",left:void 0,right:void 0,rightFieldId:void 0,leftFieldId:void 0,operator:void 0},Mw=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}},Rw=function(e){var t,n,r,i,o=void 0,a=void 0,l=void 0;return e&&(Nw(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}),zw(e)&&(o=e.field,a=e.function)),{fieldId:o,function:a,nested:l}};function Lw(e){return{field:e.fieldId,function:e.function}}var Nw=function(e){return"left"in e||"operator"in e||"right"in e},zw=function(e){return"field"in e&&"function"in e};function qw(e,t){var n={};return n[t]=e&&Nw(e)?e.left:{operator:"+",left:null!=e?e:void 0},n}var Bw=function(e){var t=e.state,n=e.onClick,r=md().textOverride,i=r("agg_maths_add_remove_button","[[add|remove]] nested calculation",{add:"add"===t?r("add","Add"):"",remove:"remove"===t?r("remove","Remove"):""});return c.jsx(ih,{tooltipContent:function(){return i},classNameTrigger:""+Yw,children:c.jsxs(Fh,{secondary:!0,onClick:n,children:[c.jsx("span",{className:""+eu,children:i}),c.jsx("remove"===t?v.MinusSmIcon:v.PlusSmIcon,{width:16})]})})},Ww=function(e){var n=e.left,r=e.right,i=e.operator,o=e.dataSet,a=md().textOverride,l=Mw({mathType:"aggregate",left:n,right:r,operator:i,publicName:""});return c.jsx("code",{className:""+Uw,children:l?c.jsx(t.Fragment,{children:a("metrics_operators_need_defined","Metrics and operator need to be defined")}):c.jsxs(t.Fragment,{children:[n&&c.jsx(_f,{flex:1,as:"span","data-component":"calculation-left",textAlign:"right",children:c.jsx(Hw,{side:n,dataSet:o})}),c.jsx(_f,{as:"strong",width:8,"data-component":"calculation-operator",className:""+tu.bold,children:i}),r&&c.jsx(_f,{flex:1,as:"span","data-component":"calculation-right",children:c.jsx(Hw,{side:r,dataSet:o})})]})})},Vw=function(e){return c.jsx("code",{className:""+Uw,children:e.children})},Hw=function(e){var n,r,i,o,a,l,s=e.side,u=e.dataSet;return c.jsx(t.Fragment,{children:s&&Nw(s)?c.jsxs("span",{children:[c.jsx("span",{className:""+tu.bold,children:"("}),(null==(n=s.left)?void 0:n.field)&&Yr(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)&&Yr(u,null==(a=s.right)?void 0:a.field).publicName," (",null==(l=s.right)?void 0:l.function,")",c.jsx("span",{className:""+tu.bold,children:")"})]}):c.jsxs("span",{children:[s&&Yr(u,s.field).publicName," ",(null==s?void 0:s.function)&&c.jsxs(t.Fragment,{children:["(",null==s?void 0:s.function,")"]})]})})},Yw=As({display:"block"}),Uw=As({backgroundColor:Ds(80),color:Ds(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11}),Gw=function(e){var n=e.dataSet,r=md(),i=r.textOverride,o=r.queryEngineConfig,a=function(e,n,r,i){var o=!!n,a=t.useState(Dw),l=a[0],s=a[1],u=Aw(n&&"numeratorFilter"in n&&n.numeratorFilter?n.numeratorFilter:[],r,e.supportedAggregates),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter,m=Aw(n&&"denominatorFilter"in n&&n.denominatorFilter?n.denominatorFilter:[],r,e.supportedAggregates),h=m.completedFilters,v=m.wipFilters,g=m.deleteWipFilter,b=m.updateWipFilter;return t.useEffect((function(){s(n?{publicName:n.publicName,numeratorFilter:!(!n||!("numeratorFilter"in n)),denominatorFilter:!(!n||!("denominatorFilter"in n)),numerator:n.numeratorFieldId&&n.numeratorAggregate?{function:n.numeratorAggregate,field:n.numeratorFieldId}:null,denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId},denominatorScope:n.denominatorScope}:Dw)}),[JSON.stringify(n)]),{onChange:function(e){s(Q({},l,e))},denominatorScope:l.denominatorScope,fieldPublicName:l.publicName,denominatorMeasure:l.denominator,numeratorMeasure:l.numerator,completedNumeratorFilter:d,wipNumeratorFilters:c,deleteWipNumeratorFilter:p,updateWipNumeratorFilter:f,completedDenominatorFilter:h,wipDenominatorFilters:v,deleteWipDenominatorFilter:g,updateWipDenominatorFilter:b,isEditing:o,handleUpsertPercentageField:function(){if(l.denominator&&l.publicName){var t=function(e,t,n,r,i,o,a,l,s){return{version:2,id:qt(),publicName:e,numeratorFilter:null!=o?o:[],denominatorFieldId:t,numeratorFieldId:null!=r?r:null,numeratorAggregate:null!=i?i:null,denominatorAggregate:n,denominatorFilter:null!=a?a:[],canBeDimension:!1,canBeMeasure:!0,dataType:"number",denominatorScope:s||"all",allowedOperators:ae({dataType:"number"},l)}}(l.publicName,l.denominator.field,l.denominator.function,l.numerator?l.numerator.field:null,l.numerator?l.numerator.function:null,d,h,e,l.denominatorScope);i(Q({},t,{id:o?n.id:t.id}))}},numeratorFilter:l.numeratorFilter,denominatorFilter:l.denominatorFilter,saveDisabled:Iw(l,d)}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),l=a.onChange,s=a.numeratorFilter,u=a.denominatorFilter,d=a.denominatorScope,p={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removePercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0};return c.jsxs(kv,{width:"4xl",isOpen:e.isOpen,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("percentage",i)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{id:"percentage-name",placeholder:i("metric_name","Metric name"),label:i("metric_name","Metric name"),value:a.fieldPublicName,onChange:function(e){return l({publicName:e.target.value})}})}),c.jsxs(Ud,{gap:"1rem",children:[c.jsxs(Fw.Panel,{children:[c.jsxs(Ov,{as:"fieldset",marginBottom:s?void 0:0,children:[c.jsx(vm,{as:"legend",children:i("numerator","Numerator")}),c.jsx(Ny,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({numerator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.numeratorMeasure?[a.numeratorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:p})]}),s&&c.jsxs(Ov,{as:"fieldset",marginBottom:0,children:[c.jsx(vm,{as:"legend",children:i("Filters","Filters")}),c.jsx(ww,{fieldHeadingOverride:i("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedNumeratorFilter,wipFilters:a.wipNumeratorFilters,updateWipFilter:function(e,t,n){a.updateWipNumeratorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipNumeratorFilter(e,t).length&&l({numeratorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:i})]}),!1===s&&c.jsx(Qw,{onChange:function(){l({numeratorFilter:!0})}})]}),c.jsxs(Fw.Panel,{children:[c.jsxs(Ov,{as:"fieldset",marginBottom:u?void 0:0,children:[c.jsx(vm,{as:"legend",children:i("denominator","Denominator")}),c.jsx(Ny,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({denominator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.denominatorMeasure?[a.denominatorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:p})]}),u&&c.jsxs(Ov,{as:"fieldset",marginBottom:0,children:[c.jsx(vm,{as:"legend",children:i("Filters","Filters")}),c.jsx(ww,{fieldHeadingOverride:i("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedDenominatorFilter,wipFilters:a.wipDenominatorFilters,updateWipFilter:function(e,t,n){a.updateWipDenominatorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipDenominatorFilter(e,t).length&&l({denominatorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:i})]}),!1===u&&c.jsx(Qw,{onChange:function(){l({denominatorFilter:!0})}}),c.jsx(Xm,{testId:"percentage-advanced-options",showAccordionIcon:!0,title:i("advanced_options","Advanced Options"),children:c.jsx(Ov,{as:"fieldset",children:c.jsx(_f,{marginY:5,children:c.jsx(sy,{options:[{value:"all",label:i("denominator_scope_all_title","Across all groups"),description:i("denominator_scope_all_description","Denominator is calculated using all your data")},{value:"withinGrouping",label:i("denominator_scope_all_title","Within each group"),description:i("denominator_scope_within_group_description","Denominator is calculated using the data within each grouping")}],name:"start-check",label:i("denominator_scope_title","Scope"),selected:d||"all",direction:"row",onChange:function(e){return l({denominatorScope:e})}})})})})]})]}),c.jsx(_f,{marginTop:20,children:c.jsx(Vw,{children:c.jsxs(Ud,{justifyContent:"center",children:[c.jsx(Kw,Q({},a,{position:"numerator",dataSet:n,supportedAggregates:o.supportedAggregates})),c.jsx(_f,{children:c.jsx(_f,{as:"hr",border:"1px solid "+Ds(15),height:1})}),c.jsx(Kw,Q({},a,{position:"denominator",dataSet:n,supportedAggregates:o.supportedAggregates}))]})})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:i("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return a.handleUpsertPercentageField()},disabled:a.saveDisabled,children:a.isEditing?i("update","Update"):i("create","Create")})]})})]})},Kw=function(e){var t,n,r,i=e.numeratorMeasure,o=e.denominatorMeasure,a=e.position,l=e.dataSet,s=e.supportedAggregates,u=e.completedDenominatorFilter,d=e.completedNumeratorFilter,p=md().textOverride,f="",m="",h=[],v="numerator"===a&&$t(d)&&d[0].length>0;return o||"denominator"!==a?"numerator"!==a||v||i?("numerator"===a&&!i&&o&&(f=null==(t=s[o.function])?void 0:t.publicName,m=Yr(l,o.field).publicName,$t(u)&&u[0].length>0&&u[0].map(Xw(l,h))),"numerator"===a&&i&&(f=null==(n=s[i.function])?void 0:n.publicName,m=Yr(l,i.field).publicName),"denominator"===a&&o&&(f=null==(r=s[o.function])?void 0:r.publicName,m=Yr(l,o.field).publicName),v&&d[0].map(Xw(l,h)),"denominator"===a&&$t(u)&&u[0].length>0&&u[0].map(Xw(l,h)),c.jsxs(_f,{textAlign:"center",children:[f,"(",m,h.length?" | "+h.join(", "):"",")"]})):c.jsx(_f,{textAlign:"center",children:p("percentage_modal.numerator_required","Numerator required")}):c.jsx(_f,{textAlign:"center",children:p("percentage_modal.denominator_required","Denominator required")})};function Xw(e,t){return function(n){var r=Yr(e,n.field);t.push(r.publicName+" "+n.op+" “"+n.value+"“")}}var Qw=function(e){var t=md();return c.jsx(zf,{justifyContent:"space-between",children:c.jsx(Fh,{secondary:!0,onClick:function(){return e.onChange()},children:(0,t.textOverride)("add_filter_by","+ Filter by")})})},Jw=function(e){var t,n=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:n("are_you_sure","Are you sure?"),show:!0}),c.jsx(kv.Content,{children:c.jsx(_f,{paddingY:8,children:e.message})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{testId:"modal-cancel-delete-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:n("cancel","Cancel")}),c.jsx(Ch,{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:null!=(t=e.deleteButtonLabel)?t:n("delete","Delete")})]})})]})};function Zw(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(Sm,{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 $w=function(e){var t,n=md().textOverride,r=[{label:n("add","Add"),value:"+",testId:"simple-math-operator-add"},{label:n("subtract","Subtract"),value:"-"},{label:n("multiply","Multiply"),value:"*"},{label:n("divide","Divide"),value:"/"}];return c.jsx(Sm,{placeholder:n("select_operator","Operator..."),id:null!=(t=null==e?void 0:e.id)?t:"simple-math-operator",label:n("operator","Operator"),labelHidden:!0,onChange:function(t){null==e||e.onChange(t)},options:r,selected:e.mathOperator})},ej=function(e){var n=md().textOverride,r=function(e,n,r){var i=!!n,o=t.useState(Ew),a=o[0],l=o[1],s=function(){l(Ew)};return t.useEffect((function(){if(n)if(Vt(n)){var e=function(e){var t=e.rightFieldId,n=e.rightFunction,r=e.leftNested,i=e.rightNested,o=Lw({fieldId:e.leftFieldId,function:e.leftFunction}),a=Lw({fieldId:t,function:n});return r&&(o={left:o,operator:r.operator,right:Lw({fieldId:r.fieldId,function:r.function})}),i&&(a={left:a,operator:i.operator,right:Lw({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 Bt(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)]),Q({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:qt(),publicName:e,rightFieldId:r,operator:n,leftFieldId:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:ae({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(Q({},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=Rw(e.left),r=n.fieldId,i=n.function,o=n.nested,a=Rw(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:qt(),publicName:e,rightFieldId:i,rightFunction:o,operator:r,leftFieldId:t,leftFunction:n,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:ae({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(Q({},l,{id:i?n.id:l.id}))}},onChange:function(e){l(void 0!==e.mathType&&e.mathType!==a.mathType?Q({},a,e,{left:void 0,leftFieldId:void 0,right:void 0,rightFieldId:void 0}):Q({},a,e))},isEditing:!!n,disabled:Mw(a)})}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),i=r.leftFieldId,o=r.rightFieldId,a=r.operator,l=r.publicName,s=r.handleUpsertMathField,u=r.onChange,d=r.isEditing,p=r.mathType,f=r.right,m=r.left,h=r.disabled,v=r.reset,g={onlyFieldTypes:["number"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},b=Wr(e.dataSet.fields,g),x=function(e){var t=[],n=Br(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),y=function(t){return t?Yr(e.dataSet,t):void 0};return t.useEffect((function(){null!=e&&e.open&&!e.initialValue&&v()}),[null==e?void 0:e.open]),c.jsxs(kv,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("math",n)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{label:n("metric_name","Metric name"),id:"metric-name",placeholder:n("metric_name","Metric name"),value:l,onChange:function(e){return u({publicName:e.target.value})}})}),c.jsxs(Ov,{as:"fieldset",children:[c.jsx(vm,{as:"legend",children:"Calculation"}),e.allowAggregateMathsCustomField&&c.jsx(_f,{marginBottom:"1rem",children:c.jsx(sy,{options:x,name:"math-check",label:n("select_math_type","Select Math Type"),selected:p,locked:d,labelHidden:!0,onChange:function(e){return u({mathType:e})}})}),"simple"===p&&c.jsx(Fw.Panel,{children:c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Zw,{id:"metric-1",testId:"metric-1",label:n("metric_number","Metric [[metricNumber]]",{metricNumber:"1"}),onChange:function(e){return u({leftFieldId:null==e?void 0:e.id})},dataSetFields:b,value:y(i),labelHidden:!0})}),c.jsx(_f,{width:170,children:c.jsx($w,{mathOperator:a,onChange:function(e){return u({operator:e})}})}),c.jsx(_f,{flex:1,children:c.jsx(Zw,{id:"metric-2",testId:"metric-2",label:n("metric_number","Metric [[metricNumber]]",{metricNumber:"2"}),onChange:function(e){return u({rightFieldId:null==e?void 0:e.id})},dataSetFields:b.filter((function(e){return e.id!==i})),value:y(o),labelHidden:!0})})]})}),"aggregate"===p&&c.jsxs(t.Fragment,{children:[c.jsx(Fw.Panel,{children:c.jsxs(zf,{direction:"column",gap:"1rem",paddingY:"0.5rem",children:[c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"left-1",testId:"left-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return u(m&&Nw(m)?{left:Q({},m,{left:t[0]})}:{left:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:m&&zw(m)?[m]:null!=m&&m.left?[null==m?void 0:m.left]:[]},dataSet:e.dataSet,fieldFilterOptions:g},""+m)}),m&&!!Nw(m)&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{width:120,children:c.jsx($w,{mathOperator:m.operator,onChange:function(e){return u({left:Q({},m,{operator:e})})}})}),c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"right-1",testId:"right-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return u({left:Q({},m,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:null!=m&&m.right?[null==m?void 0:m.right]:[]},dataSet:e.dataSet,fieldFilterOptions:g})})]}),c.jsx(_f,{children:c.jsx(Bw,{onClick:function(){return u(qw(m,"left"))},state:m&&Nw(m)?"remove":"add"})})]}),c.jsx(zf,{justifyContent:"center",children:c.jsx(_f,{flex:1,marginRight:60,children:c.jsx($w,{mathOperator:a,onChange:function(e){return u({operator:e})},id:"operator-2"})})}),c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"left-2",testId:"left-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return u(f&&Nw(f)?{right:Q({},f,{left:t[0]})}:{right:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f&&zw(f)?[f]:null!=f&&f.left?[null==f?void 0:f.left]:[]},dataSet:e.dataSet,fieldFilterOptions:g},""+f)}),f&&Nw(f)&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{width:120,children:c.jsx($w,{mathOperator:f.operator,onChange:function(e){return u({right:Q({},f,{operator:e})})},id:"operator-2"})}),c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"right-2",testId:"right-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return u({right:Q({},f,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f.right?[f.right]:[]},dataSet:e.dataSet,fieldFilterOptions:g})})]}),c.jsx(_f,{children:c.jsx(Bw,{onClick:function(){u(qw(f,"right"))},state:f&&Nw(f)?"remove":"add"})})]})]})}),c.jsx(_f,{marginTop:20,children:c.jsx(Ww,{left:m,right:f,operator:a,dataSet:null==e?void 0:e.dataSet})})]})]})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:n("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return s()},disabled:h,children:d?n("update","Update"):n("create","Create")})]})})]})},tj=["round_to_0_dp","round_to_2_dp"],nj=function(e){var n=md(),r=n.mode,o=n.textOverride,a=function(e,n,r,o){var a=!!e,l=i.intersection(tj,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=Wr(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(Q({},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=Yr(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:qt(),publicName:e,fieldId:t,roundToDecimalPlaces:n,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:ae({dataType:"number"},r)}}(u,null==(t=p.dataSetField)?void 0:t.id,"round_to_0_dp"==p.transformationFunctionKey?0:2,n);o(Q({},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),l=a.isEditing,s=a.metricName,u=a.setMetricName,d=a.items,p=a.initValues,f=a.selected,m=a.setSelected,h=a.transformationFunctions,v=a.onCreateNewRoundedNumber;return c.jsxs(kv,{width:"xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("number_formatting",o)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{id:"rounded-number-name",placeholder:o("metric_name","Metric name"),label:o("metric_name","Metric name"),value:s,onChange:function(e){return u(e.target.value)}})}),c.jsx(Ov,{children:c.jsx(xh,{testId:"select-rounded-number-field",mode:r,items:d,onDeleteItem:function(){return m({dataSetField:void 0,transformationFunctionKey:h[0]})},newItem:{callToAction:o("select_field_to_transform","Select field to transform"),onNew:function(e){return m({dataSetField:e,transformationFunctionKey:h[0]})},initValues:p,hide:!!f.dataSetField}})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:o("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){f.dataSetField&&v()},children:l?o("update","Update"):o("create","Create")})]})})]})},rj=function(e,t,n,r){var i=[],o=Br(t);return e.allowSimpleMathsCustomField&&o.supportedCustomFields.simpleMaths||e.allowAggregateMathsCustomField&&o.supportedCustomFields.aggregateMaths?i.push(Q({},Ow("math",r),{value:"math"})):(e.allowSimpleMathsCustomField||e.allowAggregateMathsCustomField||Fe("Simple math custom field not made available, because of a feature toggle."),o.supportedCustomFields.simpleMaths&&!o.supportedCustomFields.aggregateMaths||Fe("Simple math custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRoundedNumberCustomField&&o.supportedCustomFields.roundedNumbers?i.push(Q({},Ow("number_formatting",r),{value:"roundedNumber"})):(e.allowRoundedNumberCustomField||Fe("Rounded number custom field not made available, because of a feature toggle."),o.supportedCustomFields.roundedNumbers||Fe("Rounded number custom field not made available, because it is not supported for the view "+o.title+".")),e.allowPercentagesCustomField&&o.supportedCustomFields.percentages?i.push(Q({},Ow("percentage",r),{value:"percentage"})):(e.allowPercentagesCustomField||Fe("Percentage custom field not made available, because of a feature toggle."),o.supportedCustomFields.percentages||Fe("Percentage custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRulesCustomField&&o.supportedCustomFields.rules&&ln(n,"switchField")?i.push(Q({},Ow("rules-based_groups",r),{value:"rules"})):(e.allowRulesCustomField||Fe("Custom rules field not made available, because of a feature toggle."),o.supportedCustomFields.rules||Fe("Custom rules field not made available, because it is not supported for the view "+o.title+"."),ln(n,"switchField")||Fe("Custom rules field not made available, because it is not supported by the current query engine.")),i},ij=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=md().textOverride,m=Aw(r.rule,i,a.supportedAggregates),h=m.completedFilters,v=m.wipFilters,g=m.addOrFilter,b=m.deleteWipFilter,x=m.updateWipFilter;t.useEffect((function(){var e={name:d,rule:h};o.isEqual(r,e)||l(e)}),[h,d]);var y=f("rule_title","Rule [[ruleNumber]]",{ruleNumber:n+1})+(r.name?": "+r.name:"");return c.jsx(_f,{as:"fieldset",children:c.jsxs(zf,{gap:"0.5rem",paddingBottom:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.1rem",direction:"column",children:[c.jsx(Fw.Title,{title:y}),c.jsx(_f,{children:c.jsx(jm,{id:"rules-name-"+n,label:f("field_value","Field Value"),value:null==r?void 0:r.name,onChange:function(e){return p(e.target.value)}})}),c.jsx(_f,{children:c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(_f,{children:c.jsx(ww,{wipFilters:v,completedFilters:h,dataSet:i,updateWipFilter:x,queryEngineConfig:a,deleteWipFilter:b,textOverride:f})}),c.jsx(_f,{children:c.jsxs(zf,{justifyContent:"space-between",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return g()},children:f("add_or_filter","Add `OR`")}),0!==n&&c.jsx(Fh,{secondary:!0,onClick:function(){return s()},children:f("delete_rule","Delete Rule")})]})})]})})]})})},oj=function(e){var t,n=sj(e.initialValue),r=n.draft,i=n.updateDraftTitle,o=n.addNewRule,a=n.updateDraftRules,l=n.removeDraftRule,s=md().textOverride;return c.jsxs(kv,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("rules-based_groups",s)}),c.jsxs(kv.Content,{scrollable:!0,children:[c.jsx(Ov,{children:c.jsx(jm,{id:"rules-name",label:s("metric_name","Metric name"),value:null==r?void 0:r.publicName,onChange:function(e){return i(e.target.value)}})}),c.jsx(Ov,{children:c.jsx(Ud,{gap:"0.75rem",role:"list",children:null==r||null==(t=r.rules)?void 0:t.map((function(t,n){return c.jsx(oy,{transform:!1,children:c.jsx(ij,{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(kv.Footer,{buttons:"space-between",children:[c.jsx(Dv,{children:c.jsx(Fh,{onClick:function(){return o()},secondary:!0,children:s("add_rule","Add Rule")})}),c.jsxs(Dv,{buttons:"end",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return function(){if(r.publicName&&r.rules){var t=(n=r.publicName,i=r.rules,o=e.queryEngineConfig,{id:qt(),publicName:n,rules:i,dataType:"string",canBeDimension:!0,canBeMeasure:!0,allowedOperators:ae({dataType:"string"},o)});e.onCreateNewRules(e.initialValue?Q({},t,{id:e.initialValue.id}):t)}var n,i,o}()},children:e.initialValue?s("update","Update"):s("create","Create")})]})]})]})},aj={name:"",rule:[]},lj={publicName:"",rules:[aj]},sj=function(e){var n=t.useState(lj),r=n[0],i=n[1];return t.useEffect((function(){i(e||lj)}),[JSON.stringify(e)]),{draft:r,updateDraftTitle:function(e){i(Q({},r,{publicName:e}))},addNewRule:function(){var e,t=[].concat(null!=(e=null==r?void 0:r.rules)?e:[]);t.push(aj),i(Q({},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(Q({},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(Q({},r,{rules:n}))}}},uj=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){Fe("Failed to auto-scroll.")}}),50)},dj=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)})),r=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:r("fields_being_used","Fields Being Used"),show:!0}),c.jsx(kv.Content,{children:c.jsxs(_f,{paddingY:8,children:[r("fields_being_used_description","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(kv.Footer,{buttons:"end",children:c.jsx(Dv,{children:c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},children:r("close","Close")})})})]})},cj=function(e){var n,r=md(),i=r.mode,o=r.featureToggles,a=r.textOverride,l=Vr(e.dataSets,e.dataSetId);if(!l)return console.warn("Data set must be found for custom field input to render."),null;var s=t.useState(null),u=s[0],d=s[1],p=t.useState(void 0),f=p[0],m=p[1],h=t.useState(null),v=h[0],g=h[1],b=rj(o,e.componentType,null==e?void 0:e.queryEngineConfig,a),x=Xr(l,e.componentType),y=Xr(l),w=[].concat(x).map((function(e){return{title:e.publicName,subtext:pj(e,a),onClick:function(){return d({customFieldCategory:Ut(e),customField:e})}}})),j=function(t){var n=Vr(e.dataSets,e.dataSetId);if(!n)throw a("cannot_find_data_set","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 Q({},e,{fields:n?r:[].concat(r,[t])})}(n,t),i=Jr(e.dataSets,r);e.setDataSets(i),d(null)};return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:i,newItem:{callToAction:a("add_custom_metric","Add custom metric"),onNew:function(e){d({customFieldCategory:e,customField:void 0})},initValues:b,onOpenDropdown:function(){uj("bottom","editor-panel")}},items:w,onDeleteItem:function(e){var t=x[e],n=function(e,t){return e.reduce((function(e,n){var r,i;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&&(null==(r=n.numeratorFilter)?void 0:r.some((function(e){return e.some((function(e){return e.field===t.id}))})))&&e.push(n.id),"denominatorFilter"in n&&(null==(i=n.denominatorFilter)?void 0:i.some((function(e){return e.some((function(e){return e.field===t.id}))})))&&e.push(n.id),e}),[])}(y,t);n.length>0?m(n):g(t)},testId:"custom-metric-input"}),c.jsx(Gw,{dataSet:l,onNewCustomField:j,isOpen:"percentage"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==u?void 0:u.customField}),c.jsx(ej,{open:"math"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},dataSet:l,onNewCustomField:j,queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==u?void 0:u.customField,allowAggregateMathsCustomField:o.allowAggregateMathsCustomField}),c.jsx(oj,{open:"rules"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},data:l,queryEngineConfig:e.queryEngineConfig,onCreateNewRules:j,initialValue:null==u?void 0:u.customField}),c.jsx(nj,{open:"roundedNumber"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},dataSet:l,queryEngineConfig:e.queryEngineConfig,onNewCustomField:j,initialValue:null==u?void 0:u.customField}),c.jsx(Jw,{message:a("delete_custom_metric","This will permanently remove the custom field [[nameOfCustomMetric]] from all views on the dashboard, not just this view. Are you sure you want to continue?",{nameOfCustomMetric:null!=(n=null==v?void 0:v.publicName)?n:""}),onClose:function(t){if(t&&v){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),Q({},e,{fields:r})):Q({},e,{fields:r})}(l,v.id),r=Jr(e.dataSets,n);e.setDataSets(r)}g(null)},show:null!=v}),c.jsx(dj,{onClose:function(){return m(void 0)},show:null!=f&&f.length>0,fieldsUsedModal:f,customFields:y})]})};function pj(e,t){return Bt(e)||Vt(e)?Ow("math",t).title:Ht(e)?Ow("percentage",t).title:Yt(e)?Ow("rules-based_groups",t).title:""}var fj=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"==Yr(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=md(),w=mj(h,m,o,v),j=vj(h,r,m,o,v),C=hj(r,a,f,h);return c.jsxs(t.Fragment,{children:[c.jsx(xh,{testId:null!=(n=null==e?void 0:e.testId)?n:"field-collector-input",mode:y.mode,onOrderChange:function(e,t){var n=Iy([].concat(h),e,t);v(n)},onDeleteItem:r.preAggregated?void 0:function(e){var t=h[e],n=Yr(r,h[e].field);Ey(l,"date_time"===n.dataType&&"function"in t?{field:t.field,truncate:t.function}:t)?x(!0):v(es(h,e))},items:j,newItem:{callToAction:d||y.textOverride("add_field","Add field"),onNew:w,initValues:C,hide:!!e.dataSet.preAggregated||!!p&&h.length>=p}}),b&&c.jsx(Oy,{onClose:function(){return x(!1)}})]})};function mj(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||Ht(i)||Vt(i)?{field:i.id,function:"none"}:{field:i.id,function:Pe(i,n.supportedAggregates)[0]},r([].concat(a,[o]))}}function hj(e,t,n,r){var i=Wr(e.fields,t);return n&&(i=Le(i,[].concat(r))),i.map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}))}function vj(e,t,n,r,o){return[].concat(e).map((function(a,l){var s=Yr(t,a.field),u=[];"metric"==n?u=Pe(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=!Ht(s),c=!Vt(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 gj={name:"iaoxbn",styles:"display:grid;width:100%;grid-template-columns:repeat(2, minmax(0, 1fr))"},bj={name:"1flj9lk",styles:"text-align:left"},xj={name:"gdaplf",styles:"width:100%;text-align:right"},yj={name:"1gqeage",styles:"margin-right:0.75rem"},wj=function(e){var n=md(),r=n.mode,o=n.queryEngineConfig,a=e.textOverride,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 Yr(t,e.field).publicName}))}));return i.uniq(n)}(e.attributes.filter,l),f=i.isEmpty(e.attributes.filter)?[]:[{title:a("filter_list_title","[[filterCount]] {{condition}}",{condition:{plural:"conditions",singular:"condition",count:e.attributes.filter.length},filterCount:e.attributes.filter.length}),subtext:a("filter_list_subtext","{{acrossFields}} [[fields]].",{acrossFields:{count:p.length,singular:"On the field",plural:"Across fields"},fields:be(p)}),onClick:function(){return d(!0)}}],m={callToAction:a("add_filter","Add filter"),onClick:function(){d(!0)}},h=Aw(e.attributes.filter,l,o.supportedAggregates),v=h.completedFilters,g=h.addOrFilter,b=h.wipFilters,x=h.updateWipFilter,y=h.deleteWipFilter;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:r,newItemBtn:i.isEmpty(f)?m:void 0,onDeleteItem:function(){e.setPartialAttributes({filter:[]})},items:f}),c.jsxs(kv,{width:"4xl",isOpen:u,onClose:function(){return d(!1)},children:[c.jsx(kv.Header,{title:a("advanced_filters","Advanced Filters")}),c.jsx(kv.Content,{children:c.jsx(ww,{queryEngineConfig:o,updateWipFilter:x,deleteWipFilter:y,wipFilters:b,completedFilters:v,dataSet:l,textOverride:a})}),c.jsx(kv.Footer,{children:c.jsxs("div",{css:gj,children:[c.jsx("div",{css:bj,children:c.jsx(Fh,{testId:"add-rule-btn",secondary:!0,onClick:function(){g()},children:0==v.length?a("add_filter","Add filter"):a("add_or_filter","Add `OR`")})}),c.jsx("div",{children:c.jsxs("div",{css:xj,children:[c.jsx("span",{css:yj,children:c.jsx(Fh,{secondary:!0,onClick:function(){d(!1)},children:a("cancel","Cancel")})}),c.jsx(Fh,{testId:"save-filter-btn",onClick:function(){e.setPartialAttributes({filter:v}),d(!1)},children:a("save","Save")})]})})]})})]})]})},jj={name:"12vm4ss",styles:"margin-left:0.75rem;opacity:0.4;:hover{opacity:0.8;}"},Cj=function(e){return c.jsxs("div",{children:[c.jsxs("div",{children:[c.jsx(vm,{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:jj,children:c.jsx("button",{onClick:function(){var t;return null==(t=e.secondaryAction)?void 0:t.onClick()},children:e.secondaryAction.label})})]}),c.jsx(jm,{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})]})},Sj=function(e){var t,n,r=e.component,i=e.definedMetric,o=e.measure,a=_t(i),l=Yr(null==e?void 0:e.dataSet,i.field),s=md(),u=s.queryEngineConfig,d=s.textOverride,p=s.labelFormat,f=gs(l.publicName,null==(t=u.supportedAggregates[i.function])?void 0:t.publicName),m=p({fieldId:i.field,func:i.function,type:r.attributes.type,defaultLabel:f,viewId:null!=(n=r.attributes.viewId)?n:"",values:[l.publicName]});return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:l.dataType})," ",c.jsx("span",{children:null!=m?m:f})]})}),c.jsx(Ny,Q({},e,{attributes:{measure:o?o[a]:[]},dataSet:null==e?void 0:e.dataSet,componentType:r.attributes.type,allowsMultiple:!0,onNewMeasureFilterAggregate:kj(e.definedMetrics,u),setPartialAttributes:function(t){var n;e.setAttributes(((n={})[a]=t.measure,n))},supportedAggregates:u.supportedAggregates,id:"metric-input",propKey:"measure",filterOptions:function(t){return Fj(t,null==e?void 0:e.definedMetrics)},label:d("add_alternative_metric","Add alternative metric")}))]})},Fj=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),Q({},e,{select:Q({},e.select,{options:r,selected:i})})}))};function kj(e,t){return function(n){var r=e.filter((function(e){return e.field===n.id})),i=Q({},t.supportedAggregates);return r.forEach((function(e){delete i[e.function]})),i}}var _j=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},Tj=function(e,t,n){var r=Me(t,n);return e.filter((function(e){return e.field===(null==r?void 0:r.field)&&e.function===r.function}))[0]},Aj=function(e){var t=e.group,n=e.definedDimension,r=_j(n),i=Yr(null==e?void 0:e.dataSet,n.field),o=t?t[r]:null,a=md(),l=a.queryEngineConfig,s=a.textOverride;return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:i.dataType})," ",c.jsx("span",{children:i.publicName})]})}),c.jsx(My,Q({},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:l.supportedTransformationFunctions,filterOptions:function(e){return e},label:s("add_alternative_group","Add alternative group")}))]})},Dj=function(e){var t=e.group,n=e.definedDimension,r=jt(n),i=Yr(null==e?void 0:e.dataSet,null==e?void 0:e.definedDimension.field),o=md(),a=o.queryEngineConfig,l=o.textOverride,s=t?t[r]:null;return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:i.dataType})," ",c.jsxs("span",{children:[i.publicName," (",n.truncate,")"]})]})}),c.jsx(Ry,Q({},e,{attributes:{timeDimensions:s||null},supportedTimeDimensions:a.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&e.setAttributes(((n={})[r]=t.timeDimensions,n))},onNewMeasureFilterTruncFunctions:function(t){var r=Q({},a.supportedTimeTruncFunctions);return t.id===(null==e?void 0:e.definedDimension.field)&&delete r[n.truncate],r},label:l("add_alternative_time_group","Add alternative time group")}))]})},Ij=function(e){var t=(null==e?void 0:e.component).attributes,n=md().featureToggles,r=Rm().dispatch;return null!=e&&e.show?0==function(e,t){var n=[],r=Br(t);return e.parameters&&r.supportedFeatures.parameters?n.push({title:"Parameter",subtext:"Set customisable Parameters on Views"}):(e.parameters||Fe("Parameters not made available, because of a feature toggle."),r.supportedFeatures.parameters||Fe("Parameters not made available, because it is not supported for the view "+r.title+".")),n}(n,t.type).length?null:c.jsx(Oj,Q({},e,{onAddingParameters:function(n){var i=Q({},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},Oj=function(e){var n=(null==e?void 0:e.component).attributes,r=md().textOverride,i=Rm(),a=La(i.dashboard,e.component.attributes.dataSetId);if(!a)return null;var l=function(e,n,r){var i=md().queryEngineConfig,a=t.useState(Fy),l=a[0],s=a[1],u=function(){s(Fy)},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,j="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?Tt(i,{supportedAggregates:e,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}):t}))}(i.supportedAggregates,e.measure,e.parameters):[],C="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=Ct(i,e);return null!=o?o:t}return t}(i.supportedTimeTruncFunctions,e.timeDimension,e.parameters):void 0;return Q({},l,{definedMetrics:j,definedDimensions:C,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=Q({},e.measure),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:Q({},e,{measure:r}),metricKeyToDelete:i}}(Q({},l),t.measure),o=n.updatedMetrics,a=n.metricKeyToDelete;a&&function(t){if("measure"in e&&t&&l.measure){var n=Tt(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=Q({},e.group),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:Q({},e,{group:r}),metricKeyToDelete:i}}(Q({},l),t.group),d=u.updatedMetrics,c=u.metricKeyToDelete;c&&function(t){if("parameters"in e&&t&&l.group){var n=Ct(t,i.supportedTimeTruncFunctions);n&&r({updatedTimeDimension:n}),"dimension"in e&&!n&&r({updatedDimension:_y(t,e.dimension,l.group)})}}(c),s(d)}},handleUpsert:function(){n(l)},reset:u,disabled:ky(l,d)})}(n,null==e?void 0:e.onAddingParameters,e.setParameterUpdate),s=l.definedMetrics,u=l.onChange,d=l.measure,p=l.handleUpsert,f=l.definedDimensions,m=l.definedTimeDimension,h=l.group;return c.jsxs(kv,{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(kv.Header,{title:r("add_parameters","Add Parameters"),show:!0,tooltip:r("add_parameters_tooltip","Set alternate metrics and groups for the view.")}),c.jsx(kv.Content,{children:c.jsx(zf,{width:"100%",children:c.jsx(_f,{flex:1,children:c.jsxs(Av.Group,{defaultIndex:0,children:[(m||0!==f.length)&&c.jsxs(Av.List,{columns:"1fr 1fr",padding:0,children:[c.jsx(Av.Button,{children:r("add_parameter_metrics","Metrics")}),c.jsx(Av.Button,{children:r("add_parameter_groups","Groups")})]}),c.jsxs(Av.Panels,{children:[c.jsxs(Av.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(fv,{marginBottom:2,children:r("current_active_metrics","Current active metrics")}),c.jsx(zf,{direction:"column",gap:"1.5rem",children:null==s?void 0:s.map((function(t){return c.jsx(Sj,{component:null==e?void 0:e.component,definedMetric:t,definedMetrics:s,dataSet:a,setAttributes:function(e){return u({measure:e})},measure:d},t.field+"-"+t.function)}))})]}),c.jsxs(Av.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(fv,{marginBottom:2,children:r("current_active_groups","Current active groups")}),c.jsxs(zf,{direction:"column",gap:"1.5rem",children:[f.map((function(t){return c.jsx(Aj,{setAttributes:function(e){return u({group:e})},component:null==e?void 0:e.component,definedDimension:t,dataSet:a,group:h},""+t.field)})),m&&c.jsx(Dj,{definedDimension:m,setAttributes:function(e){return u({group:e})},dataSet:a,group:h})]})]})]})]})})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:r("close","Close")}),c.jsx(Ch,{onClick:function(){return p()},primary:!0,children:r("update","Update")})]})})]})},Pj=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,renderDateTimeRangeInput:e.renderDateTimeRangeInput||null,renderDateTimeInput:e.renderDateTimeInput||null,renderReportIcon:e.renderReportIcon||null,renderSendIcon:e.renderSendIcon||null,renderUserIcon:e.renderUserIcon||null,renderAIChatIcon:e.renderAIChatIcon||null,renderAIIcon:e.renderAIIcon||null,renderThumbsUpUnselectedIcon:e.renderThumbsUpUnselectedIcon||null,renderThumbsUpSelectedIcon:e.renderThumbsUpSelectedIcon||null,renderThumbsDownUnselectedIcon:e.renderThumbsDownUnselectedIcon||null,renderThumbsDownSelectedIcon:e.renderThumbsDownSelectedIcon||null,renderSelectIcon:e.renderSelectIcon||null,renderBackButtonArrowIcon:e.renderBackButtonArrowIcon||null,renderStopIcon:e.renderStopIcon||null}},Ej=function(e){var t=md().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(ov,{})}return c.jsx(n.Component,{})},Mj=t.memo((function(e){var n,r,i,o,a,l=md(),u=l.textOverride,d=l.labelFormat,p=e.displayTitle,f=e.displaySubject,m=Bb({title:p,subject:f}),h=Xd(),v={displayTitle:p,displaySubject:f,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,viewId:null!=(r=e.viewId)?r:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.lineResult)||ds(e.barResult))return c.jsx(nm,{});if(cs(e.lineResult)&&cs(e.barResult))return c.jsx(iv,{});var g,b,x=qb({dimension:e.barDimension,timeDimension:e.timeDimension}),y=e.barResult?ls(x,e.barMeasure,e.barResult):[],w=e.barResult?as(e.barResult,e.barMeasure,x,"100%"==e.stacked):[],j=qb({dimension:e.lineDimension,timeDimension:e.timeDimension}),C=e.lineResult?ls(j,e.lineMeasure,e.lineResult):[],S=e.lineResult?as(e.lineResult,e.lineMeasure,j,"100%"==e.stacked):[];return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},v)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(qx,{ref:m,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,formatYAxisLabel:Ss(u,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(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:Wb(null==e?void 0:e.legend,"verbose"===(null==h?void 0:h.detail)),x:"x",bars:{colors:di(null==h?void 0:h.colors,y.length),data:w,annotate:[],stacked:!!e.stacked,keys:y,styles:null==h||null==(o=h.charts)?void 0:o.barChart,formatter:function(t,n){if(e.conditionalFormattingRules&&e.conditionalFormattingRules.bar){var r=js(e.barDimension,e.conditionalFormattingRules.bar,t,n,null==e?void 0:e.dataSet);return r?r.value:void 0}}},lines:{colors:(g=di(null==h?void 0:h.colors,C.length),void 0===b&&(b=1),[].concat(g).map((function(e){return function(e,t,n){return s(e).darken(t).hex()}(e,b)}))),data:S,annotate:[],keys:C,threshold:fx(null==(a=e.conditionalFormattingRules)?void 0:a.line)},removeStroke:!1,theme:null==h?void 0:h.charts,formatSeriesName:function(t){var n,r,i=e.barResult&&Fs(e.barResult,u,e.type,null!=(n=e.viewId)?n:"",d)(t),o=e.lineResult&&Fs(e.lineResult,u,e.type,null!=(r=e.viewId)?r:"",d)(t);return i||o||""},sparkline:e.sm,onClick:function(){},goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix})})]})})}),xs),Rj=function(e){var t=e.component,n=t.results,r=t.attributes,i=t.localFilters,o=Rm().dashboard,a=Vb(r,e.runQueriesCallback,e.setResults,{localFilters:i,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(Mj,Q({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,idPrefix:e.idPrefix}))},Lj=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,viewId:e.id},s=Bb({title:e.displayTitle,subject:e.displaySubject});if(!Br("mercatorMap").isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(r))return c.jsx(nm,{});if(cs(r))return c.jsx(iv,{});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==_t(p)}));r.content.forEach((function(e){u[e[f]]=e[m]}))}var h=ui([i,o],((null==r?void 0:r.content.length)||100)/4);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},l)),c.jsx(Jx,{ref:s,formatValue:function(t){return ks(Jl(t,2),e.numberFormatOptions,e.labelFormat)},topology:"worldCountries",data:u,background:e.backgroundColor,colorRange:h,missingDataColor:a,position:e.position,onPositionChange:e.onPositionChange})]})})},Nj=function(e){var t=e.component,n=t.results,r=t.attributes,i=Vb(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Lj,Q({},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}))},zj=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Tx(i,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsx(sx,Q({},i,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:r,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,viewFor:"standalone"}))};function qj(e){return e>0}function Bj(e){return e.total>=e.limit}function Wj(e,t){return(e||0)+(t||TC.limit)}function Vj(e,t){if(void 0!==e||void 0!==t)return(e||0)-(t||TC.limit)}var Hj=As(Q({minWidth:"100%",overflow:"overlay"},Ef)),Yj=Object.assign((function(){return null}),{table:As({textIndent:"0",borderColor:"inherit",borderCollapse:"collapse",tableLayout:"fixed"}),wrapper:Hj,th:function(e){var t,n,r,i,o,a,l,s;return As({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:{lastGroupColumn:{true:{borderRight:null!=(t=null==e||null==(n=e.row)?void 0:n.borderRight)?t:null==e?void 0:e.borderRight}},firstGroupColumn:{true:{borderLeft:null==e||null==(r=e.row)?void 0:r.borderLeft}},first:{true:{borderLeft:null==e||null==(i=e.first)?void 0:i.borderLeft}},last:{true:{borderRight:null==e||null==(o=e.last)?void 0:o.borderRight}},rowScope:{true:{background:null==e||null==(a=e.column)?void 0:a.background}},hover:{true:{"&:hover":{color:null==e||null==(l=e["&:hover"])?void 0:l.color,background:null==e||null==(s=e["&:hover"])?void 0:s.background}}}}})},td:function(e){var t,n,r,i,o,a,l;return As({verticalAlign:"top",overflow:"hidden",position:"relative",whiteSpace:"nowrap",borderLeft:null==e||null==(t=e.body)||null==(t=t.cells)?void 0:t.borderLeft,borderRight:null==e||null==(n=e.body)||null==(n=n.cells)?void 0:n.borderRight,borderBottom:null==e||null==(r=e.body)||null==(r=r.cells)?void 0:r.borderBottom,fontSize:null==e||null==(i=e.body)||null==(i=i.cells)?void 0:i.fontSize,padding:null==e||null==(o=e.body)||null==(o=o.cells)?void 0:o.padding,variants:{first:{true:{borderLeft:null==e||null==(a=e.body)?void 0:a.borderLeft}},last:{true:{borderRight:null==e||null==(l=e.body)?void 0:l.borderRight}},align:{alignLeft:{textAlign:"left"},alignRight:{textAlign:"right"}}}})},tr:function(e){var t,n,r,i,o,a,l,s;return As({position:"relative",cursor:"default",variants:{even:{true:{background:null==e||null==(t=e.body)||null==(t=t.even)?void 0:t.background,color:null==e||null==(n=e.body)||null==(n=n.even)?void 0:n.color,"&:hover":{background:null==e||null==(r=e.body)||null==(r=r.even)||null==(r=r["&:hover"])?void 0:r.background,color:null==e||null==(i=e.body)||null==(i=i.even)||null==(i=i["&:hover"])?void 0:i.color}}},odd:{true:{background:null==e||null==(o=e.body)||null==(o=o.odd)?void 0:o.background,color:null==e||null==(a=e.body)||null==(a=a.odd)?void 0:a.color,"&:hover":{background:null==e||null==(l=e.body)||null==(l=l.odd)||null==(l=l["&:hover"])?void 0:l.background,color:null==e||null==(s=e.body)||null==(s=s.odd)||null==(s=s["&:hover"])?void 0:s.color}}}}})},showMoreButton:function(e){var t;return As(Q({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},Ts,{"&:hover":Q({},Ts,{opacity:.5}),"> svg":{marginTop:-2},"> span":{height:10,lineHeight:"1px",display:"block"}}))},tdContentWrapper:function(e){return As({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip","> span":{fontSize:null!=e?e:"inherit"}})},thInner:function(e){var t,n;return As({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 As({textTransform:null==e?void 0:e.textTransform})},thButton:function(){return As({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;return As(Q({display:"table-cell",position:"relative",fontWeight:null==e||null==(t=e.th)||null==(t=t.group)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.th)||null==(n=n.group)?void 0:n.fontSize,background:null==e||null==(r=e.th)||null==(r=r.column)?void 0:r.background,textTransform:null==e||null==(i=e.th)||null==(i=i.group)?void 0:i.textTransform,color:null==e||null==(o=e.th)||null==(o=o.column)?void 0:o.color,whiteSpace:"nowrap",textAlign:"left",borderRight:null==e||null==(a=e.th)||null==(a=a.column)?void 0:a.borderRight,borderLeft:null==e||null==(l=e.th)||null==(l=l.column)?void 0:l.borderLeft,borderBottom:null==e||null==(s=e.body)||null==(s=s.cells)?void 0:s.borderBottom,padding:null==e||null==(u=e.th)||null==(u=u.column)?void 0:u.padding},Ts,{variants:{first:{true:{borderLeft:null==e||null==(d=e.body)?void 0:d.borderLeft}},last:{true:{borderRight:null==e||null==(c=e.body)?void 0:c.borderRight}},deadSpace:{true:{borderBottom:null==e||null==(p=e.th)||null==(p=p.row)?void 0:p.borderBottom,borderRight:0,borderLeft:null==e||null==(f=e.th)||null==(f=f.column)?void 0:f.borderLeft}},level:{2:{background:null==e||null==(m=e.th)||null==(m=m.level)?void 0:m[2].background}}}}))},thGroupColumn:function(e,t){var n,r,i,o,a,l,s,u,d,c,p;return As(Q({display:"table-cell",position:"relative",fontWeight:null==e||null==(n=e.group)?void 0:n.fontWeight,fontSize:null==e||null==(r=e.group)?void 0:r.fontSize,textTransform:null==e||null==(i=e.group)?void 0:i.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:t?null==e?void 0:e.borderRight:null!=(o=null==e||null==(a=e.row)?void 0:a.borderRight)?o:null==e?void 0:e.borderRight,borderLeft:null==e?void 0:e.borderRight,borderBottom:null==e||null==(l=e.row)?void 0:l.borderBottom,padding:null==e||null==(s=e.row)?void 0:s.padding},Ts,{variants:{first:{true:{borderLeft:null==e||null==(u=e.first)?void 0:u.borderLeft}},last:{true:{borderRight:null==e||null==(d=e.last)?void 0:d.borderRight}},hover:{true:{"&:hover":Q({},Ts,{color:null==e||null==(c=e["&:hover"])?void 0:c.color,background:null==e||null==(p=e["&:hover"])?void 0:p.background})}}}}))}}),Uj=As({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),Gj=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:""+Kj,ref:f,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)},children:c.jsx("span",{className:""+Xj({onHover:p.isDragging||s?"true":"false"})})})},Kj=As({position:"absolute",right:-8,top:0,bottom:0,width:16,zIndex:1,cursor:"ew-resize"}),Xj=As({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:Ms.colors.blue},false:{borderRightColor:"transparent"}}}}),Qj=t.forwardRef((function(e,t){return c.jsx("div",{ref:t,className:"vizzly-data-table "+Yj.wrapper,children:c.jsx("table",{className:""+Yj.table,children:e.children})})})),Jj={name:"1pghby6",styles:"position:relative;box-sizing:border-box"},Zj=t.forwardRef((function(e,n){var r,i,o=e.clickEnabled,a=Xd(),l={first:e.first&&"true",last:e.last&&"true",hover:e.hover&&"true",level:null==e?void 0:e.level},s=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]),u=t.useMemo((function(){var t,n;return e.group?"row"===e.scope?Yj.thGroupRow(null==a?void 0:a.tables)(Q({},l,{deadSpace:null!=e&&e.deadSpace?"true":void 0})):Yj.thGroupColumn(null==a||null==(t=a.tables)?void 0:t.th,!(null!=e&&e.lastGroupColumn)&&(null==e?void 0:e.deadSpace))(l):Yj.th(null==a||null==(n=a.tables)?void 0:n.th)(Q({},l,{rowScope:"row"===(null==e?void 0:e.scope)?"true":void 0,lastGroupColumn:null!=e&&e.lastGroupColumn&&!e.last?"true":void 0,firstGroupColumn:null==e||!e.firstGroupColumn||e.last||e.first?void 0:"true"}))}),[e.group,e.scope,null==e?void 0:e.deadSpace,null==e?void 0:e.level]);return c.jsxs("th",{scope:null!=(r=null==e?void 0:e.scope)?r:"column",className:u,style:e.cellStyles,"data-themeapi":s,"data-chipposition":"top.left","data-group":e.group?"true":"false","data-first":e.first?"true":"false","data-last":e.last?"true":"false","data-hover":e.hover?"true":"false","data-deadspace":e.deadSpace?"true":"false","data-lastgroupcolumn":e.lastGroupColumn?"true":"false","data-firstgroupcolumn":e.firstGroupColumn?"true":"false",colSpan:e.colSpan,role:o?"button":void 0,tabIndex:o?0:void 0,"data-clickenabled":o?"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(Gj,Q({},null==e?void 0:e.dragSettings)),c.jsx("div",{css:Jj,style:e.columnStyles,children:c.jsx("div",{className:""+Yj.thInner(null==a||null==(i=a.tables)?void 0:i.th),ref:n,"data-themeapi":"tables.th.inner",children:c.jsxs(zf,{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(um,Q({},e.expand,{label:null!=e&&e.expand.expanded?"Collapse "+(null==e?void 0:e.expand.label):"Expand "+e.expand.label,arrowStart:"side"})),e.children]})})})]})})),$j={name:"1flj9lk",styles:"text-align:left"},eC={name:"6r56vi",styles:"height:1rem;width:1rem"},tC=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]);return Xd(),c.jsxs(t.Fragment,{children:[c.jsx("button",{onClick:function(){return e.onChange&&e.onChange()},css:$j,ref:l,className:Hd(a?""+Uj:void 0,""+tu.button,""+Yj.thButton()),"data-testid":e.testIdPrefix+"-title",children:a?c.jsx(ih,{placement:"bottom-start",tooltipContent:function(){return c.jsx(ih.Content,{children:o})},className:""+Uj,modifiers:[{name:"offset",options:{offset:[-50,10]}}],showTooltip:e.showTooltip,children:c.jsx(nC,{children:o})}):c.jsx(nC,{children:o})}),e.onSort&&c.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:""+tu.button,"aria-label":null!=(r=e.sortLabel)?r:"Sort",css:eC,"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,{})]})]})})),nC=function(e){var t,n=Xd();return c.jsx("span",{className:""+Yj.thLabel(null==n||null==(t=n.tables)?void 0:t.th),children:e.children})},rC={name:"agbev0",styles:"min-width:100%;overflow:scroll;border-bottom-width:1px"},iC=Object.assign((function(){return null}),{Wrapper:Qj,Head:function(e){return c.jsx("thead",{children:e.children})},Body:function(e){return c.jsx("tbody",{css:rC,children:e.children})},TR:function(e){var t,n=Xd();return c.jsx("tr",{"data-themeapi":e.odd?"tables.body.odd":"tables.body.even",className:""+Yj.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=Xd(),u=n.useState(!1),d=u[0],p=u[1],f=e.clickEnabled,m=e.first,h=t.useRef(null),g=null!=(r=e.showMoreLabel)?r:"Show more";return t.useEffect((function(){var t,n,r=h.current;"number"==typeof(null==(t=e.style)?void 0:t.width)&&r&&p((null==(n=e.style)?void 0:n.width)<r.offsetWidth+16)}),[h.current,null==(i=e.style)?void 0:i.width]),c.jsxs("td",{style:Q({},e.style),className:""+Yj.td(null==s?void 0:s.tables)({first:e.first&&"true",last:e.last&&"true",align:null!=(o=e.align)?o:"alignRight"}),role:f?"button":void 0,tabIndex:f?0:void 0,"data-clickenabled":f?"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":m?"true":"false","data-last":e.last?"true":"false",children:[c.jsx("div",{className:""+Yj.tdContentWrapper(null==s||null==(a=s.tables)||null==(a=a.body)||null==(a=a.cells)?void 0:a.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}}(d),children:c.jsx("span",{ref:h,children:e.children})}),d&&c.jsx("button",{"aria-label":"string"==typeof e.children?g+": "+e.children:g,onClick:function(){return e.onShowMore&&e.onShowMore()},className:""+Yj.showMoreButton(null==s||null==(l=s.tables)?void 0:l.body),children:c.jsx(v.DotsHorizontalIcon,{})})]})},TH:Zj,THButton:tC,THLabel:nC,HeadTR:function(e){return c.jsx("tr",{children:e.children})}}),oC=Object.assign(iC.Wrapper,{Wrapper:iC.Wrapper,Head:iC.Head,Body:iC.Body,TR:iC.TR,TD:iC.TD,TH:iC.TH,THLabel:iC.THLabel,THButton:iC.THButton,HeadTR:iC.HeadTR}),aC=function(e){return c.jsx(zf,{direction:"column",children:null==e?void 0:e.children})};function lC(e){return null===e?"asc":"asc"===e?"desc":null}var sC=function(e){var n=i.debounce(e.onSetExportName),r=md().textOverride,o=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(Af,{onClose:function(){return null==e?void 0:e.close()},width:220,position:null==e?void 0:e.triggerPosition,align:"right",children:c.jsxs(Af.Options,{padding:!0,children:[c.jsx(Af.Option,{children:c.jsx(aC,{children:c.jsx(jm,{label:r("table_settings.title","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(Af.Option,{children:c.jsx(aC,{children:c.jsx(Sm,{label:r("table_settings.format","Format"),id:"table-header-format",testId:"table-header-format",showClearBtn:!0,selected:e.currentNumberFormat,options:o,onChange:function(t){e.onSetNumberFormat(t)},textOverride:r})})})]})})})},uC=function(e){var t=md().textOverride,n=e.fieldIndex,r=e.currentOrder,i=e.exportName,o=e.currentNumberFormat,a=e.fields[n],l={width:e.width,maxWidth:e.width,minWidth:e.width},s=If(),u=s.ref,d=s.show,p=s.position,f=s.close,m=s.open,h={fontFamily:l.fontFamily,translate:e.columnOffset+"px"};return e.isImpactedColumn&&(h.opacity=.1),c.jsxs(oC.TH,{cellStyles:l,columnStyles:h,first:0===n,last:null==e?void 0:e.last,hover:!0,group:!1,dragSettings:{columnIndex:n,type:e.id,fieldKey:a.datumKey,onResized:null==e?void 0:e.onResizedColumn,width:e.width},lastGroupColumn:e.isLastGroupColumn,firstGroupColumn:e.isFirstGroupColumn,children:[c.jsx(oC.THButton,{onChange:function(){return m()},direction:r?null==r?void 0:r.direction:void 0,label:i||a.publicName,onSort:ze(a)?void 0:function(){var t,n=Me(a.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});null==e.onOrderChange||e.onOrderChange({fieldId:n.field,function:n.function,direction:lC(null!=(t=null==r?void 0:r.direction)?t:null)})},ref:u,testIdPrefix:"column-"+(null==a?void 0:a.id),sortLabel:t("table_settings.sort","Sort")}),c.jsx(sC,{open:d,triggerPosition:p,close:f,exportName:e.exportName||a.publicName,fieldId:a.datumKey,originalPublicName:a.publicName,onSetExportName:e.onSetExportName,onSetNumberFormat:function(t){return e.onSetNumberFormat(a.datumKey,t)},currentNumberFormat:o,numberFormatOptions:e.numberFormatOptions,dataType:a.dataType})]})},dC=function(e){var n=t.useRef(null),r=t.useState(0),o=r[0],a=r[1];return t.useEffect((function(){var e=i.throttle((function(){a(n.current?n.current.offsetWidth:0)}),100);return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),e.cancel()}}),[e]),[n,o]},cC=Object.assign((function(e){var n=e.content,r=e.textOverride,i=e.children,o=t.useState(!1),a=o[0],l=o[1],s=zh().addToast;return c.jsxs(zf,{gap:"0.5rem",children:[c.jsx(_f,{textWrap:!0,flex:1,hyphens:"none",children:c.jsx("span",{style:{userSelect:"none"},children:i||n})}),c.jsx(cC.Button,{onClick:function(e){e.preventDefault(),e.stopPropagation(),"string"==typeof n&&(q(n),l(!0),s((function(){return c.jsx(Mh,{message:"Copied to clipboard"})})),setTimeout((function(){return l(!1)}),2e3))},copied:a,textOverride:r})]})}),{Button:function(e){return c.jsxs("button",{onClick:function(t){return null==e?void 0:e.onClick(t)},"aria-label":e.textOverride?e.textOverride("copy_content","Copy content"):"Copy content",className:""+tu.button,children:[!(null!=e&&e.copied)&&c.jsx("svg",{height:22,width:22,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:22,width:22,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"})})]})}}),pC=function(e){return c.jsxs(kv,{onClose:function(){return null==e?void 0:e.onCloseModal()},isOpen:null==e?void 0:e.open,width:"sm",children:[c.jsx(kv.Content,{children:c.jsx(Fw.Container,{children:c.jsx(Fw.Panel,{as:"div",children:c.jsx(cC,{content:null==e?void 0:e.content})})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onCloseModal()},children:"Close"})})]})},fC=As({height:"1.25rem",width:"1.25rem","&:disabled":{opacity:.4}}),mC=As({fontSize:13,fontWeight:"normal"}),hC=function(e){var t,n,r=e.textOverride;return c.jsxs(zf,{justifyContent:"flex-end",alignItems:"center",margin:"0.5rem 0 0 0",children:[c.jsxs("span",{className:""+mC,children:[r?r("pagination.page","Page"):"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:tu.button+" "+fC,children:c.jsx(v.ChevronLeftIcon,{})}),e.onNext&&c.jsx("button",{"aria-label":"Next",disabled:null==e?void 0:e.nextDisabled,className:tu.button+" "+fC,onClick:e.onNext,children:c.jsx(v.ChevronRightIcon,{})})]})},vC=function(e,t){return t[e]?t[e]:ns(e)?t[is(e)]:void 0},gC=function(e){for(var t,n=[],r=function(){var e=t.value,r=n.find((function(t){return t.content===e.formatted}));r?r.colSpan+=1:n.push({content:e.formatted,colSpan:1,unformatted:e.unformatted})},i=ie(e);!(t=i()).done;)r();return n};function bC(e,t){return e.dimensionValues.map((function(n,r){return t(n,e.dimensionKeys[r])})).join(", ")}var xC=function(e,t){if((null==t?void 0:t.length)>0&&ns(e.datumKey)){var n=(rs(e.datumKey).dimensionValues||[]).join(", ");return t.some((function(e){return e.unformatted===n}))}return!1},yC=function(e,t,n,r,o,a,l,s,u,d,c,p,f,m,h,v,g){if(!t)return null;var b=[],x=[],y=void 0,w=function(t,n,r){var i=t;n&&"none"!=n&&(i=gs(t,u[n].publicName));var o=c({fieldId:r,func:n,type:e,defaultLabel:i,viewId:null!=g?g:"",values:[t]});return null!=o?o:i};if(t&&"dataTable"==e){var j=mn({measure:f,xMeasure:m,yMeasure:h}),C=hn({dimension:v}),S=function(e,t,n,r){var o=i.groupBy(t,(function(e){return e.pivot||"x"})),a={x:(o.x||[]).map((function(e){return _t(e)})),y:(o.y||[]).map((function(e){return _t(e)}))},l=as(e,n,a,void 0,r),s=[].concat(a.x).map((function(t){return Q({},us(e,t),{datumKey:t})})),u=[],d=ls(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=rs(t),r=_t({field:n.fieldId,function:n.function}),i=us(e,r),o=ts(n.dimensionKeys,n.dimensionValues,n.fieldId,n.function);s.push({id:r,datumKey:o,publicName:null==i?void 0:i.publicName,dataType:"number"})})),{fields:s,content:u}}(t,C,j,p);y=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(ns(t.datumKey)){var n=rs(t.datumKey);return[{formatted:bC(n,(function(t,n){return function(e,t,n,r,i){var o=Ct(t,i);if(e&&o){var a=us(e,t),l=i[o.truncate].dateFormat,s="date_time"==(null==a?void 0:a.dataType)?new Date(n):n;return De(s,r[l].formatter)||""+n}return""+n}(e,n,t,r,o)})),unformatted:bC(n,(function(e){return e}))}]}return[]})),l=i.cloneDeep(t).flatMap((function(e){return"y"==e.pivot?[]:[{colSpan:1,content:"",rowGroup:!0,unformatted:""}]}));return{consolidated:[].concat(l,gC(a)),unconsolidated:[].concat(l,a.map((function(e){return{colSpan:1,content:e.formatted,unformatted:e.unformatted}})))}}(t,C,S.fields,a,d),x=S.content,b=S.fields}else t&&t.fields.forEach((function(e){b.push(Q({},e,{datumKey:ts([],[],e.id,"none")}))}));return b=b.map((function(e){var t=e.publicName,r=e.id,i="none",o=function(e,t){return t[e]?t[e]:ns(e)?t[is(e)]:void 0}(e.datumKey,n||{});return ns(e.datumKey)&&(r=rs(e.datumKey).fieldId),o?t=o:ns(e.datumKey)&&(i=rs(e.datumKey).function),Q({},e,{publicName:o||w(t,i,r)})})),x=wC(b,"dataTable"==e?x:t.content,r,o,a,l,s,p),{groupTitles:y,fields:b,content:x}},wC=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 ns(n)?is(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?vC(null!=(u=d.datumKey)?u:"",o):"",m=a[f||""];return{value:t,displayValue:""+(null!=c?c:"")+(m&&"number"==d.dataType?m.formatter(t,l):De(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)?be(e,!1):""+e);case"string":return""+e}}(t,d.dataType),p,l))}}))}))};function jC(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 CC=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=md(),m=f.queryEngineConfig,h=f.textOverride;return c.jsx(t.Fragment,{children:n.map((function(t,f){if(null!=o&&o.fields[f].hidden)return null;if(null==o)return null;var v,g,b=o.fields[f],x=e.drilldown.length>0&&0===f,y=jC(b.datumKey,null==e?void 0:e.sizing,null==e?void 0:e.defaultColumnWidth,null==e?void 0:e.alternativeColumnSizing);if(ns(b.datumKey)){var w=rs(b.datumKey),j={};null==o||o.fields.forEach((function(e,t){var r,i;j[w.fieldId]=null==(r=n[t])?void 0:r.value,j[e.datumKey]=null==(i=n[t])?void 0:i.value})),w.dimensionKeys.forEach((function(e,t){j[e]=w.dimensionValues[t]}));var C=js(a,l,j,b.datumKey,u);C&&(v=function(e){var t,n=e.type,r=e.value,o=(t=null!=r?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{}}(C))}return Tj(a,b.id,{supportedAggregates:m.supportedAggregates,supportedTimeTruncFunctions:m.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0})?c.jsx(oC.TH,{first:0===f,last:f+1===n.length,group:!0,scope:"row",onClick:function(){return e.onViewClick(r,f,t.value,b.datumKey)},clickEnabled:Sx(d),expand:p&&x?{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!=(g=null==e?void 0:e.level)?g:void 0,children:"undefined"!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+f):c.jsx(oC.TD,{first:0===f,last:f+1===n.length,onClick:function(){return e.onViewClick(r,f,t.value,b.datumKey)},align:"number"==b.dataType?"alignRight":"alignLeft",clickEnabled:Sx(d),style:Q({},null==e?void 0:e.cellStyles,v||{},{width:y,maxWidth:y,minWidth:y}),onShowMore:function(){return null==e?void 0:e.setShowMore(t.displayValue)},showMoreLabel:h("table_settings.show_more","Show more"),children:void 0!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+f+"_"+JSON.stringify(t.displayValue)+"}")}))})},SC=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=md().queryEngineConfig;return c.jsxs(t.Fragment,{children:[c.jsx(oC.TR,{odd:a%2!=0,even:a%2==0,level:s?1:void 0,expanded:s?f:void 0,children:c.jsx(CC,Q({},e,{drilldownAction:m?{onExpanded:function(t){if(void 0!==t){var n=function(e,t,n){return kC(t).map((function(t){var r,i,o,a=(o=_j(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,Cx(null==e?void 0:e.tableRepresentation.fields,h,e.row))}}))}),(null==e?void 0:e.drilldownInputProps)&&f&&m&&c.jsx(FC,{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})]})},FC=function(e){var n,r,i=t.useState(0),o=i[0],a=i[1],l=e.drilldownInputProps,s=l.component,u=l.runQueriesCallback,d=s.attributes.limit,p=md(),f=p.queryEngineConfig,m=p.numberFormatOptions,h=p.dateTimeFormatOptions,v=p.labelFormat,g=p.textOverride,b=function(e,t,n,r,i){var o,a,l,s,u=(o=r.map((function(e){return Object.keys(e)})).flat(),e.filter.filter((function(e){return e.every((function(e){return!o.includes(e.field)}))}))),d=function(e,t,n){var r=[].concat(e).map((function(e){var n,r=Object.keys(e)[0];return{field:r,op:"=",value:e[r],function:(null==(n=t.find((function(e){return e.field===r})))?void 0:n.function)||"none"}}));return Jt(n,r)}(r,n,[].concat(u));return Q({},e,{dimension:(a=e.dimension,l=t,s=a.filter((function(e){return"x"!==e.pivot})),[].concat(s,[Q({},l)])),order:[{field:t.field,direction:"asc",function:t.function||"none"}],filter:d,offset:i})}(s.attributes,Me(e.drilldown[0].subsetDimension,f),e.dimension,e.selectedRow,o);Vb(b,u,null==e?void 0:e.setResults,{localFilters:s.localFilters,globalFilters:e.drilldownInputProps.globalFilters},e.dataSet);var x=t.useMemo((function(){return yC(b.type,e.result,b.exportNames,b.prefixes,b.dateTimeFormat,h,b.numberFormat,m,f.supportedAggregates,f.supportedTimeTruncFunctions,v,void 0,b.measure,b.xMeasure,b.yMeasure,b.dimension)}),[b.type,e.result,b.exportNames,b.prefixes,b.dateTimeFormat,h,b.numberFormat,m,f.supportedAggregates,f.supportedTimeTruncFunctions,void 0,b.measure,b.xMeasure,b.yMeasure,b.dimension]),y=t.useMemo((function(){return c.jsx(c.Fragment,{children:e.result&&c.jsx(hC,{offset:o,limit:d,onNext:function(){var e;return a(null!=(e=Wj(o,d))?e:0)},onPrevious:function(){var e;return a(null!=(e=Vj(o,d))?e:0)},previousDisabled:!qj(null!=o?o:0),nextDisabled:!Bj({offset:null!=o?o:0,limit:null!=d?d:0,total:x?x.content.length:0}),textOverride:g})})}),[o,d,null==(n=e.result)?void 0:n.content.length,a,null==x?void 0:x.content.length]),w=0===o&&(null!=(r=null==x?void 0:x.content.length)?r:0)<(null!=d?d:0),j=null==e?void 0:e.tableRowProps.row.length;return ds(e.result)?c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:c.jsx(nm,{minHeight:30})})}):cs(e.result)?c.jsx(iv,{}):c.jsxs(t.Fragment,{children:[(null==x?void 0:x.content)&&c.jsx(t.Fragment,{children:(null==x?void 0:x.content.length)>0?c.jsx(t.Fragment,{children:null==x?void 0:x.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,x,n,t,kC(e.dimension));return c.jsx(oC.TR,{level:2,odd:n%2!=0,even:n%2==0,children:c.jsx(CC,Q({},null==e?void 0:e.tableRowProps,{row:r,rowIndex:n,drilldownAction:void 0,level:2,subsetTableRepresentation:x,onViewClick:function(t,n,i,o){e.handleOnChange(t,n,i,Cx(e.parentFields,f,r,x.fields,e.drilldown[0]),function(e,t,n,r,i,o,a){var l=Me(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(ns(o)){var n=rs(o);return{fieldId:n.fieldId,value:i,function:n.function,aggregate:n.function,datum:o}}var r=Me(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],f,e.selectedRow,x.content[t][0].value,r[n].value,o,e.dimension))}}))},"table_row_level_2_"+n)}))}):c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:"No Results"})})}),!w&&c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:y})})]})};function kC(e){return e.filter((function(e){return"x"===e.pivot}))}var _C=function(e,t,n){if(!n)return[];var r=[],i=new Map;return n.fields.forEach((function(e,t){i.set(e.id,t)})),e.forEach((function(e){var o,a,l,s,u=hn(t),d=Ee({field:null==(o=e.filters)?void 0:o[0][0].field,function:null!=(a=null==(l=e.filters)?void 0:l[0][0].function)?a:"none"}),c=i.get(d);if(void 0!==c)if(u.some((function(t){var n;return t.field===(null==(n=e.filters)?void 0:n[0][0].field)}))||"number"!=typeof(null==(s=e.filters)?void 0:s[0][0].value))r.push(Q({},e,{boundaries:void 0}));else{var p=Infinity,f=-Infinity;n.content.forEach((function(t){var n,r,i=Number(t[c]);isNaN(i)||hs({op:null==(n=e.filters)?void 0:n[0][0].op,value:null==(r=e.filters)?void 0:r[0][0].value},i)&&(p=Math.min(p,i),f=Math.max(f,i))})),Infinity!==p&&-Infinity!==f&&r.push(Q({},e,{boundaries:[p,f]}))}})),r},TC={type:"dataTable",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:10,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},AC=function(e){var n,r,i,o,a,l,s,u={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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},d=e.sizing,p=md(),f=p.labelFormat,m=p.textOverride,h=dC(JSON.stringify(e)),v=h[0],g=function(e,t){var n=e/t;return n<200&&(n=200),n>300&&(n=300),n}(h[1],((null==(i=e.result)?void 0:i.fields)||[]).length),x=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}})),y=function(t){var n;return null==e?void 0:e.onSizingUpdate(Q({},d,((n={})[t.fieldKey]={width:t.width},n)))},w=t.useState(null),j=w[0],C=w[1],S=t.useMemo((function(){return yC(e.type,e.result,e.exportNames,e.prefixes,e.dateTimeFormat,e.dateTimeFormatOptions,e.numberFormat,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions,f,void 0,e.measure,e.xMeasure,e.yMeasure,null==e?void 0:e.dimension,null==e?void 0:e.viewId)}),[e.measure,e.xMeasure,e.yMeasure,e.result,e.dateTimeFormat,e.numberFormat,e.prefixes,e.dateTimeFormatOptions,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions,null==e?void 0:e.dimension]),F=(null!=(o=e.result)&&o.content?null==(a=e.result)?void 0:a.content.length:0)>(S?S.content.length:0),k=t.useMemo((function(){var t,n,r;return c.jsx(c.Fragment,{children:e.result&&!F&&c.jsx(hC,{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:!qj(null!=(t=e.offset)?t:0),nextDisabled:!Bj({offset:null!=(n=e.offset)?n:0,limit:null!=(r=e.limit)?r:0,total:S?S.content.length:0}),textOverride:m})})}),[e.offset,e.limit,e.onPrevious,e.onNext,null==(l=e.result)?void 0:l.content.length,F]),_=t.useMemo((function(){return S?function(e,t,n,r){var i=function(e,t,n,r){return e.fields.filter((function(e){return!!Tj(t,e.id,{supportedAggregates:n,supportedTimeTruncFunctions:r,supportedTransformationFunctions:void 0})}))}(e,t,n,r);return i.length>0?i[i.length-1].id:null}(S,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions):null}),[S,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions]),T=t.useMemo((function(){return S?function(e){var t=-1;return e.groupTitles&&e.groupTitles.consolidated.forEach((function(e,n){""===e.content&&!0===e.rowGroup&&(t=n)})),t}(S):null}),[S]),A=Xd();if(null===S)return null;if(ps(e.result))return c.jsx(av,Q({},u,{children:k}));if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb(e)});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});var D={fontFamily:null==A?void 0:A.fontFamily},I=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=Re(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:yx(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"};Sx(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(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(_f,{marginBottom:null!=e&&e.displayTitle&&(null==e?void 0:e.displayTitle.length)>0?"0.4rem":void 0,children:c.jsx(Pg,Q({},u,{paddingBottom:0}))}),c.jsxs(su,{disabledFeatures:null!=(s=null==e?void 0:e.library)&&s,children:[c.jsxs(oC.Wrapper,{ref:v,children:[c.jsxs(oC.Head,{children:[S.groupTitles&&c.jsx(oC.HeadTR,{children:S.groupTitles.consolidated.map((function(e,t){var n;return c.jsx(oC.TH,{colSpan:e.colSpan,group:!0,last:t+1===((null==S?void 0:S.groupTitles)&&(null==S||null==(n=S.groupTitles)||null==(n=n.consolidated)?void 0:n.length)),deadSpace:e.rowGroup,lastGroupColumn:t===T,children:e.content},e+"_"+t)}))}),c.jsx(oC.HeadTR,{children:S.fields.map((function(t,n){if(t.hidden)return null;var r=e.order.find((function(n){var r=Me(t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});return n.field===r.field&&r.function==n.function})),i=function(e,t){var n,r,i=(n=e.groupTitles?e.groupTitles.consolidated:[],(r=e.fields.filter((function(e){return xC(e,n)}))).length>0?r[r.length-1]:void 0),o=function(e,t){var n=e.filter((function(e){return xC(e,t)}));return n.length>0?n[0]:void 0}(e.fields,e.groupTitles?e.groupTitles.consolidated:[]);return{isLastGroupColumn:t.id===(null==i?void 0:i.id),isFirstGroupColumn:t.id===(null==o?void 0:o.id)}}(S,t),o=i.isLastGroupColumn,a=i.isFirstGroupColumn,l=Tj(null==e?void 0:e.dimension,t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0}),s=jC(t.datumKey,d,g,x),u=!(!S.groupTitles||t.id!==_);return c.jsx(uC,{exportName:t.publicName,onSetExportName:e.onSetExportName,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,id:e.id,isImpactedColumn:!1,width:s,columnOffset:0,currentOrder:r,onOrderChange:e.onOrderChange,fieldIndex:n,numberFormatOptions:e.numberFormatOptions,currentNumberFormat:vC(t.datumKey,e.numberFormat),onSetNumberFormat:e.onSetNumberFormat,fields:null==S?void 0:S.fields,last:n+1===(null==S?void 0:S.fields.length),scope:l?"row":void 0,onResizedColumn:y,isLastGroupColumn:o||u,isFirstGroupColumn:a},"table_column_"+n)}))})]}),c.jsx(oC.Body,{children:S.content.map((function(t,n){return c.jsx(SC,{protectedFields:null==e?void 0:e.protectedFields,dataSet:null==e?void 0:e.dataSet,conditionalFormattingRules:_C(null==e?void 0:e.conditionalFormattingRules,e,e.result),dimension:null==e?void 0:e.dimension,rowIndex:n,row:t,tableRepresentation:S,sizing:d,defaultColumnWidth:g,alternativeColumnSizing:x,handleOnChange:I,cellStyles:D,setShowMore:C,drilldown:e.tableDrilldown,drilldownInputProps:null==e?void 0:e.drilldownInputProps,queriesAreChanging:e.queriesAreChanging},n)}))})]}),k]}),c.jsx(pC,{open:!!j,onCloseModal:function(){return C(null)},content:j})]})};AC.defaultProps=TC;var DC=function(e){return c.jsx(b.DndProvider,{backend:B.HTML5Backend,children:c.jsx(AC,Q({},e))})},IC=function(e){var t=e.component,n=t.results,r=t.attributes,o=Vb(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 _t(e)})),s=r.dimension.map((function(e){return _t({function:e.function,field:e.field})})),u=i.every(null==a?void 0:a.fields,(function(e){return s.includes(e.id)||l.includes(e.id)}));return 0===e.cellWidth?null:u?c.jsx(DC,Q({},r,{dataSet:e.dataSet,onSetExportName:function(t,n){var i;e.updateComponentAttributes(Q({},r,{exportNames:Q({},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;Bj({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(Q({},r,{offset:Wj(r.offset,r.limit)}))},onPrevious:function(){var t;qj(null!=(t=r.offset)?t:0)&&e.updateComponentAttributes(Q({},r,{offset:Vj(r.offset,r.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(Q({},r,{order:l}))},numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onSetNumberFormat:function(t,n){var i=Q({},r.numberFormat);n?i[t]=n:delete i[t],e.updateComponentAttributes(Q({},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(Q({},r,{sizing:t}))},drilldownInputProps:{component:e.component,runQueriesCallback:e.runQueriesCallback,globalFilters:e.globalFilters}})):null},OC=function(e){var t;return e&&0!==e.length?null==(t=e[0])?void 0:t.value:wr.Linear},PC=Object.assign((function(e){var n=e.children,r=e.view,i=e.onWidthChange,o=dC(),a=o[0],l=o[1];return t.useEffect((function(){i(l)}),[l]),c.jsx("div",{className:""+EC({fullHeight:r===wr.Linear?"true":"false"}),ref:a,children:c.jsx("div",{children:c.jsxs(zf,{direction:r!==wr.Linear?"row":"column",height:"100%",gap:r!==wr.Linear?l/16.8:"1.5rem","data-component":"stat-container",alignItems:r!==wr.Linear?"center":"normal",justifyContent:r!==wr.Linear?"flex-start":"normal",children:[r===wr.Circular&&c.jsx(zf,{justifyContent:"center",alignItems:"center",width:"fit-content",grow:1,gap:l/17,children:n}),r===wr.Linear&&n]})})})}),{Individual:t.forwardRef((function(e,t){return c.jsx("div",{ref:t,children:e.children})})),Single:function(e){return c.jsx(Ud,{placeContent:"center","data-component":"stat-single-container",height:"100%",justifyContent:"normal",children:e.children})}}),EC=As({width:"100%",variants:{fullHeight:{true:{height:"100%"}}}}),MC=function(e){var n,r,i,o=md(),a=o.numberFormatOptions,l=o.labelFormat,s=e.results[0],u=t.useState(null),d=u[0],p=u[1];if(t.useEffect((function(){if(s&&e.measure){var t=ss(s,_t(e.measure));-1!==t&&p(t)}}),[s,e.measure]),null===d)return null;var f=null==s?void 0:s.content[0][d],m=function(e,t,n,r){var i,o;return gs(null==e||null==(i=e.fields[t])?void 0:i.publicName,null==(o=r[n.function])?void 0:o.publicName)}(s,d,e.measure,e.supportedAggregates),h=Zb(e.formatter,e.prefixes,e.postfixes,e.measure,f,a),v=h.formattedValue,g=h.prefix,b=h.postfix,x=l({fieldId:e.measure.field,func:e.measure.function,type:"progress",defaultLabel:m,viewId:e.viewId,values:[null!=(n=null==s||null==(r=s.fields[d])?void 0:r.publicName)?n:""]});return c.jsx(rw,{valueNow:f,title:null!=x?x:m,displayValueNow:$b(v,g,b),type:e.progressType,color:["#7F7FD5","#86A8E7"],valueMax:null!=(i=e.valueMax)?i:2*f,showValue:!0,showTitle:e.showTitle,radius:e.progressType===wr.Linear?void 0:e.radius})},RC={type:"progress",measure:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],parameters:{},formatter:{},goals:[],progressType:[],postfixes:{},prefixes:{}},LC=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,measure:null==(i=e)?void 0:i.measure,viewId:null!=(o=null==(a=e)?void 0:a.viewId)?o:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb({measure:e.measure,order:[],dimension:[]})});var f=void 0!==e.results?e.results[0]:void 0;if(ds(f))return c.jsx(nm,{});if(cs(f))return c.jsx(iv,{});if(ps(f))return c.jsx(av,Q({},p));var m=(e=bs(e,{},RC)).measure.length,h=OC(e.progressType),v=t.useState(0),g=v[0],b=v[1],x=(null!=(l=e.height)?l:350)/2.1;return c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[c.jsx(Pg,Q({},p,{paddingBottom:0})),m>1?c.jsx(_f,{marginY:"0.5rem",children:c.jsx(PC,{noOfValues:m,view:h,onWidthChange:function(e){return b(e)},children:[].concat(e.measure).map((function(t,n){var r,i,o,a,l=e.goals?null==(r=e.goals.filter((function(e){return e.field===_t(t)}))[0])?void 0:r.value:null;return c.jsx(PC.Individual,{children:c.jsx(MC,{index:n,supportedAggregates:e.supportedAggregates,measure:t,results:e.results,valueMax:l,showTitle:!0,progressType:h,formatter:null==(i=e)?void 0:i.formatter,postfixes:null==(o=e)?void 0:o.postfixes,prefixes:e.prefixes,radius:h===wr.Linear?void 0:x<g?x:g,viewId:null!=(a=e.viewId)?a:""})},n)}))})}):c.jsx(PC.Single,{children:c.jsx(MC,{index:1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],results:e.results,valueMax:e.goals&&e.goals.length>0?e.goals[0].value:null,showTitle:!1,progressType:h,formatter:null==(s=e)?void 0:s.formatter,postfixes:null==(u=e)?void 0:u.postfixes,prefixes:e.prefixes,radius:x+20,viewId:null!=(d=e.viewId)?d:""},1)})]})};LC.defaultProps=RC;var NC=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(LC,Q({},i,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:r,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,height:null==e?void 0:e.height}))},zC=function(e){var t=Rm().dashboard,n=md();if(!e.component.attributes)return null;var r=ay(e.component,t.dataSets,n);if(r){if(r instanceof fn)return c.jsx(Gh,{title:"Data set not available."});if(r instanceof pn)return c.jsx(Gh,{title:"This view is no-longer supported."});if(r instanceof un)return c.jsx(nv,{removeMissingField:function(){var t=Br(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig});if(r instanceof un){var i=t.removeField(e.component.attributes,r.getMissingFieldId());e.updateComponentAttributes(i)}}})}var i=La(t,e.component.attributes.dataSetId);if(e.isBeingSizeAdjusted)return c.jsx(Gh,{title:c.jsx(em,{color:"#e5e5e5"})});var o=null!=e&&e.editor||null!=e&&e.library?void 0:e.component.colSpan<=2,a=function(r){(0,Br(r.type,n).validate)(r,t.dataSets),e.updateComponentAttributes(r)},l=e.editor?"editor":e.library?"library":"dashboard";if("scatterChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Nx,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if(["horizontalBarChart","barChart"].includes(e.component.attributes.type))return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ax,{id:e.id,dataSet:i,cellWidth:e.cellWidth,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,idPrefix:l})});if("areaChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(bx,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("lineChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Px,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("pieChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(ey,{id:e.id,cellWidth:e.cellWidth,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(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(zj,{id:e.id,cellWidth:e.cellWidth,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,updateComponentAttributes:function(e){return a(e)}})});if("progress"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(NC,{id:e.id,cellWidth:e.cellWidth,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,height:e.height})});if("dataTable"==e.component.attributes.type||"basicTable"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(IC,{id:e.id,cellWidth:e.cellWidth,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(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Rj,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("custom"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ej,{component:e.component})});if("mercatorMap"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Nj,{id:e.id,setLocalFilters:e.setLocalFilters,onPositionChange:function(t){var r=(0,Br("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},qC=function(e){var t=e.component.localFilters||[],n=Rm().dashboard,r=La(n,e.component.attributes.dataSetId);return r?(r.preAggregated&&(r=La(n,r.preAggregated[0])),c.jsx(zv,{dataSets:[r],filters:t,show:null==e?void 0:e.show,onUpdate:function(n){var r=qv(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},BC=function(e){var r=t.useState(!1),i=r[0],o=r[1],a=t.useState(!1),l=a[0],s=a[1],u=Rm().dispatch,d=e.component,p=e.libraryIndex,f=n.useState(!1),m=f[0],h=f[1],v=md().mode,g=window.disableViewCheck||m,b=Xd(),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:""+iu.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(yg,{children:["View ",p+1,d.attributes.displayTitle?": "+d.attributes.displayTitle:""]}),!g&&c.jsx("div",{style:{height:"170px"},children:c.jsx(nm,{})}),g&&c.jsx(oy,{children:c.jsxs(ry,{width:340,height:306,percentage:100,children:[x&&c.jsx(VC,{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(zC,{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,cellWidth:330})]})},"select_component_preview_"+p),c.jsx(Ij,{setParameterUpdate:function(){},libraryIndex:e.libraryIndex,show:i,component:e.component,onClose:function(){return o(!1)}}),c.jsx(qC,{component:e.component,onClose:function(){return s(!1)},show:l,setLocalFilters:function(e){u({type:"setLocalFilters",localFilters:e,libraryIndex:p})}})]})})})},WC={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},VC=function(e){var r,i=n.useRef(null),o=md(),a=Br(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(_d,{})},onClick:function(){return e.onEdit()}},{purpose:"removeComponentFromLibrary",renderIcon:function(){return c.jsx(kd,{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(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(jd,{})})},onClick:function(){return e.onSetParameters()}}),o.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(yd,{active:!1})})},onClick:function(){return e.onAddFilter()}});var h=Xd();return c.jsxs("div",{css:WC,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:oh(null==h?void 0:h.dashboard)+" "+tu.button+" open-component-options",children:[c.jsx(yg,{children:null==e?void 0:e.label}),c.jsx(Dd,{})]}),s&&c.jsx(Af,{onClose:function(){return u(!1)},position:p,children:c.jsx(by,{onClose:function(){return u(!1)},cellOptions:m})})]})},HC=function(e){var n=md().textOverride;if(i.isEmpty(e.components))return c.jsx(Gh,{title:n("library.no_results","Your library is empty")});var r=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&e.current.focus()}),[]),e}(),o=[].concat(e.components).map((function(e){return{displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,component:e}})),a=Pf(o,["displayTitle","displaySubject"]),l=a.values,s=a.setSearch;return t.useEffect((function(){var t;null==e||e.onSelectComponent(null==(t=l[0])?void 0:t.refIndex)}),[a.searchString]),c.jsx(_f,{padding:"1.5rem",children:c.jsxs(Ud,{gap:"1.5rem",rows:["48px","1fr"],children:[c.jsx(_f,{children:c.jsx(ny,{placeholder:n("library.search_library","Search Library"),onChange:s,inputRef:r})}),c.jsx(_f,{children:c.jsxs(Ud,{columns:["repeat(3, 1fr)"],gap:"1.5rem",children:[0===l.length&&c.jsx(Gh,{title:n("library.search_returned_no_results","Your search returned no results")}),[].concat(l).map((function(t){var n=t.refIndex;return c.jsx(BC,{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)}))]})})]})})},YC={name:"om9tn6",styles:"margin:auto;height:24rem"},UC={name:"1g0vxgi",styles:"margin-top:0.75rem"},GC=function(){var e=Rm(),n=e.dispatch,r=e.dashboard,o=e.trackEvent,a=e.runQueriesCallback,l=t.useState(0),s=l[0],u=l[1],d=t.useState(null),p=d[0],f=d[1],m=md(),h=m.featureToggles,v=m.textOverride,g=h.canEditComponentLibrary,b=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:Qf("modal-empty-library"),css:YC,children:c.jsx(Gh,{title:v("library.no_view_in_library","There are no Views in your template library"),renderExtra:function(){return h.canEditComponentLibrary&&c.jsx("div",{css:UC,children:c.jsx(Fh,{onClick:b,children:v("library.create_new","Create New")})})}})}):c.jsxs(c.Fragment,{children:[c.jsx(KC,{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:g,onEdit:function(e){var t=Q({},r.componentLibrary[e]);o("library.startEditing"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:t})},onDelete:f,onCreate:b,onSelectComponent:function(e){o("library.switchSelectedComponent"),u(e)}}),c.jsx(XC,{open:null!==p,onClose:function(){return f(null)},onDelete:function(){null!==p&&n({type:"removeComponentFromLibrary",libraryIndex:p}),f(null),u(0)}})]})},KC=function(e){var n,r,i=Xd(),o=md().textOverride,a="boolean"==typeof(null==i||null==(n=i.modals)||null==(n=n.options)||null==(n=n.showTitle)?void 0:n.library)&&!(null!=i&&null!=(r=i.modals)&&null!=(r=r.options)&&null!=(r=r.showTitle)&&r.library);return c.jsxs(t.Fragment,{children:[c.jsx(kv.Header,{title:o("library.select_template","Select Template"),"data-component":"library-header",hide:a}),c.jsx(kv.Content,{scrollable:!0,"data-component":"library-content",children:c.jsx(HC,{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(kv.Footer,{buttons:"space-between","data-component":"library-footer",children:[c.jsx(Dv,{"data-component":"library-footer-left",children:(null==e?void 0:e.canEditComponentLibrary)&&c.jsx(Fh,{testId:"library-create-new",onClick:function(){return null==e?void 0:e.onCreate()},secondary:!0,children:o("library.create_new","Create New")})}),c.jsxs(Dv,{buttons:"end","data-component":"library-footer-right",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:o("close","Close")}),c.jsx(Fh,{testId:"add-view-from-library-to-dashboard",onClick:function(){return null==e?void 0:e.onSelect()},children:o("library.add_to_dashboard","Add to Dashboard")})]})]})]})},XC=function(e){return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.open,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:"Are you sure?"}),c.jsx(kv.Content,{children:c.jsx("p",{className:""+tu.text,children:"Are you sure you want to delete this component from your library?"})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Cancel"}),c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onDelete()},children:"Delete"})]})})]})},QC=gd((function(e){var n=Rm().dashboard,r=md(),i=r.dateFilterOptions,o=r.featureToggles,a=r.cascadeFilterSelection;return c.jsxs(zf,{gap:"0.5rem","data-component":"filters",className:""+$C(r.scope),wrap:!0,children:[e.globalFilters.length>0&&c.jsx(t.Fragment,{children:[].concat(e.globalFilters).map((function(t,r){return c.jsx(vg,{shouldAlwaysHaveValue:t.requiresValue,dataSets:n.dataSets,dateFilterOptions:i,filter:Q({},t,{optionsFilters:Fi(null==e?void 0:e.globalFilters,n.dataSets,i,a)}),filterIndex:r,onChange:function(t){var n=[].concat(e.globalFilters);n[r]=t,e.setGlobalFilters(n)}},r)}))}),o.canManageGlobalFilters&&c.jsx(Wv,{})]})}),"renderGlobalFiltersViewComponent"),JC=function(e){var t=md();return c.jsx("div",{className:""+ZC(t.scope),"data-component":"global-filters",children:c.jsx(QC,Q({},e))})},ZC=function(e){return As("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%"})},$C=function(e){return As("read"===e?{"@media (min-width: 768px)":{flexDirection:"row"},"@media (max-width: 767px)":{flexDirection:"column"}}:{flexDirection:"row"})};function eS(e,n){var r=md().id;t.useEffect((function(){var t,i=Nl.get(null!=(t=null!=n?n:r)?t:"",(function(t){return e(t)}));return function(){return i()}}),[])}var tS=r.object({dataSetId:r.string().required(),fieldId:r.string().required()}),nS=r.array().items(tS).required();function rS(e,t,n,r){var i=e.properties.appliesToFields,o=nS.validate(i).error;if(o&&Ae("Validation error for appliesToFields: "+o.message+" ",i),t.forEach((function(r,o){iS(r.appliesToFields,i)&&(n=!0,t[o]=Q({},r,e.properties))})),!n)throw Ae("No matching filters found for the provided appliesToFields when running updateFilter.",r.updateFilter),new Error("No matching filters found for the provided appliesToFields.");return n}function iS(e,t){return e.length===t.length&&e.every((function(e){return t.some((function(t){return t.dataSetId===e.dataSetId&&t.fieldId===e.fieldId}))}))}var oS=function(e){function t(t,n){var r;return(r=e.call(this,"'Issue with Vizzly State "+n+": '"+t+"'")||this).name="StateValidation",r}return J(t,e),t}(sn),aS=function(){var e=Rm(),t=e.dashboard,n=e.dispatch,r=md().featureToggles.showGlobalFilters;return eS((function(e){var r=function(e,t){var n;if(t.addFilter){var r,i,o=nS.validate(t.addFilter.properties.appliesToFields).error;if(o)throw Ae("Validation error for appliesToFields: "+o.message,null==(r=t.addFilter)||null==(r=r.properties)?void 0:r.appliesToFields),new Error("Validation error for appliesToFields");if(e.some((function(e){var n,r;return iS(e.appliesToFields,null!=(n=null==(r=t.addFilter)||null==(r=r.properties)?void 0:r.appliesToFields)?n:[])})))throw Ae("Filter with matching appliesToFields already exists",t.addFilter),new Error("Filter with matching appliesToFields already exists.");e.push(null==(i=t.addFilter)?void 0:i.properties)}if(t.updateFilter&&rS(t.updateFilter,e,!1,t),t.updateFilters)return null==t||null==(n=t.updateFilters)||n.forEach((function(n){rS(n,e,!1,t)})),e;if(t.removeFilter){var a=nS.validate(t.removeFilter).error;if(a)throw Ae("Validation error for appliesToFields: "+a.message+" ",t.removeFilter),new Error("No matching filters found for the provided appliesToFields.");e=e.filter((function(e){return!(t.removeFilter&&iS(e.appliesToFields,t.removeFilter))}))}return Fe("Updated global filters",e,t),e}(t.globalFilters,e);try{var i=function(e){var t=Aa.validate(e),n=t.error,r=t.value;if(n)throw Ae("Invalid global filter configuration: "+n.message),n;return r}(r);n({type:"setGlobalFilters",globalFilters:i})}catch(e){throw new oS(e,"globalFilters")}})),r?c.jsx(JC,{globalFilters:t.globalFilters,setGlobalFilters:function(e){Fe("Setting global filters",e),n({type:"setGlobalFilters",globalFilters:e})},setupAsyncOptionLoader:function(){return X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Not implemented.";case 1:case"end":return e.stop()}}),e)})))}}):null},lS=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(sS,{content:e.content,copyContent:e.copyContent}),e.children||e.content]})},sS=function(e){var n=zh().addToast,r=t.useState(!1),i=r[0],o=r[1];return c.jsx(cC.Button,{onClick:X(G().mark((function t(){return G().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:q(t.t0),n((function(){return c.jsx(Mh,{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})},uS={name:"1gok8e8",styles:"margin-bottom:0.5rem"},dS={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"},cS=function(){var e,t=md(),n=t.overrideDeveloperInfo,r=t.setOverrideDeveloperInfo;return c.jsx(kv,{width:"xl",isOpen:!!n,onClose:function(){return r(null)},children:c.jsxs("div",{onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[c.jsx(kv.Header,{title:"Replace component"}),c.jsxs(kv.Content,{children:[c.jsx("div",{css:uS,children:c.jsx(lS,{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:dS,children:c.jsx(Km,{showAccordionIcon:!0,title:"View props",Icon:Ou,children:c.jsx(lS,{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))})})})]})]})})},pS=function(e){var t=e.currentReports[0],n=t?t.id:l.v4(),r=md(),i=r.reportScheduleOptions,o=r.onScheduledReportChange,a=r.textOverride,s=[].concat(i).map((function(e){return{label:e.description,value:e.cron}})),u=function(){var t=X(G().mark((function t(r){var a,l;return G().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(kv,{width:"xl",onClose:e.onClose,isOpen:e.isOpen,children:[c.jsx(kv.Header,{title:a("set_report_schedule","Set report schedule")}),c.jsx(kv.Content,{children:c.jsx(Sm,{placeholder:a("select_schedule","Select schedule"),selected:t?t.schedule:null,showClearBtn:!0,onChange:u,options:s})}),c.jsx(kv.Footer,{children:c.jsx(Fh,{onClick:e.onClose,secondary:!0,children:a("close","Close")})})]})},fS=Object.assign((function(){return null}),{emptyCell:function(e){return As({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})}}),mS=function(e){return c.jsxs("div",{style:{position:"relative",cursor:e.onStartEdit?"pointer":"auto"},onClick:function(){return null==e.onStartEdit?void 0:e.onStartEdit()},children:[!!e.onStartEdit&&c.jsx(_f,{display:"inline",position:"absolute",top:2,right:0,children:c.jsx(vS,{})}),c.jsx(vm,{as:"span",children:e.label}),c.jsx("div",{className:Hd(""+tu.text,null==e?void 0:e.className),children:e.value})]})},hS={name:"6r56vi",styles:"height:1rem;width:1rem"},vS=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:hS,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"})})},gS=function(e){var n,r,o=(null==e?void 0:e.component).attributes,a=Rm().dispatch,l=md().textOverride,s=function(){var t,n={};null==e||null==(t=e.component)||null==(t=t.results[0])||t.fields.forEach((function(e){n[e.id]=e.publicName}));var r=[];if("dimension"in o&&o.dimension.map((function(e){var t=n[Ee(e)];r.push({value:e,label:t})})),"timeDimension"in o&&null!==o.timeDimension){var i=o.timeDimension,a=n[i?Ee({field:null==i?void 0:i.field,function:null==i?void 0:i.truncate}):""];r.push({value:i,label:a})}return r.sort((function(e,t){return e.label.localeCompare(t.label,void 0,{sensitivity:"base"})})),r},u=t.useState(!1),d=u[0],p=u[1],f=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)),m=f[0],h=f[1],v=t.useState(function(){var e,t,n=[],r=s().map((function(e){return e.value}));return o&&"protectedFields"in o&&o.protectedFields&&"dimension"in o.protectedFields&&o.protectedFields.dimension&&(n=null!=(e=null==(t=o.protectedFields)||null==(t=t.dimension)?void 0:t.map((function(e){return r.findIndex((function(t){return(null==t?void 0:t.field)===e.field}))})))?e:[]),n}()),g=v[0],b=v[1],x=function(){null==e||e.onClose()};return c.jsxs(kv,{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(kv.Header,{title:l("click_settings","Click Settings"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(mS,{label:l("view_id","View Id"),value:c.jsx(Fw.Panel,{children:c.jsx(cC,{content:o.viewId,textOverride:l})})})}),"basicTable"!==o.type&&c.jsx(Ov,{children:c.jsx(bS,{options:s(),selectedDimension:g,setSelectedDimesion:b})}),c.jsx(Ov,{children:c.jsx(xS,{attributes:o,results:null==e||null==(n=e.component)?void 0:n.results,selectedMeasure:m,setSelectedMeasure:h,label:l("protected_measure_select","Protected [[type]]",{type:"basicTable"===o.type?"Columns":"Metrics"})})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,onClick:function(){d||(x(),null==e||e.onClose())},disabled:d,children:l("cancel","Cancel")}),c.jsx(Ch,{onClick:function(){return d?void 0:function(){p(!0);var t={};"measure"in o&&i.isArray(m)&&(t.measure=m.map((function(e){return null==o?void 0:o.measure[e]})));var n=s();n.length>0&&i.isArray(g)&&(t.dimension=g.map((function(e){return n[e]})).map((function(e){return e.value}))),"protectedFields"in o&&a({type:"setAttributes",attributes:Q({},o,{protectedFields:t}),cellIndex:e.cellIndex,rowIndex:e.rowIndex}),p(!1),x()}()},disabled:d,primary:!0,children:l("confirm","Confirm")})]})})]})},bS=function(e){var t=md();return c.jsx(Gv,{label:(0,t.textOverride)("protected-grouping-fields","Protected Grouping Fields"),id:"protected-grouping-fields",setSelected:function(t){return e.setSelectedDimesion(t)},selected:e.selectedDimension,options:e.options})},xS=function(e){var t=e.attributes,n=e.results,r=e.setSelectedMeasure;return c.jsx(Gv,{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=_t(e);i.push({value:e,label:r[t]+("none"!==e.function?" ("+e.function+")":"")})})),i}()})},yS=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"})})]})]})},wS=function(e){var t;return c.jsxs(zf,{justifyContent:"center",direction:"column",alignItems:"center",height:"100%","data-component":"empty-state",children:[c.jsx(yS,{height:null!=(t=e.height)?t:160,color:null==e?void 0:e.illustrationColor}),c.jsxs(zf,{direction:"column",gap:"1rem",alignItems:"center",children:[c.jsx(_f,{className:""+jS,children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx(_f,{children:null==e?void 0:e.children})]})]})},jS=As({fontSize:16,fontWeight:500}),CS=function(e){return c.jsx("div",{className:tu.height100+" "+SS,"data-component":"cell-contents","data-vizzlycomponentloaded":e.showComponent?"true":"false",children:e.children})},SS="vizzly-component",FS=function(){return Array.from(document.querySelectorAll('[class*="'+SS+'"]')).map((function(e){return{element:e,isLoaded:"true"===e.getAttribute("data-vizzlycomponentloaded")}}))},kS=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===t&&(t=500),n=function(){return FS().every((function(e){return e.isLoaded}))};case 2:if(n()){e.next=7;break}return e.next=5,new Promise((function(e){return setTimeout(e,t)}));case 5:e.next=2;break;case 7:return e.abrupt("return",FS());case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_S=function(e){var t=md().textOverride,n=zh().addToast;return c.jsxs(kv,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:t("json_results","Data in raw JSON format"),show:!0}),c.jsx(kv.Content,{children:c.jsx(_f,{maxHeight:"400px",overflowY:"scroll",children:c.jsx("pre",{"data-testid":"raw-results-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.results,null,2)})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("close","Close")}),c.jsx(Ch,{primary:!0,testId:"modal-copy-json-results-btn",onClick:function(){var t=q(JSON.stringify(e.results));n(t?function(){return c.jsx(Mh,{message:"Copied results"})}:function(){return c.jsx(Ph,{message:"Failed to copy results"})})},children:t("copy","Copy")})]})})]})},TS=function(e){var t=md().textOverride,n=zh().addToast;return c.jsxs(kv,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:t("json_attributes","Attributes in raw JSON format"),show:!0}),c.jsx(_f,{position:"absolute",top:20,right:20,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/services/views/"+e.attributes.type,children:c.jsx(v.QuestionMarkCircleIcon,{color:"#000",width:20,height:20})})}),c.jsx(kv.Content,{children:c.jsx(_f,{maxHeight:"400px",overflowY:"scroll",children:c.jsx("pre",{"data-testid":"raw-attributes-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.attributes,null,2)})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("close","Close")}),c.jsx(Ch,{primary:!0,testId:"modal-copy-json-attributes-btn",onClick:function(){var t=q(JSON.stringify(e.attributes));n(t?function(){return c.jsx(Mh,{message:"Copied attributes"})}:function(){return c.jsx(Ph,{message:"Failed to copy attributes"})})},children:t("copy","Copy")})]})})]})},AS={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},DS={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},IS={name:"1q8mru7",styles:"margin-left:0.25rem;display:inline-block"},OS=function(e){var n=Xd(),r=md(),i=r.featureToggles,o=r.textOverride,a=i.canUseComponentLibrary,l=i.canCreateStandaloneComponents;return 0===(null==e?void 0:e.rowIndex)&&0===(null==e?void 0:e.cellIndex)&&i.canSeeEmptyState?c.jsx(oy,{vizzlyPrefix:Qf("populated-cell"),children:c.jsxs("div",{css:AS,children:[!e.generatingPDF&&c.jsx(jy,{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(wS,{title:c.jsx(t.Fragment,{children:o("empty_state_call_to_action","Build a dashboard with your data and delight your customer.")}),illustrationColor:"#43BA73",children:l&&c.jsx(hh,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:o("add_view_call_to_action","+ Add View")})})]})}):c.jsx("div",{className:Hd(Qf("empty-cell"),""+fS.emptyCell(null==n?void 0:n.dashboard)),"data-themeapi":"dashboard","data-chipposition":"top.left",children:c.jsxs("div",{css:DS,children:[!e.generatingPDF&&c.jsx(jy,{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(zf,{gap:"0.5rem",wrap:!0,justifyContent:"center",children:[a&&c.jsx(hh,{onChange:e.onPickFromLibrary,size:"small","data-component":"select-template",testId:"add-view-from-library",children:c.jsxs(zf,{alignItems:"center",as:"span",children:[c.jsx(Id,{}),c.jsx("span",{css:IS,children:o("select_template","Select Template")})]})}),l&&c.jsx(hh,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:o("add_view_call_to_action","+ Add View")})]})]})})},PS=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=t.useState(!1),g=v[0],x=v[1],y=t.useState(!1),w=y[0],j=y[1],C=Rm().dispatch,S=md(),F=S.featureToggles,k=S.developerTools,_=S.reportScheduleOptions,T=S.scope,A=S.textOverride,D=F.canDownloadComponentData,I=F.canEditComponentsOnDashboard,O=F.canRemoveComponentsFromDashboard,P=!0===k||"object"==typeof k&&k.viewRawResults,E=!0===k||"object"==typeof k&&k.viewRawAttributes,M=n.useState(!1),R=M[0],L=M[1],N=t.useState(!1),q=N[0],B=N[1],W=n.useState(!1),V=W[0],H=W[1],Y=e.generatingPDF||window.disableViewCheck||V,U=!i.isEmpty(_)&&e.hasWebhookSetup,G=(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}}}}))),K=G[1],X=G[2],Q=function(t){C({type:"setLocalFilters",localFilters:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},J=function(t){C({type:"setParameterBasedUpdate",payload:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},Z=t.useState(!1),$=Z[0],ee=Z[1];return c.jsxs(c.Fragment,{children:[c.jsx(z,{active:!V,partialVisibility:!0,onChange:H,children:c.jsxs(oy,{vizzlyPrefix:Qf("populated-cell"),"data-testid":e.testId,ref:X,onHover:ee,children:[c.jsx(ah,{dragSource:K,active:"read_write"===T&&$,enabled:"read_write"===T,top:ES(e.component.attributes).top,height:ES(e.component.attributes).height}),!e.generatingPDF&&c.jsx(wy,{canDownloadComponentData:D&&e.componentValidWithDataSet,canEditComponentsOnDashboard:I&&e.componentValidWithDataSet,canRemoveComponentsFromDashboard:O,onEdit:e.onEdit,onRemove:function(){return s(!0)},onDownload:e.onDownload,canSetupReportSchedule:U,onManageReport:function(){return L(!0)},onClickSettings:function(){return B(!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 j(!0)},onViewRawJSONResults:function(){return h(!0)},onViewRawAttributes:function(){return x(!0)},canViewRawJSONResults:P,canViewRawViewAttributes:E}),c.jsxs(CS,{showComponent:Y,children:[Y&&c.jsx(zC,{cellWidth:e.cellWidth,id:e.id,setLocalFilters:Q,setParameterUpdate:J,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes,height:e.height}),!Y&&c.jsx(nm,{})]})]})}),U&&c.jsx(pS,{setComponentReports:e.setComponentReports,currentReports:e.component.reports||[],isOpen:R,onClose:function(){return L(!1)}}),q&&c.jsx(gS,{show:q,component:null==e?void 0:e.component,onClose:function(){return B(!1)},cellIndex:e.cellIndex,rowIndex:e.rowIndex}),c.jsx(Jw,{message:A("delete_view_from_dashboard_message","This view will be deleted from your dashboard."),onClose:function(t){t&&(null==e||e.onRemove()),s(!1)},show:l}),c.jsx(qC,{component:e.component,onClose:function(){return p(!1)},show:d,setLocalFilters:Q}),c.jsx(Ij,{cellIndex:e.cellIndex,setParameterUpdate:J,rowIndex:e.rowIndex,show:w,component:e.component,onClose:function(){return j(!1)}}),c.jsx(_S,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:m,results:e.component.results,onClose:function(){return h(!1)}}),c.jsx(TS,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:g,attributes:e.component.attributes,onClose:function(){return x(!1)}})]})},ES=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}},MS=function(e,t){if(e){var n=[[].concat(e.fields).map((function(t,n){var r;if(!e.groupTitles)return t.publicName;var i=null==(r=e.groupTitles.unconsolidated)||null==(r=r[n])?void 0:r.content;return(i?"["+i+"] ":"")+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")},RS=function(e){var t=new Blob([e],{type:"text/csv;charset=utf-8"});W.saveAs(t,"download.csv")},LS=function(){var e=X(G().mark((function e(t,n,r,o,a,l,s,u,d,c,p){var f,m,h,v,g,b,x;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===c&&(c=RS),f=i.cloneDeep(a),e.prev=2,"limit"in f&&(f.limit=o),m=new AbortController,h="view-download-type"==t?f:[$r(n,o,"filter"in f?f.filter:[])],e.next=8,Nm(h,r,m.signal,d);case 8:cs(g=null==(v=e.sent)?void 0:v[0])||ps(g)||ds(g)||(b=i.isArray(h)?h[0]:h,x=yC(b.type,g,"exportNames"in f?f.exportNames:void 0,"prefixes"in f&&Array.isArray(f.prefixes)?f.prefixes:void 0,"dateTimeFormat"in f?f.dateTimeFormat:void 0,l,"numberFormat"in f?f.numberFormat:void 0,s,u.supportedAggregates,u.supportedTimeTruncFunctions,p,"",b.measure,b.xMeasure,b.yMeasure,null==b?void 0:b.dimension),MS(x,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,c){return e.apply(this,arguments)}}(),NS=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=Rm().dispatch,s=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return t()},children:[c.jsx(kv.Header,{title:s("update_header","Update Header"),show:!0}),c.jsx(kv.Content,{children:c.jsx(Ov,{children:c.jsx(jm,{id:"header-title",label:s("header_title","Title"),labelHidden:!0,value:o,onChange:function(e){return a(e.target.value)}})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return t()},secondary:!0,children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return n=Q({},r,{displayTitle:o}),l({type:"setHeaderComponent",component:n,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),void t();var n},children:s("update","Update")})]})})]})},zS=function(e){var t,n,r,i=Xd();return c.jsxs(zf,{justifyContent:"space-between",alignItems:"center",margin:null!=(t=null==e?void 0:e.margin)?t:"0 0 1rem","data-component":"action-section",className:""+qS(null==i?void 0:i.header),"data-themeapi":"header",children:[c.jsx(_f,{children:(null==e?void 0:e.title)&&c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(_f,{as:null!=(n=e.titleLevel)?n:null==i||null==(r=i.header)||null==(r=r.title)?void 0:r.htmlElement,className:""+BS(null==i?void 0:i.header),"data-themeapi":"header.title",children:null==e?void 0:e.title}),(null==e?void 0:e.subTitle)&&c.jsx("p",{className:""+WS,children:null==e?void 0:e.subTitle})]})}),(null==e?void 0:e.extra)&&c.jsx(_f,{children:null==e?void 0:e.extra})]})},qS=function(e){var t;return As({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})},BS=function(e){var t,n,r,i,o,a;return As({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})},WS=As({margin:0,fontSize:14}),VS=function(e){var t=[],r=n.useState(!1),i=r[0],o=r[1],a=md(),l=a.featureToggles,s=a.scope;return t.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Sy,{})},onClick:function(){return o(!0)},testId:"edit"}),l.canRemoveComponentsFromDashboard&&t.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Cy,{})},onClick:function(){return e.onRemove()},testId:"remove"}),c.jsxs(_f,{position:"relative",height:"100%",margin:"0 0.1rem 0.5rem 0.1rem",children:[c.jsx(zS,{title:e.component.displayTitle,margin:0}),!e.generatingPDF&&"read_write"===s&&c.jsx(yy,{cellOptions:t,chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1)}),c.jsx(NS,{show:i,component:e.component,onClose:function(){return o(!1)},rowIndex:e.rowIndex,cellIndex:e.cellIndex})]})};function HS(e,t){return!(t<=0||t>=e.length)&&e[t-1].components.some((function(e){return mi(e)}))}var YS,US=function(e,t,n){return e.slice(-15)+"_"+t+"_"+n},GS=function(e){var t=e.onCreateNew,n=e.onPickFromLibrary,r=e.onRemoveCell,i=e.rowIndex,o=e.cellIndex,a=e.trackEvent,l=md(),s=l.queryEngineConfig,u=l.dateTimeFormatOptions,d=l.numberFormatOptions,p=l.labelFormat,f=Rm(),m=f.dispatch,h=f.dashboard,v=f.runQueriesCallback,g=h.display[i].components[o],x=Li(g)?"empty":mi(g)?"header":"populated",y=null!=h.webhookId,w=b.useDrop((function(){return{accept:"moveComponentPositionDragHandle",drop:function(t,n){m({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:w[1],css:["height:100%;padding:0.5rem;",w[0].isOver&&{opacity:"0.2"},"",""],children:["populated"==x&&!Li(g)&&!mi(g)&&c.jsx(PS,{cellWidth:e.cellWidth,rowIndex:i,cellIndex:o,id:US(h.id,i,o),hasWebhookSetup:y,componentValidWithDataSet:!0,generatingPDF:e.generatingPDF,setComponentReports:function(e){m({type:"setComponentReports",rowIndex:i,cellIndex:o,reports:e})},testId:"populated_cell_"+i+"_cell_"+o,isBeingSizeAdjusted:e.isBeingSizeAdjusted,component:g,runQueriesCallback:v,updateComponentAttributes:function(e){m({type:"updateDisplayComponentAttributes",rowIndex:i,cellIndex:o,attributes:e})},height:e.height,setResults:function(e){m({type:"setResultsForComponentInDisplay",rowIndex:i,cellIndex:o,results:e})},onEdit:function(){a("component.startEditing"),m({type:"startEditingComponent",displayTarget:{rowIndex:i,cellIndex:o},libraryIndex:null,component:g})},onRemove:function(){a("component.removeFromDisplay"),m({type:"clearCell",rowIndex:i,cellIndex:o})},onDownload:function(){var t=X(G().mark((function t(n){var r,i;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=Vr(h.dataSets,g.attributes.dataSetId),i={globalFilters:h.globalFilters,localFilters:g.localFilters},r&&LS(n,r,v,e.maxCSVDownloadLimit,g.attributes,u,d,s,i,void 0,p);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),"empty"==x&&c.jsx(OS,{onCreateNew:function(){return t(i,o)},onPickFromLibrary:function(){return n(i,o)},onRemoveCell:function(){return r(i,o)},cellIndex:o,rowIndex:i,generatingPDF:e.generatingPDF}),"header"==x&&mi(g)&&c.jsx(VS,{component:g,onRemove:function(){return r(i,o)},rowIndex:i,cellIndex:o,generatingPDF:e.generatingPDF})]},"row_"+i+"_cell_"+o)},KS=As(Q({width:"100%",cursor:"ns-resize",opacity:0,paddingTop:"0.75rem",paddingBottom:"0.75rem"},Ts,{"&:hover":Q({},Ts,{opacity:100})})),XS=As({position:"relative",height:"0.25rem",marginLeft:"40%",width:"20%"}),QS=As(Q({cursor:"ew-resize",position:"absolute",right:"-0.75rem",height:"25%",width:"0.25rem",top:"40%"},Ts,{"&:hover":Q({},Ts,{opacity:80}),variants:{highlighted:(YS={},YS.true={opacity:100},YS.false={opacity:0},YS)}})),JS=Object.assign((function(){return null}),{dragHandle:function(e){return As({borderRadius:"0.75rem",background:null==e?void 0:e.borderColor})},cellDragHandle:QS,rowDragHandle:XS,rowDragHandleContainer:KS}),ZS=Object.assign((function(){return null}),{tooltip:As({height:"100%",width:"100%",justifyContent:"center",alignItems:"center",display:"flex"})}),$S=function(e){return null!=e&&e.narrow?c.jsx(ih,{placement:"right-start",tooltipContent:function(){return c.jsx(ih.Content,{children:null==e?void 0:e.tooltipLabel})},className:""+ZS.tooltip,classNameTrigger:""+ZS.tooltip,children:c.jsx(eF,Q({},e))}):c.jsx(eF,Q({},e))},eF=function(e){var t;return c.jsxs(hh,{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})]})},tF=function(e){var n=Xd(),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(B.getEmptyImage(),{captureDraggingState:!1})}),[]),i.isDragging?null:c.jsx("div",{ref:o,className:""+JS.rowDragHandleContainer,children:c.jsx("div",{className:" "+JS.dragHandle(null==n?void 0:n.dashboard)+" "+JS.rowDragHandle,"data-themeapi":"dashboard"})})},nF=function(e){var t=Xd(),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:JS.dragHandle(null==t?void 0:t.dashboard)+" "+JS.cellDragHandle({highlighted:null!=e&&e.rowHighlighted?"true":"false"})})},rF={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"},iF={name:"1vjyfqt",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.8)"},oF={name:"ve8olc",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.1)"},aF=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:rF,children:t[0].isOver?c.jsx("div",{style:{left:"calc(50% - 10px)"},css:iF}):c.jsx(c.Fragment,{children:e.active&&c.jsx("div",{style:{left:"calc(50% - 10px)"},css:oF})})})},lF={name:"1kzq5ms",styles:"height:100%;width:100%"},sF={name:"cvkgqy",styles:"display:inline-block;overflow-y:hidden"},uF={name:"1wv4onu",styles:"position:relative;height:100%"},dF=function(e){var n,r,o=e.generatingPDF,a=t.useState(!1),l=a[0],s=a[1],u=md(),d=u.scope,p=u.textOverride,f=Rm().dispatch,m=(r=null!=(n=e.containerWidth)?n:0,parseFloat(((r-1)/12).toFixed(2))),h=b.useDragLayer((function(t){var n=t.getItem(),r=t.getItemType(),i=t.getDifferenceFromInitialOffset(),o=[].concat($l(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}})),v=h.rowHeightAdjustment,g=h.widthAdjustments,x=h.activeCell,y=h.activeRow,w=h.moveType,j=h.isDraggingComponentWidth,C=e.displayRow.components.some((function(e){return mi(e)})),S=v+(C?52:e.displayRow.height);return void 0===e.containerWidth?null: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(Ud,{columns:e.columns,"data-component":"panel-row",marginBottom:C?void 0:26,children:[c.jsx(zf,{alignItems:"stretch",paddingBottom:10,paddingTop:8,"data-component":"add-cell",direction:"column",gap:"0.5rem",children:!C&&l&&e.canAddNewCells&&c.jsxs(t.Fragment,{children:[!e.hideAddNewHeaderRow&&c.jsx(_f,{minHeight:32,width:32,children:c.jsx($S,{onChange:e.onAddHeaderRow,narrow:!0,tooltipLabel:p("add_header_tooltip","Add Header Row"),label:p("add_header","Add Header"),"data-component":"add-header-row"})}),c.jsx($S,{onChange:e.onAppendCell,narrow:!0,tooltipLabel:p("add_cell_tooltip","Add Cell to Row"),label:p("add_cell","Add Cell"),"data-component":"add-cell-button"})]})}),c.jsxs("div",{className:""+pF(S,d,e.displayRow.components.length),"data-component":"rowContainer",children:[j&&!C&&c.jsx(c.Fragment,{children:$l(12).map((function(t,n){return c.jsx(aF,{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:m,active:null!=x},n)}))}),c.jsx("div",{css:lF,children:[].concat(e.displayRow.components).map((function(t,n){var r=n==e.displayRow.components.length-1,i=m*t.colSpan+(g[n]||0),a="componentWidthDragHandle"==w&&null!=x&&e.rowIndex==y&&(x==n||x+1==n),s="rowHeightDragHandle"==w&&e.rowIndex==y;return c.jsx("div",{css:sF,className:""+cF(S,i,d,e.containerWidth),"data-component":"cell-container",children:c.jsxs("div",{css:uF,style:{width:"calc(100% - 20px)"},children:[c.jsx(GS,{generatingPDF:o,maxCSVDownloadLimit:e.maxCSVDownloadLimit,isBeingSizeAdjusted:a||s,onCreateNew:e.onCreateNew,onPickFromLibrary:e.onPickFromLibrary,onRemoveCell:e.onRemoveCell,rowIndex:e.rowIndex,cellIndex:n,trackEvent:e.trackEvent,height:S,cellWidth:i}),!r&&"read_write"===d&&!C&&c.jsx(nF,{displayRow:e.displayRow,rowIndex:e.rowIndex,cellIndex:n,rowHighlighted:l})]})},"row_"+e.rowIndex+"_cell_"+n)}))}),"read_write"===d&&c.jsx(tF,{onNewHeight:function(e,t){f({type:"setRowHeight",rowIndex:e,height:t})},displayRow:e.displayRow,rowIndex:e.rowIndex})]},"actual_resizable_row_"+e.rowIndex)]})})},cF=function(e,t,n,r){var i;return As("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%"})},pF=function(e,t,n){var r;return As("read"===t?((r={})["@media (min-width: 768px)"]={height:e},r["@media (max-width: 767px)"]={height:e*n},r):{height:e})},fF=function(e){var t,n;return c.jsx(_f,{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(zf,{className:""+mF,children:[c.jsxs("a",{href:e.logo.href,className:""+hF,target:null!=(t=null==e||null==(n=e.logo)?void 0:n.target)?t:void 0,children:[c.jsx("span",{className:""+tu.srOnly,children:"Vizzly"}),c.jsx(Mu,{}),(null==e?void 0:e.logo.text)&&c.jsx(_f,{as:"span",paddingTop:2,children:e.logo.text})]}),null==e?void 0:e.children]})})},mF=As({background:"#E7EAF1",color:"#151515",padding:"0 0.75rem",borderRadius:12,position:"relative",minHeight:40}),hF=As({position:"absolute",left:12,top:7.5,display:"flex",gap:"0.5rem",alignItems:"center",fontSize:12,fontWeight:600}),vF=As({height:30,background:Ms.colors.brand[20],width:1}),gF={background:"transparent",color:Ds(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:Ms.colors.brand.base},"&:focus":{background:"rgba(48, 116, 217, 0.1)",border:"1px solid transparent",color:Ms.colors.brand.base},"&:disabled":{background:"transparent",opacity:.5},"&:hover:disabled":{background:"transparent",opacity:.5},fontSize:12,fontWeight:600},bF=function(e){return JSON.stringify({display:e.display,componentLibrary:e.componentLibrary,globalFilters:e.globalFilters,customFields:e.customFields})},xF={name:"1gok8e8",styles:"margin-bottom:0.5rem"},yF={name:"1gok8e8",styles:"margin-bottom:0.5rem"},wF=function(e){var n=t.useState("small"),r=n[0],i=n[1],o=Rm().dashboard,a=t.useState(!1),l=a[0],s=a[1],u=md(),d=u.featureToggles,p=u.scope,f=u.mode,m=u.onSave,h=u.queryEngineConfig,v=u.onOpenConfigManagerUi;if(u.disableToolbar)return null;var g=za(o),b=function(){"read_write"==p&&m(o)},x=Ko(h,"configManagerUi")&&v;t.useEffect((function(){!function(){var e=X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:d.disableAutoSave||"endUser"!=f?Fe("Auto-save is disabled, so the dashboard will not be saved."):b();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[g&&JSON.stringify({changes:bF(g)})]);var y=function(){s(!1)};return c.jsxs(c.Fragment,{children:[("admin"==f||x)&&"hidden"!==r&&c.jsx(fF,{"data-component":"admin-tools",logo:{href:"https://docs.vizzly.co/",target:"_blank"},children:c.jsx(zf,{justifyContent:"end",alignItems:"center",padding:"0.1rem 0",children:c.jsxs(Dv,{buttons:"end",children:[x&&c.jsx(Fh,{testId:"manage-data-sets",secondary:!0,onClick:function(){v()},internal:!0,themeOverride:gF,children:"Config Manager"}),"admin"==f&&c.jsx(Fh,{secondary:!0,testId:"save-dashboard",onClick:function(){s(!0)},internal:!0,themeOverride:gF,disabled:e.isProgrammaticParent,children:"Save"}),c.jsx("div",{className:""+vF}),c.jsxs(Fh,{secondary:!0,onClick:function(){return i("hidden")},internal:!0,themeOverride:gF,children:[c.jsx("span",{className:""+tu.srOnly,children:"Hide Tools"}),c.jsx(pu,{})]})]})})}),c.jsxs(kv,{width:"sm",isOpen:l,onClose:function(){return y()},children:[c.jsx(kv.Header,{title:"Confirm changes?"}),c.jsxs(kv.Content,{children:[c.jsx("p",{css:xF,children:"Are you sure you want to save this dashboard?"}),c.jsx("p",{css:yF,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(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:function(){return y()},children:"Cancel"}),c.jsx(Fh,{testId:"confirm-save",onClick:function(){b(),y()},children:"Save"})]})})]})]})},jF=function(e){var n=Rm(),r=n.dashboard,o=n.dispatch,a=md().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 Q({},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!Ci(n,e)})));return e.globalFilters.length==l.length?i.cloneDeep(l):(Te("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},CF={name:"firlg",styles:"grid-column:span 2 / span 2"},SF=function(e){return c.jsx("div",{css:CF,children:e.children})},FF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(zf,{gap:"0.75rem",direction:"column",children:e.section.subSection.map((function(t,n){return c.jsxs(SF,{children:[c.jsx(fv,{children:t.title}),c.jsx(Ny,Q({componentType:e.attributes.type},e,{allowsMultiple:t.allowsMultiple,propKey:t.propKey,setPartialAttributes:e.setAttributes,supportedAggregates:e.queryEngineConfig.supportedAggregates}))]},n)}))})})},kF=function(e){var t=e.dataSets.filter((function(e){return!e.hide}));return t.length<2&&!e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"dataset-section",children:c.jsx(Ay,Q({},e,{dataSets:t,setPartialAttributes:e.setAttributes}))})},_F=function(e){var t=md();return 0==rj(t.featureToggles,e.attributes.type,null==e?void 0:e.queryEngineConfig,t.textOverride).length||e.dataSet.preAggregated?null:c.jsx(c.Fragment,{children:e.featureToggles.canEditCustomMetrics&&c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"custom-metric-section",children:c.jsx(cj,{queryEngineConfig:e.queryEngineConfig,setDataSets:e.setDataSets,dataSetId:e.attributes.dataSetId,dataSets:e.dataSets,componentType:e.attributes.type})})})},TF=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(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"sort-section",children:c.jsx(By,Q({},e,{attributes:t,timeDimension:"timeDimension"in t&&t.timeDimension||null,dimension:n,measure:r,setPartialAttributes:e.setAttributes}))})},AF=function(e){var n=t.useState([]),r=n[0],i=n[1],o=md(),a=o.mode,l=o.queryEngineConfig,s=o.textOverride,u=vj(r,null==e?void 0:e.dataSet,"grouping",l,i),d=hj(null==e?void 0:e.dataSet,{onlyDimensions:!0},!0,[].concat(r,null==e?void 0:e.dimension)),p=mj(r,"grouping",l,i);return c.jsxs(kv,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(kv.Header,{title:s("add_drilldown","Add Drilldown")}),c.jsx(kv.Content,{children:c.jsx(Ud,{columns:["1fr"],gap:"1rem",children:c.jsxs(Ov,{children:[c.jsx(vm,{as:"p",children:s("drilldown_field","Drilldown field")}),c.jsx(xh,{mode:a,onDeleteItem:function(){return i([])},items:u,newItem:{callToAction:s("add_drilldown_field","Add drilldown field"),onNew:p,initValues:d,hide:r.length>0}})]})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){var t;0===r.length||e.onClose({subsetDimension:Ee({field:r[0].field,function:null==(t=r[0])?void 0:t.function})})},primary:!0,disabled:0===r.length,children:s("update","Update")})]})})]})},DF=function(e){var n=md(),r=n.mode,o=n.queryEngineConfig,a=n.textOverride,l=t.useState(!1),s=l[0],u=l[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 d=function(t){if(!(null==e||null==(t=e.drilldown)?void 0:t[0]))return[];var n=Me(null==e?void 0:e.drilldown[0].subsetDimension,o),r=Yr(e.dataSet,n.field);return[{title:qy(r.publicName,n.function&&"none"!=n.function&&le(n.function,a))}]}();return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:r,newItemBtn:i.isEmpty(null==e?void 0:e.drilldown)?{callToAction:a("add_drilldown","Add drilldown"),onClick:function(){u(!0)}}:void 0,onDeleteItem:function(){return e.onSetDrilldown([])},items:d}),s&&c.jsx(AF,{show:s,onClose:function(t){t&&e.onSetDrilldown([t]),u(!1)},dimension:null==e?void 0:e.dimensions,dataSet:e.dataSet})]})},IF=function(e){return"tableDrilldown"in e.attributes?c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(DF,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldown:null==e?void 0:e.attributes.tableDrilldown,onSetDrilldown:function(t){return e.setAttributes({tableDrilldown:t})}})}):null},OF=function(e){var t=md();return"filter"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(wj,Q({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,textOverride:t.textOverride}))}):null},PF=function(e){var t=md();return"limit"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Cj,{label:(0,t.textOverride)("limit","Limit"),labelHidden:!0,id:"limit",currentValue:e.attributes.limit,setNumber:function(t){return e.setAttributes({limit:t||0})}})}):null},EF=function(e){var t=md().textOverride;if(!("limit"in e.attributes))return null;var n=e.section.options.map((function(e){return{value:e,label:e}}));return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Fm,{children:c.jsx(Sm,{label:t("rows_per_page","Rows per page"),id:"pagination-limit-input",testId:"pagination-limit-input",onChange:function(t){e.setAttributes({limit:t||0,offset:0})},options:n,selected:e.attributes.limit,textOverride:t,onClick:function(){return uj("bottom","editor-panel")}})})})},MF=function(e){var t=md().textOverride;return"comboChart"!=e.attributes.type?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsxs(zf,{gap:"0.75rem",direction:"column","data-component":"combo-chart-compare",children:[c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.line","Line")}),c.jsx(My,Q({propKey:"lineDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.bar","Bar")}),c.jsx(My,Q({propKey:"barDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.time","Time")}),c.jsx(Ry,Q({},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}))}}))]})]})})},RF=function(e){return"measure"in e.attributes?c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(zy,Q({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},LF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"views-section",children:c.jsx(lw,Q({},e,{setPartialAttributes:e.setAttributes}))})},NF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(fj,Q({},e,e.section,{setPartialAttributes:e.setAttributes}))})},zF=function(e){return c.jsx(Ud,{gap:"1.5rem",children:null==e?void 0:e.children})},qF=function(e){var t=Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),n=Wr(e.dataSet.fields,{onlyFieldTypes:["date_time"]}),r=md(),i=r.mode,o=r.textOverride;if(0===n.length)return null;var a,l=[];e.deltaTimeDimension&&l.push({title:Yr(e.dataSet,e.deltaTimeDimension.field).publicName,subtext:e.queryEngineConfig.supportedTimeTruncFunctions[null==(a=e.deltaTimeDimension)?void 0:a.truncate].publicName+" window",select:{onChange:function(t){e.deltaTimeDimension&&e.setDeltaTimeDimension(Q({},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 s=[].concat(n).map((function(e){return{title:""+e.publicName,subtext:"",value:e.id}}));return c.jsx(xh,{mode:i,onDeleteItem:function(){e.setDeltaTimeDimension(null)},items:l,newItem:{callToAction:o("add_percentage_and_absolute_change","Add percentage and absolute change"),hide:null!=e.deltaTimeDimension,initValues:s,onNew:function(n){e.setDeltaTimeDimension({truncate:t[0],field:n,bucketFill:!1})}}})},BF=function(e){var t,n=md().queryEngineConfig,r=null==e?void 0:e.attributes;return t=Wr((null==e?void 0:e.dataSet).fields,{onlyFieldTypes:["date_time"]}),a(t)?null:c.jsx(Fw,{title:"Comparison",children:c.jsx(qF,{dataSet:null==e?void 0:e.dataSet,deltaTimeDimension:r.deltaTimeDimension,setDeltaTimeDimension:function(t){e.setAttributes({deltaTimeDimension:t})},queryEngineConfig:n})})},WF=function(e){return c.jsx(Ov,{children:c.jsx("div",{className:""+VF,children:c.jsx(jm,{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})})})},VF=As({width:"100%",flexDirection:"column",flexGrow:1,height:"100%",display:"flex"}),HF=function(e){return c.jsxs(zf,{alignItems:"top"===(null==e?void 0:e.checkboxPosition)?"flex-start":"center",children:[c.jsx(Qm,{onChange:function(t){e.setChecked(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(vm,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},YF=function(e){return c.jsx("div",{children:c.jsx(jm,{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})})},UF=function(e){var t=md();return c.jsx(Fm,{children:c.jsx(Sm,{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,textOverride:t.textOverride})})},GF=function(e){var n,r,i=t.useState((null==(n=e.progressMetric)?void 0:n.measure)||null),o=i[0],a=i[1],l=t.useState((null==(r=e.progressMetric)?void 0:r.goal)||null),s=l[0],u=l[1],d=md(),p=d.queryEngineConfig,f=d.textOverride;return c.jsxs(kv,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(kv.Header,{title:f("add_progress_metric","Add Progress Metric")}),c.jsxs(kv.Content,{children:[c.jsxs(Ov,{children:[c.jsx(vm,{children:f("metric","Metric")}),c.jsx(Ny,{componentType:"progress",maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){a(e.measure[0])},supportedAggregates:p.supportedAggregates,attributes:{measure:o?[o]:[]},dataSet:e.dataSet,fieldFilterOptions:{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:"progress",removePercentage:!1,removeSimpleMaths:!1,removeRuleGrouping:!1,removeAggregateMaths:!1},disableRemove:!0})]}),c.jsx(Ov,{children:c.jsx(Cj,{label:f("goal","Goal"),currentValue:s,setNumber:function(e){return u(e)},id:"progress-goal"})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:f("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){o&&s&&e.onClose({measure:o,goal:s})},primary:!0,disabled:null===s||null===o,children:e.progressMetric?f("update","Update"):f("add","Add")})]})})]})},KF=function(e){var n=e.attributes,r=e.dataSet,i=e.setAttributes,o=n.measure,a=md(),l=a.mode,s=a.queryEngineConfig,u=a.textOverride,d=t.useState(!1),p=d[0],f=d[1],m=[].concat(o).map((function(e){var t,i,o,a=Yr(r,e.field),l=null!=(t=null==(i=n.goals.find((function(t){return t.field===_t(e)})))?void 0:i.value)?t:"-";return{title:c.jsxs(zf,{gap:"0.25rem",direction:"column",children:[c.jsx("div",{children:gs(a.publicName,null==(o=s.supportedAggregates[e.function])?void 0:o.publicName)}),c.jsxs("div",{children:[u("goal_set_to","Goal set to"),": ",c.jsx("span",{className:""+tu.bold,children:l})]})]}),icon:a.dataType,onClick:function(){return f({measure:e,goal:l})}}}));return c.jsxs(Fw,{title:e.section.title,tooltip:e.section.description,children:[p&&c.jsx(GF,{show:!!p,onClose:function(e){if(f(!1),e){var t=_t(e.measure);i({measure:JF(o,t,e),goals:QF(n.goals,t,e),progressType:XF(n.progressType,t)})}},dataSet:r,progressMetric:"boolean"!=typeof p?p:void 0}),c.jsx(Fw.Container,{"data-component":"progress-input",children:c.jsx(xh,{mode:l,onOrderChange:function(e,t){var n=Iy([].concat(o),e,t);i({measure:n})},newItemBtn:{callToAction:u("add_metric","Add metric"),onClick:function(){f(!0)}},onDeleteItem:function(e){var t=_t(o[e]);i({measure:es(o,e),goals:n.goals.filter((function(e){return e.field!==t})),progressType:n.progressType.filter((function(e){return e.field!==t}))})},items:m})})]})};function XF(e,t){var n=e.findIndex((function(e){return e.field===t})),r=[].concat(e);return-1!==n?r[n]={field:t,value:OC(e)}:r.push({field:t,value:OC(e)}),r}function QF(e,t,n){var r=e.findIndex((function(e){return e.field===t})),i=[].concat(e);return-1!==r?i[r]={field:t,value:n.goal}:i.push({field:t,value:n.goal}),i}function JF(e,t,n){var r=[].concat(e),i=r.findIndex((function(e){return _t(e)===t}));return-1!==i?r[i]=n.measure:r.push(n.measure),r}var ZF=function(e){var r=md().textOverride,i=e.dataPanelConfig.some((function(e){return"function"!=typeof e&&("filter"===e.type||"customMetrics"==e.type||"limit"==e.type)}))&&!e.dataSet.preAggregated;return c.jsxs(zF,{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(NF,Q({},e,{section:t})),"drilldown"==t.type&&c.jsx(IF,Q({},e,{section:t})),"labelledMetrics"==t.type&&c.jsx(FF,Q({},e,{section:t})),"fields"==t.type&&c.jsx(RF,Q({},e,{section:t})),"progressGoals"===t.type&&c.jsx(KF,Q({},e,{section:t})),"dataSet"==t.type&&c.jsx(kF,Q({},e,{section:t})),"views"==t.type&&c.jsx(LF,Q({},e,{section:t})),"sort"==t.type&&c.jsx(TF,Q({},e,{section:t})),"pagination"==t.type&&c.jsx(EF,Q({},e,{section:t})),"comboChartDimension"==t.type&&c.jsx(MF,Q({},e,{section:t})),"comparison"==t.type&&c.jsx(BF,Q({},e,{section:t}))]},t.type+"_"+r)})),i&&c.jsx(Xm,{title:r("advanced_options","Advanced Options"),defaultOpen:!1,showAccordionIcon:!0,onOpened:function(){uj("bottom","editor-panel")},children:c.jsx(zF,{children:e.dataPanelConfig.map((function(n,r){return"function"!=typeof n?c.jsxs(t.Fragment,{children:["filter"==n.type&&c.jsx(OF,Q({},e,{section:n})),"customMetrics"==n.type&&c.jsx(_F,Q({},e,{section:n})),"limit"==n.type&&c.jsx(PF,Q({},e,{section:n}))]},r):null}))})})]})},$F=function(){var e=Ky(),t=md();if(!e)return c.jsx(nm,{});var n=e.dataSet,r=e.queryEngineConfig,i=e.dataPanel,o=e.dashboard,a=e.setPartialAttributes,l=e.component.attributes;if(!n)throw"Data set required to show data props editor.";var s=Br(l.type,{queryEngineConfig:r,textOverride:e.textOverride});return c.jsx(Il,{renderOnError:function(e){return c.jsx(dv,{onManualRetry:e})},onError:t.onError,children:c.jsx(ZF,{setDataSets:e.setDataSets,setAttributes:a,setDataSet:e.setDataSet,dataSets:o.dataSets,dataSet:n,featureToggles:e.featureToggles,attributes:l,queryEngineConfig:r,dataPanelConfig:i(s.dataPanelConfig(),{type:l.type})})})},ek=function(e){var n,r=e.section,i=e.setAttributes,o=e.attributes;return c.jsx(Fw,{title:r.title,tooltip:null==r?void 0:r.description,children:c.jsx(Fw.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(jm,{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(jm,{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)}))})})},tk=function(e){var t,n=md(),r=n.numberFormatOptions,i=n.textOverride,o=Object.keys(r).map((function(e){return{value:e,label:r[e].description}}));return c.jsx(Fm,{children:c.jsx(Sm,{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:i("format","Format"),onChange:function(t){return null==e?void 0:e.onChange(t)},options:o,textOverride:i})})},nk=function(e){var n=e.section,r=e.attributes,i=e.setAttributes,o=md().textOverride,a=n.subSection.some((function(e){return"legend"===e.type||"numberFormat"===e.type})),l=n.subSection.some((function(e){return"stacked"===e.type||"curve"===e.type}));return c.jsx(Fw,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsxs(Ud,{gap:"1rem",children:[l&&c.jsx(Fw.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(UF,{id:"format-layout-stacked",label:e.title,currentValue:void 0!==r.stacked&&r.stacked,onSelect:function(e){return i({stacked:e})},options:[{label:o("grouped","Grouped"),value:!1},{label:o("stacked","Stacked"),value:!0},{label:o("stacked_100prc","Stacked (100%)"),value:"100%"}]}),"curve"===e.type&&c.jsx(UF,{label:e.title,id:"format-layout-curve",currentValue:r.lineCurve,onSelect:function(e){return i({lineCurve:e})},options:[{value:"natural",label:o("natural","Natural")},{value:"straight",label:o("straight","Straight")},{value:"step",label:o("step","Step")}]})]},n)}))}),a&&c.jsx(Fw.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(HF,{label:e.title,setChecked:function(e){return i({legend:e})},currentValue:r.legend,id:"show-legend-input"}),"numberFormat"===e.type&&c.jsx(tk,{label:e.title,onChange:function(e){return i({labelFormat:e})},id:"format-number",currentValue:r.labelFormat,testId:"format-number"})]},n)}))})]})})},rk=function(e){return c.jsxs(zf,{alignItems:"center",children:[c.jsx(Qm,{onChange:function(t){e.onChange(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(vm,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},ik=function(e){var t,n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b=md(),x=b.textOverride,y=b.dateTimeFormatOptions,w=[{label:x("auto","Auto"),value:"auto"},{label:x("minimal","Minimal"),value:2},{label:x("None","None"),value:0}],j=Object.keys(y).map((function(e){return{label:y[e].description,value:e}})),C="horizontalBarChart"==e.attributes.type,S=(null==(t=e.attributes)||null==(t=t.dimension)?void 0:t.length)>0&&"number"===Yr(e.dataSet,null==(n=e.attributes)||null==(n=n.dimension[0])?void 0:n.field).dataType&&!(null!=(r=e.attributes)&&r.timeDimension),F=!(null==(i=e.attributes)||!i.timeDimension),k=C?{x:"y",y:"x"}:{x:"x",y:"y"},_=k.x,T=k.y;return c.jsx(Fw,{title:null==(o=e.section)?void 0:o.title,tooltip:null==(a=e.section)?void 0:a.description,"data-component":"axis-preference-section",children:c.jsxs(Fw.Container,{"data-component":"single-stats-labels",children:[c.jsxs(Fw.Panel,{title:null==(l=e.section[T])?void 0:l.title,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{label:e.section[T].prefix.title,setText:function(t){return e.setAttributes({yAxisPrefix:t})},currentValue:e.attributes.yAxisPrefix,maxLength:4,id:"axis-"+T+"-prefix"}),c.jsx(YF,{label:e.section[T].postfix.title,setText:function(t){return e.setAttributes({yAxisPostfix:t})},currentValue:e.attributes.yAxisPostfix,maxLength:4,id:"axis-"+T+"-postfix"})]}),c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(tk,{label:null==(s=e.section[T].format)?void 0:s.title,id:"axis-"+T+"-format",onChange:function(t){return e.setAttributes({yAxisFormat:t})},currentValue:e.attributes.yAxisFormat,testId:"axis-"+T+"-format"}),c.jsx(UF,{id:"axis-"+T+"-label-count",label:e.section.y.count.title,currentValue:e.attributes.approxYAxisLabelCount,onSelect:function(t){return e.setAttributes({approxYAxisLabelCount:t})},options:w})]}),c.jsx(Fw.Grid,{children:c.jsx(YF,{label:null!=(u=null==(d=e.section[T].axisTitle)?void 0:d.title)?u:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[T]=t,n)})},currentValue:null==(p=e.attributes.axisTitles)?void 0:p[T],id:"axis-"+[T]+"-axisTitle"})})]}),c.jsxs(Fw.Panel,{title:e.section[_].title,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{label:e.section[_].prefix.title,setText:function(t){return e.setAttributes({xAxisPrefix:t})},currentValue:e.attributes.xAxisPrefix,maxLength:4,id:"axis-"+_+"-prefix"}),c.jsx(YF,{label:e.section[_].postfix.title,setText:function(t){return e.setAttributes({xAxisPostfix:t})},currentValue:e.attributes.xAxisPostfix,maxLength:4,id:"axis-"+_+"-postfix"})]}),c.jsx(Fw.Grid,{columns:S||F?2:1,children:c.jsxs(c.Fragment,{children:[S&&c.jsx(tk,{label:null==(f=e.section[_].format)?void 0:f.title,id:"axis-"+_+"-format",onChange:function(t){e.setAttributes({xAxisFormat:t})},currentValue:e.attributes.xAxisFormat,testId:"axis-"+T+"-format"}),F?c.jsxs(c.Fragment,{children:[c.jsx(UF,{id:"axis-"+_+"-label-date-format",label:(null==(m=e.section.x)||null==(m=m.format)?void 0:m.title)||"Format",currentValue:e.attributes.xAxisFormat,onSelect:function(t){return e.setAttributes({xAxisFormat:t})},options:j}),c.jsx(UF,{id:"axis-"+_+"-label-count",label:e.section.x.count.title,currentValue:e.attributes.approxXAxisLabelCount,onSelect:function(t){return e.setAttributes({approxXAxisLabelCount:t})},options:w})]}):c.jsx(rk,{label:x("hide_labels","Hide Labels"),onChange:function(t){return e.setAttributes({approxXAxisLabelCount:t?0:"auto"})},id:"hide-labels",currentValue:0===e.attributes.approxXAxisLabelCount})]})}),c.jsx(Fw.Grid,{children:c.jsx(YF,{label:null!=(h=null==(v=e.section[_].axisTitle)?void 0:v.title)?h:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[_]=t,n)})},currentValue:null==(g=e.attributes.axisTitles)?void 0:g[_],id:"axis-"+[_]+"-axisTitle"})})]})]})})},ok={filters:[[]],ruleValue:"#1FF985",ruleValueEnd:void 0,ruleType:"backgroundColor"},ak=function(e,t){return!!Ve(t).validate(e).error},lk=function(e){return null!=e&&e.show?c.jsx(sk,Q({},e)):null},sk=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=t.useState(null!=(n=e.conditionalFormatting)&&n.ruleValueEnd?"gradient":"single"),l=a[0],s=a[1],u=md(),d=u.queryEngineConfig,p=u.textOverride,f="basicTable"!=e.componentType,m=function(e,t,n,r,i,o){return[].concat(function(e,t){return[].concat(t).flatMap((function(t){var n=Yr(e,t.field);return"date_time"==n.dataType?[]:[{label:n.publicName,value:n,icon:c.jsx(Uf,{icon:n.dataType,paddingTop:0}),function:t.function}]}))}(e,t),function(e,t,n,r,i){return t.map((function(t){var o=Yr(e,t.field);return{label:o.publicName+(At(t)?" ("+le(t.function,r)+")":""),value:kw(o,t.function,i,n),icon:c.jsx(Uf,{icon:n?"number":o.dataType,paddingTop:0}),function:t.function}}))}(e,n,r,i,o))}(e.dataSet,e.dimension,e.measures,f,p,d.supportedAggregates),h=function(e,n,r,i,o){void 0===o&&(o=!1);var a=md().queryEngineConfig,l=t.useState(null!=e?e:Q({},ok,{ruleType:r})),s=l[0],u=l[1],d=Aw(s.filters,i,a.supportedAggregates,{startWithEmptyField:!0,maxFilters:1,enableChangeToNumber:o}),c=d.completedFilters,p=d.wipFilters,f=d.deleteWipFilter,m=d.updateWipFilter;t.useEffect((function(){u(e||ok)}),[JSON.stringify(e)]);var h=function(e){u(Q({},s,e))};return t.useEffect((function(){return h({filters:c})}),[JSON.stringify(c)]),Q({},s,{completedFilters:c,wipFilters:p,handleUpsert:function(){n(Q({},s,{ruleType:r}))},deleteWipFilter:f,updateWipFilter:m,onChange:h,disabled:ak(Q({},s,{ruleType:r}),a)})}(null==e?void 0:e.conditionalFormatting,e.onSave,e.ruleType,e.dataSet,f),v=h.onChange,g=h.ruleValue,b=h.ruleValueEnd,x=h.disabled,y=h.handleUpsert,w=h.completedFilters,j=h.wipFilters,C=h.deleteWipFilter,S=h.updateWipFilter,F=Br(e.componentType);t.useEffect((function(){var e,t,n,r;void 0===(null==(e=j[0][0])?void 0:e.field)&&(o(!1),s("single")),"none"!==(null==(t=j[0][0])?void 0:t.function)&&void 0!==(null==(n=j[0][0])?void 0:n.function)||"number"===(null==(r=j[0][0])||null==(r=r.field)?void 0:r.dataType)?o(!0):(o(!1),s("single"))}),[j]);var k=function(){if(e.numberConditionalFormattingOnly)return[].concat(Object.keys(d.supportedOperators)).flatMap((function(e,t){return">="===e||"<="===e?{label:d.supportedOperators[e].publicName,value:e,testId:"pick-op-"+t}:[]}))}();return c.jsxs(kv,{isOpen:!0,onClose:e.onClose,width:"4xl",children:[c.jsx(kv.Header,{title:p("add_conditional_formatting","Add Conditional Formatting"),hiddenUnlessEnabledInCss:!1}),c.jsx(kv.Content,{children:c.jsxs(Ud,{gap:"1rem",children:[c.jsx(Fw.Panel,{children:c.jsx(ww,{fieldHeadingOverride:p("field","Field"),queryEngineConfig:d,dataSet:e.dataSet,completedFilters:w,wipFilters:j,updateWipFilter:S,deleteWipFilter:C,overrideFieldOptions:m,maxOrFilters:1,textOverride:p,supportedQueryOperators:k})}),c.jsx(Fw.Panel,{children:c.jsxs(zf,{gap:"1rem",direction:"column",children:[i&&F.supportedFeatures.colorGradient&&c.jsx(sy,{options:[{label:p("color_format.single","Single"),value:"single"},{label:p("color_format.gradient","Gradient"),value:"gradient"}],name:"gradient-check",label:p("select_percentage_type","Select Percentage Type"),selected:l,labelHidden:!0,onChange:function(e){s(e),v({ruleValueEnd:"gradient"===e?"#16A257":void 0})}}),c.jsxs(zf,{gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(WF,{id:"color-formatting",label:"gradient"===l?p("start_color","Start Color"):p("color","Color"),currentValue:g,setColor:function(e){return v({ruleValue:e})}})}),c.jsx(_f,{flex:1,children:"gradient"===l&&i&&F.supportedFeatures.colorGradient&&c.jsx(WF,{id:"color-formatting-end",label:p("end_color","End Color"),currentValue:null!=b?b:"#16A257",setColor:function(e){return v({ruleValueEnd:e})}})})]})]})})]})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:e.onClose,children:p("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return y()},disabled:x,children:p("save","Save")})]})})]})};function uk(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}var dk=Object.assign((function(){}),{Swatch:function(e){return c.jsx("span",{className:""+ck(e.color)})}}),ck=function(e){return As({backgroundColor:e,width:"1rem",height:"1rem",borderRadius:"0.125rem",display:"inline-block"})},pk=function(e){var t,n=md().textOverride,r=null==(t=e.rule.filters)?void 0:t[0][0],i=r.function,o=r.value,a=r.op,l=Yr(e.dataSet,r.field);return c.jsxs(zf,{alignItems:"center",as:"span",direction:"row",children:[c.jsx("span",{className:""+tu.text,dangerouslySetInnerHTML:{__html:n("display_conditional_format_configuration","If <strong>[[fieldName]] [[fieldFunction]]</strong> is <strong>[[operator]]</strong> <strong>[[value]]</strong> then color is",{fieldName:l.publicName,fieldFunction:i&&"none"!=i?"("+i+")":"",operator:a,value:o})}}),c.jsxs(_f,{as:"span",marginLeft:"0.5rem",height:"1rem",children:[c.jsx(dk.Swatch,{color:e.rule.ruleValue}),e.rule.ruleValueEnd&&c.jsx(dk.Swatch,{color:e.rule.ruleValueEnd})]})]})},fk=function(e){var n=t.useState(!1),r=n[0],i=n[1],o=md(),a=o.textOverride;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:o.mode,onOrderChange:function(t,n){var r=Iy([].concat(e.conditionalFormattingRules),t,n);e.onSetConditionalFormattingRules(r)},items:mk(e.queryEngineConfig,e.conditionalFormattingRules,e.dataSet,a,i),newItemBtn:{callToAction:a("add_condition","Add Condition"),onClick:function(){return i(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.conditionalFormattingRules)?n:[]);r.splice(t,1),e.onSetConditionalFormattingRules(r)}}),c.jsx(lk,{ruleType:e.ruleType,dataSet:e.dataSet,conditionalFormatting:"boolean"!=typeof r?r:void 0,show:!!r,onClose:function(){return i(!1)},measures:e.measure,dimension:e.dimension||[],onSave:function(t){var n=uk(r,e.conditionalFormattingRules,t);e.onSetConditionalFormattingRules(n),i(!1)},componentType:e.componentType,numberConditionalFormattingOnly:e.numberConditionalFormattingOnly})]})};function mk(e,t,n,r,o){return(null!=t?t:[]).map((function(t){var a;if(!i.isArray(t.filters)||i.isArray(t.filters),0===t.filters[0].length)return{title:r("error","Error"),subtext:r("invalid_rule","Invalid or broken rule")};var l=Me(null==(a=t.filters)?void 0:a[0][0].field,e);try{return{title:Yr(n,l.field).publicName,subtext:c.jsx(pk,{dataSet:n,rule:t,queryEngineConfig:e}),onClick:function(){return o(t)}}}catch(e){return{title:r("error","Error"),subtext:r("invalid_rule","Invalid or broken rule")}}}))}var hk=function(e){var t,n=e.section,r=e.attributes;return c.jsx(Fw,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsx(zf,{gap:"0.75rem",direction:"column",children:n.subSection?null==(t=n.subSection)?void 0:t.map((function(t,i){var o,a,l="bar"===t.propKey?r.barMeasure:"line"===t.propKey?r.lineMeasure:[];return c.jsxs("div",{children:[c.jsx(fv,{children:t.title}),c.jsx(fk,{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:l,dataSet:e.dataSet,conditionalFormattingRules:null!=(o=null==r||null==(a=r.conditionalFormattingRules)?void 0:a[t.propKey])?o:void 0,queryEngineConfig:e.queryEngineConfig,componentType:e.attributes.type,numberConditionalFormattingOnly:"line"===t.propKey})]},i)})):c.jsx(fk,{dimension:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)?[]: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,componentType:e.attributes.type,numberConditionalFormattingOnly:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)})})})},vk=function(e){var n,r,i=md(),o=i.dateTimeFormatOptions,a=i.textOverride;return c.jsx(Fw,{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==(r=r.subSection)?void 0:r.map((function(n,r){return c.jsxs(t.Fragment,{children:["time"===n.type&&c.jsx("div",{children:c.jsx(Sm,{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,textOverride:a})}),"fontSize"===n.type&&c.jsx(YF,{label:null==n?void 0:n.title,currentValue:e.attributes.fontSize,setText:function(t){return e.setAttributes({fontSize:t})}})]},r)}))})},gk=function(e,t){return t.map((function(t){return{label:Yr(e,t.field).publicName,value:_t(t)}}))};function bk(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],m=md().textOverride;return c.jsxs(kv,{isOpen:r,onClose:i,width:"sm",children:[c.jsx(kv.Header,{title:m("choose_a_prefix","Choose a prefix")}),c.jsxs(kv.Content,{children:[c.jsxs(Ov,{children:[c.jsx(fv,{children:m("field","Field")}),c.jsx(Sm,{options:gk(n,o),selected:s,onChange:function(e){return u(e)},textOverride:m})]}),c.jsx(YF,{label:m("prefix","Prefix"),currentValue:p,setText:f})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:i,children:m("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){s&&p&&(a({field:s,prefix:p}),i())},children:m("save","Save")})]})})]})}var xk=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1],l=md(),s=l.textOverride;return c.jsxs(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[c.jsx(xh,{mode:l.mode,items:(null!=(r=e.attributes.prefixes)?r:[]).map((function(t){var n=Re(t.field,e.queryEngineConfig),r=n.function;return{title:Yr(e.dataSet,n.fieldId).publicName+("none"!=r?" ("+e.queryEngineConfig.supportedAggregates[r].publicName+")":""),subtext:t.prefix}})),newItemBtn:{callToAction:s("add_prefix","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(bk,{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])})}})]})},yk=function(e){var t,n=md().textOverride;if("mercatorMap"!=e.attributes.type)return null;var r=e.attributes,o=r.backgroundColor,a=r.noDataColor,l=r.maxValueColor,s=r.minValueColor,u=i.debounce(e.setAttributes,200);return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsxs(Fw.Grid,{columns:2,children:[c.jsx("div",{children:c.jsx(WF,{id:"map-background-color",label:n("background","Background"),currentValue:o,setColor:function(e){return u({backgroundColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-no-data-color",label:n("no_data","No data"),currentValue:a,setColor:function(e){return u({noDataColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-min-value-color",label:n("min_value","Min value"),currentValue:s,setColor:function(e){return u({minValueColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-max-value-color",label:n("max_value","Max value"),currentValue:l,setColor:function(e){return u({maxValueColor:e})}})})]})})},wk={name:"135831l",styles:"font-size:0.75rem;line-height:1rem;opacity:0.8"},jk=function(e){var t,n,r=md(),i=r.numberFormatOptions,o=r.textOverride,a=r.labelFormat,l=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return c.jsxs(Fw,{title:null==e||null==(t=e.section)?void 0:t.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[0==e.attributes.measure.length&&c.jsx("p",{css:wk,children:o("stats_label_warning","Please select a metric on the data panel.")}),c.jsx(Fw.Container,{"data-component":"single-stats-labels",children:[].concat(e.attributes.measure).map((function(t,n){var r,i,o,s,u,d=gs(Yr(e.dataSet,t.field).publicName,null==(r=e.queryEngineConfig.supportedAggregates[t.function])?void 0:r.publicName),p=a({fieldId:t.field,func:t.function,type:e.attributes.type,defaultLabel:d,viewId:e.attributes.viewId,values:[Yr(e.dataSet,t.field).publicName]});return c.jsxs(Fw.Panel,{title:null!=p?p:d,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{id:"prefix_"+n,label:null==e||null==(i=e.section)?void 0:i.prefix.title,currentValue:e.attributes.prefixes?e.attributes.prefixes[_t(t)]:void 0,setText:function(n){var r,i=Q({},e.attributes.prefixes,((r={})[_t(t)]=n,r));e.setAttributes({prefixes:i})}}),c.jsx(YF,{id:"postfix_"+n,label:null==e||null==(o=e.section)?void 0:o.postfix.title,currentValue:e.attributes.postfixes?e.attributes.postfixes[_t(t)]:void 0,setText:function(n){var r,i=Q({},e.attributes.postfixes,((r={})[_t(t)]=n,r));e.setAttributes({postfixes:i})}})]}),c.jsx(Fw.Grid,{children:c.jsx(UF,{id:"format_"+n,options:l,currentValue:e.attributes.formatter&&e.attributes.formatter[_t(t)]||"_vizzly_number",onSelect:function(n){var r,i=Q({},e.attributes.formatter,((r={})[_t(t)]=n,r));e.setAttributes({formatter:i})},label:null!=(s=null==e||null==(u=e.section)||null==(u=u.format)?void 0:u.title)?s:"Format"})})]},n)}))})]})},Ck={value:void 0,strokeStyle:"dashed",strokeWidth:2,color:Ds(0),label:void 0},Sk=function(e){return!!ft().validate(e).error},Fk=function(e){return null!=e&&e.show?c.jsx(kk,Q({},e)):null},kk=function(e){var n=md().textOverride,r=function(e,n){var r=t.useState(null!=e?e:Ck),i=r[0],o=r[1];return t.useEffect((function(){o(e||Ck)}),[JSON.stringify(e)]),Q({},i,{handleUpsert:function(){n(i)},onChange:function(e){o(Q({},i,e))},disabled:Sk(i)})}(null==e?void 0:e.goalLine,null==e?void 0:e.onSave),i=r.value,o=r.onChange,a=r.color,l=r.disabled,s=r.handleUpsert;return c.jsxs(kv,{isOpen:!0,onClose:null==e?void 0:e.onClose,width:"xl",children:[c.jsx(kv.Header,{title:n("add_goal_line","Add Goal Line")}),c.jsx(kv.Content,{children:c.jsxs(Ud,{columns:["1fr","1fr"],gap:"1rem",children:[c.jsx(Ov,{children:c.jsx(Cj,{id:"goal-line-value",label:n("value","Value"),currentValue:i,setNumber:function(e){return o({value:e})}})}),c.jsx(WF,{id:"color-formatting",label:n("color","Color"),currentValue:a,setColor:function(e){return o({color:e})}})]})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:null==e?void 0:e.onClose,children:n("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return s()},disabled:l,children:n("save","Save")})]})})]})},_k=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=md(),l=a.textOverride;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:a.mode,onOrderChange:function(t,n){var r=Iy([].concat(e.goalLines),t,n);e.onSetGoalLineRules(r)},items:(null!=(n=e.goalLines)?n:[]).map((function(e){return{title:c.jsxs(zf,{alignItems:"center",gap:"0.25rem",children:[c.jsx(dk.Swatch,{color:e.color}),c.jsx("span",{dangerouslySetInnerHTML:{__html:l("goal_line_configuration","Set to <strong>[[ruleValue]]</strong>",{ruleValue:e.value})}})]}),onClick:function(){return o(e)}}})),newItemBtn:{callToAction:l("add_goal_line","Add Goal Line"),onClick:function(){return o(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.goalLines)?n:[]);r.splice(t,1),e.onSetGoalLineRules(r)}}),c.jsx(Fk,{show:!!i,goalLine:"boolean"!=typeof i?i:void 0,onClose:function(){return o(!1)},onSave:function(t){o(!1);var n=uk(i,e.goalLines,t);e.onSetGoalLineRules(n)}})]})},Tk=function(e){var t;return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(_k,{onSetGoalLineRules:function(t){return e.setAttributes({goalLines:t})},goalLines:e.attributes.goalLines})})},Ak=Object.assign((function(){return null}),{container:As({position:"relative"}),overlay:As({position:"absolute",inset:0,zIndex:2}),content:As({opacity:.5})}),Dk=function(e){return null!=e&&e.enabled?c.jsxs("div",{className:""+Ak.container,"aria-disabled":"true",children:[c.jsx("div",{className:""+Ak.overlay,children:(null==e?void 0:e.message)&&c.jsx(zf,{justifyContent:"center",alignItems:"center",height:"100%",className:""+Ak.overlay,children:c.jsx(_f,{marginX:"3.5rem",children:c.jsx("div",{style:{textAlign:"center"},children:null==e?void 0:e.message})})})}),c.jsx("div",{className:""+Ak.content,children:null==e?void 0:e.children})]}):c.jsx(t.Fragment,{children:null==e?void 0:e.children})},Ik=function(e){var n=md().textOverride;return c.jsx(t.Fragment,{children:c.jsxs(Fw.Grid,{children:[0===e.attributes.goals.length&&c.jsx(vy,{type:"info",title:n("progress.goals_need to be set","Goals need to be set")}),c.jsx(Dk,{enabled:0===e.attributes.goals.length,children:c.jsx(UF,{options:[{value:wr.Linear,label:n("linear","Linear")},{value:wr.Circular,label:n("circular","Circular")}],currentValue:OC(e.attributes.progressType),onSelect:function(t){var n=e.attributes.progressType.map((function(e){return Q({},e,{value:t})}));e.setAttributes({progressType:n})},label:n("type","Type")})})]})})},Ok=function(e){var t,n,r,i=md().textOverride;if(e.dataSet.preAggregated)return null;if(!dx(e.attributes.order,e.attributes.timeDimension))return null;var o=[{label:i("none","None"),value:null},{label:i("current","Current"),value:"current"}];return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(Sm,{id:"headline-options",label:i("options","Options"),labelHidden:!0,onChange:function(t){e.setAttributes({headline:{func:t}})},options:o,selected:null!=(n=null==(r=e.attributes.headline)?void 0:r.func)?n:null,textOverride:i,onClick:function(){uj("bottom","editor-panel")}})})},Pk=function(e){return c.jsx(zF,{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(ek,Q({},e,{section:r})),"progressType"===r.type&&c.jsx(Ik,Q({},e,{section:r})),"format"===r.type&&c.jsx(vk,Q({},e,{section:r})),"prefixes"===r.type&&c.jsx(xk,Q({},e,{section:r})),"axisLabels"===r.type&&c.jsx(ik,Q({},e,{section:r})),"mapColors"===r.type&&c.jsx(yk,Q({},e,{section:r})),"conditionalFormatting"===r.type&&c.jsx(hk,Q({},e,{section:r})),"goalLine"===r.type&&c.jsx(Tk,Q({},e,{section:r})),"chartStyles"===r.type&&c.jsx(nk,Q({},e,{section:r})),"headline"===r.type&&c.jsx(Ok,Q({},e,{section:r})),"statsLabels"===r.type&&c.jsx(jk,Q({},e,{section:r}))]},i)}))})},Ek=function(){var e=Ky(),t=md();if(!e)return c.jsx(nm,{});var n=Br(e.component.attributes.type,{queryEngineConfig:e.queryEngineConfig,textOverride:e.textOverride});return c.jsx(Il,{renderOnError:function(e){return c.jsx(dv,{onManualRetry:e})},onError:t.onError,children:c.jsx(Pk,{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(n.formatPanelConfig(),{type:e.component.attributes.type})})})};function Mk(e){var t=md().textOverride;return c.jsxs(Av.Group,{defaultIndex:e.defaultTabOpen||0,children:[c.jsxs(Av.List,{columns:"1fr 1fr",children:[c.jsx(Av.Button,{"data-component":"tab-data",children:t("editor.tab.heading.data","Data")}),c.jsx(Av.Button,{"data-component":"tab-format",children:t("editor.tab.heading.format","Format")})]}),c.jsxs(Av.Panels,{children:[c.jsx(Av.Panel,{children:c.jsx($F,{})}),c.jsx(Av.Panel,{children:c.jsx(Ek,{})})]})]})}var Rk=function(e){return yn(null==e?void 0:e.component.attributes)?null:c.jsx(_f,{paddingX:24,paddingTop:16,children:c.jsx(vy,{title:"Feedback",type:"info",children:xn(null==e?void 0:e.component.attributes)})})},Lk=Object.assign((function(){return null}),{panel:function(e){return As(Q({height:"100%",overflow:"overlay",padding:2===e?0:"0 8px",marginLeft:2===e?"-0.5rem":void 0},Ef))},view:As(Q({height:"100%",overflow:"overlay"},Ef))}),Nk=t.createContext(void 0),zk=t.forwardRef((function(e,n){var r,i,o,a=Xd(),l=t.useRef(null),s=function(){var e=l.current;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")};t.useImperativeHandle(n,(function(){return{focus:function(){var e;null==(e=l.current)||e.focus()}}})),t.useEffect((function(){l.current&&e.enableFocus&&l.current.focus()}),[]),t.useEffect((function(){s()}),[e.value]);var u=!e.submitDisabled&&"\n"!==e.value&&"\n\n"!==e.value;return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),c.jsxs(zf,{className:""+gm(null!=(r=null==e?void 0:e.inputTheme)?r:null==a||null==(i=a.forms)?void 0:i.input,null==e?void 0:e.error),alignItems:"flex-start",maxHeight:200,children:[c.jsx("textarea",{id:null==e?void 0:e.id,ref:l,className:""+qk({isDisabled:null!=e&&e.disabled?"true":"false"}),"data-themeapi":"forms.input","data-chipposition":"above.right",onKeyDown:function(t){"Enter"===t.key&&!t.shiftKey&&u&&(t.preventDefault(),e.handleSubmit())},disabled:null==e?void 0:e.disabled,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.placeholder,onChange:null==e?void 0:e.onChange,rows:1,onInput:s,onFocus:null==e?void 0:e.onFocus,onBlur:null==e?void 0:e.onBlur}),c.jsx("button",{"aria-label":null==e?void 0:e.submit.label,onClick:null==e?void 0:e.handleSubmit,className:""+Bk(null==a?void 0:a.icons),children:c.jsx("span",{children:null!=(o=e.submit.icon)?o:null==e?void 0:e.submit.label})})]})]})})),qk=As(Q({flex:1,border:"none",background:"transparent",marginRight:6,resize:"none",lineHeight:"1.5",maxHeight:180,"&:focus":{outline:"none"},fontStyle:"inherit",fontSize:"inherit",fontFamily:"inherit"},Ef,{variants:{isDisabled:{true:{opacity:.5}}}})),Bk=function(e){var t;return As({border:"none",background:"transparent",cursor:"pointer",padding:0,paddingBottom:2,alignSelf:"flex-end","&:focus":{outline:"none"},"&[disabled]":{cursor:"initial"},"& svg":{fill:null==e?void 0:e.color,"&:hover":{fill:null==e||null==(t=e["&:hover"])?void 0:t.color}}})},Wk=function(e){var t=md().textOverride;return c.jsxs(zf,{children:[e.onReload&&c.jsx(Vk,{label:t("refetch_response","Refetch response"),icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"18",height:"18",children:c.jsx("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})}),onChange:e.onReload,"data-id":e["data-id"]+"-reload"}),e.onThumbsUp&&c.jsx(Vk,{label:t("ai.good_response","Good response"),icon:c.jsx(e.thumbsUp?zd:Nd,{}),onChange:e.onThumbsUp,"data-id":e["data-id"]+"-thumbs-up","data-selected":e.thumbsUp?"true":"false"}),e.onThumbsDown&&c.jsx(Vk,{label:t("ai.bad_response","Bad response"),icon:c.jsx(e.thumbsDown?Bd:qd,{}),onChange:e.onThumbsDown,"data-id":e["data-id"]+"-thumbs-down","data-selected":e.thumbsUp?"true":"false"}),e.onSelect&&c.jsx(Vk,{label:t("show_this_change","Show this change"),onChange:e.onSelect,icon:c.jsx(Wd,{}),"data-id":e["data-id"]+"-select"})]})},Vk=function(e){var t=Xd();return c.jsx(_f,{children:c.jsx(ih,{tooltipContent:function(){return e.label},children:c.jsx("button",{onClick:function(){return e.onChange()},"aria-label":e.label,className:""+Hk(null==t?void 0:t.icons),"data-testid":e["data-id"],"data-select":e["data-selected"],children:e.icon})})})},Hk=function(e){var t;return As(Q({border:"none",background:"transparent",cursor:"pointer",padding:0,width:30,height:30,borderRadius:"50%",stroke:null==e?void 0:e.color},Ts,{"&:hover":Q({},Ts,{stroke:null==e||null==(t=e["&:hover"])?void 0:t.color})}))},Yk=function(e){return e.User="user",e.AI="ai",e}({}),Uk=function(e){return e.WaitingForMessage="waitingForMessage",e.Thinking="thinking",e}({}),Gk=function(e){return e.ThumbsUp="thumbs_up",e.ThumbsDown="thumbs_down",e}({}),Kk=function(e){return e.Warning="warning",e.Critical="critical",e.Info="info",e}({}),Xk=function(e){var t=md();return c.jsx(Qk,Q({},e,{label:(0,t.textOverride)("ai.you","You"),icon:c.jsx(Md,{width:16,height:16})}))},Qk=function(e){var t=Xd();return c.jsxs(Ud,{columnGap:"0.5rem",as:"li",areas:'"icon title"\n "empty content"',columns:["max-content","1fr"],children:[c.jsx(_f,{width:30,area:"icon",children:c.jsx("div",{className:""+Jk(null==t?void 0:t.ai),"data-conversationid":e.id,children:e.icon})}),c.jsx(_f,{area:"title",alignSelf:"end",children:c.jsx(vm,{as:"p",children:e.label})}),c.jsxs(_f,{area:"content",children:[e.loading&&c.jsx(_f,{width:40,paddingY:8,children:c.jsx(im,{color:"#3074d9"})}),!e.loading&&e.message&&c.jsxs(zf,{gap:"0.5rem",direction:"column",children:[c.jsx(_f,{children:e.message}),e.options&&c.jsx(Wk,Q({},e.options))]})]})]})},Jk=function(e){var t,n,r;return As({border:null==e||null==(t=e.avatar)?void 0:t.border,width:30,height:30,borderRadius:"50%",backgroundColor:null==e||null==(n=e.avatar)?void 0:n.background,display:"flex",alignItems:"center",justifyContent:"center","& svg":{fill:null==e||null==(r=e.avatar)?void 0:r.color}})},Zk=Object.assign({},{Replies:function(e){return e.sender_type===Yk.AI?c.jsx(Qk,{message:e.content,label:"Vizzly AI",icon:c.jsx(Rd,{}),onTypingEnd:e.onTypingEnd,options:e.options,id:e.id}):c.jsx(Xk,{message:e.content,id:e.id})},Loading:function(){return c.jsx(Qk,{label:"Vizzly AI",icon:c.jsx(Mu,{width:20,height:20}),loading:!0,id:"loading"})},Reply:Qk,You:Xk}),$k={conversationId:void 0,message:"",messageState:Uk.WaitingForMessage,messageHistory:[]},e_=["How could I improve this visualisation?","Show me a line chart."],t_=t.createContext({}),n_=function(e){var n=t.useState(void 0),r=n[0],i=n[1],o=t.useState(!1),a=o[0],l=o[1],s=function(){var t=X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l(!0),a||r){t.next=15;break}return t.prev=2,t.next=5,e.fetchSuggestions();case 5:i(t.sent),l(!1),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),Ae(t.t0),i(e_),l(!1);case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(){return t.apply(this,arguments)}}();return c.jsx(t_.Provider,{value:{onAsk:e.onAsk,onAction:e.onAction,suggestions:r,fetchSuggestions:s},children:e.children})},r_=function(){return t.useContext(t_)},i_=function(e){var t=r_().suggestions,n=md().textOverride,r=Xd();return c.jsxs(_f,{as:"li",children:[c.jsx(_f,{as:"p",paddingBottom:"0.25rem",children:n("ai.ask_a_question_or_pick_a_suggestion","Ask a question or pick a suggestion:")}),c.jsxs(zf,{as:"ul",padding:0,margin:0,gap:"0.75rem",direction:"column",children:[!t&&c.jsx(_f,{as:"li",width:40,paddingY:8,children:c.jsx(im,{color:"#3074d9"})}),null==t?void 0:t.map((function(t,n){return c.jsx(_f,{as:"li",listStyle:"none",children:c.jsx("button",{className:""+o_(null==r?void 0:r.ai),onClick:function(){return e.onChange(t)},children:t})},n)}))]})]})},o_=function(e){var t,n,r,i,o,a,l,s;return As({border:null==e||null==(t=e.suggestions)?void 0:t.border,background:null==e||null==(n=e.suggestions)?void 0:n.background,color:null==e||null==(r=e.suggestions)?void 0:r.color,padding:null==e||null==(i=e.suggestions)?void 0:i.padding,borderRadius:null==e||null==(o=e.suggestions)?void 0:o.borderRadius,cursor:"pointer",minHeight:40,textAlign:"left",width:"100%","&:focus":{outline:"none"},"&:hover":{background:null==e||null==(a=e.suggestions)||null==(a=a["&:hover"])?void 0:a.background,color:null==e||null==(l=e.suggestions)||null==(l=l["&:hover"])?void 0:l.color,border:null==e||null==(s=e.suggestions)||null==(s=s["&:hover"])?void 0:s.border}})},a_=function(e){var r,i,o,a,l,s,u,d=md().textOverride,p=n.useState(!1),f=p[0],m=p[1],h=t.useRef(null),v=(i=t.useRef(r=e.attributes),t.useEffect((function(){i.current=r}),[]),i.current),g=r_(),b=g.onAction,x=function(e,n,r,i){var o=t.useRef(null),a=t.useState($k),l=a[0],s=a[1],u=t.useState(void 0),d=u[0],c=u[1],p=t.useCallback((function(e){s((function(t){return Q({},t,{message:e})})),c(void 0)}),[]),f=t.useCallback(function(){var t=X(G().mark((function t(a){var u,d,p,f,m,h,v,g;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c(void 0),o.current&&o.current.abort(),o.current=new AbortController,void 0!==a&&void 0!==a.message&&(u=a.message,s((function(e){return Q({},e,{message:u})}))),t.prev=4,!n||l.messageState===Uk.Thinking){t.next=16;break}return s((function(e){return Q({},e,{messageState:Uk.Thinking})})),t.next=9,n(null!=(d=null==a?void 0:a.message)?d:l.message,l.conversationId,e,o.current.signal);case 9:return m=(p=t.sent).conversationId,h=p.messageHistory,v=Br((f=p.attributes).type,{queryEngineConfig:r}),g=v.init(f.dataSetId,f),s(Q({},l,{conversationId:m,messageHistory:h,message:""})),i(g),t.abrupt("return",{status:"success"});case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),t.t0 instanceof vo?c({error:Kk.Info,message:"We stopped your question from being sent."}):t.t0 instanceof mo?c({error:Kk.Warning,message:t.t0.message}):t.t0 instanceof ho||t.t0 instanceof uo?c({error:Kk.Critical,message:t.t0.message}):Ae(t.t0),s((function(e){return Q({},e,{messageState:Uk.WaitingForMessage})}));case 22:return t.abrupt("return",{status:"failed"});case 23:case"end":return t.stop()}}),t,null,[[4,18]])})));return function(e){return t.apply(this,arguments)}}(),[n,l.message,l.messageState,e]);return Q({send:f,setMessage:p},l,{feedback:d,reset:function(){s($k),c(void 0)}})}(e.attributes,g.onAsk,e.queryEngineConfig,e.setAttributes),y=function(e,n){var r=t.useState({reactions:[]}),i=r[0],o=r[1],a=t.useCallback(function(){var t=X(G().mark((function t(r,i){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e||!n){t.next=6;break}return t.next=4,e(n,r,{reaction:i});case 4:t.sent.success&&o((function(e){return Q({},e,{reactions:[].concat(e.reactions||[],[{messageId:r,reaction:i}])})}));case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error sending AI reaction",t.t0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n){return t.apply(this,arguments)}}(),[e,n,i]);return Q({sendReaction:a},i)}(b,x.conversationId),w=x.messageState,j=x.messageHistory,C=x.message,S=x.feedback,F=(o=C,a=t.useRef(null),s=(l=t.useState(0))[0],u=l[1],t.useEffect((function(){var e=function(){u(a.current?a.current.clientHeight:0)};return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}),[o]),[a,s]),k=F[0],_=F[1],T=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&(e.current.scrollTop=e.current.scrollHeight)})),e}();return t.useEffect((function(){var e;w!==Uk.Thinking&&(null==(e=h.current)||e.focus())}),[w]),e.closed?null:c.jsxs(zf,{direction:"column",height:"100%",gap:"1.5rem",children:[e.closeAI&&c.jsxs(Dv,{buttons:"space-between",children:[c.jsx(Ch,{onClick:function(){return e.closeAI&&e.closeAI()},suppressed:!0,icon:{Icon:function(){return c.jsx(Vd,{})}},children:d("back_to_editor","Back to Editor")}),c.jsx(Ch,{onClick:function(){return m(!0)},children:d("new_chat","New Chat")})]}),c.jsxs(_f,{position:"relative",height:"100%",children:[c.jsx(_f,{height:0,children:c.jsx(Jw,{onClose:function(){var t=X(G().mark((function t(n){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n&&(x.reset(),e.setAttributes(v)),m(!1),t.abrupt("return",!0);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),message:d("ai.new_chat_modal_message","Are you sure you want to start a new chat? This will delete all your current changes."),show:f,deleteButtonLabel:d("ai.new_chat_modal_cta","Start new chat")})}),c.jsx("div",{className:""+s_(_),ref:T,children:c.jsx(zf,{gap:"2rem",direction:"column",overflow:"overlay",children:c.jsxs(zf,{gap:"1.25rem",direction:"column",as:"ul",padding:0,margin:0,children:[w!==Uk.Thinking&&(!j||0===(null==j?void 0:j.length))&&c.jsx(i_,{onChange:function(e){return x.send({message:e})}}),w===Uk.Thinking&&(!j||0===(null==j?void 0:j.length))&&c.jsxs(t.Fragment,{children:[c.jsx(Zk.You,{message:C,id:"thinking"}),void 0===S&&c.jsx(Zk.Loading,{})]}),j.length>0&&c.jsxs(t.Fragment,{children:[null==j?void 0:j.map((function(e,n){var r,i=null==(r=y.reactions)?void 0:r.filter((function(t){return t.messageId===e.id})),o=void 0;return console.log("ai",x),e.sender_type===Yk.AI&&void 0===S&&(o={onThumbsUp:x.conversationId?function(){return y.sendReaction(e.id,Gk.ThumbsUp)}:void 0,onThumbsDown:x.conversationId?function(){return y.sendReaction(e.id,Gk.ThumbsDown)}:void 0,thumbsUp:null==i?void 0:i.some((function(e){return e.reaction===Gk.ThumbsUp})),thumbsDown:null==i?void 0:i.some((function(e){return e.reaction===Gk.ThumbsDown})),"data-id":e.id}),c.jsx(t.Fragment,{children:c.jsx(Zk.Replies,Q({},e,{content:e.content,options:o}))},n+"_"+e.id)})),w===Uk.Thinking&&c.jsxs(t.Fragment,{children:[c.jsx(Zk.You,{message:C,id:"thinking"}),void 0===S&&c.jsx(Zk.Loading,{})]})]})]})})}),c.jsx("div",{className:""+l_,ref:k,children:c.jsxs(zf,{gap:"1rem",direction:"column",children:[S&&c.jsx(vy,{title:S.message,type:S.error}),c.jsxs(zf,{gap:"0.5rem",direction:"column",children:[c.jsx(zk,{ref:h,id:"input",label:"Message Vizzly",placeholder:d("ai.ask_me_a_question","Ask me a question..."),value:C,onChange:function(e){return x.setMessage(e.currentTarget.value)},labelHidden:!0,handleSubmit:X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.send();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),submitDisabled:!C||w===Uk.Thinking,enableFocus:!0,disabled:w===Uk.Thinking,submit:w===Uk.Thinking?{label:d("stop_question","Stop Question"),icon:c.jsx(Ed,{})}:{label:d("submit_question","Submit Question"),icon:c.jsx(Pd,{})}}),c.jsx(_f,{as:"p",className:tu.textSize("xs")+" "+tu.color(Ds(50)),margin:0,padding:0,paddingLeft:"0.5rem",children:d("ai.ai_may_hallucinate","Responses may be inaccurate; verify details in the Editor.")})]})]})})]})]})},l_=As({position:"absolute",left:0,right:0,bottom:0}),s_=function(e){return As(Q({position:"absolute",left:0,top:0,right:0,overflowY:"scroll",bottom:e,paddingBottom:"1.5rem"},Ef))},u_=function(e){return c.jsx(a_,Q({},e))},d_=function(e){var r,o,a=Ky(),l=n.useState(!1),s=l[0],u=l[1],d=t.useContext(Nk),p=r_().fetchSuggestions,f=md().textOverride,m=Xd();if(!a)return c.jsx(nm,{});var h=a.setAttributes,v=a.dashboard,g=a.setResults,b=a.mode,x=a.origin,y=a.componentEditor,w=a.runQueriesCallback,j=a.component,C=a.dispatch,S=a.trackEvent,F=a.dataSet,k=a.queryEngineConfig,_=null==d?void 0:d.active,T="boolean"==typeof(null==m||null==(r=m.modals)||null==(r=r.options)||null==(r=r.showTitle)?void 0:r.editor)&&!(null!=m&&null!=(o=m.modals)&&null!=(o=o.options)&&null!=(o=o.showTitle)&&o.editor),A=(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(vv,{title:f("editor","Editor"),"data-component":"editor-header",hide:T}),c.jsx(bv,{"data-component":"editor-content",children:c.jsx(_f,{height:"40rem",width:"100%",children:c.jsxs(Ud,{columns:["24rem","1fr"],height:"100%",children:[!s&&c.jsx("div",{id:"editor-panel",className:""+Lk.panel(null==m?void 0:m.version),children:c.jsx(Mk,{})}),_&&c.jsx(u_,{closeAI:function(){return u(!1)},dataSet:F,attributes:j.attributes,setAttributes:h,queryEngineConfig:k,closed:!s}),c.jsxs(Ud,{rows:["1fr","100px"],className:""+Lk.view,children:[c.jsx(_f,{paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:c.jsx(zC,{id:"editor_"+Math.floor(1e11*Math.random()),isBeingSizeAdjusted:!1,setLocalFilters:a.setLocalFilters,setParameterUpdate:a.setParameterUpdate,runQueriesCallback:w,setResults:g,component:j,updateComponentAttributes:h,editor:!0,cellWidth:784})}),c.jsx(Rk,{component:j})]})]})})}),c.jsxs(gv,{buttons:_?"space-between":"end","data-component":"editor-footer",children:[_&&c.jsx(Dv,{children:c.jsx(Dk,{enabled:s,children:c.jsx(Fh,{secondary:!0,onClick:function(){return u(!0)},icon:{Icon:function(){return c.jsx(Ld,{})}},onMouseEnter:function(){p&&p()},children:f("ask_ai","Ask AI")})})}),c.jsxs(Dv,{buttons:"end",children:[c.jsx(Fh,{secondary:!0,onClick:function(){S("editor.changesCancelled"),e.onClose?e.onClose():C({type:"clearModal"}),u(!1)},children:A?f("cancel","Cancel"):f("close","Close")}),A&&c.jsx(Fh,{onClick:function(){S("editor.changesConfirmed"),C({type:"saveComponent",protectedComponent:"library"===x&&"admin"===b}),u(!1)},children:c_(b,f,x,(null==y?void 0:y.target.libraryIndex)!==v.componentLibrary.length)})]})]})]})};function c_(e,t,n,r){return"library"===n&&r?t("save","Save"):"library"===n?t("add_to_library","Add to Library"):"endUser"===e?t("save","Save"):t("confirm","Confirm")}var p_=function(e){var t=Xd();return c.jsxs("button",{onClick:e.onChange,disabled:null==e?void 0:e.disabled,className:Hd(""+f_(null==t?void 0:t.icons),e.className),children:[c.jsx("span",{className:""+eu,children:e.label}),e.children]})},f_=function(e){var t,n;return As(Q({},nu.button,{color:null==e?void 0:e.color,borderRadius:null==e?void 0:e.borderRadius,padding:null==e?void 0:e.padding,width:null==e?void 0:e.width,height:null==e?void 0:e.height,"&:hover":{background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}}))},m_=function(e){var n=Rm().dispatch,r=md(),i=r.onReset,o=r.textOverride,a=t.useState(!1),l=a[0],s=a[1],u=function(){var t=X(G().mark((function t(){var r;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(!0),t.next=3,i();case 3:(r=t.sent)&&n({type:"setDashboard",dashboard:r}),s(!1),null==e||e.onClose();case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=t.useState(!1),p=d[0],f=d[1];return t.useEffect((function(){e.show||(f(!1),s(!1))}),[e.show]),c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:o("confirm_reset","Confirm Reset"),show:!0}),c.jsx(kv.Content,{children:c.jsx(HF,{label:o("delete_all_dashboard_content","Any change you have made will be lost and the default dashboard will be restored."),setChecked:function(e){return f(e)},currentValue:p,id:"reset-dashboard",checkboxPosition:"top"})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},disabled:l,children:o("cancel","Cancel")}),c.jsx(Ch,{onClick:function(){p&&u()},disabled:!p||l,primary:!0,children:o("reset_dashboard","Reset Dashboard")})]})})]})},h_=function(e){var t=md(),n=t.textOverride;return!1===t.featureToggles.showResetButton?null:c.jsx(ih,{tooltipContent:function(){return n("reset_dashboard_to_default","Reset dashboard to default")},children:c.jsx(p_,{label:n("reset","Reset"),onChange:e.onChange,className:"vizzly_reset-button",disabled:null==e?void 0:e.disabled,children:c.jsx(Ku,{})})})},v_=function(e){return e[e.LOW=1]="LOW",e[e.NORMAL=2]="NORMAL",e[e.MEDIUM=3]="MEDIUM",e[e.HIGH=7]="HIGH",e[e.EXTREME=12]="EXTREME",e}({}),g_=function(e){return e[e.NONE=0]="NONE",e[e.SMALL=5]="SMALL",e[e.MEDIUM=10]="MEDIUM",e[e.LARGE=25]="LARGE",e}({}),b_={orientation:"portrait",format:"A4",margin:g_.NONE},x_=function(e){var n=t.useState(!1),r=n[0],i=n[1],o=md().textOverride,a=t.useState(b_),l=a[0],s=a[1];return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:o("download_dashboard_to_pdf","Download dashboard to PDF"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx("p",{children:o("pdf_download.description","Download the dashboard you see in this view.")}),c.jsx(sy,{options:[{label:o("pdf_download.page.orientation.portrait","Portrait"),value:"portrait"},{label:o("pdf_download.page.orientation.landscape","Landscape"),value:"landscape"}],name:"page-orientation",label:o("pdf_download.page.orientation","Orientation"),selected:l.orientation,labelHidden:!0,onChange:function(e){return s(Q({},l,{orientation:e}))}})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:o("cancel","Cancel")}),c.jsx(Fh,{primary:!0,onClick:function(){i(!0),kS().then((function(){i(!1),null==e||e.onClose(l)}))},disabled:r,children:o("download","Download")})]})})]})},y_=function(e){var n=md().textOverride;return c.jsxs(t.Fragment,{children:[e.showLabel&&c.jsx(Fh,{secondary:!0,onClick:e.onChange,disabled:e.disabled,children:c.jsxs(zf,{gap:"0.25rem",children:[c.jsx(Ad,{})," ",n("download_dashboard_to_pdf.button","Download to PDF")]})}),!e.showLabel&&c.jsx(ih,{tooltipContent:function(){return n("download_dashboard_to_pdf","Download dashboard to PDF")},children:c.jsx(p_,{onChange:e.onChange,disabled:e.disabled,label:n("download_dashboard_to_pdf.button","Download to PDF"),className:""+tu.pt(6),children:c.jsx(Ad,{})})})]})},w_=3.77952755906,j_={method:"save",resolution:v_.MEDIUM,page:{margin:g_.NONE,format:"A4",orientation:"portrait"},canvas:{mimeType:"image/jpeg",qualityRatio:1,useCORS:!0,logging:!1},overrides:{}},C_=function(){function e(e,t){var n,r,i,o,a;this.pdf=void 0,this.canvas=void 0,this.options=void 0,this.canvas=e,this.options=t,this.pdf=new H(Q({format:null!=(n=null==(r=this.options)||null==(r=r.page)?void 0:r.format)?n:j_.page.format,orientation:null!=(i=null==(o=this.options)||null==(o=o.page)?void 0:o.orientation)?i:j_.page.orientation},null==(a=this.options.overrides)?void 0:a.pdf,{unit:"mm"}))}var t=e.prototype;return t.getMarginTopMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginLeftMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginRightMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginBottomMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginTop=function(){return this.getMarginTopMM()*w_},t.getMarginBottom=function(){return this.getMarginBottomMM()*w_},t.getMarginLeft=function(){return this.getMarginLeftMM()*w_},t.getMarginRight=function(){return this.getMarginRightMM()*w_},t.getScale=function(){var e;return null!=(e=this.options.resolution)?e:j_.resolution},t.getPageHeight=function(){return this.getPageHeightMM()*w_},t.getPageHeightMM=function(){return this.pdf.internal.pageSize.height},t.getPageWidthMM=function(){return this.pdf.internal.pageSize.width},t.getPageWidth=function(){return this.getPageWidthMM()*w_},t.getOriginalCanvasWidth=function(){return this.canvas.width/this.getScale()},t.getOriginalCanvasHeight=function(){return this.canvas.height/this.getScale()},t.getCanvasPageAvailableHeight=function(){return this.getPageAvailableHeight()*this.getScale()*this.getHorizontalFitFactor()},t.getPageAvailableWidth=function(){return this.getPageWidth()-(this.getMarginLeft()+this.getMarginRight())},t.getPageAvailableHeight=function(){return this.getPageHeight()-(this.getMarginTop()+this.getMarginBottom())},t.getPageAvailableWidthMM=function(){return this.getPageAvailableWidth()/w_},t.getPageAvailableHeightMM=function(){return this.getPageAvailableHeight()/w_},t.getNumberPages=function(){return Math.ceil(this.canvas.height/this.getCanvasPageAvailableHeight())},t.getHorizontalFitFactor=function(){return this.getPageAvailableWidth()<this.getOriginalCanvasWidth()?this.getOriginalCanvasWidth()/this.getPageAvailableWidth():1},t.getCanvasOffsetY=function(e){return this.getCanvasPageAvailableHeight()*(e-1)},t.getCanvasHeightLeft=function(e){return this.canvas.height-this.getCanvasOffsetY(e)},t.getCanvasPageHeight=function(e){if(this.canvas.height<this.getCanvasPageAvailableHeight())return this.canvas.height;var t=this.getCanvasHeightLeft(e);return t<this.getCanvasPageAvailableHeight()?t:this.getCanvasPageAvailableHeight()},t.getCanvasPageWidth=function(){return this.canvas.width},t.createCanvasPage=function(e){var t=this.getCanvasPageWidth(),n=this.getCanvasPageHeight(e),r=document.createElement("canvas");r.setAttribute("width",String(t)),r.setAttribute("height",String(n));var i=r.getContext("2d");return i&&i.drawImage(this.canvas,0,this.getCanvasOffsetY(e),this.canvas.width,n,0,0,this.canvas.width,n),r},t.convert=function(){for(var e=1,t=this.getNumberPages();e<=t;){var n,r,i,o,a,l,s,u;e>1&&this.pdf.addPage(null!=(a=null==(l=this.options)||null==(l=l.page)?void 0:l.format)?a:j_.page.format,null!=(s=null==(u=this.options)||null==(u=u.page)?void 0:u.orientation)?s:j_.page.orientation);var d=this.createCanvasPage(e),c=d.toDataURL(null!=(n=null==(r=this.options.canvas)?void 0:r.mimeType)?n:j_.canvas.mimeType,null!=(i=null==(o=this.options.canvas)?void 0:o.qualityRatio)?i:j_.canvas.qualityRatio);this.pdf.setPage(e),this.pdf.addImage({imageData:c,width:d.width/(this.getScale()*w_*this.getHorizontalFitFactor()),height:d.height/(this.getScale()*w_*this.getHorizontalFitFactor()),x:this.getMarginLeftMM(),y:this.getMarginTopMM()}),e+=1}return this.pdf},e}(),S_=function(e){return e?Q({},j_,e,{canvas:Q({},j_.canvas,e.canvas),page:Q({},j_.page,e.page)}):j_},F_=function(e){return e()},k_=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l,s,u,d,c,p,f;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=S_(n),o=F_(t)){e.next=4;break}throw new Error("Target element not found");case 4:return a=Q({useCORS:i.canvas.useCORS,logging:i.canvas.logging,scale:i.resolution},i.overrides.canvas),e.next=7,V(o,a);case 7:if(l=e.sent,null==n||!n.header){e.next=15;break}if(!(u=F_(null==n?void 0:n.header))){e.next=15;break}return e.next=13,V(u,a);case 13:s=__(s,e.sent,l);case 15:d=new C_(null!=(r=s)?r:l,i),c=d.convert(),e.t0=i.method,e.next="build"===e.t0?20:"open"===e.t0?21:23;break;case 20:return e.abrupt("return",c);case 21:return window.open(c.output("bloburl"),"_blank"),e.abrupt("return",c);case 23:return f=null!=(p=i.filename)?p:(new Date).getTime()+".pdf",e.next=26,c.save(f,{returnPromise:!0});case 26:return e.abrupt("return",c);case 27:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function __(e,t,n){e=document.createElement("canvas");var r=(t?t.height:0)+n.height,i=Math.max(t?t.width:0,n.width);e.width=i,e.height=r;var o=e.getContext("2d");return o&&(o.clearRect(0,0,i,r),t&&o.drawImage(t,0,0),o.drawImage(n,0,t?t.height:0)),e}var T_=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,A_=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,D_=/on[a-z]+\s*=\s*["'][^"']*["']/gi,I_=/javascript:[^\s"']+/gi;function O_(e){return X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,k_((function(){return document.getElementById("vizzly_dashboard_content")}),{method:"save",filename:"dashboard.pdf",page:null==e?void 0:e.page,header:function(){return document.getElementById("vizzly_dashboard_header")}});case 2:case"end":return t.stop()}}),t)})))}var P_,E_,M_=function(e){var t,n=e.pdfSettings,r=null==(t=document.getElementById("vizzly_dashboard_content"))?void 0:t.offsetWidth;if(null!=n&&n.header&&function(e){return function(e){return T_.test(e)||A_.test(e)||D_.test(e)||I_.test(e)}(e)}(null==n?void 0:n.header))throw new Error("Invalid content: potentially malicious elements detected.");return null!=n&&n.header?c.jsx("div",{dangerouslySetInnerHTML:{__html:(null==n?void 0:n.header)||""},id:"vizzly_dashboard_header",style:{position:"absolute",left:-9999,width:r}}):null},R_=function(){var e=t.useState(!1),n=e[0],r=e[1],o=t.useState(!1),a=o[0],l=o[1],s=Rm(),u=s.dashboard,d=s.dispatch,p=s.componentEditor,f=s.pickFromComponentLibrary,m=s.trackEvent,h=md(),v=h.maxCSVDownloadLimit,g=h.featureToggles,x=h.scope,y=h.isProgrammaticParent,w=h.textOverride,j=h.pdfSettings,C=h.containerWidth,S=h.componentOverrides,F=dC(JSON.stringify(u)),k=F[0],_=F[1],T=t.useState(!1),A=T[0],D=T[1];t.useEffect((function(){if(!window.disableViewCheck){var e=function(){D(!0),setTimeout((function(){return D(!1)}),1e3)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}),[]);var I=function(e,t){m("library.open"),d({type:"startPickingComponentFromLibraryForDisplay",rowIndex:e,cellIndex:t})},O=function(e,t){m("manageDisplay.removeCell"),d({type:"removeCell",rowIndex:e,cellIndex:t})},P=function(e,t){d({type:"startEditingComponent",displayTarget:{rowIndex:e,cellIndex:t},libraryIndex:null,component:null})},E=null!=p||null!=f,M="neither",R=void 0;null!=p?(M="editor",R="modal-editor"):null!=f&&(M="library",R="modal-library");var L=g.showGlobalFilters,N=g.canAddNewRows,z=function e(t){return i.isArray(t)?i.every(t,e):!t.requiresValue||!(!t.requiresValue||!t.value)}(u.globalFilters);z||Fe("Required dashboard filters do not have values, so the display of the dashboard will not render.",u.globalFilters);var q=g.canDownloadPDF,W="read"===x,V=W&&!q,H=(null==j?void 0:j.generatingPDF)||0===u.globalFilters.length&&V,Y=(W||!q)&&u.globalFilters.length>0?["1fr"]:W||!1===N?["auto"]:["32px","auto"],U=!1===g.canAddNewCells?["1fr","auto"]:Y;return c.jsxs(b.DndProvider,{backend:B.HTML5Backend,children:[!(null!=j&&j.generatingPDF)&&c.jsx(wF,{isProgrammaticParent:y}),c.jsxs(_f,{padding:"0.25rem","data-component":"dashboard",overflow:"hidden",className:"vizzly-studio",children:[c.jsx(_f,{marginLeft:1+(N?32:0),"data-component":"width-detection",children:c.jsx("div",{ref:k,style:{width:"100%",height:0},"data-width":_})}),c.jsx(jF,{children:c.jsxs(_f,{position:"relative",children:[A&&c.jsx(nm,{override:S.renderLoadingComponent}),c.jsx("div",{style:A?{display:"none"}:{display:"block"},children:c.jsxs(Ud,{rows:H?["auto"]:L_(),columns:U,gap:8,className:Qf("dashboard"),"data-component":"dashboard-grid",children:[!H&&c.jsxs(zf,{gridRow:1,gap:"16px","data-component":"action-bar",className:""+N_(x),justifyContent:"space-between",gridArea:!1===g.canAddNewCells?"1 / 1 / 2 / 2":void 0,children:[c.jsx(_f,{flexGrow:1,paddingLeft:W||!1===g.canAddNewCells?"0.5rem":void 0,"data-component":"action-bar-filters",children:L&&c.jsx(aS,{})}),!V&&c.jsxs(zf,{gap:"0.25rem",width:"auto",paddingTop:4,"data-component":"action-bar-tools",children:[q&&c.jsx(y_,{onChange:function(){return r(!0)},disabled:!0===n,showLabel:"read"===x&&(!1===L||0===u.globalFilters.length)}),"read_write"===x&&c.jsx(h_,{onChange:function(){return l(!0)}})]})]}),z&&c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{gridColumn:"span 2/span 2",gridRow:2},"data-component":"panels",id:"vizzly_dashboard_content",children:u.display.map((function(e,t){var r,i;return c.jsx(dF,{maxCSVDownloadLimit:v,onCreateNew:P,onPickFromLibrary:I,onRemoveCell:O,rowIndex:t,trackEvent:m,displayRow:u.display[t],generatingPDF:null!=(r=null==j?void 0:j.generatingPDF)?r:!0===n,containerWidth:null!=C?C:_,onColSpanChange:function(e){d({type:"setColSpans",colSpans:e,rowIndex:t})},canAddNewCells:(i=e,g.canAddNewCells&&i.components.length<6),columns:Y,onAppendCell:function(){return function(e){m("manageDisplay.appendCell"),d({type:"appendCell",rowIndex:e})}(t)},onAddHeaderRow:function(){return function(e){d({type:"addHeaderRow",rowIndex:e,initialTitle:w("header.new_header","New Header")})}(t)},hideAddNewHeaderRow:HS(u.display,t)},"dashboard_"+u.id+"_row_"+t)}))}),u.display.length<u.theme.rowLimit&&g.canAddNewRows&&c.jsx(zf,{alignItems:"stretch",gridRow:3,gridColumn:2,paddingRight:28,"data-component":"add-row",children:c.jsx($S,{label:w("add_row","Add Row"),onChange:function(){var e;e=u.display.length,m("manageDisplay.newRow"),d({type:"insertRow",rowIndex:e}),uj(350)}})})]})]})})]})})]}),n&&c.jsx(M_,{pdfSettings:j}),c.jsxs(kv,{width:"7xl",isOpen:E,onClose:function(){m("library.close"),d({type:"clearModal"})},transparentBackground:"modal-library"==R,namespace:R,children:["library"==M&&c.jsx(GC,{}),"editor"==M&&c.jsx(d_,{})]}),c.jsx(x_,{show:!0===n,onClose:function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=O_({page:t}),!t){e.next=4;break}return e.next=4,n();case 4:r(null!=t&&t);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),c.jsx(cS,{}),c.jsx(m_,{show:a,onClose:function(){return l(!1)}})]})},L_=function(){return["minmax(28px, 1fr)","auto","72px"]},N_=function(e){return As("read"===e?{"@media (min-width: 767px)":{paddingRight:24,gridColumn:1},"@media (max-width: 768px)":{paddingRight:28,gridColumn:"span 2/span 2"}}:{paddingRight:29,gridColumn:2})},z_=function(e){var t,r=n.useState(0),i=r[0],o=r[1],a=function(){var t=X(G().mark((function t(){var n;return G().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 o(i+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(fd,{isProgrammaticParent:e.dashboardBehaviour.isProgrammaticParent,mode:e.dashboardBehaviour.mode,includeComponentTypes:e.includeComponents,excludeComponentTypes:e.excludeComponents,dashboardBehaviour:e.dashboardBehaviour,onError:e.onError,onViewClick:e.onViewClick,onReset:a,disableToolbar:e.dashboardBehaviour.disableToolbar,cascadeFilterSelection:e.dashboardBehaviour.cascadeFilterSelection,textOverride:e.dashboardBehaviour.textOverride,labelFormat:null!=(t=e.dashboardBehaviour.labelFormat)?t:function(){},pdfSettings:e.dashboardBehaviour.pdfSettings,id:e.dashboardBehaviour.id,containerWidth:e.containerWidth,children:c.jsx(Mm,{theme:e.theme,trackEvent:e.trackEvent,dashboard:e.dashboard,componentEditor:e.componentEditor,onDashboardUpdate:e.onDashboardUpdate,runQueriesCallback:function(t,n){var r;return e.runQueriesCallback(t,Q({},n,{dataAccessToken:null==(r=e.identityConfig.dataAccess)?void 0:r.signature}))},children:c.jsx(n_,Q({},e.ai,{children:c.jsx("div",{children:c.jsx(Nh,{children:e.children})},"_vizzly_dashboard_"+e.dashboard.id+"_"+i)}))})})},q_=t.createContext(void 0);!function(e){e.Admin="admin",e.EndUser="endUser"}(P_||(P_={})),function(e){e.Read="read",e.ReadWrite="read_write"}(E_||(E_={}));var B_=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("exact"!=t.type){e.next=7;break}return r=sl(t.dashboardId,n.permissions),Fe("A specific dashboard has been requested. This will be rendered with",i=r?E_.ReadWrite:E_.Read,"scope.",t.dashboardId),e.abrupt("return",{dashboardId:t.dashboardId,mode:r&&t.dashboardId==n.defaultParentDashboardId?P_.Admin:P_.EndUser,scope:i});case 7:if("instantCopyOf"!=t.type){e.next=27;break}if(!sl(t.parentDashboardId,n.permissions)){e.next=12;break}return Fe("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:P_.Admin,scope:E_.ReadWrite});case 12:if(o=Va(t.parentDashboardId,n.writeAccessDashboards),!(a=Ga(o))){e.next=17;break}return Fe("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:P_.EndUser,scope:E_.ReadWrite});case 17:if(l=Ka(n.dashboards,n.defaultParentDashboardId)){e.next=20;break}throw"Failed to find parent dashboard. "+n.defaultParentDashboardId;case 20:return Fe("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:za(l),meta:{},metadata:{},permissions:[{scope:E_.ReadWrite}]});case 23:return e.abrupt("return",{dashboardId:e.sent.id,scope:E_.ReadWrite,mode:P_.EndUser});case 27:throw"Unsupported strategy";case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),W_=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 J(t,e),t}(ee(Error)),V_=function(){var e=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Zo(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 ra("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)}}(),H_=function(e,t){if(e)return e;if(t)return n=t,function(){var e=X(G().mark((function e(t){var r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V_(n,null==(r=t.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 n;throw new oa},Y_=function(e){return"runQueries"in e?{type:"custom",queryEngineEndpoint:e.queryEngineEndpoint}:"data"in e?{type:"in-browser",queryEngineEndpoint:e.queryEngineEndpoint}:{type:"query-engine",queryEngineEndpoint:e.queryEngineEndpoint}},U_=function(e){return X(G().mark((function t(){var n;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=Y_(e),!("queryEngineConfig"in e)||!e.queryEngineConfig){t.next=5;break}return t.abrupt("return",ta(e.queryEngineConfig));case 5:if(!("queryEngineEndpoint"in e)||!e.queryEngineEndpoint||"query-engine"!==n.type){t.next=7;break}return t.abrupt("return",ta(e.queryEngineEndpoint));case 7:return t.abrupt("return",ea);case 8:case"end":return t.stop()}}),t)})))},G_={file:"local file",environment:"environment variables",github:"GitHub",s3:"AWS S3",vizzlyEncrypted:"Vizzly API",customEndpoint:"Custom endpoint"},K_={dynamic:"Dynamic",vizzlyApiStore:"Vizzly",static:"Static"},X_={name:"1gqeage",styles:"margin-right:0.75rem"},Q_=function(e){return c.jsx("div",{children:c.jsxs("span",{children:[c.jsxs("span",{css:X_,children:[!0===e.status&&c.jsx(eT,{}),!1===e.status&&c.jsx(nT,{}),null===e.status&&c.jsx(iT,{})]}),!0===e.status&&e.successMessage,!1===e.status&&e.errorMessage,null===e.status&&e.unknownMessage]})})},J_={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));}"},Z_=function(e){return c.jsxs("div",{css:J_,children:[c.jsx(Q_,{status:e.statusReport.configFound,successMessage:e.statusReport.configSources?"Config was fetched from "+(n=e.statusReport.configSources.dataSets,be(n.map((function(e){return G_[e]})))+" with ")+(t=e.statusReport.dataSetsCount||0,t+" "+(1==t?"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(Q_,{status:e.statusReport.configValid,successMessage:"Data sets are valid",errorMessage:"Config is not valid",unknownMessage:"We did not run any config validation checks"}),c.jsx(Q_,{status:e.statusReport.connectionOk,successMessage:"Connection check passed",errorMessage:"Connection check failed. Please check the logs",unknownMessage:"We did not run a connection check"}),c.jsx(Q_,{status:!!e.statusReport.projectId||null,successMessage:"Project ID found",errorMessage:"Failed to find your project ID. Please ensure environment variables have been setup correctly",unknownMessage:"Failed to find your project ID. Please ensure environment variables have been setup correctly"}),c.jsx(Q_,{status:!!e.statusReport.strategy||null,successMessage:"'"+K_[e.statusReport.strategy]+"' strategy loaded",errorMessage:"Failed to determine Query Engine Strategy",unknownMessage:"Failed to determine Query Engine Strategy"}),!1===e.statusReport.allowGetStarted&&c.jsx(Q_,{status:!0,successMessage:"Get started steps have been completed",errorMessage:"",unknownMessage:""})]});var t,n},$_={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},eT=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:$_,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"})})},tT={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},nT=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:tT,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"})})},rT={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},iT=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:rT,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"})})},oT=function(){var e=X(G().mark((function e(t,n){var r,i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Zo(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)}}(),aT=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},lT={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"},sT={name:"1flj9lk",styles:"text-align:left"},uT={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},dT={name:"1gok8e8",styles:"margin-bottom:0.5rem"},cT={name:"1f0dvzm",styles:"margin-top:1.5rem;text-align:right"},pT={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"},fT={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},mT={name:"12q5llh",styles:"margin-top:0.5rem;text-align:right"},hT={name:"fevti5",styles:"margin-bottom:0.75rem;margin-top:0.75rem;font-weight:700"},vT=function(e){var n=t.useState(void 0),r=n[0],i=n[1];return t.useEffect((function(){var t=new AbortController;return"query-engine"==e.implementationMeta.type&&e.implementationMeta.queryEngineEndpoint&&function(){var e=X(G().mark((function e(n){var o,a;return G().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,oT(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(Uh,{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:lT,children:[c.jsxs("div",{css:sT,children:[c.jsx("h2",{css:uT,className:""+tu.text,children:e.title}),e.text.map((function(e,t){return c.jsx("p",{css:dT,className:""+tu.text,children:e},t)}))]}),e.callToAction&&c.jsx("div",{css:cT,children:c.jsx("a",{target:"_blank",href:e.callToAction.link,children:c.jsx(Fh,{children:e.callToAction.text})})})]},t)})),void 0!==r&&c.jsxs("div",{css:pT,children:[null===r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:fT,className:""+tu.text,children:"Vizzly Query Engine not found"}),c.jsxs("p",{className:""+tu.text,children:["If you have deployed the Vizzly Query Engine, then please set the ",c.jsx(aT,{children:"queryEngineEndpoint"})," ","property to the URL where it is deployed too."]}),c.jsx("div",{css:mT,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/query-engines/self-hosted-query-engine",children:c.jsx(Fh,{children:"Deploy the Query Engine"})})})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:hT,className:""+tu.text,children:"Query engine status"}),c.jsx(Z_,{statusReport:r})]})]})]})}})},gT=function(e){return c.jsx(vT,{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(aT,{children:"identity"})," function with your own identity logic."]}),"Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens."]}]})},bT=function(e){return c.jsx(vT,{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."]}]})},xT=function(e){var t=[];switch(e.implementationMeta.type){case"custom":case"in-browser":t=[c.jsxs(c.Fragment,{children:["The ",c.jsx(aT,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"}),"function must provide at least one data set"]})];break;case"query-engine":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(vT,{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}]})},yT=function(e){return c.jsx(vT,{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(aT,{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(aT,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"})," property is required, and it must be an async function."]})]}]})},wT={name:"185o5ba",styles:"text-decoration-line:underline"},jT=function(e){return c.jsx(vT,{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(aT,{children:"queryEngineEndpoint"})," value",e.invalidEndpoint?" ("+JSON.stringify(e.invalidEndpoint)+")":"",". Please deploy the"," ",c.jsx("a",{css:wT,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."]})]}]})},CT=function(e){return c.jsx(vT,{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(aT,{children:"identity"})," must be an async function that returns your Vizzly identity tokens."]})]}]})},ST=function(e){Ae(e.error);var t=c.jsx("p",{children:"Unknown error"});return e.error instanceof W_&&(t=c.jsx(xT,{implementationMeta:e.implementationMeta})),e.error instanceof oa&&(t=c.jsx(yT,{implementationMeta:e.implementationMeta})),e.error instanceof Qo&&(t=c.jsx(jT,{implementationMeta:e.implementationMeta,invalidType:!0})),e.error instanceof Xo&&(t=c.jsx(jT,{implementationMeta:e.implementationMeta,invalidEndpoint:e.error.invalidEndpoint})),e.error instanceof ia&&(t=c.jsx(CT,{implementationMeta:e.implementationMeta})),e.error instanceof Ho&&(t=c.jsx(ev,{})),e.error instanceof Yo&&(t=c.jsx(bT,{implementationMeta:e.implementationMeta})),e.error instanceof Uo&&(t=c.jsx(Qh,{})),e.error instanceof ra&&(t=c.jsx(Jh,{})),e.error instanceof Go&&(t=c.jsx(gT,{implementationMeta:e.implementationMeta})),c.jsxs(rc,{children:[c.jsx(Rl,{}),t]})},FT=function(e,t){return e.map((function(e){return e.map((function(e){var t=e.field;return{id:_t({field:t.id,function:e.functionId}),publicName:t.publicName,dataType:t.dataType}}))}))},kT=function(e,t,n){var r=t.map((function(t){var r=Vr(e,t.dataSetId);if(!r)throw"Data set not found for query attributes query";return tn(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:FT([].concat(r).map((function(e){return e.measureDescription})))}};function _T(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 TT=function(e,t,n,r){var i=nn(t,e.measure,e.order,Jt(e.filter,n),e.dimension,e.timeDimension||null,e.limit,e.offset,r);return{queries:[i.query],resultFields:FT([i.measureDescription])}},AT=TT,DT=TT,IT=TT,OT=TT,PT=TT,ET=TT,MT=TT,RT=function(e,t,n){var r=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){var o,a=Vr(n.dataSets,e[0].dataSetId);if(!a)throw"Data set not found for pre aggregated query";var l=a.preAggregated[0],s=function(e,t){return{query:e,resultFields:t.fields.map((function(e){return{id:e.id,publicName:e.publicName,dataType:e.dataType}}))}}(e[0],a),u=s.query,d=s.resultFields,c=Vr(n.dataSets,l),p=wi(n.filterConfig,c,n.timeRangeOptions),f=Zt([p],t,c);r=[Q({},u,{filter:(o={},o[c.id]=f,o)})],i=[d]}else if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"uniqueArrayValues"==e[0].preparedQueryType){r=[e[0]];var m=Vr(n.dataSets,e[0].dataSetId);if(!m)throw"Data set not found for view attributes query";var h=Yr(m,e[0].fieldId),v=on(e[0].dataSetId,h);r=[v.query],i=[v.resultFields]}else if(Array.isArray(e)){var g=[].concat(e).map((function(e){var t=Vr(n.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";var r=wi(n.filterConfig,t,n.timeRangeOptions);return Q({},e,{filter:Jt(e.filter,r)})})),b=kT(n.dataSets,g,t);r=b.queries,i=b.resultFields}else if("type"in e&&("order"in e||"measure"in e)){var x=Vr(n.dataSets,e.dataSetId);if(!x)throw"Data set not found for view attributes query";var y=function(e,t,n,r){switch(e.type){case"areaChart":return AT(e,t,n,r);case"barChart":return DT(e,t,n,r);case"horizontalBarChart":return IT(e,t,n,r);case"lineChart":return OT(e,t,n,r);case"pieChart":return PT(e,t,n,r);case"dataTable":return ET(e,t,n,r);case"basicTable":return MT(e,t,n,r);case"comboChart":return function(e,t,n,r){var i=function(e,t,n,r){var i=nn(t,e.lineMeasure,e.order,Jt(e.filter,r),e.lineDimension,e.timeDimension,e.limit,e.offset,n);return{bar:nn(t,e.barMeasure,e.order,Jt(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:FT([o.measureDescription,a.measureDescription])}}(e,t,n,r);case"singleStat":case"progress":return function(e,t,n,r){var i=function(e,t,n,r){var i=function(e,t,n,r){var i=nn(n,e.measure,[],Jt(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=null;return"deltaTimeDimension"in e&&(o=function(e,t,n,r){return t.deltaTimeDimension?nn(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],Jt(t.filter,n),[],t.deltaTimeDimension,t.limit,t.offset,r):null}(t,e,r,n)),{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:FT(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=nn(t,i,e.order,Jt(e.filter,n),e.dimension,e.timeDimension,e.limit,e.offset,r);return{queries:[o.query],resultFields:FT([o.measureDescription])}}(e,t,n,r);case"mercatorMap":return function(e,t,n,r){return kT([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:Jt(e.filter,n),order:[],timeDimension:null}],r)}(e,t,n,r);default:throw"Unsupported."}}(e,x,wi(n.filterConfig,x,n.timeRangeOptions),t);r=y.queries,i=y.resultFields}else if("custom"!=e.type){var w=function(e,t,n){var r=[].concat(e.appliesToFields).map((function(r){var i=Vr(t,r.dataSetId);if(!i)throw"Data set not found for additional filter query";var o=Yr(i,r.fieldId);if("string[]"==o.dataType){var a=Zt([_T(e,r)],n,i),l=on(r.dataSetId,o,a);return{queries:[l.query],resultFields:[l.resultFields]}}var s=an(i,r.fieldId,_T(e,r));return kT(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=w.queries,i=w.resultFields}return{queries:r,resultFields:i}},LT={},NT=function(e,t,n){var r=JSON.stringify(e),i=new Date;i.setSeconds(i.getSeconds()+n),Fe("Browser cache new object set.",r),LT[r]={item:t,expires:i}},zT=function(e){var t=JSON.stringify(e),n=LT[t];if(!n)return Fe("Browser cache miss.",e),null;Fe("Browser cache hit.",e);var r=n.item,i=n.expires;return new Date<i?r:(delete LT[t],null)},qT=function e(t){return Array.isArray(t)?0==t.length:"object"==typeof t&&e(Object.keys(t))},BT=function(){var e=X(G().mark((function e(t,n,r,i){var o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},t.forEach((function(e,t){var n=zT(i(e));n&&(Fe("Query result received from the cache."),o[t]=n)})),t.forEach((function(e,t){n(e)||(Fe("Query is not runnable."),o[t]=null)})),a=t.filter((function(e,t){return n(e)&&void 0===o[t]})),l=[],qT(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(!qT(l)||!qT(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,NT(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)}}(),WT=function(){var e=X(G().mark((function e(t,n,r,i){var o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Zo(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)}}(),VT=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return!0}),function(){var e=X(G().mark((function e(n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,WT(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)}}(),HT={},YT=[],UT=function(){var e=X(G().mark((function e(t,n,r){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Fe("Fetching data for in-browser query engine. DataSet;",t.id,"CacheKey;",r),!HT[r]){e.next=5;break}return e.abrupt("return",HT[r]);case 5:return e.next=7,n(t);case 7:return(i=e.sent)||YT.includes(t.id)||(YT.push(t.id),console.error("Failed to download data for data set "+t.id)),HT[r]=i,e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),GT=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingVizzlyInMemoryDb",n}return J(t,e),t}(ee(Error)),KT=function(){var e=window.VizzlyInMemoryDb;if(!e)throw new GT("VizzlyInMemoryDb missing! This means that 'window.VizzlyInMemoryDb' was not set. This is required for the in-browser vizzly setup.\n\nPlease ensure you have added the script tag to load the in-browser query engine.\n\nFor example, this should be added within the <head> tag;\n<script src=\"https://static.app.vizzly.co/query-engine/0.8.10/vizzly-in-memory-db.umd.js\"><\/script>\n\nNote, you can change the version of the in-memory database by changing '0.8.3' to the version you require.\n");return e},XT=function(e,t){var n=[].concat(e).filter((function(e){return!i.isEmpty(e)})),r={type:"orWhere",value:[].concat(n).map((function(e){return{type:"andWhere",value:e.map((function(e){return{type:"where",left:QT(e.field,t),op:e.op,right:{type:i.isArray(e.value)?"list":i.isNumber(e.value)?"number":"unsafeString",value:i.isArray(e.value)?e.value.map((function(e){return{type:"unsafeString",value:e}})):e.value}}}))}}))},o={type:"andWhere",value:[]};return i.isEmpty(r.value)||(o.value=[].concat(o.value,[r])),o},QT=function e(t,n){if("subquery"==t.type)return{type:"subquery",value:{select:[e(t.value.measure[0],n)],where:XT(t.value.filter,n),join:[]}};if("maths"==t.type)return{type:"maths",left:e(t.left,n),right:e(t.right,n),op:t.op};if("number"==t.type)return t;if("null"==t.type)return t;if("string"==t.type)return{type:"unsafeString",value:t.value};if("function"==t.type)return{type:"function",function:t.function,value:e(t.value,n)};if("switchField"==t.type)return{type:"case",value:{cases:t.value.cases.map((function(t){return{result:e(t.returns,n),where:XT(t.filter,n)}}))}};if("field"==t.type&&"none"!=t.function){var r=Yr(n,t.value);return{type:"function",function:t.function,value:{type:"field",value:{nativeDataType:r.dataType,address:["_",n.id,r.id]}}}}if("field"===t.type){var i=Yr(n,t.value);return{type:"field",value:{nativeDataType:i.dataType,address:["_",n.id,i.id]}}}throw"Unsupported measure in JS query engine "+JSON.stringify(t)},JT=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l,s,u;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("query"!==t.type){e.next=10;break}if(0!==(null==t||null==(r=t.measure)?void 0:r.length)){e.next=3;break}return e.abrupt("return",[[]]);case 3:return o={select:t.measure.map((function(e){return QT(e,n)})),where:XT(t.filter,n),order:t.order,group:t.group,join:[],limit:t.limit||5e3,offset:t.offset||0,from:["_",t.dataSetId]},e.next=6,KT().query(o);case 6:return e.abrupt("return",(null==(a=e.sent)||null==(i=a[0])?void 0:i.values)||[]);case 10:if("preparedQuery"!==t.type||"uniqueArrayValues"!==t.preparedQueryType){e.next=16;break}return s={type:"uniqueArrayValues",field:{type:"field",value:{address:["_",t.dataSetId,t.fieldId],nativeDataType:"JSON"}},where:XT(t.filter,n)},e.next=14,KT().query(s);case 14:return e.abrupt("return",(null==(u=e.sent)||null==(l=u[0])?void 0:l.values)||[]);case 16:throw"Unsupported query";case 17:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ZT=function(e,t){return e+"::"+t},$T=function(){var e=X(G().mark((function e(t,n,r){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[].concat(t).map(function(){var e=X(G().mark((function e(t){var i,o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Gr(n,t.dataSetId),o=i[0],a=ZT(r,t.dataSetId),!HT[a]||!o){e.next=10;break}return e.next=6,JT(t,o);case 6:return e.abrupt("return",e.sent);case 10:return console.warn("Returning an empty result."),e.abrupt("return",[]);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=3,Promise.all(i);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),eA=function(){var e=X(G().mark((function e(t,n,r,i){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,KT().init(n.map((function(e){return{id:null==e?void 0:e.id,fields:null==e?void 0:e.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))}})));case 2:return e.next=4,Promise.all([].concat(t).flatMap(function(){var e=X(G().mark((function e(t){var o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Gr(n,t.dataSetId),!(a=o[0])){e.next=8;break}return e.next=4,UT(a,r,ZT(i,t.dataSetId));case 4:return l=e.sent,s={id:null==a?void 0:a.id,fields:null==a?void 0:a.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))},e.next=8,KT().ingest(s,l||[]);case 8:return e.abrupt("return",[]);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:return e.next=6,$T(t,n,i);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),tA=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,ea,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return!0}),function(){var e=X(G().mark((function e(n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,eA(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)}}(),nA=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return"preparedQuery"==e.type&&Te("Custom query engine does not support prepared queries."),"query"==e.type}),function(){var e=X(G().mark((function e(n){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.runQueries(n,Q({},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 rA(e,t,n){return iA.apply(this,arguments)}function iA(){return(iA=X(G().mark((function e(t,n,r){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyQueryEngine"!=t.type){e.next=4;break}return e.next=3,VT(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,tA(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,nA(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 oA=function(e){var n=t.useState(0),r=n[0],i=n[1];return eS((function(e){e.reload&&i((function(e){return e+1}))}),e.id),d.createElement(aA,Q({},e,{key:e.parentDashboardId+"_"+e.dashboardId+"_"+r}))},aA=function(e){var n,r,i,o,a,l,s,u,d,p=Y_(e),f=e.vizzlyApiHost?{host:e.vizzlyApiHost}:{host:"https://api.vizzly.co"},m=Vo(f),h=function(t,n,r){var i;return Mr(t,n,r,e.textOverrides,"object"==typeof e.developerTools&&!0===(null==(i=e.developerTools)?void 0:i.translationKeys))},v=(a={dashboardId:e.dashboardId,parentDashboardId:e.parentDashboardId,identityCallback:e.identity,loadDataSetsCallback:(i=e.dataSets,o=e.queryEngineEndpoint,function(){var e=X(G().mark((function e(t,n){var r,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"function"==typeof(r=H_(i,o))){e.next=4;break}throw new oa;case 4:return e.next=6,r(t,n);case 6:if(a=e.sent){e.next=9;break}throw new ra("Failed to fetch data sets from the query engine endpoint");case 9:return e.abrupt("return",a.map((function(e){return Kr(e,n)})));case 12:if(e.prev=12,e.t0=e.catch(0),!(e.t0 instanceof oa)){e.next=16;break}throw e.t0;case 16:throw new ra("Failed to fetch data sets.");case 17:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t,n){return e.apply(this,arguments)}}()),vizzlyAPI:m,implementationMeta:p,loadQueryEngineConfigCallback:U_(e),programmaticDashboard:e.parentDashboard,textOverride:h},s=ha(a.identityCallback,a.loadDataSetsCallback,a.loadQueryEngineConfigCallback,a.textOverride),d=function(e,n,r){var i=t.useState(),o=i[0],a=i[1];if(t.useEffect((function(){!function(){var t=X(G().mark((function t(){var r,i,l,s;return G().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,B_(e,n);case 6:i=(r=t.sent).mode,s=r.scope,(l=r.dashboardId)!=(null==o?void 0:o.dashboardId)&&a({mode:i,dashboardId:l,scope:s});case 11:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify(e),n]),!o)return null;if("isLoading"in n)return null;var l=n.dashboards.find((function(e){return e.id==o.dashboardId}))||null;return{mode:o.mode,dashboard:l,scope:o.scope,isProgrammaticParent:!!r}}(function(e,t,n){if("accessType"in e&&"admin"==e.accessType){Fe("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&&(Fe("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?(Fe("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)?(Fe("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.find((function(e){return null!=e.parentDashboardId})).id}):"read"==(null==t?void 0:t.dashboardAccess.scope)&&"defaultParentDashboardId"in e?(Fe("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?(Fe("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}):(Fe("Strategy will be to show a child of the parent dashboard",e.defaultParentDashboardId),{type:"instantCopyOf",parentDashboardId:e.defaultParentDashboardId}):void 0;var o,a}(u=Sl(null==s?void 0:s.identityConfig,null==s?void 0:s.dataSets,a.vizzlyAPI,a.parentDashboardId,jl(a.implementationMeta.queryEngineEndpoint,s.queryEngineConfig),s.queryEngineConfig,a.programmaticDashboard),s.identityConfig,a.dashboardId),u,a.programmaticDashboard),0===(null==(l=s.dataSets)?void 0:l.length)?{error:new W_}:s.error?{error:s.error}:s.identityConfig&&s.queryEngineConfig?"isLoading"in u?null:d?{dashboardAPI:u,scope:d.scope,queryEngineConfig:s.queryEngineConfig,dashboard:d.dashboard,identityConfig:s.identityConfig,mode:d.mode,vizzlyApiConfig:a.vizzlyAPI.config,isProgrammaticParent:d.isProgrammaticParent}:null:null);if(function(e,n){var r;t.useEffect((function(){var t;e&&"dashboard"in e&&null!=e&&null!=(t=e.dashboard)&&t.id&&(null==n||n({id:e.dashboard.id,metadata:e.dashboard.metadata,scope:e.scope}))}),[JSON.stringify({loaded:!!e,dashboardId:e&&"dashboard"in e&&(null==e||null==(r=e.dashboard)?void 0:r.id)})])}(v,e.onDashboardLoad),null===v)return c.jsx(nm,{override:e.renderLoadingComponent});if("error"in v)return c.jsx(ST,{implementationMeta:p,error:v.error});if(!v.dashboard)return c.jsx(nm,{override:e.renderLoadingComponent});var g=function(){var e=X(G().mark((function e(t,n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n||!v.dashboard){e.next=7;break}return e.next=3,v.dashboardAPI.saveScheduledReport({dashboardId:v.dashboard.id,cronSchedule:null,scheduledReportId:t});case 3:return e.abrupt("return",e.sent?"deleted":null);case 7:if(null==n||!v.dashboard){e.next=12;break}return e.next=10,v.dashboardAPI.saveScheduledReport({dashboardId:v.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)}}(),b=function(){var e=X(G().mark((function e(t){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"read_write"==v.scope&&v.dashboardAPI.updateDashboard(t.id,{definition:za(t)});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),x=function(){var e=X(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===v||!("dashboard"in v)||null===v.dashboard){e.next=4;break}return t=Ja(v.dashboard,v.dashboardAPI.dashboards,v.dashboardAPI.defaultParentDashboardId),b(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)}}(),y=(null==(n=v.identityConfig)||null==(n=n.queryEngineAccessConfig)?void 0:n.allowDatabaseSchemaAccess)&&"query-engine"==p.type,w=null!=(r=e.dateFilterOptions)?r:e.dateTimeFilterOptions,j=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("runQueries"in e&&e.runQueries)return function(){var r=X(G().mark((function r(i,a){var l;return G().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rA({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=X(G().mark((function t(r,i){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,rA({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)}}();if("queryEngineEndpoint"in e&&e.queryEngineEndpoint&&null!=(r=t.identityConfig.dataAccess)&&r.signature)return function(){var r=X(G().mark((function r(i,a){var l;return G().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rA({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)}}();throw"Missing required props."}(e,v,id(h,w)),C=function(){var e=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=5;break}return o=ll(null==(i=v.dashboard)?void 0:i.id,v.dashboardAPI.permissions),e.next=4,m.aiActions(t,n,o.token,r);case 4:return e.abrupt("return",e.sent);case 5:throw"Dashboard has not yet been loaded.";case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),S=function(){var e=X(G().mark((function e(t,n,r,i){var o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=5;break}return a=ll(null==(o=v.dashboard)?void 0:o.id,v.dashboardAPI.permissions),e.next=4,m.askAi(n,r,t,a.token,v.dashboard.dataSets,v.queryEngineConfig,i);case 4:return e.abrupt("return",e.sent);case 5:throw"Dashboard has not yet been loaded.";case 6:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),F=function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=7;break}return n=ll(null==(t=v.dashboard)?void 0:t.id,v.dashboardAPI.permissions),e.next=4,m.askAiForQuestionSuggestions(n.token,v.dashboard.dataSets);case 4:return e.abrupt("return",e.sent.suggestions);case 7:throw"Dashboard has not yet been loaded.";case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return c.jsx(q_.Provider,{value:Q({},e,{onSave:b}),children:c.jsx(z_,{trackEvent:e.trackEvent,dashboardBehaviour:{id:e.id,isProgrammaticParent:v.isProgrammaticParent,mode:v.mode,scope:v.scope,dateFilterOptions:w,numberFormatOptions:null==e?void 0:e.numberFormatOptions,dateTimeFormatOptions:null==e?void 0:e.dateTimeFormatOptions,onEditorUpdate:null==e?void 0:e.onEditorUpdate,onScheduledReportChange:g,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:b,onOpenConfigManagerUi:y?function(){var e,t,n,r,i;y&&"query-engine"===p.type&&p.queryEngineEndpoint&&(window.location.href=(t=p.queryEngineEndpoint,(n=null==(e=v.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"),Ui(na(t),"/sign-in#"+i)):""))}:void 0,organizationName:e.organizationName,featureToggles:e.featureToggles,customComponents:e.customComponents,componentOverrides:Pj(e),queryEngineConfig:v.queryEngineConfig,disableToolbar:null==e?void 0:e.disableToolbar,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:h,pdfSettings:null==e?void 0:e.pdfSettings,labelFormat:null==e?void 0:e.labelFormat},ai:{onAction:C,onAsk:S,fetchSuggestions:F},onDashboardUpdate:null==e?void 0:e.onDashboardUpdate,dashboard:v.dashboard,runQueriesCallback:j,implementationMeta:p,identityConfig:v.identityConfig,includeComponents:null==e?void 0:e.includeComponents,excludeComponents:null==e?void 0:e.excludeComponents,onReset:x,onError:null==e?void 0:e.onError,theme:e.theme,vizzlyApiConfig:f,onViewClick:null==e?void 0:e.onViewClick,children:null==e?void 0:e.children})})},lA=function(e){return c.jsxs(Il,{renderOnError:function(){return c.jsx("p",{children:"Unexpected error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[c.jsx(Rl,{}),c.jsx(oA,Q({},e,{children:c.jsx(R_,{})}))]})},sA={Dashboard:lA,useDashboardManager:Al,useInBrowserDashboardManager:Dl,NewVizzlyImplementation:Go,displayPositions:Wi,DataSetField:Pl};exports.Dashboard=lA,exports.DataSetField=Pl,exports.NewVizzlyImplementation=Go,exports.default=sA,exports.displayPositions=Wi,exports.useDashboardManager=Al,exports.useInBrowserDashboardManager=Dl,exports.vizzlyState=Nl;
|
|
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("@vizzly/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"),j=require("@visx/responsive"),C=require("@visx/xychart"),S=require("@visx/gradient"),F=require("@visx/legend"),k=require("@visx/scale"),_=e(require("@visx/legend/lib/legends/Ordinal")),T=require("@visx/curve"),A=require("d3-time-format"),D=require("@visx/shape"),I=require("@visx/group"),O=e(require("@visx/shape/lib/shapes/Pie")),P=require("@react-spring/web"),E=require("@visx/tooltip"),M=require("@visx/geo"),R=require("topojson-client"),L=e(require("@visx/responsive/lib/components/ParentSize")),N=require("@visx/zoom"),z=e(require("react-visibility-sensor")),q=e(require("copy-to-clipboard")),B=require("react-dnd-html5-backend"),W=require("file-saver"),V=e(require("html2canvas")),H=e(require("jspdf"));function Y(e,t,n){if(U())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&$(i,n.prototype),i}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}function G(){G=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),a=new A(r||[]);return i(o,"_invoke",{value:F(e,n,a)}),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="executing",m="completed",h={};function v(){}function g(){}function b(){}var x={};u(x,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(D([])));w&&w!==n&&r.call(w,a)&&(x=w);var j=b.prototype=v.prototype=Object.create(x);function C(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,o,a,l){var s=c(e[i],e,o);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function F(t,n,r){var i=p;return function(o,a){if(i===f)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var l=r.delegate;if(l){var s=k(l,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var u=c(t,n,r);if("normal"===u.type){if(i=r.done?m:"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=m,r.method="throw",r.arg=u.arg)}}}function k(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=c(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,h):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function _(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 T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function D(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=b,i(j,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(j),e},t.awrap=function(e){return{__await:e}},C(S.prototype),u(S.prototype,l,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(d(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(j),u(j,s,"Generator"),u(j,a,(function(){return this})),u(j,"toString",(function(){return"[object Generator]"})),t.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}},t.values=D,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return l.type="throw",l.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.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,h):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),h},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),T(n),h}},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;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:D(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),h}},t}function K(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 X(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){K(o,r,i,a,l,"next",e)}function l(e){K(o,r,i,a,l,"throw",e)}a(void 0)}))}}function Q(){return(Q=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 J(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,$(e,t)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){var t="function"==typeof Map?new Map:void 0;return(ee=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))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 Y(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(n,e)})(e)}function te(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 ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(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 ie(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 re(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)?re(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 oe={">":{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[]"]}},ae=function(e,t){return[].concat(Object.keys(t.supportedOperators)).filter((function(t){return se[t].validDataTypes.includes(e.dataType)}))},le=function(e,t){return"countDistinct"==e?t("count_distinct","Count distinct"):i.capitalize(e)},se=oe,ue=function(e){var t=i.cloneDeep(se);if(!e)return t;var n={};return e.forEach((function(e){if(!se[e])throw"Operator "+e+" not managed by Vizzly";n[e]=se[e]})),n},de=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:Q({},e,{value:[e.value]})}))}))},ce=function(e,t){return e.map((function(e){var n=Q({},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}))},pe=function(e){return e.map((function(e){var t=Q({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t}))},fe=function(e){return"auto"===e||0===e||2===e?e:"auto"},me=function(e){if(!e)return{};var t={};return e.measure&&Object.entries(e.measure).forEach((function(e){t&&(t[e[0]]=pe(e[1]))})),{measure:i.isEmpty(t)?void 0:t,group:e.group}},he={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"]},median:{publicName:"Median",validDataTypes:["number"]}},ve=he,ge=function(e){var t=i.cloneDeep(ve);if(!e)return t;var n={};return e.forEach((function(e){if(!ve[e])throw"Aggregate "+e+" not managed by Vizzly";n[e]=ve[e]})),n};function be(e,t,n){if(void 0===t&&(t=!0),1==e.length)return t?"'"+e[0]+"'":""+e[0];var r=[].concat(e),i=r.pop();return r.map((function(e){return t?"'"+e+"'":""+e})).join(", ")+" "+(n?n("list_of_values_and","and"):"and")+" "+(t?"'"+i+"'":""+i)}var xe=function(e){for(var t=0,n=0;n<e.length;n++)t+=e.charCodeAt(n);return t},ye=["debug","info","warning","error","properties"],we="error",je=function(e,t){return we=e,t&&t(we),{logDebug:Fe,logError:Ae,logInfo:ke,logWarning:Te,logProperties:_e}},Ce=function(e){return ye.findIndex((function(e){return we==e}))<=ye.findIndex((function(t){return e==t}))},Se=function(e){return e instanceof Error?e:i.isObject(e)||i.isArray(e)?JSON.stringify(e):e},Fe=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("debug")&&(e=console).info.apply(e,["[VIZZLY DEBUG]"].concat(n.map(Se)))},ke=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("info")&&(e=console).info.apply(e,["[VIZZLY INFO]"].concat(n.map(Se)))},_e=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Ce("properties")&&console.info("[VIZZLY Dashboard Properties]",t)},Te=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("warning")&&(e=console).warn.apply(e,["[VIZZLY WARNING]"].concat(n.map(Se)))},Ae=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ce("error")&&(e=console).error.apply(e,["[VIZZLY ERROR]"].concat(n.map(Se)))},De=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},Ie=function(e,t){return void 0===t&&(t="No value"),null===e?t:e instanceof Date?e.toISOString():e},Oe=function(e,t){return Pe(e,t)[0]},Pe=function(e,t){var n,r=null!=(n=e.supportedAggregateOptions)?n:[],i=r.filter((function(n){return Object.keys(t).includes(n)&&t[n].validDataTypes.includes(e.dataType)}));return 0===i.length?i=Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)})):i.sort((function(e,t){return r.indexOf(e)-r.indexOf(t)})),i},Ee=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},Me=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"}},Re=function(e,t){var n=Me(e,t);return{fieldId:n.field,function:n.function}},Le=function(e,t){var n=new Set(t.map((function(e){return e.field})));return e.filter((function(e){return!n.has(e.id)}))},Ne=function(e){return e.map((function(e){return"string"==typeof e?{field:e,function:"none"}:e}))},ze=function(e){return"string[]"==e.dataType},qe={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}},Be=function(e){var t=i.cloneDeep(qe);if(!e)return t;var n={};return e.forEach((function(e){if(!qe[e])throw"Transformation function "+e+" is not managed by Vizzly";n[e]=qe[e]})),n},We=function(e,t,n){var r=e.supportedAggregates,i=Object.keys(r).filter((function(e){return r[e].validDataTypes.includes(t)}));null==n||n.forEach((function(e){r.hasOwnProperty(e)||Te("Unsupported aggregate option: "+e+" on "+t)}));var o=n&&n.length>0?n.filter((function(e){return i.includes(e)})):i;return n&&n.length>0&&0===o.length&&(o=i),o},Ve=function(e){return r.object({filters:r.array().items(r.array().items(tt(e)).required().max(1)).required().max(1),ruleValue:r.string().allow("").required(),ruleValueEnd:r.string().allow(""),ruleType:r.valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view.")},He=r.object({field:r.string().required().description("ID of the field in the data set to add a prefix too."),prefix:r.string().required().description("The prefix to be applied.")}),Ye=r.object({fieldId:r.string().required(),dataSetId:r.string().required()}),Ue=function(e){return r.object().pattern(r.string(),r.array().items(tt(e)).optional())},Ge=function(e){return{title:r.string().allow(""),managedByConfiguration:r.boolean().optional(),requiresValue:r.boolean().optional(),optionsFilters:Ue(e).optional(),appliesToFields:r.array().items(Ye).required(),optionsPulledFrom:r.array().items(Ye).optional()}},Ke=function(e,t){return r.object(Q({},Ge(e),{type:r.valid("singleSelectFilter").required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.valid.apply(r,t?[]:[null]))}))},Xe=function(e,t){return r.object(Q({},Ge(e),{type:r.valid("multiSelectFilter").required(),value:r.alternatives(r.array().items(r.string(),r.number()).single(),r.valid.apply(r,t?[]:[null]))}))},Qe=function(e,t,n){return r.object(Q({},Ge(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()}))}))},Je=function(e,t){var n=function(e,t){return r.object({field:e.required(),function:t.required().description("Which if any, aggregate function should be applied to the field?")})};return null!=t&&t.restrictFields?r.alternatives.apply(r,t.restrictFields.filter((function(e){return e.canBeMeasure})).map((function(t){var i,o=function(e,t){return Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)}))}(t,e);return n(r.string().valid(t.id).description(t.publicName+", "+(t.description||"")+"."),(i=r.string()).valid.apply(i,o.concat(["none"])))}))):n(r.string().description("The ID of the field from the data set to reference."),r.valid.apply(r,Object.keys(e).concat(["none"])))},Ze=function(e){var t;return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),direction:r.string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which if any, function should be applied to the field?")})},$e=function(e){return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),truncate:r.valid.apply(r,Object.keys(e).concat(["none"])),bucketFill:r.boolean()})},et=function(e,t){var n=function(t,n){return r.object({field:t.required(),pivot:r.string().valid("x","y").optional(),function:n?r.valid.apply(r,Object.keys(e).concat(["none"])).required():r.valid("none").required()})};return null!=t&&t.restrictFields?r.array().items(r.alternatives.apply(r,t.restrictFields.filter((function(e){return e.canBeDimension})).map((function(e){return n(r.string().valid(e.id).description(e.publicName+", "+(e.description||"")+"."),"date_time"===e.dataType)})))).description("Fields to group the data by"):r.array().items(n(r.string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},tt=function(e){var t,n;return r.object({field:r.string().required().description("The ID of the field from the data set to reference."),op:(t=r.string()).valid.apply(t,Object.keys(e.supportedOperators)).required(),value:r.alternatives(r.string().allow(null),r.number(),r.boolean(),r.array().items(r.string(),r.number())).required(),function:(n=r.string()).valid.apply(n,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which function should be applied to the field?")})},nt=function(e){return r.array().items(r.array().items(tt(e)))},rt=function(){return r.number().description("Limit the number of results returned after the query has been ran.")},it=function(e){var t,n=null!=e&&e.restrictDataSetIds?(t=r.string()).valid.apply(t,e.restrictDataSetIds):r.string();return{viewId:r.string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:r.string().allow("").description("A title that explains what is being displayed."),displaySubject:r.string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:n.description("The ID of the data set that is being used by the view."),protectedByOrganisation:r.boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},ot=r.valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),at=function(e,t){return{measure:r.array().items(Je(e.supportedAggregates,t)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:et(e.supportedTimeTruncFunctions,t).required(),drilldown:r.alternatives(et(e.supportedTimeTruncFunctions,t).required(),r.string()),order:r.array().items(Ze(e)),timeDimension:r.alternatives($e(e.supportedTimeTruncFunctions),r.valid(null)).required(),limit:rt(),offset:r.number().min(0).description("Paginate results by using this property with limit."),filter:r.array().items(r.array().items(tt(e))),xAxisPrefix:r.string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:r.string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:r.string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:r.string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:r.alternatives(r.string(),r.valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:r.alternatives(r.string(),r.valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:ot,approxXAxisLabelCount:ot}},lt=r.string().valid("natural","straight","step","stepBefore","stepAfter"),st=function(e){var t;return r.array().items(r.object({function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),field:r.string().required().description("The ID of the field from the data set to reference.")}))},ut=function(e){var t;return r.array().items(r.object({function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),truncate:r.string(),field:r.string().required().description("The ID of the field from the data set to reference."),bucketFill:r.boolean().optional(),pivot:r.string().valid("x","y").optional()}))},dt=function(e,t){return r.object().pattern(r.string(),r.alternatives().try(r.array().items($e(e.supportedTimeTruncFunctions)).min(1),et(e.supportedTimeTruncFunctions,t))).unknown(!0)},ct=function(e,t){return r.object().pattern(r.string(),r.array().items(Je(e.supportedAggregates,t)).min(1)).unknown(!0)},pt=function(e,t){return r.object({measure:ct(e,t),group:dt(e,t)})},ft=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()})},mt=function(){return r.array().items(ft())},ht=function(){return r.object({func:r.string().valid("mean","sum","current").allow(null).optional()})},vt=function(){return r.object({x:r.string().allow(""),y:r.string().allow("")})},gt=r.object().pattern(r.string(),r.object({width:r.number().min(0),height:r.number().min(0)})),bt=function(e){return r.array().items(Ve(e)).description("Apply formatting based on a set of defined rules.")},xt=r.object({field:r.string().required(),function:r.valid("none").required()}),yt=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("basicTable").required(),measure:r.array().items(xt).required(),dimension:r.array().max(0),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.valid(null),limit:rt().required(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),prefixes:r.array().items(He),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:bt(e.queryEngineConfig),dateTimeFormat:r.string(),protectedFields:r.object({measure:st(e.queryEngineConfig)}).unknown(!0),sizing:gt}))},wt={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"}},jt=function(e){return null!=e&&e.truncate&&"none"!=(null==e?void 0:e.truncate)?e.field+"_"+e.truncate:null==e?void 0:e.field},Ct=function(e,t){var n=e.split("_"),r=n.pop();return r&&!kt(t,r)?null:{field:n.join("_"),truncate:null!=r?r:""}},St=wt,Ft=function(e){var t=i.cloneDeep(St);if(!e)return t;var n={};return e.forEach((function(e){if(!St[e])throw"Time trunc function "+e+" not managed by Vizzly";n[e]=St[e]})),n},kt=function(e,t){return[].concat(Object.keys(e),["none"]).includes(t)},_t=Ee,Tt=Me,At=function(e){return"none"!=e.function};function Dt(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 It=function(e,t){return Q({},e,{order:i.remove(e.order,(function(e){return i.some(t,(function(t){return t.function==e.function&&t.field==e.field}))}))})},Ot=function(e,t,n){var r,o,a,l=Q({},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=Tt(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=_t(r);delete e.measure[i]}e.measure=Dt(e.measure,t)}if("group"in e&&e.group){var o=function(e,t){return Object.keys(e).map((function(e){var n=Ct(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=jt(o);delete e.group[a]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=Dt(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},Pt=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}),It(e,t)},Et=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},Mt=function(e){return function(t,n){var r=Et(t,n,yt(e));return It(r,[].concat(r.measure))}},Rt=function(e,t){var n=[];return i.isEmpty(t)||void 0===t?[]:(null==t||t.map((function(t){if(null!=t&&t.ruleType&&null!=t&&t.ruleValue){var r=[],i="field"in t&&"string"==typeof t.field&&"operator"in t&&"string"==typeof t.operator&&"value"in t;if(null!=t&&t.filters){var o=t.filters.map((function(t){return t.map((function(t){return Lt(t,e)}))}));r.push.apply(r,o)}else i&&r.push([Lt({field:t.field,op:t.operator,value:t.value},e)]);n.push({filters:r,ruleValueEnd:null==t?void 0:t.ruleValueEnd,ruleValue:t.ruleValue,ruleType:t.ruleType})}})),n)},Lt=function(e,t){var n,r=Me(e.field,t),i="none"!==r.function?r.function:null!=(n=e.function)?n:"none";return{field:r.field,op:e.op,value:e.value,function:i}},Nt=function(e,t){return t.length>0&&t[0].length>0?{type:"function",function:e.aggregate,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:t},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}:{type:"field",function:e.aggregate,value:e.fieldId}},zt=function(e,t,n){return e.map((function(e){return{returns:{type:"string",value:e.name},filter:Zt(e.rule,t,n)}}))},qt=function(){return l.v4().replace(/-/g,"")},Bt=function(e){return"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e},Wt=function(e){return"roundToDecimalPlaces"in e},Vt=function(e){return"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e},Ht=function(e){return"denominatorFieldId"in e||"numeratorFieldId"in e},Yt=function(e){return"rules"in e},Ut=function(e){if(Ht(e))return"percentage";if(Bt(e))return"math";if(Vt(e))return"math";if(Yt(e))return"rules";if(Wt(e))return"roundedNumber";throw"Unrecognised custom field type for custom field; "+JSON.stringify(e)},Gt=function(e){return Ht(e)||Bt(e)||Vt(e)||Yt(e)||Wt(e)},Kt=function(e,t,n,r,i,o){if(Ht(t))return function(e,t,n,r,i){var o,a,l,s,u=function(e,t){var n,r;return{combinedNominatorFilters:t.numeratorFilter&&$t(t.numeratorFilter)?Jt(null!=e?e:[],null!=(n=t.numeratorFilter[0])?n:[]):null!=e?e:[],combinedDenominatorFilters:t.denominatorFilter&&$t(t.denominatorFilter)?Jt(null!=e?e:[],null!=(r=t.denominatorFilter[0])?r:[]):null!=e?e:[]}}(i,e),d=u.combinedNominatorFilters,c=u.combinedDenominatorFilters,p={fieldId:null!=(o=e.numeratorFieldId)?o:e.denominatorFieldId,aggregate:null!=(a=e.numeratorAggregate)?a:e.denominatorAggregate},f={fieldId:null!=(l=e.denominatorFieldId)?l:e.numeratorFieldId,aggregate:null!=(s=e.denominatorAggregate)?s:e.numeratorFieldId},m={type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Zt(c||[],t,n)}},h=Nt(f,$t(e.denominatorFilter)?Zt(c,t,n):[]);return{type:"maths",left:Nt(p,$t(e.numeratorFilter)?Zt(d,t,n):[]),op:"/",right:"withinGrouping"===e.denominatorScope?h:m}}(t,n,r,0,o);if(Yt(t))return function(e,t,n,r){var i={type:"switchField",value:{cases:zt(t.rules,n,r)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}}(e,t,n,r);if(Vt(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(Bt(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 Xt(e,t);throw"Unsupported custom field type; "+JSON.stringify(t)},Xt=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}},Qt=function(e){if("leftAggregate"in e||"rightAggregate"in e){var t=Q({},e,{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?Q({},e.leftNested,{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?Q({},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}if("numeratorFieldId"in e&&!("version"in e)){var n,r,i=[].concat((null==(n=e.numeratorFilter)?void 0:n[0])||[],(null==(r=e.denominatorFilter)?void 0:r[0])||[]);return Q({},e,{version:2,denominatorScope:e.denominatorScope||"all",denominatorFilter:(null==e?void 0:e.denominatorFilter)||[],numeratorFilter:i.length>0?[i]:[]})}return e},Jt=function(e,t){return e&&!i.isEmpty(e)||(e=[[]]),[].concat(e).map((function(e){return[].concat(e,t)}))},Zt=function(e,t,n){return e.map((function(r){return[].concat(r).flatMap((function(r){var i;if(r.function&&!kt(t.supportedTimeTruncFunctions,r.function))throw"Query engine does not support the query function "+r.function+".";var o,a=Yr(n,r.field),l={type:"field",value:r.field,function:null!=(i=r.function)?i:"none"};return Gt(a)&&(l=Kt({field:a.id,function:null!=(o=r.function)?o:"none"},a,t,n,0,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){return e&&i.isArray(e)&&i.isArray(e[0])},en=function(e,t){return[[].concat(e,[t]),e.length]},tn=function(e,t,n,r,i,o,a,l,s){var u=[],d=[],c=[],p=[],f=[];if(o){var m;if(!kt(s.supportedTimeTruncFunctions,o.truncate))throw"Query engine does not support the time trunc function "+o.truncate+".";var h=en(d,{type:"field",value:o.field,function:o.truncate});d=h[0],m=h[1],u=[].concat(u,[{functionId:o.truncate,field:Yr(e,o.field)}]),c=[].concat(c,[{index:m}])}return i.forEach((function(t){var n,r=en(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:Yr(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=en(d,{type:"field",value:t.field,function:t.function});d=r[0],u=[].concat(u,[{functionId:t.function,field:Yr(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=Zt([t],s,e);f=[].concat(f,[n[0]])})),d=d.map((function(t){if("field"==t.type&&"string"==typeof t.value){var n=Yr(e,t.value);if(Gt(n))return Kt({function:t.function,field:t.value},n,s,e,rn({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}},nn=tn,rn=function(e){return e.group.length>0},on=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}]}},an=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}},ln=function(e,t){return e.supportedFeatures.includes(t)},sn=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ValidationError",n}return J(t,e),t}(ee(Error)),un=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 J(t,e),t.prototype.getMissingFieldId=function(){return this.missingFieldId},t}(sn),dn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("barChart","horizontalBarChart").required(),conditionalFormattingRules:bt(e.queryEngineConfig),protectedFields:r.object({dimension:ut(e.queryEngineConfig),measure:st(e.queryEngineConfig)}).unknown(!0),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:mt(),axisTitles:vt(),headline:ht()}))},cn=function(e){return function(t,n){var r=Et(t,n,dn(e));return Pt(r)}},pn=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 J(t,e),t}(sn),fn=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 J(t,e),t}(sn),mn=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},hn=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},vn=function(e){var t=[];return mn(e).forEach((function(e){t=[].concat(t,[e.field])})),hn(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},gn={allowUnknown:!0,stripUnknown:!0},bn=function(e,t,n){var r=Br(e.type,{queryEngineConfig:n}).schema.validate(e,gn).error;if(r)return[new pn(r)];var i=Vr(t,e.dataSetId);if(!i)return[new fn(t,e.dataSetId)];var o=vn(e);try{o.forEach((function(e){Yr(i,e)}))}catch(e){if(e instanceof un)return[e];throw e}return[]},xn=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},yn=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)},wn=function(e){return!!yn(e)||xn(e)},jn=["parentDimension"],Cn=function(e){return e||"view_"+l.v4()};function Sn(e){return te(e,jn)}var Fn=function(e,t,n){var r=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["boolean","string"]})),o=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["date_time"]})),a=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["number"]})),l=null;return o[0]&&(l={field:o[0].id,truncate:"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})},kn=function(e,t){var n=null,r=i.cloneDeep(e);return r.forEach((function(e){var r=Yr(t,e.field);"date_time"==r.dataType&&(n={field:r.id,truncate:e.function})})),r=r.filter((function(e){return"date_time"!=Yr(t,e.field).dataType})),{timeDimension:n,dimension:r}},_n=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},Tn=function(e){if(e){var t=i.cloneDeep(e);return t.measure=pe(e.measure||[]),t}},An={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}};function Dn(e,t){return function(t){return t in e.format_panel}(t)?Q({},e.format_panel[t],{namespace:t}):Q({},e.data_panel[t],{namespace:t})}function In(e,t){var n;return null==(n=e.format_panel.axis_labels)?void 0:n.subSectionDefinition[t]}function On(e){return Q({},Dn(e,"heading"),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function Pn(e){return Q({},Dn(e,"axis_labels"),{y:Q({},In(e,"y"),{prefix:In(e,"y.prefix"),postfix:In(e,"y.postfix"),format:In(e,"y.format"),count:In(e,"y.count"),axisTitle:In(e,"y.axis_title")}),x:Q({},In(e,"x"),{prefix:In(e,"x.prefix"),postfix:In(e,"x.postfix"),format:In(e,"x.format"),count:In(e,"x.count"),axisTitle:In(e,"x.axis_title")})})}function En(e,t,n){var r,i,o,a,l;return Q({},Dn(e,"chart_styles"),t?{subSection:[null==(i=e.format_panel.chart_styles)?void 0:i.subSectionDefinition.curve,null==(o=e.format_panel.chart_styles)?void 0:o.subSectionDefinition.legend]}:n?{subSection:[null==(a=e.format_panel.chart_styles)?void 0:a.subSectionDefinition.stacked,null==(l=e.format_panel.chart_styles)?void 0:l.subSectionDefinition.legend]}:{subSection:[null==(r=e.format_panel.chart_styles)?void 0:r.subSectionDefinition.legend]})}function Mn(e,t){var n;return Q({},null==(n=e.format_panel.stats_labels)?void 0:n.subSectionDefinition[t],{namespace:t})}var Rn=function(e,t){if("current"===(null==e?void 0:e.func)&&t)return e},Ln=function(e){return{title:An.title,description:An.description,servicesClass:"BarChart",namespace:An.namespace,dump:function(e){return e},load:function(t){return Q({},t,{measure:pe(t.measure),order:ce(t.order,t.timeDimension),filter:de(t.filter),protectedFields:Tn(t.protectedFields),viewId:Cn(t.viewId),dimension:Ne(t.dimension),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),parameters:me(t.parameters),conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),headline:Rn(t.headline,t.timeDimension)})},setAttributes:cn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:dn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(An,"data_set"),Dn(An,"views"),Q({},Dn(An,"field_y_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(An,"drilldown"),Q({},Dn(An,"field_x_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(An,"sort"),Dn(An,"filter"),Dn(An,"custom_metrics"),Dn(An,"limit")]},formatPanelConfig:function(){return[On(An),En(An,!1,!0),Pn(An),Q({},Dn(An,"conditional_formatting"),{ruleType:"backgroundColor"}),Dn(An,"goal_line"),Dn(An,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},Nn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("lineChart").required(),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:lt,conditionalFormattingRules:bt(e.queryEngineConfig),goalLines:mt(),axisTitles:vt(),headline:ht()}))},zn=function(e){return function(t,n){var r=Et(t,n,Nn(e));return Pt(r)}},qn={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Bn=function(e){return{title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension),dimension:Ne(t.dimension),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:Cn(t.viewId),filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:Rn(t.headline,t.timeDimension),parameters:me(t.parameters),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),axisTitles:t.axisTitles}},setAttributes:zn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:Nn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(qn,"data_set"),Dn(qn,"views"),Q({},Dn(qn,"field_y_axis"),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(qn,"field_x_axis"),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(qn,"sort"),Dn(qn,"filter"),Dn(qn,"custom_metrics"),Dn(qn,"limit")]},formatPanelConfig:function(){return[On(qn),En(qn,!0,!1),Pn(qn),Q({},Dn(qn,"conditional_formatting"),{ruleType:"lineColor"}),Dn(qn,"goal_line"),Dn(qn,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},Wn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),filter:nt(e.queryEngineConfig),timeDimension:r.valid(null),order:r.array().items(Ze(e.queryEngineConfig)),type:r.valid("pieChart").required(),legend:r.valid(!0,!1),limit:rt(),labelsAsPercentage:r.boolean(),conditionalFormattingRules:bt(e.queryEngineConfig),labelFormat:r.alternatives(r.string(),r.valid(null)),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions)}))},Vn={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Hn=function(e){return{title:Vn.title,description:Vn.description,servicesClass:"PieChart",namespace:Vn.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension),dimension:Ne(t.dimension),viewId:Cn(t.viewId),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),labelsAsPercentage:t.labelsAsPercentage,legend:t.legend,labelFormat:t.labelFormat,parameters:me(t.parameters)}},setAttributes:function(t,n){return Et(t,n,Wn(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{}},t)},createFeedback:wn,schema:Wn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(Vn,"data_set"),Dn(Vn,"views"),Q({},Dn(Vn,"field_metrics"),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(Vn,"field_grouping"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(Vn,"sort"),Dn(Vn,"filter"),Dn(Vn,"custom_metrics"),Dn(Vn,"limit")]},formatPanelConfig:function(){var e,t;return[On(Vn),Q({},Dn(Vn,"conditional_formatting"),{ruleType:"backgroundColor"}),Q({},Dn(Vn,"chart_styles"),{subSection:[null==(e=Vn.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend,null==(t=Vn.format_panel.chart_styles)?void 0:t.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}},Yn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{xMeasure:Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),yMeasure:Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:r.array().items(Ze(e.queryEngineConfig)),limit:rt(),legend:r.valid(!0,!1),offset:r.number().min(0),filter:nt(e.queryEngineConfig),type:r.valid("scatterChart").required(),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:ot,approxXAxisLabelCount:ot,goalLines:mt(),axisTitles:vt()}))},Un=function(e){return function(t,n){var r=Et(t,n,Yn(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})})),It(r,i)}},Gn={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Kn=function(e){return{title:Gn.title,description:Gn.description,servicesClass:"ScatterChart",namespace:Gn.namespace,dump:function(e){return e},load:function(e){return{type:e.type,xMeasure:pe(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:pe(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:Ne(e.dimension),viewId:Cn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:de(e.filter),order:ce(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:fe(e.approxXAxisLabelCount),approxYAxisLabelCount:fe(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles}},setAttributes:Un(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:Cn(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:wn,schema:Yn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"scatterChart"),r=n.measure;return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n.dimension})},dataPanelConfig:function(){var e,t;return[Dn(Gn,"data_set"),Dn(Gn,"views"),Q({},Dn(Gn,"labelled_metrics"),{subSection:[Q({},null==(e=Gn.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.xAxis,{propKey:"xMeasure",allowsMultiple:!1}),Q({},null==(t=Gn.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.yAxis,{propKey:"yMeasure",allowsMultiple:!1})]}),Q({},Dn(Gn,"field_grouping"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(Gn,"filter"),Dn(Gn,"custom_metrics"),Dn(Gn,"limit")]},formatPanelConfig:function(){var e;return[On(Gn),Q({},Dn(Gn,"chart_styles"),{subSection:[null==(e=Gn.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend]}),Pn(Gn),Dn(Gn,"goal_line")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},Xn=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),barMeasure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),lineMeasure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),barDimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),lineDimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:rt(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),type:r.valid("comboChart").required(),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:ot,approxXAxisLabelCount:ot,goalLines:mt(),conditionalFormattingRules:r.object({bar:r.array().items(Ve(e.queryEngineConfig)),line:r.array().items(Ve(e.queryEngineConfig))}),axisTitles:vt()}))},Qn=function(e){return function(t,n){var r=Et(t,n,Xn(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}),It(r,i)}},Jn={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Zn=function(e){return{title:Jn.title,description:Jn.description,servicesClass:"ComboChart",namespace:Jn.namespace,dump:function(e){return e},load:function(t){return r=e.queryEngineConfig,Q({},n=t,{lineMeasure:pe(n.lineMeasure),barMeasure:pe(n.barMeasure),order:ce(n.order,n.timeDimension||null),filter:de(n.filter),lineDimension:Ne(n.lineDimension||n.dimension||[]),barDimension:Ne(n.barDimension||n.dimension||[]),viewId:Cn(n.viewId),approxXAxisLabelCount:fe(n.approxXAxisLabelCount),approxYAxisLabelCount:fe(n.approxYAxisLabelCount),conditionalFormattingRules:{bar:Rt(r,null==(i=n.conditionalFormattingRules)?void 0:i.bar),line:Rt(r,null==(o=n.conditionalFormattingRules)?void 0:o.line)}});var n,r,i,o},setAttributes:Qn(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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:wn,schema:Xn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.lineMeasure.length>0||e.barMeasure.length>0},autoGenerate:function(t){var n=Zr(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(){var e,t;return[Dn(Jn,"data_set"),Dn(Jn,"views"),Q({},Dn(Jn,"labelled_metrics"),{subSection:[Q({},null==(e=Jn.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.line,{propKey:"lineMeasure",allowsMultiple:!0}),Q({},null==(t=Jn.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.bar,{propKey:"barMeasure",allowsMultiple:!0})]}),Dn(Jn,"combo_chart_dimension"),Dn(Jn,"sort"),Dn(Jn,"filter"),Dn(Jn,"custom_metrics"),Dn(Jn,"limit")]},formatPanelConfig:function(){var e,t,n,r,i,o;return[On(Jn),En(Jn,!1,!0),Pn(Jn),Q({},Dn(Jn,"conditional_formatting"),{ruleType:"backgroundColor",subSection:[{title:null!=(e=null==(t=Jn.format_panel.conditional_formatting)||null==(t=t.subSectionDefinition)?void 0:t.bar.title)?e:"",namespace:null==(n=Jn.format_panel.conditional_formatting)||null==(n=n.subSectionDefinition)?void 0:n.bar.namespace,propKey:"bar"},{title:null!=(r=null==(i=Jn.format_panel.conditional_formatting)||null==(i=i.subSectionDefinition)?void 0:i.line.title)?r:"",namespace:null==(o=Jn.format_panel.conditional_formatting)||null==(o=o.subSectionDefinition)?void 0:o.line.namespace,propKey:"line"}]}),Dn(Jn,"goal_line")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},$n=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("dataTable").required(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)).required(),dimension:et(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions).required(),order:r.array().items(Ze(e.queryEngineConfig)),timeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:rt().required(),offset:r.number().min(0),filter:nt(e.queryEngineConfig),prefixes:r.array().items(He),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:bt(e.queryEngineConfig),dateTimeFormat:r.string(),protectedFields:r.object({dimension:ut(e.queryEngineConfig),measure:st(e.queryEngineConfig)}).unknown(!0),sizing:gt,tableDrilldown:r.array().items(r.object({subsetDimension:r.string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table.")}))},er=function(e){return function(t,n){var r=Et(t,n,$n(e));return Pt(r)}},tr={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{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",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},nr=[3,5,10,20,50,100,200],rr=function(e,t){return e.filter((function(e){return e.pivot==t}))},ir=function(e){return{title:tr.title,description:tr.description,servicesClass:"PivotTable",namespace:tr.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),order:ce(t.order,t.timeDimension||null),displayTitle:t.displayTitle,dimension:(r=_n({timeDimension:t.timeDimension,dimension:Ne(t.dimension)}),r.map((function(e){return Q({},e,{pivot:e.pivot?e.pivot:"x"})}))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:Tn(t.protectedFields),viewId:Cn(t.viewId),filter:de(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),dateTimeFormat:t.dateTimeFormat,prefixes:t.prefixes,exportNames:t.exportNames,numberFormat:t.numberFormat,sizing:t.sizing,tableDrilldown:(n=t.tableDrilldown,n&&n.length>0?n.map(Sn):n||[])};var n,r},setAttributes:er(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},t)},schema:$n(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"dataTable"),r=n.dimension;return this.init(t.id,{measure:n.measure.slice(0,5),dimension:r})},dataPanelConfig:function(){return[Dn(tr,"data_set"),Dn(tr,"views"),Q({},Dn(tr,"field_columns"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return Q({},e,{pivot:"y"})})),rr(n.dimension,"x"))}},getValues:function(e){return rr(e.dimension,"y")},testId:"add-pivot-dimension"}),Q({},Dn(tr,"field_rows"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return Q({},e,{pivot:"x"})})),rr(n.dimension,"y"))}},getValues:function(e){return rr(e.dimension,"x")},testId:"add-dimension"}),Dn(tr,"drilldown"),Q({},Dn(tr,"field_metrics"),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(tr,"sort"),Q({},Dn(tr,"pagination"),{options:nr}),Dn(tr,"filter"),Dn(tr,"custom_metrics")]},formatPanelConfig:function(){var e;return[On(tr),Q({},Dn(tr,"format"),{subSection:[null==(e=tr.format_panel.format)?void 0:e.subSectionDefinition.time]}),Dn(tr,"prefixes"),Q({},Dn(tr,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}},or=function(e){return function(t,n){var r=Et(t,n,dn(e));return Pt(r)}},ar={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},lr=function(e){return{title:ar.title,description:ar.description,servicesClass:"HorizontalBarChart",namespace:ar.namespace,dump:function(e){return e},load:function(e){return Q({},e,{measure:pe(e.measure),order:ce(e.order,e.timeDimension),dimension:Ne(e.dimension),viewId:Cn(e.viewId),filter:de(e.filter),approxXAxisLabelCount:fe(e.approxXAxisLabelCount),approxYAxisLabelCount:fe(e.approxYAxisLabelCount),protectedFields:Tn(e.protectedFields)})},setAttributes:or(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:Cn(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:wn,schema:dn(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(ar,"data_set"),Dn(ar,"views"),Q({},Dn(ar,"field_y_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(ar,"drilldown"),Q({},Dn(ar,"field_x_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(ar,"sort"),Dn(ar,"filter"),Dn(ar,"custom_metrics"),Dn(ar,"limit")]},formatPanelConfig:function(){return[On(ar),En(ar,!1,!0),Pn(ar),Q({},Dn(ar,"conditional_formatting"),{ruleType:"backgroundColor"}),Dn(ar,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return Fn(e,t,this.setAttributes)}}},sr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),at(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("areaChart").required(),lineCurve:lt,conditionalFormattingRules:bt(e.queryEngineConfig),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:mt(),axisTitles:vt(),headline:ht()}))},ur=function(e){return function(t,n){var r=Et(t,n,sr(e));return Pt(r)}},dr={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{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.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},cr=function(e){return{title:dr.title,description:dr.description,servicesClass:"AreaChart",namespace:dr.namespace,dump:function(e){return e},load:function(t){return{type:t.type,measure:pe(t.measure),displayTitle:t.displayTitle,dimension:Ne(t.dimension),timeDimension:t.timeDimension,displaySubject:t.displaySubject,viewId:Cn(t.viewId),filter:de(t.filter),order:ce(t.order,t.timeDimension),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,lineCurve:t.lineCurve,conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules),protectedByOrganisation:t.protectedByOrganisation,stacked:t.stacked,drilldown:t.drilldown,legend:t.legend,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,goalLines:t.goalLines,parameters:me(t.parameters),approxXAxisLabelCount:fe(t.approxXAxisLabelCount),approxYAxisLabelCount:fe(t.approxYAxisLabelCount),headline:Rn(t.headline,t.timeDimension)}},setAttributes:ur(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:Cn(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,headline:void 0},t)},createFeedback:wn,schema:sr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[Dn(dr,"data_set"),Dn(dr,"views"),Q({},Dn(dr,"field_y_axis"),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(dr,"field_x_axis"),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return kn(e,t)},getValues:function(e){return _n(e)},maxAllowed:2,testId:"add-dimension"}),Dn(dr,"sort"),Dn(dr,"filter"),Dn(dr,"custom_metrics"),Dn(dr,"limit")]},formatPanelConfig:function(){var e,t,n;return[On(dr),Q({},Dn(dr,"chart_styles"),{subSection:[null==(e=dr.format_panel.chart_styles)?void 0:e.subSectionDefinition.stacked,null==(t=dr.format_panel.chart_styles)?void 0:t.subSectionDefinition.legend,null==(n=dr.format_panel.chart_styles)?void 0:n.subSectionDefinition.curve]}),Pn(dr),Q({},Dn(dr,"conditional_formatting"),{ruleType:"areaColor"}),Dn(dr,"goal_line"),Dn(dr,"headline")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1}}},pr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{fontSize:r.string().allow(""),formatter:r.object(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),prefixes:r.object(),postfixes:r.object(),type:r.valid("singleStat").required(),limit:rt(),conditionalFormattingRules:bt(e.queryEngineConfig),deltaTimeDimension:r.alternatives($e(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions)}))},fr=function(e){if("singleMeasure"in e){var t={},n={},r=[],i={};return e.singleMeasure&&(r=[e.singleMeasure],t[_t(e.singleMeasure)]=e.prefix,n[_t(e.singleMeasure)]=e.postfix,i[_t(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:n,measure:r,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,filter:de(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:me(e.parameters)}}return Q({},e,{filter:de(e.filter)})},mr={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"}}}}},hr=function(e){return{title:mr.title,description:mr.description,servicesClass:"SingleStat",namespace:mr.namespace,dump:function(e){return e},load:function(e){var t=fr(e);return{type:"singleStat",prefixes:t.prefixes,postfixes:t.postfixes,formatter:t.formatter,fontSize:t.fontSize,measure:pe(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:Cn(e.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:me(t.parameters)}},setAttributes:function(t,n){return Et(t,n,pr(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{}},t)},schema:pr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Zr(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[n.measure[0]]})},dataPanelConfig:function(){return[Dn(mr,"data_set"),Dn(mr,"views"),Q({},Dn(mr,"field_metrics"),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Dn(mr,"filter"),Dn(mr,"custom_metrics"),Dn(mr,"comparison")]},formatPanelConfig:function(){var e;return[On(mr),Q({},Dn(mr,"stats_labels"),{prefix:Mn(mr,"prefix"),postfix:Mn(mr,"postfix"),format:Mn(mr,"format"),count:Mn(mr,"count")}),Q({},Dn(mr,"format"),{subSection:[null==(e=mr.format_panel.format)?void 0:e.subSectionDefinition.font_size]}),Q({},Dn(mr,"conditional_formatting"),{ruleType:"fontColor"})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){var n=i.cloneDeep(Wr(t.fields,{onlyFieldTypes:["number"]}));return Q({},e,{type:"singleStat",protectedByOrganisation:!0,measure:[].concat(n).map((function(e){return{function:"none",field:e.id}}))})}}},vr={title:"Custom",servicesClass:"",namespace:"custom",description:"",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:{percentages:!1,simpleMaths:!0,rules:!1,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{colorGradient:!1,parameters:!1}},gr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{type:r.valid("mercatorMap").required(),measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),limit:rt(),dimension:et({},e.attributesSchemaOptions),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()})}))},br=function(e){return function(t,n){return Et(t,n,gr(e))}},xr={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},yr=function(e){return{title:xr.title,description:xr.description,servicesClass:"MercatorMap",namespace:xr.namespace,dump:function(e){return e},load:function(e){return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:Cn(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:pe(e.measure),labelFormat:e.labelFormat,position:e.position,filter:de(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0"}},setAttributes:br(e),validate:function(){return[]},init:function(e,t){return Q({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:Cn(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0"},t)},schema:gr(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[Dn(xr,"data_set"),Dn(xr,"views"),Q({},Dn(xr,"field_metrics"),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),Q({},Dn(xr,"field_country"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),Dn(xr,"filter"),Dn(xr,"custom_metrics"),Dn(xr,"limit")]},formatPanelConfig:function(){var e;return[On(xr),Q({},Dn(xr,"chart_styles"),{subSection:[null==(e=xr.format_panel.chart_styles)?void 0:e.subSectionDefinition.number_format]}),Dn(xr,"map_colors")]},supportedCustomFields:{percentages:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},wr=function(e){return e.Linear="linear",e.Circular="circular",e}({}),jr=function(e){return r.object(Q({},it(e.attributesSchemaOptions),{measure:r.array().items(Je(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:nt(e.queryEngineConfig),type:r.valid("progress").required(),limit:rt(),conditionalFormattingRules:bt(e.queryEngineConfig),parameters:pt(e.queryEngineConfig,e.attributesSchemaOptions),goals:r.array().items(r.object({field:r.string().required().description("ID of the field in the data set to which the goal applies too"),value:r.number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:r.array().items(r.object({field:r.string().required().description("ID of the field to set the progress type of"),value:r.valid(wr.Linear,wr.Circular).required()})).description("Set the display type of the progress view"),formatter:r.object().pattern(r.string(),r.string()),prefixes:r.object().pattern(r.string(),r.string()),postfixes:r.object().pattern(r.string(),r.string())}))},Cr={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},Sr=function(e){return{title:Cr.title,description:Cr.description,dump:function(e){return e},namespace:Cr.namespace,servicesClass:"Progress",load:function(e){var t=fr(e);return{type:"progress",measure:pe(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:Cn(t.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,parameters:t.parameters,prefixes:t.prefixes,postfixes:t.postfixes,formatter:t.formatter,goals:t.goals,progressType:t.progressType}},setAttributes:function(t,n){return Et(t,n,jr(e))},validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(e,t){return Q({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:Cn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{}},t)},schema:jr(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[Dn(Cr,"data_set"),Dn(Cr,"views"),Dn(Cr,"progress_goals"),Dn(Cr,"filter"),Dn(Cr,"custom_metrics")]},formatPanelConfig:function(){return[On(Cr),Dn(Cr,"progress_type"),Q({},Dn(Cr,"stats_labels"),{prefix:Mn(Cr,"prefix"),postfix:Mn(Cr,"postfix"),format:Mn(Cr,"format"),count:Mn(Cr,"count")})]},supportedCustomFields:{percentages:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!1}}},Fr=["title","description","data_panel","format_panel"],kr=["title","description","callToAction"],_r=r.alternatives().try(r.string(),r.object({sentence:r.string().custom((function(e,t){for(var n,r=/\{\{(\w+)\}\}/g;null!==(n=r.exec(e));){var i=n[1];if(!t.state.ancestors[0][i+"_singular"]||!t.state.ancestors[0][i+"_plural"])return t.error("any.invalid",{message:'"textOverride": "'+i+'" found in sentence but corresponding "'+i+'_singular" and "'+i+'_plural" fields are missing'})}return e}))}).pattern(/.+_(singular|plural)$/,r.string())).messages({"any.custom":"{{#message}}"}),Tr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Ar=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,Dr=/on[a-z]+\s*=\s*["'][^"']*["']/gi,Ir=/javascript:[^\s"']+/gi,Or=new RegExp("^(?:"+/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source+"|"+/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source+"|[^*_<>])*$","m"),Pr=function(e){if(Tr.test(e)||Ar.test(e)||Dr.test(e)||Ir.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return Or.test(e)},Er=function(e,t,n,r){return Mr(e,t,n,void 0,r)},Mr=function(e,t,n,r,i){if(i)return"[key: "+e+"]";var o,a=r?function(e,t){var n=e[t],r=_r.validate(n);return r.error&&r.error.details.forEach((function(e){var t;Ae(null==(t=e.context)?void 0:t.message)})),function(){if("string"==typeof n)return Pr(n);if("object"==typeof n)return Pr(n.sentence);if(void 0===n)return!0;throw new Error("Invalid translation type")}()?n:void 0}(r,e):void 0;return o=function(e,t){return t?e.replace(/\[\[([^\]]+)\]\]/g,(function(e,n){for(var r,i=ie(n.split("|"));!(r=i()).done;){var o=t[r.value];if("string"==typeof o&&""!==o)return o;if("number"==typeof o)return o.toString()}return""})):e}(o="object"==typeof a&&null!==a?a.sentence:"string"==typeof a?a:t,n),n&&(o=function(e,t,n){return Object.entries(t).forEach((function(t){var r=t[0],i=t[1];if(i&&"object"==typeof i&&"count"in i){var o=1===i.count?n&&n[r+"_singular"]||i.singular:n&&n[r+"_plural"]||i.plural;e=e.replace(new RegExp("{{"+r+"}}","g"),o)}})),e}(o,n,a)),function(e,t){if(!t)return e;for(var n=0,r=Object.entries(t);n<r.length;n++){var i=r[n],o=i[1];if("string"==typeof o||"number"==typeof o){var a=new RegExp("\\[\\["+i[0]+"\\]\\]","g");e=e.replace(a,String(o))}}return e}(o,n)},Rr=function(e,t){var n=null!=t?t:Mr,r=e,i=e.namespace;return Fr.forEach((function(t){if("title"===t||"description"===t){var o,a=n(i+"."+t,e[t]);r=Q({},r,((o={})[t]=a,o))}if("data_panel"===t){var l=i+"."+t,s=[];e.dataPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Nr(e,n,l)),zr(e).forEach((function(t){var r=n(l+"."+t.key,t.defaultValue);e[t.property]=r})),s.push(e)})),r=Q({},r,{dataPanelConfig:function(){return s}})}if("format_panel"===t){var u=i+"."+t,d=[];e.formatPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Nr(e,n,u)),function(e,t,n){function r(n,r){n&&zr(n).forEach((function(i){var o=e(t+"."+r+"."+i.key,i.defaultValue);n[i.property]=o}))}function i(e,t,n){t.forEach((function(t){var i=e[t];i&&r(i,n)}))}n.x&&(i(n.x,Lr,"axis_labels"),r(n.x,"axis_labels")),n.y&&(i(n.y,Lr,"axis_labels"),r(n.y,"axis_labels")),function(e){return"prefix"in e}(n)&&i(n,Lr,"stats_labels")}(n,u,e),zr(e).forEach((function(t){var r=n(u+"."+t.key,t.defaultValue);e[t.property]=r})),d.push(e)})),r=Q({},r,{formatPanelConfig:function(){return d}})}})),r},Lr=["count","axisTitle","format","postfix","prefix"];function Nr(e,t,n){var r;return null==(r=e.subSection)?void 0:r.map((function(r){return zr(r).forEach((function(i){var o=t(n+"."+e.namespace+"."+i.key,i.defaultValue);r[i.property]=o})),r}))}function zr(e){var t=e.namespace||e.type;if(!t)return[];var n=[];return kr.forEach((function(r){if(e[r]){var i=r;"callToAction"===r&&(i="call_to_action"),n.push({key:t+"."+i,defaultValue:e[r],property:r})}})),n}var qr={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function Br(e,t){if("custom"==e)return vr;if("barChart"==e)return Rr(Ln(t||qr),null==t?void 0:t.textOverride);if("areaChart"==e)return Rr(cr(t||qr),null==t?void 0:t.textOverride);if("lineChart"==e)return Rr(Bn(t||qr),null==t?void 0:t.textOverride);if("pieChart"==e)return Rr(Hn(t||qr),null==t?void 0:t.textOverride);if("scatterChart"==e)return Rr(Kn(t||qr),null==t?void 0:t.textOverride);if("comboChart"==e)return Rr(Zn(t||qr),null==t?void 0:t.textOverride);if("dataTable"==e)return Rr(ir(t||qr),null==t?void 0:t.textOverride);if("basicTable"==e)return Rr(si(t||qr),null==t?void 0:t.textOverride);if("singleStat"==e)return Rr(hr(t||qr),null==t?void 0:t.textOverride);if("progress"==e)return Rr(Sr(t||qr),null==t?void 0:t.textOverride);if("mercatorMap"==e)return Rr(yr(t||qr),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return Rr(lr(t||qr),null==t?void 0:t.textOverride);throw"Cannot get interface for "+e+". Please implement it."}function Wr(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=Br(t);return[].concat(e).filter((function(e){var t=!0;return Ht(e)&&!n.supportedCustomFields.percentages&&(t=!1),Bt(e)&&!n.supportedCustomFields.simpleMaths&&(t=!1),Yt(e)&&!n.supportedCustomFields.rules&&(t=!1),Wt(e)&&!n.supportedCustomFields.roundedNumbers&&(t=!1),t}))}(n,t.forComponent)),null!=t&&t.removePercentage&&(n=n.filter((function(e){return!Ht(e)}))),null!=t&&t.removeRuleGrouping&&(n=n.filter((function(e){return!Yt(e)}))),null!=t&&t.removeSimpleMaths&&(n=n.filter((function(e){return!Bt(e)}))),null!=t&&t.removeAggregateMaths&&(n=n.filter((function(e){return!Vt(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 Vr=function(e,t){return e.find((function(e){return e.id==t}))||null},Hr=function(e,t){return e.find((function(e){return e.name==t}))||null},Yr=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n;throw new un(e,t)},Ur=function(e,t){var n=[].concat(e.fields).find((function(e){return e.publicName==t}));if(n)return n;throw"Failed to find field by name in data set. Looking for "+t},Gr=function(e,t){var n=i.findIndex(e,(function(e){return e.id==t}));return[e[n]||null,n]},Kr=function(e,t){return Q({},e,{fields:[].concat(e.fields).map((function(e){return function(e,t,n){var r,o=(r=function e(t,n,r){var o=i.replace(t,n,r);return o.indexOf(n)>=0?e(o,n,r):o}(e.id,"_"," ")).charAt(0).toUpperCase()+r.slice(1);return{id:e.id,dataType:e.dataType,publicName:e.publicName||o,dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],description:e.description||void 0,canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?ae(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities,supportedAggregateOptions:We(t,e.dataType,e.supportedAggregateOptions)}}(e,t)}))})},Xr=function(e,t){var n=[].concat(e.fields).filter(Gt);return t&&(n=Wr(n,{forComponent:t})),n},Qr=function(e){return Q({},e,{fields:[].concat(e.fields).filter((function(e){return!Gt(e)}))})},Jr=function(e,t){return[].concat(e).map((function(e){return e.id==t.id?t:e}))},Zr=function(e,t,n){var r="horizontalBarChart"===n?void 0:"x",i=function(e){return[].concat(Wr(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0}))}(e)[0],o=[].concat(function(e,t){return[].concat(Wr(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t}))}(e,n)).map((function(e){var n=Oe(e,t.supportedAggregates);return{field:e.id,function:n}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:i?[{field:i.id,function:"none",pivot:r}]:[]}},$r=function(e,t,n){var r=Wr(e.fields,{removeAggregateMaths:!0,removePercentage:!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}},ei=function(e){if(!e.preAggregated)throw"buildViewOnlyQuery function should only be used for single-view datasets";return{dataSetId:e.id,preparedQueryType:"preAggregated",type:"preparedQuery",filter:{}}},ti=function(e,t){if(!t)return e;e=e.map(Qr);var n=[].concat(e).map((function(e){var n=(t[e.id]||[]).map(Qt);return Q({},e,{fields:[].concat(e.fields,n)})}));return[].concat(n)},ni=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:ae({dataType:t},e)}},ri=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"string",t,n,r)},ii=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"number",t,n,r)},oi=function(e,t,n,r){return void 0===r&&(r={}),ni(e,"boolean",t,n,r)},ai=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:ae({dataType:"date_time"},e),canBeDimension:null==(a=r.canBeDimension)||a,canBeMeasure:null!=(l=r.canBeMeasure)&&l}},li={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},si=function(e){return{title:li.title,description:li.description,servicesClass:"BasicTable",namespace:li.namespace,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(t){return Q({},t,{measure:pe(t.measure),order:ce(t.order,t.timeDimension),filter:de(t.filter),dimension:Ne(t.dimension),viewId:Cn(t.viewId),protectedFields:Tn(t.protectedFields),conditionalFormattingRules:Rt(e.queryEngineConfig,t.conditionalFormattingRules)})},setAttributes:Mt(e),validate:function(t,n){return bn(t,n,e.queryEngineConfig)},init:function(t,n){var r={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],dataSetId:t,viewId:Cn(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 Mt(e)(r,n||{})},schema:yt(e),removeField:function(t,n){return Ot(t,n,e.queryEngineConfig)},setFields:function(t,n){var r=[].concat(n).map((function(e){return{field:e,function:"none"}}));return Mt(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=Wr(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!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[Dn(li,"data_set"),Dn(li,"views"),Dn(li,"fields"),Dn(li,"sort"),Q({},Dn(li,"pagination"),{options:nr}),Dn(li,"filter"),Dn(li,"custom_metrics")]},formatPanelConfig:function(){var e;return[On(li),Q({},Dn(li,"format"),{subSection:[null==(e=li.format_panel.format)?void 0:e.subSectionDefinition.time]}),Dn(li,"prefixes"),Q({},Dn(li,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0},supportedFeatures:{parameters:!1,colorGradient:!0}}},ui=function(e,t){return s.scale(e).colors(t)},di=function(e,t){var n;return(null!=t?t:0)<=(null!=(n=null==e?void 0:e.length)?n:0)?e:fi(ui(e,t))},ci={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},pi=function(e){var t=1e4*Math.sin(e++);return t-Math.floor(t)},fi=function(e,t){void 0===t&&(t=5);for(var n,r,i=e.length;i;)r=Math.floor(pi(t)*i--),n=e[i],e[i]=e[r],e[r]=n,++t;return e},mi=function(e){return"displayTitle"in e},hi=[].concat(["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","custom"]).filter((function(e){return"custom"!=e})),vi=function(e){return{attributes:e,localFilters:[],results:[],colSpan:1,reports:[],updatesFromParameters:{}}},gi=function(e,t){if("dateFilter"==e)return t("date_filter","Date filter");if("dateAndTimeFilter"==e)return t("date_time_filter","Date Time filter");if("singleSelectFilter"==e)return t("single_select_filter","Single select filter");if("multiSelectFilter"==e)return t("multi_select_filter","Multi select filter");throw"Unrecognised additional filter type "+e},bi=function(e){return Q({},e,{managedByConfiguration:!1})},xi=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):Q({},e,{type:Si(e.type)})},yi=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[]"==Yr(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)}))},wi=function(e,t,n){var r=[];return(e.globalFilters||[]).forEach((function(e){r=[].concat(r,yi(t,e,n))})),Object.values(e.localFilters||{}).flat().forEach((function(e){r=[].concat(r,yi(t,e,n))})),r},ji=function(e,t,n){if(e.title)return e.title;var r=n?n("untitled","Untitled"):"Untitled";return t.forEach((function(t){try{var n=e.appliesToFields[0],i=Yr(t,n.fieldId);t.id==n.dataSetId&&n.fieldId==i.id&&(r=i.publicName)}catch(e){}})),r},Ci=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}))},Si=function(e){return"dateTimeFilter"===e?"dateFilter":e};function Fi(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=Vr(t,o);e[o]||(e[o]=[]),null!==a&&(e[o]=[].concat(e[o],yi(a,r,n)))}))}return e}),{});return 0===Object.keys(i).length?void 0:i}}var ki=function(e){return"optionsPulledFrom"in e&&e.optionsPulledFrom&&0!==e.optionsPulledFrom.length?Q({},e,{appliesToFields:[].concat(e.optionsPulledFrom)}):e},_i=function(e,t){if("isEmpty"in e||mi(e))return e;var n=(0,Br(e.attributes.type,t).load)(e.attributes),r=[];return i.isArray(e.localFilters)&&(r=[].concat(e.localFilters?e.localFilters:[]).map((function(e){return xi(e)}))),"addOns"in e.attributes&&i.isEmpty(r)&&e.attributes.addOns.forEach((function(e){r=[].concat(r,[{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:n.dataSetId}]}])})),delete e.addOns,delete n.addOns,Q({},e,{localFilters:r,attributes:n,results:[]})},Ti=function(e){if(Li(e)||mi(e))return e;var t=[].concat(e.localFilters&&i.isArray(e.localFilters)?e.localFilters:[]).map(bi);return Q({},e,{results:void 0,queries:void 0,attributes:Q({},e.attributes,{offset:void 0}),localFilters:t})},Ai=function(e){return r.alternatives().conditional(".type",{is:"barChart",then:Ln(e).schema}).conditional(".type",{is:"mercatorMap",then:yr(e).schema}).conditional(".type",{is:"horizontalBarChart",then:lr(e).schema}).conditional(".type",{is:"lineChart",then:Bn(e).schema}).conditional(".type",{is:"comboChart",then:Zn(e).schema}).conditional(".type",{is:"areaChart",then:cr(e).schema}).conditional(".type",{is:"pieChart",then:Hn(e).schema}).conditional(".type",{is:"scatterChart",then:Kn(e).schema}).conditional(".type",{is:"singleStat",then:hr(e).schema}).conditional(".type",{is:"dataTable",then:ir(e).schema}).conditional(".type",{is:"basicTable",then:si(e).schema}).conditional(".type",{is:"progress",then:Sr(e).schema})},Di=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},Ii=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},Oi=function(e){return{colSpan:e,isEmpty:!0}};function Pi(e){return 1===e?12:e<5?12/e:2}var Ei=function(e,t){for(var n,r=i.cloneDeep(e),o=[].concat(r[t].components),a=Oi(Pi(o.length+1)),l=(o=[].concat(o,[a])).length-1,s=0;s<((n=o.length)>2&&n<5?3:2);s++){var u=Di(r,t,l,"left");o.length<5?o[s].colSpan=Pi(o.length):o[u].colSpan=o[u].colSpan-1,r[t]={components:[].concat(o),height:r[t].height}}return r},Mi=function(e,t,n,r){var i=[].concat(e),o=[].concat(i[n].components);return o[r]=Q({},t,{colSpan:o[r].colSpan}),i[n]={components:o,height:i[n].height},i},Ri=function(e,t){return{components:e,height:null!=t?t:350}},Li=function(e){return"isEmpty"in e};function Ni(e){for(var t,n=ie(e);!(t=n()).done;)for(var r,i=ie(t.value.components);!(r=i()).done;){var o=r.value;if(!("isEmpty"in o)||!0!==o.isEmpty)return!1}return!0}var zi=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},qi=function(e,t){return e.map((function(e){return function(e,t){var n=function(e){return"components"in e?e:{components:e,height:350}}(e),r=i.sumBy(n.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}:Li(e)||mi(e)?e:_i(Q({},e,{colSpan:e.colSpan}),t)}));return{components:zi(l),height:n.height||350}}(e,t)}))},Bi=function(e){return{display:e.display,componentLibrary:e.componentLibrary,isPlayground:!1,globalFilters:[],customFields:{}}},Wi={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},Vi={emptyDashboard:function(){var e=new Date;return{id:void 0,parentDashboardId:void 0,createdAt:e,updatedAt:e,metadata:{},display:[],globalFilters:[],componentLibrary:[]}},insertRow:function(e,t,n){return Q({},e,{display:Ii(e.display,t,null==n?void 0:n.height)})},setComponentOnDisplay:function(e,t,n,r){return Q({},e,{display:Mi(e.display,vi(t),n,r)})},listComponentTypesUsed:function(e){return t=[],e.display.forEach((function(e){e.components.forEach((function(e){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.type]))}))})),i.uniq(t);var t},appendEmptyCell:function(e,t){return Q({},e,{display:Ei(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){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t)}},Hi={setComponent:Mi,newEmptyCell:Oi,initRow:Ri,init:function(){return[]}},Yi=function e(t){return t.startsWith("/")?e(t.slice(1)):t.endsWith("/")?e(t.slice(0,-1)):t},Ui=function(e,t){var n=Yi(e),r=Yi(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},Gi=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},r&&(o.auth="Bearer "+r),a="",i&&(a="filter="+i.join(",")),t.next=6,e({path:"/api/v2/auth/project/"+n+"/access_token?"+a,method:"get",headers:o});case 6:if(s=(l=t.sent).body,200!=l.status){t.next=11;break}return t.abrupt("return",s.token.token);case 11:return t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Ki=function(){var e=X(G().mark((function e(t,n){var r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.dashboardAccessToken){e.next=3;break}return Fe("Using dashboard access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.dashboardAccessToken});case 3:if(!t.projectAccessToken){e.next=6;break}return Fe("Using project access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.projectAccessToken});case 6:if(!t.apiKey){e.next=11;break}return Fe("Using API Key for auth header"),e.abrupt("return",{auth:"Api-Key "+t.apiKey});case 11:if(!n.preFetchProjectAccessTokens||!t.useCookieAuth&&!t.appSessionAuthToken){e.next=24;break}return Fe("Fetching project access token from the Vizzly API",n.preFetchProjectAccessTokens.projectId,"Filtering by",n.preFetchProjectAccessTokens.resourceFilters),e.next=15,Gi(Xi(t))(n.preFetchProjectAccessTokens.projectId,t.appSessionAuthToken,n.preFetchProjectAccessTokens.resourceFilters);case 15:if(!(r=e.sent)){e.next=21;break}return Fe("Project access token received."),e.abrupt("return",{auth:"Bearer "+r});case 21:Fe("Failed to receive project access token.");case 22:e.next=25;break;case 24:Fe("Not pre-fetching project access token.");case 25:return e.abrupt("return",{});case 26:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Xi=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Ki(e,n);case 3:return r=t.sent,i=n.headers||{},o=Ui(e.host,n.path),t.next=8,u(o,{method:n.method,headers:Q({"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,Fe("HTTP Client Response",{host:e.host,path:n.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),t.abrupt("return",{body:l,status:a.status,headers:a.headers});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"},headers:null});case 21:throw t.t0;case 22:case"end":return t.stop()}}),t,null,[[0,16]])})));return function(e){return t.apply(this,arguments)}}()},Qi=function(e){return X(G().mark((function t(){var n,r;return G().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{id:e.id,created_at:e.created_at,updated_at:e.updated_at,webhook_id:e.webhook_id}})));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})))},Ji=function(e){return function(){var t=X(G().mark((function t(n){return G().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)}}()},Zi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboardAccess",n}return J(t,e),t}(ee(Error)),$i=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a;return G().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 Zi("Failed to fetch dashboard access");case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},eo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToGetDashboard",n}return J(t,e),t}(ee(Error)),to=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o;return G().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:r});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",o);case 7:throw new eo("Failed to get dashboard from POST /api/v2/multi-get-dashboard.");case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},no=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i);case 7:throw new eo("Failed to get potentially encrypted dashboard from POST /api/v2/multi-get-dashboard.");case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ro=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboard",n}return J(t,e),t}(ee(Error)),io=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="DashboardQuotaReached",n}return J(t,e),t}(ee(Error)),oo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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.metadata||n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 2:if(i=(r=t.sent).body,200!=(o=r.status)){t.next=7;break}return t.abrupt("return",{dashboard:i.dashboard,permissions:i.permissions});case 7:if(422!=o){t.next=9;break}throw new io("Dashboard quota reached; "+JSON.stringify(i));case 9:throw new ro("Failed to update the dashboard from POST /api/v2/dashboard");case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ao=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToUpdateDashboard",n}return J(t,e),t}(ee(Error)),lo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.metadata||n.meta||{},t.next=3,e({path:"/api/v2/dashboard",method:"put",body:Q({},n,{meta:r})});case 3:if(o=(i=t.sent).body,200!=i.status){t.next=8;break}return t.abrupt("return",o);case 8:throw new ao("Failed to update dashboard from PUT /api/v2/dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},so=function(e){return e.map((function(e){return{name:e.name,description:e.description||"",fields:e.fields.map((function(e){var t=[],n=["none"];return"date_time"==e.dataType?n=[].concat(n,e.allowedGranularities||[]):t=[].concat(t,e.supportedAggregateOptions||[]),{name:e.publicName,description:e.description||"",canBeDimension:e.canBeDimension,canBeMeasure:e.canBeMeasure,availableFunctionsInSelect:t,availableFunctionsInGrouping:n}}))}}))},uo=function(e){function t(){var n;return(n=e.call(this,"There has been an error with the AI. Please try again.")||this).name="AIContainsErrors",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error)),co=function(e,t){var n=i.cloneDeep(t);if("custom"===n.type)throw"Custom views are not supported by Vizzly AI.";var r,o,a,l=[],s=[],u=[],d={orWhereClauses:[]},c=[],p=[],f=n.displayTitle,m=n.displaySubject,h=n.limit;return"goalLines"in n&&(c=null==(r=n.goalLines)?void 0:r.map((function(e){return{value:e.value,color:e.color,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth}}))),"conditionalFormattingRules"in n&&Array.isArray(n.conditionalFormattingRules)&&(p=null==(o=n.conditionalFormattingRules)?void 0:o.map((function(e){return{color:e.ruleValue,field:e.filters[0][0].field,function:e.filters[0][0].function,op:e.filters[0][0].op,value:e.filters[0][0].value}}))),"measure"in n&&(l=n.measure.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function}}))),"dimension"in n&&(s=n.dimension.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function}}))),"order"in n&&(u=n.order.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function,direction:t.direction}}))),"filter"in n&&(d={orWhereClauses:null==(a=n.filter||[])?void 0:a.map((function(t){return{andWhereClauses:t.map((function(t){return{field:Yr(e,t.field).publicName,function:t.function,op:t.op,value:t.value}}))}}))}),{title:f,subtitle:m,type:n.type,dataSetName:e.name,select:l,group:s,order:u,goalLines:c,conditionalFormatting:p,filter:d,limit:h}},po=function(e,t,n,r){var o,a,l,s,u=i.cloneDeep(t),d=Hr(e,n.dataSetName);if(!d)throw"Failed to find data set by name";return"title"in n&&(u.displayTitle=n.title||u.displayTitle),"limit"in u&&"limit"in n&&(u.limit=n.limit),"filter"in u&&"filter"in n&&(u.filter=null==(o=(null==(a=n.filter)?void 0:a.orWhereClauses)||[])?void 0:o.map((function(e){return e.andWhereClauses.map((function(e){return{field:Ur(d,e.field).id,function:e.function,op:e.op,value:e.value}}))}))),"subtitle"in n&&(u.displaySubject=n.subtitle||u.displaySubject),"measure"in u&&"select"in n&&(u.measure=(n.select||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function}}))),"dimension"in u&&"group"in n&&(u.dimension=(n.group||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function}}))),"goalLines"in u&&"goalLines"in n&&(u.goalLines=null==(l=n.goalLines)?void 0:l.map((function(e){return{strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,color:e.color,value:e.value}}))),"order"in u&&"order"in n&&(u.order=(n.order||[]).map((function(e){return{field:Ur(d,e.field).id,function:e.function,direction:e.direction}}))),"conditionalFormattingRules"in u&&"conditionalFormatting"in n&&(u.conditionalFormattingRules=null==(s=n.conditionalFormatting)?void 0:s.map((function(e){var t=Ur(d,e.field);return{ruleType:"backgroundColor",ruleValue:e.color,filters:[[{field:t.id,function:e.function,op:e.op,value:e.value}]]}}))),n.type&&t.type!=n.type&&(u=Br(n.type,{queryEngineConfig:r}).init(d.id,Q({},u,{type:n.type}))),function(e,t){var n=Br(e.type,{queryEngineConfig:t}).schema.validate(e,{stripUnknown:{arrays:!0,objects:!0},allowUnknown:!1,abortEarly:!1}),r=n.error,i=n.value;return r&&Te("AI attribute errors",r),i}(u,r)},fo=function(e,t,n,r){if(!Hr(r,e.ai_view.dataSetName))throw Te("The AI returned an invalid data set ID. This is likely due to a bug in the AI. Please contact support."),new uo;return{conversationId:e.conversation_id,attributes:po(r,t,e.ai_view,n),messageHistory:e.conversation_content.messages.map((function(e){return{id:e.id,content:e.content,reaction:e.reaction,sender_type:e.sender_type,sent_at:new Date(e.sent_at),status:e.status}}))}},mo=function(e){function t(n){var r;return void 0===n&&(n="AI usage limit reached"),(r=e.call(this,n)||this).name="AIUsageLimitReached",Object.setPrototypeOf(ne(r),t.prototype),r}return J(t,e),t}(ee(Error)),ho=function(e){function t(){var n;return(n=e.call(this,"Something went wrong while fetching data from the AI.")||this).name="AIFailedToFetch",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error)),vo=function(e){function t(){var n;return(n=e.call(this,"User aborted AI request.")||this).name="AIAborted",Object.setPrototypeOf(ne(n),t.prototype),n}return J(t,e),t}(ee(Error));function go(e,t){if(200!=e){if(422==e||429==e)throw Fe("askAi","AI usage limit reached",t),new mo(t.quota+" queries per hour allowed.");if(500===e&&t&&"reason"in t&&"Aborted"===t.reason)throw new vo;throw new ho}}var bo=function(e){return function(){var t=X(G().mark((function t(n,r,i,o,a,l,s){var u,d,c,p;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=co(Vr(a,r.dataSetId),r),t.next=3,e({path:"/api/ai",method:"post",body:{question:i,conversationId:n,currentAttributes:u,dataSets:so(a),dashboardAccessToken:o},abortSignal:s});case 3:return go((d=t.sent).status,c=d.body),p=fo(c,r,l,a),t.abrupt("return",p);case 9:case"end":return t.stop()}}),t)})));return function(e,n,r,i,o,a,l){return t.apply(this,arguments)}}()},xo=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 J(t,e),t}(ee(Error)),yo=function(e){return e.ConfigStore="cnf_",e.Project="prj_",e.KeyPair="kyp_",e.Dashboard="dsh_",e.ProjectApiKey="vizzly_project_api_key_",e}({}),wo=function(e){return function(){var t=X(G().mark((function t(n,r){var i;return G().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:[yo.Project,yo.ConfigStore]}:void 0});case 2:if(200==(i=t.sent.status)){t.next=6;break}throw new xo(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)}}()},jo=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 J(t,e),t}(ee(Error)),Co=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o;return G().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:[yo.Project]}});case 2:if(200==(o=t.sent.status)){t.next=6;break}throw new jo(o);case 6:return t.abrupt("return",200==o);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},So=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a;return G().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:[yo.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 Fe("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)}}()},Fo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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:[yo.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)}}()},ko=function(e){return function(){var t=X(G().mark((function t(n){return G().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:[yo.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)}}()},_o=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:Q({},i),preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project,yo.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)}}()},To=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/question-suggestions",method:"post",body:{dataSets:so(r),dashboardAccessToken:n}});case 2:if(go(a=(i=t.sent).status,o=i.body),200!=a){t.next=8;break}return t.abrupt("return",{suggestions:o.suggestions});case 8:throw"Failed to fetch question suggestions from AI.";case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},Ao=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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:[yo.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)}}()},Do=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:[yo.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)}}()},Io=function(e){return function(){var t=X(G().mark((function t(n,r,i){return G().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:"put",body:{query_engine_user_id:r,password:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project]}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Oo=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o;return G().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:[yo.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)}}()},Po=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().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)}}()},Eo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Mo=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Ro=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().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)}}()},Lo=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o,a,l;return G().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)}}()},No=function(e){function t(t){var n;return(n=e.call(this,"Failed to save an encrypted secret for "+t)||this).name="FailedToSaveProjectEncryptedEncryptionSecret",n}return J(t,e),t}(sn),zo=function(e){function t(t){var n;return(n=e.call(this,"An encrypted secret has already been saved for "+t)||this).name="ProjectEncryptedSecretAlreadySaved",n}return J(t,e),t}(sn),qo=function(e){return function(){var t=X(G().mark((function t(n,r,i){var o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i=!1),t.next=3,e({path:"/api/v3/project/"+n+"/encrypted-encryption-secret",method:"post",body:{projectId:n,encryptedEncryptionSecret:r,allowRotation:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[yo.Project]}});case 3:if(400!=(o=t.sent.status)||!i){t.next=9;break}throw new No(n);case 9:if(400!=o||i){t.next=11;break}throw new zo(n);case 11:return t.abrupt("return",200==o);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Bo=function(e){return function(){var t=X(G().mark((function t(n,r,i,o){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/conversation/"+n+"/message/"+r,method:"post",body:{reaction:o.reaction,dashboardAccessToken:i}});case 2:return t.abrupt("return",Wo(t.sent));case 4:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},Wo=function(e){if(200===e.status)return{success:!0};throw new Error("AI Action failed")},Vo=function(e){var t=Xi(e);return{config:e,getParentDashboards:Qi(t),saveScheduledReport:Ji(t),createDashboardAccess:$i(t),multiGetDashboards:to(t),multiGetEncryptedDashboards:no(t),createDashboard:oo(t),updateDashboard:lo(t),askAi:bo(t),aiActions:Bo(t),askAiForQuestionSuggestions:To(t),createVizzlyConfigVersion:wo(t),getVizzlyConfig:So(t),saveConnection:Co(t),getConnection:Fo(t),createProjectApiKey:ko(t),updateProjectApiKey:_o(t),getProjectAccessToken:Gi(t),getProject:Ao(t),createQueryEngineUser:Do(t),updateQueryEngineUser:Io(t),getQueryEngineUser:Oo(t),getProjectTeamMembers:Po(t),createSelfHostedQueryEngineProject:Eo(t),createSelfHostedDynamicQueryEngineProject:Mo(t),createSelfHostedInBrowserQueryEngineProject:Ro(t),getManagedQueryEngineKeyPair:Lo(t),saveEncryptedProjectEncryptionSecret:qo(t)}},Ho=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadIdentity",n}return J(t,e),t}(ee(Error)),Yo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="InvalidIdentityReturn",n}return J(t,e),t}(ee(Error)),Uo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadQueryEngineConfig",n}return J(t,e),t}(ee(Error)),Go=function(e){function t(){return e.apply(this,arguments)||this}return J(t,e),t}(ee(Error)),Ko=function(e,t){return[].concat(e.supportedFeatures).includes(t)},Xo=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 J(t,e),t}(ee(Error)),Qo=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 J(t,e),t}(ee(Error)),Jo=function(e){return"string"==typeof e?{}:e.customHeaders?e.customHeaders():{}},Zo=function(e){return function(){var t=X(G().mark((function t(n){var r,i;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={host:na(e)},i=Q({},n,{headers:Q({},n.headers,Jo(e))}),t.abrupt("return",Xi(r)(i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},$o=function(){var e=X(G().mark((function e(t){var n,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Zo(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:Q({},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)}}(),ea={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards"],supportedTimeTruncFunctions:Ft(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:ge(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:ue([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:Be(["round_to_0_dp","round_to_2_dp"])},ta=function(){var e=X(G().mark((function e(t){var n,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"in-browser"!==t){e.next=5;break}return e.abrupt("return",ea);case 5:if(!("string"==typeof t||"object"==typeof t&&"endpoint"in t)){e.next=16;break}if(o=void 0,(o="string"==typeof(i=t)?i:i.endpoint).startsWith("http://")||o.startsWith("https://")||o.startsWith("/")){e.next=8;break}throw new Xo(t);case 8:return e.next=10,$o(t);case 10:if(n=e.sent){e.next=13;break}throw new Uo("Failed to load query engine config.");case 13:return e.abrupt("return",n);case 16:if("function"!=typeof t){e.next=25;break}return e.next=19,t();case 19:if(r=e.sent){e.next=22;break}throw new Uo("Failed to load query engine config.");case 22:return e.abrupt("return",Q({},r));case 25:throw new Qo;case 26:e.next=35;break;case 28:if(e.prev=28,e.t0=e.catch(0),!(e.t0 instanceof Xo)){e.next=32;break}throw e.t0;case 32:if(!(e.t0 instanceof Qo)){e.next=34;break}throw e.t0;case 34:throw new Uo("Failed to load query engine config.");case 35:case"end":return e.stop()}var i,o}),e,null,[[0,28]])})));return function(t){return e.apply(this,arguments)}}(),na=function(e){return"string"==typeof e?e:e.endpoint},ra=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToResolveDataSets",n}return J(t,e),t}(ee(Error)),ia=function(e){function t(){var t;return(t=e.call(this,"Identity prop type is invalid.")||this).name="InvalidIdentityPropType",t}return J(t,e),t}(ee(Error)),oa=function(e){function t(){var t;return(t=e.call(this,"dataSets property is not valid")||this).name="InvalidDataSetsPropType",t}return J(t,e),t}(ee(Error)),aa=function(e){return Q({},(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},la=function(e,t,n,r){var i=aa(e);"scope"in i||(i.scope="read_write");var o={dashboardAccess:i,dataAccess:t?aa(t):void 0,queryEngineAccessConfig:n?aa(n):void 0,dashboardAdminOverride:r?aa(r):void 0};return sa(o),o},sa=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)},ua=function(e){if(!e)throw new Yo("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 Yo(t.message);return e},da=function(){var e=X(G().mark((function e(t){var n,r,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:if(n=ua(n=e.sent)){e.next=6;break}throw new Ho("Failed to fetch identity config.");case 6:return r=ca()&&((o=window.location.href).split("#vizzly_")[1]||new URLSearchParams(new URL(o).search).get("_vizzlyDashboardAdmin"))||null,i=la(n.dashboardAccessToken,n.dataAccessToken,n.queryEngineAccessToken,r),e.abrupt("return",{identityConfig:i,tokens:n});case 9:case"end":return e.stop()}var o}),e)})));return function(t){return e.apply(this,arguments)}}(),ca=function(){return"undefined"!=typeof window},pa=[{namespace:"config.supported_operator",constants:oe},{namespace:"config.supported_aggregate",constants:he},{namespace:"config.supported_time",constants:wt}],fa=function(e,t,n){var r={};return Object.entries(e).forEach((function(e){var i=e[0],o=e[1];r[i]=Q({},o,{publicName:t(n+"."+i,o.publicName)})})),r},ma=function(e,t){var n=Q({},e);return n.supportedAggregates&&(n.supportedAggregates=fa(n.supportedAggregates,t,pa[1].namespace)),n.supportedTimeTruncFunctions&&(n.supportedTimeTruncFunctions=fa(n.supportedTimeTruncFunctions,t,pa[2].namespace)),n.supportedOperators&&(n.supportedOperators=fa(n.supportedOperators,t,pa[0].namespace)),n},ha=function(e,n,r,i){var o,a,l=t.useState(),s=l[0],u=l[1],d=t.useState({dataSets:void 0,queryEngineConfig:void 0,identityConfig:void 0}),c=d[0],p=d[1];return o=X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,Fe("Fetching identity config."),t.next=4,da(e);case 4:p(Q({},c,{identityConfig:t.sent.identityConfig})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),Te("Failed to refresh identity tokens.");case 12:case"end":return t.stop()}}),t,null,[[0,9]])}))),a=t.useRef(),t.useEffect((function(){a.current=o})),t.useEffect((function(){var e=setInterval((function(){a.current&&a.current()}),12e5);return function(){return clearInterval(e)}}),[12e5]),t.useEffect((function(){!function(){var t=X(G().mark((function t(){var o,a,l;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof e){t.next=3;break}throw new ia;case 3:return t.next=5,Promise.all([ta(r),da(e)]);case 5:return l=(o=t.sent)[1].identityConfig,a=ma(a=o[0],i),t.next=11,n(l,a);case 11:p({dataSets:t.sent,queryEngineConfig:a,identityConfig:l}),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),t.t0 instanceof Ho||t.t0 instanceof Uo||t.t0 instanceof Go||t.t0 instanceof Yo||t.t0 instanceof ra||t.t0 instanceof Xo||t.t0 instanceof Qo||t.t0 instanceof ia||t.t0 instanceof oa?u(t.t0):(Ae("Unknown error",t.t0),u(new Ho("Failed to load identity")));case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}()()}),[]),Q({},c,{error:s})},va=r.string().required(),ga=r.object({dataSetId:va,fieldId:r.string().required()}),ba=r.object({field:ga.required(),op:r.string().required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.array()).required(),function:r.string().optional()}),xa=r.object().pattern(va,r.array().items(ba)),ya=r.object({type:r.string().valid("fixedRange").required(),before:r.date().allow(null),after:r.date().allow(null)}),wa=r.object({type:r.string().valid("relative").required(),value:r.string().required()}),ja=r.alternatives().try(ya,wa),Ca=function(e){return r.object({type:e.required(),appliesToFields:r.array().items(ga).required(),managedByConfiguration:r.boolean().required(),requiresValue:r.boolean().required(),title:r.string().allow("").optional(),optionsFilters:xa.optional(),hidden:r.boolean().optional()})},Sa=Ca(r.string().valid("dateFilter")).keys({value:ja.allow(null)}),Fa=Ca(r.string().valid("dateAndTimeFilter")).keys({value:ja.allow(null)}),ka=Ca(r.string().valid("singleSelectFilter")).keys({value:r.alternatives().try(r.string(),r.number(),r.boolean()).allow(null),optionsPulledFrom:r.array().items(ga).optional()}),_a=Ca(r.string().valid("multiSelectFilter")).keys({value:r.alternatives().try(r.array().items(r.string()),r.array().items(r.number())).allow(null),optionsPulledFrom:r.array().items(ga).optional()}),Ta=r.alternatives().try(Sa,Fa,ka,_a),Aa=r.array().items(Ta).optional(),Da=r.object({displayTitle:r.string().min(1).required(),colSpan:r.number().valid(12).required()}),Ia=r.number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),Oa=r.object({isEmpty:r.valid(!0).required(),colSpan:Ia}),Pa=function(e){return r.object({attributes:Ai({queryEngineConfig:e}),colSpan:Ia})};function Ea(e){return r.array().required().items(r.object({height:r.number().required(),components:r.array().required().min(1).items(r.alternatives(Oa,Pa(e),Da))}))}var Ma=function(e,t){var n=t?{queryEngineConfig:t}:void 0;if("string"==typeof e.definition)throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:!1,globalFilters:[].concat(e.definition.globalFilters||[]).map((function(e){return xi(e)})),componentLibrary:[].concat(e.definition.componentLibrary||[]).map((function(e){return _i(Q({},e,{colSpan:(null==e?void 0:e.colSpan)||1}),n)})),theme:Q({},ci,e.theme),display:qi(e.definition.display,n),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},Ra=function(e,t){return e.dataSets.findIndex((function(e){return e.id==t}))},La=function(e,t){return Vr(e.dataSets,t)},Na=function(e,t){return Ra(e,t)>=0},za=function(e){var t=Q({},e),n={};e.dataSets.forEach((function(e){n[e.id]=Xr(e)}));var r,i=null===t.parentDashboardId?t.componentLibrary:Qa(t),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})).map(bi);return{isPlayground:e.isPlayground,globalFilters:o,componentLibrary:[].concat(i).map(Ti),display:(r=e.display,r.map((function(e){return{components:[].concat(e.components).map(Ti),height:e.height}}))),customFields:n}},qa=function(e,t,n){return Q({},e,{dataSets:ti(t,n)})},Ba=function(e){var t=[];return e.display.forEach((function(e){e.components.forEach((function(e){Li(e)||mi(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t).flatMap((function(t){var n=Vr(e.dataSets,t);return n?[n]:[]}))},Wa=function(e){var t=Ba(e),n=function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),i.uniq(t).flatMap((function(t){var n=Vr(e.dataSets,t);return n?[n]:[]}))}(e);return i.uniqBy([].concat(n,t),(function(e){return e.id}))},Va=function(e,t){return[].concat(t).filter((function(t){return t.parentDashboardId==e}))},Ha=function(e){return[].concat(e).filter((function(e){return null==e.parentDashboardId}))},Ya=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]},Ua=function(e){return[].concat(e).sort((function(e,t){var n=new Date(e.updatedAt);return new Date(t.updatedAt).getTime()-n.getTime()}))},Ga=function(e){return Ua(e)[0]||null},Ka=function(e,t){return e.find((function(e){return e.id==t}))||null},Xa=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?Q({},e,{componentLibrary:[].concat(Qa(e),i)}):e}))},Qa=function(e){return e.componentLibrary.filter((function(e){return!e.attributes.protectedByOrganisation}))};function Ja(e,t,n){var r=t.find((function(e){return e.id===n}));return void 0===r?e:Q({},r,{id:e.id,createdAt:e.createdAt,updatedAt:new Date})}var Za=function(e,t){var n=new Map;return e.forEach((function(e){var t=e.attributes.viewId;n.set(null!=t?t:"",e)})),t.forEach((function(e){var t=e.attributes.viewId;n.has(null!=t?t:"")||n.set(null!=t?t:"",e)})),Array.from(n.values())},$a=function(e){var t=e.filter((function(e){return e.isProgrammatic}));if(0!==t.length){if(t.length>1)throw new Error("There should only be one programmatic dashboard");return t[0].id}},el={__proto__:null,indexOfDataSet:Ra,getDataSet:La,hasDataSet:Na,getComponentsUsingDataSet:function(e,t){return i.flatMap([].concat(e.display),(function(e){return i.flatMap(e.components,(function(e){return Li(e)||mi(e)?[]:(null==e?void 0:e.attributes.dataSetId)==t?[e]:[]}))}))},toSaveableDefinition:za,setDataSets:qa,newSaveable:function(e){return Q({isPlayground:!1,display:[{components:[Oi(8),Oi(4)],height:350},{components:[Oi(4),Oi(4),Oi(4)],height:350}],componentLibrary:[],globalFilters:[],customFields:{}},e)},takePlaygroundDashboards:function(e){return i.filter([].concat(e),(function(e){return e.isPlayground}))},takeLiveDashboards:function(e){return i.filter([].concat(e),(function(e){return!e.isPlayground}))},getDataSetsUsedOnDisplay:Ba,getDataSetsUsedOnDashboard:Wa,getCopiesOfParentDashboard:Va,getParentDashboards:Ha,getFirstCreated:Ya,orderByLastUpdated:Ua,takeMostRecentlyUpdated:Ga,find:Ka,updateLibraryWithProtectedComponents:Xa,resetToParentDashboard:Ja,buildProgrammaticDashboard:function(e,t){var n=[];return e.map((function(e){var r;if(void 0===e.id)throw new Error("Dashboard id is undefined");var i=qa(e,t,e.customFields||{});n.push({id:i.id,dataSets:i.dataSets,display:null!=(r=i.display)?r:[],globalFilters:[],componentLibrary:i.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})})),n},updateWithProgrammaticDashboard:function(e,t){var n=new Map(t.map((function(e){return[e.id,e]})));return e.map((function(e){var t=n.get(e.id);if(null!==e.parentDashboardId){var r=n.get(e.parentDashboardId);if((null==r?void 0:r.id)===e.parentDashboardId)return Q({},e,{componentLibrary:Za(null==r?void 0:r.componentLibrary,e.componentLibrary)})}return null!=t?t:e}))},addUniqueLibraryComponents:Za,checkAndReturnProgrammaticDashboardId:$a,colSpanSchema:Ia,saveableDashboardDefinitionSchema:function(e){return r.object({id:r.string(),display:Ea(e),componentLibrary:r.array().required().items(Ai({queryEngineConfig:e})),globalFilters:Aa,customFields:r.object().required()})},displaySchema:Ea,fromRaw:Ma,Dashboard:void 0},tl=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a,l,s;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.defaultParentDashboardId,i=Ka(e.dashboards,n.parentDashboardId||r)){t.next=4;break}throw"Cannot create a child dashboard from a parent dashboard which does not exist.";case 4:return o=Bi(i),a=n.dashboard?Bi(n.dashboard):o,l={definition:a,metadata:n.metadata,parentDashboardId:i.id,permissions:[{scope:"read_write"}]},t.next=9,e.createDashboard(l);case 9:if(!(s=t.sent)){t.next=12;break}return t.abrupt("return",s.id);case 12:return t.abrupt("return",null);case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},nl=function(e){return function(){var t=X(G().mark((function t(n){return G().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)}}()},rl=function(e){return function(){var t=X(G().mark((function t(n,r){return G().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)}}()},il=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadOnlyPermissionNotFound",n}return J(t,e),t}(ee(Error)),ol=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadPermissionNotFound",n}return J(t,e),t}(ee(Error)),al=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="WritePermissionNotFound",n}return J(t,e),t}(ee(Error)),ll=function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read_write"==t.scope}));if(!n)throw new al("Cannot find write permission for dashboard "+e);return n},sl=function(e,t){try{return!!ll(e,t)}catch(e){if(e instanceof al)return!1;throw e}},ul=function(e){return function(){var t=X(G().mark((function t(n,r){var i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Zo(e),t.next=3,i({path:"/api/v1/get-dashboards",method:"post",body:{dashboardAccessTokens:n},abortSignal:r});case 3:if(a=(o=t.sent).body,200!=o.status){t.next=8;break}return t.abrupt("return",a);case 8:throw new eo("Failed to get dashboard from POST /api/v1/get-dashboards");case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},dl=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o,a;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zo(e),t.next=3,r({path:"/api/v1/dashboard",method:"post",body:{dashboardAccessToken:n.dashboardAccessToken,definition:n.definition,meta:n.metadata||n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 3:if(o=(i=t.sent).body,200!=(a=i.status)){t.next=8;break}return t.abrupt("return",{dashboard:o.dashboard,permissions:o.permissions});case 8:if(422!=a){t.next=10;break}throw new io("Dashboard quota reached; "+JSON.stringify(o));case 10:throw new ro("Failed to update the dashboard from POST /api/v2/dashboard");case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};function cl(e,t,n){var r=Ma(e.dashboard,n);return{createdDashboard:qa(r,t,e.dashboard.definition.customFields||{}),formattedPermissions:e.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}}))}}function pl(e,t,n,r){return fl.apply(this,arguments)}function fl(){return(fl=X(G().mark((function e(t,n,r,i){var o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Q({},t,{dashboardAccessToken:n.dashboardAccess.signature}),"vizzlyApi"!==r.strategy){e.next=7;break}return e.next=4,i.createDashboard(a);case 4:o=e.sent,e.next=15;break;case 7:if("queryEngine"!==r.strategy){e.next=14;break}return l=dl(r.endpoint),e.next=11,l(a);case 11:o=e.sent,e.next=15;break;case 14:throw"Unsupported strategy for creating dashboard "+JSON.stringify(r);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ml=function(e){return function(){var t=X(G().mark((function t(n){var r,i,o;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zo(e),t.next=3,r({path:"/api/v1/dashboard",method:"put",body:Q({},n)});case 3:if(o=(i=t.sent).body,200!=i.status){t.next=8;break}return t.abrupt("return",o);case 8:throw new ao("Failed to update dashboard from PUT /api/v1/dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};function hl(e,t,n){return vl.apply(this,arguments)}function vl(){return(vl=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyApi"!==t.strategy){e.next=6;break}return e.next=3,n.updateDashboard(r);case 3:i=e.sent,e.next=14;break;case 6:if("queryEngine"!==t.strategy){e.next=13;break}return o=ml(t.endpoint),e.next=10,o(r);case 10:i=e.sent,e.next=14;break;case 13:throw"Unsupported strategy for updating dashboard "+JSON.stringify(t);case 14:return e.abrupt("return",i);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gl(e,t,n,r,i){var o=Ma(e.dashboard,i),a=qa(o,t,e.dashboard.definition.customFields||{});return{newDashboards:[].concat(n).flatMap((function(e){return e.id==a.id?r.deleted?[]:[a]:[e]})),updatedDashboard:a}}function bl(e,t,n){return(Array.isArray(e.found)?e.found:[]).map((function(e){var r,i=Ma(e,n);return qa(i,t,(null==(r=e.definition)?void 0:r.customFields)||{})}))}function xl(e,t,n,r){return yl.apply(this,arguments)}function yl(){return(yl=X(G().mark((function e(t,n,r,i){var o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyApi"!=t.strategy){e.next=6;break}return e.next=3,n.multiGetDashboards(r,i.signal);case 3:o=e.sent,e.next=14;break;case 6:if("queryEngine"!==t.strategy){e.next=13;break}return a=ul(t.endpoint),e.next=10,a(r,i.signal);case 10:o=e.sent,e.next=14;break;case 13:throw"Unsupported strategy for fetching dashboards "+JSON.stringify(t);case 14:return e.abrupt("return",o);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var wl={strategy:"vizzlyApi"},jl=function(e,t){return"function"!=typeof e&&e&&t&&t.supportedFeatures.includes("encryptedDashboards")&&"in-browser"!==e?{strategy:"queryEngine",endpoint:e}:wl};function Cl(e){return function(e,t){return[].concat(e).map((function(e){return function(e,t){var n=t.find((function(t){return t.dashboardId==e}));if(!n)throw new ol("Cannot find read permission for dashboard "+e);return n}(e,t).token}))}((t=[].concat(e).map((function(e){return e.dashboardId})),i.uniq(t)),e);var t}var Sl=function(e,n,r,i,o,a,l){var s=t.useState(),u=s[0],d=s[1],c=t.useState(),p=c[0],f=c[1],m=function(){var t=X(G().mark((function t(i){var s,u,c,p,m;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e||!n){t.next=41;break}return t.prev=1,t.next=4,r.createDashboardAccess(e.dashboardAccess.signature,null==(s=e.dashboardAdminOverride)?void 0:s.signature,i.signal);case 4:return c=Cl(u=t.sent.permissions),t.next=9,xl(o,r,c,i);case 9:if(p=bl(t.sent,n,a),i.signal.aborted){t.next=24;break}if(m=Xa(p),!l){t.next=23;break}return t.t0=el,t.t1=m,t.t2=el,t.next=19,l(n);case 19:t.t3=t.sent,t.t4=n,t.t5=t.t2.buildProgrammaticDashboard.call(t.t2,t.t3,t.t4),m=t.t0.updateWithProgrammaticDashboard.call(t.t0,t.t1,t.t5);case 23:f({dashboards:m,permissions:u});case 24:t.next=41;break;case 26:if(t.prev=26,t.t6=t.catch(1),!(t.t6 instanceof eo)){t.next=32;break}d(t.t6),t.next=41;break;case 32:if(!(t.t6 instanceof Zi)){t.next=36;break}d(t.t6),t.next=41;break;case 36:if(!(t.t6 instanceof Go)){t.next=40;break}d(t.t6),t.next=41;break;case 40:throw t.t6;case 41:case"end":return t.stop()}}),t,null,[[1,26]])})));return function(e){return t.apply(this,arguments)}}();if(t.useEffect((function(){var e=new AbortController;return void 0===p&&m(e),function(){return e.abort()}}),[e,i]),!p||!e)return{isLoading:!0,error:u};var h=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=ll(t.dashboardId,p.permissions),e.next=3,r.saveScheduledReport(Q({},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)}}(),v=function(){var t=X(G().mark((function t(i){var l,s,u;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=7;break}return t.next=3,pl(i,e,o,r);case 3:return l=cl(t.sent,n,a),u=l.formattedPermissions,f({dashboards:[].concat(p.dashboards,[s=l.createdDashboard]),permissions:[].concat(p.permissions,u)}),t.abrupt("return",s);case 7:throw"Unable to create a dashboard when the data sets have not been loaded.";case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=function(){var e=X(G().mark((function e(t,i){var l,s,u,d;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=9;break}return l=ll(t,p.permissions),s=Q({},i,{dashboardSessionToken:l.token}),e.next=5,hl(o,r,s);case 5:return u=gl(e.sent,n,p.dashboards,i,a),d=u.updatedDashboard,f({dashboards:u.newDashboards,permissions:[].concat(p.permissions)}),e.abrupt("return",d);case 9:throw"Unable to update a dashboard when the data sets have not been loaded.";case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),b=[].concat(p.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 il("Cannot find read-only permission for dashboard "+e);return n}(e,t)}catch(e){if(e instanceof il)return!1;throw e}}(e.id,p.permissions)})),x=[].concat(p.dashboards).filter((function(e){return sl(e.id,p.permissions)})),y=function(e,t,n){if(e){var r=Ka(n,e);if(null!=r&&r.parentDashboardId)throw"[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.";return e}var i=Ha(n);return $a(i)||t||Ya(i).id}(i,e.dashboardAccess.dashboardId,p.dashboards);return{childDashboardCount:[].concat(p.dashboards||[]).filter((function(e){return!!e.parentDashboardId})).length,defaultParentDashboardId:y,createDashboard:v,updateDashboard:g,saveScheduledReport:h,permissions:p.permissions,writeAccessDashboards:x,readOnlyAccessDashboards:b,dashboards:p.dashboards,error:u,accessType:e.dashboardAdminOverride?"admin":e.dashboardAccess.accessType}};function Fl(e){return r.object({id:r.string().required(),display:e?Ea(e):r.object().required(),parentDashboardId:r.string().required().allow(null),metadata:r.object(),componentLibrary:r.array().required(),globalFilters:Aa.required(),createdAt:r.date().required(),updatedAt:r.date().required()})}var kl={convert:!1,stripUnknown:!1,allowUnknown:!0},_l=function(e,t){var n=i.cloneDeep(t).filter((function(t){return t.parentDashboardId==e}));return i.sortBy(n,(function(e){return e.updatedAt})).reverse()};function Tl(e){return i.cloneDeep(e).filter((function(e){return null==e.parentDashboardId}))}var Al=function(e,t,n,r){var o=ha(e,X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[]);case 1:case"end":return e.stop()}}),e)}))),t,Er),a=o.identityConfig,l=o.dataSets,s=o.queryEngineConfig,u=Vo(r||{host:"https://api.vizzly.co"}),d=Sl(a,l,u,n,jl(t,s),s);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,f=function(e,t){try{if(!Array.isArray(e))throw new Error("dashboards must be an array");for(var n,r=[],i=ie(e);!(n=i()).done;){var o=n.value,a=Fl(t).validate(o,kl);if(a.error)throw Ae("There is an error with Dashboard "+o.id+". It has been removed from the array.",a.error.message),new Error("Validation error for dashboard "+o.id+": "+a.error.message);r.push({id:o.id,parentDashboardId:o.parentDashboardId,globalFilters:o.globalFilters,display:o.display,componentLibrary:o.componentLibrary,createdAt:o.createdAt,updatedAt:o.updatedAt,metadata:o.metadata})}return r}catch(e){throw Ae("Error building client-facing dashboards: "+e),e}}(d.dashboards,s);return{VizzlySDK:(p={queryEngineConfig:s},Q({},function(e){return{BasicTable:{init:si(e).init,setAttributes:si(e).setAttributes,setFields:si(e).setFields,validate:si(e).validate,setDateTimeFormat:si(e).setDateTimeFormat},DataTable:{init:ir(e).init,setAttributes:ir(e).setAttributes,validate:ir(e).validate},HorizontalBarChart:{init:lr(e).init,setAttributes:lr(e).setAttributes,validate:lr(e).validate},BarChart:{init:Ln(e).init,setAttributes:Ln(e).setAttributes,validate:Ln(e).validate},AreaChart:{init:cr(e).init,setAttributes:cr(e).setAttributes,validate:cr(e).validate},SingleStat:{init:hr(e).init,setAttributes:hr(e).setAttributes,validate:hr(e).validate},PieChart:{init:Hn(e).init,setAttributes:Hn(e).setAttributes,validate:Hn(e).validate},LineChart:{init:Bn(e).init,setAttributes:Bn(e).setAttributes,validate:Bn(e).validate},ComboChart:{init:Zn(e).init,setAttributes:Zn(e).setAttributes,validate:Zn(e).validate}}}(p),{displayPositions:Wi,Display:Hi,Dashboard:Vi})),loading:!1,getChildDashboards:function(e){return _l(e,f)},dashboards:_l(d.defaultParentDashboardId,f),allChildDashboards:(c=f,i.cloneDeep(c).filter((function(e){return null!=e.parentDashboardId}))),parentDashboards:Tl(f),createDashboard:tl(d),deleteDashboard:nl(d),updateDashboardMeta:rl(d),isAdmin:"admin"==d.accessType,defaultParentDashboardId:d.defaultParentDashboardId}},Dl=function(e,t,n){return Al(e,X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ea);case 1:case"end":return e.stop()}}),e)}))),t,n)},Il=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={error:void 0,tryCount:0},n}J(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),Ol={string:function(e,t,n){return void 0===n&&(n={}),ri(ea,e,t,n)},number:function(e,t,n){return void 0===n&&(n={}),ii(ea,e,t,n)},boolean:function(e,t,n){return void 0===n&&(n={}),oi(ea,e,t,n)},stringArray:function(e,t,n){return void 0===n&&(n={}),function(e,t,n,r){return void 0===r&&(r={}),ni(ea,"string[]",t,n,r)}(0,e,t,n)},dateTime:function(e,t,n){return void 0===n&&(n={}),ai(ea,e,t,n)}},Pl={__proto__:null,number:ii,string:ri,boolean:oi,dateTime:ai,InBrowser:Ol},El=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}(),Ml=["vizzly-studio","vizzly-toolbar","vizzly-modals","vizzly-popover"].map((function(e){return"\n ."+e+" hr {"+Ll({height:"0",color:"inherit",borderTopWidth:"1px"})+"}\n ."+e+" svg {"+Ll({display:"block",verticalAlign:"middle"})+"}\n "})).join(""),Rl=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{",Ll(El),";}",Ml,";","")})};function Ll(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}var Nl=new(function(){function e(){this.subscribers={}}var t=e.prototype;return t.get=function(e,t){var n=this;return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),function(){n.subscribers[e]=n.subscribers[e].filter((function(e){return e!==t}))}},t.set=function(e,t){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e(t)}))},t.reload=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({reload:!0})}))},t.save=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({save:!0})}))},e}()),zl=require("../package.json");if("undefined"!=typeof window&&"undefined"!=typeof localStorage){var ql=localStorage.getItem("__VIZZLY__LOG_LEVEL_STORED");ql&&je(ql),window.VizzlyDev={version:(null==zl?void 0:zl.version)||"dev",setLogLevel:function(e){if(ye.includes(e))return je(e,(function(e){localStorage.setItem("__VIZZLY__LOG_LEVEL_STORED",e)})),"Log level set to "+e+".";console.warn("Invalid log level. Please set one of",ye)}}}var Bl={year:"numeric",month:"short",day:"numeric"},Wl={year:"numeric",month:"short"},Vl={weekday:"long",year:"numeric",month:"long",day:"numeric"},Hl=function(e,t,n){if(!e)return"";var r=e.toLocaleDateString("en-GB",n);return t&&t!=Intl.DateTimeFormat().resolvedOptions().timeZone?r+" ("+t+")":r},Yl=function(e,t){var n={hour:"2-digit",minute:"2-digit"};return t&&(n.seconds="2-digit"),e.toLocaleTimeString("en-GB",n)},Ul=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"+Kl(e)+", "+e.getFullYear().toString():"week"==t?"Week "+Xl(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=Q({},Bl,{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=Q({},Vl,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"hh:mm"==t?Yl(e):"hh:mm:ss"==t?Yl(e,!0):"DD MMMM YYYY"==t?function(e,t){return Hl(e,void 0,Bl)}(e):"MMMM YYYY"==t?Hl(e,null,Wl):"YYYY-MM-DD[T]HH:mm:ss"==t?e.getFullYear()+"-"+r+"-"+i+"T"+Yl(e):"YYYY"==t?e.getFullYear().toString():null},Gl=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Kl=function(e){return Math.floor((e.getMonth()+3)/3)},Xl=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)},Ql=function(e,t){return e/t*100},Jl=function(e,t){return(Math.round(100*e)/100).toFixed(t)},Zl=function(e,t){return new Intl.NumberFormat(void 0,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e)},$l=function(e){return Array(e).fill(void 0)},es=function(e,t){var n=i.cloneDeep(e);return n.splice(t,1),n},ts=function(e,t,n,r){return JSON.stringify({dimensionKeys:e,dimensionValues:t,fieldId:n,function:r})},ns=function(e){if(!e)return!1;try{return rs(e),!0}catch(e){return!1}},rs=function(e){var t=JSON.parse(e);return{dimensionKeys:t.dimensionKeys,dimensionValues:t.dimensionValues,fieldId:t.fieldId,function:t.function}},is=function(e){var t=rs(e);return Ee({function:t.function,field:t.fieldId})},os=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}),{})}))},as=function(e,t,n,r,o){if(void 0===r&&(r=!1),!e)return[];var a=os(e),l=[].concat(a).map((function(e){var r=[].concat(n.x).map((function(t){return Ie(e[t],o)})),i={},a=[].concat(n.y).map((function(t){return e[t]}));t.forEach((function(t){var r=_t(t),o=ts(n.y,a,t.field,t.function);i[o]=e[r]}));var l={};return[].concat(n.x).forEach((function(t){l[t]=e[t]})),Q({},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?fs(d):d},ls=function(e,t,n){if(!n)return[];var r=os(n),i={};return r.forEach((function(n){var r=[].concat(e.y).map((function(e){return n[e]}));t.forEach((function(t){var n=ts(e.y,r,t.field,t.function);i[n]=!0}))})),Object.keys(i)},ss=function(e,t){return i.findIndex(e.fields,(function(e){return e.id==t}))},us=function(e,t){return e.fields[ss(e,t)]},ds=function(e){return void 0===e},cs=function(e){return null===e},ps=function(e){return!!ds(e)||!!cs(e)||i.isEmpty(e.content)},fs=function(e){var t=["x","xValues"];return e.map((function(e){var n=Q({},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)?Ql(n[o],r):e}))}))},ms=["contains_substring","does_not_contain_substring","ends_with","starts_with","<","<=",">",">="],hs=function(e,t){return function(e,t){if(null==t&&ms.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."}(e,t)},vs=function(e){var t=e("number_format_option.noValueReplacement","No value"),n=e("number_format_option.formattingError","Formatting error");return{_vizzly_compact:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Intl.NumberFormat(void 0,{notation:"compact"}).format(e)},description:e("number_format_option.compact","Compact")},_vizzly_to_2_dp:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Jl(e,2)},description:e("number_format_option.to_2_dp","2 decimal places")},_vizzly_to_gbp:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"GBP")},description:e("number_format_option.currency_gbp","Currency £")},_vizzly_to_usd:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"USD")},description:e("number_format_option.currency_usd","Currency $")},_vizzly_to_eur:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Zl(e,"EUR")},description:e("number_format_option.currency_eur","Currency €")},_vizzly_to_percentage:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:function(e,t){var n=(100*e).toFixed(2);return n.endsWith(".00")?parseInt(n)+"%":n+"%"}(e)},description:e("number_format_option.percentage","Percentage")},_vizzly_separated:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:e.toLocaleString()},description:e("number_format_option.separated","Separated")},_vizzly_number:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:""+e},description:e("number_format_option.number","Number")},_vizzly_hours_and_minutes_from_minutes:{formatter:function(e,r){return void 0===r&&(r=t),null==e?r:Number.isNaN(e)?n:Math.floor(e/60)+" H : "+Jl(e%60,0)+" M"},description:e("number_format_option.minutes_to_hours_minutes","Minutes to hours & minutes")}}},gs=function(e,t,n){return void 0===n&&(n=[]),[].concat(n,[e,"NONE"===(null==t?void 0:t.toUpperCase())?null:t]).filter((function(e){return null!=e})).join(" • ")},bs=function(e,t,n){var r=i.merge({},t,e);return i.merge({},n,r)},xs=function(e,t){return JSON.stringify(e)==JSON.stringify(t)},ys=function(e,t,n){var r=rs(n);return[].concat(t).flatMap((function(t){var n,i,o,a,l,s,u=Ee({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(i=null==(o=t.filters)?void 0:o[0][0].function)?i:"none"}),d=e.some((function(e){return e.field===u}))&&("string"==typeof(null==(a=t.filters)?void 0:a[0][0].value)||"boolean"==typeof(null==(l=t.filters)?void 0:l[0][0].value)||"number"==typeof(null==(s=t.filters)?void 0:s[0][0].value));return d||_t({field:r.fieldId,function:r.function})==u?[{rule:t,isRuleOnDimension:d}]:[]}))},ws=function(e,t,n,r,i){return ys(e,t,n).map((function(e){var t,n,o,a,l,s,u,d=Ee({field:null==(t=e.rule.filters)?void 0:t[0][0].field,function:null!=(n=null==(o=e.rule.filters)?void 0:o[0][0].function)?n:"none"}),c=Re(d,{supportedAggregates:r,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),p=c.function,f=Yr(i,c.fieldId),m="When "+f.publicName+" "+(p&&"none"!=p?"("+p+")":"")+" "+(null==(a=e.rule.filters)?void 0:a[0][0].op)+" "+(null==(l=e.rule.filters)?void 0:l[0][0].value);return{isRuleOnDimension:e.isRuleOnDimension,color:e.rule.ruleValue,explanation:m,value:null==(s=e.rule.filters)?void 0:s[0][0].value,operator:null==(u=e.rule.filters)?void 0:u[0][0].op,conditionIsMet:function(t){var n,r;return hs({value:null==(n=e.rule.filters)?void 0:n[0][0].value,op:null==(r=e.rule.filters)?void 0:r[0][0].op},_s(f,t))}}}))},js=function(e,t,n,r,o){if(n){var a=ys(e,t,r),l=rs(r),u=a.find((function(e){var t,a,s,u=e.rule,d=e.isRuleOnDimension;if(!i.isEmpty(u.filters)&&0!==u.filters.length){var c=Ee({field:null==(t=u.filters)?void 0:t[0][0].field,function:null!=(a=null==(s=u.filters)?void 0:s[0][0].function)?a:"none"}),p=d?Yr(o,c):void 0,f=d?[].concat(l.dimensionValues,null!=n[c]?[n[c]]:[]):[n[r]];return i.some(f,(function(e){var t,n;return null==e?null:hs({op:null==(t=u.filters)?void 0:t[0][0].op,value:null==(n=u.filters)?void 0:n[0][0].value},p?_s(p,e):e)}))}}));if(u){var d=u.rule,c=d.ruleValue;return{value:c=function(e,t,n){if(e.boundaries&&2===e.boundaries.length&&e.ruleValueEnd){var r=e.boundaries[0],i="number"==typeof r?r:Number(r),o=e.boundaries[1],a="number"==typeof o?o:Number(o);t=s.scale([e.ruleValue,e.ruleValueEnd]).domain([i,a])(n).hex()}return t}(d,c,n[r]),type:u.rule.ruleType}}}},Cs=function(e,t,n){return function(r){if(e){var i,o=new Date(r);if(isNaN(o.getTime()))return"";var a,l=n.dateTimeFormatOptions[null==t||null==(i=t[null==e?void 0:e.truncate])?void 0:i.dateFormat],s=n.dateTimeFormatOptions[(null==n?void 0:n.format)||""];return a=null!=s&&s.formatter?s.formatter(new Date(r)):null!=l&&l.formatter?l.formatter(new Date(r)):Ul(new Date(r),"DD MMMM YYYY, hh:mm")||new Date(r).toISOString(),""+(n.prefix||"")+a+(n.postfix||"")}return r=ks(r,n.numberFormatOptions,n.format),""+(n.prefix||"")+r+(n.postfix||"")}},Ss=function(e,t){return function(n){var r;return"number"==typeof n?(n=ks(n,function(e,t){var n;return Q({},t,((n={}).default=function(e){return{description:"Default",formatter:vs(e)._vizzly_compact.formatter}}(e),n))}(e,null==t?void 0:t.numberFormatOptions),null!=(r=null==t?void 0:t.format)?r:"default"),""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")):""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")}},Fs=function(e,t,n,r,i){return function(o){if(e){var a=rs(o),l=_t({function:a.function,field:a.fieldId}),s=us(e,l),u=le(a.function,t);if(s){var d=gs(null==s?void 0:s.publicName,u,a.dimensionValues),c=i({fieldId:a.fieldId,func:a.function,type:null!=n?n:"barChart",defaultLabel:d,viewId:null!=r?r:"",dimensionValues:a.dimensionValues,dimensionKeys:a.dimensionKeys});return null!=c?c:d}}}},ks=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 _s(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 Ts={transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)"},As=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=Q({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=Q({},r,n.variants&&n.variants[e]&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=Q({},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=Q({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t};function Ds(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 Is(e){for(var t,n={},r=ie(e);!(t=r()).done;){var i=t.value;n[i.toString()]=100-i}return n}var Os=Is([5,8,20,80,90]),Ps={base:Rs("55, 65, 81",0)};for(var Es in Os)Ps[Es]=Rs("55, 65, 81",Os[Es]);var Ms={font:{header:16,standard:13,bold:400,sanSerif:"Inter, sans-serif",color:"rgb(55, 65, 81)"},size:{borderRadius:"0.5rem"},colors:{brand:Ps,blue:"rgb(48, 116, 217)",contrast:"rgb(249, 247, 250)",success:"#43BA73"}};function Rs(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))+")"}var Ls={backgroundColor:"transparent",backgroundImage:"none",WebkitAppearance:"button",border:"none",cursor:"pointer",padding:0},Ns=As(Ls),zs=As(Q({},Ls,{color:Ds(10),borderRadius:8,padding:4,"&:hover":{background:Ds(90),color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}})),qs={margin:0},Bs={margin:0,textDecoration:"underline",color:"rgb(47, 129, 247)",cursor:"pointer"},Ws={listStyle:"none",padding:0,margin:0},Vs={padding:0,margin:0},Hs=As(qs),Ys='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Us=As({fontFamily:Ys,fontSize:"1em"}),Gs=As(Bs),Ks=As(Ws),Xs=As(Vs),Qs=As({height:"100%"}),Js=As({fontWeight:700}),Zs={xs:"0.75rem",sm:"0.8rem"},$s=As({whiteSpace:"nowrap"}),eu=As({position:"absolute",left:-9999,width:1,height:1,overflow:"hidden"}),tu=Object.assign((function(){return null}),{iconButton:zs,ml:function(e){return As({marginLeft:e})},bw:function(e){return As({borderWidth:e})},pt:function(e){return As({paddingTop:e})},pl:function(e){return As({paddingLeft:e})},pr:function(e){return As({paddingRight:e})},pb:function(e){return As({paddingBottom:e})},py:function(e){return As({paddingTop:e,paddingBottom:e})},p:function(e){return As({padding:e})},mt:function(e){return As({marginTop:e})},mb:function(e){return As({marginBottom:e})},mr:function(e){return As({marginRight:e})},m:function(e){return As({margin:e})},my:function(e){return As({marginTop:e,marginBottom:e})},codeText:Us,bold:Js,button:Ns,text:Hs,link:Gs,srOnly:eu,liReset:Ks,ulReset:Xs,textSize:function(e){return As({fontSize:Zs[e]||"1rem"})},opacity:function(e){return As({opacity:e})},color:function(e){return As({color:e})},align:function(e){return As({textAlign:e})},height100:Qs,nowrap:$s}),nu=Object.assign((function(){return null}),{button:Ls,text:qs,link:Bs,codeFontFamily:Ys}),ru=As({display:"block",verticalAlign:"middle"}),iu=Object.assign((function(){return null}),{selectedComponent:function(e){return As(Q({},Ts,nu.button,{borderRadius:null==e?void 0:e.borderRadius,"&:hover":Q({},Ts,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),"&:focus":Q({},Ts,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),variants:{componentSelect:{true:Q({},Ts,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius,"&:focus-visible":{outline:0},"&:focus":{outline:0},"&:hover":Q({},Ts,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius})})}}}))},tableWrapper:As({display:"flex",height:268,width:"100%",flexDirection:"column",position:"relative"})}),ou={name:"n8i3ag",styles:"position:relative;height:100%;width:100%;flex-grow:1;overflow-x:hidden"},au={name:"4hfwcq",styles:"height:100%;width:100%;flex-grow:1"},lu=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{css:ou,"aria-disabled":!0,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx("div",{css:au,children:null==e?void 0:e.children})},su=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{className:""+iu.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})},uu={name:"c1vcec",styles:"display:inline-block;height:1rem;width:1rem"},du=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:e.active?"black":"none",css:uu,viewBox:"0 0 24 24",strokeWidth:2.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"})})},cu={name:"6r56vi",styles:"height:1rem;width:1rem"},pu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:cu,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"})})},fu={name:"3vy5qs",styles:"height:1.25rem;width:1.25rem;opacity:0.7"},mu=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:fu,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"})})},hu={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},vu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:hu,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"})})},gu={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},bu={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},xu=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:gu,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:bu,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"})})]})},yu={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},wu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:yu,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"})})},ju={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Cu=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:ju,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"})})},Su={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Fu=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Su,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"})})},ku={name:"6r56vi",styles:"height:1rem;width:1rem"},_u=function(e){return c.jsx("svg",{onClick:e.onClick,css:ku,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"})})},Tu={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},Au=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Tu,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"})})},Du={name:"6r56vi",styles:"height:1rem;width:1rem"},Iu={name:"6r56vi",styles:"height:1rem;width:1rem"},Ou=function(e){return c.jsxs(c.Fragment,{children:[e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Du,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:Iu,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"})})]})},Pu={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},Eu=function(e){return c.jsx("svg",{onClick:e.onClick,css:Pu,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"})})},Mu=function(e){return c.jsx("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"24",height:null!=e&&e.height?""+(null==e?void 0:e.height):"24",viewBox:"0 0 160 160",fill:"rgb(55, 65, 81)",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"})})},Ru={name:"37ue6p",styles:"display:inline-block;height:1.25rem;width:1.25rem"},Lu=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",css:Ru,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"})})},Nu=function(e){return c.jsx("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"16",height:null!=e&&e.height?""+(null==e?void 0:e.height):"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),children:c.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",clipRule:"evenodd"})})},zu=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:c.jsx("path",{fillRule:"evenodd",d:"M7.28 7.72a.75.75 0 0 1 0 1.06l-2.47 2.47H21a.75.75 0 0 1 0 1.5H4.81l2.47 2.47a.75.75 0 1 1-1.06 1.06l-3.75-3.75a.75.75 0 0 1 0-1.06l3.75-3.75a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},qu=function(e){return c.jsxs("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"24",height:null!=e&&e.height?""+(null==e?void 0:e.height):"24",viewBox:"0 0 20 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M17.5007 4.66663C16.2923 4.66663 15.6173 5.86663 15.8923 6.75829L12.934 9.72496C12.684 9.64996 12.3173 9.64996 12.0673 9.72496L9.94232 7.59996C10.2257 6.70829 9.55065 5.49996 8.33398 5.49996C7.12565 5.49996 6.44232 6.69996 6.72565 7.59996L2.92565 11.3916C2.03398 11.1166 0.833984 11.7916 0.833984 13C0.833984 13.9166 1.58398 14.6666 2.50065 14.6666C3.70898 14.6666 4.38398 13.4666 4.10898 12.575L7.90065 8.77496C8.15065 8.84996 8.51732 8.84996 8.76732 8.77496L10.8923 10.9C10.609 11.7916 11.284 13 12.5007 13C13.709 13 14.3923 11.8 14.109 10.9L17.0757 7.94163C17.9673 8.21663 19.1673 7.54163 19.1673 6.33329C19.1673 5.41663 18.4173 4.66663 17.5007 4.66663Z",fill:"url(#paint0_linear_2169_391)"}),c.jsx("path",{d:"M12.5 5.5L13.2833 3.775L15 3L13.2833 2.225L12.5 0.5L11.7333 2.225L10 3L11.7333 3.775L12.5 5.5Z",fill:"url(#paint1_linear_2169_391)"}),c.jsx("path",{d:"M2.91732 7.16667L3.33398 5.5L5.00065 5.08333L3.33398 4.66667L2.91732 3L2.50065 4.66667L0.833984 5.08333L2.50065 5.5L2.91732 7.16667Z",fill:"url(#paint2_linear_2169_391)"}),c.jsxs("defs",{children:[c.jsxs("linearGradient",{id:"paint0_linear_2169_391",x1:"0.833984",y1:"4.66663",x2:"19.4886",y2:"5.49589",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),c.jsxs("linearGradient",{id:"paint1_linear_2169_391",x1:"10",y1:"0.5",x2:"15.0947",y2:"0.623532",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),c.jsxs("linearGradient",{id:"paint2_linear_2169_391",x1:"0.833984",y1:"3",x2:"5.07954",y2:"3.10294",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#3074D9"}),c.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),c.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]})]})]})},Bu=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:c.jsx("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})})},Wu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"})})},Vu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"})})},Hu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Ds(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{d:"M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z"})})},Yu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"})})},Uu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},Gu=function(e){var t,n;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:c.jsx("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 0 1-1.313-1.313V9.564Z",clipRule:"evenodd"})})},Ku=function(e){var t,n;return c.jsx("svg",{fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",viewBox:"0 0 32 32",id:"icon",xmlns:"http://www.w3.org/2000/svg",stroke:"inherit",strokeWidth:"0.736",children:c.jsx("path",{d:"M18,28A12,12,0,1,0,6,16v6.2L2.4,18.6,1,20l6,6,6-6-1.4-1.4L8,22.2V16H8A10,10,0,1,1,18,26Z"})})},Xu={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,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0},Qu={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,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0},Ju=function(e,t,n,r){var i=Q({},Qu,e);return"admin"==n&&(i=Q({},Xu,Zu(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),Ko(t,"simpleMaths")||(i.allowSimpleMathsCustomField=!1),Ko(t,"aggregateMaths")||(i.allowAggregateMathsCustomField=!1),Ko(t,"subquery")||(i.allowPercentagesCustomField=!1),Ko(t,"switchField")||(i.allowRulesCustomField=!1),Ko(t,"roundedNumbers")||(i.allowRoundedNumberCustomField=!1),i},Zu=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,canDownloadViewData:void 0===e.canDownloadViewData||e.canDownloadViewData,canDownloadDataSet:void 0===e.canDownloadDataSet||e.canDownloadDataSet}},$u={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},ed=function(e,t){return{description:t,range:{before:Gl(e),after:Gl((n=e,r=new Date(n.getTime()-864e5),new Date(r.getFullYear(),r.getMonth(),r.getDate())))}};var n,r},td=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}}},nd=function(e){return{today:(t=new Date,n=e("filter.today","Today"),r=Gl(t),i=new Date(r),i.setDate(i.getDate()+1),i.setMilliseconds(i.getMilliseconds()-1),{description:n,range:{before:i,after:r}}),past_1_day:td(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:ed(new Date,e("filter.yesterday","Yesterday")),past_3_days:td(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:td(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:td(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:td(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:td(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:td(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:td(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:td(0,18,e("filter.past_18_months","Last 18 months"))};var t,n,r,i},rd=function(){for(var e=nd(Er),t={},n=0,r=Object.entries($u);n<r.length;n++){var i=r[n],o=i[0];i[1]&&o in e&&(t["_vizzly_"+o]=e[o])}return t},id=function(e,t){var n=nd(e),r=Object.keys($u).map((function(e){return e in n?"_vizzly_"+e:e})),i=r.indexOf("_vizzly_today");i>-1&&(r.splice(i,1),r.unshift("_vizzly_today"));for(var o,a={},l={},s=ie(r);!(o=s()).done;){var u=o.value,d=u.replace("_vizzly_",""),c=n[d],p=null==t?void 0:t[d];"boolean"==typeof p?p&&(l[u]=c):null!=p?l[u]=p:!1!==$u[d]&&(l[u]=c)}if(t)for(var f=0,m=Object.entries(t);f<m.length;f++){var h=m[f],v=h[0],g=h[1];v in $u||(r.push(v),l[v]=g)}for(var b,x=ie(r);!(b=x()).done;){var y=b.value;y in l&&(a[y]=l[y])}return a},od=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingDateTimeFormatOption",n}return J(t,e),t}(ee(Error)),ad={"DD/MM/YYYY":{description:"DD/MM/YYYY",formatter:function(e){return Ul(e,"DD/MM/YYYY")}},"MM/DD/YYYY":{description:"MM/DD/YYYY",formatter:function(e){return Ul(e,"MM/DD/YYYY")}},"DD-MM-YYYY":{description:"DD-MM-YYYY",formatter:function(e){return Ul(e,"DD-MM-YYYY")}},"MM-DD-YYYY":{description:"MM-DD-YYYY",formatter:function(e){return Ul(e,"MM-DD-YYYY")}},"DD MMMM YYYY, hh:mm":{description:"DD MMMM YYYY, hh:mm",formatter:function(e){return Ul(e,"DD MMMM YYYY, hh:mm")}},"dddd DD MMMM YYYY, hh:mm":{description:"dddd DD MMMM YYYY, hh:mm",formatter:function(e){return Ul(e,"dddd DD MMMM YYYY, hh:mm")}},"hh:mm":{description:"hh:mm",formatter:function(e){return Ul(e,"hh:mm")}},"hh:mm:ss":{description:"hh:mm:ss",formatter:function(e){return Ul(e,"hh:mm:ss")}},"DD MMMM YYYY":{description:"DD MMMM YYYY",formatter:function(e){return Ul(e,"DD MMMM YYYY")}},"MMMM YYYY":{description:"MMMM YYYY",formatter:function(e){return Ul(e,"MMMM YYYY")}},YYYY:{description:"YYYY",formatter:function(e){return Ul(e,"YYYY")}},"YYYY-MM-DD[T]HH:mm:ss":{description:"YYYY-MM-DD[T]HH:mm:ss",formatter:function(e){return Ul(e,"YYYY-MM-DD[T]HH:mm:ss")}},quarter:{description:"Quarter",formatter:function(e){return Ul(e,"quarter")}},week:{description:"Week",formatter:function(e){return Ul(e,"week")}}},ld=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 od("Date format option "+r+" is required by the query engine, but it has not been set on the dateTimeFormatOptions.")})),n},sd={mode:"endUser",scope:"read_write",maxCSVDownloadLimit:1e4,featureToggles:Q({},Qu),developerTools:!1,componentOverrides:{},customComponents:[],reportScheduleOptions:[],overrideDeveloperInfo:null,disableToolbar:!1,onlyViewTypes:function(){return[]},dataPanel:function(e){return e},formatPanel:function(e){return e},isProgrammaticParent:!1,dashboardFilters:function(){return[]},onDashboardFilterChange:function(){},dateFilterOptions:rd(),dateTimeFormatOptions:ad,numberFormatOptions:vs(Er),textOverrides:{},queryEngineConfig:ea,organizationName:void 0,onEditorUpdate:function(e){return e},onSave:function(){return Te("Save functionality not set.")},onScheduledReportChange:function(){var e=X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Te("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.")},textOverride:function(e,t){return t},labelFormat:function(){}},ud=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&&dd(),r&&cd()}),[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})},dd=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;}"})},cd=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;}"})},pd=n.createContext(Q({},sd,{setOverrideDeveloperInfo:function(){throw"Not initiated."}})),fd=function(e){var n,r,a=e.textOverride||Er,l=t.useState(null),s=l[0],u=l[1],d=function(e,t,n,r){var a,l=e.mode||sd.mode,s=e.scope||sd.scope,u=e.isProgrammaticParent||sd.isProgrammaticParent,d="admin"==l?{}:Q({},e.componentOverrides),c=e.queryEngineConfig?e.queryEngineConfig:sd.queryEngineConfig;return Q({},sd,{isProgrammaticParent:u,mode:l,scope:s,reportScheduleOptions:e.reportScheduleOptions||sd.reportScheduleOptions,customComponents:e.customComponents||sd.customComponents,componentOverrides:d,onlyViewTypes:function(e){var r,o,a;return(r=hi,o=n,a=[].concat(t||r),o&&(a=i.reject(a,(function(e){return o.includes(e)}))),a).filter((function(t){var n=!!Br(t).setDataAttributesFromPreAggregatedDataSet;return!(e.preAggregated&&!n)}))},developerTools:null!=(a=e.developerTools)&&a,featureToggles:Ju(o.merge({},sd.featureToggles,e.featureToggles),c,l,s),textOverrides:e.textOverrides||sd.textOverrides,maxCSVDownloadLimit:e.maxCSVDownloadLimit?e.maxCSVDownloadLimit:sd.maxCSVDownloadLimit,queryEngineConfig:c,dataPanel:e.dataPanel?e.dataPanel:sd.dataPanel,formatPanel:e.formatPanel?e.formatPanel:sd.formatPanel,numberFormatOptions:Q({},vs(r),e.numberFormatOptions),onEditorUpdate:e.onEditorUpdate?e.onEditorUpdate:sd.onEditorUpdate,dateFilterOptions:id(r,e.dateFilterOptions),onSave:e.onSave?e.onSave:sd.onSave,onScheduledReportChange:e.onScheduledReportChange?e.onScheduledReportChange:sd.onScheduledReportChange,dashboardFilters:e.dashboardFilters?e.dashboardFilters:sd.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange?e.onDashboardFilterChange:sd.onDashboardFilterChange,onOpenConfigManagerUi:e.onOpenConfigManagerUi,organizationName:e.organizationName,dateTimeFormatOptions:ld(Q({},sd.dateTimeFormatOptions,e.dateTimeFormatOptions?e.dateTimeFormatOptions:{}),c),disableToolbar:e.disableToolbar})}(Q({},e.dashboardBehaviour||{},{mode:e.mode}),e.includeComponentTypes,e.excludeComponentTypes,a);return c.jsx(ud,{developerTools:null==(n=e.dashboardBehaviour)?void 0:n.developerTools,children:c.jsx(pd.Provider,{value:Q({},d,{isProgrammaticParent:e.isProgrammaticParent,setOverrideDeveloperInfo:u,overrideDeveloperInfo:s,onError:e.onError,onReset:e.onReset,onViewClick:e.onViewClick,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:a,labelFormat:e.labelFormat?(r=e.labelFormat,function(e){if(r){var t,n=r(e);if("string"==typeof(t=n)||void 0===t)return n;console.error("labelFormat function returned an invalid type",e)}}):function(){},pdfSettings:e.pdfSettings,id:e.id,containerWidth:e.containerWidth}),children:e.children})})},md=function(){return n.useContext(pd)},hd=function(e){var t=md(),n=t.developerTools,r=t.setOverrideDeveloperInfo,i=t.componentOverrides[e.renderOverrideKey];if(i){var o=Q({},e.componentProps,{testId:void 0,onClickWithDevToolCheck:void 0,activeDevToolHighlight:void 0});return delete o.testId,delete o.onClickWithDevToolCheck,delete o.activeDevToolHighlight,i(o)}var a=!0===n||"object"==typeof n&&n.componentOverride;return c.jsx(e.Element,Q({},e.componentProps,{activeDevToolHighlight:a,onClickWithDevToolCheck:function(t){return function(n){if(!n.shiftKey||!a)return t&&t(n);r({overrideKey:e.renderOverrideKey,componentProps:e.componentProps}),n.stopPropagation()}}}))},vd=function(e,t,n){return function(r){return c.jsx(hd,{Element:e,renderOverrideKey:t,componentProps:n?n(r):r})}},gd=function(e,t,n){return vd((function(n){return c.jsx(xd,{activeDevToolHighlight:n.activeDevToolHighlight,onClickWithDevToolCheck:n.onClickWithDevToolCheck,renderOverrideKey:t,children:c.jsx(e,Q({},n))})}),t,n)},bd={name:"bjn8wh",styles:"position:relative"},xd=function(e){var t;return c.jsx("div",Q({style:{display:"inherit"},css:bd,onClick:e.onClickWithDevToolCheck()},((t={})["data-componentoverride"]=null==e?void 0:e.renderOverrideKey,t),{"data-testid":e.renderOverrideKey,children:e.children}))},yd=gd((function(e){return c.jsx(du,{active:e.active})}),"renderFilterIcon"),wd=gd((function(){return c.jsx(Eu,{})}),"renderReportIcon"),jd=gd((function(){return c.jsx(Lu,{active:!0})}),"renderParametersIcon"),Cd=gd((function(){return c.jsx(pu,{})}),"renderCloseIcon"),Sd=gd((function(){return c.jsx(mu,{})}),"renderUndoIcon"),Fd=gd((function(){return c.jsx(vu,{})}),"renderCompletedIcon"),kd=gd((function(e){return c.jsx(xu,{purpose:e.purpose})}),"renderDeleteIcon"),_d=gd((function(){return c.jsx(wu,{})}),"renderEditIcon"),Td=gd((function(){return c.jsx(Cu,{})}),"renderLockedIcon"),Ad=gd((function(){return c.jsx(Fu,{})}),"renderDownloadIcon"),Dd=gd((function(){return c.jsx(_u,{})}),"renderComponentOptionsMenuIcon"),Id=gd((function(){return c.jsx(Au,{})}),"renderLibraryIcon"),Od=gd((function(e){return c.jsx(Ou,{isOpen:e.isOpen})}),"renderAccordionIcon"),Pd=gd((function(){return c.jsx(Bu,{})}),"renderSendIcon"),Ed=gd((function(){return c.jsx(Gu,{})}),"renderStopIcon"),Md=gd((function(){return c.jsx(Nu,{})}),"renderUserIcon"),Rd=gd((function(){return c.jsx(Mu,{width:20,height:20})}),"renderAIChatIcon"),Ld=gd((function(){return c.jsx(qu,{width:20,height:20})}),"renderAIIcon"),Nd=gd((function(){return c.jsx(Vu,{width:20,height:20})}),"renderThumbsUpUnselectedIcon"),zd=gd((function(){return c.jsx(Wu,{width:20,height:20})}),"renderThumbsUpSelectedIcon"),qd=gd((function(){return c.jsx(Yu,{width:20,height:20})}),"renderThumbsDownUnselectedIcon"),Bd=gd((function(){return c.jsx(Hu,{width:20,height:20})}),"renderThumbsDownSelectedIcon"),Wd=gd((function(){return c.jsx(Uu,{width:20,height:20})}),"renderSelectIcon"),Vd=gd((function(){return c.jsx(zu,{})}),"renderBackButtonArrowIcon");function Hd(){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 Yd=function(e){var t,n;return As({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,justifyContent:null==e?void 0:e.justifyContent,alignItems:null==e?void 0:e.alignItems,alignContent:null==e?void 0:e.alignContent,gridTemplateAreas:null==e?void 0:e.areas,minWidth:null==e?void 0:e.minWidth})},Ud=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"div";return c.jsx(r,{className:Hd(""+Yd(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})},Gd=Object.assign((function(){return null}),{container:function(e){return As({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 As(Q({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"},Ts,{variants:{clickable:(r={},r.true={cursor:"pointer","&:hover":Q({background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},Ts),"&: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:As({marginRight:"0.5rem",color:"inherit","&:hover":{opacity:.7}})});function Kd(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 Xd=function(){return t.useContext(Qd)},Qd=t.createContext(void 0);function Jd(e,t){if(void 0!==e)return s(e).brighten(t).css()}var Zd=function(e){return 1===e?$d:tc},$d={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,forms:{label:{fontSize:Ms.font.standard,fontWeight:Ms.font.bold,margin:"0 0 0.3rem 0"},input:{border:"2px "+Ms.colors.brand[8]+" solid",background:"#fff",borderRadius:Ms.size.borderRadius,padding:"0.35rem 0.5rem",fontSize:Ms.font.standard,color:Ms.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+Ms.colors.brand[8]+" solid",background:"#fff",borderRadius:Ms.size.borderRadius,padding:"0.35rem 0.5rem",color:Ms.colors.brand.base,fontSize:Ms.font.standard,fontWeight:"inherit",indicatorColor:Ms.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:Ms.size.borderRadius,padding:"0.26rem 0.5rem",fontSize:Ms.font.standard,color:Ms.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:Ms.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:Ms.font.header,fontWeight:Ms.font.bold,color:Ms.font.color}}}},dropdowns:{fontSize:Ms.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:Ms.size.borderRadius,border:"0px solid transparent",separatorBorder:"1px solid "+Ms.colors.brand[8],"&:hover":{background:Ms.colors.brand[5]},padding:"0.5rem"},buttons:{primary:{borderRadius:Ms.size.borderRadius,border:"1px solid rgb(48, 116, 217)",background:Ms.colors.blue,padding:"0.30rem 0.75rem",boxShadow:"0 2px 0 rgb(0 0 0 / 5%)",color:"#fff",fontSize:Ms.font.standard,"&:hover":{background:"#5795e6"}},secondary:{borderRadius:Ms.size.borderRadius,border:"1px solid "+Ms.colors.brand[20],background:"rgb(255, 255, 255)",padding:"0.30rem 0.75rem",color:Ms.font.color,fontSize:Ms.font.standard,"&:hover":{border:"1px solid rgb(209, 209, 209, 0.8)",color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}},add:{border:"2px dashed rgba(143, 143, 145, 0.2)",borderRadius:Ms.size.borderRadius,color:"#8f8f91",background:"transparent","&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:"0.75rem"},medium:{fontSize:Ms.font.standard},large:{fontSize:Ms.font.standard}},grid:{selected:{borderRadius:Ms.size.borderRadius,fontWeight:Ms.font.bold,background:"rgb(243 244 246)",fontSize:Ms.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:Ms.size.borderRadius,fontWeight:Ms.font.bold,background:"transparent",fontSize:Ms.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:Ms.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:Ms.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:Ms.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:Ms.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:Ms.font.bold,fontSize:Ms.font.standard},content:{fontSize:Ms.font.standard}},tabs:{selected:{borderRadius:Ms.size.borderRadius,padding:"0.5rem 0",fontSize:Ms.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:Ms.size.borderRadius,padding:"0.5rem 0",fontSize:Ms.font.standard,fontWeight:600,color:"rgba(0, 0, 0, 0.4)"}},lists:{title:{fontSize:14,fontWeight:Ms.font.bold},fontSize:Ms.font.standard,border:"2px solid rgb(229 231 235 / 0.6)",borderRadius:Ms.size.borderRadius,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"}},popoverMenu:{borderRadius:Ms.size.borderRadius,fontSize:Ms.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:Ms.font.bold,fontSize:Ms.font.header,color:Ms.colors.brand[90]},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Ds(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"}},tables:{th:{background:Ds(95),borderTop:0,borderBottom:"3px solid "+Ds(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+Ds(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:Ms.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Ds(70)},row:{borderBottom:"1px solid "+Ds(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}}},accordion:{iconColor:Ms.colors.blue,button:{fontWeight:Ms.font.bold,fontSize:Ms.font.standard,color:Ms.colors.blue}},dashboard:{borderColor:Ds(80),borderStyle:"solid",borderWidth:2,borderRadius:Ms.size.borderRadius,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:Ms.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 "+Ds(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Jd("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Ds(15),background:"#fff"}},icons:{borderRadius:8,color:Ds(5),padding:4,"&:hover":{color:Jd(Ds(5),.95),background:Ds(95)}}},ec=Ds(82),tc={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,version:2,forms:{label:{fontSize:14,color:Ds(0),fontWeight:500,margin:"0 0 0.3rem 0"},input:{fontSize:14,padding:"7px 1rem",color:Ds(0),fontWeight:400,border:"2px "+ec+" solid",background:"#fff",borderRadius:8,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+ec+" solid",background:"#fff",borderRadius:8,indicatorColor:Ms.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:Ds(0),fontWeight:400},dateTime:{input:{border:"2px "+ec+" solid",background:"#fff",borderRadius:8,padding:"0.26rem 0.5rem",fontSize:14,color:Ds(0),"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},date:{width:90},time:{width:40},indicatorColor:Ms.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:Ms.font.header,fontWeight:Ms.font.bold,color:Ms.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 transparent solid","&:hover":{background:Ds(95)},padding:"0.5rem 1rem"},buttons:{primary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,fontWeight:500,background:Ds(0),color:"#fff",border:"0",boxShadow:"unset",narrowPadding:"0.46rem 1rem 0.5rem","&:hover":{background:Ds(10),border:0,boxShadow:"unset"},"&:disabled":{opacity:1,background:Ds(50),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(50),border:"0"}},secondary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,background:"rgb(255, 255, 255)",fontWeight:500,color:Ds(0),border:"0",boxShadow:"unset","&:hover":{background:"#e9ebf0",border:0,boxShadow:"unset"},"&:disabled":{opacity:.7,background:"transparent",border:0},"&:hover:disabled":{opacity:.7,background:"transparent",border:0}},add:{border:"2px dashed "+Ds(70),color:Ds(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:Ms.font.bold,fontSize:Ms.font.standard},content:{fontSize:Ms.font.standard}},tabs:{selected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,background:Ds(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:Ds(50),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(50),border:"0"}},unselected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,color:Ds(25),"&:hover":{background:Ds(90)},"&:disabled":{opacity:1,background:Ds(90),border:"0"},"&:hover:disabled":{opacity:1,background:Ds(90),border:"0"}}},lists:{title:{fontSize:14,fontWeight:Ms.font.bold},subTitle:{fontSize:14,fontWeight:Ms.font.bold,color:Ds(20),margin:"0 0 0.5rem 0"},fontSize:Ms.font.standard,borderRadius:8,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"},border:"2px solid "+ec},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:Ms.font.bold,fontSize:Ms.font.header,color:Ds(10)},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Ds(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"}},tables:{th:{background:"transparent",borderTop:0,borderBottom:"2px solid "+Ds(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid transparent",last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:Ms.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Ds(70)},row:{borderBottom:"1px solid transparent",padding:"0.5rem",borderRight:"1px solid "+Ds(70),borderLeft:"1px solid "+Ds(70)},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}},body:{cells:{padding:"7.3px 8px",fontSize:13,borderBottom:"1px solid "+Ms.colors.brand[8]},odd:{"&:hover":{background:Ms.colors.brand[5]}},even:{"&:hover":{background:Ms.colors.brand[5]}}}},accordion:{iconColor:Ms.colors.blue,button:{fontWeight:Ms.font.bold,fontSize:Ms.font.standard,color:Ms.colors.blue}},dashboard:{borderColor:Ds(80),borderStyle:"solid",borderWidth:2,borderRadius:8,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:Ds(20),fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid "+ec,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 "+Ds(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Jd("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Ds(15),background:"#fff"}},icons:{borderRadius:8,color:Ds(5),padding:4,"&:hover":{color:Jd(Ds(5),.95),background:Ds(95)}}},nc=f({key:"css"}),rc=function(e){var t,n,r=null!=(t=null==(n=e.theme)?void 0:n.version)?t:2,o=i.defaultsDeep({},ic(r,null==e?void 0:e.theme,null==e?void 0:e.storedTheme),Zd(r));return c.jsx(Qd.Provider,{value:o,children:c.jsx(d.CacheProvider,{value:nc,children:null==e?void 0:e.children})})},ic=function(e,t,n){var r,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,j,C,S,F,k,_,T,A,D,I={baseFont:{fontSize:null!=(r=null!=(o=null==t||null==(a=t.baseFont)?void 0:a.fontSize)?o:null==n?void 0:n.fontSize)?r:Ms.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:Ms.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:Ms.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:Zd(e).colors,rowLimit:null!=(y=null!=(w=null==t?void 0:t.rowLimit)?w:null==n?void 0:n.rowLimit)?y:Zd(e).rowLimit,detail:null!=(j=null!=(C=null==t?void 0:t.detail)?C:null==n?void 0:n.detail)?j:Zd(e).detail,fontFamily:null!=(S=null!=(F=null==t?void 0:t.fontFamily)?F:null==n?void 0:n.fontFamily)?S:Ms.font.sanSerif,fontSize:null!=(k=null!=(_=null==t?void 0:t.fontSize)?_:null==n?void 0:n.fontSize)?k:Ms.font.sanSerif,dashboard:{icon:{color:null!=(T=null==t||null==(A=t.dashboard)||null==(A=A.icon)?void 0:A.color)?T:null==(D=Zd(e))||null==(D=D.dashboard)||null==(D=D.icon)?void 0:D.color}}};return i.merge({},t,I)},oc=t.createContext(!1);function ac(e){return c.jsx(oc.Provider,{value:e.force,children:e.children})}function lc(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,lc),a}var sc=["static"],uc=["unmount"],dc=["as","children","refName"],cc=function(e){return e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e}({}),pc=function(e){return e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e}({});function fc(e){var t=e.slot,n=e.defaultTag,r=e.features,i=e.visible,o=void 0===i||i,a=e.name,l=hc(e.theirProps,e.ourProps);if(o)return mc(l,t,n,a);var s=null!=r?r:cc.None;if(s&cc.Static){var u=l.static,d=void 0!==u&&u,c=te(l,sc);if(d)return mc(c,t,n,a)}if(s&cc.RenderStrategy){var p,f=l.unmount,m=void 0===f||f,h=te(l,uc);return lc(m?pc.Unmount:pc.Hidden,((p={})[pc.Unmount]=function(){return null},p[pc.Hidden]=function(){return mc(Q({},h,{hidden:!0,style:{display:"none"}}),t,n,a)},p))}return mc(l,t,n,a)}function mc(e,n,r,i){var o;void 0===n&&(n={});var a=bc(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=te(a,dc),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(gc(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({},hc(m.props,gc(bc(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=ie(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({},bc(p,["ref"]),s!==t.Fragment&&f,s!==t.Fragment&&h),m)}function hc(){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=ie(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 vc(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function gc(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}function bc(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),i=ie(t);!(n=i()).done;){var o=n.value;o in r&&delete r[o]}return r}var xc="undefined"==typeof window||"undefined"==typeof document,yc=xc?t.useEffect:t.useLayoutEffect;function wc(e){var n=t.useRef(e);return yc((function(){n.current=e}),[e]),n}var jc=function(e){var t=wc(e);return n.useCallback((function(){return t.current.apply(t,arguments)}),[t])},Cc=Symbol();function Sc(){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=jc((function(e){for(var t,n=ie(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[Cc])}))?void 0:o}var Fc,kc=function(e){return 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",e}({}),_c={serverHandoffComplete:!1};function Tc(){var e=t.useState(_c.serverHandoffComplete),n=e[0],r=e[1];return t.useEffect((function(){!0!==n&&r(!0)}),[n]),t.useEffect((function(){!1===_c.serverHandoffComplete&&(_c.serverHandoffComplete=!0)}),[]),n}var Ac=0;function Dc(){return++Ac}var Ic=null!=(Fc=n.useId)?Fc:function(){var e=Tc(),t=n.useState(e?Dc:null),r=t[0],i=t[1];return yc((function(){null===r&&i(Dc())}),[r]),null!=r?""+r:void 0},Oc=["features"],Pc=function(e){return e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e}({}),Ec=vc((function(e,t){var n=e.features,r=void 0===n?Pc.None:n,i=te(e,Oc);return fc({ourProps:{ref:t,"aria-hidden":(r&Pc.Focusable)===Pc.Focusable||void 0,style:Q({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&Pc.Hidden)===Pc.Hidden&&!((r&Pc.Focusable)===Pc.Focusable)&&{display:"none"})},theirProps:i,slot:{},defaultTag:"div",name:"Hidden"})}));function Mc(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}function Rc(){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 Mc((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=ie(e.splice(0));!(t=n()).done;)(0,t.value)()},workQueue:function(){return X(G().mark((function e(){var n,r,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=ie(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 Lc(e){return xc?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}var Nc=["[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(","),zc=function(e){return 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",e}({}),qc=function(e){return e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e}({}),Bc=function(e){return e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e}(Bc||{}),Wc=function(e){return e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e}({});function Vc(e){null==e||e.focus({preventScroll:!0})}var Hc=["textarea","input"].join(",");function Yc(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 Uc(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?Yc(e):e:function(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(Nc))}(e);r=null!=(i=r)?i:o.activeElement;var l,s,u=function(){if(t&(zc.First|zc.Next))return Bc.Next;if(t&(zc.Previous|zc.Last))return Bc.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),d=function(){if(t&zc.First)return 0;if(t&zc.Previous)return Math.max(0,a.indexOf(r))-1;if(t&zc.Next)return Math.max(0,a.indexOf(r))+1;if(t&zc.Last)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),c=t&zc.NoScroll?{preventScroll:!0}:{},p=0,f=a.length,m=void 0;do{var h;if(p>=f||p+f<=0)return qc.Error;var v=d+p;if(t&zc.WrapAround)v=(v+f)%f;else{if(v<0)return qc.Underflow;if(v>=f)return qc.Overflow}null==(h=m=a[v])||h.focus(c),p+=u}while(m!==o.activeElement);return t&(zc.Next|zc.Previous)&&null!=(s=null==(l=m)||null==l.matches?void 0:l.matches(Hc))&&s&&m.select(),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0"),qc.Success}var Gc=function(e){return e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e}({});function Kc(){var e=t.useRef(!1);return yc((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function Xc(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((function(){return Lc.apply(void 0,n)}),[].concat(n))}function Qc(e,n,r,i){var o=wc(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 Jc(e,n){var r=t.useRef([]),i=jc(e);t.useEffect((function(){for(var e,t=[].concat(r.current),o=ie(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))}var Zc=["initialFocus","containers","features"],$c=function(e){return 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",e}($c||{}),ep=Object.assign(vc((function(e,n){var r=t.useRef(null),i=Sc(r,n),o=e.initialFocus,a=e.containers,l=e.features,s=void 0===l?$c.All:l,u=te(e,Zc);Tc()||(s=$c.None);var d=Xc(r);!function(e,n){var r=e.ownerDocument,i=t.useRef(null);Qc(null==r?void 0:r.defaultView,"focusout",(function(e){n&&(i.current||(i.current=e.target))}),!0),Jc((function(){n||((null==r?void 0:r.activeElement)===(null==r?void 0:r.body)&&Vc(i.current),i.current=null)}),[n]);var o=t.useRef(!1);t.useEffect((function(){return o.current=!1,function(){o.current=!0,Mc((function(){o.current&&(Vc(i.current),i.current=null)}))}}),[])}({ownerDocument:d},Boolean(s&$c.RestoreFocus));var p=function(e,n){var r=e.ownerDocument,i=e.container,o=e.initialFocus,a=t.useRef(null),l=Kc();return Jc((function(){if(n){var e=i.current;e&&Mc((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?Vc(o.current):Uc(e,zc.First)===qc.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&$c.InitialFocus));!function(e,t){var n=e.ownerDocument,r=e.container,i=e.containers,o=e.previousActiveElement,a=Kc();Qc(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=ie(e);!(n=r()).done;){var i;if(null!=(i=n.value.current)&&i.contains(t))return!0}return!1}(n,s)?(o.current=s,Vc(s)):(e.preventDefault(),e.stopPropagation(),Vc(l)):Vc(o.current)}}}),!0)}({ownerDocument:d,container:r,containers:a,previousActiveElement:p},Boolean(s&$c.FocusLock));var f=function(){var e,n=t.useRef(Gc.Forwards);return e=wc((function(e){"Tab"===e.key&&(n.current=e.shiftKey?Gc.Backwards:Gc.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=jc((function(){var e,t=r.current;t&&lc(f.current,((e={})[Gc.Forwards]=function(){return Uc(t,zc.First)},e[Gc.Backwards]=function(){return Uc(t,zc.Last)},e))})),h={ref:i};return c.jsxs(c.Fragment,{children:[Boolean(s&$c.TabLock)&&c.jsx(Ec,{as:"button",type:"button",onFocus:m,features:Pc.Focusable}),fc({ourProps:h,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(s&$c.TabLock)&&c.jsx(Ec,{as:"button",type:"button",onFocus:m,features:Pc.Focusable})]})})),{features:$c}),tp=new Set,np=new Map;function rp(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function ip(e){var t=np.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var op=["target"],ap="headlessui-portal-root",lp=t.Fragment,sp=vc((function(e,n){var r,i,o=e,a=t.useRef(null),l=Sc((void 0===r&&(r=!0),Object.assign((function(e){a.current=e}),((i={})[Cc]=r,i))),n),s=Xc(a),u=function(e){var n=t.useContext(oc),r=t.useContext(dp),i=Xc(e),o=t.useState((function(){if(!n&&null!==r)return null;if(xc)return null;var e=null==i?void 0:i.getElementById(ap);if(e)return e;if(null===i)return null;var t=i.createElement("div");return t.setAttribute("id",ap),t.setAttribute("data-testid",ap),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 xc?null:null!=(e=null==s?void 0:s.createElement("div"))?e:null}))[0],c=Tc(),p=t.useRef(!1);return yc((function(){if(p.current=!1,u&&d)return u.contains(d)||(d.setAttribute("data-headlessui-portal",""),u.appendChild(d)),function(){p.current=!0,Mc((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(fc({ourProps:{ref:l},theirProps:o,defaultTag:lp,name:"Portal"}),d):null})),up=t.Fragment,dp=t.createContext(null),cp=Object.assign(sp,{Group:vc((function(e,t){var n=e.target,r=te(e,op),i=Sc(t);return c.jsx(dp.Provider,{value:n,children:fc({ourProps:{ref:i},theirProps:r,defaultTag:up,name:"Popover.Group"})})}))}),pp=t.createContext(null);function fp(){var e=t.useContext(pp);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,fp),n}return e}var mp=vc((function(e,t){var n=fp(),r="headlessui-description-"+Ic(),i=Sc(t);yc((function(){return n.register(r)}),[r,n.register]);var o=e;return fc({ourProps:Q({ref:i},n.props,{id:r}),theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})})),hp=t.createContext(null);hp.displayName="OpenClosedContext";var vp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}({});function gp(){return t.useContext(hp)}function bp(e){return c.jsx(hp.Provider,{value:e.value,children:e.children})}var xp=t.createContext((function(){}));xp.displayName="StackContext";var yp=function(e){return e[e.Add=0]="Add",e[e.Remove=1]="Remove",e}({});function wp(e){var n=e.children,r=e.onUpdate,i=e.type,o=e.element,a=e.enabled,l=t.useContext(xp),s=jc((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 yc((function(){var e=void 0===a||!0===a;return e&&s(yp.Add,i,o),function(){e&&s(yp.Remove,i,o)}}),[s,i,o,a]),c.jsx(xp.Provider,{value:s,children:n})}function jp(e,n,r){var i=wc(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])}var Cp,Sp=["open","onClose","initialFocus","__demoMode"],Fp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(Fp||{}),kp=function(e){return e[e.SetTitleId=0]="SetTitleId",e}(kp||{}),_p=((Cp={})[kp.SetTitleId]=function(e,t){return e.titleId===t.id?e:Q({},e,{titleId:t.id})},Cp),Tp=t.createContext(null);function Ap(e){var n=t.useContext(Tp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ap),r}return n}function Dp(e,t){return lc(t.type,_p,e,t)}Tp.displayName="DialogContext";var Ip,Op=cc.RenderStrategy|cc.Static,Pp=vc((function(e,n){var r,i=e.open,o=e.onClose,a=e.initialFocus,l=e.__demoMode,s=void 0!==l&&l,u=te(e,Sp),d=t.useState(0),p=d[0],f=d[1],m=gp();void 0===i&&null!==m&&(i=lc(m,((r={})[vp.Open]=!0,r[vp.Closed]=!1,r)));var h=t.useRef(new Set),v=t.useRef(null),g=Sc(v,n),b=t.useRef(null),x=Xc(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 j=i?Fp.Open:Fp.Closed,C=t.useReducer(Dp,{titleId:null,descriptionId:null,panelRef:t.createRef()}),S=C[0],F=C[1],k=jc((function(){return o(!1)})),_=jc((function(e){return F({type:kp.SetTitleId,id:e})})),T=!!Tc()&&!s&&j===Fp.Open,A=p>1,D=null!==t.useContext(Tp),I=A?"parent":"leaf";!function(e,t){void 0===t&&(t=!0),yc((function(){if(t&&e.current){var n=e.current,r=Lc(n);if(r){tp.add(n);for(var i,o=ie(np.keys());!(i=o()).done;){var a=i.value;a.contains(n)&&(ip(a),np.delete(a))}return r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=ie(tp);!(t=n()).done;)if(e.contains(t.value))return;1===tp.size&&(np.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),rp(e))}})),function(){if(tp.delete(n),tp.size>0)r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!np.has(e)){for(var t,n=ie(tp);!(t=n()).done;)if(e.contains(t.value))return;np.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),rp(e)}}));else for(var e,t=ie(np.keys());!(e=t()).done;){var i=e.value;ip(i),np.delete(i)}}}}}),[t])}(v,!!A&&T),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=ie(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=Wc.Loose)&&(p=Wc.Strict),(c=a)!==(null==(f=Lc(c))?void 0:f.body)&&lc(p,((m={})[Wc.Strict]=function(){return c.matches(Nc)},m[Wc.Loose]=function(){for(var e=c;null!==e;){if(e.matches(Nc))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);jp("mousedown",(function(e){var t;i.current&&(a.current=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target)}),!0),jp("click",(function(e){a.current&&(o(e,(function(){return a.current})),a.current=null)}),!0),jp("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,T&&!A),Qc(null==x?void 0:x.defaultView,"keydown",(function(e){e.defaultPrevented||e.key===kc.Escape&&j===Fp.Open&&(A||(e.preventDefault(),e.stopPropagation(),k()))})),function(e,n){t.useEffect((function(){var t;if(n&&e){var r=Rc(),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,j===Fp.Open&&!D),t.useEffect((function(){if(j===Fp.Open&&v.current){var e=new IntersectionObserver((function(e){for(var t,n=ie(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()}}}),[j,v,k]);var O=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=jc((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(pp.Provider,{value:i,children:e.children})}}),[r])]}(),P=O[0],E=O[1],M="headlessui-dialog-"+Ic(),R=t.useMemo((function(){return[{dialogState:j,close:k,setTitleId:_},S]}),[j,S,k,_]),L=t.useMemo((function(){return{open:j===Fp.Open}}),[j]),N={ref:g,id:M,role:"dialog","aria-modal":j===Fp.Open||void 0,"aria-labelledby":S.titleId,"aria-describedby":P};return c.jsxs(wp,{type:"Dialog",enabled:j===Fp.Open,element:v,onUpdate:jc((function(e,t,n){var r;"Dialog"===t&&lc(e,((r={})[yp.Add]=function(){h.current.add(n),f((function(e){return e+1}))},r[yp.Remove]=function(){h.current.add(n),f((function(e){return e-1}))},r))})),children:[c.jsx(ac,{force:!0,children:c.jsx(cp,{children:c.jsx(Tp.Provider,{value:R,children:c.jsx(cp.Group,{target:v,children:c.jsx(ac,{force:!1,children:c.jsx(E,{slot:L,name:"Dialog.Description",children:c.jsx(ep,{initialFocus:a,containers:h,features:T?lc(I,{parent:ep.features.RestoreFocus,leaf:ep.features.All&~ep.features.FocusLock}):ep.features.None,children:fc({ourProps:N,theirProps:u,slot:L,defaultTag:"div",features:Op,visible:j===Fp.Open,name:"Dialog"})})})})})})})}),c.jsx(Ec,{features:Pc.Hidden,ref:b})]})})),Ep=vc((function(e,n){var r=Ap("Dialog.Overlay")[0],i=r.dialogState,o=r.close;return fc({ourProps:{ref:Sc(n),id:"headlessui-dialog-overlay-"+Ic(),"aria-hidden":!0,onClick:jc((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===Fp.Open}}),[i]),defaultTag:"div",name:"Dialog.Overlay"})})),Mp=Object.assign(Pp,{Backdrop:vc((function(e,n){var r=Ap("Dialog.Backdrop"),i=r[0].dialogState,o=r[1],a=Sc(n),l="headlessui-dialog-backdrop-"+Ic();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===Fp.Open}}),[i]);return c.jsx(ac,{force:!0,children:c.jsx(cp,{children:fc({ourProps:{ref:a,id:l,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})})})})),Panel:vc((function(e,n){var r=Ap("Dialog.Panel"),i=r[0].dialogState,o=Sc(n,r[1].panelRef),a="headlessui-dialog-panel-"+Ic(),l=t.useMemo((function(){return{open:i===Fp.Open}}),[i]);return fc({ourProps:{ref:o,id:a,onClick:jc((function(e){e.stopPropagation()}))},theirProps:e,slot:l,defaultTag:"div",name:"Dialog.Panel"})})),Overlay:Ep,Title:vc((function(e,n){var r=Ap("Dialog.Title")[0],i=r.dialogState,o=r.setTitleId,a="headlessui-dialog-title-"+Ic(),l=Sc(n);t.useEffect((function(){return o(a),function(){return o(null)}}),[a,o]);var s=t.useMemo((function(){return{open:i===Fp.Open}}),[i]);return fc({ourProps:{ref:l,id:a},theirProps:e,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),Description:mp});function Rp(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 Lp(e,n){var r=t.useState((function(){return Rp(e)})),i=r[0],o=r[1];return yc((function(){o(Rp(e))}),[e.type,e.as]),yc((function(){i||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[i,n]),i}var Np,zp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(zp||{}),qp=function(e){return 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",e}(qp||{});(Ip={})[qp.ToggleDisclosure]=function(e){var t;return Q({},e,{disclosureState:lc(e.disclosureState,(t={},t[zp.Open]=zp.Closed,t[zp.Closed]=zp.Open,t))})},Ip[qp.CloseDisclosure]=function(e){return e.disclosureState===zp.Closed?e:Q({},e,{disclosureState:zp.Closed})},Ip[qp.LinkPanel]=function(e){return!0===e.linkedPanel?e:Q({},e,{linkedPanel:!0})},Ip[qp.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:Q({},e,{linkedPanel:!1})},Ip[qp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:Q({},e,{buttonId:t.buttonId})},Ip[qp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:Q({},e,{panelId:t.panelId})},t.createContext(null).displayName="DisclosureContext",t.createContext(null).displayName="DisclosureAPIContext",t.createContext(null).displayName="DisclosurePanelContext";var Bp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(Bp||{}),Wp=function(e){return 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",e}(Wp||{});function Vp(e){var n=e.onFocus,r=t.useState(!0),i=r[1];return r[0]?c.jsx(Ec,{as:"button",type:"button",features:Pc.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}(Np={})[Wp.TogglePopover]=function(e){var t;return Q({},e,{popoverState:lc(e.popoverState,(t={},t[Bp.Open]=Bp.Closed,t[Bp.Closed]=Bp.Open,t))})},Np[Wp.ClosePopover]=function(e){return e.popoverState===Bp.Closed?e:Q({},e,{popoverState:Bp.Closed})},Np[Wp.SetButton]=function(e,t){return e.button===t.button?e:Q({},e,{button:t.button})},Np[Wp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:Q({},e,{buttonId:t.buttonId})},Np[Wp.SetPanel]=function(e,t){return e.panel===t.panel?e:Q({},e,{panel:t.panel})},Np[Wp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:Q({},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 Hp,Yp=["defaultIndex","vertical","manual","onChange","selectedIndex"],Up=function(e){return 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",e}(Up||{}),Gp=((Hp={})[Up.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 Q({},e,{selectedIndex:e.tabs.indexOf(n[0])});if(t.index>e.tabs.length)return Q({},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?Q({},e,{selectedIndex:e.tabs.indexOf(o)}):e},Hp[Up.RegisterTab]=function(e,t){var n;if(e.tabs.includes(t.tab))return e;var r=e.tabs[e.selectedIndex],i=Yc([].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),Q({},e,{tabs:i,selectedIndex:o})},Hp[Up.UnregisterTab]=function(e,t){return Q({},e,{tabs:e.tabs.filter((function(e){return e!==t.tab}))})},Hp[Up.RegisterPanel]=function(e,t){return e.panels.includes(t.panel)?e:Q({},e,{panels:Yc([].concat(e.panels,[t.panel]),(function(e){return e.current}))})},Hp[Up.UnregisterPanel]=function(e,t){return Q({},e,{panels:e.panels.filter((function(e){return e!==t.panel}))})},Hp),Kp=t.createContext(null);function Xp(e){var n=t.useContext(Kp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Xp),r}return n}Kp.displayName="TabsSSRContext";var Qp=t.createContext(null);function Jp(e){var n=t.useContext(Qp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Jp),r}return n}Qp.displayName="TabsDataContext";var Zp=t.createContext(null);function $p(e){var n=t.useContext(Zp);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,$p),r}return n}function ef(e,t){return lc(t.type,Gp,e,t)}Zp.displayName="TabsActionsContext";var tf=t.Fragment,nf=vc((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=te(e,Yp),m=a?"vertical":"horizontal",h=s?"manual":"auto",v=null!==p,g=Sc(n),b=t.useReducer(ef,{selectedIndex:null!=p?p:i,tabs:[],panels:[]}),x=b[0],y=b[1],w=t.useMemo((function(){return{selectedIndex:x.selectedIndex}}),[x.selectedIndex]),j=wc(u||function(){}),C=wc(x.tabs),S=t.useMemo((function(){return Q({orientation:m,activation:h},x)}),[m,h,x]),F=wc(v?e.selectedIndex:x.selectedIndex),k=t.useMemo((function(){return{registerTab:function(e){return y({type:Up.RegisterTab,tab:e}),function(){return y({type:Up.UnregisterTab,tab:e})}},registerPanel:function(e){return y({type:Up.RegisterPanel,panel:e}),function(){return y({type:Up.UnregisterPanel,panel:e})}},change:function(e){F.current!==e&&j.current(e),v||y({type:Up.SetSelectedIndex,index:e})}}}),[y,v]);yc((function(){y({type:Up.SetSelectedIndex,index:null!=p?p:i})}),[p]);var _=t.useRef({tabs:[],panels:[]}),T={ref:g};return c.jsx(Kp.Provider,{value:_,children:c.jsx(Zp.Provider,{value:k,children:c.jsxs(Qp.Provider,{value:S,children:[S.tabs.length<=0&&c.jsx(Vp,{onFocus:function(){for(var e,t=ie(C.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}}),fc({ourProps:T,theirProps:f,slot:w,defaultTag:tf,name:"Tabs"})]})})})})),rf=vc((function(e,t){var n=Jp("Tab.List"),r=n.orientation,i=n.selectedIndex;return fc({ourProps:{ref:Sc(t),role:"tablist","aria-orientation":r},theirProps:e,slot:{selectedIndex:i},defaultTag:"div",name:"Tabs.List"})})),of=cc.RenderStrategy|cc.Static,af=Object.assign(vc((function(e,n){var r,i="headlessui-tabs-tab-"+Ic(),o=Jp("Tab"),a=o.orientation,l=o.activation,s=o.selectedIndex,u=o.tabs,d=o.panels,c=$p("Tab"),p=Jp("Tab"),f=Xp("Tab"),m=t.useRef(null),h=Sc(m,n);yc((function(){return c.registerTab(m)}),[c,m]);var v=f.current.tabs.indexOf(i);-1===v&&(v=f.current.tabs.push(i)-1);var g=u.indexOf(m);-1===g&&(g=v);var b=g===s,x=jc((function(e){var t=e();if(t===qc.Success&&"auto"===l){var n,r=null==(n=Lc(m))?void 0:n.activeElement,i=p.tabs.findIndex((function(e){return e.current===r}));-1!==i&&c.change(i)}return t})),y=jc((function(e){var t=u.map((function(e){return e.current})).filter(Boolean);if(e.key===kc.Space||e.key===kc.Enter)return e.preventDefault(),e.stopPropagation(),void c.change(g);switch(e.key){case kc.Home:case kc.PageUp:return e.preventDefault(),e.stopPropagation(),x((function(){return Uc(t,zc.First)}));case kc.End:case kc.PageDown:return e.preventDefault(),e.stopPropagation(),x((function(){return Uc(t,zc.Last)}))}return x((function(){return lc(a,{vertical:function(){return e.key===kc.ArrowUp?Uc(t,zc.Previous|zc.WrapAround):e.key===kc.ArrowDown?Uc(t,zc.Next|zc.WrapAround):qc.Error},horizontal:function(){return e.key===kc.ArrowLeft?Uc(t,zc.Previous|zc.WrapAround):e.key===kc.ArrowRight?Uc(t,zc.Next|zc.WrapAround):qc.Error}})}))===qc.Success?e.preventDefault():void 0})),w=t.useRef(!1),j=jc((function(){var e;w.current||(w.current=!0,null==(e=m.current)||e.focus(),c.change(g),Mc((function(){w.current=!1})))})),C=jc((function(e){e.preventDefault()})),S=t.useMemo((function(){return{selected:b}}),[b]),F=e;return fc({ourProps:{ref:h,onKeyDown:y,onMouseDown:C,onClick:j,id:i,role:"tab",type:Lp(e,m),"aria-controls":null==(r=d[g])||null==(r=r.current)?void 0:r.id,"aria-selected":b,tabIndex:b?0:-1},theirProps:F,slot:S,defaultTag:"button",name:"Tabs.Tab"})})),{Group:nf,List:rf,Panels:vc((function(e,n){var r=Jp("Tab.Panels").selectedIndex;return fc({ourProps:{ref:Sc(n)},theirProps:e,slot:t.useMemo((function(){return{selectedIndex:r}}),[r]),defaultTag:"div",name:"Tabs.Panels"})})),Panel:vc((function(e,n){var r,i,o,a=Jp("Tab.Panel"),l=a.selectedIndex,s=a.tabs,u=a.panels,d=$p("Tab.Panel"),p=Xp("Tab.Panel"),f="headlessui-tabs-panel-"+Ic(),m=t.useRef(null),h=Sc(m,n);yc((function(){return d.registerPanel(m)}),[d,m]);var v=p.current.panels.indexOf(f);-1===v&&(v=p.current.panels.push(f)-1);var g=u.indexOf(m);-1===g&&(g=v);var b=g===l,x=t.useMemo((function(){return{selected:b}}),[b]),y={ref:h,id:f,role:"tabpanel","aria-labelledby":null==(r=s[g])||null==(r=r.current)?void 0:r.id,tabIndex:b?0:-1};return b||null!=(i=e.unmount)&&!i||null!=(o=e.static)&&o?fc({ourProps:y,theirProps:e,slot:x,defaultTag:"div",features:of,visible:b,name:"Tabs.Panel"}):c.jsx(Ec,Q({as:"span"},y))}))});function lf(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 sf(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)}var uf=function(e){return e.Ended="ended",e.Cancelled="cancelled",e}({});function df(){var e=t.useState(Rc)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}var cf=["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"],pf=["show","appear","unmount"];function ff(e){return void 0===e&&(e=""),e.split(" ").filter((function(e){return e.trim().length>1}))}var mf=t.createContext(null);mf.displayName="TransitionContext";var hf=function(e){return e.Visible="visible",e.Hidden="hidden",e}(hf||{}),vf=t.createContext(null);function gf(e){return"children"in e?gf(e.children):e.current.filter((function(e){return null!==e.el.current})).filter((function(e){return e.state===hf.Visible})).length>0}function bf(e,n){var r=wc(e),i=t.useRef([]),o=Kc(),a=df(),l=jc((function(e,t){var n;void 0===t&&(t=pc.Hidden);var l=i.current.findIndex((function(t){return t.el===e}));-1!==l&&(lc(t,((n={})[pc.Unmount]=function(){i.current.splice(l,1)},n[pc.Hidden]=function(){i.current[l].state=hf.Hidden},n)),a.microTask((function(){!gf(i)&&o.current&&(null==r.current||r.current())})))})),s=jc((function(e){var t=i.current.find((function(t){return t.el===e}));return t?t.state!==hf.Visible&&(t.state=hf.Visible):i.current.push({el:e,state:hf.Visible}),function(){return l(e,pc.Unmount)}})),u=t.useRef([]),d=t.useRef(Promise.resolve()),c=t.useRef({enter:[],leave:[],idle:[]}),p=jc((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=jc((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 xf(){}vf.displayName="NestingContext";var yf=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function wf(e){for(var t={},n=0,r=yf;n<r.length;n++){var i,o=r[n];t[o]=null!=(i=e[o])?i:xf}return t}var jf=cc.RenderStrategy,Cf=vc((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=te(e,cf),g=t.useRef(null),b=Sc(g,n),x=v.unmount?pc.Unmount:pc.Hidden,y=function(){var e=t.useContext(mf);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,j=y.appear,C=y.initial,S=t.useState(w?hf.Visible:hf.Hidden),F=S[0],k=S[1],_=function(){var e=t.useContext(vf);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=_.register,A=_.unregister,D=t.useRef(null);t.useEffect((function(){return T(g)}),[T,g]),t.useEffect((function(){var e;if(x===pc.Hidden&&g.current){if(!w||F===hf.Visible)return lc(F,((e={})[hf.Hidden]=function(){return A(g)},e[hf.Visible]=function(){return T(g)},e));k(hf.Visible)}}),[F,g,T,A,w,x]);var I=wc({enter:ff(s),enterFrom:ff(u),enterTo:ff(d),entered:ff(p),leave:ff(f),leaveFrom:ff(m),leaveTo:ff(h)}),O=function(e){var n=t.useRef(wf(e));return t.useEffect((function(){n.current=wf(e)}),[e]),n}({beforeEnter:i,afterEnter:o,beforeLeave:a,afterLeave:l}),P=Tc();t.useEffect((function(){if(P&&F===hf.Visible&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,F,P]);var E=C&&!j,M=P?E||D.current===w?"idle":w?"enter":"leave":"idle",R=jc((function(e){return lc(e,{enter:function(){return O.current.beforeEnter()},leave:function(){return O.current.beforeLeave()},idle:function(){}})})),L=jc((function(e){return lc(e,{enter:function(){return O.current.afterEnter()},leave:function(){return O.current.afterLeave()},idle:function(){}})})),N=bf((function(){k(hf.Hidden),A(g)}),_);!function(e){var t=e.container,n=e.direction,r=e.classes,i=e.onStart,o=e.onStop,a=Kc(),l=df(),s=wc(n);yc((function(){var e=Rc();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=Rc(),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=lc(i,{enter:function(){return t.enter},leave:function(){return t.leave}}),s=lc(i,{enter:function(){return t.enterTo},leave:function(){return t.leaveTo}}),u=lc(i,{enter:function(){return t.enterFrom},leave:function(){return t.leaveFrom}});return sf.apply(void 0,[e].concat(t.enter,t.enterTo,t.enterFrom,t.leave,t.leaveFrom,t.leaveTo,t.entered)),lf.apply(void 0,[e].concat(l,u)),o.nextFrame((function(){sf.apply(void 0,[e].concat(u)),lf.apply(void 0,[e].concat(s)),function(e,t){var n=Rc();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(uf.Ended),o.splice(0).forEach((function(e){return e()})))})),n.addEventListener(e,"transitioncancel",(function(e){e.target===e.currentTarget&&(t(uf.Cancelled),o.splice(0).forEach((function(e){return e()})))}))))})))}else t(uf.Ended);n.add((function(){return t(uf.Cancelled)}))}(e,(function(n){return n===uf.Ended&&(sf.apply(void 0,[e].concat(l)),lf.apply(void 0,[e].concat(t.entered))),a(n)}))})),o.dispose}(n,r.current,"enter"===s.current,(function(t){var n;e.dispose(),lc(t,((n={})[uf.Ended]=function(){o.current(s.current)},n[uf.Cancelled]=function(){},n))}))),e.dispose}),[n])}({container:g,classes:I,direction:M,onStart:wc((function(e){N.onStart(g,e,R)})),onStop:wc((function(e){N.onStop(g,e,L),"leave"!==e||gf(N)||(k(hf.Hidden),A(g))}))}),t.useEffect((function(){E&&(D.current=x===pc.Hidden?null:w)}),[w,E,F]);var z=v,q={ref:b};return c.jsx(vf.Provider,{value:N,children:c.jsx(bp,{value:lc(F,(r={},r[hf.Visible]=vp.Open,r[hf.Hidden]=vp.Closed,r)),children:fc({ourProps:q,theirProps:z,defaultTag:"div",features:jf,visible:F===hf.Visible,name:"Transition.Child"})})})})),Sf=vc((function(e,n){var r=e.show,i=e.appear,o=void 0!==i&&i,a=e.unmount,l=te(e,pf),s=t.useRef(null),u=Sc(s,n);Tc();var d,p=gp();if(void 0===r&&null!==p&&(r=lc(p,((d={})[vp.Open]=!0,d[vp.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?hf.Visible:hf.Hidden),m=f[0],h=f[1],v=bf((function(){h(hf.Hidden)})),g=t.useState(!0),b=g[0],x=g[1],y=t.useRef([r]);yc((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(hf.Visible);else if(gf(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(hf.Hidden)}else h(hf.Hidden)}),[r,v]);var j={unmount:a};return c.jsx(vf.Provider,{value:v,children:c.jsx(mf.Provider,{value:w,children:fc({ourProps:Q({},j,{as:t.Fragment,children:c.jsx(Cf,Q({ref:u},j,l))}),theirProps:{},defaultTag:t.Fragment,features:jf,visible:m===hf.Visible,name:"Transition"})})})})),Ff=Object.assign(Sf,{Child:vc((function(e,n){var r=null!==t.useContext(mf),i=null!==gp();return c.jsx(c.Fragment,{children:c.jsx(!r&&i?Sf:Cf,Q({ref:n},e))})})),Root:Sf}),kf=function(e){var t,n,r,i,o,a,l,s;return As(Q({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,gridArea:null==e?void 0:e.area,bottom:null==e?void 0:e.bottom,lineHeight:null==e?void 0:e.lineHeight,whiteSpace:null!=e&&e.nowrap?"nowrap":void 0,borderTop:null==e?void 0:e.borderTop},function(e){var t={};return null!=e&&e.mdWidth&&(t=Q({},t,{"@media (max-width: 1366px)":{width:null==e?void 0:e.mdWidth}})),null!=e&&e.smWidth&&(t=Q({},t,{"@media (max-width: 920px)":{width:null==e?void 0:e.smWidth}})),t}(e)))},_f=function(e){var t,n,r,i,o,a=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=Q({padding:0,border:0,marginY:0,marginX:0},e)),c.jsx(a,{className:Hd(""+kf(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=e["data-component"])?i:"View","data-themeapi":e["data-themeapi"],"data-testid":e["data-testid"],role:e.role,children:null==(o=e)?void 0:o.children})},Tf=function(e){var n=e.width,r=void 0===n?170:n,i=t.useRef(null);function o(){null==e||e.onClose()}Kd(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=Xd();return null!=e&&e.position?c.jsx(ac,{force:!0,children:c.jsx(cp,{children:c.jsx("div",{style:Df(r,null==e?void 0:e.position,null==e?void 0:e.align),"data-component":"popover-menu-container",ref:i,className:Gd.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})})}):c.jsx("div",{className:Gd.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})},Af=Object.assign(Tf,{Options:function(e){return c.jsx(Ud,{rows:["auto"],gap:"0.5rem",children:c.jsx(_f,{paddingY:null!=e&&e.padding?"0.5rem":void 0,children:null==e?void 0:e.children})})},Option:function(e){var t=Xd();return c.jsx("li",{className:""+Gd.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:Tf,DisplayWrapper:function(e){var t=e.width,n=void 0===t?160:t,r=Xd();return c.jsx("div",{className:""+Gd.container(null==r?void 0:r.popoverMenu),style:{width:n},children:null==e?void 0:e.children})}});function Df(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 If(){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 Of={convert:!1,stripUnknown:!0},Pf=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}},Ef={"&::-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"}},Mf=As({width:"100%"}),Rf=Object.assign((function(){return null}),{dropdown:function(e,t){return As({marginTop:8,width:null!=e?e:void 0,minWidth:null!=t?t:void 0,position:"absolute",top:"100%",zIndex:40,left:0,variants:{fixedHeight:{on:{maxHeight:328},withAction:{maxHeight:288}}}})},optionWrappper:function(e,t){return As(Q({fontSize:null==e?void 0:e.fontSize,position:"relative",top:"100%",left:0,overflow:"overlay",borderRadius:t||null==e?void 0:e.borderRadius,borderTopLeftRadius:t?null==e?void 0:e.borderRadius:void 0,borderTopRightRadius:t?null==e?void 0:e.borderRadius:void 0,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:328},withAction:{maxHeight:288}}}},Ef))},option:function(e){return As({position:"relative",width:"100%",cursor:"pointer",borderBottom:null==e?void 0:e.separatorBorder,"&:hover":null==e?void 0:e["&:hover"]})},button:function(e){return As({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:Q({fontWeight:500,gridTemplateColumns:"1fr 24px"},null==e?void 0:e.selected),off:{gridTemplateColumns:"1fr"}}}})},selectedIcon:As({height:"1.25rem",width:"1.25rem"}),layout:Mf,subtext:As({color:"inherit",opacity:.6,fontWeight:400}),action:function(e){return As({fontSize:null==e?void 0:e.fontSize,color:Ds(15),position:"relative",bottom:0,width:"100%",textAlign:"left",background:Ds(90),padding:"0.65rem 0.5rem",borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius,boxShadow:null==e?void 0:e.boxShadow,border:null==e?void 0:e.border,"&:hover":{background:Ds(95)},marginBottom:"0.5rem"})}}),Lf={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))"},Nf=function(e){var t,n,r,i,o;return As({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,gridArea:null==e?void 0:e.gridArea})},zf=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=Q({padding:0,border:0,margin:0},e)),c.jsx(s,{className:Hd(""+Nf(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})},qf=As({position:"relative",display:"flex",flex:1,flexDirection:"row"}),Bf=As({width:16,zIndex:999,top:0,bottom:0,left:-3,position:"absolute",alignSelf:"flex-start",cursor:"pointer"}),Wf=Object.assign((function(){return null}),{itemWrapper:qf,item:function(e){var t;return As({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:"#3074d9"},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 As(Q({},nu.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em"}))},metadata:function(e){var t;return As(Q({},nu.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em",color:"inherit",opacity:.6}))},right:As({display:"flex",placeContent:"center"}),edit:As({marginRight:"0.75rem",display:"grid",placeContent:"center",color:"inherit",opacity:.5}),deleteWrapper:function(e){var t,n;return As({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 As(Q({},nu.button,{height:16,color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":{color:Jd(null==e||null==(n=e.icon)?void 0:n.color,1.5)}}))},iconSize:As({height:"1rem",width:"1rem"}),addWrapper:As(Q({position:"relative",width:"100%"},Ts)),title:function(e){return As(Q({padding:0},Ts,e))},titleContainer:function(){return As({variants:{hasBorder:{true:{borderBottom:"2px solid #e5e7eb"}}}})},dragHandleContainer:Bf}),Vf=Object.assign((function(){return null}),{item:As({opacity:.5}),string:As({fontSize:"0.55rem",transform:"scaleX(1.2)",marginLeft:1}),bool:As({fontSize:"0.65rem",fontWeight:"bold"}),icon:function(e){return As({"& > *":{fill:null!=e?e:"#2d2f31"}})}}),Hf=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(_f,{as:"code",children:c.jsxs(Ud,{columns:["1fr","1fr"],className:""+tu.codeText,children:[c.jsx("span",{className:""+tu.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Hd(""+Vf.string({}),""+tu.bold),children:"A"})]})}),"string[]"===(null==e?void 0:e.icon)&&c.jsx(_f,{as:"code",className:""+tu.codeText,children:c.jsxs(Ud,{columns:["1fr","1fr"],children:[c.jsx("span",{className:""+tu.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Hd(""+Vf.string({}),""+tu.bold),children:"[]"})]})}),"boolean"===(null==e?void 0:e.icon)&&c.jsx(_f,{as:"code",className:Hd(""+Vf.bool({}),""+Yf),"data-component":"true-false",children:c.jsxs(Ud,{columns:["1fr","1fr","1fr"],height:"20px",children:[c.jsx(_f,{alignSelf:"start",children:"T"}),c.jsx(_f,{alignSelf:"center",marginLeft:-.5,children:"/"}),c.jsx(_f,{alignSelf:"end",children:"F"})]})})]})},Yf=As({fontSize:11,lineHeight:1.3,fontFamily:nu.codeFontFamily}),Uf=function(e){var t,r,i;return c.jsx(_f,{width:24,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:"0.30rem",alignSelf:null==e?void 0:e.alignSelf,"data-component":"item-icon",marginLeft:-2,children:c.jsxs(zf,{justifyContent:"center",alignItems:"center",className:""+Vf.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(Gf,{icon:null==e?void 0:e.icon,width:null==e?void 0:e.iconWidth})),c.jsx(Hf,{icon:null==e?void 0:e.icon})]})})},Gf=function(e){var t,n,r=Xd();return c.jsx(_f,{width:null!=(t=null==e?void 0:e.width)?t:"75%",className:""+Vf.icon(null==r||null==(n=r.charts)?void 0:n.iconColor),"data-themeapi":"charts.iconColor",children:null==e?void 0:e.icon})},Kf={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Xf=Object.assign((function(e){var n=Xd();return c.jsx(t.Fragment,{children:(null==e?void 0:e.open)&&c.jsx("div",{className:""+Rf.dropdown(null==e?void 0:e.width,null==e?void 0:e.minWidth)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsxs(_f,{position:"relative",children:[c.jsx("div",{className:""+Rf.optionWrappper(null==n?void 0:n.dropdowns,!!e.onFreeTextSelected)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsx(_f,{role:"list","data-component":"dropdown-options",maxHeight:e.onFreeTextSelected?360:400,children:null==e?void 0:e.children})}),e.onFreeTextSelected&&c.jsx("button",{onClick:function(){return e.onFreeTextSelected&&e.onFreeTextSelected()},className:tu.button+" "+Rf.action(null==n?void 0:n.dropdowns),children:e.textOverride?e.textOverride("dropdown.free_text","Enter Custom Value..."):"Enter Custom Value..."})]})})})}),{Option:function(e){var n=e.label,r=Xd();return c.jsx("div",{className:""+Rf.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:""+Rf.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(zf,{direction:"row",gap:"0.5rem",children:[(null==e?void 0:e.icon)&&c.jsx(Uf,{icon:null==e?void 0:e.icon,paddingTop:"0"}),c.jsxs(_f,{flexGrow:1,paddingTop:"0.1rem",children:[c.jsx(_f,{children:i.isFunction(n)?n():n}),(null==e?void 0:e.subtext)&&c.jsx(_f,{className:""+Rf.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(zf,{alignItems:"center",justifyContent:"center",alignSelf:"start",paddingTop:"0.25rem",children:c.jsx("div",{className:""+Rf.selectedIcon,children:c.jsx(v.CheckIcon,{css:Kf,"aria-hidden":"true"})})})]})})},Empty:function(e){return c.jsx("div",{css:Lf,children:e.label})},Title:function(e){var t,n=e.label,r=Xd();return c.jsx("div",{className:""+(t=null==r?void 0:r.dropdowns,As({padding:null==t?void 0:t.padding,paddingTop:0,paddingBottom:0,fontSize:"0.75rem",variants:{index:{true:{borderTop:"1px solid #dbdcdf",marginTop:"0.25rem"}}}}))({index:0!==e.index}),role:"listitem","data-component":"dropdown-title",children:c.jsx("p",{className:""+As({marginBottom:0,fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.05em"}),children:i.isFunction(n)?n():n})})}}),Qf=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(" ")},Jf=function(e,t,n){var r=[].concat(n).flatMap((function(e){if(i.isFunction(e)){var n=e();if(n)return[Qf(n)]}return i.isString(e)&&t[e]?[Qf(e)]:[]})).join(" ");return Qf(e)+" "+r},Zf=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);}"}),$f=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:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;}&:nth-of-type(2){-moz-animation:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;-webkit-animation-delay:0.25s;animation-delay:0.25s;}&:nth-of-type(3){-moz-animation:",Zf," 2s infinite ease-in-out;-webkit-animation:",Zf," 2s infinite ease-in-out;-webkit-animation-delay:0.5s;animation-delay:0.5s;}",""),"",""]})},em=gd((function(e){var t=e.color,n=e.mAuto;return c.jsxs("div",{className:Qf("loading"),css:["margin-top:-0.5rem;margin-bottom:-0.5rem;",n&&{margin:"auto"},"",""],children:[c.jsx($f,{color:t}),c.jsx($f,{color:t}),c.jsx($f,{color:t})]})}),"renderLoadingComponent"),tm={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},nm=function(e){var t;return c.jsx("div",{css:tm,style:{width:"100%",height:"100%",minHeight:null!=(t=null==e?void 0:e.minHeight)?t:"200px"},children:e.override?e.override({}):c.jsx(em,{mAuto:!0,color:"#e5e5e5"})})},rm={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},im=function(e){return c.jsx("div",{css:rm,style:{width:"100%",height:"100%"},children:c.jsx(em,{mAuto:!0,color:e.color})})},om=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:Hd(null==e?void 0:e.className,""+tu.button),"aria-label":null!=(t=null==e?void 0:e["aria-label"])?t:null!=e&&e.textOverride?null==e?void 0:e.textOverride("clear","Clear"):"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:""+ru,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"})})})})},am={height:"1.5rem",width:"1.5rem",cursor:"pointer",paddingTop:1,outline:"2px solid transparent",outlineOffset:2},lm=Object.assign((function(e){return As({width:"100%",minWidth:null!=e?e:void 0})}),{inputComponent:function(e,t){var n,r;return As(Q({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?Q({},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 As({width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==e?void 0:e.padding,paddingRight:0,gridArea:"1 / 1 / 2 / 3",variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},multiple:function(e,t){return As({display:"inline-grid",gridArea:"1 / 1 / 2 / 3",padding:null==e?void 0:e.padding,paddingLeft:0,paddingRight:0,width:null!=t?t:void 0,variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},input:As({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:As({paddingLeft:"0.25rem",paddingRight:0,width:100,alignSelf:"center"}),clearContainer:As({display:"flex",width:32,alignItems:"center",paddingLeft:"0.5rem",paddingRight:"0.25rem"}),clearButton:function(e){return As(Q({},am,{color:null==e?void 0:e.indicatorColor}))},controlGrid:As({paddingBottom:1}),arrowContainer:function(e){return As({display:"flex",width:32,alignItems:"center",justifyContent:"center",padding:0,margin:0,color:"rgb(209 213 219)",variants:{subtle:{off:{borderLeft:null==e?void 0:e.border}}}})}}),sm=As({variants:{open:{up:{},off:{transform:"rotate(180deg)"},side:{transform:"rotate(90deg)"}}}}),um=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,As(Q({},nu.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:Hd(""+sm({open:null==e||!e.expanded||null!=e&&e.disabled?null==e?void 0:e.arrowStart:"off"}),""+ru),children:c.jsx("polyline",{points:"18 15 12 9 6 15"})})});var t},dm=function(e){var n,r,o,a,l,s,u,d,p,f=e.disabled,m=e.placeholder,h=e.onClear,v=e.isLoading,g=t.useRef(null),b=function(){null==e||e.setOpen(!0),null!==g.current&&g.current.focus()},x=i.isString(null==e?void 0:e.selectedValue)?null==e?void 0:e.selectedValue:void 0;t.useEffect((function(){null!=e&&e.open&&null!==g.current&&!v&&g.current.focus()}),[null==e?void 0:e.open]);var y=Xd(),w=null!=e&&e.open?null!=e&&e.textOverride?null==e?void 0:e.textOverride("close","Close"):"Close":null!=e&&e.textOverride?null==e?void 0:e.textOverride("open","Open"):"Open";return c.jsx("div",{className:""+lm(e.fixedWidth),"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:""+lm.inputComponent(null==y||null==(n=y.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(zf,{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?33: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(_f,{flex:1,"data-component":"control-view",children:c.jsxs(Ud,{"data-component":"control-grid",className:""+lm.controlGrid,minWidth:e.fixedWidth,children:[c.jsx(t.Fragment,{children:null!=e&&e.open?c.jsx(t.Fragment,{children:0===e.value.length&&x&&c.jsx("div",{className:lm.clickableArea(null==y||null==(o=y.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:x})}):c.jsx("div",{onClick:function(){return b()},onKeyUp:function(){return b()},"data-testid":e.testId,className:Hd(""+lm.clickableArea(null==y||null==(r=y.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:lm.multiple(null==y||null==(a=y.forms)?void 0:a.select,e.fixedWidth)({small:null!=e&&e.sm?"on":"off"}),"data-component":"control-multiple",children:c.jsx("input",{style:{minWidth:m?9*(null==m?void 0:m.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:f,ref:g,className:lm.input({rightAligned:null!=e&&e.rightAligned?"on":"off"}),autoComplete:"off"})})]})})]}),v&&c.jsx("div",{className:""+lm.loading,children:c.jsx(im,{color:"#3074d9"})}),h&&(null==e?void 0:e.clearable)&&c.jsx("div",{className:""+lm.clearContainer,children:c.jsx(om,{onClear:function(){return h&&h()},className:""+lm.clearButton(null==y||null==(l=y.forms)?void 0:l.select),fill:null==y||null==(s=y.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==y||null==(u=y.forms)||null==(u=u.select)?void 0:u.indicatorColor,testId:e.testId?e.testId+"-clear":void 0,textOverride:e.textOverride})}),c.jsx("div",{className:lm.arrowContainer(null==y||null==(d=y.forms)?void 0:d.select)({subtle:null!=e&&e.subtle?"on":"off"}),children:c.jsx(um,{label:w,arrowStart:"up",disabled:f,onClick:function(){return null==e?void 0:e.setOpen(!(null!=e&&e.open))},styled:null==y||null==(p=y.forms)?void 0:p.select,expanded:null==e?void 0:e.open})})]})})},cm=Object.assign(As({display:"flex",position:"relative",alignItems:"start",flexDirection:"column",variants:{dynamicWidth:{true:{width:"100%"}}}})),pm=function(e){var n=t.useState(!1),r=n[0],i=n[1];return t.useEffect((function(){var t;return e?t=setTimeout((function(){return i(!0)}),500):i(!1),function(){t&&clearTimeout(t)}}),[e]),r},fm=vd((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=e.textOverride,v=null===e.selected?null:s[e.selected],g=v?v.label:e.placeholder||(h?h("select_empty","Select..."):"Select..."),b=n.useRef(null);Kd(b,(function(){return u(!1)}));var x=Object.keys(s[0]||{}),y=Pf(s,x),w=y.values,j=y.setSearch,C=y.searchString,S=function(t){t!=l&&e.onChange(null===t?null:t),u(!1)},F=pm(e.isLoading);return c.jsxs("div",Q({className:""+cm({dynamicWidth:null==e?void 0:e.dynamicWidth}),ref:b,"data-component":null==e?void 0:e["data-component"]},((r={})["data-componentoverride"]="renderSelectComponent",r),{children:[c.jsx(dm,{onClick:null==e?void 0:e.onClick,value:null!=e&&e.selectOptionsAreOpen?C:i.isFunction(g)?g():g,onChange:function(e){return j(e)},open:p,setOpen:f((function(){u(!p),j("")})),onClear:function(){v&&e.canBeCleared&&S(null),v&&e.canBeCleared&&j("")},clearable:!(!v||!e.canBeCleared),subtle:null==e?void 0:e.subtle,selectedValue:null==(o=w.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,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e["aria-labelledby"],className:null==e?void 0:e.controlClassName,textOverride:e.textOverride,fixedWidth:e.fixedWidth,children:null!=e&&e.renderSelected?null==e?void 0:e.renderSelected(v):c.jsxs(t.Fragment,{children:[v&&e.selectedLabelPrefix,i.isFunction(g)?g():g]})}),c.jsxs(Xf,{open:p,fixedHeight:!0,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?158:void 0,onFreeTextSelected:e.onFreeTextSelected,textOverride:e.textOverride,children:[d&&c.jsx(_f,{height:80,children:F&&c.jsx(im,{color:"#3074d9"})}),!d&&w.map((function(t,n){return t.item.title?c.jsx(Xf.Title,{label:t.item.label,index:n},"option_"+t.refIndex+"_"+t.item.label):c.jsx(Xf.Option,Q({onChange:function(){return S(t.refIndex)},label:t.item.label,subtext:t.item.subText,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)})),!d&&!F&&0===w.length&&c.jsx(_f,{padding:8,width:200,children:null!=(a=e.noOptionsMessage)?a:e.textOverride?e.textOverride("no_options","No Options"):"No Options"})]})]}))}),"renderSelectComponent",(function(e){return Q({},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],Of);if(n.error)throw n.error;r[t]=n.value})),t.apply(void 0,r)})});var t,n})),mm=function(e,t,n,r){return As(Q({},e,{margin:null!=n?n:null==e?void 0:e.margin,fontWeight:null!=r?r:null==e?void 0:e.fontWeight,display:t?"none":"block",padding:0,position:"relative",width:"100%"}))},hm=As({color:"#7D7D7E"}),vm=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"label",i=Xd(),o={className:""+(e.classNameOverride?e.classNameOverride:mm(null==i||null==(n=i.forms)?void 0:n.label,null==e?void 0:e.labelHidden,null==e?void 0:e.margin,null==e?void 0:e.fontWeight)),"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(zf,{gap:"0.25rem",children:[c.jsx(r,Q({},o,{children:null==e?void 0:e.children})),c.jsx(_f,{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:""+tu.srOnly,children:null==e?void 0:e.tooltip.label}),c.jsx(v.QuestionMarkCircleIcon,{className:Hd("help-icon",""+hm)})]})})]}):c.jsx(r,Q({},o,{children:null==e?void 0:e.children}))},gm=function(e,t){return As(Q({},e,{boxSizing:"border-box"},t?{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}:{outline:"2px solid transparent",outlineOffset:-2},{position:"relative"}))},bm=["labelHidden","onClear","textOverride"],xm=["sm","error"],ym={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"},wm={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"},jm=n.forwardRef((function(e,n){var r,i,o,a,l,s,u,d=Xd(),p=te(e,bm);return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),!e.onClear&&c.jsx("input",Q({css:ym,id:null==e?void 0:e.id,ref:n},p,{className:Hd(Jf("input",e,xm),""+gm(null!=(r=null==e?void 0:e.inputTheme)?r:null==d||null==(i=d.forms)?void 0:i.input,null==e?void 0:e.error)),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled})),e.onClear&&c.jsxs(zf,{alignItems:"center",position:"relative","data-component":"input",children:[c.jsx("input",Q({css:wm,id:null==e?void 0:e.id,ref:n},p,{className:Hd(Jf("input",e,xm),""+gm(null!=(o=null==e?void 0:e.inputTheme)?o:null==d||null==(a=d.forms)?void 0:a.input,null==e?void 0:e.error)),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled})),c.jsx(om,{onClear:function(){return e.onClear&&e.onClear()},className:lm.clearButton(null==d||null==(l=d.forms)?void 0:l.select)+" "+Cm,fill:null==d||null==(s=d.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==d||null==(u=d.forms)||null==(u=u.select)?void 0:u.indicatorColor})]})]})})),Cm=As({position:"absolute",right:6,display:"flex",alignItems:"center",justifyCntent:"center"}),Sm=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=X(G().mark((function n(){var r;return G().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}):Ae("[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]);var f=t.useState(!1),m=f[0],h=f[1];t.useEffect((function(){if(!a.loading&&e.hasFreeText&&Array.isArray(s)&&e.selected){var t=s.some((function(t){return t.value===e.selected}));h(!t)}}),[a.loading,e.hasFreeText,s,e.selected]),t.useEffect((function(){i.isArray(e.options)&&l({loading:!1,options:e.options})}),[e.options]);var v=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(vm,{labelHidden:null==e?void 0:e.labelHidden,id:m||null==e?void 0:e.id,htmlFor:m?e.id:void 0,tooltip:null==e?void 0:e.tooltip,children:null==e?void 0:e.label}),!m&&c.jsx(fm,{"data-component":null==e?void 0:e["data-component"],testId:e.testId,dynamicWidth:e.dynamicWidth,onChange:function(t){null===t?e.onChange(null,null):e.onChange(a.options[t].value,t)},onClick:e.onClick,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===v?null:v,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,textOverride:e.textOverride,fixedWidth:e.fixedWidth,dropdownForFilter:e.dropdownForFilter,onFreeTextSelected:e.hasFreeText?function(){h(!0),e.onChange("",null)}:void 0}),m&&c.jsx(jm,{type:"string",onChange:function(t){e.onChange(t.target.value,null)},id:null==e?void 0:e.id,autoFocus:!0,onClear:function(){var t;h(!1),e.onChange(null==a||null==(t=a.options[0])?void 0:t.value,null)},value:e.selected,textOverride:e.textOverride})]})},Fm=function(e){return c.jsx("div",{"data-component":"select-input",children:null==e?void 0:e.children})},km=function(e){var t=e.placeholder,n=e.showClearBtn;return c.jsx(Sm,{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",textOverride:e.textOverride,label:t,labelHidden:!0,id:e.id,dropdownForFilter:!0,fixedWidth:e.labelWidth})},_m=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=Br(e.attributes.type).removeField(e.attributes,t),n}(e,t.id)}),e)},Tm=[];function Am(e){for(var t,n=[],r=ie(e);!(t=r()).done;){var i=t.value;n.push("dateTimeFilter"===i.type?Q({},i,{type:"dateFilter"}):i)}return n}function Dm(e,t){var n=Q({},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 Im=function(e,t,n,r){var i=[].concat(e.dashboard.componentLibrary);return i[n]=Q({},t,{attributes:Q({},t.attributes,{protectedByOrganisation:!!r||void 0})}),Q({},e,{componentEditor:null,dashboard:Q({},e.dashboard,{componentLibrary:i})})},Om=function(e,t,n,r){var i=Mi(e.dashboard.display,t,n,r);return Q({},e,{dashboard:Q({},e.dashboard,{display:i})})},Pm=function(e,t){var n=t.rowIndex,r=i.cloneDeep(e.dashboard.display);return r.length>1?(r.splice(n,1),Q({},e,{dashboard:Q({},e.dashboard,{display:r})})):e},Em=n.createContext(null),Mm=function(e){var r,o,a=e.dashboard,l=e.children,s=e.trackEvent,u=function(e){var t,r=md(),o=r.dashboardFilters,a=r.onDashboardFilterChange,l=Q({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=t.dashboardFilters,l=[].concat(e.dashboard.globalFilters).filter((function(e){return!e.managedByConfiguration})),s=(r=e.dashboard.dataSets,o={},r.forEach((function(e){e.fields.forEach((function(t){[].concat(t.dashboardRequiredFilterGroups||[]).forEach((function(n){var r=n.publicName+" - "+t.dataType;o[r]=[].concat(o[r]||[],[{publicName:n.publicName,dataSetField:t,dataSetId:e.id}])}))}))})),Object.values(o)).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}})),u=a(Wa(e.dashboard),Tm).map((function(e){return Q({},e,{managedByConfiguration:!0})})),d=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(Am(s),Am(u),Am(l)),e.dashboard.dataSets).map((function(t){var n=Ci(e.dashboard.globalFilters,t);return Q({},t,{value:n?n.value:t.value||null})}));return i.some(n=d,(function(e,t){var r=[].concat(n);return r.splice(t,1),!!Ci(r,e)}))&&Te("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."),Q({},e,{dashboard:Q({},e.dashboard,{globalFilters:d})})}(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=Ii(e.dashboard.display,t.rowIndex);return Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"appendCell":return function(e,t){var n=Ei(e.dashboard.display,t.rowIndex);return Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"addHeaderRow":return function(e,t){var n,r,i,o,a=(n=t.rowIndex,r=t.initialTitle,i=[].concat(e.dashboard.display),o=Ri([{displayTitle:r,colSpan:12}],52),i.splice(n,0,o),i);return Q({},e,{dashboard:Q({},e.dashboard,{display:a})})}(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,Q({},e,{dashboard:Q({},e.dashboard,{display:o})})):Pm(e,Q({},t,{type:"removeRow"}))}(e,n);case"removeRow":return Pm(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]=Oi(o[n].components[r].colSpan),Q({},e,{dashboard:Q({},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),Q({},e,{dashboard:Q({},e.dashboard,{dataSets:r})})}(e,n);case"removeDataSet":return function(e,t){var n=t.dataSetId;if(!Na(e.dashboard,n))return e;var r=Ra(e.dashboard,n),i=[].concat(e.dashboard.dataSets);return i.splice(r,1),Q({},e,{dashboard:Q({},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=Vr(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||mi(e)||(e.attributes=Br(e.attributes.type).removeField(e.attributes,t)),e}));return Q({},e,{components:n})})),n}(e,t.id)}),e.dashboard.display);return Q({},e,{componentEditor:(n=e.componentEditor,r=l,o=(null==n?void 0:n.component)||null,o=_m(o,r),n?Q({},n,{component:o}):null),dashboard:Q({},e.dashboard,{componentLibrary:[].concat(e.dashboard.componentLibrary).map((function(e){return _m(e,l)})),dataSets:[].concat(a),display:s})})}(e,n);case"startPickingComponentFromLibraryForDisplay":return function(e,t){return Q({},e,{pickFromComponentLibrary:{cellIndex:t.cellIndex,rowIndex:t.rowIndex}})}(e,n);case"startEditingComponent":return function(e,t){return Q({},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=Q({},e);return null!=e.componentEditor.target.libraryIndex&&(r=Im(e,e.componentEditor.component,e.componentEditor.target.libraryIndex,t.protectedComponent)),e.componentEditor.target.displayTarget&&!e.componentEditor.target.libraryIndex&&(r=Om(r,e.componentEditor.component,e.componentEditor.target.displayTarget.rowIndex,e.componentEditor.target.displayTarget.cellIndex)),Q({},r,{componentEditor:null,pickFromComponentLibrary:e.pickFromComponentLibrary})}(e,n);case"addCustomComponent":return function(e,t){var n=Q({},e);return null!=t.target.libraryIndex&&(n=Im(e,t.component,t.target.libraryIndex)),t.target.displayTarget&&!t.target.libraryIndex&&(n=Om(n,t.component,t.target.displayTarget.rowIndex,t.target.displayTarget.cellIndex)),Q({},n,{componentEditor:null})}(e,n);case"clearModal":return function(e,t){return Q({},e,{pickFromComponentLibrary:null,componentEditor:null})}(e);case"updateEditorComponent":return function(e,t){return e.componentEditor?Q({},e,{componentEditor:Q({},e.componentEditor,{component:t.component})}):Q({},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=Q({},i,{results:t.results});return Q({},Om(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]=Q({},i[n],{results:r}),Q({},e,{dashboard:Q({},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 Q({},e,{componentEditor:Q({},e.componentEditor,{component:Q({},e.componentEditor.component,{results:t.results})})})}(e,n);case"pickComponentFromLibraryForDisplay":return function(e,t){var n=Q({},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 Q({},Om(e,n,r.rowIndex,r.cellIndex),{pickFromComponentLibrary:null})}(e,n);case"setDashboard":return function(e,t){return Q({},e,{dashboard:t.dashboard})}(e,n);case"setTheme":return function(e,t){return Q({},e,{dashboard:Q({},e.dashboard,{theme:t.theme})})}(e,n);case"setGlobalFilters":return function(e,t){return Q({},e,{dashboard:Q({},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,Q({},e,{dashboard:Q({},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,Q({},e,{dashboard:Q({},e.dashboard,{display:n})})}(e,n);case"changePreviewMode":return function(e,t){return Q({},e,{inPreviewMode:t.inPreviewMode})}(e,n);case"updateDisplayComponentAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=Q({},e.dashboard.display[n].components[r],{attributes:Q({},t.attributes)});return Om(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]=Q({},i[n],{attributes:r}),Q({},e,{dashboard:Q({},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),Q({},e,{dashboard:Q({},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=Q({},i,{reports:t.reports});return Q({},Om(e,o,n,r))}(e,n);case"swapComponents":return function(e,t){var n,r,i,o,a,l=(i=t.positionB,o=Q({},(n=e.dashboard.display)[(r=t.positionA).rowIndex].components[r.cellIndex]),a=Q({},n[i.rowIndex].components[i.cellIndex]),n=Mi(n,o,i.rowIndex,i.cellIndex),n=Mi(n,a,r.rowIndex,r.cellIndex));return Q({},e,{dashboard:Q({},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=Q({},i,{attributes:t.attributes});return Q({},Om(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||Li(i)||mi(i))throw"We can only set parameters on an existing component on the dashboard.";return Dm(i,r)}(e.dashboard.display,n,r,t.payload);return Q({},Om(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=Q({},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=Q({},l,{localFilters:n});a=Om(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=Q({},u,{localFilters:n});a=Im(e,d,o)}return Q({},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?Lm(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(Em.Provider,{value:Q({},d,{dispatch:p,trackEvent:s||function(){},runQueriesCallback:(o=X(G().mark((function t(n,r,i){return G().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(rc,{theme:null==e?void 0:e.theme,storedTheme:null==d||null==(r=d.dashboard)?void 0:r.theme,children:l})})},Rm=function(){return n.useContext(Em)},Lm=function(e,t){var n,r,i,o,a,l,s,u,d,c,p,f;return Q({},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}})},Nm=function(){var e=X(G().mark((function e(t,n,r,i){return G().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)}}(),zm=function(e,t){return function(){var n=X(G().mark((function n(r){var o,a;return G().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,Nm(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:De(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)}}()};function qm(e,t){var n=function(e,t,n){var r=document.createElement("div"),i=document.createElement("span");i.textContent=e,null!=n&&n.fontSize&&(i.style.fontSize="number"==typeof n.fontSize?n.fontSize+"px":""+n.fontSize),null!=n&&n.fontWeight&&(i.style.fontWeight=""+n.fontWeight),r.appendChild(i),r.style.display="inline-block",r.style.visibility="hidden",document.body.appendChild(r);var o=i.offsetWidth;return document.body.removeChild(r),o}(e,0,{fontSize:null==t?void 0:t.fontSize,fontWeight:null==t?void 0:t.fontWeight});return(n>100?n:100)+24}var Bm=function(e){var n,r,i=Rm().runQueriesCallback,o=md(),a=o.cascadeFilterSelection,l=o.textOverride,s=e.filter,u=e.filterIndex,d=e.dataSets,p=e.onChange,f=t.useState(null),m=f[0],h=f[1],v=Xd(),g=t.useRef(void 0),b=function(){var e=X(G().mark((function e(t){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zm(ki(s),i)(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)}}();t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t,n;return G().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,b(t.signal);case 4:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),h(n),p(Q({},s,{value:n[0].value}))):Te("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)]),t.useEffect((function(){a&&null!==g.current&&JSON.stringify(g.current)!==JSON.stringify(s.optionsFilters)&&h(null),g.current=s.optionsFilters}),[s.optionsFilters]);var x=qm(ji(s,d,l),null==v||null==(n=v.forms)?void 0:n.select);return e.filter.hidden?null:c.jsx(km,{showClearBtn:e.showClearBtn,anchorLeft:!0,placeholder:ji(s,d,l),options:m||b,currentValue:s.value,setSelected:function(t){e.onChange(Q({},s,{value:t}))},textOverride:l,id:xe(null!=(r=e.filter.title)?r:"")+"_"+e.filter.type,labelWidth:x},"filter-"+u)},Wm=Object.assign((function(){return null}),{button:function(e){return As(Q({},nu.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 As({"& > *":{fill:null==e?void 0:e.iconColor}})}}),Vm=["sm"],Hm={name:"1hl83va",styles:"margin-bottom:0.75rem"},Ym={name:"jf4xqj",styles:"position:absolute;top:0px;right:2rem"},Um={name:"duftww",styles:"position:absolute;top:0.25rem;right:0px"},Gm={name:"1e4sizb",styles:"margin-top:0.5rem"},Km=function(e){var n,r=t.useState(e.defaultOpen||!1),i=r[0],o=r[1],a=Xd();return c.jsxs("div",{css:Hm,className:Hd(Jf("accordion",e,Vm)),children:[c.jsxs("button",{"data-testid":e.testId,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:Hd(""+Wm.button(null==a||null==(n=a.accordion)?void 0:n.button)),"data-themeapi":"accordion.button","data-chipposition":"top.left",children:[c.jsx(zf,{gap:"0.25rem",alignItems:"center",children:null==e?void 0:e.title}),e.renderAction&&c.jsx("div",{css:Ym,children:e.renderAction(i)}),e.showAccordionIcon&&c.jsx("span",{css:Um,className:Hd(""+Wm.icon(null==a?void 0:a.accordion)),"data-themeapi":"accordion.iconColor",children:c.jsx(e.Icon,{isOpen:i})})]}),i&&c.jsx("div",{className:Qf("accordion-content"),css:Gm,children:e.children})]})},Xm=function(e){return c.jsx(Km,Q({},e,{Icon:Od}))},Qm=n.forwardRef((function(e,t){return c.jsxs(c.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsx("input",Q({className:""+Jm(),type:"checkbox",ref:t},e))]})})),Jm=function(){return As({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:Ds(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}})},Zm=t.forwardRef((function(e,t){var n=Xd();return c.jsx("div",{className:Hd(Qf("listview-item"),""+Wf.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})})),$m=As(Q({},Ts,{opacity:0,cursor:"pointer",variants:{active:{true:Q({},Ts,{opacity:1})}}})),eh=As({width:"100%",display:"flex",cursor:"pointer",height:16}),th=As(Q({},Ts,{width:12,color:"#1f293799",variants:{active:{true:Q({},Ts,{color:"rgba(93,103,119,0.6)"})}}})),nh=As({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:Ms.size.borderRadius,borderTopLeftRadius:Ms.size.borderRadius}}}}}),rh=Object.assign((function(){return null}),{popover:function(e){return As(Q({background:Ds(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}))}}),ih=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:Hd((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:Hd((null==e?void 0:e.classNameTrigger)&&""+(null==e?void 0:e.classNameTrigger)),children:e.children}),a&&c.jsx("div",Q({ref:f,className:""+rh.popover(null==e?void 0:e.tooltipMinWidth),style:Q({},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})}}),oh=function(e){var t,n;return As(Q({},Ts,{cursor:"pointer",color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":Q({},Ts,{color:Jd(null==e||null==(n=e.icon)?void 0:n.color,1.5)})}))},ah=function(e){return c.jsx("div",{ref:e.dragSource,className:""+nh({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(lh,{active:null==e?void 0:e.active,top:null==e?void 0:e.top})})},lh=function(e){var n,r=md().textOverride,i=t.useState(!1),o=i[0],a=i[1],l=Xd();return c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:r("drag_to_move","Drag to move")})},className:""+(n=null==e?void 0:e.top,As(Q({},Ts,{position:"absolute",left:1,top:n})))({active:null!=e&&e.active?"true":"false"}),tooltipMinWidth:110,children:c.jsx("div",{className:""+$m({active:null!=e&&e.active?"true":"false"}),children:c.jsxs("div",{className:""+eh,onMouseOver:function(){return a(!0)},onMouseLeave:function(){return a(!1)},"data-themeapi":"dashboard.icon",children:[c.jsx(v.DotsVerticalIcon,{className:th({active:o?"true":"false"})+" "+oh(null==l?void 0:l.dashboard)}),c.jsx(v.DotsVerticalIcon,{className:th({active:o?"true":"false"})+" "+oh(null==l?void 0:l.dashboard),style:{marginLeft:-8}})]})})})},sh=function(e){return c.jsx(null!=e&&e.onOrderChange?dh:ch,Q({},e))},uh=function(){},dh=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||uh,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(ch,Q({},e,{ref:p[0]}))},ch=t.forwardRef((function(e,n){var r=e.item,i=e.index,o=e.onDeleteItem,a=e.onOrderChange&&e.totalItemsCount>1,l=md().textOverride,s=Xd(),u=t.useState(!1),d=u[1];return c.jsx(zf,{"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:""+Wf.itemWrapper,onMouseOver:function(){return!!a&&d(!0)},onMouseLeave:function(){return!!a&&d(!1)},children:[c.jsx(Zm,{clickable:!!r.onClick,highlight:r.highlight,ref:n,children:c.jsxs(zf,{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:""+Wf.dragHandleContainer,children:!!a&&c.jsx(lh,{active:u[0],top:9})}),c.jsx(_f,{flex:1,paddingLeft:0,children:c.jsxs(zf,{gap:"0.5rem",children:[(null==r?void 0:r.icon)&&c.jsx(Uf,{icon:null==r?void 0:r.icon}),c.jsxs(_f,{flexGrow:1,paddingY:"5.5px","data-component":"list-title-subtext",children:["string"==typeof r.title?c.jsx("p",{className:""+Wf.label(null==s?void 0:s.lists),children:r.title}):c.jsx(t.Fragment,{children:r.title}),r.subtext&&c.jsx("p",{className:""+Wf.metadata(null==s?void 0:s.lists),children:r.subtext})]})]})}),r.select&&c.jsx("div",{className:""+Wf.right,children:c.jsx(Sm,{labelHidden:!0,label:l("function","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:""+Wf.right,children:r.renderRight()}),r.editIcon&&c.jsx("div",{className:""+Wf.edit,children:c.jsx(_d,{})}),r.preventDelete&&c.jsx("div",{className:""+Wf.edit,children:c.jsx(Td,{})})]})}),o&&!r.preventDelete&&c.jsx("div",{className:""+Wf.deleteWrapper(null==s?void 0:s.lists),children:c.jsxs("button",{type:"button",className:""+Wf.deleteButton(null==s?void 0:s.lists),"data-testid":e.testId&&e.testId+"-"+i+"-remove",onClick:function(e){e.stopPropagation(),o&&o(i)},"aria-label":l("remove","Remove"),"data-themeapi":"lists.icon",children:[c.jsxs("span",{className:""+eu,children:[l("remove","Remove")," ",r.title]}),c.jsx(Cd,{})]})})]})})})),ph=function(e){return c.jsx(_f,{paddingRight:null==e?void 0:e.paddingRight,as:null==e?void 0:e.as,children:c.jsx(Ud,{gap:"0.5rem",children:null==e?void 0:e.children})})},fh=function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x;return As({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":mh(e.theme),variants:{size:{small:{fontSize:null==(s=e.theme)||null==(s=s.small)?void 0:s.fontSize,fontWeight:null==(u=e.theme)||null==(u=u.small)?void 0:u.fontWeight,padding:null!=(d=null==(c=e.theme)||null==(c=c.small)?void 0:c.padding)?d:"2px 8px 3px",height:"auto",width:"auto"},medium:{fontSize:null==(p=e.theme)||null==(p=p.medium)?void 0:p.fontSize,fontWeight:null==(f=e.theme)||null==(f=f.medium)?void 0:f.fontWeight,padding:null!=(m=null==(h=e.theme)||null==(h=h.medium)?void 0:h.padding)?m:"0 12px"},large:{fontSize:null==(v=e.theme)||null==(v=v.large)?void 0:v.fontSize,fontWeight:null==(g=e.theme)||null==(g=g.large)?void 0:g.fontWeight,padding:null!=(b=null==(x=e.theme)||null==(x=x.large)?void 0:x.padding)?b:"0 12px"}},isHovering:{true:mh(e.theme)}}})};function mh(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 hh=function(e){var t,n,r,i=Xd();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:Hd(fh({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})})},vh=function(e){return c.jsx(_f,{children:c.jsx(hh,{testId:e.testId,onChange:function(){return null==e?void 0:e.onChange()},height:36,align:"left",disabled:e.disabled,children:c.jsxs(zf,{children:["+ ",e.label]})})})},gh=function(e){return void 0===(null==e?void 0:e.children)?null:c.jsx(Ud,{gap:e.hasDeleteIcon?"0.9rem":"0.5rem",className:Qf("listview"),columns:["repeat(1,minmax(0,1fr))"],"data-component":"list-view",role:"list",children:null==e?void 0:e.children})};function bh(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=Pf(r,["title","subtext"]),u=s.setSearch,d=s.values,p=s.searchString,f=n.useRef(null);return Kd(f,(function(){return l(!1)})),e.hide?null:c.jsxs("div",{className:""+Wf.addWrapper,ref:f,children:[c.jsx(_f,{marginTop:e.marginTop,"data-component":"new-item",children:c.jsx(vh,{testId:e.testId,onChange:function(){var t=!a;t&&e.onOpenDropdown&&e.onOpenDropdown(),l(t)},label:e.callToAction})}),c.jsxs(Xf,{open:a,fixedHeight:!0,width:"calc(100% - 2px)",children:[c.jsx(_f,{padding:8,children:c.jsx(jm,{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(Xf.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 xh(e){var n,r;return c.jsxs(ph,{paddingRight:null!=(n=null==e?void 0:e.paddingRight)?n:"0.25rem",children:[e.items.length>0&&c.jsx(gh,{children:[].concat(e.items).map((function(t,n){return c.jsx(sh,{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(bh,Q({},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(vh,{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 yh=function(e){var t=e.children;return c.jsx("div",{id:e.id,className:""+wh({queriesAreChanging:e.queriesAreChanging,overflowScroll:e.overflowScroll,justifyCenter:e.justifyCenter}),"data-component":"view-wrapper",children:t})},wh=As({display:"flex",width:"100%",height:"100%",flexDirection:"column",variants:{queriesAreChanging:{false:{},true:{filter:"blur(1px)"}},overflowScroll:{false:{},true:Q({overflow:"auto"},Ef)},justifyCenter:{false:{},true:{justifyContent:"center"}}}}),jh=["sm","primary","secondary","disabled","loading","suppressed"],Ch=vd((function(e){var n,r,i,o,a,l,s=Xd(),u=null!=e&&e.primary?"primary":null!=e&&e.secondary?"secondary":e.suppressed?"suppressed":"secondary";return c.jsx("button",Q({},((n={})["data-componentoverride"]="renderButtonComponent",n),{"data-component":null==e?void 0:e["data-component"],"data-testid":e.testId,onClick:e.onClickWithDevToolCheck&&e.onClickWithDevToolCheck(e.onClick),disabled:e.disabled,className:Hd(Jf("button",e,jh),null==e?void 0:e.className,""+(r=null==s?void 0:s.buttons,i=e.themeOverride,As(Q({},nu.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:{},suppressed:{}},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:Q({},null==r?void 0:r.primary,i)},{type:"secondary",css:Q({},null==r?void 0:r.secondary,{"&:hover":Q({opacity:.7,background:"transparent"},null==r||null==(o=r.secondary)?void 0:o["&:disabled"]),"&:disabled":Q({opacity:.7,background:"transparent"},null==r||null==(a=r.secondary)?void 0:a["&:disabled"]),"&:hover:disabled":Q({opacity:.7,background:"transparent"},null==r||null==(l=r.secondary)?void 0:l["&:hover:disabled"])},i)},{type:"suppressed",css:Q({},null==r?void 0:r.secondary,i,{background:"transparent",paddingLeft:4,paddingRight:4,"&:disabled":{background:"transparent"}})}]})))({type:u,highlight:!(null==e||!e.highlight),block:null==e?void 0:e.block})),onMouseEnter:e.onMouseEnter,"data-themeapi":e.internal?void 0:"buttons."+u,children:e.icon?c.jsxs(zf,{gap:"0.25rem",alignItems:"center",children:[c.jsx(_f,{width:20,children:e.icon.Icon()}),c.jsx("span",{children:e.children})]}):c.jsx(t.Fragment,{children:e.children})}))}),"renderButtonComponent"),Sh={name:"t91scv",styles:"display:grid;place-content:center"},Fh=function(e){var n=t.useState("initial"),r=n[0],i=n[1],o=e.autoFeedback?X(G().mark((function t(){var n;return G().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(Ch,{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,icon:e.icon,onMouseEnter:e.onMouseEnter,children:[c.jsx("div",{css:["loading"==a&&{visibility:"hidden"},"",""],children:e.children}),"loading"==a&&c.jsx("div",{css:Sh,children:c.jsx(em,{color:"white"})})]})},kh=t.createContext({addToast:function(){throw"not implemented."}}),_h={name:"zjik7",styles:"display:flex"},Th={name:"1x3jg5i",styles:"margin-left:0.75rem"},Ah=function(e){return c.jsxs("div",{css:_h,children:[c.jsx("span",{children:e.renderIcon()}),c.jsx("span",{css:Th,children:e.message})]})},Dh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Ih=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Dh,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"})})}})},Oh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Ph=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Oh,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"#e86f7f",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"})})}})},Eh={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Mh=function(e){return c.jsx(Ah,{message:e.message,renderIcon:function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:Eh,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"})})}})},Rh={name:"6u431h",styles:"position:fixed;left:1.25rem;bottom:1.25rem"},Lh={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 Nh(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(kh.Provider,{value:{addToast:s},children:[c.jsx("div",{css:Rh,style:{zIndex:2147483647},children:o.map((function(e,t){return c.jsx("div",{css:Lh,children:e()},"toast_"+t)}))}),n]})}function zh(){return t.useContext(kh)}var qh,Bh=function(e){var t=md(),n=t.textOverrides,r=t.developerTools,i=zh().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!0===r||"object"==typeof r&&r.translationKeys?c.jsx("span",{onMouseEnter:function(){i((function(){return c.jsx(Ih,{message:"Change the text with 'textOverride' property '"+e.override+"'"})}),"unique-text-override-"+e.override)},children:a}):c.jsx(c.Fragment,{children:a})},Wh=As({display:"grid",height:"100%",width:"100%",alignContent:"center"}),Vh=As({margin:"auto",textAlign:"center"}),Hh=As(Q({},nu.text,{fontSize:"1.5rem",lineHeight:"2rem",color:"inherit",variants:{textOpacity:(qh={},qh[60]={opacity:60},qh[40]={opacity:40},qh)}})),Yh=As({marginTop:"0.75rem",fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1rem",opacity:.8}),Uh=Object.assign((function(e){var t;return c.jsx("div",{className:""+Wh,children:c.jsxs("div",{className:""+Vh,children:[c.jsx("h1",{className:""+Hh({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:""+Yh,children:null==e?void 0:e.children})}}),Gh=function(e){return c.jsx(Uh,{opacity:40,title:null==e?void 0:e.title,children:e.renderExtra&&e.renderExtra()})},Kh={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"},Xh={name:"akdqam",styles:"margin-top:1rem"},Qh=function(){return c.jsx(Uh,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:Kh,className:""+tu.text,children:"An internal error occurred, please try again soon."}),c.jsx("div",{css:Xh,children:c.jsx(Fh,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},Jh=function(){return c.jsx(Uh,{title:"There is an issue with your configuration settings.",renderExtra:function(){return c.jsx("p",{className:""+tu.text,children:"See logs for more details."})}})},Zh={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"},$h={name:"akdqam",styles:"margin-top:1rem"},ev=function(){return c.jsx(Uh,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:Zh,className:""+tu.text,children:"We were unable to verify your identity"}),c.jsx("div",{css:$h,children:c.jsx(Fh,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},tv={name:"12dms0z",styles:"margin-top:1rem;width:100%"},nv=function(e){return c.jsx(Uh,{title:"This view has changed",renderExtra:function(){return c.jsx(Uh.Extra,{children:c.jsxs(Bh,{override:"view.data-set-changed",children:["A field this view was using has been removed.",c.jsx("div",{css:tv,children:c.jsx(Fh,{"data-component":"remove-missing-field",onClick:function(){return e.removeMissingField()},children:"Auto fix"})})]})})}})},rv=function(e){var t;return c.jsx(Uh,{title:null!=(t=null==e?void 0:e.title)?t:"Query under construction 🏗",renderExtra:function(){var t;return c.jsx(Uh.Extra,{children:null!=(t=null==e?void 0:e.children)?t:"Not all required properties have been set to render this component"})}})},iv=function(){return c.jsx(Uh,{title:c.jsx(Bh,{override:"view.failed-to-fetch-results",children:"Failed to fetch the data 🤔"})})},ov=function(){return c.jsx(Uh,{title:"This view is not available"})},av=function(e){return c.jsxs(yh,{queriesAreChanging:!1,children:[c.jsx(Pg,Q({},e)),c.jsx(Uh,{title:c.jsx(Bh,{override:"view.empty-results",children:"No data to show"})}),e.children]})},lv={name:"1g0vxgi",styles:"margin-top:0.75rem"},sv=function(e){return c.jsx(Uh,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(Fh,{onClick:e.onManualRetry,css:lv,children:"retry"})}})},uv={name:"1g0vxgi",styles:"margin-top:0.75rem"},dv=function(e){return c.jsx(Uh,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(Fh,{onClick:e.onManualRetry,css:uv,children:"retry"})}})},cv=function(e){return c.jsx("h3",Q({},e,{children:e.children}))},pv=function(e){return c.jsx("p",Q({},e,{children:e.children}))},fv=function(e){return c.jsx("p",Q({},e,{className:Hd(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}))},mv=As(Q({overflow:"overlay"},Ef)),hv=function(e){return As(Q({},e,{variants:{buttons:{end:{display:"grid",justifyContent:"end"}}}}))},vv=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=Xd();return c.jsx("div",{className:Hd(Qf("modal-header"),""+(l=null==m||null==(t=m.modals)?void 0:t.header,As(Q({width:"100%",lineHeight:"1.5rem"},l,{"& h3":nu.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.jsx(zf,{className:Hd(null!=d?d:void 0),alignItems:"center",gap:"0.25rem",children:e.children||c.jsxs(c.Fragment,{children:[c.jsx(cv,{children:s}),(null==e?void 0:e.tooltip)&&c.jsx(_f,{width:18,children:c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",color:Ds(30)})})})]})})})},gv=function(e){var t,n,r,i,o,a=null!=(t=null==e?void 0:e.buttons)?t:"end",l=Xd();return c.jsx("div","space-between"===(null==e?void 0:e.buttons)?{className:Hd(Qf("modal-footer"),""+hv(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(zf,{gap:"0.75rem",justifyContent:"space-between",children:null==e?void 0:e.children})}:{className:Hd(Qf("modal-footer"),""+hv(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})},bv=function(e){var t,n,r,i=e.children,o=e.className,a=Xd();return c.jsx("div",{className:Hd(null!=e&&e.scrollable?""+mv:void 0,Qf("modal-content"),""+(r=null==a||null==(t=a.modals)?void 0:t.content,As({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:Q({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})},xv={name:"1px9jck",styles:"min-height:100vh;padding-left:1rem;padding-right:1rem;text-align:center"},yv={name:"8pnu7z",styles:"display:inline-block;height:100vh;vertical-align:middle"},wv=function(e){var n,r,i,o,a,l,s,u=t.useRef();e.width&&(u.current=e.width);var d,f=null==(n=Xd())?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(Ff,{appear:!0,show:e.isOpen,children:c.jsxs(Mp,{style:{zIndex:null!=(o=null==f||null==(a=f.base)?void 0:a.zIndex)?o:2147483147},"data-themeapi":"modals.base",className:Hd(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(Mp.Overlay,{className:Hd(Qf("modal-overlay"),""+(d=null==f?void 0:f.overlay,As(Q({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:xv,children:[c.jsx("span",{css:yv,"aria-hidden":"true",children:""}),c.jsxs(Ff.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(Fv,{onClick:e.onClose}),c.jsx(jv,{vizzlyPrefix:Qf("modal-wrapper",e.namespace),children:e.children})]})]})]})})})},jv=function(e){var t,n,r,i=Xd();return c.jsx("div",{className:Hd(null==e?void 0:e.vizzlyPrefix,""+(r=null==i||null==(t=i.modals)?void 0:t.base,As(Q({maxHeight:"100%"},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}}}}))),Qf("modal-body")),"data-themeapi":"modals.base","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"vizzly-modal-body","data-chipposition":"above.center",children:null==e?void 0:e.children})},Cv={name:"1f0fr1j",styles:"position:absolute;top:-1.5rem;right:-1.5rem"},Sv={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Fv=function(e){var t,n,r=null==(t=Xd())?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:Cv,className:Hd(Qf("modal-close"),""+tu.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:Sv,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})},kv=Object.assign(wv,{Header:vv,Footer:gv,Content:bv}),_v=Object.assign((function(){return null}),{list:function(e){var t;return As({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,j,C,S,F,k,_;return As(Q({lineHeight:"1rem",letterSpacing:"0.1em",whiteSpace:"nowrap"},Ts,{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":Q({},Ts,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==(j=e.selected)?void 0:j.border,borderRight:null==e||null==(C=e.selected)?void 0:C.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":Q({},Ts,null==e||null==(_=e.selected)?void 0:_["&:hover"])}},button:{true:{cursor:"pointer",padding:"0.5rem",border:0,whiteSpace:"nowrap"}}}}))},panel:function(e,t){return As({paddingLeft:null!=e?e:"0.5rem",paddingRight:null!=t?t:"0.5rem"})},hasChanges:As({fontSize:8})}),Tv=["children","paddingLeft","paddingRight"],Av=Object.assign((function(){return null}),{Group:function(e){return c.jsx(af.Group,Q({},e,{children:c.jsx("div",{className:Qf("tab-group"),children:e.children})}))},Button:function(e){var t=Xd();return c.jsx(af,Q({},e,{className:""+tu.button,children:function(n){var r=n.selected;return c.jsx("div",{className:Hd(Jf("tab-button",{selected:r},["selected"]),""+_v.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=te(e,Tv);return c.jsx(af.Panel,Q({className:Hd(Qf("tab-panel"),""+_v.panel(n,r))},i,{children:t}))},Panels:function(e){return c.jsx(af.Panels,Q({},e,{children:e.children}))},List:function(e){var t=Xd();return c.jsx(af.List,Q({className:Hd(Qf("tab-button-list"),""+_v.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}))}}),Dv=function(e){var t;return c.jsx(zf,{className:Hd(Jf("button-group",e,[])),gap:e.gap||"0.75rem",justifyContent:null!=(t=null==e?void 0:e.buttons)?t:"start","data-component":e["data-component"],children:e.children})},Iv=As({borderWidth:0,padding:0,marginLeft:0,marginRight:0}),Ov=function(e){var t,n;return c.jsx(_f,{className:Hd(Qf("panel-property"),""+Iv),marginBottom:null!=(t=e.marginBottom)?t:"0.75rem",as:null!=(n=null==e?void 0:e.as)?n:"div",children:e.children})},Pv=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!Gt(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}}))}))},Ev=function(e,t){switch(t.type){case"setSelectedFields":return function(e,t){return Q({},e,{selectedFieldIndexes:t.selectedFieldIndexes})}(e,t);case"setSelectedDataSets":return function(e,t){var n=t.selectedDataSetIndexes,r=e.dataSets,o=e.selectedFieldIndexes,a=Pv(e.type,r,e.selectedDataSetIndexes);return o=i.remove(o,(function(e){var t=Gr(r,a[e].value.dataSetId);return n.includes(t[1])})),Q({},e,{selectedDataSetIndexes:n,selectedFieldIndexes:o})}(e,t);case"setTitle":return function(e,t){return Q({},e,{title:t.title})}(e,t);case"setType":return function(e,t){return Q({},e,{selectedFieldIndexes:[],type:t.filterType})}(e,t);default:return Q({},e)}},Mv={type:"singleSelectFilter",appliesToFields:[],title:"",value:null,requiresValue:!1,managedByConfiguration:!1},Rv=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=Pv(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(Ev,{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).filter((function(e){return!e.hide})).map((function(e){return{label:e.name,value:e.id}})),d=Pv(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||Mv,e.dataSets),a=o.fieldOptions,l=o.dataSetOptions,s=o.globalFilter,u=o.dispatch,d=o.selectedDataSetIndexes,p=o.selectedFieldIndexes,f=md(),m=f.featureToggles,h=f.textOverride;return t.useEffect((function(){1===e.dataSets.length&&u({type:"setSelectedDataSets",selectedDataSetIndexes:[0]})}),[]),c.jsxs(c.Fragment,{children:[c.jsx(kv.Header,{title:h("new_filter","New filter"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{label:h("title","Title"),id:"title",placeholder:h("title","Title"),value:s.title,onChange:function(e){u({type:"setTitle",title:e.target.value})}})}),l.length>1&&c.jsx(Ov,{children:c.jsx(Gv,{id:"data-set",label:h("data_sets","Data sets"),placeholder:h("data_sets_placeholder","Which data sets will this filter impact?"),options:l,selected:d,setSelected:function(e){u({type:"setSelectedDataSets",selectedDataSetIndexes:e})},textOverride:h})}),c.jsx(Ov,{children:c.jsx(Sm,{id:"filter-type",label:h("filter_type","Filter type"),anchorLeft:!0,selected:s.type,onChange:function(e){u({type:"setType",filterType:e})},options:(r=[{label:h("single_select","Single select"),value:"singleSelectFilter"},{label:h("multi_select","Multi select"),value:"multiSelectFilter"}],m.showDateFilter&&r.push({label:h("date_picker","Date picker"),value:"dateFilter"}),m.showDateAndTimeFilter&&r.push({label:h("date_time_picker","Date Time picker"),value:"dateAndTimeFilter"}),r),textOverride:h})}),c.jsx(Ov,{children:c.jsx(Gv,{label:h("fields","Fields"),id:"data-set-fields",placeholder:h("fields_placeholder","Which fields will this filter impact?"),options:a,selected:p,setSelected:function(e){u({type:"setSelectedFields",selectedFieldIndexes:e})},textOverride:h})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:function(){return e.onCancel()},children:h("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){e.setFilter(s)},children:h("confirm","Confirm")})]})})]})},Lv=Object.assign((function(){}),{svg:function(e){var t,n,r;return As({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:As({paddingTop:0,display:"block",height:"1rem",width:"1rem"})}),Nv=function(e){var t,n=Xd();return c.jsxs("div",{className:Hd(""+Lv.icon,null==e?void 0:e.className),role:"alert",children:[c.jsx("span",{className:""+eu,children:null==e?void 0:e.title}),c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+Lv.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:""+Lv.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"})})]})},zv=function(e){var r=e.filters,i=e.show,o=e.onClose,a=e.source,l=e.onDeleteItem,s=e.onUpdate,u=e.dataSets.filter((function(e){return!e.preAggregated})),d=t.useState([])[1],p=md(),f=p.textOverride,m=p.mode,h=n.useState(null),v=h[0],g=h[1],b=Array.isArray(r)?[].concat(r).filter((function(e){return!e.hidden})).map((function(e,t){var n={};0===e.appliesToFields.length&&(n={renderRight:function(){return c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added.")})},children:c.jsx(Nv,{title:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added."),type:"warning",className:""+Bv})})}});var r=f("additional_filters.filter_type_subtext","[[filterType]] for [[numberOfFields]] {{field}} [[listOfFields]]",{field:{count:e.appliesToFields.length,singular:"field",plural:"fields"},listOfFields:be([].concat(e.appliesToFields).map((function(e){var t=Vr(u,e.dataSetId);return t?Yr(t,e.fieldId).publicName:""})),!0,f),numberOfFields:e.appliesToFields.length,filterType:gi(e.type,f)});return Q({preventDelete:e.managedByConfiguration,title:ji(e,u,f),subtext:r},n,{editIcon:!e.managedByConfiguration,onClick:e.managedByConfiguration?function(){}:function(){return g({draftFilter:e,filterIndex:t})}})})):[];return c.jsxs(c.Fragment,{children:[c.jsxs(kv,{width:"xl","data-testid":"manage-filters-modal",isOpen:i,onClose:function(){return o()},children:[c.jsx(kv.Header,{title:""+("global"===a?f("dashboard_filters","Dashboard filters"):f("add_local_filters","Add Local filters")),show:!0}),c.jsx(kv.Content,{children:c.jsx(xh,{mode:m,onDeleteItem:l,newItemBtn:{callToAction:"global"===a?f("new_dashboard_filter","New dashboard filter"):f("new_local_filter","New local filter"),onClick:function(){g({filterIndex:void 0,draftFilter:Mv}),d(r)}},items:b})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Fh,{onClick:function(){return o()},secondary:!0,children:f("close","Close")})})]}),c.jsx(kv,{width:"xl","data-testid":"edit-filter",isOpen:null!=v,onClose:function(){},hideCloseIcon:!0,children:c.jsx(Rv,{onCancel:function(){return g(null)},current:(null==v?void 0:v.draftFilter)||null,setFilter:function(e){d(r),s({filter:e,index:null==v?void 0:v.filterIndex}),g(null)},dataSets:u})})]})};function qv(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 Bv=As({paddingTop:0}),Wv=function(){var e=Rm(),t=e.dashboard,r=e.dispatch,i=e.trackEvent,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(Vv,{onChange:function(){i("manageGlobalFilters.open"),l(!0)},disabled:Ni(t.display)}),c.jsx(zv,{dataSets:t.dataSets,filters:t.globalFilters,show:a,onUpdate:function(e){var n=qv(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)}})]})},Vv=function(e){var t,n=Xd(),r=md().textOverride;return c.jsx("div",{className:""+Hv,"data-themeapi":"filters.filterBy",children:c.jsx(Fh,{testId:"manage-global-filters-open",onClick:null==e?void 0:e.onChange,disabled:null==e?void 0:e.disabled,className:Hd("filter-by-button"),themeOverride:null==n||null==(t=n.filters)?void 0:t.filterBy,secondary:!0,children:c.jsxs(zf,{as:"span",justifyContent:"center",alignItems:"center",gap:"0.25rem",children:[c.jsx("span",{className:"filter-by-button-icon",children:c.jsx(du,{active:!1})}),c.jsx("span",{className:"filter-by-button-text",children:r("dashboard-filters.call-to-action","Add filter")})]})})})},Hv=As({minWidth:"100px",position:"relative"}),Yv={name:"1d3w5wq",styles:"width:100%"},Uv={name:"1egouu6",styles:"position:relative;display:flex;width:100%;flex-direction:column;align-items:center"},Gv=function(e){var r,o,a,l,s,u,d=null!=(r=null==e?void 0:e.showableChips)?r:2,p=e.selected,f=e.textOverride,m=t.useState([]),h=m[0],v=m[1];t.useEffect((function(){i.isArray(e.options)&&v(e.options)}),[e.options]);var g=t.useState(null!=(o=null==e?void 0:e.isLoading)&&o),b=g[0],x=g[1],y=t.useState(i.isFunction(e.options)?"unloaded":void 0),w=y[0],j=y[1],C=n.useState(!1),S=C[0],F=C[1];t.useEffect((function(){var t=function(){var t=X(G().mark((function t(){var n;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(x(!0),n=new AbortController,j("loading"),!i.isFunction(e.options)){t.next=9;break}return e.options(n.signal).then((function(e){j("loaded"),e&&(v(e),x(!1))})),t.abrupt("return",(function(){n.abort(),j("failed")}));case 9:x(!1),v(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 k=Pf(h,["label","value"]),_=k.values,T=k.searchString,A=k.setSearch,D=t.useRef(null);Kd(D,(function(){F(!1),M(d)}));var I=function(t){A("");var n=[].concat(p);n=p.includes(t)?i.filter([].concat(p),(function(e){return e!=t})):[].concat(p,[t]),e.setSelected(n)},O=i.sumBy(h,(function(e){return e.hide?0:1})),P=t.useState(d),E=P[0],M=P[1];t.useEffect((function(){M(S?p.length:d)}),[p.length,h.length]);var R=Xd(),L=pm(e.isLoading);return c.jsxs("div",{css:Yv,"data-fetchstatus":null!=w?w:void 0,children:[(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&c.jsx(vm,{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:Uv,ref:D,children:[c.jsxs(dm,{value:T,onChange:function(e){return A(e)},open:S,setOpen:function(e){F(e),M(e?p.length:d)},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===p.length&&F(!0)},testId:"multi-select",textOverride:f,fixedWidth:null==e?void 0:e.labelWidth,children:[(null==e?void 0:e.selectedPrefix)&&c.jsx(_f,{"data-component":"selected-prefix",padding:null!=(a=null==R||null==(l=R.forms)||null==(l=l.select)?void 0:l.padding)?a:"0.30rem 0.5rem",paddingRight:0,children:null==e?void 0:e.selectedPrefix}),(null==e?void 0:e.placeholder)&&0===p.length&&c.jsx(_f,{padding:"0.35rem 0.5rem",as:"span",children:c.jsx("span",{style:{color:"#A1A8B3"},children:null==e?void 0:e.placeholder})}),c.jsxs(zf,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,minWidth:S?0===p.length?void 0:190:void 0,wrap:!0,padding:null!=(s=null==R||null==(u=R.forms)||null==(u=u.select)?void 0:u.padding)?s:"0.30rem","data-component":"selected-chips",children:[p.length<=E&&p.map((function(t,n){var r=h[t];return r?c.jsx(Jv,{onRemove:function(){return I(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:f},n):null})),E<=d&&p.length>d&&c.jsxs(t.Fragment,{children:[p.map((function(t,n){var r=h[t];return n>d-1?null:r?c.jsx(Jv,{onRemove:function(){return I(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:f},n):null})),c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:p.map((function(e,n){var r;return n<=d-1?null:c.jsxs(t.Fragment,{children:[null==(r=h[e])?void 0:r.label,p.length!==n+1&&", "]},n)}))})},children:c.jsx(Jv,{onRemove:function(){},label:p.length-d+" more",disableClear:!0,textOverride:f})})]})]})]}),c.jsxs(Xf,{open:S,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?192:void 0,children:[b&&c.jsx(_f,{height:80,children:L&&c.jsx(im,{color:"#3074d9"})}),p.length!==O&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{padding:8,children:c.jsx(jm,{id:(null==e?void 0:e.id)+"-add-item",label:"Add "+e.placeholder,labelHidden:!0,autoFocus:!0,defaultValue:T,onChange:function(e){return A(e.target.value)}})}),_.map((function(e,n){return c.jsx(t.Fragment,{children:!e.item.hide&&!p.includes(e.refIndex)&&c.jsx(Xf.Option,{onChange:function(){return I(e.refIndex)},label:e.item.label})},n)}))]}),!b&&p.length===O&&c.jsx(_f,{padding:8,children:f?f("no_options","No Options"):"No Options"})]})]})]})},Kv={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))"},Xv={name:"1ho1ybk",styles:"max-width:100%;flex:0 1 auto;font-size:0.75rem;line-height:1;font-weight:400"},Qv={name:"10bts8a",styles:"display:flex;flex:1 1 auto;flex-direction:row-reverse"},Jv=function(e){var t=e.textOverride,n=t?t("remove_pill","Remove [[label]]",{label:e.label}):"Remove "+(null==e?void 0:e.label);return c.jsxs("div",{css:Kv,children:[c.jsx("div",{css:Xv,children:e.label}),c.jsx("div",{css:Qv,children:c.jsxs("button",{onClick:function(t){t.preventDefault(),e.onRemove()},className:""+tu.button,children:[c.jsx("span",{className:""+tu.srOnly,children:n}),!(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:Hd(p.css({name:"13h9wtn",styles:"margin-left:0.5rem;height:1rem;width:1rem;cursor:pointer;border-radius:9999px;opacity:0.7;:hover{opacity:1;}"}),""+ru),"aria-label":n,children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})})]})},Zv=function(e){var n,r,i,o,a=Xd(),l=t.useRef(void 0),s=md(),u=s.cascadeFilterSelection,d=s.textOverride,p=Rm().runQueriesCallback,f=e.filter,m=e.filterIndex,h=e.dataSets,v=e.onChange,g=t.useState(null),b=g[0],x=g[1],y=t.useState(!1),w=y[0],j=y[1],C=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zm(ki(f),p)(t);case 2:return x(n=e.sent),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b){e.next=7;break}return j(!0),t=new AbortController,e.next=5,C(t.signal);case 5:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),j(!1),x(n)):Te("Ran select filter options to force a value, but no results were returned.");case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!f.requiresValue||null!==f.value){e.next=6;break}return t=new AbortController,e.next=4,C(t.signal);case 4:(n=e.sent)&&n[0]?(Fe("Filter forcing initial value to be set."),x(n),v(Q({},f,{value:n[0].value}))):Te("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(f)]);var F=ji(f,h,d),k=t.useState([]),_=k[0],T=k[1];t.useEffect((function(){var e;null!=f&&f.value&&(b&&(null==b?void 0:b.length)>0?T((e=null==f?void 0:f.value,b.reduce((function(t,n,r){return e.includes(n.value)&&t.push(r),t}),[]))):S())}),[f,b]),t.useEffect((function(){u&&null!==l.current&&JSON.stringify(l.current)!==JSON.stringify(f.optionsFilters)&&x(null),l.current=f.optionsFilters}),[f.optionsFilters]);var A=qm(F,null==a||null==(n=a.forms)?void 0:n.select);return e.filter.hidden?null:c.jsx(_f,{minWidth:A+36,"data-component":"multi-select-filter",children:c.jsx(Gv,{options:b||C,setSelected:function(t){b&&e.onChange(Q({},f,{value:t.map((function(e){var t;return null==(t=b[e])?void 0:t.value})).filter((function(e){return void 0!==e}))}))},selected:_,isLoading:w,id:"filter-"+m,disableClearAll:!(null!=e&&e.showClearBtn)&&1===(null==(r=f.value)?void 0:r.length),selectedPrefix:F+(null!=(i=f.value)&&i.length&&(null==(o=f.value)?void 0:o.length)>0?" · ":""),showableChips:1,textOverride:d,labelWidth:A,label:F,labelHidden:!0,dropdownForFilter:!0},"filter-"+m)})},$v=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"}}),eg=As({position:"relative",display:"inline-flex",height:"100%"}),tg=As({display:"flex",width:"100%",height:"100%",alignItems:"center"}),ng=As({width:18,display:"flex",verticalAlign:"middle",color:"rgb(72, 72, 72)",alignSelf:"center",justifyContent:"center"}),rg=Object.assign((function(){return null}),{picker:As(Q({},$v.input,{appearance:"searchfield"})),prefixStyle:function(e){var t,n,r;return As({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;return As({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==(a=a["&:hover"])?void 0:a.border,background:null==e||null==(l=e.input)||null==(l=l["&:hover"])?void 0:l.background,boxShadow:null==e||null==(s=e.input)||null==(s=s["&:hover"])?void 0:s.boxShadow},"&:focus":{border:null==e||null==(u=e.input)||null==(u=u["&:focus"])?void 0:u.border,background:null==e||null==(d=e.input)||null==(d=d["&:focus"])?void 0:d.background,boxShadow:null==e||null==(c=e.input)||null==(c=c["&:focus"])?void 0:c.boxShadow}})},inputs:tg,separator:ng,dateInput:function(e){var t,n,r,i,o,a;return As({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 As({width:null==e||null==(t=e.time)?void 0:t.width,paddingLeft:0,paddingRight:0})},clearContainer:function(){return As({width:18,alignSelf:"center"})},wrapper:eg,separatorIcon:function(e){return As({verticalAlign:"middle",display:"block",fill:null==e?void 0:e.indicatorColor,height:18,width:18})},clearButton:function(e){return As(Q({},am,{fill:null==e?void 0:e.indicatorColor}))}}),ig=function(e,t){var n,r,i,o,a,l,s,u,d,c,f,m,h,v,g,b,x,y,w,j,C,S,F,k,_,T,A,D,I,O,P;return p.css("position:absolute;top:",t?t+16:40,"px;margin-right:0;border:1px solid ",Ms.colors.brand[20],";border-radius:",Ms.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==(l=l["&:hover"])?void 0:l.border,";background:",null==e||null==(s=e.input)||null==(s=s["&:hover"])?void 0:s.background,";}}.DateInput_input__focused input{border:",null==e||null==(u=e.input)||null==(u=u["&:focus"])?void 0:u.border,";background:",null==e||null==(d=e.input)||null==(d=d["&:focus"])?void 0:d.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==(c=e.input)?void 0:c.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==(f=e.calendar)||null==(f=f.selected)?void 0:f.background,";opacity:0.8;color:",null==e||null==(m=e.calendar)||null==(m=m.selected)?void 0:m.color,";}.CalendarDay__selected_span{background:",null==e||null==(h=e.calendar)||null==(h=h.selected)?void 0:h.background,";opacity:0.8;border:1px double ",null==e||null==(v=e.calendar)||null==(v=v.selected)?void 0:v.background,";color:",null==e||null==(g=e.calendar)||null==(g=g.selected)?void 0:g.color,";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:",null==e||null==(b=e.calendar)||null==(b=b.selected)?void 0:b.background,";opacity:0.7;border:1px double ",null==e||null==(x=e.calendar)||null==(x=x.selected)?void 0:x.background,";color:",null==e||null==(y=e.calendar)||null==(y=y.selected)?void 0:y.color,";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:",null==e||null==(w=e.calendar)||null==(w=w.selected)?void 0:w.background,";border:1px double ",null==e||null==(j=e.calendar)||null==(j=j.selected)?void 0:j.background,";color:",null==e||null==(C=e.calendar)||null==(C=C.selected)?void 0:C.color,";}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:",null==e||null==(S=e.calendar)||null==(S=S.selected)?void 0:S.background,";border:1px double ",null==e||null==(F=e.calendar)||null==(F=F.selected)?void 0:F.background,";opacity:0.8;color:",null==e||null==(k=e.calendar)||null==(k=k.selected)?void 0:k.color,";}.CalendarDay__hovered_span:active{background:",null==e||null==(_=e.calendar)||null==(_=_.selected)?void 0:_.background,";border:1px double ",null==e||null==(T=e.calendar)||null==(T=T.selected)?void 0:T.background,";color:",null==e||null==(A=e.calendar)||null==(A=A.selected)?void 0:A.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==(D=e.calendar)||null==(D=D.title)?void 0:D.color,";font-size:",(P=null==e||null==(I=e.calendar)||null==(I=I.title)?void 0:I.fontSize)+("number"==typeof P?"px":""),";text-align:center;padding-top:22px;padding-bottom:37px;caption-side:initial;}.CalendarMonth_caption>strong{font-weight:",null==e||null==(O=e.calendar)||null==(O=O.title)?void 0:O.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;}","")},og=function(e){var t,n=Xd();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:""+rg.dateInput(null==n||null==(t=n.forms)?void 0:t.dateTime),onChange:function(t){return null==e?void 0:e.onChange(t.currentTarget.value)}})})},ag=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 Kd(d,(function(){u(!1)})),t.useEffect((function(){if(i){var t=lg(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(Xf,{open:s,fixedHeight:!0,width:"calc(100% - 2px)",children:p.map((function(t,n){return c.jsx(Xf.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)},lg=function(e,t){var n=y(e,"HH:mm:ss",!0);return y(e,"HH:mm",!0).isValid()||n.isValid()?y(e,t):null},sg=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:""+tu.bold,children:[n.format("MMMM")," "]}),c.jsx("select",{value:n.year(),onChange:function(e){return r(n,e.target.value)},className:""+rg.picker,"data-testid":"year-select",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)})))})]})}})},ug=vd((function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v=e.startDate,g=e.endDate,b=e.startTime,x=e.endTime,w=e.onChange,j=e.id,C=e.prefix,S=e.onClear,F=e.label,k=e.type,_=e.textOverride,T=null!=(n=e.dateFormat)?n:"DD/MM/YYYY",A=null!=(r=e.timeFormat)?r:"HH:mm",D=t.useState({start:b?lg(b,A):null,end:x?lg(x,A):null}),I=D[0],O=D[1],P=t.useState(!1),E=P[0],M=P[1],R=t.useState(v?y(v):null),L=R[0],N=R[1],z=t.useState(!1),q=z[0],B=z[1];t.useEffect((function(){q&&B(!1)}),[q]);var W=t.useState(g?y(g):null),V=W[0],H=W[1],Y=t.useState(void 0),U=Y[0],G=Y[1],K=t.useState(void 0),X=K[0],Q=K[1],J=t.useState("startDate"),Z=J[0],$=J[1],ee=t.useRef(null),te=t.useRef(null),ne=Xd(),re=t.useCallback((function(e){var t=e.startDate,n=e.endDate;y(t).isSame(ee.current)&&y(n).isSame(te.current)||(O({start:t?lg("00:00",A):null,end:n?lg("23:59",A):null}),N(t),H(n),w(t&&n?pg("date_time"===k?y("00:00",A):null,t.toDate(),"date_time"===k?y("23:59",A):null,n.toDate()):null),t&&n&&M(!1))}),[w]),ie=t.useCallback((function(e){O({start:e.start,end:e.end}),w(L&&V?pg("date_time"===k?y(e.start,"HH:mm"):null,L.toDate(),"date_time"===k?y(e.end,"HH:mm"):null,V.toDate()):null)}),[w]);t.useEffect((function(){ee.current=L}),[L]),t.useEffect((function(){te.current=V}),[V]);var oe=t.useRef(null);Kd(oe,(function(){M(!1),$("startDate")}));var ae=L?L.format(T):"",le=V?V.format(T):"",se=t.useCallback((function(){M(!1),N(null),H(null),G(void 0),Q(void 0),w(null),S(),O({start:null,end:null}),B(!0)}),[w,S]);t.useEffect((function(){if(U){var e=dg(U,T),t=dg(X||"",T);null===e&&null===t||re({startDate:e||L,endDate:t||V})}}),[U,X]);var ue=t.useRef(null),de=t.useState(0),ce=de[0],pe=de[1];return t.useEffect((function(){ue.current&&pe(ue.current.getBoundingClientRect().height)}),[ue.current]),c.jsxs("div",{className:""+rg.wrapper,id:""+(null!=j?j:"date-picker"),"data-component":"date-picker",children:[c.jsx("div",{className:""+rg.inputsWrapper(null==ne||null==(i=ne.forms)?void 0:i.dateTime),"data-themeapi":"forms.dateTime.input",onClick:function(){M(!0),G(void 0),Q(void 0),$("startDate"),H(null)},ref:ue,children:c.jsxs("div",{className:""+rg.inputs,children:[C&&c.jsxs("div",{className:""+rg.prefixStyle(null==ne||null==(o=ne.forms)?void 0:o.dateTime),children:[null!=F?F:"Custom"," ·"]}),c.jsxs(zf,{gap:0,alignItems:"center",children:[c.jsx(og,{name:"start_date",value:null!=U?U:ae,label:_?_("start_date","Start Date"):"Start Date",onChange:function(e){return G(e)},dateFormat:T}),"date_time"===k&&c.jsx(t.Fragment,{children:c.jsx(ag,{label:_?_("time","Time"):"Time",name:"start_time",onChange:function(e){ie({start:e,end:I.end})},className:rg.dateInput(null==ne||null==(a=ne.forms)?void 0:a.dateTime)+" "+rg.timeInput(null==ne||null==(l=ne.forms)?void 0:l.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:A,value:I.start,shouldClear:q})})]}),c.jsx("div",{"aria-hidden":"true",role:"presentation",className:""+rg.separator,children:c.jsx("svg",{focusable:"false",viewBox:"0 0 1000 1000",className:""+rg.separatorIcon(null==ne||null==(s=ne.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(zf,{gap:0,children:[c.jsx(og,{name:"end_date",value:null!=X?X:le,label:_?_("end_date","End Date"):"End Date",onChange:function(e){return Q(e)},dateFormat:T}),"date_time"===k&&c.jsx(ag,{label:_?_("time","Time"):"Time",name:"end_time",onChange:function(e){ie({start:I.start,end:e})},className:rg.dateInput(null==ne||null==(u=ne.forms)?void 0:u.dateTime)+" "+rg.timeInput(null==ne||null==(d=ne.forms)?void 0:d.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:A,value:I.end,shouldClear:q})]}),c.jsx("div",{className:""+rg.clearContainer(),children:c.jsx(om,{onClear:se,className:""+rg.clearButton(null==ne||null==(p=ne.forms)?void 0:p.dateTime),"aria-label":_?_("clear_date","Clear Dates"):"Clear Dates",fill:null==ne||null==(f=ne.forms)||null==(f=f.select)?void 0:f.indicatorColor,stroke:null==ne||null==(m=ne.forms)||null==(m=m.select)?void 0:m.indicatorColor})})]})}),E&&c.jsx("div",{className:""+ig(null==ne||null==(h=ne.forms)?void 0:h.dateTime,ce),"data-themeapi":"forms.dateTime.calendar",ref:oe,children:c.jsx(sg,{startDate:L,endDate:V,onDatesChange:function(e){G(void 0),Q(void 0),re(e)},focusedInput:Z,onFocusChange:function(e){return $(e)},textOverride:_})})]})}),"renderDateTimeRangeInput",(function(e){return Q({},e)})),dg=function(e,t){return y(e,t,!0).isValid()?y(e,t):null},cg=function(e,t){if(!t)throw new Error("time is null or undefined");var n=y(e),r=y(t);return(n=n.hour(r.hour()).minute(r.minute()).second(r.second())).toDate()};function pg(e,t,n,r){return{start:cg(t,e||y("00:00","HH:mm")),end:cg(r,n||y("23:59","HH:mm"))}}var fg=function(e){var n=e.placeholder,r=e.dateFilterOptions,i=e.onChangeToTimeRange,o=e.showClearBtn,a=e.textOverride,l=t.useState(e.currentValue),s=l[0],u=l[1],d=Object.keys(r).map((function(e){return{value:e,label:r[e].description}}));return i&&(d=[].concat(d,[{label:a?a("custom_range","Custom range"):"Custom range",value:"__vizzly_custom"}])),c.jsx(Sm,{showClearBtn:void 0===o||o,options:d,onChange:function(t){"__vizzly_custom"===t?(u(t),e.onChangeToTimeRange&&e.onChangeToTimeRange()):(u(t),e.onChange&&e.onChange(t))},selected:s,anchorLeft:!0,placeholder:n,selectedPrefix:null!=e&&e.hasSelectedPrefix?n+" · ":void 0,maintainOptionOrder:!0,textOverride:a,fixedWidth:null==e?void 0:e.fixedWidth,label:n,labelHidden:!0,id:null==e?void 0:e.id,dropdownForFilter:e.dropdownForFilter})},mg=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(fg,{showClearBtn:e.showClearBtn,dateFilterOptions:e.dateFilterOptions,placeholder:null==e?void 0:e.placeholder,fixedWidth:null==e?void 0:e.fixedWidth,dropdownForFilter:!0,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,textOverride:e.textOverride,id:null==e?void 0:e.id}),n&&l&&c.jsx(ug,{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){null===t||null===t.start&&null===t.end?e.onChange(null):null!==t.start&&null!==t.end&&e.onChange({startDate:t.start,endDate:t.end})},prefix:!0,onClear:function(){null==e||e.onChange(null),s(!1)},type:"dateAndTimeFilter"===o?"date_time":"date",textOverride:e.textOverride})]})},hg=function(e){var t,n,r=Xd(),i=md().textOverride,o=e.onChange,a=e.filter,l=e.showClearBtn,s=e.type,u=ji(a,e.dataSets,i),d=qm(u,null==r||null==(t=r.forms)?void 0:t.select);return e.filter.hidden?null:c.jsx(_f,{minWidth:d,children:c.jsx(mg,{hasCustomPicker:!0,showClearBtn:l,fixedWidth:d,dateFilterOptions:null==e?void 0:e.dateFilterOptions,onChange:function(e){"string"==typeof e?o({type:s,appliesToFields:a.appliesToFields,title:a.title,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,value:{type:"relative",value:e}}):e&&e.endDate&&e.startDate?o({type:s,appliesToFields:a.appliesToFields,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,title:a.title,value:{type:"fixedRange",before:e.endDate,after:e.startDate}}):null===e&&o({type:s,managedByConfiguration:a.managedByConfiguration,requiresValue:a.requiresValue,appliesToFields:a.appliesToFields,title:a.title,value:null})},currentValue:a,placeholder:u,textOverride:i,id:xe(null!=(n=e.filter.title)?n:"")+"_"+e.filter.type})})},vg=function(e){var t=e.filter,n=e.filterIndex,i=e.onChange,o=e.shouldAlwaysHaveValue,a=md().queryEngineConfig,l=function(e){var t=function(e,t){return r.alternatives().conditional(".type",{is:"singleSelectFilter",then:Ke(e,t)}).conditional(".type",{is:"dateFilter",then:Qe(e,t,"dateFilter")}).conditional(".type",{is:"dateAndTimeFilter",then:Qe(e,t,"dateAndTimeFilter")}).conditional(".type",{is:"multiSelectFilter",then:Xe(e,t)})}(a,e.requiresValue).validate(e).error;t?Ae("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(Bm,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets},JSON.stringify(e.filter.value)):"multiSelectFilter"==t.type?c.jsx(Zv,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"dateFilter"==t.type||"dateAndTimeFilter"==t.type?c.jsx(hg,{showClearBtn:!o,dateFilterOptions:null==e?void 0:e.dateFilterOptions,filter:t,onChange:s,dataSets:e.dataSets,type:t.type},JSON.stringify(e.filter.value)):null:null},gg={name:"1gqeage",styles:"margin-right:0.75rem"},bg=function(e){var n,r=If(),o=r.ref,a=r.show,l=r.position,s=r.close,u=r.open,d=md().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:gg,onClick:e.zoomControl.onReset,children:c.jsx(Sd,{})}),e.localFilters.length>0&&c.jsx("button",{onClick:function(){return u()},"aria-label":"Show Local Filter",className:""+tu.button,children:c.jsx(yd,{active:(n=e.localFilters,i.some(n,(function(e){var t=e.value;return!(i.isArray(t)&&0===t.length||!t)})))})})]}),a&&c.jsx(Af,{onClose:function(){return s()},width:320,position:l,children:c.jsx(Af.Options,{padding:!0,children:c.jsx(_f,{padding:"0.5rem",children:c.jsx(zf,{direction:"column",gap:"0.5rem","data-component":"filters",children:[].concat(e.localFilters).map((function(t,n){return c.jsx(_f,{children:c.jsx(vg,{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)}))})})})})]})},xg=Object.assign((function(){return null}),{title:function(e){var t,n,r,i,o,a,l,s,u;return As({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,variants:{canFlex:{true:{flex:1},false:{flex:"none"}}}})},subject:function(e){var t,n,r,i,o,a,l,s,u;return As({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,flex:1})},verified:function(e){var t;return As({height:18,color:null==e||null==(t=e.verified)?void 0:t.color})}}),yg=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span";return c.jsx(n,{className:""+tu.srOnly,htmlFor:null==e?void 0:e.htmlFor,children:null==e?void 0:e.children})},wg=function(e){var n=e.measures,r=md();return c.jsx(t.Fragment,{children:n&&(null==e?void 0:e.activeMeasures)&&c.jsx(zf,{direction:"column",gap:"1rem",children:Object.keys(n).map((function(t,i){var a=function(e,t,n,r,i,o,a){try{var l,s,u=Tt(e,{supportedAggregates:t,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),d=Yr(n,u.field),c=null!=(l=gs(d.publicName,null==(s=t[u.function])?void 0:s.publicName))?l:"",p=i({fieldId:u.field,func:u.function,type:o,defaultLabel:c,viewId:a}),f=[{label:null!=p?p:c,value:u}];return r[e].map((function(e){var r,l=gs(Yr(n,e.field).publicName,null==(r=t[e.function])?void 0:r.publicName),s=i({fieldId:e.field,func:e.function,type:o,defaultLabel:l,viewId:a});f.push({label:null!=s?s:l,value:e})})),f}catch(e){if(e instanceof un)return[];throw e}}(t,r.queryEngineConfig.supportedAggregates,e.dataSet,n,r.labelFormat,e.componentType,e.viewId),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(Sm,{label:"Replace Parameter "+(i+1),labelHidden:!0,id:"replace-parameter-"+i,selected:l,onChange:function(t){return e.setMeasure(t,l)},options:a},t)}))})})},jg=function(e,t){return!!Br(e).supportedFeatures.parameters&&!(i.isEmpty(t)||!Sg(t)&&!Cg(t))},Cg=function(e){return!i.isEmpty(null==e?void 0:e.group)},Sg=function(e){return!i.isEmpty(null==e?void 0:e.measure)},Fg=function(e){var n=e.activeDimensions,r=e.group,i=e.dataSet,o=md().queryEngineConfig;return c.jsx(t.Fragment,{children:r&&n&&c.jsx(zf,{direction:"column",gap:"1rem",children:Object.keys(r).map((function(t,n){var a=Ct(t,o.supportedTimeTruncFunctions),l=a?function(e,t,n,r){if(!t||!n[r])return[];var i=Yr(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=Yr(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=Yr(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=Yr(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?kg(l,null==e?void 0:e.activeTimeDimension):_g(l,null==e?void 0:e.activeDimensions);return c.jsx(Sm,{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)}))})})},kg=function(e,t){var n;return null==(n=e.find((function(e){return o.isEqual(e.value,t)})))?void 0:n.value},_g=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},Tg=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?Q({},t):n}))},Ag=function(e,t,n){return null==n?void 0:n.map((function(n){return o.isEqual(n,e)?t:n}))},Dg=function(e){var n=If(),r=n.ref,i=n.show,o=n.position,a=n.close,l=n.open,s=e.parameters;return jg(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:""+tu.button,children:[c.jsx("span",{className:""+eu,children:"Change Parameters"}),c.jsx(ih,{tooltipContent:function(){return"Change Parameters"},children:c.jsx(jd,{})})]})}),i&&c.jsx(Af,{onClose:function(){return a()},width:320,position:o,children:c.jsx(Af.Options,{padding:!0,children:c.jsx(_f,{padding:"0.5rem",children:c.jsxs(zf,{direction:"column",gap:"0.5rem","data-component":"parameters",children:[Cg(s)&&Sg(s)&&c.jsx(fv,{marginBottom:0,children:"Measures"}),c.jsx(wg,{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:Ag(n,t,e.activeMeasures)})},componentType:null==e?void 0:e.componentType,viewId:null==e?void 0:e.viewId}),Cg(s)&&Sg(s)&&c.jsx(fv,{marginBottom:0,children:"Groups"}),c.jsx(Fg,{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:Tg(n,t,null==e?void 0:e.activeDimension)}),"truncate"in t&&(null==e||e.setParameterUpdate({updatedTimeDimension:t}))}})]})})})})]}):null},Ig={name:"18pw007",styles:"position:absolute;top:0px;right:0px;z-index:2"},Og={name:"195ggdj",styles:"position:absolute;top:0.75rem;right:0.75rem;display:flex;flex-direction:row;gap:0.625rem"},Pg=function(e){var n,r,o,a,l,s,u=Xd(),d=md(),p=d.organizationName,f=d.textOverride;if(!e.displayTitle&&!e.displaySubject&&i.isEmpty(e.localFilters)&&!jg(null==e?void 0:e.componentType,e.parameters)&&(null==e||!e.verified))return c.jsx(_f,{paddingBottom:null!=(s=e.paddingBottom)?s:"0.75rem","data-component":"empty-titles"});var m,h=(m=0,i.isEmpty(e.localFilters)||(m+=1.25),jg(null==e?void 0:e.componentType,e.parameters)&&(m+=1.25),jg(null==e?void 0:e.componentType,e.parameters)&&!i.isEmpty(e.localFilters)&&(m+=.5),m+"rem"),g=p?f("verified_by_with_organization","Verified by [[organizationName]]",{organizationName:p}):f("verified","Verified");return c.jsxs(c.Fragment,{children:[c.jsxs(zf,{direction:"column",gap:"0.25rem",paddingBottom:null!=(n=e.paddingBottom)?n:"0.75rem","data-component":"titles",children:[c.jsxs(zf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(r=u.charts)||null==(r=r.title)?void 0:r.textAlign)?h:void 0,children:[e.displayTitle&&c.jsx(cv,{style:{fontFamily:null==u||null==(o=u.titles)?void 0:o.fontFamily},className:""+xg.title(null==u?void 0:u.charts)({canFlex:null!=e&&e.library?"false":"true"}),"data-themeapi":"charts.title",children:e.displayTitle}),(null==e?void 0:e.verified)&&(null==e?void 0:e.library)&&c.jsxs(ih,{tooltipContent:function(){return c.jsx(t.Fragment,{children:g})},children:[c.jsx(v.BadgeCheckIcon,{className:""+xg.verified(null==u?void 0:u.library),"data-testid":"badge","data-themeapi":"library.verified.icon"}),c.jsx(yg,{children:g})]})]}),e.displaySubject&&c.jsx(zf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(a=u.charts)||null==(a=a.subject)?void 0:a.textAlign)?h:void 0,children:c.jsx(pv,{style:{fontFamily:null==u||null==(l=u.baseFont)?void 0:l.fontFamily},className:""+xg.subject(null==u?void 0:u.charts),"data-themeapi":"charts.subject",children:e.displaySubject})})]}),!(null!=e&&e.library)&&c.jsx("div",{css:Ig,children:c.jsxs("div",{css:Og,children:[c.jsx(Dg,{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)},viewId:e.viewId}),c.jsx(bg,{setLocalFilters:e.setLocalFilters,localFilters:e.localFilters,zoomControl:e.zoomControl,dataSet:e.dataSet})]})})]})};function Eg(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 Mg=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)})),Rg=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(Mg,{dataKey:t,annotations:r})},Lg=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=Q({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=Q({},r,n.variants&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=Q({},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=Q({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t},Ng="\n.visx-tooltip {\n z-index: 14294967294; /* or whatever height is appropriate */\n}",zg=function(e,t){return t?e-40:e},qg=p.css({display:"inline-flex",position:"relative",flexDirection:"row",gap:24,padding:0,height:40},"",""),Bg=p.css({name:"um88o8",styles:"color:inherit;margin:0 0 0 4px;flex:1;display:flex;justify-content:left;font-family:inherit;font-size:0.75rem;opacity:1;font-weight:400"}),Wg=Object.assign((function(){return null}),{icon:function(e){return Lg({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:qg,label:Bg,scrollbar:p.css({name:"1azakc",styles:"text-align:center"}),reason:function(e){return p.css(Bg,{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)"},"","")}}),Vg=function(e){var n,r,i=t.useState(!1),o=i[1];return c.jsx("div",{className:(r=i[0],p.css(Q({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})},Hg=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:Wg.icon(null!=(n=e.color)?n:"#5d4e8c")({type:null==e?void 0:e.type}),children:o&&e.reason&&c.jsx("div",{className:Wg.reason(null!=(r=e.color)?r:"#5d4e8c"),children:e.reason})})})},Yg={natural:T.curveNatural,monotoneX:T.curveMonotoneX,monotoneY:T.curveMonotoneY,straight:T.curveLinear,step:T.curveStep,stepBefore:T.curveStepBefore,stepAfter:T.curveStepAfter},Ug="-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif";function Gg(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 Kg(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=Q({},a,{domain:o})),"x"===e?(i&&(l=Q({},l,{type:"band"})),r&&(l=Q({},l,{type:"pow"})),t?a:l):t?l:a}function Xg(e,t,n,r){return function(i){var o;return null!=(o=t(i,e))?o:n[r]}}function Qg(e,t,n){return function(r){var i;return null!=(i=e(r))?i:t[n]}}var Jg,Zg=function(e,t){return function(n){return e?e(n):t?eb(n):n}},$g=function(e){return function(t){return null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(t):t}},eb=function(e){return A.timeFormat("%b %d, %y")(new Date(e))},tb=function(e){return c.jsx(Vg,{className:null!=e&&e.alignCenter?""+Wg.scrollbar:void 0,x:!0,children:c.jsx(_,{scale:k.scaleOrdinal({domain:null==e?void 0:e.keys,range:null==e?void 0:e.colors}),children:function(t){return c.jsx("div",{className:Wg.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?Xg(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(Hg,{type:null==i?void 0:i.type,color:a()}),c.jsxs(F.LegendItem,{margin:"0",children:[l.map((function(e,t){return c.jsx(Hg,{type:null==i?void 0:i.type,color:e.color,reason:e.explanation},t)})),c.jsx(Hg,{type:null==i?void 0:i.type,color:a(),reason:l.length>0?"Original color":void 0}),c.jsx(F.LegendLabel,{className:Wg.label,style:{},children:null!=e&&e.formatSeriesName?null==e?void 0:e.formatSeriesName(null==t?void 0:t.text):t.text})]},"legend-quantile-"+n)}))})}})})},nb=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},rb=function(e,t){var n=-Infinity;if(t&&e)for(var r,i=ie(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},ib=function(e,t){var n=Infinity;if(t&&e)for(var r,i=ie(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 ob(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?Kg("y",r,i,void 0,void 0,[1.0005*a,1.0005*o]):o&&o>t?Kg("y",r,i,void 0,void 0,[n,1.0005*o]):a&&a<n?Kg("y",r,i,void 0,void 0,[1.0005*a,t]):Kg("y",r,i)}var ab=Lg({margin:0,fontSize:"0.9rem",padding:0}),lb=Lg({borderBottom:"1px dotted rgba(0,0,0,0.025)"}),sb=Lg({display:"flex",alignItems:"center",gap:6}),ub=Lg({display:"block",padding:0,margin:0,textAlign:"right"}),db=Lg({display:"grid",gridTemplateRows:"auto 1fr",gridRowGap:12,variants:{displayGrid:(Jg={},Jg.true={gridTemplateColumns:"1fr 1fr",gridColumnGap:48},Jg.false={gridTemplateColumns:"1fr"},Jg)}}),cb=Lg({borderTop:"1px solid rgba(200, 200, 200, 0.4)"}),pb=Lg({display:"grid",gridTemplateColumns:"auto 1fr",gap:12,fontSize:"0.75rem",fontWeight:500,color:"inherit",alignItems:"center"}),fb=Lg({display:"block",padding:0,margin:0}),mb=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"),Lg({display:"grid",gridTemplateRows:r,gap:12,padding:6})},heading:ab,total:cb,highlighted:Lg({wordBreak:"break-all"}),row:lb,rowLabel:sb,resultGrid:db,rowValue:ub,tooltipRowContainer:pb,totalLabel:fb,sectionTitle:Lg({color:"#7d838d",fontSize:12,marginTop:"0.25rem",marginBottom:0})}),hb=As({color:Ds(35)}),vb=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(gb,{total:o.showTotalOnTooltip,title:!0,sections:void 0!==d&&u.length>1?2:1,children:[c.jsx("p",{className:""+mb.heading,children:null==e?void 0:e.heading}),void 0!==d&&c.jsxs("div",{className:""+mb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[u.length>1&&c.jsx("p",{className:mb.sectionTitle+" "+hb,children:"Active"}),c.jsx(xb,{datumKey:a,keyString:l,chartProps:o,chartTooltipProps:e})]}),u.length>1&&c.jsxs("div",{className:""+mb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[c.jsx("p",{className:mb.sectionTitle+" "+hb,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(xb,{datumKey:a,keyString:t,chartProps:o,chartTooltipProps:e},"chart_"+t)}))]}),o.showTotalOnTooltip&&c.jsxs("div",{className:mb.total+" "+mb.tooltipRowContainer,children:[c.jsx("p",{className:""+mb.totalLabel,children:"Rounded total: "}),c.jsx("p",{className:mb.row+" "+mb.rowValue,children:null==e?void 0:e.total})]})]})},gb=function(e){return c.jsx("div",{className:""+mb.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})},bb=function(e){var t,n;return c.jsxs("div",{className:""+mb.tooltipRowContainer,children:[c.jsxs("span",{className:mb.row+" "+mb.rowLabel,children:[(null==e?void 0:e.icon)&&c.jsx(Hg,{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:""+mb.highlighted,children:null==e?void 0:e.label})]}),c.jsx("p",{className:mb.row+" "+mb.rowValue,children:null==e?void 0:e.value})]})},xb=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;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==(r=r.keys)||!r.find((function(t){return t===e}))?null!=t&&t.areas&&null!=t&&null!=(i=t.areas)&&null!=(i=i.keys)&&i.find((function(t){return t===e}))?"area":null!=t&&t.lines&&null!=t&&t.lines.scatter&&null!=t&&null!=(o=t.lines)&&null!=(o=o.keys)&&o.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(bb,{icon:{type:a,color:l},label:s,value:"undefined"===u?"-":u})})};function yb(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*((null==e?void 0: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 wb(e,t,n){if(1===e.length)return null==t?void 0: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 jb=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new Error("Invalid font size type")},Cb=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 Sb(e,t,n){var r=(t-n)/3;return r*e+(n-9*r)}function Fb(e,t,n,r){var i=0,o=function(e,t){var n,r;return{fontFamily:null!=(n=null!=(r=null==e?void 0:e.fontFamily)?r:t)?n:Ug,fontWeight:null!=e&&e.fontWeight?Cb(e.fontWeight):"700",fontSize:null!=e&&e.fontSize?jb(e.fontSize):9,letterSpacing:"normal"}}(n,null==r?void 0:r.fontFamily),a=o.fontFamily,l=o.fontWeight,s=o.fontSize,u=o.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),a,""+l,""+s,u);i=Math.max(i,n)})),i}var kb=function(e){var t,n,r,i,o,a,l={fontFamily:null!=(t=null==e||null==(n=e.theme)?void 0:n.fontFamily)?t:Ug,fontWeight:null==e||null==(r=e.theme)?void 0:r.fontWeight,fontSize:null==e||null==(i=e.theme)?void 0:i.fontSize,style:{fill:null!=(o=null==(a=e.theme)?void 0:a.color)?o:Ds(10)}};if("y"===(null==e?void 0:e.axis)){var s,u,d=-((null==e?void 0:e.axisFromPoint.y)+e.axisToPoint.y)/2;return c.jsx("svg",{x:"-1.25em",y:"0",fontSize:null==e||null==(s=e.theme)?void 0:s.fontSize,style:{overflow:"visible"},className:"vizzly-axis-title vizzly-axis-title-y",children:c.jsx("text",Q({transform:"rotate(-90)",x:d,y:"-"+(e.horizontal?null!=(u=e.leftPanelWidth)?u:82:38)},l,{textAnchor:"middle",children:c.jsx("tspan",{x:d,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",Q({x:((null==e?void 0:e.axisFromPoint.x)+e.axisToPoint.x)/2,y:"34",textAnchor:"middle",dominantBaseline:"middle"},l,{children:null==e?void 0:e.label}))})},_b=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 Fb(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=(null==t?void 0: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(Tb,Q({},t,{width:wb(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(Tb,Q({},t,{width:wb(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:(null==t?void 0: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(kb,Q({},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(Tb,Q({},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(kb,Q({},e,{theme:null==e||null==(l=e.theme)?void 0:l.axisTitles,axis:"y",horizontal:null!=(s=e.axisHorizontal)&&s}))]})},Tb=function(e){var n,r,i,o,a,l,s,u,d,p,f,m=e.type,h=null!=(n=e.theme)&&n.fontSize?jb(null==(r=e.theme)?void 0:r.fontSize):9,v=null!=(i=e.theme)&&i.fontWeight?""+Cb(null==(o=e.theme)?void 0:o.fontWeight):"700",g=null!=(a=null==(l=e.theme)?void 0:l.fontFamily)?a:Ug,b=e.width/6,x=yb(e.formattedValue,e.horizontal&&e.last?e.width-Sb(h,40,5):e.width-Sb(h,4,0),g,""+h,v,b),y="end2end"===m?e.last?e.right:null==e?void 0:e.left:e.horizontal?null!=e&&e.last?(null==e||null==(s=e.from)?void 0:s.x)-5:null==e||null==(u=e.from)?void 0:u.x:-5,w=null==e||null==(d=e.from)?void 0:d.y;return c.jsxs(t.Fragment,{children:[!e.horizontal&&c.jsx("line",{className:"visx-line",x1:"0",y1:w,x2:"0",y2:w,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:y,y:e.horizontal?"16":w,fontFamily:g,fontWeight:v,fontSize:""+h,letterSpacing:.4,stroke:"none",textAnchor:"end2end"===m?e.last?"end":"start":e.horizontal?"middle":"end",style:{fill:null!=(p=null==(f=e.theme)?void 0:f.color)?p:"rgba(0, 0, 0, 0.6)"},"data-horizontal":e.horizontal?"true":"false","data-axisistime":e.xAxisIsTime?"true":"false","data-type":"type-"+m,children:c.jsx("tspan",{x:y,dy:e.horizontal?0:2,children:"end2end"===m||e.xAxisIsTime?e.formattedValue:x})})})]})},Ab=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(Db,Q({},n,{width:null!=e&&e.horizontal?wb(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(Db,Q({},n,{width:null!=e&&e.horizontal?wb(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(Db,Q({},t,{width:null!=e&&e.horizontal?wb(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(kb,Q({},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}))]})},Db=function(e){var t,n,r,i,o,a,l,s,u,d=null!=(t=e.theme)&&t.fontSize?jb(null==(n=e.theme)?void 0:n.fontSize):"9",p=null!=(r=e.theme)&&r.fontWeight?""+Cb(null==(i=e.theme)?void 0:i.fontWeight):"700",f=null!=(o=null==(a=e.theme)?void 0:a.fontFamily)?o:Ug,m=yb(null!=(l=null==e?void 0:e.maxValueOfYAxis)?l:e.formattedValue,e.width,f,""+d,p,5),h=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:h,y:e.horizontal?"16":null!=e&&e.last?e.top:e.from.y,fontFamily:f,fontWeight:p,fontSize:d,letterSpacing:.4,stroke:"none",textAnchor:e.horizontal&&"end2end"===e.type?e.last?"end":"start":"middle",style:{fill:null!=(s=null==(u=e.theme)?void 0:u.color)?s:"rgba(0, 0, 0, 0.6)"},children:c.jsx("tspan",{x:h,dy:e.horizontal?0:2,children:m})})})},Ib=t.memo((function(e){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=ie(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:Ug,fontSize:9,fill:Ob(r.color,["#fff",Ds(0)]),children:n})]})]})})),Ob=function(e,t){return i.maxBy(t,(function(t){return s.contrast(t,e)}))||e},Pb=function(e,t,n){return(n+"_"+t+"_"+btoa(e.key+"_"+e.value+"_"+e.direction)).replace(/=/g,"")};function Eb(e,t){return null==t?void 0:t.filter((function(t){return t.key===e}))}function Mb(e,t){return Pb(e,t,">="===e.direction?"above":"below")}var Rb=function(e){var n=t.useContext(C.DataContext)||{},r=n.yScale,i=n.width;if(!r||!i)return null;var o=e.height-e.margin.top;return c.jsxs(t.Fragment,{children:[c.jsx("g",{transform:"translate(50, 0)",children:e.threshold.map((function(t,n){var o=r(t.value);return c.jsx("g",{children:c.jsx("line",{x1:0,y1:o,x2:i-e.margin.right-e.margin.left,y2:o,stroke:"#F4F4F4",strokeWidth:"1",fill:"transparent"})},"threshold-"+n)}))}),c.jsx("defs",{children:e.threshold.map((function(n,i){var a=r(n.value);return c.jsxs(t.Fragment,{children:[c.jsx("clipPath",{id:Pb(n,e.idPrefix,"above"),children:c.jsx("rect",{x:"0",y:"0",width:"100%",height:a})}),c.jsx("clipPath",{id:Pb(n,e.idPrefix,"intermediate"),children:c.jsx("rect",{x:"0",y:a,width:"100%",height:0})}),c.jsx("clipPath",{id:Pb(n,e.idPrefix,"below"),children:c.jsx("rect",{x:"0",y:a,width:"100%",height:o-a})})]},"threshold-"+i)}))})]})},Lb=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}}},Nb=function(e){var n,r,o,a,l,s,u,p,f,m,h,v,g,b,x,y,w,j,F,k,_,T,A,D,I,O,P,E,M,R=zg(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),L=e.approxYAxisLabelCount,N=void 0===L?"auto":L,z=e.approxXAxisLabelCount,q=void 0===z?"auto":z,B=e.removeStroke,W=void 0!==B&&B,V=e.horizontal,H=void 0!==V&&V,Y=e.theme,U=e.x,G=(P=e.x,E=e.bars,e.forceXAxisAsTime&&!E||i.isDate(null==(M=Gg({bars:E,lines:e.lines,areas:e.areas},"data")[0])?void 0:M[P])),K=Yg[function(e,t){var n=e||"natural";return"natural"===n&&(n=t?"monotoneY":"monotoneX"),n}(e.lineCurve,H)],X=function(e,t){var n,r,i,o;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,fontFamily:null!=(o=null==t?void 0:t.fontFamily)?o:Ug,textAnchor:e?"end":"middle",scaleToFit:"shrink-only"}},J=function(e,n){var r=t.useRef(null),o=t.useState(0),a=o[0],l=o[1];t.useEffect((function(){var e=i.throttle((function(){l(r.current?r.current.clientWidth:0)}),100);return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}));var s=Math.min(a<1e3?parseInt((""+a)[0]):12,12);return"auto"!=e?[r,e]:[r,s*(n?4:1)]}(q,!(null!=e&&e.horizontal)&&(null==e?void 0:e.forceXAxisAsTime)),Z=J[0],$=J[1],ee=t.useState(void 0),te=ee[0],ne=ee[1],re=t.useState(void 0),ie=re[0],oe=re[1],ae=Gg(e,"colors"),le=C.buildChartTheme(Q({},C.lightTheme,{colors:ae,tickLength:0,gridColor:"",gridColorDark:""})),se=null!=(r=null==Y||null==(o=Y.axis)?void 0:o.stroke)?r:"#eaeaea",ue=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"}}(q,N),de=ue.xAxisType,ce=ue.xAxisAttributes,pe=ue.yAxisType,fe=null!=(a=null!=(l=null==e||null==(s=e.lines)?void 0:s.data.length)?l:null==e||null==(u=e.areas)||null==(u=u.data)?void 0:u.length)?a:null==(p=e.bars)?void 0:p.data.length,me=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=rb(s,u),c=ib(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),he=me.maxValue,ve=me.minValue,ge=null!=(f=null==(m=e.lines)?void 0:m.threshold)?f:null==(h=e.areas)?void 0:h.threshold,be=function(e,t,n,r,i,o){if(e&&t)return Fb(i,(function(e){return n.formatXAxisLabel?n.formatXAxisLabel(e[o]):String(e[o])}),null==r?void 0:r.labels)}(H,null!=(v=e.forceXAxisAsTime)&&v,e,Y,Gg(e,"data"),e.x),xe=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:8,bottom:o?40:25,left:e?("none"!==n?i?i+10:82:25)+(a?24:0):t?50+(a?24:0):25,right:25}}(H,"right"!==e.yAxisOrientation,de,null==e?void 0:e.axisTitles,be);return c.jsxs("div",{ref:Z,style:{position:"relative",height:R},children:[c.jsxs(C.XYChart,{theme:le,margin:xe,height:R,xScale:Kg("x",H,G,null==e||null==(g=e.lines)?void 0:g.scatter,!(null==e||!e.lines)||!(null==e||!e.areas)),yScale:ob(null==e?void 0:e.goalLine,he,ve,H,G),horizontal:H,onPointerUp:function(){return null==e?void 0:e.onClick(te,ie)},children:[c.jsx(C.Grid,{columns:H,rows:!H,stroke:"black",strokeDasharray:"0.5 5",strokeWidth:W?0:2,lineStyle:{strokeLinecap:"round",stroke:null!=(b=null==Y||null==(x=Y.grid)?void 0:x.stroke)?b:"rgba(200, 200, 200, 0.2)"}}),!(null!=e&&e.sparkline)&&c.jsxs(c.Fragment,{children:["none"!==de&&c.jsx(C.Axis,Q({},ce,{tickLabelProps:function(){var e=Q({},X(H,null==Y?void 0:Y.labels));return H||(e.y=15),e},numTicks:"end2end"===de?fe:$,strokeWidth:W?0:1,tickStroke:"#eaeaea",stroke:H?"transparent":se,orientation:H?"left":"bottom",tickFormat:Zg(e.formatXAxisLabel,e.forceXAxisAsTime||G),label:H?null==e||null==(y=e.axisTitles)?void 0:y.y:null==e||null==(w=e.axisTitles)?void 0:w.x,children:function(t){return c.jsx(_b,Q({},t,{theme:Y,type:de,uniqueId:null==e?void 0:e.uniqueId,chartWidth:null==e?void 0:e.width,xAxisIsTime:!!e.forceXAxisAsTime,leftPanelWidth:be,axisHorizontal:null==e?void 0:e.horizontal}))}})),c.jsx(C.Axis,{labelOffset:50,tickLabelProps:function(){var t=Q({},X(H,null==Y?void 0:Y.labels));return H||"right"===e.yAxisOrientation||(t.width=50,t.textAnchor="middle"),t},hideAxisLine:!0,numTicks:"auto"===N?5:N,strokeWidth:W?0:1,hideTicks:!0,tickLength:e.horizontal||"right"===e.yAxisOrientation?10:25,stroke:se,orientation:H?"bottom":e.yAxisOrientation||"left",tickFormat:$g(e),label:H?null==e||null==(j=e.axisTitles)?void 0:j.x:null==e||null==(F=e.axisTitles)?void 0:F.y,children:function(t){return c.jsx(Ab,Q({},t,{theme:Y,type:pe,horizontal:H,maxValueOfYAxis:null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(he):he,uniqueId:null==e?void 0:e.uniqueId}))}})]}),ge&&ge.length>0&&c.jsx(Rb,{threshold:ge,height:R,margin:xe,idPrefix:e.idPrefix}),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 "+Ng+"\n "}),(null==e?void 0:e.areas)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(n,r){var i,o,a,l,s,u=(null==(i=e.areas)?void 0:i.formatter)&&(null==(o=e.areas)?void 0:o.formatter(n))||(null==(a=e.areas)?void 0:a.colors[r]);return c.jsxs(t.Fragment,{children:[c.jsx(S.LinearGradient,{id:"g"+e.uniqueId+r,from:u,to:u,fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+r),null==(l=Eb(n,null==(s=e.areas)?void 0:s.threshold))?void 0:l.map((function(t,n){return c.jsx(S.LinearGradient,{id:"g"+e.uniqueId+r+"_"+n,from:t.color,to:t.color,clipPath:"url(#"+Mb(t,e.idPrefix)+")",fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+r+"_"+n)}))]})}))}),(null==e?void 0:e.areas)&&!(null!=e&&null!=(k=e.areas)&&k.stacked)&&[].concat(e.areas.keys).map((function(n,r){var i,o,a,l=Q({curve:K,dataKey:n,data:null==(i=e.areas)?void 0:i.data},Lb(G,U,n,H),{renderLine:!1});return c.jsxs(t.Fragment,{children:[d.createElement(C.AreaSeries,Q({},l,{key:"grouped_area_"+e.uniqueId+"_"+r,fill:"url(#g"+e.uniqueId+r+")"})),null==(o=Eb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return c.jsx(C.AreaSeries,Q({},l,{clipPath:"url(#"+Mb(t,e.idPrefix)+")",fill:"url(#g"+e.uniqueId+r+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+r+"_threshold_"+n)}))]})})),(null==e?void 0:e.areas)&&e.areas.stacked&&c.jsx(C.AreaStack,{curve:K,renderLine:!0,children:[].concat(e.areas.keys).map((function(n,r){var i,o,a,l=Q({dataKey:n,data:null==(i=e.areas)?void 0:i.data},Lb(G,U,n,H));return c.jsxs(t.Fragment,{children:[c.jsx(C.AreaSeries,Q({fill:"url(#g"+e.uniqueId+r+")",lineProps:{strokeWidth:4,strokeLinecap:"round"}},l),"areas_stacked_"+e.uniqueId+"_"+r),null==(o=Eb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return c.jsx(C.AreaSeries,Q({},l,{clipPath:"url(#"+Mb(t,e.idPrefix)+")",fill:"url(#g"+e.uniqueId+r+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+r+"_threshold_"+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,o,a;return c.jsx(C.BarSeries,Q({radiusAll:!0,radius:null!=(r=null==(i=e.bars)||null==(i=i.styles)?void 0:i.cornerRadius)?r:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(a=e.bars)?void 0:a.formatter)&&Xg(t,null==e?void 0:e.bars.formatter,ae,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,o,a;return c.jsx(C.BarSeries,Q({radiusAll:!0,radius:null!=(r=null==(i=e.bars)||null==(i=i.styles)?void 0:i.cornerRadius)?r:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(a=e.bars)?void 0:a.formatter)&&Xg(t,null==e?void 0:e.bars.formatter,ae,n)}),"stacked_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.lines)&&!(null!=e&&null!=(_=e.lines)&&_.scatter)&&e.lines.keys.map((function(t,n){var r,i,o,a,l=Q({strokeWidth:3,curve:K,dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H));return c.jsxs(c.Fragment,{children:[d.createElement(C.LineSeries,Q({},l,{key:"line_on_line_chart_"+e.uniqueId+"_"+n,colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Qg(null==e?void 0:e.lines.formatter,ae,n)})),null==(o=Eb(t,null==(a=e.lines)?void 0:a.threshold))?void 0:o.map((function(t,r){return d.createElement(C.LineSeries,Q({},l,{key:"line_on_line_chart_"+e.uniqueId+"_"+n+"_threshold_"+r,clipPath:"url(#"+Mb(t,e.idPrefix)+")",stroke:t.color}))}))]})})),e.lines&&(null==e||null==(T=e.lines)?void 0:T.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,Q({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Xg(t,null==e?void 0:e.lines.formatter,ae,n)}),"scatter_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(A=e.lines)?void 0:A.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,Q({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lb(G,U,t,H),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Xg(t,null==e?void 0:e.lines.formatter,ae,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(Rg,{show:(null==te?void 0:te.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;oe(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==te?void 0:te.key);te&&!t||ne(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":Zg(e,t)(n)}(e.formatXAxisLabel,G,null==l?void 0:l.datum[U]);return c.jsx(vb,{heading:p,total:d,chartProps:e,datumKey:a,tooltipNearestDatum:l,typeIndex:nb(e),getColor:function(e){return null==o?void 0:o(e)},formatSeriesName:e.formatSeriesName,formatValue:$g(e)})}}),e.goalLine&&(null==(D=e.goalLine)?void 0:D.length)>0&&!H&&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(Ib,{axisProps:t,goalLine:n,value:n.value,toX:(null!=(i=null==e?void 0:e.width)?i:0)-xe.left-xe.right,marginRight:xe.right,maxValueOfYAxis:he,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel},(null==e?void 0:e.uniqueId)+"-"+r)}))}})]}),(null==e?void 0:e.legend)&&c.jsx(tb,{keys:Gg(e,"keys"),colors:ae,typeIndex:nb(e),formatSeriesName:null==e?void 0:e.formatSeriesName,formatter:null==e||null==(I=e.bars)?void 0:I.formatter,data:null==(O=e.bars)?void 0:O.data,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities})]})},zb=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,threshold:e.threshold},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,idPrefix:null==e?void 0:e.idPrefix})}})})),qb=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 Ee(e)})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return Ee(e)}))}};function Bb(e){var n=e.title,r=e.subject,i=e.headline,o=t.useRef(null),a=t.useState(n),l=a[0],s=a[1],u=t.useState(null==i?void 0:i.func),d=u[0],c=u[1],p=t.useState(r),f=p[0],m=p[1];return t.useEffect((function(){var e;0===l.length&&n.length>=1&&o.current&&o.current.resetSize(),0===f.length&&r.length>=1&&o.current&&o.current.resetSize(),0===(null==d?void 0:d.length)&&null!=i&&i.func&&(null==i||null==(e=i.func)?void 0:e.length)>=1&&o.current&&o.current.resetSize(),s(n),m(r),c(null==i?void 0:i.func)}),[n,r,i]),o}var Wb=function(e,t){return!(!1!==e&&void 0!==e||!t)||!0===e},Vb=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=vn(t).flatMap((function(t){var n=Yr(e,t);return Gt(n)?[n]:[]}));return JSON.stringify(n)}return""}(o,e);return t.useEffect((function(){var t=new AbortController;return function(){var o=X(G().mark((function o(){var a;return G().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return u(!0),o.next=3,Nm(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 un)return{queriesAreChanging:!1};throw e}};function Hb(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 Yb(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 Ub=As({padding:"2px 6px",borderRadius:6,variants:{positive:{yes:{color:"rgb(4, 120, 87)",background:"#D1FAE5"},no:{color:"rgb(190, 18, 60)",background:"#FFE4E6"}}}}),Gb=As({fontSize:"12px",display:"flex",alignItems:"center",rowGap:"0.5rem",position:"relative",cursor:"pointer"}),Kb=Object.assign((function(){return null}),{deltaPill:Ub,deltaText:As({padding:0,borderRadius:6,variants:{positive:{yes:{color:"rgb(23, 171, 92)",background:"transparent"},no:{color:"rgb(190, 18, 60)",background:"transparent"}}}}),arrow:As({height:"1rem",width:"1rem",variants:{percentageIncrease:{yes:{transform:"rotate(315deg)"},no:{transform:"rotate(45deg)"}},delteStyle:{pill:{},text:{position:"absolute",right:"-1rem"}}}}),delta:Gb});function Xb(e,t){var n;return null==e||null==(n=e.content)||null==(n=n[e.content.length-1])?void 0:n[t]}var Qb=function(e){var n,r,i,o=md().textOverride,a=Xd(),l=t.useState(!0),s=l[0],u=l[1],d="supporting"===e.viewFor||"text"===(null==a||null==(i=a.charts)||null==(i=i.singleStat)?void 0:i.delteStyle)?"text":"pill",p=e.result;if(!p||0===p.content.length||1===p.content.length)return null;var f,m,h,v=p.content[p.content.length-2][e.index],g=Xb(p,e.index),b=(f=v,0!==(m=g)?0!==f?(m-f)/f*100:100*m:100*-f),x=(h={positive:b>=0?"yes":"no"},"text"===d?Kb.deltaText(h):Kb.deltaPill(h)),y=-1*(v-g);return c.jsxs(t.Fragment,{children:[c.jsx(_f,{as:"hr",margin:0,border:0,borderTop:"1px solid "+Ds(85)}),c.jsxs(Ud,{gap:"0.15rem",children:["standalone"===e.viewFor&&c.jsxs(_f,{as:"p",className:Hd(""+tu.textSize("xs"),tu.opacity(.7)+" "+tu.align("left")),margin:0,children:[o("single_stat.current","Current")," ",null==e||null==(n=e.deltaTimeDimension)?void 0:n.truncate]}),c.jsxs(zf,{gap:"0.5rem",alignItems:"end",children:["standalone"===e.viewFor&&c.jsx(_f,{as:"p",margin:0,nowrap:!0,children:c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:g,measure:null==e?void 0:e.measure})}),c.jsx(zf,{alignSelf:"supporting"===e.viewFor?"flex-end":"text"===(null==a||null==(r=a.charts)||null==(r=r.singleStat)?void 0:r.delteStyle)?"center":"flex-end",gap:"0.5rem",children:c.jsx(ih,{tooltipContent:function(){var t;return c.jsxs(ih.Content,{children:[o("single_stat.previous","Previous")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate,":"," ",c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:v,measure:null==e?void 0:e.measure})]})},children:c.jsxs("button",{onClick:function(){return u(!s)},className:Hd(x,""+tu.bw(0),""+Kb.delta),"aria-label":s?o("single_stat.show_as_value","Show as value"):o("single_stat.show_as_percentage","Show as percentage"),children:[s?Jl(b,2)+"%":c.jsx(ox,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:y,measure:null==e?void 0:e.measure}),c.jsx("svg",{className:""+Kb.arrow({percentageIncrease:b>=0?"yes":"no",delteStyle:d}),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"})})]})})})]})]})]})},Jb=function(e){var t=md().textOverride,n=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===n?c.jsx("p",{className:Hd(""+tu.textSize("xs"),""+tu.opacity(.5)),children:t("single_stat.no_data_for_delta_description","No data available for [[deltaTimeDimension]] comparison",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})}):null===(null==e?void 0:e.deltaTimeDimension)||!1===n?null:c.jsx(_f,{margin:0,className:Hd(""+tu.textSize("xs"),""+tu.opacity(.5)),children:t("single_stat.delta_description","Comparing [[deltaTimeDimension]] over [[deltaTimeDimension]]",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})})};function Zb(e,t,n,r,i,o){var a=e[_t(r)]||"_vizzly_to_2_dp",l=t[_t(r)]||"",s=n[_t(r)]||"";return{formattedValue:o[a].formatter(i),prefix:l,postfix:s}}var $b=function(e,t,n){var r="";return t&&(r=""+t),r=""+r+e,n&&(r=""+r+n),r},ex=function(e){var n=t.useRef(null),r=t.useState(0),i=r[0],o=r[1];return t.useEffect((function(){var e,t,r=function(){n.current&&o(n.current.offsetWidth)},i=(e=r,function(){clearTimeout(t),t=setTimeout((function(){e()}),50)});requestAnimationFrame((function(){return r()}));var a=new ResizeObserver(i);return n.current&&a.observe(n.current),window.addEventListener("resize",i),function(){window.removeEventListener("resize",i),a&&a.disconnect()}}),[e]),[n,i]},tx={standalone:{smallFonts:"sm",direction:"column",gap:"1rem",statGap:80},supporting:{smallFonts:"xs",direction:"row",gap:"0.25rem",statGap:40}},nx={name:"12ayaws",styles:"position:relative;display:flex;white-space:nowrap;padding-top:0.25rem;text-align:left;font-size:3rem;line-height:1;font-weight:600;letter-spacing:0.025em"},rx={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"},ix=function(e){var n,r,o,a=md(),l=a.textOverride,s=a.labelFormat,u=e.results[0],d=e.results[1],p=t.useState(null),f=p[0],m=p[1];if(t.useEffect((function(){if(u&&e.measure){var t=ss(u,_t(e.measure));-1!==t&&m(t)}}),[u,e.measure]),null===f)return null;var h=e.displayCurrent?Xb(d,f):null==u||null==(n=u.content)||null==(n=n[0])?void 0:n[f],v=function(e,t){var n={};return t.forEach((function(t){var r,i;if("fontColor"==t.ruleType&&hs({op:null==(r=t.filters)?void 0:r[0][0].op,value:null==(i=t.filters)?void 0:i[0][0].value},e))return n.color=t.ruleValue})),n}(h,i.filter(e.conditionalFormattingRules,(function(t){var n,r,i;return Ee({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(r=null==(i=t.filters)?void 0:i[0][0].function)?r:"none"})==_t(e.measure)}))),g=gs(null==u||null==(r=u.fields[f])?void 0:r.publicName,null==(o=e.supportedAggregates[e.measure.function])?void 0:o.publicName),b=s({fieldId:e.measure.field,func:e.measure.function,type:"singleStat",defaultLabel:g,viewId:e.viewId});return c.jsxs("div",{children:[c.jsx("div",{className:""+tu.align("left"),children:(e.showAggregateText||"supporting"===e.viewFor)&&c.jsx("span",{className:tu.textSize(tx[e.viewFor].smallFonts)+" "+tu.nowrap,children:null!=b?b:g})}),c.jsxs(zf,{gap:"0.35rem",direction:tx[e.viewFor].direction,children:[c.jsx(_f,{children:e.displayCurrent&&"supporting"===e.viewFor?c.jsx(ih,{tooltipContent:function(){var t;return c.jsxs(ih.Content,{children:[l("single_stat.current","Current")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate]})},children:c.jsx("p",{style:Q({},v,{fontSize:e.fontSize}),css:nx,className:""+tu.text,children:c.jsx(ox,{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("p",{style:Q({},v,{fontSize:e.fontSize}),css:rx,className:tu.text+" "+tu.align("left"),children:c.jsx(ox,{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:h})})}),c.jsx(Qb,{index:f,result:d,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,viewFor:e.viewFor})]})]})},ox=function(e){var n=md(),r=n.textOverride,i=Zb(e.formatter,e.prefixes,e.postfixes,e.measure,e.value,n.numberFormatOptions),o=i.formattedValue,a=i.prefix,l=i.postfix;return o===r("single_stat.no_value","No value")?c.jsx(t.Fragment,{children:o}):c.jsx(t.Fragment,{children:$b(o,a,l)})},ax={type:"singleStat",prefixes:{},postfixes:{},fontSize:"30px",measure:[],displayTitle:"",displaySubject:"",formatter:{},filter:[],limit:500,conditionalFormattingRules:[],deltaTimeDimension:null},lx={name:"1kzq5ms",styles:"height:100%;width:100%"},sx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g={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,viewId:null!=(a=null==(l=e)?void 0:l.viewId)?a:""},b=ex(e.queriesAreChanging),x=b[0],y=b[1],w=ex(e.queriesAreChanging),j=w[0],C=w[1];if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb({measure:e.measure,order:[],dimension:[]})});var S=void 0!==e.results?e.results[0]:void 0;if(ds(S))return c.jsx(nm,{});if(cs(S))return c.jsx(iv,{});if(ps(S))return c.jsx(av,Q({},g));var F=(e=bs(e,{},ax)).measure.length,k=tx[e.viewFor].statGap,_=e.leftAlign?"flex-start":(F-1)*k+C*F<y-32?"center":void 0;return c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[!e.hideHeader&&c.jsx(Pg,Q({},g,{paddingBottom:0})),F>1?c.jsxs(t.Fragment,{children:[c.jsx("div",{css:lx,ref:x,children:c.jsx(zf,{direction:"row",height:"100%",gap:k,"data-component":"stat-container",alignItems:"center",justifyContent:_,paddingTop:"0.5rem",children:[].concat(e.measure).map((function(t,n){var r,i;return c.jsx("div",{ref:j,children:c.jsx(ix,{index:n,showAggregateText:F>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,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(i=e.viewId)?i:""})},n)}))})}),(null==(s=e)?void 0:s.deltaTimeDimension)&&c.jsx(_f,{marginTop:tx[e.viewFor].gap,children:c.jsx(Jb,{deltaTimeDimension:null==(u=e)?void 0:u.deltaTimeDimension,results:null==(d=e)?void 0:d.results})})]}):c.jsxs(Ud,{placeContent:e.leftAlign?"left":"center","data-component":"stat-container",height:"100%",children:[c.jsx(ix,{index:1,showAggregateText:F>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==(p=e)?void 0:p.deltaTimeDimension,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(f=e.viewId)?f:""},1),(null==(m=e)?void 0:m.deltaTimeDimension)&&c.jsx(_f,{marginTop:tx[e.viewFor].gap,children:c.jsx(Jb,{deltaTimeDimension:null==(h=e)?void 0:h.deltaTimeDimension,results:null==(v=e)?void 0:v.results})})]})]})};function ux(e,t){return e.reduce((function(e,n){return t&&"string"==typeof t&&(e[Ee(n)]=t),e}),{})}function dx(e,t){return(null===t||"object"!=typeof t||0!==Object.keys(t).length)&&e.length>0&&"asc"===e[0].direction&&!!t}function cx(e,t,n){return!(null==t||!t.func)&&dx(e,n)}sx.defaultProps=ax;var px=function(e){var n,r,i,o,a=md().queryEngineConfig,l=t.useState([]),s=l[0],u=l[1],d=0!==Object.keys(e.component.attributes.timeDimension||{}).length&&"current"===(null==(n=e.component.attributes.headline)?void 0:n.func),p=d&&e.component.attributes.timeDimension?Q({},e.component.attributes.timeDimension,{bucketFill:!1}):null,f=function(e,t,n,r){return e.map((function(e){var i;return Q({},e,{function:(null==(i=Pe(Yr(n,e.field),t))?void 0:i.includes(r))?r:e.function})}))}(e.component.attributes.measure,a.supportedAggregates,e.dataSet,null==(r=e.component.attributes.headline)?void 0:r.func),m=hr({queryEngineConfig:a}).init(e.dataSet.id,{prefixes:ux(f,e.component.attributes.yAxisPrefix),postfixes:ux(f,e.component.attributes.yAxisPostfix),formatter:ux(f,e.component.attributes.yAxisFormat),fontSize:"1.1rem",viewId:e.component.attributes.viewId+"-stats",deltaTimeDimension:p,measure:f}),h=Vb(m,e.runQueriesCallback,u,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(_f,{minHeight:d?80:56,children:c.jsx(sx,Q({},m,{id:null!=(i=m.viewId)?i:"",dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:function(){},setParameterUpdate:function(){},results:s,queriesAreChanging:h.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(o=e.dashboardBehaviour)||null==(o=o.queryEngineConfig)?void 0:o.supportedTransformationFunctions,library:null==e?void 0:e.library,leftAlign:!0,viewFor:"supporting",displayCurrent:d}))})},fx=function(e){var t=[];return e?(e.forEach((function(e){var n;t.push({key:ts([],[],e.filters[0][0].field,null!=(n=e.filters[0][0].function)?n:"none"),value:e.filters[0][0].value,direction:e.filters[0][0].op,color:e.ruleValue})})),t):t},mx=function(e){var n,r,i,o,a=Bb({title:null==e?void 0:e.displayTitle,subject:null==e?void 0:e.displaySubject,headline:null==e?void 0:e.headline}),l=md(),s=l.textOverride,u=l.labelFormat,d=Xd(),p={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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},p));var f=qb(e),m=ls(f,e.measure,e.result),h=as(e.result,e.measure,f,"100%"==e.stacked),v=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},p,{paddingBottom:v?"0.5rem":void 0})),v&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(zb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:a,uniqueId:e.id,x:"x",keys:m,colors:di(null==d?void 0:d.colors,m.length),data:h,legend:Wb(null==e?void 0:e.legend,"verbose"===(null==d?void 0:d.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,showTotalOnTooltip:!!e.stacked,stacked:!!e.stacked,formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatYAxisLabel:Ss(s,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),annotate:"verbose"==(null==d?void 0:d.detail)?["high_and_low"]:[],lineCurve:e.lineCurve,theme:null==d?void 0:d.charts,formatSeriesName:Fs(e.result,s,e.type,null!=(o=e.viewId)?o:"",u),formatter:function(t){var n=js(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},onPointerUp:null==e?void 0:e.onPointerUp,sparkline:e.sm,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,threshold:fx(e.conditionalFormattingRules)})})]})})};mx.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,headline:{}};var hx=t.memo(mx,xs),vx=function(){return null},gx=function(e){var t;return(null==e||null==(t=e.component)||null==(t=t.attributes)||null==(t=t.drilldown)?void 0:t.length)>0},bx=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=a.localFilters,d=Vb(s,e.runQueriesCallback,e.setResults,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(hx,Q({id:e.id},s,{dataSet:e.dataSet,localFilters:u,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:l[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,onPointerUp:function(t){return gx(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},xx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,styles:e.styles},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,idPrefix:e.idPrefix})}})}));function yx(e,t,n){var r=wx(e,t);return null!=n&&n.grouping?jx(r,null==n?void 0:n.grouping):r}var wx=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}}))},jx=function(e,t){return t.forEach((function(t){var n=e.findIndex((function(e){return e.fieldId===t.fieldId}));n>-1?e[n]=Q({},e[n],t):e.push(t)})),e};function Cx(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(ns(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=Me(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 Sx=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))},Fx={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"},kx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b,x,y,w,j=e.displayTitle,C=e.displaySubject,S=md(),F=S.textOverride,k=S.labelFormat,_=Bb({title:j,subject:C,headline:e.headline}),T=Xd(),A={displayTitle:j,displaySubject:C,localFilters:(e=bs(e,{},Fx)).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,viewId:null!=(u=null==(d=e)?void 0:d.viewId)?u:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},A));var D=qb(e),I=ls(D,e.measure,e.result),O=as(e.result,e.measure,D,"100%"==e.stacked),P=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},A,{paddingBottom:P?"0.5rem":void 0})),P&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(p=null==(f=e)?void 0:f.library)&&p,children:c.jsx(xx,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:_,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:Ss(F,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(m=e)?void 0:m.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(h=e)?void 0:h.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatter:function(t,n){var r,i=js(e.dimension,e.conditionalFormattingRules,t,n,null==(r=e)?void 0:r.dataSet);if(i)return i.value},styles:null==T||null==(v=T.charts)?void 0:v.barChart,keys:I,colors:di(null==T?void 0:T.colors,I.length),data:O,legend:Wb(null==(g=e)?void 0:g.legend,"verbose"===(null==T?void 0:T.detail)),horizontal:"horizontalBarChart"==e.type,removeStroke:!1,type:e.stacked?"stacked":"grouped",showTotalOnTooltip:!!e.stacked,forceXAxisAsTime:!!e.timeDimension,theme:null==T?void 0:T.charts,axisTitles:null==(b=e)?void 0:b.axisTitles,formatSeriesName:Fs(e.result,F,e.type,null!=(x=e.viewId)?x:"",k),onPointerUp:null==(y=e)?void 0:y.onPointerUp,conditionalFormattingPossibilities:function(t){return ws(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)&&Sx(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 rs(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==(w=e)?void 0:w.goalLines,idPrefix:e.idPrefix})})]})})};kx.defaultProps=Fx;var _x=t.memo(kx,xs),Tx=function(e,n,r,i,o,a,l){var s=e;return n.preAggregated&&(s=[ei(n)]),function(e,n,r,i){t.useEffect((function(){var t=Br(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:Vb(s,a,l,i,n,e.type).queriesAreChanging}},Ax=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=Tx(s,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(_x,Q({id:e.id},s,{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:l[0],queriesAreChanging:u.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,onPointerUp:function(t){return gx(e)&&o(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,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},Dx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,threshold:e.threshold},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,idPrefix:null==e?void 0:e.idPrefix})}})})),Ix=function(e){var n,r,i,o,a=md(),l=a.textOverride,s=a.labelFormat,u=e.displayTitle,d=e.displaySubject,p=Bb({title:u,subject:d,headline:null==e?void 0:e.headline}),f={displayTitle:u,displaySubject:d,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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},m=Xd();if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},f));var h=qb(e),v=ls(h,e.measure,e.result),g=as(e.result,e.measure,h,"100%"==e.stacked),b=cx(e.order,e.headline,e.timeDimension);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},f,{paddingBottom:b?"0.5rem":void 0})),b&&c.jsx(px,Q({},e.propsForHeadline)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(Dx,{ref:p,uniqueId:e.id,x:"x",approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,formatYAxisLabel:Ss(l,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),keys:v,colors:di(null==m?void 0:m.colors,v.length),data:g,sparkline:e.sm,legend:Wb(null==e?void 0:e.legend,"verbose"===(null==m?void 0:m.detail)),horizontal:!1,annotate:"verbose"==(null==m?void 0:m.detail)?["high_and_low"]:[],forceXAxisAsTime:!!e.timeDimension,lineCurve:e.lineCurve,theme:null==m?void 0:m.charts,formatSeriesName:Fs(e.result,l,e.type,null!=(o=e.viewId)?o:"",s),formatter:function(t){var n=js(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},onPointerUp:null==e?void 0:e.onPointerUp,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,threshold:fx(e.conditionalFormattingRules),idPrefix:e.idPrefix})})]})})};Ix.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,headline:void 0};var Ox=t.memo(Ix,xs),Px=function(e){var n,r=t.useState(null),i=r[0],o=r[1],a=e.component,l=a.results,s=a.attributes,u=Tx(s,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsxs(t.Fragment,{children:[c.jsx(Ox,Q({id:e.id},s,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,result:l[0],queriesAreChanging:u.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,onPointerUp:function(t){return gx(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix})),i&&c.jsx(vx,{onDrilldown:i,onClose:function(){return o(null)},inputProps:e})]})},Ex=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,{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,idPrefix:null==e?void 0:e.idPrefix})}})})),Mx={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"},Rx=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h=e.displayTitle,v=e.displaySubject,g=md(),b=g.textOverride,x=g.labelFormat,y=Bb({title:h,subject:v}),w={displayTitle:h,displaySubject:v,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,viewId:null!=(i=null==(o=e)?void 0:o.viewId)?i:""},j=Xd();if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Yb(e)});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},w));var C=(e=bs(e,{},Mx)).result&&e.xMeasure?function(e,t,n){var r={};return os(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=ts(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 S=[];e.xMeasure&&S.push(e.xMeasure),e.yMeasure&&S.push(e.yMeasure);var F=qb(e),k=e.result?as(e.result,S,F):[],_=ts([],[],e.xMeasure.field,e.xMeasure.function);return k.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=ts([],[],r.field,r.function),a=ts(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(nm,{}),children:c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},w)),c.jsx(lu,{disabledFeatures:null!=(a=null==(l=e)?void 0:l.library)&&a,children:c.jsx(Ex,{ref:y,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,x:_,keys:C,colors:di(null==j?void 0:j.colors,C.length),data:k,legend:Wb(null==(s=e)?void 0:s.legend,"verbose"===(null==j?void 0:j.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!1,sparkline:!1,formatYAxisLabel:Ss(b,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(u=e)?void 0:u.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(null,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(d=e)?void 0:d.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),theme:null==j?void 0:j.charts,formatSeriesName:Fs(e.result,b,e.type,null!=(p=e.viewId)?p:"",x),goalLine:null==(f=e)?void 0:f.goalLines,axisTitles:null==(m=e)?void 0:m.axisTitles,idPrefix:e.idPrefix})})]})})};Rx.defaultProps=Mx;var Lx=t.memo(Rx,xs),Nx=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=n.localFilters,a=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:o,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(Lx,Q({id:e.id},i,{dataSet:e.dataSet,localFilters:o,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:r[0],queriesAreChanging:a.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==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,idPrefix:e.idPrefix}))},zx=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}),{})}))},qx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){var n,r;return c.jsx(Nb,Q({},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}))}})})),Bx=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}},Wx=function(e){return{startAngle:e.startAngle,endAngle:e.endAngle,opacity:1}};function Vx(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 P.useTransition(e.arcs,{from:t?Bx:Wx,enter:Wx,update:Wx,leave:t?Bx:Wx,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(P.animated.path,{d:P.interpolate([e.startAngle,e.endAngle],(function(e,r){return n(Q({},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(P.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 Hx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(j.ParentSize,{children:function(t){return c.jsx(Yx,Q({width:null==t?void 0:t.width,height:null==t?void 0:t.height},e))}})})),Yx=function(e){var n,r,i,o,a,l=e.width,s=e.labelKey,u=e.valueKey,d=e.formatValue,p=e.formatLabel,f=zg(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),m=E.useTooltip({tooltipOpen:!1,tooltipLeft:l/2,tooltipTop:f,tooltipData:"Move me with your mouse or finger"}),h=m.showTooltip,v=m.hideTooltip,g=m.tooltipOpen,b=m.tooltipData,x=m.tooltipLeft,y=void 0===x?0:x,w=m.tooltipTop,j=void 0===w?0:w,C=E.useTooltipInPortal({scroll:!0,detectBounds:!0}),S=C.containerRef,F=C.containerBounds,_=C.TooltipInPortal,T=Ux(null==e?void 0:e.data,s,p),A=k.scaleOrdinal({domain:T,range:null==e?void 0:e.colors}),D=l-25-25,P=f-8-25,M=Math.min(D,P)/2,R=P/2,L=D/2,N=f/5.5,z=t.useCallback((function(e){var t,n,r=(null==e||null==(t=e.coords)?void 0:t.x)-F.left+l/2,i=(null==e||null==(n=e.coords)?void 0:n.y)-F.top+f/2;h({tooltipLeft:r,tooltipTop:i,tooltipData:JSON.stringify(e.arc.data)})}),[h,f,l]);if(l<10)return null;var q=function(){if(b){var e=JSON.parse(b);return{label:p?p(e[s]):e[s],value:d(e[u])}}return{label:"",value:""}};return c.jsxs("div",{ref:S,style:{position:"relative",height:f,width:l},children:[c.jsx("style",{children:""+Ng}),c.jsx("svg",{width:l,height:f,children:c.jsxs(I.Group,{top:R+8,left:L+25,children:[c.jsx(O,{data:null==e?void 0:e.data,pieValue:function(e){return e[u]},outerRadius:M,innerRadius:null!=(r=e.styles)&&r.hole?M-N:void 0,cornerRadius:null!=(i=null==(o=e.styles)?void 0:o.cornerRadius)?i:5,padAngle:null!=(a=e.styles)&&a.gap?.005:void 0,pieSort:null,pieSortValues:null,children:function(t){return c.jsx(Vx,Q({},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,u)||A(t.data[s])},onMouseOver:z,onMouseOut:function(){return v()},showLabel:null==e?void 0:e.showLabel,valueKey:u,formatValue:function(e){return d(e)}}))}}),g&&c.jsx(_,{top:j,left:y,children:c.jsx(gb,{sections:1,children:c.jsx(bb,{label:q().label,value:q().value.toString()})})},Math.random())]})}),(null==e?void 0:e.legend)&&c.jsx(tb,{colors:null==e?void 0:e.colors,keys:T,typeIndex:Gx(null==e?void 0:e.data),alignCenter:!0,replaceDimensionColorsIfPossible:!0,conditionalFormattingPossibilities:function(t){return e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(u):[]}})]})},Ux=function(e,t,n){return e.map((function(e){return n?n(e[t]):e[t]}))},Gx=function(e){return e.map((function(e,t){return{index:t,type:"pie"}}))},Kx={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"},Xx={worldCountries:{id:"worldCountries",fetchTopoJSON:function(){var e=X(G().mark((function e(){var t;return G().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=this,r=(null==e||null==(t=e.objects)||null==(t=t.countries1)?void 0:t.geometries)||[];return i.reduce(r,(function(e,t){return e[n.geographicAreaId(t)]={publicName:n.geographicAreaPublicName(t)},e}),{})},resolveUserDataToVizzlyAreaCode:function(e){var t={};return Object.keys(e).forEach((function(n){t[Kx[n]||n]=e[n]})),t}}},Qx=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=Xx[e];return t.useEffect((function(){!function(){var e=X(G().mark((function e(){var t;return G().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,j=function(e,t){var n=E.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=E.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),C=j.showTooltip,S=j.containerRef,F=j.tooltipData,_=j.containerBounds,T=j.tooltipOpen,A=j.TooltipInPortal,D=j.tooltipTop,I=j.tooltipLeft,O=j.hideTooltip;if(!w)return null;var P=y.resolveUserDataToVizzlyAreaCode(l),L=R.feature(w,w.objects.countries1),z=Object.values(l),q=k.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:""+Ng}),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(){O(),e.isDragging&&e.dragEnd()},children:[c.jsx("rect",{x:0,y:0,width:o,height:a,fill:s,rx:14}),c.jsx(M.Mercator,{data:L.features,scale:e.transformMatrix.scaleX,translate:[e.transformMatrix.translateX,e.transformMatrix.translateY],children:function(e){return c.jsxs("g",{children:[c.jsx(M.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),P[n]?q(P[n]):p),stroke:s,strokeWidth:.5,onMouseEnter:function(e){r.id!=(null==F?void 0:F.areaId)&&C({tooltipLeft:e.clientX-_.left,tooltipTop:e.clientY-_.top,tooltipData:{areaId:r.id,publicName:y.geographicAreaPublicName(r),value:P[r.id]}})}},"map-feature-"+t)}))]})}}),T&&c.jsx(A,{top:D,left:I,children:c.jsx(gb,{sections:1,children:c.jsx(bb,{label:null==F?void 0:F.publicName,value:null!=F&&F.value?""+f(F.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:"-"})]})]})}})]})},Jx=t.forwardRef((function(e,t){return Eg(t)?null:c.jsx(L,{children:function(t){return c.jsx(Qx,Q({},e,{width:t.width,height:t.height}))}})})),Zx=function(e){var n,r,o,a,l=e.displayTitle,s=e.displaySubject,u=Xd(),d=Bb({title:l,subject:s}),p={displayTitle:l,displaySubject:s,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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},f={dataSetId:e.dataSetId,measure:e.measure,dimension:e.dimension,timeDimension:null,order:e.order,filter:e.filter},m=e.measure.length>0&&e.dimension.length>0;if(ds(e.result))return c.jsx(nm,{});if(!m)return c.jsx(rv,{title:"Missing parameters",children:Hb(f)});if(cs(e.result))return c.jsx(iv,{});if(ps(e.result))return c.jsx(av,Q({},p));var h=qb({dimension:e.dimension}),v=function(e,t,n,r){void 0===r&&(r=!1);var o=zx(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 Ie(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=_t(t),r=ts(l,s,t.field,t.function);a[r]=e[n]}));var u={};return r.forEach((function(t){u[t]=e[t]})),Q({},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=Q({},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)?Ql(n[o],r):e}))}))}(u):u}(e.result,h,f),g=function(e,t,n){var r=zx(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=_t(e),o=ts(n.y,r,e.field,e.function);i[o]={key:o,yValues:[].concat(r,[t]),name:[].concat(r,[t]).join(", ")}}))})),Object.values(i)}(f,e.result,h).map((function(t){return{data:v.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(nm,{}),children:c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},p)),c.jsx(lu,{disabledFeatures:null!=(o=null==e?void 0:e.library)&&o,children:c.jsx(Hx,{ref:d,data:g[0].data,labelKey:g[0].labelKey,valueKey:g[0].valueKey,colors:di(null==u?void 0:u.colors,v.length),styles:null==u||null==(a=u.charts)?void 0:a.pie,conditionalFormattingPossibilities:function(t){return ws(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},formatColor:function(t,n){var r=js(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(r)return r.value},showLabel:"verbose"===(null==u?void 0:u.detail),legend:Wb(null==e?void 0:e.legend,"verbose"===(null==u?void 0:u.detail)),formatValue:function(t){return ks(Jl(t,2),null==e?void 0:e.numberFormatOptions,null==e?void 0:e.labelFormat)}})})]})})};Zx.defaultProps={type:"pieChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!1,labelFormat:null};var $x=t.memo(Zx,xs),ey=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx($x,Q({id:e.id},i,{dataSet:e.dataSet,localFilters:e.component.localFilters,setParameterUpdate:e.setParameterUpdate,setLocalFilters:e.setLocalFilters,result:r[0],queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},ty=Object.assign((function(){}),{wrapper:function(e){return As({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 As(Q({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"},Ts,{"&:hover":Q({},Ts,{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":Q({},Ts,{outline:0,boxShadow:e?null==(r=e["&:focus"])?void 0:r.boxShadow:void 0})}))},icon:function(e){var t,n;return As({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:As({top:8,right:12,position:"absolute",display:"flex",gap:"0.5rem"})}),ny=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=Xd();return c.jsx("form",{autoComplete:"off",children:c.jsxs("div",{role:"search",className:""+ty.wrapper(null==f?void 0:f.search),"data-themeapi":"search","data-chipposition":"top.left",children:[c.jsx(yg,{as:"label",htmlFor:"fuzzy-search-input",children:"Search"}),c.jsx("input",{value:s,onChange:function(e){return u(e.target.value)},id:"fuzzy-search-input",name:"fuzzy-search-input",className:""+ty.input(null==f?void 0:f.search),placeholder:r,ref:a,"data-testid":"fuzzy-search-input"}),c.jsxs("span",{className:""+ty.iconWrapper,children:[s&&c.jsx(om,{onClear:function(){return p&&p()},className:""+ty.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"}),c.jsx(g.SearchIcon,{className:""+ty.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"})]})]})})})),ry=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})})},iy=function(e,t,n){return As(Q({transform:t?"translate3d(0, 0, 0)":void 0,position:"relative",height:"100%",width:null!=n?n:"100%"},e))},oy=n.forwardRef((function(e,t){var n,r,i=e.transform,o=void 0===i||i,a=Xd();return c.jsx("div",{role:null==e?void 0:e.role,"data-testid":null==e?void 0:e.testId,className:Hd(null==e?void 0:e.vizzlyPrefix,""+iy(Q({},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})})),ay=function(e,t,n){try{if(!Vr(t,e.attributes.dataSetId))throw new fn(t,e.attributes.dataSetId);var r=Br(e.attributes.type,{queryEngineConfig:n.queryEngineConfig}).validate(e.attributes,t);return r.length>0&&Te(r),r[0]}catch(e){if(e instanceof un)return e;if(e instanceof fn)return e;if(e instanceof pn)return e;throw e}},ly=Object.assign((function(){return null}),{label:function(e){return As({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 As({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight})},input:As({margin:0,padding:0,alignSelf:"flex-start",marginTop:2}),fieldset:function(e){return void 0===e&&(e=!1),As({border:"none",margin:0,padding:0,width:"auto",opacity:e?.6:1,cursor:e?"not-allowed":"pointer"})}});function sy(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:""+ly.fieldset(l),children:[!a&&c.jsx(vm,{as:"legend",children:o}),c.jsx(zf,{direction:s||"column",gap:"0.5rem","data-component":"radio-group",maxWidth:u||"100%",children:t.map((function(e,t){return c.jsx(uy,{option:e,name:n,onChange:function(e){return r&&!l&&r(e.target.value)},selected:i},t)}))})]})}function uy(e){return c.jsx(dy,Q({},e,{type:"radio"}))}function dy(e){var t,n,r=e.name,i=e.option,o=e.selected,a=e.onChange,l=e.type,s=Xd();return c.jsxs(zf,{as:"label",gap:"0.5rem",alignItems:"self-start","data-component":"input",cursor:"inherit",className:""+py,children:[c.jsx("input",{type:l,name:r,value:i.value,checked:JSON.stringify(o)===JSON.stringify(i.value),onChange:a,className:Hd("checkbox"===l?Jm()+" "+cy:""+ly.input)}),c.jsxs(zf,{direction:"column","data-component":"label",children:[c.jsx("p",{className:""+ly.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:""+ly.description(null==s||null==(n=s.radioGroup)?void 0:n.description),children:null==i?void 0:i.description})]})]})}var cy=As({marginRight:0,marginTop:1}),py=As({userSelect:"none"}),fy=function(e){return As({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}}})},my=As({display:"block",alignSelf:"flex-start"}),hy=Object.assign(fy,{svg:function(e){var t,n,r;return As({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:As({paddingTop:3,display:"block",height:"1rem",width:"1rem"}),content:function(e){var t,n;return As({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 As({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:my}),vy=function(e){var n,r,i=Xd();return c.jsxs("div",{role:"alert",className:""+hy(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:""+hy.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:""+hy.icon,children:c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+hy.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:""+hy.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:""+hy.content(null==i?void 0:i.alerts),children:[(null==e?void 0:e.title)&&c.jsx("div",{className:""+hy.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})]})]})},gy=function(e){var n=md(),r=n.maxCSVDownloadLimit,i=n.textOverride,o=n.featureToggles,a=t.useState(function(e){return e.canDownloadDataSet&&e.canDownloadViewData?"data-set-download-type":e.canDownloadViewData&&!e.canDownloadDataSet?"view-download-type":e.canDownloadDataSet&&!e.canDownloadViewData?"data-set-download-type":void 0}(o)),l=a[0],s=a[1],u=[];if(o.canDownloadDataSet){var d=r&&"number"==typeof r?i("full_data_set_desription","Download the underlying data that this view has used. Up to [[maxCSVDownloadLimit]] rows.",{maxCSVDownloadLimit:r.toLocaleString()}):"";u.push({label:i("full_data_set","Full data set"),value:"data-set-download-type",description:d})}return o.canDownloadViewData&&u.push({label:i("view_data_set","View data set"),value:"view-download-type",description:i("view_data_set_description","Download the data that you see in this view.")}),c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:i("data_download","Data download"),show:!0}),c.jsxs(kv.Content,{children:[u.length>1?c.jsx(sy,{options:u,name:"download-type",label:i("select_download_type","Select Download Type"),selected:l,labelHidden:!0,onChange:function(e){return s(e)}}):1===u.length&&c.jsx("p",{className:""+tu.my(0),children:u[0].description}),0===u.length&&c.jsx(vy,{children:i("data_download.not_enabled","Downloads for this view have not been made available")})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:i("cancel","Cancel")}),c.jsx(Ch,{primary:!0,onClick:function(){l&&e.onDownload(l),null==e||e.onClose(!0)},disabled:0===u.length,children:i("download","Download")})]})})]})},by=gd((function(e){var t=md().textOverride,n=e.onClose,r={editComponentsOnDashboard:t("edit_components_on_dashboard","Edit"),editComponentsOnLibrary:t("edit_components_on_library","Edit"),downloadComponentData:t("download","Download"),increaseColSpan:t("merge","Merge"),decreaseColSpan:t("unmerge","Unmerge"),removeComponentFromLibrary:t("remove_component_from_library","Remove"),removeComponentFromDashboard:t("remove_component_from_dashboard","Remove"),removeCellFromDashboard:t("remove_cell_from_dashboard","Remove"),manageReport:t("manage_reports","Reports"),parameters:t("add_parameters","Add Parameters"),localFilter:t("add_local_filters","Add Local Filters"),clickSettings:t("click_settings","Click Settings"),viewRawResults:t("view_raw_results","JSON Results"),viewRawAttributes:t("view_view_attributes","JSON Attributes")};return c.jsx(Af.Options,{children:c.jsx("div",{children:e.cellOptions.map((function(e,t){return c.jsxs(Af.Option,{"data-testid":e.testId,onChange:function(){e.onClick(),n()},children:[e.renderIcon&&e.renderIcon(),c.jsx("span",{children:r[e.purpose]||""})]},"option_"+t+"_"+e.purpose+e.testId)}))})})}),"renderComponentOptions"),xy={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},yy=function(e){var t=md().textOverride,n=If(),r=n.ref,i=n.open,o=n.position,a=n.show,l=n.close,s=Xd();return c.jsxs("div",{css:xy,ref:r,children:[c.jsx("button",{"data-testid":"open-component-options","aria-label":null!=e&&e.chartLabel?t("cell_options","Options")+": "+(null==e?void 0:e.chartLabel):t("cell_options","Options"),onClick:function(){i()},className:oh(null==s?void 0:s.dashboard)+" "+tu.button,"data-themeapi":"dashboard.icon",children:c.jsx(Dd,{})}),a&&c.jsx(Af,{onClose:function(){return l()},position:o,children:c.jsx(by,{onClose:function(){return i()},cellOptions:e.cellOptions})})]})},wy=function(e){var n,r=t.useState(!1),o=r[0],a=r[1],l=Rm().dashboard,s=(null==e?void 0:e.component.attributes).type,u=md(),d=Br(e.component.attributes.type),p=ay(e.component,l.dataSets,u),f=Vr(l.dataSets,e.component.attributes.dataSetId),m=[];return!e.canEditComponentsOnDashboard||p instanceof un||m.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Sy,{})},onClick:function(){return e.onEdit()},testId:"edit"}),e.canSetupReportSchedule&&"basicTable"==s&&m.push({purpose:"manageReport",renderIcon:function(){return c.jsx(wd,{})},onClick:function(){return e.onManageReport()},testId:"manage-report"}),"admin"!==u.mode||"basicTable"!=s&&"dataTable"!=s&&"barChart"!=s&&"horizontalBarChart"!=s||m.push({purpose:"clickSettings",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CogIcon,{})})},onClick:function(){return e.onClickSettings()},testId:"click-settings"}),e.canDownloadComponentData&&"custom"!=s&&m.push({purpose:"downloadComponentData",renderIcon:function(){return c.jsx(Ad,{})},onClick:function(){return a(!0)},testId:"download"}),u.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(yd,{active:!1})})},onClick:function(){return e.onAddFilter()},testId:"filterBy"}),!u.featureToggles.parameters||null==(n=d.supportedFeatures)||!n.parameters||"read_write"!==u.scope||null!=f&&f.preAggregated||m.push({purpose:"parameters",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(jd,{})})},onClick:function(){return e.onSetParameters()},testId:"parameters"}),e.canViewRawJSONResults&&m.push({purpose:"viewRawResults",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CodeIcon,{})})},onClick:function(){return e.onViewRawJSONResults()},testId:"view-raw-results"}),e.canViewRawViewAttributes&&m.push({purpose:"viewRawAttributes",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CodeIcon,{})})},onClick:function(){return e.onViewRawAttributes()},testId:"view-view-attributes"}),e.canRemoveComponentsFromDashboard&&m.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Cy,{})},onClick:function(){return e.onRemove()},testId:"remove"}),i.isEmpty(m)?null:c.jsxs(c.Fragment,{children:[c.jsx(yy,{cellOptions:m,chartLabel:null==e?void 0:e.chartLabel}),c.jsx(gy,{onDownload:e.onDownload,show:o,onClose:function(){return a(!1)}})]})},jy=function(e){var t=[];return md().featureToggles.canRemoveComponentsFromDashboard&&(t=[].concat(t,[{purpose:"removeCellFromDashboard",renderIcon:function(){return c.jsx(kd,{purpose:"removeCellFromDashboard"})},onClick:function(){return e.onRemoveCell()},testId:"deleteCell"}])),i.isEmpty(t)?null:c.jsx(yy,{chartLabel:e.chartLabel,cellOptions:t})},Cy=function(){return c.jsx(kd,{purpose:"removeComponentFromDashboard"})},Sy=function(){return c.jsx(_d,{})},Fy={group:void 0,measure:void 0},ky=function(e,t){if(!e.group&&!e.measure&&!t)return!0},_y=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};function Ty(e,t){var n=[],r=[],i=!1,o=!1;return e.forEach((function(e){var t={value:e.id,label:e.name,subText:e.description};e.preAggregated?(i=!0,r.push(t)):(o=!0,n.push(t))})),i&&o?(n.unshift({label:t("dataSets.data","Data"),title:!0,value:""}),r.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""})):i&&r.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""}),[].concat(n,r)}var Ay=function(e){var t=e.dataSets,n=e.setDataSet,r=md().textOverride;return c.jsxs(c.Fragment,{children:[t.length>1&&c.jsx(Fm,{children:c.jsx(Sm,{label:r("dataset","Dataset"),labelHidden:!0,id:"select-data-set",testId:"select-data-set",anchorLeft:!0,placeholder:r("dataset","Dataset"),onChange:n,selected:e.dataSet.id,options:Ty(t,r)})}),e.dataSet.preAggregated&&c.jsx(_f,{paddingX:0,paddingTop:16,children:c.jsx(vy,{icon:c.jsx(c.Fragment,{}),type:"info",children:r("pre-aggregated_data_set_description","Please note; this data set is pre-aggregated, therefore customization options on the data panel are limited.")})})]})},Dy=function(e,t,n,r){var i,o=[].concat(n);return o.splice(r,1),(i={})[e]=t(o),i},Iy=function(e,t,n){var r=[].concat(e),i=e[t];return r[t]=e[n],r[n]=i,r},Oy=function(e){var t=md(),n=t.textOverride,r=t.organizationName;return c.jsxs(kv,{width:"sm","data-testid":"cannot-delete-modal",isOpen:!0,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:n("field_protected","Field Protected"),show:!0}),c.jsx(kv.Content,{children:c.jsx("p",{children:r?n("cannot_delete_modal_content_with_org_name","This field has been protected by [[organizationName]] and cannot be removed.",{organizationName:r}):n("cannot_delete_modal_content_without_org_name","This field has been protected by the administrator and cannot be removed.")})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Dv,{children:c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:n("close","Close")})})})]})},Py=["barChart","dataTable","basicTable"],Ey=function(e,t){if(!t)return!1;if(!(e&&"type"in e&&e.type&&Py.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},My=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=Yr(d,e.field);return{title:t.publicName,icon:t.dataType}})),h=[].concat(Wr(d.fields,null!=(n=e.filterFieldOptions)?n:{onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})),v=Le(h,[].concat(f)),g=[].concat(v).map((function(e){return{title:e.publicName,icon:e.dataType,value:e.id}})),b=md();return c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:b.mode,testId:null!=(r=null==e?void 0:e.testId)?r:"add-dimension",onDeleteItem:e.dataSet.preAggregated?void 0:function(t){if(Ey(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=Iy([].concat(f),t,n);e.setPartialAttributes({dimension:r})}:void 0,newItem:{callToAction:null!=(o=null==e?void 0:e.label)?o:(0,b.textOverride)("add_comparison","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(Oy,{onClose:function(){return s(!1)}})]})},Ry=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=Yr(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]=Q({},n[t],{truncate:e}),a({timeDimensions:n})}(e,t)},options:Ly(l,i),selected:t.truncate}:void 0;r.push({title:Yr(o,t.field).publicName,icon:"date_time",value:t.field,select:u})})),r),d=Wr(o.fields,{onlyFieldTypes:["date_time"]}).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),p=!!l&&s.length===l,f=md();return c.jsx(xh,{mode:f.mode,testId:"time-dimension",onOrderChange:l?void 0:function(e,t){var n=Iy([].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:(0,f.textOverride)("add_time_dimension","Add time dimension"),onNew:function(e){var t=[].concat(s,[{field:e.id,truncate:Object.keys(St)[0]}]);a({timeDimensions:t})},initValues:d,hide:p},items:e.filterOptions?e.filterOptions(u):u})};function Ly(e,t){return e.filter((function(e){return t.hasOwnProperty(e.value)}))}var Ny=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=Yr(t,e.field),i={onChange:function(e,t){!function(e,t){!function(e,t,n){var r,i,o=[].concat(b);o[n]=Q({},o[n],((r={}).function=t,r)),m(((i={})[d]=p(o),i))}(0,e,t)}(e,t)},options:function(e,t){var n=Pe(e,t);return[].concat(n).map((function(e){return{value:e,label:t[e].publicName}}))}(r,n),selected:e.function};return{title:r.publicName,icon:r.dataType,value:e.field,select:Ht(r)||"none"===e.function?void 0:i}}))}(b,h,v),y=[].concat(Wr(h.fields,e.fieldFilterOptions)).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}})),w=md(),j=w.mode,C=w.textOverride,S=!1;return e.allowsMultiple||(S=!e.allowsMultiple&&!!g[d]),i.isArray(g[d])&&e.maxAllowed&&e.maxAllowed<=g[d].length&&(S=!0),e.dataSet.preAggregated&&(S=!0),c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:j,onOrderChange:e.allowsMultiple?function(e,t){var n,r=Iy([].concat(b),e,t);m(((n={})[d]=p(r),n))}:void 0,onDeleteItem:e.disableRemove||e.dataSet.preAggregated?void 0:function(e){Ey(f,b[e])?u(!0):m(Dy(d,p,b,e))},items:e.filterOptions?e.filterOptions(x):x,newItem:{callToAction:null!=(n=null==e?void 0:e.label)?n:C("add_metric","Add metric"),onNew:function(t){var n,r=null!=e&&e.onNewMeasureFilterAggregate?e.onNewMeasureFilterAggregate(t):e.supportedAggregates,i=Oe(t,r),o=[].concat(b,[{field:t.id,function:Ht(t)?t.denominatorAggregate:i}]);m(((n={})[d]=p(o),n))},initValues:y,hide:S},id:null==e?void 0:e.id,testId:null!=(r=null==e?void 0:e.testId)?r:"metric-input"}),s&&c.jsx(Oy,{onClose:function(){return u(!1)}})]})},zy=function(e){var n=e.attributes,r=e.setPartialAttributes,i=e.dataSet,o=t.useState(!1),a=o[0],l=o[1],s=md(),u=n.measure,d=[].concat(u).map((function(e){var t=Yr(i,e.field);return{title:t.publicName,icon:t.dataType}})),p=[].concat(Wr(i.fields,{removeAggregateMaths:!0,removePercentage:!0})).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}));return c.jsxs(t.Fragment,{children:[c.jsx(xh,{mode:s.mode,onOrderChange:function(e,t){var n=Iy([].concat(u),e,t);r({measure:n})},onDeleteItem:function(e){Ey(n,n.measure[e])?l(!0):r(Dy("measure",(function(e){return e}),u,e))},items:d,newItem:{callToAction:s.textOverride("add_field","Add field"),onNew:function(e){var t=[].concat(u,[{field:e.id,function:"none"}]);r({measure:t})},initValues:p}}),a&&c.jsx(Oy,{onClose:function(){return l(!1)}})]})},qy=function(e,t){return t?e+" ("+t+")":e},By=function(e){var t=e.attributes,n=e.setPartialAttributes,r=e.dataSet,i=md().textOverride,o=[].concat(t.order).map((function(e){var t={onChange:function(e,t){a(e,t)},options:[{label:i("asc","Asc"),value:"asc"},{label:i("desc","Desc"),value:"desc"}],selected:e.direction},n=Yr(r,e.field);return{title:qy(n.publicName,e.function&&"none"!=e.function&&le(e.function,i)),icon:n.dataType,select:t}})),a=function(e,r){var i=[].concat(t.order);i[r].direction=e,n({order:i})},l=md().mode,s=function(e,t,n,r,i,o){var a=[];if(a=a.concat([].concat(r||[]).flatMap((function(t){var n=Yr(e,t.field);return ze(n)?[]:[{title:n.publicName,icon:n.dataType,value:n,onSelected:function(e){i(e.id,t.function)}}]}))),t){var l=Yr(e,t.field);a.push({title:l.publicName,icon:l.dataType,value:l,onSelected:function(e){i(e.id,t.truncate)}})}return a.concat([].concat(n||[]).flatMap((function(t){var n=Yr(e,t.field);return ze(n)?[]:[{title:qy(n.publicName,At(t)&&le(t.function,o)),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})}),i);return c.jsx(xh,{mode:l,onOrderChange:function(e,r){var i=Iy([].concat(t.order),e,r);n({order:i})},onDeleteItem:function(e){var r=[].concat(t.order);r.splice(e,1),n({order:r})},items:o,newItem:{callToAction:i("add_sort","Add sort"),initValues:s},testId:"sort-input"})},Wy=function(e,t){return!(!e.field||!e.op||!t&&[void 0,NaN,""].includes(e.value))},Vy=function(e){var t;if(!e.field)return null;var n=md().textOverride,r=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),i=[].concat(Object.keys(r)).flatMap((function(t,n){return null!=e&&e.isAList||!["is_one_of","is_not_one_of"].includes(t)?[{label:r[t].publicName,value:t,testId:e.testId+"-pick-op-"+n}]:[]}));"allowedOperators"in e.field&&e.field.allowedOperators.includes("=")&&i.push({label:n("math_op_is_null","Is null"),value:"is_null",testId:"is-null"}),"allowedOperators"in e.field&&e.field.allowedOperators.includes("!=")&&i.push({label:n("math_op_is_not_null","Is not null"),value:"is_not_null",testId:"is-not-null"});var o=e.selected;return"!="==e.selected&&null===e.value?o="is_not_null":"="==e.selected&&null===e.value&&(o="is_null"),c.jsx(Sm,{label:n("operator","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:null!=(t=e.supportedQueryOperators)?t:i,selected:o,textOverride:n})},Hy=gd((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"),Yy=Object.assign((function(){return null}),{remove:function(e){return As(Q({"& svg":Q({},Ts,{fill:"#e5e7eb"})},e?{}:{"&:hover svg":Q({},Ts,{fill:"#de0938",cursor:"pointer"})}))},complete:function(e){return As(Q({},e?{}:{"& svg":Q({},Ts,{fill:"rgb(229, 231, 235)"})}))}}),Uy=function(e,t,n,r,i,o){var a=Br(t,{queryEngineConfig:r}),l=n.preAggregated&&a.setDataAttributesFromPreAggregatedDataSet?a.setDataAttributesFromPreAggregatedDataSet(a.init(n.id),n):a.autoGenerate(n);if(o)try{var s=function(e,t,n,r){var i={},o=Gy.includes("measure")?"measure":null;return Gy.forEach((function(a){if(a in e&&a in t){var l=e[a];if(a!==o||!Array.isArray(l))return void(i[a]=l);i[o]=l.map((function(e){if(At(e))return e;var t=Yr(n,e.field);return Q({},e,{function:We(r,t.dataType)[0]})}))}})),i}(o.attributes,l,n,r);ke("Swapping component type");var u=a.setAttributes(l,Q({type:t},s));return i(u,n,"initial"),vi(u)}catch(e){ke("Component properties are not compatible with new type",e)}var d=i(l,n,"initial");return vi(a.setAttributes(l,d))},Gy=["measure","order","timeDimension","dimension","filter","displayTitle","displaySubject","limit"],Ky=function(){var e,n,r=md(),i=r.onlyViewTypes,o=r.queryEngineConfig,a=r.textOverride;t.useState(null);var l=Rm(),s=l.dashboard,u=l.componentEditor,d=l.runQueriesCallback,c=l.dispatch,p=l.trackEvent,f=md(),m=f.featureToggles,h=f.numberFormatOptions,v=f.mode,g=f.dataPanel,b=f.formatPanel,x=f.onEditorUpdate,y=(null==u?void 0:u.component)||null;if(t.useEffect((function(){var e=function(){var e=X(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Uy(0,i(s.dataSets[0])[0],s.dataSets[0],o,x);case 2:t=e.sent,u&&c(Q({type:"startEditingComponent",component:t},u.target));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();y||e()}),[]),!y)return null;var w=Br(y.attributes.type,{queryEngineConfig:o}),j=Vr(s.dataSets,y.attributes.dataSetId);if(!j)return null;var C=null!=u&&null!=(e=u.target)&&e.libraryIndex||0===(null==u||null==(n=u.target)?void 0:n.libraryIndex)?"library":"dashboard",S=function(e){if(y&&w){var t,n=x(e,j,"edit");e.type!==y.attributes.type&&(w=Br(e.type,{queryEngineConfig:o}));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=Q({},y,{attributes:t});c({type:"updateEditorComponent",component:r})}};return{setLocalFilters:function(e){c({type:"updateEditorComponent",component:Q({},y,{localFilters:e})})},setParameterUpdate:function(e){var t=Dm(y,e);c({type:"updateEditorComponent",component:Q({},t)})},queryEngineConfig:o,selectedComponent:y.attributes.type,onSelectViewType:function(e){var t=Uy(0,e,j,o,x,y);c({type:"updateEditorComponent",component:t})},dataPanel:g,formatPanel:b,setDataSet:function(){var e=X(G().mark((function e(t){var n,r,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u&&u.component&&t)){e.next=10;break}if(n=Gr(s.dataSets,t),!(r=n[0])){e.next=10;break}return(a=i(r)).includes(l=u.component.attributes.type)||(l=a[0]),e.next=8,Uy(0,l,r,o,x);case 8:c({type:"updateEditorComponent",component:e.sent});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),featureToggles:m,dashboard:s,setDataSets:function(e){c({type:"setDataSets",dataSets:e})},dataSet:j,viewOptions:i,numberFormatOptions:h,setAttributes:S,setPartialAttributes:function(e){w&&S(w.setAttributes(y.attributes,e))},setResults:function(e){c({type:"setResultsForComponentInEditor",results:e})},mode:v,origin:C,componentEditor:u,component:y,trackEvent:p,runQueriesCallback:d,dispatch:c,textOverride:a}},Xy=Ds(85),Qy=function(e){return c.jsx("div",{"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:c.jsxs(zf,{direction:"column",gap:"0.25rem",children:[c.jsxs(zf,{justifyContent:"space-between",alignItems:"end",children:[c.jsx("span",{className:""+tu.textSize("sm"),children:e.showTitle?e.title:""}),e.showValue&&c.jsx(_f,{as:"p",margin:0,children:null==e?void 0:e.displayValueNow})]}),c.jsx("div",{className:""+Jy,"data-percentage":e.percentage,children:c.jsx("div",{className:""+Zy(e.color,e.percentage)})})]})})},Jy=As({height:10,backgroundColor:Xy,borderRadius:"9999px",position:"relative",overflow:"hidden",width:"100%"}),Zy=function(e,t){var n=Math.max(0,Math.min(100,t));return As({height:"100%",width:n+"%",backgroundColor:"string"==typeof e?e:null==e?void 0:e[0],borderRadius:"inherit",transition:"width 0.3s ease"})},$y=function(e){var t,n,r,i,o=null!=(t=e.radius)?t:120,a=null!=(n=e.stroke)?n:15,l=o-2*a,s=2*l*Math.PI,u=s-e.percentage/100*s,d="gradient-"+Math.random().toString(36).substr(2,9);return c.jsxs(zf,{direction:"column",alignItems:"center",children:[c.jsxs("div",{style:{position:"relative"},"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:[c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:1.25*o,height:1.25*o,viewBox:"0 0 "+2*o+" "+2*o,children:[c.jsx("defs",{children:c.jsx("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:(i=e.color,Array.isArray(i)?i.map((function(e,t,n){return c.jsx("stop",{offset:t/(n.length-1)*100+"%",stopColor:e},t)})):[c.jsx("stop",{offset:"0%",stopColor:i},"0"),c.jsx("stop",{offset:"100%",stopColor:i},"1")])})}),c.jsx("circle",{stroke:Xy,fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,r:l,cx:o,cy:o}),c.jsx("circle",{stroke:"url(#"+d+")",fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,style:{strokeDashoffset:u},r:l,cx:o,cy:o,transform:"rotate(-90 "+o+" "+o+")",strokeLinecap:"round"})]}),e.showValue&&c.jsx("p",{className:""+ew,children:null!=(r=null==e?void 0:e.displayValueNow)?r:e.percentage+"%"})]}),e.showTitle&&c.jsx("div",{className:tu.textSize("sm")+" "+tw,children:e.title})]})},ew=As({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",margin:0}),tw=As({textAlign:"center",height:20}),nw=function(e){var t=Number(Ql(e.valueNow,e.valueMax).toFixed(2));return c.jsx(e.type===wr.Circular?$y:Qy,Q({},e,{percentage:t}))},rw=Object.assign(nw,{View:nw,Circular:$y,Linear:Qy}),iw={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))"},ow=function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))},aw={areaChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))}(e)},barChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{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"})}))}(e)},horizontalBarChart:function(e){return function(e){return c.jsx("svg",Q({css:iw,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{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"})}))}(e)},lineChart:function(e){return function(e){return c.jsx("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{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"})}))}(e)},pieChart:function(e){return function(e){return c.jsxs("svg",Q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},e,{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"})]}))}(e)},scatterChart:function(e){return function(e){return c.jsxs("svg",Q({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"}})]}))}(e)},singleStat:function(e){return function(e){return c.jsx("svg",Q({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"})}))}(e)},dataTable:function(e){return ow(e)},basicTable:function(e){return ow(e)},comboChart:function(e){return function(e){return c.jsx("svg",Q({},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"})]})}))}(e)},mercatorMap:function(e){return function(e){return c.jsx("svg",Q({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"},e,{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"})}))}(e)},progress:function(e){return c.jsx(rw,{valueMax:100,valueNow:64,type:wr.Circular,title:"Progress type",color:(null==(t=e)?void 0:t.color)||"#2d2f31",radius:19,stroke:5});var t},custom:function(e){return c.jsx(c.Fragment,{})}},lw=function(){var e=md(),t=e.textOverride,n=e.queryEngineConfig,r=Ky();if(!r)return null;var i=[].concat(r.viewOptions(r.dataSet)).flatMap((function(e){var i=Br(e,{textOverride:t,queryEngineConfig:n});return!i.setDataAttributesFromPreAggregatedDataSet&&r.dataSet.preAggregated?[]:[{value:e,label:i.title,icon:aw[e]()}]}));return c.jsx(Fm,{children:c.jsx(Sm,{label:t("view","View"),labelHidden:!0,id:"select-view",testId:"select-view",anchorLeft:!0,onChange:function(e){return r.onSelectViewType(e)},selected:r.component.attributes.type,renderOption:function(e){return c.jsx(sw,Q({},e,{option:"option"}))},renderSelected:function(e){return c.jsx(sw,Q({},e,{option:"view"}))},options:i})})},sw=function(e){return c.jsxs(zf,{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(Uf,{flexPaddingTop:"0",paddingTop:"0",icon:null==e?void 0:e.icon,iconWidth:"horizontalBarChart"===e.value[0]||"barChart"===e.value[0]?"66%":void 0,alignSelf:"center"}),c.jsx(_f,{as:"span",marginY:"0.15rem",children:null==e?void 0:e.label})]})},uw=function(e,t){return("!="==e||"="==e)&&null===t},dw={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"},cw={name:"1jjvu4g",styles:"margin-left:0.5rem;width:1.75rem;flex:none;text-align:right"},pw={name:"xioa8z",styles:"width:1.75rem;flex:none;text-align:right"},fw=function(e){var n,r,i=e.textOverride,o=e.filter,a=o.field,l=o.op,s=o.value,u=Wy(e.filter),d=function(t){e.onChange(Q({},e.filter,t))},p=(r=[],Wr(e.dataSet.fields,{removeAggregateMaths:!0,removePercentage:!0}).forEach((function(t,n){r.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n,icon:c.jsx(Uf,{icon:t.dataType,paddingTop:0})})})),r);return c.jsxs("div",{css:["display:flex;",u&&{"--tw-border-opacity":"1",borderColor:"rgb(74 222 128 / var(--tw-border-opacity))"},"",""],children:[c.jsxs("div",{css:dw,children:[c.jsx("div",{children:c.jsx(Sm,{label:i("field","Field"),id:e.testId+"-pick-field",labelHidden:!0,testId:e.testId+"-pick-field",onChange:function(t,n){var r=void 0;"number"==typeof n&&null!=e&&e.overrideFieldOptions&&(r=null==e?void 0:e.overrideFieldOptions[n].function),d({value:void 0,op:void 0,field:t,function:r})},options:null!=(n=null==e?void 0:e.overrideFieldOptions)?n:p,selected:a,renderSelected:a?function(e){return c.jsx(sw,Q({},e,{option:"inline"}))}:void 0,controlClassName:""+tu.pl("0.5rem"),textOverride:i})}),c.jsx("div",{css:[a?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:c.jsx(Vy,{queryEngineConfig:e.queryEngineConfig,onChange:function(e){return d(Q({},e))},field:a,testId:e.testId,selected:l,value:s,id:"percentage-operator-"+(null==e?void 0:e.rowIndex),isAList:a&&"string"==a.dataType,supportedQueryOperators:e.supportedQueryOperators})}),c.jsx("div",{css:[l?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:!uw(l,s)&&c.jsxs(c.Fragment,{children:[a&&"number"==a.dataType&&c.jsx(jm,{id:e.testId+"-value",label:i("value","Value"),labelHidden:!0,"data-testid":e.testId+"-value",type:"number",onChange:function(e){var t=parseFloat(e.target.value);d({value:t})},defaultValue:s}),a&&("string"==a.dataType||"string[]"==a.dataType)&&c.jsx(t.Fragment,{children:"="===l||"!="===l||"array_contains"===l||"is_one_of"===l||"is_not_one_of"===l?c.jsx(mw,{onChange:function(e){return d({value:e})},testId:e.testId+"-value",value:s,dataSet:e.dataSet,field:a,multiple:"is_one_of"===l||"is_not_one_of"===l||"array_contains"===l,filter:e.filter}):c.jsx(jm,{label:i("value","Value"),labelHidden:!0,id:e.testId+"-value","data-testid":e.testId+"-value",type:"text",onChange:function(e){d({value:e.target.value})},defaultValue:s})}),a&&"boolean"==a.dataType&&c.jsx(Sm,{label:i("value","Value"),labelHidden:!0,id:e.testId+"-value",selected:s,onChange:function(e){return d({value:e})},options:[{label:"True",value:!0},{label:"False",value:!1}],textOverride:i}),a&&"date_time"==a.dataType&&c.jsx(Hy,{value:s?Ul(new Date(s),"YYYY-MM-DD[T]HH:mm:ss"):void 0,onChange:function(e){var t=e?e.toISOString():null;d({value:t})},testId:""+e.testId})]})||c.jsx("p",{children:"-"})})]}),c.jsx("div",{css:cw,className:""+Yy.complete(u),children:c.jsx(Fd,{})}),!e.hideRemove&&c.jsx("div",{css:pw,children:c.jsx("button",{onClick:function(){return e.onDelete()},className:Hd(""+Yy.remove(!(null==e||!e.removeDisabled)),""+tu.button),"aria-label":i("remove_filter","Remove filter: [[filterNumber]]",{filterNumber:e.rowIndex+1}),disabled:null==e?void 0:e.removeDisabled,children:c.jsx(kd,{purpose:"removeFilter"})})})]})},mw=function(e){var n,r=e.value,i=function(e,n){var r,i=Rm().runQueriesCallback,o=t.useState(void 0),a=o[0],l=o[1],s=Yr(e,n);return r="string[]"==s.dataType?[on(e.id,s).query]:[an(e,n)],Vb(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=md().textOverride,a=(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(Gv,{label:o("values","Values"),id:"select-multiple-value",labelHidden:!0,setSelected:function(t){return null==e?void 0:e.onChange(t.map((function(e){return a[e].value})))},selected:(n=[],a.forEach((function(e,t){null!=r&&r.includes(e.value)&&n.push(t)})),n),options:a,textOverride:o}):c.jsx(Sm,{testId:null==e?void 0:e.testId,label:o("value","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:a,textOverride:o,hasFreeText:!0})},hw={name:"1v017vf",styles:"margin-top:1.5rem;margin-bottom:1.5rem;text-align:left"},vw={name:"151yjvf",styles:"margin-bottom:0.5rem;font-weight:500;text-transform:uppercase;letter-spacing:0.1em"},gw={name:"zjik7",styles:"display:flex"},bw={name:"1sul1dv",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem"},xw={name:"1x4tmz9",styles:"width:3.5rem;flex:none"},yw={name:"1gok8e8",styles:"margin-bottom:0.5rem"},ww=function(e){var t=e.textOverride;return c.jsx(c.Fragment,{children:e.wipFilters.map((function(n,r){var i=null!=e&&e.maxOrFilters?Math.min(null==e?void 0:e.maxOrFilters,n.length):n.length;return c.jsxs("div",{children:[0!=r&&c.jsx("div",{css:hw,children:c.jsx("span",{css:vw,children:t("filter_or","or")})}),c.jsxs("div",{children:[!e.removeHeadings&&c.jsxs("div",{css:gw,children:[c.jsxs("div",{css:bw,children:[c.jsx("div",{children:c.jsx(vm,{as:"span",children:e.fieldHeadingOverride||t("field","Field")})}),c.jsx("div",{children:c.jsx(vm,{as:"span",children:t("operator","Operator")})}),c.jsx("div",{children:c.jsx(vm,{as:"span",children:t("value","Value")})})]}),c.jsx("div",{css:xw})]}),n.slice(0,i).map((function(i,o){return c.jsx("div",{css:yw,children:c.jsx(fw,{queryEngineConfig:e.queryEngineConfig,testId:"filter-"+r+"-"+o,filter:i,dataSet:e.dataSet,onChange:function(t){e.updateWipFilter(t,r,o)},onDelete:function(){e.deleteWipFilter(r,o)},rowIndex:o,removeDisabled:void 0!==e.removeLastEnabled?!e.removeLastEnabled:n.length<=1||n.length===o+1,overrideFieldOptions:null==e?void 0:e.overrideFieldOptions,hideRemove:1===e.maxOrFilters,textOverride:t,supportedQueryOperators:e.supportedQueryOperators})},"filter_"+r+"_"+o)}))]})]},"filter_"+r)}))})},jw=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"span",i=Xd();return c.jsx(r,{className:""+Wf.title(null==i||null==(n=i.lists)?void 0:n.title),"data-themeapi":"list.title",children:null==e?void 0:e.children})},Cw=Object.assign((function(){return null}),{wrapper:As({position:"relative","&:hover .help-icon":{opacity:1}}),fadeIn:function(e){return As(Q({opacity:0,maxWidth:18,color:e},Ts))}}),Sw=function(e){var t,n=Xd();return c.jsx(jw,{as:"legend",children:c.jsxs(zf,{gap:"0.25rem",alignItems:"center",children:[null==e?void 0:e.title,(null==e?void 0:e.tooltip)&&c.jsx(_f,{width:"18px",children:c.jsx(ih,{tooltipContent:function(){return c.jsx(ih.Content,{children:null==e?void 0:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+Cw.fadeIn(null==n||null==(t=n.dashboard)||null==(t=t.icon)?void 0:t.color)})})})]})})},Fw=Object.assign((function(e){return c.jsxs("fieldset",{className:Hd(""+Cw.wrapper,""+tu.bw(0),""+tu.m(0),""+tu.p(0)),children:[(null==e?void 0:e.title)&&c.jsx(Sw,Q({},e)),c.jsx(_f,{marginTop:"0.25rem",children:e.children})]})}),{Grid:function(e){return c.jsx(Ud,{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,n,r=Xd();return c.jsx(_f,{as:null!=(t=null==e?void 0:e.as)?t:"fieldset","data-component":"list-panel",children:c.jsxs(Zm,{padding:!0,children:[(null==e?void 0:e.title)&&c.jsx(_f,{"data-component":"section-panel",children:c.jsx(vm,{as:"legend",classNameOverride:""+mm(null==r||null==(n=r.lists)?void 0:n.subTitle),children:null==e?void 0:e.title})}),c.jsx(Ud,{gap:"0.5rem",children:null==e?void 0:e.children})]})})},Container:function(e){return c.jsx(zf,{direction:"column",gap:"0.75rem","data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Title:Sw});function kw(e,t,n,r){return Q({},e,r&&!!(i=n[t])&&i.validDataTypes.includes(e.dataType)&&function(e,t){return"string"==typeof e&&t.hasOwnProperty(e)}(t,n)&&{dataType:"number",allowedOperators:[">","<","=","!=",">=","<=","is_one_of","is_not_one_of"]});var i}function _w(e,t,n,r){return[].concat(e).map((function(e){return[].concat(e).map((function(e){var i;return Q({},e,{field:kw(Yr(t,e.field),null!=(i=e.function)?i:"none",n,r)})}))}))}function Tw(e,t){return[].concat(e).map((function(e){return[].concat(e).flatMap((function(e){var n;return Wy(e,1===t.maxFilters)?[{op:e.op,value:e.value,field:null==(n=e.field)?void 0:n.id,function:e.function}]:[]}))})).filter((function(e){return!i.isEmpty(e)}))}var Aw=function(e,r,o,a){var l;void 0===a&&(a={startWithEmptyField:!1,maxFilters:void 0,enableChangeToNumber:!1});var s=_w(e,r,o,a.enableChangeToNumber),u=n.useState(s),d=u[0],c=u[1];t.useEffect((function(){c(_w(e,r,o,a.enableChangeToNumber))}),[JSON.stringify(e)]);var p={field:null!=(l=a)&&l.startWithEmptyField?void 0:r.fields[0],op:void 0,value:void 0};i.isEmpty(d)&&(d=[[p]]);var f=[].concat(d).map((function(e){var t=e[e.length-1];return t&&Wy(t)?[].concat(e,[p]):[].concat(e)}));return{addOrFilter:function(){var e=[].concat(d);e.push([p]),c(e)},deleteWipFilter:function(e,t){var n=d;return n[e].splice(t,1),i.isEmpty(n[e])&&n.splice(e,1),c([].concat(n)),Tw(d,a)},updateWipFilter:function(e,t,n){var r=d;r[t][n]=e,c([].concat(r))},completedFilters:Tw(d,a),wipFilters:f}},Dw={publicName:"",numerator:null,numeratorFilter:!1,denominatorFilter:!1,denominator:null,denominatorScope:"all"},Iw=function(e,t){return!(e.denominator&&e.publicName&&(t[0]&&t[0].length>0||e.numerator))};function Ow(e,t){return{math:{title:t("custom_metric_title.math","Math"),subtext:t("custom_metric_description.math","Calculate from multiple values")},"rules-based_groups":{title:t("custom_metric_title.rules_based_groups","Rules-based Groups"),subtext:t("custom_metric_description.rules_based_group","Create groups based on conditions")},percentage:{title:t("custom_metric_title.percentage","Percentage"),subtext:t("custom_metric_description.percentage","Calculate a percentage in a field")},number_formatting:{title:t("custom_metric_title.number_formatting","Rounded Number"),subtext:t("custom_metric_description.number_formatting","Round a number field")}}[e]}function Pw(e,t){return t("custom_metric_modal_title","[[custom_metric_title]] Custom Metric",{custom_metric_title:Ow(e,t).title})}var Ew={publicName:"",mathType:"simple",left:void 0,right:void 0,rightFieldId:void 0,leftFieldId:void 0,operator:void 0},Mw=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}},Rw=function(e){var t,n,r,i,o=void 0,a=void 0,l=void 0;return e&&(Nw(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}),zw(e)&&(o=e.field,a=e.function)),{fieldId:o,function:a,nested:l}};function Lw(e){return{field:e.fieldId,function:e.function}}var Nw=function(e){return"left"in e||"operator"in e||"right"in e},zw=function(e){return"field"in e&&"function"in e};function qw(e,t){var n={};return n[t]=e&&Nw(e)?e.left:{operator:"+",left:null!=e?e:void 0},n}var Bw=function(e){var t=e.state,n=e.onClick,r=md().textOverride,i=r("agg_maths_add_remove_button","[[add|remove]] nested calculation",{add:"add"===t?r("add","Add"):"",remove:"remove"===t?r("remove","Remove"):""});return c.jsx(ih,{tooltipContent:function(){return i},classNameTrigger:""+Yw,children:c.jsxs(Fh,{secondary:!0,onClick:n,children:[c.jsx("span",{className:""+eu,children:i}),c.jsx("remove"===t?v.MinusSmIcon:v.PlusSmIcon,{width:16})]})})},Ww=function(e){var n=e.left,r=e.right,i=e.operator,o=e.dataSet,a=md().textOverride,l=Mw({mathType:"aggregate",left:n,right:r,operator:i,publicName:""});return c.jsx("code",{className:""+Uw,children:l?c.jsx(t.Fragment,{children:a("metrics_operators_need_defined","Metrics and operator need to be defined")}):c.jsxs(t.Fragment,{children:[n&&c.jsx(_f,{flex:1,as:"span","data-component":"calculation-left",textAlign:"right",children:c.jsx(Hw,{side:n,dataSet:o})}),c.jsx(_f,{as:"strong",width:8,"data-component":"calculation-operator",className:""+tu.bold,children:i}),r&&c.jsx(_f,{flex:1,as:"span","data-component":"calculation-right",children:c.jsx(Hw,{side:r,dataSet:o})})]})})},Vw=function(e){return c.jsx("code",{className:""+Uw,children:e.children})},Hw=function(e){var n,r,i,o,a,l,s=e.side,u=e.dataSet;return c.jsx(t.Fragment,{children:s&&Nw(s)?c.jsxs("span",{children:[c.jsx("span",{className:""+tu.bold,children:"("}),(null==(n=s.left)?void 0:n.field)&&Yr(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)&&Yr(u,null==(a=s.right)?void 0:a.field).publicName," (",null==(l=s.right)?void 0:l.function,")",c.jsx("span",{className:""+tu.bold,children:")"})]}):c.jsxs("span",{children:[s&&Yr(u,s.field).publicName," ",(null==s?void 0:s.function)&&c.jsxs(t.Fragment,{children:["(",null==s?void 0:s.function,")"]})]})})},Yw=As({display:"block"}),Uw=As({backgroundColor:Ds(80),color:Ds(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11}),Gw=function(e){var n=e.dataSet,r=md(),i=r.textOverride,o=r.queryEngineConfig,a=function(e,n,r,i){var o=!!n,a=t.useState(Dw),l=a[0],s=a[1],u=Aw(n&&"numeratorFilter"in n&&n.numeratorFilter?n.numeratorFilter:[],r,e.supportedAggregates),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter,m=Aw(n&&"denominatorFilter"in n&&n.denominatorFilter?n.denominatorFilter:[],r,e.supportedAggregates),h=m.completedFilters,v=m.wipFilters,g=m.deleteWipFilter,b=m.updateWipFilter;return t.useEffect((function(){s(n?{publicName:n.publicName,numeratorFilter:!(!n||!("numeratorFilter"in n)),denominatorFilter:!(!n||!("denominatorFilter"in n)),numerator:n.numeratorFieldId&&n.numeratorAggregate?{function:n.numeratorAggregate,field:n.numeratorFieldId}:null,denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId},denominatorScope:n.denominatorScope}:Dw)}),[JSON.stringify(n)]),{onChange:function(e){s(Q({},l,e))},denominatorScope:l.denominatorScope,fieldPublicName:l.publicName,denominatorMeasure:l.denominator,numeratorMeasure:l.numerator,completedNumeratorFilter:d,wipNumeratorFilters:c,deleteWipNumeratorFilter:p,updateWipNumeratorFilter:f,completedDenominatorFilter:h,wipDenominatorFilters:v,deleteWipDenominatorFilter:g,updateWipDenominatorFilter:b,isEditing:o,handleUpsertPercentageField:function(){if(l.denominator&&l.publicName){var t=function(e,t,n,r,i,o,a,l,s){return{version:2,id:qt(),publicName:e,numeratorFilter:null!=o?o:[],denominatorFieldId:t,numeratorFieldId:null!=r?r:null,numeratorAggregate:null!=i?i:null,denominatorAggregate:n,denominatorFilter:null!=a?a:[],canBeDimension:!1,canBeMeasure:!0,dataType:"number",denominatorScope:s||"all",allowedOperators:ae({dataType:"number"},l)}}(l.publicName,l.denominator.field,l.denominator.function,l.numerator?l.numerator.field:null,l.numerator?l.numerator.function:null,d,h,e,l.denominatorScope);i(Q({},t,{id:o?n.id:t.id}))}},numeratorFilter:l.numeratorFilter,denominatorFilter:l.denominatorFilter,saveDisabled:Iw(l,d)}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),l=a.onChange,s=a.numeratorFilter,u=a.denominatorFilter,d=a.denominatorScope,p={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removePercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0};return c.jsxs(kv,{width:"4xl",isOpen:e.isOpen,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("percentage",i)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{id:"percentage-name",placeholder:i("metric_name","Metric name"),label:i("metric_name","Metric name"),value:a.fieldPublicName,onChange:function(e){return l({publicName:e.target.value})}})}),c.jsxs(Ud,{gap:"1rem",children:[c.jsxs(Fw.Panel,{children:[c.jsxs(Ov,{as:"fieldset",marginBottom:s?void 0:0,children:[c.jsx(vm,{as:"legend",children:i("numerator","Numerator")}),c.jsx(Ny,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({numerator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.numeratorMeasure?[a.numeratorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:p})]}),s&&c.jsxs(Ov,{as:"fieldset",marginBottom:0,children:[c.jsx(vm,{as:"legend",children:i("Filters","Filters")}),c.jsx(ww,{fieldHeadingOverride:i("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedNumeratorFilter,wipFilters:a.wipNumeratorFilters,updateWipFilter:function(e,t,n){a.updateWipNumeratorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipNumeratorFilter(e,t).length&&l({numeratorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:i})]}),!1===s&&c.jsx(Qw,{onChange:function(){l({numeratorFilter:!0})}})]}),c.jsxs(Fw.Panel,{children:[c.jsxs(Ov,{as:"fieldset",marginBottom:u?void 0:0,children:[c.jsx(vm,{as:"legend",children:i("denominator","Denominator")}),c.jsx(Ny,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({denominator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.denominatorMeasure?[a.denominatorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:p})]}),u&&c.jsxs(Ov,{as:"fieldset",marginBottom:0,children:[c.jsx(vm,{as:"legend",children:i("Filters","Filters")}),c.jsx(ww,{fieldHeadingOverride:i("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedDenominatorFilter,wipFilters:a.wipDenominatorFilters,updateWipFilter:function(e,t,n){a.updateWipDenominatorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipDenominatorFilter(e,t).length&&l({denominatorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:i})]}),!1===u&&c.jsx(Qw,{onChange:function(){l({denominatorFilter:!0})}}),c.jsx(Xm,{testId:"percentage-advanced-options",showAccordionIcon:!0,title:i("advanced_options","Advanced Options"),children:c.jsx(Ov,{as:"fieldset",children:c.jsx(_f,{marginY:5,children:c.jsx(sy,{options:[{value:"all",label:i("denominator_scope_all_title","Across all groups"),description:i("denominator_scope_all_description","Denominator is calculated using all your data")},{value:"withinGrouping",label:i("denominator_scope_all_title","Within each group"),description:i("denominator_scope_within_group_description","Denominator is calculated using the data within each grouping")}],name:"start-check",label:i("denominator_scope_title","Scope"),selected:d||"all",direction:"row",onChange:function(e){return l({denominatorScope:e})}})})})})]})]}),c.jsx(_f,{marginTop:20,children:c.jsx(Vw,{children:c.jsxs(Ud,{justifyContent:"center",children:[c.jsx(Kw,Q({},a,{position:"numerator",dataSet:n,supportedAggregates:o.supportedAggregates})),c.jsx(_f,{children:c.jsx(_f,{as:"hr",border:"1px solid "+Ds(15),height:1})}),c.jsx(Kw,Q({},a,{position:"denominator",dataSet:n,supportedAggregates:o.supportedAggregates}))]})})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:i("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return a.handleUpsertPercentageField()},disabled:a.saveDisabled,children:a.isEditing?i("update","Update"):i("create","Create")})]})})]})},Kw=function(e){var t,n,r,i=e.numeratorMeasure,o=e.denominatorMeasure,a=e.position,l=e.dataSet,s=e.supportedAggregates,u=e.completedDenominatorFilter,d=e.completedNumeratorFilter,p=md().textOverride,f="",m="",h=[],v="numerator"===a&&$t(d)&&d[0].length>0;return o||"denominator"!==a?"numerator"!==a||v||i?("numerator"===a&&!i&&o&&(f=null==(t=s[o.function])?void 0:t.publicName,m=Yr(l,o.field).publicName,$t(u)&&u[0].length>0&&u[0].map(Xw(l,h))),"numerator"===a&&i&&(f=null==(n=s[i.function])?void 0:n.publicName,m=Yr(l,i.field).publicName),"denominator"===a&&o&&(f=null==(r=s[o.function])?void 0:r.publicName,m=Yr(l,o.field).publicName),v&&d[0].map(Xw(l,h)),"denominator"===a&&$t(u)&&u[0].length>0&&u[0].map(Xw(l,h)),c.jsxs(_f,{textAlign:"center",children:[f,"(",m,h.length?" | "+h.join(", "):"",")"]})):c.jsx(_f,{textAlign:"center",children:p("percentage_modal.numerator_required","Numerator required")}):c.jsx(_f,{textAlign:"center",children:p("percentage_modal.denominator_required","Denominator required")})};function Xw(e,t){return function(n){var r=Yr(e,n.field);t.push(r.publicName+" "+n.op+" “"+n.value+"“")}}var Qw=function(e){var t=md();return c.jsx(zf,{justifyContent:"space-between",children:c.jsx(Fh,{secondary:!0,onClick:function(){return e.onChange()},children:(0,t.textOverride)("add_filter_by","+ Filter by")})})},Jw=function(e){var t,n=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:n("are_you_sure","Are you sure?"),show:!0}),c.jsx(kv.Content,{children:c.jsx(_f,{paddingY:8,children:e.message})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{testId:"modal-cancel-delete-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:n("cancel","Cancel")}),c.jsx(Ch,{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:null!=(t=e.deleteButtonLabel)?t:n("delete","Delete")})]})})]})};function Zw(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(Sm,{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 $w=function(e){var t,n=md().textOverride,r=[{label:n("add","Add"),value:"+",testId:"simple-math-operator-add"},{label:n("subtract","Subtract"),value:"-"},{label:n("multiply","Multiply"),value:"*"},{label:n("divide","Divide"),value:"/"}];return c.jsx(Sm,{placeholder:n("select_operator","Operator..."),id:null!=(t=null==e?void 0:e.id)?t:"simple-math-operator",label:n("operator","Operator"),labelHidden:!0,onChange:function(t){null==e||e.onChange(t)},options:r,selected:e.mathOperator})},ej=function(e){var n=md().textOverride,r=function(e,n,r){var i=!!n,o=t.useState(Ew),a=o[0],l=o[1],s=function(){l(Ew)};return t.useEffect((function(){if(n)if(Vt(n)){var e=function(e){var t=e.rightFieldId,n=e.rightFunction,r=e.leftNested,i=e.rightNested,o=Lw({fieldId:e.leftFieldId,function:e.leftFunction}),a=Lw({fieldId:t,function:n});return r&&(o={left:o,operator:r.operator,right:Lw({fieldId:r.fieldId,function:r.function})}),i&&(a={left:a,operator:i.operator,right:Lw({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 Bt(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)]),Q({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:qt(),publicName:e,rightFieldId:r,operator:n,leftFieldId:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:ae({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(Q({},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=Rw(e.left),r=n.fieldId,i=n.function,o=n.nested,a=Rw(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:qt(),publicName:e,rightFieldId:i,rightFunction:o,operator:r,leftFieldId:t,leftFunction:n,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:ae({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(Q({},l,{id:i?n.id:l.id}))}},onChange:function(e){l(void 0!==e.mathType&&e.mathType!==a.mathType?Q({},a,e,{left:void 0,leftFieldId:void 0,right:void 0,rightFieldId:void 0}):Q({},a,e))},isEditing:!!n,disabled:Mw(a)})}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),i=r.leftFieldId,o=r.rightFieldId,a=r.operator,l=r.publicName,s=r.handleUpsertMathField,u=r.onChange,d=r.isEditing,p=r.mathType,f=r.right,m=r.left,h=r.disabled,v=r.reset,g={onlyFieldTypes:["number"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},b=Wr(e.dataSet.fields,g),x=function(e){var t=[],n=Br(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),y=function(t){return t?Yr(e.dataSet,t):void 0};return t.useEffect((function(){null!=e&&e.open&&!e.initialValue&&v()}),[null==e?void 0:e.open]),c.jsxs(kv,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("math",n)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{label:n("metric_name","Metric name"),id:"metric-name",placeholder:n("metric_name","Metric name"),value:l,onChange:function(e){return u({publicName:e.target.value})}})}),c.jsxs(Ov,{as:"fieldset",children:[c.jsx(vm,{as:"legend",children:"Calculation"}),e.allowAggregateMathsCustomField&&c.jsx(_f,{marginBottom:"1rem",children:c.jsx(sy,{options:x,name:"math-check",label:n("select_math_type","Select Math Type"),selected:p,locked:d,labelHidden:!0,onChange:function(e){return u({mathType:e})}})}),"simple"===p&&c.jsx(Fw.Panel,{children:c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Zw,{id:"metric-1",testId:"metric-1",label:n("metric_number","Metric [[metricNumber]]",{metricNumber:"1"}),onChange:function(e){return u({leftFieldId:null==e?void 0:e.id})},dataSetFields:b,value:y(i),labelHidden:!0})}),c.jsx(_f,{width:170,children:c.jsx($w,{mathOperator:a,onChange:function(e){return u({operator:e})}})}),c.jsx(_f,{flex:1,children:c.jsx(Zw,{id:"metric-2",testId:"metric-2",label:n("metric_number","Metric [[metricNumber]]",{metricNumber:"2"}),onChange:function(e){return u({rightFieldId:null==e?void 0:e.id})},dataSetFields:b.filter((function(e){return e.id!==i})),value:y(o),labelHidden:!0})})]})}),"aggregate"===p&&c.jsxs(t.Fragment,{children:[c.jsx(Fw.Panel,{children:c.jsxs(zf,{direction:"column",gap:"1rem",paddingY:"0.5rem",children:[c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"left-1",testId:"left-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return u(m&&Nw(m)?{left:Q({},m,{left:t[0]})}:{left:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:m&&zw(m)?[m]:null!=m&&m.left?[null==m?void 0:m.left]:[]},dataSet:e.dataSet,fieldFilterOptions:g},""+m)}),m&&!!Nw(m)&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{width:120,children:c.jsx($w,{mathOperator:m.operator,onChange:function(e){return u({left:Q({},m,{operator:e})})}})}),c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"right-1",testId:"right-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return u({left:Q({},m,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:null!=m&&m.right?[null==m?void 0:m.right]:[]},dataSet:e.dataSet,fieldFilterOptions:g})})]}),c.jsx(_f,{children:c.jsx(Bw,{onClick:function(){return u(qw(m,"left"))},state:m&&Nw(m)?"remove":"add"})})]}),c.jsx(zf,{justifyContent:"center",children:c.jsx(_f,{flex:1,marginRight:60,children:c.jsx($w,{mathOperator:a,onChange:function(e){return u({operator:e})},id:"operator-2"})})}),c.jsxs(zf,{direction:"row",gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"left-2",testId:"left-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return u(f&&Nw(f)?{right:Q({},f,{left:t[0]})}:{right:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f&&zw(f)?[f]:null!=f&&f.left?[null==f?void 0:f.left]:[]},dataSet:e.dataSet,fieldFilterOptions:g},""+f)}),f&&Nw(f)&&c.jsxs(t.Fragment,{children:[c.jsx(_f,{width:120,children:c.jsx($w,{mathOperator:f.operator,onChange:function(e){return u({right:Q({},f,{operator:e})})},id:"operator-2"})}),c.jsx(_f,{flex:1,children:c.jsx(Ny,{id:"right-2",testId:"right-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return u({right:Q({},f,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f.right?[f.right]:[]},dataSet:e.dataSet,fieldFilterOptions:g})})]}),c.jsx(_f,{children:c.jsx(Bw,{onClick:function(){u(qw(f,"right"))},state:f&&Nw(f)?"remove":"add"})})]})]})}),c.jsx(_f,{marginTop:20,children:c.jsx(Ww,{left:m,right:f,operator:a,dataSet:null==e?void 0:e.dataSet})})]})]})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:n("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return s()},disabled:h,children:d?n("update","Update"):n("create","Create")})]})})]})},tj=["round_to_0_dp","round_to_2_dp"],nj=function(e){var n=md(),r=n.mode,o=n.textOverride,a=function(e,n,r,o){var a=!!e,l=i.intersection(tj,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=Wr(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(Q({},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=Yr(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:qt(),publicName:e,fieldId:t,roundToDecimalPlaces:n,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:ae({dataType:"number"},r)}}(u,null==(t=p.dataSetField)?void 0:t.id,"round_to_0_dp"==p.transformationFunctionKey?0:2,n);o(Q({},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),l=a.isEditing,s=a.metricName,u=a.setMetricName,d=a.items,p=a.initValues,f=a.selected,m=a.setSelected,h=a.transformationFunctions,v=a.onCreateNewRoundedNumber;return c.jsxs(kv,{width:"xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("number_formatting",o)}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(jm,{id:"rounded-number-name",placeholder:o("metric_name","Metric name"),label:o("metric_name","Metric name"),value:s,onChange:function(e){return u(e.target.value)}})}),c.jsx(Ov,{children:c.jsx(xh,{testId:"select-rounded-number-field",mode:r,items:d,onDeleteItem:function(){return m({dataSetField:void 0,transformationFunctionKey:h[0]})},newItem:{callToAction:o("select_field_to_transform","Select field to transform"),onNew:function(e){return m({dataSetField:e,transformationFunctionKey:h[0]})},initValues:p,hide:!!f.dataSetField}})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return e.onClose()},secondary:!0,children:o("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){f.dataSetField&&v()},children:l?o("update","Update"):o("create","Create")})]})})]})},rj=function(e,t,n,r){var i=[],o=Br(t);return e.allowSimpleMathsCustomField&&o.supportedCustomFields.simpleMaths||e.allowAggregateMathsCustomField&&o.supportedCustomFields.aggregateMaths?i.push(Q({},Ow("math",r),{value:"math"})):(e.allowSimpleMathsCustomField||e.allowAggregateMathsCustomField||Fe("Simple math custom field not made available, because of a feature toggle."),o.supportedCustomFields.simpleMaths&&!o.supportedCustomFields.aggregateMaths||Fe("Simple math custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRoundedNumberCustomField&&o.supportedCustomFields.roundedNumbers?i.push(Q({},Ow("number_formatting",r),{value:"roundedNumber"})):(e.allowRoundedNumberCustomField||Fe("Rounded number custom field not made available, because of a feature toggle."),o.supportedCustomFields.roundedNumbers||Fe("Rounded number custom field not made available, because it is not supported for the view "+o.title+".")),e.allowPercentagesCustomField&&o.supportedCustomFields.percentages?i.push(Q({},Ow("percentage",r),{value:"percentage"})):(e.allowPercentagesCustomField||Fe("Percentage custom field not made available, because of a feature toggle."),o.supportedCustomFields.percentages||Fe("Percentage custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRulesCustomField&&o.supportedCustomFields.rules&&ln(n,"switchField")?i.push(Q({},Ow("rules-based_groups",r),{value:"rules"})):(e.allowRulesCustomField||Fe("Custom rules field not made available, because of a feature toggle."),o.supportedCustomFields.rules||Fe("Custom rules field not made available, because it is not supported for the view "+o.title+"."),ln(n,"switchField")||Fe("Custom rules field not made available, because it is not supported by the current query engine.")),i},ij=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=md().textOverride,m=Aw(r.rule,i,a.supportedAggregates),h=m.completedFilters,v=m.wipFilters,g=m.addOrFilter,b=m.deleteWipFilter,x=m.updateWipFilter;t.useEffect((function(){var e={name:d,rule:h};o.isEqual(r,e)||l(e)}),[h,d]);var y=f("rule_title","Rule [[ruleNumber]]",{ruleNumber:n+1})+(r.name?": "+r.name:"");return c.jsx(_f,{as:"fieldset",children:c.jsxs(zf,{gap:"0.5rem",paddingBottom:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.1rem",direction:"column",children:[c.jsx(Fw.Title,{title:y}),c.jsx(_f,{children:c.jsx(jm,{id:"rules-name-"+n,label:f("field_value","Field Value"),value:null==r?void 0:r.name,onChange:function(e){return p(e.target.value)}})}),c.jsx(_f,{children:c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(_f,{children:c.jsx(ww,{wipFilters:v,completedFilters:h,dataSet:i,updateWipFilter:x,queryEngineConfig:a,deleteWipFilter:b,textOverride:f})}),c.jsx(_f,{children:c.jsxs(zf,{justifyContent:"space-between",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return g()},children:f("add_or_filter","Add `OR`")}),0!==n&&c.jsx(Fh,{secondary:!0,onClick:function(){return s()},children:f("delete_rule","Delete Rule")})]})})]})})]})})},oj=function(e){var t,n=sj(e.initialValue),r=n.draft,i=n.updateDraftTitle,o=n.addNewRule,a=n.updateDraftRules,l=n.removeDraftRule,s=md().textOverride;return c.jsxs(kv,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(kv.Header,{title:Pw("rules-based_groups",s)}),c.jsxs(kv.Content,{scrollable:!0,children:[c.jsx(Ov,{children:c.jsx(jm,{id:"rules-name",label:s("metric_name","Metric name"),value:null==r?void 0:r.publicName,onChange:function(e){return i(e.target.value)}})}),c.jsx(Ov,{children:c.jsx(Ud,{gap:"0.75rem",role:"list",children:null==r||null==(t=r.rules)?void 0:t.map((function(t,n){return c.jsx(oy,{transform:!1,children:c.jsx(ij,{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(kv.Footer,{buttons:"space-between",children:[c.jsx(Dv,{children:c.jsx(Fh,{onClick:function(){return o()},secondary:!0,children:s("add_rule","Add Rule")})}),c.jsxs(Dv,{buttons:"end",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return function(){if(r.publicName&&r.rules){var t=(n=r.publicName,i=r.rules,o=e.queryEngineConfig,{id:qt(),publicName:n,rules:i,dataType:"string",canBeDimension:!0,canBeMeasure:!0,allowedOperators:ae({dataType:"string"},o)});e.onCreateNewRules(e.initialValue?Q({},t,{id:e.initialValue.id}):t)}var n,i,o}()},children:e.initialValue?s("update","Update"):s("create","Create")})]})]})]})},aj={name:"",rule:[]},lj={publicName:"",rules:[aj]},sj=function(e){var n=t.useState(lj),r=n[0],i=n[1];return t.useEffect((function(){i(e||lj)}),[JSON.stringify(e)]),{draft:r,updateDraftTitle:function(e){i(Q({},r,{publicName:e}))},addNewRule:function(){var e,t=[].concat(null!=(e=null==r?void 0:r.rules)?e:[]);t.push(aj),i(Q({},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(Q({},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(Q({},r,{rules:n}))}}},uj=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){Fe("Failed to auto-scroll.")}}),50)},dj=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)})),r=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:r("fields_being_used","Fields Being Used"),show:!0}),c.jsx(kv.Content,{children:c.jsxs(_f,{paddingY:8,children:[r("fields_being_used_description","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(kv.Footer,{buttons:"end",children:c.jsx(Dv,{children:c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},children:r("close","Close")})})})]})},cj=function(e){var n,r=md(),i=r.mode,o=r.featureToggles,a=r.textOverride,l=Vr(e.dataSets,e.dataSetId);if(!l)return console.warn("Data set must be found for custom field input to render."),null;var s=t.useState(null),u=s[0],d=s[1],p=t.useState(void 0),f=p[0],m=p[1],h=t.useState(null),v=h[0],g=h[1],b=rj(o,e.componentType,null==e?void 0:e.queryEngineConfig,a),x=Xr(l,e.componentType),y=Xr(l),w=[].concat(x).map((function(e){return{title:e.publicName,subtext:pj(e,a),onClick:function(){return d({customFieldCategory:Ut(e),customField:e})}}})),j=function(t){var n=Vr(e.dataSets,e.dataSetId);if(!n)throw a("cannot_find_data_set","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 Q({},e,{fields:n?r:[].concat(r,[t])})}(n,t),i=Jr(e.dataSets,r);e.setDataSets(i),d(null)};return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:i,newItem:{callToAction:a("add_custom_metric","Add custom metric"),onNew:function(e){d({customFieldCategory:e,customField:void 0})},initValues:b,onOpenDropdown:function(){uj("bottom","editor-panel")}},items:w,onDeleteItem:function(e){var t=x[e],n=function(e,t){return e.reduce((function(e,n){var r,i;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&&(null==(r=n.numeratorFilter)?void 0:r.some((function(e){return e.some((function(e){return e.field===t.id}))})))&&e.push(n.id),"denominatorFilter"in n&&(null==(i=n.denominatorFilter)?void 0:i.some((function(e){return e.some((function(e){return e.field===t.id}))})))&&e.push(n.id),e}),[])}(y,t);n.length>0?m(n):g(t)},testId:"custom-metric-input"}),c.jsx(Gw,{dataSet:l,onNewCustomField:j,isOpen:"percentage"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==u?void 0:u.customField}),c.jsx(ej,{open:"math"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},dataSet:l,onNewCustomField:j,queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==u?void 0:u.customField,allowAggregateMathsCustomField:o.allowAggregateMathsCustomField}),c.jsx(oj,{open:"rules"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},data:l,queryEngineConfig:e.queryEngineConfig,onCreateNewRules:j,initialValue:null==u?void 0:u.customField}),c.jsx(nj,{open:"roundedNumber"===(null==u?void 0:u.customFieldCategory),onClose:function(){return d(null)},dataSet:l,queryEngineConfig:e.queryEngineConfig,onNewCustomField:j,initialValue:null==u?void 0:u.customField}),c.jsx(Jw,{message:a("delete_custom_metric","This will permanently remove the custom field [[nameOfCustomMetric]] from all views on the dashboard, not just this view. Are you sure you want to continue?",{nameOfCustomMetric:null!=(n=null==v?void 0:v.publicName)?n:""}),onClose:function(t){if(t&&v){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),Q({},e,{fields:r})):Q({},e,{fields:r})}(l,v.id),r=Jr(e.dataSets,n);e.setDataSets(r)}g(null)},show:null!=v}),c.jsx(dj,{onClose:function(){return m(void 0)},show:null!=f&&f.length>0,fieldsUsedModal:f,customFields:y})]})};function pj(e,t){return Bt(e)||Vt(e)?Ow("math",t).title:Ht(e)?Ow("percentage",t).title:Yt(e)?Ow("rules-based_groups",t).title:""}var fj=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"==Yr(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=md(),w=mj(h,m,o,v),j=vj(h,r,m,o,v),C=hj(r,a,f,h);return c.jsxs(t.Fragment,{children:[c.jsx(xh,{testId:null!=(n=null==e?void 0:e.testId)?n:"field-collector-input",mode:y.mode,onOrderChange:function(e,t){var n=Iy([].concat(h),e,t);v(n)},onDeleteItem:r.preAggregated?void 0:function(e){var t=h[e],n=Yr(r,h[e].field);Ey(l,"date_time"===n.dataType&&"function"in t?{field:t.field,truncate:t.function}:t)?x(!0):v(es(h,e))},items:j,newItem:{callToAction:d||y.textOverride("add_field","Add field"),onNew:w,initValues:C,hide:!!e.dataSet.preAggregated||!!p&&h.length>=p}}),b&&c.jsx(Oy,{onClose:function(){return x(!1)}})]})};function mj(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||Ht(i)||Vt(i)?{field:i.id,function:"none"}:{field:i.id,function:Pe(i,n.supportedAggregates)[0]},r([].concat(a,[o]))}}function hj(e,t,n,r){var i=Wr(e.fields,t);return n&&(i=Le(i,[].concat(r))),i.map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}))}function vj(e,t,n,r,o){return[].concat(e).map((function(a,l){var s=Yr(t,a.field),u=[];"metric"==n?u=Pe(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=!Ht(s),c=!Vt(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 gj={name:"iaoxbn",styles:"display:grid;width:100%;grid-template-columns:repeat(2, minmax(0, 1fr))"},bj={name:"1flj9lk",styles:"text-align:left"},xj={name:"gdaplf",styles:"width:100%;text-align:right"},yj={name:"1gqeage",styles:"margin-right:0.75rem"},wj=function(e){var n=md(),r=n.mode,o=n.queryEngineConfig,a=e.textOverride,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 Yr(t,e.field).publicName}))}));return i.uniq(n)}(e.attributes.filter,l),f=i.isEmpty(e.attributes.filter)?[]:[{title:a("filter_list_title","[[filterCount]] {{condition}}",{condition:{plural:"conditions",singular:"condition",count:e.attributes.filter.length},filterCount:e.attributes.filter.length}),subtext:a("filter_list_subtext","{{acrossFields}} [[fields]].",{acrossFields:{count:p.length,singular:"On the field",plural:"Across fields"},fields:be(p)}),onClick:function(){return d(!0)}}],m={callToAction:a("add_filter","Add filter"),onClick:function(){d(!0)}},h=Aw(e.attributes.filter,l,o.supportedAggregates),v=h.completedFilters,g=h.addOrFilter,b=h.wipFilters,x=h.updateWipFilter,y=h.deleteWipFilter;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:r,newItemBtn:i.isEmpty(f)?m:void 0,onDeleteItem:function(){e.setPartialAttributes({filter:[]})},items:f}),c.jsxs(kv,{width:"4xl",isOpen:u,onClose:function(){return d(!1)},children:[c.jsx(kv.Header,{title:a("advanced_filters","Advanced Filters")}),c.jsx(kv.Content,{children:c.jsx(ww,{queryEngineConfig:o,updateWipFilter:x,deleteWipFilter:y,wipFilters:b,completedFilters:v,dataSet:l,textOverride:a})}),c.jsx(kv.Footer,{children:c.jsxs("div",{css:gj,children:[c.jsx("div",{css:bj,children:c.jsx(Fh,{testId:"add-rule-btn",secondary:!0,onClick:function(){g()},children:0==v.length?a("add_filter","Add filter"):a("add_or_filter","Add `OR`")})}),c.jsx("div",{children:c.jsxs("div",{css:xj,children:[c.jsx("span",{css:yj,children:c.jsx(Fh,{secondary:!0,onClick:function(){d(!1)},children:a("cancel","Cancel")})}),c.jsx(Fh,{testId:"save-filter-btn",onClick:function(){e.setPartialAttributes({filter:v}),d(!1)},children:a("save","Save")})]})})]})})]})]})},jj={name:"12vm4ss",styles:"margin-left:0.75rem;opacity:0.4;:hover{opacity:0.8;}"},Cj=function(e){return c.jsxs("div",{children:[c.jsxs("div",{children:[c.jsx(vm,{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:jj,children:c.jsx("button",{onClick:function(){var t;return null==(t=e.secondaryAction)?void 0:t.onClick()},children:e.secondaryAction.label})})]}),c.jsx(jm,{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})]})},Sj=function(e){var t,n,r=e.component,i=e.definedMetric,o=e.measure,a=_t(i),l=Yr(null==e?void 0:e.dataSet,i.field),s=md(),u=s.queryEngineConfig,d=s.textOverride,p=s.labelFormat,f=gs(l.publicName,null==(t=u.supportedAggregates[i.function])?void 0:t.publicName),m=p({fieldId:i.field,func:i.function,type:r.attributes.type,defaultLabel:f,viewId:null!=(n=r.attributes.viewId)?n:""});return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:l.dataType})," ",c.jsx("span",{children:null!=m?m:f})]})}),c.jsx(Ny,Q({},e,{attributes:{measure:o?o[a]:[]},dataSet:null==e?void 0:e.dataSet,componentType:r.attributes.type,allowsMultiple:!0,onNewMeasureFilterAggregate:kj(e.definedMetrics,u),setPartialAttributes:function(t){var n;e.setAttributes(((n={})[a]=t.measure,n))},supportedAggregates:u.supportedAggregates,id:"metric-input",propKey:"measure",filterOptions:function(t){return Fj(t,null==e?void 0:e.definedMetrics)},label:d("add_alternative_metric","Add alternative metric")}))]})},Fj=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),Q({},e,{select:Q({},e.select,{options:r,selected:i})})}))};function kj(e,t){return function(n){var r=e.filter((function(e){return e.field===n.id})),i=Q({},t.supportedAggregates);return r.forEach((function(e){delete i[e.function]})),i}}var _j=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},Tj=function(e,t,n){var r=Me(t,n);return e.filter((function(e){return e.field===(null==r?void 0:r.field)&&e.function===r.function}))[0]},Aj=function(e){var t=e.group,n=e.definedDimension,r=_j(n),i=Yr(null==e?void 0:e.dataSet,n.field),o=t?t[r]:null,a=md(),l=a.queryEngineConfig,s=a.textOverride;return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:i.dataType})," ",c.jsx("span",{children:i.publicName})]})}),c.jsx(My,Q({},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:l.supportedTransformationFunctions,filterOptions:function(e){return e},label:s("add_alternative_group","Add alternative group")}))]})},Dj=function(e){var t=e.group,n=e.definedDimension,r=jt(n),i=Yr(null==e?void 0:e.dataSet,null==e?void 0:e.definedDimension.field),o=md(),a=o.queryEngineConfig,l=o.textOverride,s=t?t[r]:null;return c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(vm,{as:"p",margin:0,children:c.jsxs(zf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(Uf,{icon:i.dataType})," ",c.jsxs("span",{children:[i.publicName," (",n.truncate,")"]})]})}),c.jsx(Ry,Q({},e,{attributes:{timeDimensions:s||null},supportedTimeDimensions:a.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&e.setAttributes(((n={})[r]=t.timeDimensions,n))},onNewMeasureFilterTruncFunctions:function(t){var r=Q({},a.supportedTimeTruncFunctions);return t.id===(null==e?void 0:e.definedDimension.field)&&delete r[n.truncate],r},label:l("add_alternative_time_group","Add alternative time group")}))]})},Ij=function(e){var t=(null==e?void 0:e.component).attributes,n=md().featureToggles,r=Rm().dispatch;return null!=e&&e.show?0==function(e,t){var n=[],r=Br(t);return e.parameters&&r.supportedFeatures.parameters?n.push({title:"Parameter",subtext:"Set customisable Parameters on Views"}):(e.parameters||Fe("Parameters not made available, because of a feature toggle."),r.supportedFeatures.parameters||Fe("Parameters not made available, because it is not supported for the view "+r.title+".")),n}(n,t.type).length?null:c.jsx(Oj,Q({},e,{onAddingParameters:function(n){var i=Q({},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},Oj=function(e){var n=(null==e?void 0:e.component).attributes,r=md().textOverride,i=Rm(),a=La(i.dashboard,e.component.attributes.dataSetId);if(!a)return null;var l=function(e,n,r){var i=md().queryEngineConfig,a=t.useState(Fy),l=a[0],s=a[1],u=function(){s(Fy)},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,j="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?Tt(i,{supportedAggregates:e,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}):t}))}(i.supportedAggregates,e.measure,e.parameters):[],C="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=Ct(i,e);return null!=o?o:t}return t}(i.supportedTimeTruncFunctions,e.timeDimension,e.parameters):void 0;return Q({},l,{definedMetrics:j,definedDimensions:C,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=Q({},e.measure),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:Q({},e,{measure:r}),metricKeyToDelete:i}}(Q({},l),t.measure),o=n.updatedMetrics,a=n.metricKeyToDelete;a&&function(t){if("measure"in e&&t&&l.measure){var n=Tt(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=Q({},e.group),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:Q({},e,{group:r}),metricKeyToDelete:i}}(Q({},l),t.group),d=u.updatedMetrics,c=u.metricKeyToDelete;c&&function(t){if("parameters"in e&&t&&l.group){var n=Ct(t,i.supportedTimeTruncFunctions);n&&r({updatedTimeDimension:n}),"dimension"in e&&!n&&r({updatedDimension:_y(t,e.dimension,l.group)})}}(c),s(d)}},handleUpsert:function(){n(l)},reset:u,disabled:ky(l,d)})}(n,null==e?void 0:e.onAddingParameters,e.setParameterUpdate),s=l.definedMetrics,u=l.onChange,d=l.measure,p=l.handleUpsert,f=l.definedDimensions,m=l.definedTimeDimension,h=l.group;return c.jsxs(kv,{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(kv.Header,{title:r("add_parameters","Add Parameters"),show:!0,tooltip:r("add_parameters_tooltip","Set alternate metrics and groups for the view.")}),c.jsx(kv.Content,{children:c.jsx(zf,{width:"100%",children:c.jsx(_f,{flex:1,children:c.jsxs(Av.Group,{defaultIndex:0,children:[(m||0!==f.length)&&c.jsxs(Av.List,{columns:"1fr 1fr",padding:0,children:[c.jsx(Av.Button,{children:r("add_parameter_metrics","Metrics")}),c.jsx(Av.Button,{children:r("add_parameter_groups","Groups")})]}),c.jsxs(Av.Panels,{children:[c.jsxs(Av.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(fv,{marginBottom:2,children:r("current_active_metrics","Current active metrics")}),c.jsx(zf,{direction:"column",gap:"1.5rem",children:null==s?void 0:s.map((function(t){return c.jsx(Sj,{component:null==e?void 0:e.component,definedMetric:t,definedMetrics:s,dataSet:a,setAttributes:function(e){return u({measure:e})},measure:d},t.field+"-"+t.function)}))})]}),c.jsxs(Av.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(fv,{marginBottom:2,children:r("current_active_groups","Current active groups")}),c.jsxs(zf,{direction:"column",gap:"1.5rem",children:[f.map((function(t){return c.jsx(Aj,{setAttributes:function(e){return u({group:e})},component:null==e?void 0:e.component,definedDimension:t,dataSet:a,group:h},""+t.field)})),m&&c.jsx(Dj,{definedDimension:m,setAttributes:function(e){return u({group:e})},dataSet:a,group:h})]})]})]})]})})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:r("close","Close")}),c.jsx(Ch,{onClick:function(){return p()},primary:!0,children:r("update","Update")})]})})]})},Pj=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,renderDateTimeRangeInput:e.renderDateTimeRangeInput||null,renderDateTimeInput:e.renderDateTimeInput||null,renderReportIcon:e.renderReportIcon||null,renderSendIcon:e.renderSendIcon||null,renderUserIcon:e.renderUserIcon||null,renderAIChatIcon:e.renderAIChatIcon||null,renderAIIcon:e.renderAIIcon||null,renderThumbsUpUnselectedIcon:e.renderThumbsUpUnselectedIcon||null,renderThumbsUpSelectedIcon:e.renderThumbsUpSelectedIcon||null,renderThumbsDownUnselectedIcon:e.renderThumbsDownUnselectedIcon||null,renderThumbsDownSelectedIcon:e.renderThumbsDownSelectedIcon||null,renderSelectIcon:e.renderSelectIcon||null,renderBackButtonArrowIcon:e.renderBackButtonArrowIcon||null,renderStopIcon:e.renderStopIcon||null}},Ej=function(e){var t=md().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(ov,{})}return c.jsx(n.Component,{})},Mj=t.memo((function(e){var n,r,i,o,a,l=md(),u=l.textOverride,d=l.labelFormat,p=e.displayTitle,f=e.displaySubject,m=Bb({title:p,subject:f}),h=Xd(),v={displayTitle:p,displaySubject:f,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,viewId:null!=(r=e.viewId)?r:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(e.lineResult)||ds(e.barResult))return c.jsx(nm,{});if(cs(e.lineResult)&&cs(e.barResult))return c.jsx(iv,{});var g,b,x=qb({dimension:e.barDimension,timeDimension:e.timeDimension}),y=e.barResult?ls(x,e.barMeasure,e.barResult):[],w=e.barResult?as(e.barResult,e.barMeasure,x,"100%"==e.stacked):[],j=qb({dimension:e.lineDimension,timeDimension:e.timeDimension}),C=e.lineResult?ls(j,e.lineMeasure,e.lineResult):[],S=e.lineResult?as(e.lineResult,e.lineMeasure,j,"100%"==e.stacked):[];return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},v)),c.jsx(lu,{disabledFeatures:null!=(i=null==e?void 0:e.library)&&i,children:c.jsx(qx,{ref:m,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,formatYAxisLabel:Ss(u,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:Cs(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:Wb(null==e?void 0:e.legend,"verbose"===(null==h?void 0:h.detail)),x:"x",bars:{colors:di(null==h?void 0:h.colors,y.length),data:w,annotate:[],stacked:!!e.stacked,keys:y,styles:null==h||null==(o=h.charts)?void 0:o.barChart,formatter:function(t,n){if(e.conditionalFormattingRules&&e.conditionalFormattingRules.bar){var r=js(e.barDimension,e.conditionalFormattingRules.bar,t,n,null==e?void 0:e.dataSet);return r?r.value:void 0}}},lines:{colors:(g=di(null==h?void 0:h.colors,C.length),void 0===b&&(b=1),[].concat(g).map((function(e){return function(e,t,n){return s(e).darken(t).hex()}(e,b)}))),data:S,annotate:[],keys:C,threshold:fx(null==(a=e.conditionalFormattingRules)?void 0:a.line)},removeStroke:!1,theme:null==h?void 0:h.charts,formatSeriesName:function(t){var n,r,i=e.barResult&&Fs(e.barResult,u,e.type,null!=(n=e.viewId)?n:"",d)(t),o=e.lineResult&&Fs(e.lineResult,u,e.type,null!=(r=e.viewId)?r:"",d)(t);return i||o||""},sparkline:e.sm,onClick:function(){},goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix})})]})})}),xs),Rj=function(e){var t=e.component,n=t.results,r=t.attributes,i=t.localFilters,o=Rm().dashboard,a=Vb(r,e.runQueriesCallback,e.setResults,{localFilters:i,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(Mj,Q({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,idPrefix:e.idPrefix}))},Lj=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,viewId:e.id},s=Bb({title:e.displayTitle,subject:e.displaySubject});if(!Br("mercatorMap").isRunnable(e))return c.jsx(rv,{title:"Missing parameters"});if(ds(r))return c.jsx(nm,{});if(cs(r))return c.jsx(iv,{});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==_t(p)}));r.content.forEach((function(e){u[e[f]]=e[m]}))}var h=ui([i,o],((null==r?void 0:r.content.length)||100)/4);return c.jsx(t.Suspense,{fallback:c.jsx(nm,{}),children:c.jsxs(yh,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Pg,Q({},l)),c.jsx(Jx,{ref:s,formatValue:function(t){return ks(Jl(t,2),e.numberFormatOptions,e.labelFormat)},topology:"worldCountries",data:u,background:e.backgroundColor,colorRange:h,missingDataColor:a,position:e.position,onPositionChange:e.onPositionChange})]})})},Nj=function(e){var t=e.component,n=t.results,r=t.attributes,i=Vb(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Lj,Q({},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}))},zj=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Tx(i,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return 0===e.cellWidth?null:c.jsx(sx,Q({},i,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:r,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,viewFor:"standalone"}))};function qj(e){return e>0}function Bj(e){return e.total>=e.limit}function Wj(e,t){return(e||0)+(t||TC.limit)}function Vj(e,t){if(void 0!==e||void 0!==t)return(e||0)-(t||TC.limit)}var Hj=As(Q({minWidth:"100%",overflow:"overlay"},Ef)),Yj=Object.assign((function(){return null}),{table:As({textIndent:"0",borderColor:"inherit",borderCollapse:"collapse",tableLayout:"fixed"}),wrapper:Hj,th:function(e){var t,n,r,i,o,a,l,s;return As({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:{lastGroupColumn:{true:{borderRight:null!=(t=null==e||null==(n=e.row)?void 0:n.borderRight)?t:null==e?void 0:e.borderRight}},firstGroupColumn:{true:{borderLeft:null==e||null==(r=e.row)?void 0:r.borderLeft}},first:{true:{borderLeft:null==e||null==(i=e.first)?void 0:i.borderLeft}},last:{true:{borderRight:null==e||null==(o=e.last)?void 0:o.borderRight}},rowScope:{true:{background:null==e||null==(a=e.column)?void 0:a.background}},hover:{true:{"&:hover":{color:null==e||null==(l=e["&:hover"])?void 0:l.color,background:null==e||null==(s=e["&:hover"])?void 0:s.background}}}}})},td:function(e){var t,n,r,i,o,a,l;return As({verticalAlign:"top",overflow:"hidden",position:"relative",whiteSpace:"nowrap",borderLeft:null==e||null==(t=e.body)||null==(t=t.cells)?void 0:t.borderLeft,borderRight:null==e||null==(n=e.body)||null==(n=n.cells)?void 0:n.borderRight,borderBottom:null==e||null==(r=e.body)||null==(r=r.cells)?void 0:r.borderBottom,fontSize:null==e||null==(i=e.body)||null==(i=i.cells)?void 0:i.fontSize,padding:null==e||null==(o=e.body)||null==(o=o.cells)?void 0:o.padding,variants:{first:{true:{borderLeft:null==e||null==(a=e.body)?void 0:a.borderLeft}},last:{true:{borderRight:null==e||null==(l=e.body)?void 0:l.borderRight}},align:{alignLeft:{textAlign:"left"},alignRight:{textAlign:"right"}}}})},tr:function(e){var t,n,r,i,o,a,l,s;return As({position:"relative",cursor:"default",variants:{even:{true:{background:null==e||null==(t=e.body)||null==(t=t.even)?void 0:t.background,color:null==e||null==(n=e.body)||null==(n=n.even)?void 0:n.color,"&:hover":{background:null==e||null==(r=e.body)||null==(r=r.even)||null==(r=r["&:hover"])?void 0:r.background,color:null==e||null==(i=e.body)||null==(i=i.even)||null==(i=i["&:hover"])?void 0:i.color}}},odd:{true:{background:null==e||null==(o=e.body)||null==(o=o.odd)?void 0:o.background,color:null==e||null==(a=e.body)||null==(a=a.odd)?void 0:a.color,"&:hover":{background:null==e||null==(l=e.body)||null==(l=l.odd)||null==(l=l["&:hover"])?void 0:l.background,color:null==e||null==(s=e.body)||null==(s=s.odd)||null==(s=s["&:hover"])?void 0:s.color}}}}})},showMoreButton:function(e){var t;return As(Q({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},Ts,{"&:hover":Q({},Ts,{opacity:.5}),"> svg":{marginTop:-2},"> span":{height:10,lineHeight:"1px",display:"block"}}))},tdContentWrapper:function(e){return As({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip","> span":{fontSize:null!=e?e:"inherit"}})},thInner:function(e){var t,n;return As({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 As({textTransform:null==e?void 0:e.textTransform})},thButton:function(){return As({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;return As(Q({display:"table-cell",position:"relative",fontWeight:null==e||null==(t=e.th)||null==(t=t.group)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.th)||null==(n=n.group)?void 0:n.fontSize,background:null==e||null==(r=e.th)||null==(r=r.column)?void 0:r.background,textTransform:null==e||null==(i=e.th)||null==(i=i.group)?void 0:i.textTransform,color:null==e||null==(o=e.th)||null==(o=o.column)?void 0:o.color,whiteSpace:"nowrap",textAlign:"left",borderRight:null==e||null==(a=e.th)||null==(a=a.column)?void 0:a.borderRight,borderLeft:null==e||null==(l=e.th)||null==(l=l.column)?void 0:l.borderLeft,borderBottom:null==e||null==(s=e.body)||null==(s=s.cells)?void 0:s.borderBottom,padding:null==e||null==(u=e.th)||null==(u=u.column)?void 0:u.padding},Ts,{variants:{first:{true:{borderLeft:null==e||null==(d=e.body)?void 0:d.borderLeft}},last:{true:{borderRight:null==e||null==(c=e.body)?void 0:c.borderRight}},deadSpace:{true:{borderBottom:null==e||null==(p=e.th)||null==(p=p.row)?void 0:p.borderBottom,borderRight:0,borderLeft:null==e||null==(f=e.th)||null==(f=f.column)?void 0:f.borderLeft}},level:{2:{background:null==e||null==(m=e.th)||null==(m=m.level)?void 0:m[2].background}}}}))},thGroupColumn:function(e,t){var n,r,i,o,a,l,s,u,d,c,p;return As(Q({display:"table-cell",position:"relative",fontWeight:null==e||null==(n=e.group)?void 0:n.fontWeight,fontSize:null==e||null==(r=e.group)?void 0:r.fontSize,textTransform:null==e||null==(i=e.group)?void 0:i.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:t?null==e?void 0:e.borderRight:null!=(o=null==e||null==(a=e.row)?void 0:a.borderRight)?o:null==e?void 0:e.borderRight,borderLeft:null==e?void 0:e.borderRight,borderBottom:null==e||null==(l=e.row)?void 0:l.borderBottom,padding:null==e||null==(s=e.row)?void 0:s.padding},Ts,{variants:{first:{true:{borderLeft:null==e||null==(u=e.first)?void 0:u.borderLeft}},last:{true:{borderRight:null==e||null==(d=e.last)?void 0:d.borderRight}},hover:{true:{"&:hover":Q({},Ts,{color:null==e||null==(c=e["&:hover"])?void 0:c.color,background:null==e||null==(p=e["&:hover"])?void 0:p.background})}}}}))}}),Uj=As({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),Gj=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:""+Kj,ref:f,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)},children:c.jsx("span",{className:""+Xj({onHover:p.isDragging||s?"true":"false"})})})},Kj=As({position:"absolute",right:-8,top:0,bottom:0,width:16,zIndex:1,cursor:"ew-resize"}),Xj=As({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:Ms.colors.blue},false:{borderRightColor:"transparent"}}}}),Qj=t.forwardRef((function(e,t){return c.jsx("div",{ref:t,className:"vizzly-data-table "+Yj.wrapper,children:c.jsx("table",{className:""+Yj.table,children:e.children})})})),Jj={name:"1pghby6",styles:"position:relative;box-sizing:border-box"},Zj=t.forwardRef((function(e,n){var r,i,o=e.clickEnabled,a=Xd(),l={first:e.first&&"true",last:e.last&&"true",hover:e.hover&&"true",level:null==e?void 0:e.level},s=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]),u=t.useMemo((function(){var t,n;return e.group?"row"===e.scope?Yj.thGroupRow(null==a?void 0:a.tables)(Q({},l,{deadSpace:null!=e&&e.deadSpace?"true":void 0})):Yj.thGroupColumn(null==a||null==(t=a.tables)?void 0:t.th,!(null!=e&&e.lastGroupColumn)&&(null==e?void 0:e.deadSpace))(l):Yj.th(null==a||null==(n=a.tables)?void 0:n.th)(Q({},l,{rowScope:"row"===(null==e?void 0:e.scope)?"true":void 0,lastGroupColumn:null!=e&&e.lastGroupColumn&&!e.last?"true":void 0,firstGroupColumn:null==e||!e.firstGroupColumn||e.last||e.first?void 0:"true"}))}),[e.group,e.scope,null==e?void 0:e.deadSpace,null==e?void 0:e.level]);return c.jsxs("th",{scope:null!=(r=null==e?void 0:e.scope)?r:"column",className:u,style:e.cellStyles,"data-themeapi":s,"data-chipposition":"top.left","data-group":e.group?"true":"false","data-first":e.first?"true":"false","data-last":e.last?"true":"false","data-hover":e.hover?"true":"false","data-deadspace":e.deadSpace?"true":"false","data-lastgroupcolumn":e.lastGroupColumn?"true":"false","data-firstgroupcolumn":e.firstGroupColumn?"true":"false",colSpan:e.colSpan,role:o?"button":void 0,tabIndex:o?0:void 0,"data-clickenabled":o?"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(Gj,Q({},null==e?void 0:e.dragSettings)),c.jsx("div",{css:Jj,style:e.columnStyles,children:c.jsx("div",{className:""+Yj.thInner(null==a||null==(i=a.tables)?void 0:i.th),ref:n,"data-themeapi":"tables.th.inner",children:c.jsxs(zf,{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(um,Q({},e.expand,{label:null!=e&&e.expand.expanded?"Collapse "+(null==e?void 0:e.expand.label):"Expand "+e.expand.label,arrowStart:"side"})),e.children]})})})]})})),$j={name:"1flj9lk",styles:"text-align:left"},eC={name:"6r56vi",styles:"height:1rem;width:1rem"},tC=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]);return Xd(),c.jsxs(t.Fragment,{children:[c.jsx("button",{onClick:function(){return e.onChange&&e.onChange()},css:$j,ref:l,className:Hd(a?""+Uj:void 0,""+tu.button,""+Yj.thButton()),"data-testid":e.testIdPrefix+"-title",children:a?c.jsx(ih,{placement:"bottom-start",tooltipContent:function(){return c.jsx(ih.Content,{children:o})},className:""+Uj,modifiers:[{name:"offset",options:{offset:[-50,10]}}],showTooltip:e.showTooltip,children:c.jsx(nC,{children:o})}):c.jsx(nC,{children:o})}),e.onSort&&c.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:""+tu.button,"aria-label":null!=(r=e.sortLabel)?r:"Sort",css:eC,"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,{})]})]})})),nC=function(e){var t,n=Xd();return c.jsx("span",{className:""+Yj.thLabel(null==n||null==(t=n.tables)?void 0:t.th),children:e.children})},rC={name:"agbev0",styles:"min-width:100%;overflow:scroll;border-bottom-width:1px"},iC=Object.assign((function(){return null}),{Wrapper:Qj,Head:function(e){return c.jsx("thead",{children:e.children})},Body:function(e){return c.jsx("tbody",{css:rC,children:e.children})},TR:function(e){var t,n=Xd();return c.jsx("tr",{"data-themeapi":e.odd?"tables.body.odd":"tables.body.even",className:""+Yj.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=Xd(),u=n.useState(!1),d=u[0],p=u[1],f=e.clickEnabled,m=e.first,h=t.useRef(null),g=null!=(r=e.showMoreLabel)?r:"Show more";return t.useEffect((function(){var t,n,r=h.current;"number"==typeof(null==(t=e.style)?void 0:t.width)&&r&&p((null==(n=e.style)?void 0:n.width)<r.offsetWidth+16)}),[h.current,null==(i=e.style)?void 0:i.width]),c.jsxs("td",{style:Q({},e.style),className:""+Yj.td(null==s?void 0:s.tables)({first:e.first&&"true",last:e.last&&"true",align:null!=(o=e.align)?o:"alignRight"}),role:f?"button":void 0,tabIndex:f?0:void 0,"data-clickenabled":f?"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":m?"true":"false","data-last":e.last?"true":"false",children:[c.jsx("div",{className:""+Yj.tdContentWrapper(null==s||null==(a=s.tables)||null==(a=a.body)||null==(a=a.cells)?void 0:a.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}}(d),children:c.jsx("span",{ref:h,children:e.children})}),d&&c.jsx("button",{"aria-label":"string"==typeof e.children?g+": "+e.children:g,onClick:function(){return e.onShowMore&&e.onShowMore()},className:""+Yj.showMoreButton(null==s||null==(l=s.tables)?void 0:l.body),children:c.jsx(v.DotsHorizontalIcon,{})})]})},TH:Zj,THButton:tC,THLabel:nC,HeadTR:function(e){return c.jsx("tr",{children:e.children})}}),oC=Object.assign(iC.Wrapper,{Wrapper:iC.Wrapper,Head:iC.Head,Body:iC.Body,TR:iC.TR,TD:iC.TD,TH:iC.TH,THLabel:iC.THLabel,THButton:iC.THButton,HeadTR:iC.HeadTR}),aC=function(e){return c.jsx(zf,{direction:"column",children:null==e?void 0:e.children})};function lC(e){return null===e?"asc":"asc"===e?"desc":null}var sC=function(e){var n=i.debounce(e.onSetExportName),r=md().textOverride,o=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(Af,{onClose:function(){return null==e?void 0:e.close()},width:220,position:null==e?void 0:e.triggerPosition,align:"right",children:c.jsxs(Af.Options,{padding:!0,children:[c.jsx(Af.Option,{children:c.jsx(aC,{children:c.jsx(jm,{label:r("table_settings.title","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(Af.Option,{children:c.jsx(aC,{children:c.jsx(Sm,{label:r("table_settings.format","Format"),id:"table-header-format",testId:"table-header-format",showClearBtn:!0,selected:e.currentNumberFormat,options:o,onChange:function(t){e.onSetNumberFormat(t)},textOverride:r})})})]})})})},uC=function(e){var t=md().textOverride,n=e.fieldIndex,r=e.currentOrder,i=e.exportName,o=e.currentNumberFormat,a=e.fields[n],l={width:e.width,maxWidth:e.width,minWidth:e.width},s=If(),u=s.ref,d=s.show,p=s.position,f=s.close,m=s.open,h={fontFamily:l.fontFamily,translate:e.columnOffset+"px"};return e.isImpactedColumn&&(h.opacity=.1),c.jsxs(oC.TH,{cellStyles:l,columnStyles:h,first:0===n,last:null==e?void 0:e.last,hover:!0,group:!1,dragSettings:{columnIndex:n,type:e.id,fieldKey:a.datumKey,onResized:null==e?void 0:e.onResizedColumn,width:e.width},lastGroupColumn:e.isLastGroupColumn,firstGroupColumn:e.isFirstGroupColumn,children:[c.jsx(oC.THButton,{onChange:function(){return m()},direction:r?null==r?void 0:r.direction:void 0,label:i||a.publicName,onSort:ze(a)?void 0:function(){var t,n=Me(a.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});null==e.onOrderChange||e.onOrderChange({fieldId:n.field,function:n.function,direction:lC(null!=(t=null==r?void 0:r.direction)?t:null)})},ref:u,testIdPrefix:"column-"+(null==a?void 0:a.id),sortLabel:t("table_settings.sort","Sort")}),c.jsx(sC,{open:d,triggerPosition:p,close:f,exportName:e.exportName||a.publicName,fieldId:a.datumKey,originalPublicName:a.publicName,onSetExportName:e.onSetExportName,onSetNumberFormat:function(t){return e.onSetNumberFormat(a.datumKey,t)},currentNumberFormat:o,numberFormatOptions:e.numberFormatOptions,dataType:a.dataType})]})},dC=function(e){var n=t.useRef(null),r=t.useState(0),o=r[0],a=r[1];return t.useEffect((function(){var e=i.throttle((function(){a(n.current?n.current.offsetWidth:0)}),100);return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),e.cancel()}}),[e]),[n,o]},cC=Object.assign((function(e){var n=e.content,r=e.textOverride,i=e.children,o=t.useState(!1),a=o[0],l=o[1],s=zh().addToast;return c.jsxs(zf,{gap:"0.5rem",children:[c.jsx(_f,{textWrap:!0,flex:1,hyphens:"none",children:c.jsx("span",{style:{userSelect:"none"},children:i||n})}),c.jsx(cC.Button,{onClick:function(e){e.preventDefault(),e.stopPropagation(),"string"==typeof n&&(q(n),l(!0),s((function(){return c.jsx(Mh,{message:"Copied to clipboard"})})),setTimeout((function(){return l(!1)}),2e3))},copied:a,textOverride:r})]})}),{Button:function(e){return c.jsxs("button",{onClick:function(t){return null==e?void 0:e.onClick(t)},"aria-label":e.textOverride?e.textOverride("copy_content","Copy content"):"Copy content",className:""+tu.button,children:[!(null!=e&&e.copied)&&c.jsx("svg",{height:22,width:22,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:22,width:22,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"})})]})}}),pC=function(e){return c.jsxs(kv,{onClose:function(){return null==e?void 0:e.onCloseModal()},isOpen:null==e?void 0:e.open,width:"sm",children:[c.jsx(kv.Content,{children:c.jsx(Fw.Container,{children:c.jsx(Fw.Panel,{as:"div",children:c.jsx(cC,{content:null==e?void 0:e.content})})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onCloseModal()},children:"Close"})})]})},fC=As({height:"1.25rem",width:"1.25rem","&:disabled":{opacity:.4}}),mC=As({fontSize:13,fontWeight:"normal"}),hC=function(e){var t,n,r=e.textOverride;return c.jsxs(zf,{justifyContent:"flex-end",alignItems:"center",margin:"0.5rem 0 0 0",children:[c.jsxs("span",{className:""+mC,children:[r?r("pagination.page","Page"):"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:tu.button+" "+fC,children:c.jsx(v.ChevronLeftIcon,{})}),e.onNext&&c.jsx("button",{"aria-label":"Next",disabled:null==e?void 0:e.nextDisabled,className:tu.button+" "+fC,onClick:e.onNext,children:c.jsx(v.ChevronRightIcon,{})})]})},vC=function(e,t){return t[e]?t[e]:ns(e)?t[is(e)]:void 0},gC=function(e){for(var t,n=[],r=function(){var e=t.value,r=n.find((function(t){return t.content===e.formatted}));r?r.colSpan+=1:n.push({content:e.formatted,colSpan:1,unformatted:e.unformatted})},i=ie(e);!(t=i()).done;)r();return n};function bC(e,t){return e.dimensionValues.map((function(n,r){return t(n,e.dimensionKeys[r])})).join(", ")}var xC=function(e,t){if((null==t?void 0:t.length)>0&&ns(e.datumKey)){var n=(rs(e.datumKey).dimensionValues||[]).join(", ");return t.some((function(e){return e.unformatted===n}))}return!1},yC=function(e,t,n,r,o,a,l,s,u,d,c,p,f,m,h,v,g){if(!t)return null;var b=[],x=[],y=void 0,w=function(t,n,r,i,o){var a=t;n&&"none"!=n&&(a=gs(t,u[n].publicName));var l=c({fieldId:r,func:n,type:e,defaultLabel:a,viewId:null!=g?g:"",dimensionKeys:i,dimensionValues:o});return null!=l?l:a};if(t&&"dataTable"==e){var j=mn({measure:f,xMeasure:m,yMeasure:h}),C=hn({dimension:v}),S=function(e,t,n,r){var o=i.groupBy(t,(function(e){return e.pivot||"x"})),a={x:(o.x||[]).map((function(e){return _t(e)})),y:(o.y||[]).map((function(e){return _t(e)}))},l=as(e,n,a,void 0,r),s=[].concat(a.x).map((function(t){return Q({},us(e,t),{datumKey:t})})),u=[],d=ls(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=rs(t),r=_t({field:n.fieldId,function:n.function}),i=us(e,r),o=ts(n.dimensionKeys,n.dimensionValues,n.fieldId,n.function);s.push({id:r,datumKey:o,publicName:null==i?void 0:i.publicName,dataType:"number"})})),{fields:s,content:u}}(t,C,j,p);y=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(ns(t.datumKey)){var n=rs(t.datumKey);return[{formatted:bC(n,(function(t,n){return function(e,t,n,r,i){var o=Ct(t,i);if(e&&o){var a=us(e,t),l=i[o.truncate].dateFormat,s="date_time"==(null==a?void 0:a.dataType)?new Date(n):n;return De(s,r[l].formatter)||""+n}return""+n}(e,n,t,r,o)})),unformatted:bC(n,(function(e){return e}))}]}return[]})),l=i.cloneDeep(t).flatMap((function(e){return"y"==e.pivot?[]:[{colSpan:1,content:"",rowGroup:!0,unformatted:""}]}));return{consolidated:[].concat(l,gC(a)),unconsolidated:[].concat(l,a.map((function(e){return{colSpan:1,content:e.formatted,unformatted:e.unformatted}})))}}(t,C,S.fields,a,d),x=S.content,b=S.fields}else t&&t.fields.forEach((function(e){b.push(Q({},e,{datumKey:ts([],[],e.id,"none")}))}));return b=b.map((function(e){var t=e.publicName,r=e.id,i="none",o=void 0,a=void 0,l=function(e,t){return t[e]?t[e]:ns(e)?t[is(e)]:void 0}(e.datumKey,n||{});if(ns(e.datumKey)){var s=rs(e.datumKey);r=s.fieldId,o=s.dimensionKeys,a=s.dimensionValues}return l?t=l:ns(e.datumKey)&&(i=rs(e.datumKey).function),Q({},e,{publicName:l||w(t,i,r,o,a)})})),x=wC(b,"dataTable"==e?x:t.content,r,o,a,l,s,p),{groupTitles:y,fields:b,content:x}},wC=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 ns(n)?is(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?vC(null!=(u=d.datumKey)?u:"",o):"",m=a[f||""];return{value:t,displayValue:""+(null!=c?c:"")+(m&&"number"==d.dataType?m.formatter(t,l):De(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)?be(e,!1):""+e);case"string":return""+e}}(t,d.dataType),p,l))}}))}))};function jC(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 CC=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=md(),m=f.queryEngineConfig,h=f.textOverride;return c.jsx(t.Fragment,{children:n.map((function(t,f){if(null!=o&&o.fields[f].hidden)return null;if(null==o)return null;var v,g,b=o.fields[f],x=e.drilldown.length>0&&0===f,y=jC(b.datumKey,null==e?void 0:e.sizing,null==e?void 0:e.defaultColumnWidth,null==e?void 0:e.alternativeColumnSizing);if(ns(b.datumKey)){var w=rs(b.datumKey),j={};null==o||o.fields.forEach((function(e,t){var r,i;j[w.fieldId]=null==(r=n[t])?void 0:r.value,j[e.datumKey]=null==(i=n[t])?void 0:i.value})),w.dimensionKeys.forEach((function(e,t){j[e]=w.dimensionValues[t]}));var C=js(a,l,j,b.datumKey,u);C&&(v=function(e){var t,n=e.type,r=e.value,o=(t=null!=r?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{}}(C))}return Tj(a,b.id,{supportedAggregates:m.supportedAggregates,supportedTimeTruncFunctions:m.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0})?c.jsx(oC.TH,{first:0===f,last:f+1===n.length,group:!0,scope:"row",onClick:function(){return e.onViewClick(r,f,t.value,b.datumKey)},clickEnabled:Sx(d),expand:p&&x?{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!=(g=null==e?void 0:e.level)?g:void 0,children:"undefined"!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+f):c.jsx(oC.TD,{first:0===f,last:f+1===n.length,onClick:function(){return e.onViewClick(r,f,t.value,b.datumKey)},align:"number"==b.dataType?"alignRight":"alignLeft",clickEnabled:Sx(d),style:Q({},null==e?void 0:e.cellStyles,v||{},{width:y,maxWidth:y,minWidth:y}),onShowMore:function(){return null==e?void 0:e.setShowMore(t.displayValue)},showMoreLabel:h("table_settings.show_more","Show more"),children:void 0!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+f+"_"+JSON.stringify(t.displayValue)+"}")}))})},SC=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=md().queryEngineConfig;return c.jsxs(t.Fragment,{children:[c.jsx(oC.TR,{odd:a%2!=0,even:a%2==0,level:s?1:void 0,expanded:s?f:void 0,children:c.jsx(CC,Q({},e,{drilldownAction:m?{onExpanded:function(t){if(void 0!==t){var n=function(e,t,n){return kC(t).map((function(t){var r,i,o,a=(o=_j(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,Cx(null==e?void 0:e.tableRepresentation.fields,h,e.row))}}))}),(null==e?void 0:e.drilldownInputProps)&&f&&m&&c.jsx(FC,{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})]})},FC=function(e){var n,r,i=t.useState(0),o=i[0],a=i[1],l=e.drilldownInputProps,s=l.component,u=l.runQueriesCallback,d=s.attributes.limit,p=md(),f=p.queryEngineConfig,m=p.numberFormatOptions,h=p.dateTimeFormatOptions,v=p.labelFormat,g=p.textOverride,b=function(e,t,n,r,i){var o,a,l,s,u=(o=r.map((function(e){return Object.keys(e)})).flat(),e.filter.filter((function(e){return e.every((function(e){return!o.includes(e.field)}))}))),d=function(e,t,n){var r=[].concat(e).map((function(e){var n,r=Object.keys(e)[0];return{field:r,op:"=",value:e[r],function:(null==(n=t.find((function(e){return e.field===r})))?void 0:n.function)||"none"}}));return Jt(n,r)}(r,n,[].concat(u));return Q({},e,{dimension:(a=e.dimension,l=t,s=a.filter((function(e){return"x"!==e.pivot})),[].concat(s,[Q({},l)])),order:[{field:t.field,direction:"asc",function:t.function||"none"}],filter:d,offset:i})}(s.attributes,Me(e.drilldown[0].subsetDimension,f),e.dimension,e.selectedRow,o);Vb(b,u,null==e?void 0:e.setResults,{localFilters:s.localFilters,globalFilters:e.drilldownInputProps.globalFilters},e.dataSet);var x=t.useMemo((function(){return yC(b.type,e.result,b.exportNames,b.prefixes,b.dateTimeFormat,h,b.numberFormat,m,f.supportedAggregates,f.supportedTimeTruncFunctions,v,void 0,b.measure,b.xMeasure,b.yMeasure,b.dimension)}),[b.type,e.result,b.exportNames,b.prefixes,b.dateTimeFormat,h,b.numberFormat,m,f.supportedAggregates,f.supportedTimeTruncFunctions,void 0,b.measure,b.xMeasure,b.yMeasure,b.dimension]),y=t.useMemo((function(){return c.jsx(c.Fragment,{children:e.result&&c.jsx(hC,{offset:o,limit:d,onNext:function(){var e;return a(null!=(e=Wj(o,d))?e:0)},onPrevious:function(){var e;return a(null!=(e=Vj(o,d))?e:0)},previousDisabled:!qj(null!=o?o:0),nextDisabled:!Bj({offset:null!=o?o:0,limit:null!=d?d:0,total:x?x.content.length:0}),textOverride:g})})}),[o,d,null==(n=e.result)?void 0:n.content.length,a,null==x?void 0:x.content.length]),w=0===o&&(null!=(r=null==x?void 0:x.content.length)?r:0)<(null!=d?d:0),j=null==e?void 0:e.tableRowProps.row.length;return ds(e.result)?c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:c.jsx(nm,{minHeight:30})})}):cs(e.result)?c.jsx(iv,{}):c.jsxs(t.Fragment,{children:[(null==x?void 0:x.content)&&c.jsx(t.Fragment,{children:(null==x?void 0:x.content.length)>0?c.jsx(t.Fragment,{children:null==x?void 0:x.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,x,n,t,kC(e.dimension));return c.jsx(oC.TR,{level:2,odd:n%2!=0,even:n%2==0,children:c.jsx(CC,Q({},null==e?void 0:e.tableRowProps,{row:r,rowIndex:n,drilldownAction:void 0,level:2,subsetTableRepresentation:x,onViewClick:function(t,n,i,o){e.handleOnChange(t,n,i,Cx(e.parentFields,f,r,x.fields,e.drilldown[0]),function(e,t,n,r,i,o,a){var l=Me(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(ns(o)){var n=rs(o);return{fieldId:n.fieldId,value:i,function:n.function,aggregate:n.function,datum:o}}var r=Me(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],f,e.selectedRow,x.content[t][0].value,r[n].value,o,e.dimension))}}))},"table_row_level_2_"+n)}))}):c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:"No Results"})})}),!w&&c.jsx(oC.TR,{level:2,children:c.jsx(oC.TH,{colSpan:j,children:y})})]})};function kC(e){return e.filter((function(e){return"x"===e.pivot}))}var _C=function(e,t,n){if(!n)return[];var r=[],i=new Map;return n.fields.forEach((function(e,t){i.set(e.id,t)})),e.forEach((function(e){var o,a,l,s,u=hn(t),d=Ee({field:null==(o=e.filters)?void 0:o[0][0].field,function:null!=(a=null==(l=e.filters)?void 0:l[0][0].function)?a:"none"}),c=i.get(d);if(void 0!==c)if(u.some((function(t){var n;return t.field===(null==(n=e.filters)?void 0:n[0][0].field)}))||"number"!=typeof(null==(s=e.filters)?void 0:s[0][0].value))r.push(Q({},e,{boundaries:void 0}));else{var p=Infinity,f=-Infinity;n.content.forEach((function(t){var n,r,i=Number(t[c]);isNaN(i)||hs({op:null==(n=e.filters)?void 0:n[0][0].op,value:null==(r=e.filters)?void 0:r[0][0].value},i)&&(p=Math.min(p,i),f=Math.max(f,i))})),Infinity!==p&&-Infinity!==f&&r.push(Q({},e,{boundaries:[p,f]}))}})),r},TC={type:"dataTable",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:10,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},AC=function(e){var n,r,i,o,a,l,s,u={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,viewId:null!=(r=null==e?void 0:e.viewId)?r:""},d=e.sizing,p=md(),f=p.labelFormat,m=p.textOverride,h=dC(JSON.stringify(e)),v=h[0],g=function(e,t){var n=e/t;return n<200&&(n=200),n>300&&(n=300),n}(h[1],((null==(i=e.result)?void 0:i.fields)||[]).length),x=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}})),y=function(t){var n;return null==e?void 0:e.onSizingUpdate(Q({},d,((n={})[t.fieldKey]={width:t.width},n)))},w=t.useState(null),j=w[0],C=w[1],S=t.useMemo((function(){return yC(e.type,e.result,e.exportNames,e.prefixes,e.dateTimeFormat,e.dateTimeFormatOptions,e.numberFormat,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions,f,void 0,e.measure,e.xMeasure,e.yMeasure,null==e?void 0:e.dimension,null==e?void 0:e.viewId)}),[e.measure,e.xMeasure,e.yMeasure,e.result,e.dateTimeFormat,e.numberFormat,e.prefixes,e.dateTimeFormatOptions,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions,null==e?void 0:e.dimension]),F=(null!=(o=e.result)&&o.content?null==(a=e.result)?void 0:a.content.length:0)>(S?S.content.length:0),k=t.useMemo((function(){var t,n,r;return c.jsx(c.Fragment,{children:e.result&&!F&&c.jsx(hC,{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:!qj(null!=(t=e.offset)?t:0),nextDisabled:!Bj({offset:null!=(n=e.offset)?n:0,limit:null!=(r=e.limit)?r:0,total:S?S.content.length:0}),textOverride:m})})}),[e.offset,e.limit,e.onPrevious,e.onNext,null==(l=e.result)?void 0:l.content.length,F]),_=t.useMemo((function(){return S?function(e,t,n,r){var i=function(e,t,n,r){return e.fields.filter((function(e){return!!Tj(t,e.id,{supportedAggregates:n,supportedTimeTruncFunctions:r,supportedTransformationFunctions:void 0})}))}(e,t,n,r);return i.length>0?i[i.length-1].id:null}(S,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions):null}),[S,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions]),T=t.useMemo((function(){return S?function(e){var t=-1;return e.groupTitles&&e.groupTitles.consolidated.forEach((function(e,n){""===e.content&&!0===e.rowGroup&&(t=n)})),t}(S):null}),[S]),A=Xd();if(null===S)return null;if(ps(e.result))return c.jsx(av,Q({},u,{children:k}));if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb(e)});if(ds(e.result))return c.jsx(nm,{});if(cs(e.result))return c.jsx(iv,{});var D={fontFamily:null==A?void 0:A.fontFamily},I=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=Re(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:yx(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"};Sx(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(yh,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(_f,{marginBottom:null!=e&&e.displayTitle&&(null==e?void 0:e.displayTitle.length)>0?"0.4rem":void 0,children:c.jsx(Pg,Q({},u,{paddingBottom:0}))}),c.jsxs(su,{disabledFeatures:null!=(s=null==e?void 0:e.library)&&s,children:[c.jsxs(oC.Wrapper,{ref:v,children:[c.jsxs(oC.Head,{children:[S.groupTitles&&c.jsx(oC.HeadTR,{children:S.groupTitles.consolidated.map((function(e,t){var n;return c.jsx(oC.TH,{colSpan:e.colSpan,group:!0,last:t+1===((null==S?void 0:S.groupTitles)&&(null==S||null==(n=S.groupTitles)||null==(n=n.consolidated)?void 0:n.length)),deadSpace:e.rowGroup,lastGroupColumn:t===T,children:e.content},e+"_"+t)}))}),c.jsx(oC.HeadTR,{children:S.fields.map((function(t,n){if(t.hidden)return null;var r=e.order.find((function(n){var r=Me(t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});return n.field===r.field&&r.function==n.function})),i=function(e,t){var n,r,i=(n=e.groupTitles?e.groupTitles.consolidated:[],(r=e.fields.filter((function(e){return xC(e,n)}))).length>0?r[r.length-1]:void 0),o=function(e,t){var n=e.filter((function(e){return xC(e,t)}));return n.length>0?n[0]:void 0}(e.fields,e.groupTitles?e.groupTitles.consolidated:[]);return{isLastGroupColumn:t.id===(null==i?void 0:i.id),isFirstGroupColumn:t.id===(null==o?void 0:o.id)}}(S,t),o=i.isLastGroupColumn,a=i.isFirstGroupColumn,l=Tj(null==e?void 0:e.dimension,t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0}),s=jC(t.datumKey,d,g,x),u=!(!S.groupTitles||t.id!==_);return c.jsx(uC,{exportName:t.publicName,onSetExportName:e.onSetExportName,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,id:e.id,isImpactedColumn:!1,width:s,columnOffset:0,currentOrder:r,onOrderChange:e.onOrderChange,fieldIndex:n,numberFormatOptions:e.numberFormatOptions,currentNumberFormat:vC(t.datumKey,e.numberFormat),onSetNumberFormat:e.onSetNumberFormat,fields:null==S?void 0:S.fields,last:n+1===(null==S?void 0:S.fields.length),scope:l?"row":void 0,onResizedColumn:y,isLastGroupColumn:o||u,isFirstGroupColumn:a},"table_column_"+n)}))})]}),c.jsx(oC.Body,{children:S.content.map((function(t,n){return c.jsx(SC,{protectedFields:null==e?void 0:e.protectedFields,dataSet:null==e?void 0:e.dataSet,conditionalFormattingRules:_C(null==e?void 0:e.conditionalFormattingRules,e,e.result),dimension:null==e?void 0:e.dimension,rowIndex:n,row:t,tableRepresentation:S,sizing:d,defaultColumnWidth:g,alternativeColumnSizing:x,handleOnChange:I,cellStyles:D,setShowMore:C,drilldown:e.tableDrilldown,drilldownInputProps:null==e?void 0:e.drilldownInputProps,queriesAreChanging:e.queriesAreChanging},n)}))})]}),k]}),c.jsx(pC,{open:!!j,onCloseModal:function(){return C(null)},content:j})]})};AC.defaultProps=TC;var DC=function(e){return c.jsx(b.DndProvider,{backend:B.HTML5Backend,children:c.jsx(AC,Q({},e))})},IC=function(e){var t=e.component,n=t.results,r=t.attributes,o=Vb(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 _t(e)})),s=r.dimension.map((function(e){return _t({function:e.function,field:e.field})})),u=i.every(null==a?void 0:a.fields,(function(e){return s.includes(e.id)||l.includes(e.id)}));return 0===e.cellWidth?null:u?c.jsx(DC,Q({},r,{dataSet:e.dataSet,onSetExportName:function(t,n){var i;e.updateComponentAttributes(Q({},r,{exportNames:Q({},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;Bj({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(Q({},r,{offset:Wj(r.offset,r.limit)}))},onPrevious:function(){var t;qj(null!=(t=r.offset)?t:0)&&e.updateComponentAttributes(Q({},r,{offset:Vj(r.offset,r.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(Q({},r,{order:l}))},numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onSetNumberFormat:function(t,n){var i=Q({},r.numberFormat);n?i[t]=n:delete i[t],e.updateComponentAttributes(Q({},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(Q({},r,{sizing:t}))},drilldownInputProps:{component:e.component,runQueriesCallback:e.runQueriesCallback,globalFilters:e.globalFilters}})):null},OC=function(e){var t;return e&&0!==e.length?null==(t=e[0])?void 0:t.value:wr.Linear},PC=Object.assign((function(e){var n=e.children,r=e.view,i=e.onWidthChange,o=dC(),a=o[0],l=o[1];return t.useEffect((function(){i(l)}),[l]),c.jsx("div",{className:""+EC({fullHeight:r===wr.Linear?"true":"false"}),ref:a,children:c.jsx("div",{children:c.jsxs(zf,{direction:r!==wr.Linear?"row":"column",height:"100%",gap:r!==wr.Linear?l/16.8:"1.5rem","data-component":"stat-container",alignItems:r!==wr.Linear?"center":"normal",justifyContent:r!==wr.Linear?"flex-start":"normal",children:[r===wr.Circular&&c.jsx(zf,{justifyContent:"center",alignItems:"center",width:"fit-content",grow:1,gap:l/17,children:n}),r===wr.Linear&&n]})})})}),{Individual:t.forwardRef((function(e,t){return c.jsx("div",{ref:t,children:e.children})})),Single:function(e){return c.jsx(Ud,{placeContent:"center","data-component":"stat-single-container",height:"100%",justifyContent:"normal",children:e.children})}}),EC=As({width:"100%",variants:{fullHeight:{true:{height:"100%"}}}}),MC=function(e){var n,r=md(),i=r.numberFormatOptions,o=r.labelFormat,a=e.results[0],l=t.useState(null),s=l[0],u=l[1];if(t.useEffect((function(){if(a&&e.measure){var t=ss(a,_t(e.measure));-1!==t&&u(t)}}),[a,e.measure]),null===s)return null;var d=null==a?void 0:a.content[0][s],p=function(e,t,n,r){var i,o;return gs(null==e||null==(i=e.fields[t])?void 0:i.publicName,null==(o=r[n.function])?void 0:o.publicName)}(a,s,e.measure,e.supportedAggregates),f=Zb(e.formatter,e.prefixes,e.postfixes,e.measure,d,i),m=f.formattedValue,h=f.prefix,v=f.postfix,g=o({fieldId:e.measure.field,func:e.measure.function,type:"progress",defaultLabel:p,viewId:e.viewId});return c.jsx(rw,{valueNow:d,title:null!=g?g:p,displayValueNow:$b(m,h,v),type:e.progressType,color:["#7F7FD5","#86A8E7"],valueMax:null!=(n=e.valueMax)?n:2*d,showValue:!0,showTitle:e.showTitle,radius:e.progressType===wr.Linear?void 0:e.radius})},RC={type:"progress",measure:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],parameters:{},formatter:{},goals:[],progressType:[],postfixes:{},prefixes:{}},LC=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,measure:null==(i=e)?void 0:i.measure,viewId:null!=(o=null==(a=e)?void 0:a.viewId)?o:""};if(!Br(e.type).isRunnable(e))return c.jsx(rv,{title:"Missing parameters",children:Hb({measure:e.measure,order:[],dimension:[]})});var f=void 0!==e.results?e.results[0]:void 0;if(ds(f))return c.jsx(nm,{});if(cs(f))return c.jsx(iv,{});if(ps(f))return c.jsx(av,Q({},p));var m=(e=bs(e,{},RC)).measure.length,h=OC(e.progressType),v=t.useState(0),g=v[0],b=v[1],x=(null!=(l=e.height)?l:350)/2.1;return c.jsxs(yh,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[c.jsx(Pg,Q({},p,{paddingBottom:0})),m>1?c.jsx(_f,{marginY:"0.5rem",children:c.jsx(PC,{noOfValues:m,view:h,onWidthChange:function(e){return b(e)},children:[].concat(e.measure).map((function(t,n){var r,i,o,a,l=e.goals?null==(r=e.goals.filter((function(e){return e.field===_t(t)}))[0])?void 0:r.value:null;return c.jsx(PC.Individual,{children:c.jsx(MC,{index:n,supportedAggregates:e.supportedAggregates,measure:t,results:e.results,valueMax:l,showTitle:!0,progressType:h,formatter:null==(i=e)?void 0:i.formatter,postfixes:null==(o=e)?void 0:o.postfixes,prefixes:e.prefixes,radius:h===wr.Linear?void 0:x<g?x:g,viewId:null!=(a=e.viewId)?a:""})},n)}))})}):c.jsx(PC.Single,{children:c.jsx(MC,{index:1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],results:e.results,valueMax:e.goals&&e.goals.length>0?e.goals[0].value:null,showTitle:!1,progressType:h,formatter:null==(s=e)?void 0:s.formatter,postfixes:null==(u=e)?void 0:u.postfixes,prefixes:e.prefixes,radius:x+20,viewId:null!=(d=e.viewId)?d:""},1)})]})};LC.defaultProps=RC;var NC=function(e){var t,n=e.component,r=n.results,i=n.attributes,o=Vb(i,e.runQueriesCallback,e.setResults,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.dataSet);return 0===e.cellWidth?null:c.jsx(LC,Q({},i,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:r,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,height:null==e?void 0:e.height}))},zC=function(e){var t=Rm().dashboard,n=md();if(!e.component.attributes)return null;var r=ay(e.component,t.dataSets,n);if(r){if(r instanceof fn)return c.jsx(Gh,{title:"Data set not available."});if(r instanceof pn)return c.jsx(Gh,{title:"This view is no-longer supported."});if(r instanceof un)return c.jsx(nv,{removeMissingField:function(){var t=Br(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig});if(r instanceof un){var i=t.removeField(e.component.attributes,r.getMissingFieldId());e.updateComponentAttributes(i)}}})}var i=La(t,e.component.attributes.dataSetId);if(e.isBeingSizeAdjusted)return c.jsx(Gh,{title:c.jsx(em,{color:"#e5e5e5"})});var o=null!=e&&e.editor||null!=e&&e.library?void 0:e.component.colSpan<=2,a=function(r){(0,Br(r.type,n).validate)(r,t.dataSets),e.updateComponentAttributes(r)},l=e.editor?"editor":e.library?"library":"dashboard";if("scatterChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Nx,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if(["horizontalBarChart","barChart"].includes(e.component.attributes.type))return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ax,{id:e.id,dataSet:i,cellWidth:e.cellWidth,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,idPrefix:l})});if("areaChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(bx,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("lineChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Px,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("pieChart"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(ey,{id:e.id,cellWidth:e.cellWidth,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(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(zj,{id:e.id,cellWidth:e.cellWidth,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,updateComponentAttributes:function(e){return a(e)}})});if("progress"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(NC,{id:e.id,cellWidth:e.cellWidth,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,height:e.height})});if("dataTable"==e.component.attributes.type||"basicTable"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(IC,{id:e.id,cellWidth:e.cellWidth,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(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Rj,{id:e.id,cellWidth:e.cellWidth,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,idPrefix:l})});if("custom"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ej,{component:e.component})});if("mercatorMap"==e.component.attributes.type)return c.jsx(Il,{renderOnError:function(e){return c.jsx(sv,{onManualRetry:e})},onError:n.onError,children:c.jsx(Nj,{id:e.id,setLocalFilters:e.setLocalFilters,onPositionChange:function(t){var r=(0,Br("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},qC=function(e){var t=e.component.localFilters||[],n=Rm().dashboard,r=La(n,e.component.attributes.dataSetId);return r?(r.preAggregated&&(r=La(n,r.preAggregated[0])),c.jsx(zv,{dataSets:[r],filters:t,show:null==e?void 0:e.show,onUpdate:function(n){var r=qv(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},BC=function(e){var r=t.useState(!1),i=r[0],o=r[1],a=t.useState(!1),l=a[0],s=a[1],u=Rm().dispatch,d=e.component,p=e.libraryIndex,f=n.useState(!1),m=f[0],h=f[1],v=md().mode,g=window.disableViewCheck||m,b=Xd(),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:""+iu.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(yg,{children:["View ",p+1,d.attributes.displayTitle?": "+d.attributes.displayTitle:""]}),!g&&c.jsx("div",{style:{height:"170px"},children:c.jsx(nm,{})}),g&&c.jsx(oy,{children:c.jsxs(ry,{width:340,height:306,percentage:100,children:[x&&c.jsx(VC,{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(zC,{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,cellWidth:330})]})},"select_component_preview_"+p),c.jsx(Ij,{setParameterUpdate:function(){},libraryIndex:e.libraryIndex,show:i,component:e.component,onClose:function(){return o(!1)}}),c.jsx(qC,{component:e.component,onClose:function(){return s(!1)},show:l,setLocalFilters:function(e){u({type:"setLocalFilters",localFilters:e,libraryIndex:p})}})]})})})},WC={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},VC=function(e){var r,i=n.useRef(null),o=md(),a=Br(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(_d,{})},onClick:function(){return e.onEdit()}},{purpose:"removeComponentFromLibrary",renderIcon:function(){return c.jsx(kd,{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(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(jd,{})})},onClick:function(){return e.onSetParameters()}}),o.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(zf,{width:20,justifyContent:"center",as:"span",children:c.jsx(yd,{active:!1})})},onClick:function(){return e.onAddFilter()}});var h=Xd();return c.jsxs("div",{css:WC,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:oh(null==h?void 0:h.dashboard)+" "+tu.button+" open-component-options",children:[c.jsx(yg,{children:null==e?void 0:e.label}),c.jsx(Dd,{})]}),s&&c.jsx(Af,{onClose:function(){return u(!1)},position:p,children:c.jsx(by,{onClose:function(){return u(!1)},cellOptions:m})})]})},HC=function(e){var n=md().textOverride;if(i.isEmpty(e.components))return c.jsx(Gh,{title:n("library.no_results","Your library is empty")});var r=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&e.current.focus()}),[]),e}(),o=[].concat(e.components).map((function(e){return{displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,component:e}})),a=Pf(o,["displayTitle","displaySubject"]),l=a.values,s=a.setSearch;return t.useEffect((function(){var t;null==e||e.onSelectComponent(null==(t=l[0])?void 0:t.refIndex)}),[a.searchString]),c.jsx(_f,{padding:"1.5rem",children:c.jsxs(Ud,{gap:"1.5rem",rows:["48px","1fr"],children:[c.jsx(_f,{children:c.jsx(ny,{placeholder:n("library.search_library","Search Library"),onChange:s,inputRef:r})}),c.jsx(_f,{children:c.jsxs(Ud,{columns:["repeat(3, 1fr)"],gap:"1.5rem",children:[0===l.length&&c.jsx(Gh,{title:n("library.search_returned_no_results","Your search returned no results")}),[].concat(l).map((function(t){var n=t.refIndex;return c.jsx(BC,{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)}))]})})]})})},YC={name:"om9tn6",styles:"margin:auto;height:24rem"},UC={name:"1g0vxgi",styles:"margin-top:0.75rem"},GC=function(){var e=Rm(),n=e.dispatch,r=e.dashboard,o=e.trackEvent,a=e.runQueriesCallback,l=t.useState(0),s=l[0],u=l[1],d=t.useState(null),p=d[0],f=d[1],m=md(),h=m.featureToggles,v=m.textOverride,g=h.canEditComponentLibrary,b=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:Qf("modal-empty-library"),css:YC,children:c.jsx(Gh,{title:v("library.no_view_in_library","There are no Views in your template library"),renderExtra:function(){return h.canEditComponentLibrary&&c.jsx("div",{css:UC,children:c.jsx(Fh,{onClick:b,children:v("library.create_new","Create New")})})}})}):c.jsxs(c.Fragment,{children:[c.jsx(KC,{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:g,onEdit:function(e){var t=Q({},r.componentLibrary[e]);o("library.startEditing"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:t})},onDelete:f,onCreate:b,onSelectComponent:function(e){o("library.switchSelectedComponent"),u(e)}}),c.jsx(XC,{open:null!==p,onClose:function(){return f(null)},onDelete:function(){null!==p&&n({type:"removeComponentFromLibrary",libraryIndex:p}),f(null),u(0)}})]})},KC=function(e){var n,r,i=Xd(),o=md().textOverride,a="boolean"==typeof(null==i||null==(n=i.modals)||null==(n=n.options)||null==(n=n.showTitle)?void 0:n.library)&&!(null!=i&&null!=(r=i.modals)&&null!=(r=r.options)&&null!=(r=r.showTitle)&&r.library);return c.jsxs(t.Fragment,{children:[c.jsx(kv.Header,{title:o("library.select_template","Select Template"),"data-component":"library-header",hide:a}),c.jsx(kv.Content,{scrollable:!0,"data-component":"library-content",children:c.jsx(HC,{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(kv.Footer,{buttons:"space-between","data-component":"library-footer",children:[c.jsx(Dv,{"data-component":"library-footer-left",children:(null==e?void 0:e.canEditComponentLibrary)&&c.jsx(Fh,{testId:"library-create-new",onClick:function(){return null==e?void 0:e.onCreate()},secondary:!0,children:o("library.create_new","Create New")})}),c.jsxs(Dv,{buttons:"end","data-component":"library-footer-right",children:[c.jsx(Fh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:o("close","Close")}),c.jsx(Fh,{testId:"add-view-from-library-to-dashboard",onClick:function(){return null==e?void 0:e.onSelect()},children:o("library.add_to_dashboard","Add to Dashboard")})]})]})]})},XC=function(e){return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.open,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:"Are you sure?"}),c.jsx(kv.Content,{children:c.jsx("p",{className:""+tu.text,children:"Are you sure you want to delete this component from your library?"})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Cancel"}),c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onDelete()},children:"Delete"})]})})]})},QC=gd((function(e){var n=Rm().dashboard,r=md(),i=r.dateFilterOptions,o=r.featureToggles,a=r.cascadeFilterSelection;return c.jsxs(zf,{gap:"0.5rem","data-component":"filters",className:""+$C(r.scope),wrap:!0,children:[e.globalFilters.length>0&&c.jsx(t.Fragment,{children:[].concat(e.globalFilters).map((function(t,r){return c.jsx(vg,{shouldAlwaysHaveValue:t.requiresValue,dataSets:n.dataSets,dateFilterOptions:i,filter:Q({},t,{optionsFilters:Fi(null==e?void 0:e.globalFilters,n.dataSets,i,a)}),filterIndex:r,onChange:function(t){var n=[].concat(e.globalFilters);n[r]=t,e.setGlobalFilters(n)}},r)}))}),o.canManageGlobalFilters&&c.jsx(Wv,{})]})}),"renderGlobalFiltersViewComponent"),JC=function(e){var t=md();return c.jsx("div",{className:""+ZC(t.scope),"data-component":"global-filters",children:c.jsx(QC,Q({},e))})},ZC=function(e){return As("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%"})},$C=function(e){return As("read"===e?{"@media (min-width: 768px)":{flexDirection:"row"},"@media (max-width: 767px)":{flexDirection:"column"}}:{flexDirection:"row"})};function eS(e,n){var r=md().id;t.useEffect((function(){var t,i=Nl.get(null!=(t=null!=n?n:r)?t:"",(function(t){return e(t)}));return function(){return i()}}),[])}var tS=r.object({dataSetId:r.string().required(),fieldId:r.string().required()}),nS=r.array().items(tS).required();function rS(e,t,n,r){var i=e.properties.appliesToFields,o=nS.validate(i).error;if(o&&Ae("Validation error for appliesToFields: "+o.message+" ",i),t.forEach((function(r,o){iS(r.appliesToFields,i)&&(n=!0,t[o]=Q({},r,e.properties))})),!n)throw Ae("No matching filters found for the provided appliesToFields when running updateFilter.",r.updateFilter),new Error("No matching filters found for the provided appliesToFields.");return n}function iS(e,t){return e.length===t.length&&e.every((function(e){return t.some((function(t){return t.dataSetId===e.dataSetId&&t.fieldId===e.fieldId}))}))}var oS=function(e){function t(t,n){var r;return(r=e.call(this,"'Issue with Vizzly State "+n+": '"+t+"'")||this).name="StateValidation",r}return J(t,e),t}(sn),aS=function(){var e=Rm(),t=e.dashboard,n=e.dispatch,r=md().featureToggles.showGlobalFilters;return eS((function(e){var r=function(e,t){var n;if(t.addFilter){var r,i,o=nS.validate(t.addFilter.properties.appliesToFields).error;if(o)throw Ae("Validation error for appliesToFields: "+o.message,null==(r=t.addFilter)||null==(r=r.properties)?void 0:r.appliesToFields),new Error("Validation error for appliesToFields");if(e.some((function(e){var n,r;return iS(e.appliesToFields,null!=(n=null==(r=t.addFilter)||null==(r=r.properties)?void 0:r.appliesToFields)?n:[])})))throw Ae("Filter with matching appliesToFields already exists",t.addFilter),new Error("Filter with matching appliesToFields already exists.");e.push(null==(i=t.addFilter)?void 0:i.properties)}if(t.updateFilter&&rS(t.updateFilter,e,!1,t),t.updateFilters)return null==t||null==(n=t.updateFilters)||n.forEach((function(n){rS(n,e,!1,t)})),e;if(t.removeFilter){var a=nS.validate(t.removeFilter).error;if(a)throw Ae("Validation error for appliesToFields: "+a.message+" ",t.removeFilter),new Error("No matching filters found for the provided appliesToFields.");e=e.filter((function(e){return!(t.removeFilter&&iS(e.appliesToFields,t.removeFilter))}))}return Fe("Updated global filters",e,t),e}(t.globalFilters,e);try{var i=function(e){var t=Aa.validate(e),n=t.error,r=t.value;if(n)throw Ae("Invalid global filter configuration: "+n.message),n;return r}(r);n({type:"setGlobalFilters",globalFilters:i})}catch(e){throw new oS(e,"globalFilters")}})),r?c.jsx(JC,{globalFilters:t.globalFilters,setGlobalFilters:function(e){Fe("Setting global filters",e),n({type:"setGlobalFilters",globalFilters:e})},setupAsyncOptionLoader:function(){return X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Not implemented.";case 1:case"end":return e.stop()}}),e)})))}}):null},lS=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(sS,{content:e.content,copyContent:e.copyContent}),e.children||e.content]})},sS=function(e){var n=zh().addToast,r=t.useState(!1),i=r[0],o=r[1];return c.jsx(cC.Button,{onClick:X(G().mark((function t(){return G().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:q(t.t0),n((function(){return c.jsx(Mh,{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})},uS={name:"1gok8e8",styles:"margin-bottom:0.5rem"},dS={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"},cS=function(){var e,t=md(),n=t.overrideDeveloperInfo,r=t.setOverrideDeveloperInfo;return c.jsx(kv,{width:"xl",isOpen:!!n,onClose:function(){return r(null)},children:c.jsxs("div",{onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[c.jsx(kv.Header,{title:"Replace component"}),c.jsxs(kv.Content,{children:[c.jsx("div",{css:uS,children:c.jsx(lS,{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:dS,children:c.jsx(Km,{showAccordionIcon:!0,title:"View props",Icon:Ou,children:c.jsx(lS,{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))})})})]})]})})},pS=function(e){var t=e.currentReports[0],n=t?t.id:l.v4(),r=md(),i=r.reportScheduleOptions,o=r.onScheduledReportChange,a=r.textOverride,s=[].concat(i).map((function(e){return{label:e.description,value:e.cron}})),u=function(){var t=X(G().mark((function t(r){var a,l;return G().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(kv,{width:"xl",onClose:e.onClose,isOpen:e.isOpen,children:[c.jsx(kv.Header,{title:a("set_report_schedule","Set report schedule")}),c.jsx(kv.Content,{children:c.jsx(Sm,{placeholder:a("select_schedule","Select schedule"),selected:t?t.schedule:null,showClearBtn:!0,onChange:u,options:s})}),c.jsx(kv.Footer,{children:c.jsx(Fh,{onClick:e.onClose,secondary:!0,children:a("close","Close")})})]})},fS=Object.assign((function(){return null}),{emptyCell:function(e){return As({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})}}),mS=function(e){return c.jsxs("div",{style:{position:"relative",cursor:e.onStartEdit?"pointer":"auto"},onClick:function(){return null==e.onStartEdit?void 0:e.onStartEdit()},children:[!!e.onStartEdit&&c.jsx(_f,{display:"inline",position:"absolute",top:2,right:0,children:c.jsx(vS,{})}),c.jsx(vm,{as:"span",children:e.label}),c.jsx("div",{className:Hd(""+tu.text,null==e?void 0:e.className),children:e.value})]})},hS={name:"6r56vi",styles:"height:1rem;width:1rem"},vS=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:hS,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"})})},gS=function(e){var n,r,o=(null==e?void 0:e.component).attributes,a=Rm().dispatch,l=md().textOverride,s=function(){var t,n={};null==e||null==(t=e.component)||null==(t=t.results[0])||t.fields.forEach((function(e){n[e.id]=e.publicName}));var r=[];if("dimension"in o&&o.dimension.map((function(e){var t=n[Ee(e)];r.push({value:e,label:t})})),"timeDimension"in o&&null!==o.timeDimension){var i=o.timeDimension,a=n[i?Ee({field:null==i?void 0:i.field,function:null==i?void 0:i.truncate}):""];r.push({value:i,label:a})}return r.sort((function(e,t){return e.label.localeCompare(t.label,void 0,{sensitivity:"base"})})),r},u=t.useState(!1),d=u[0],p=u[1],f=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)),m=f[0],h=f[1],v=t.useState(function(){var e,t,n=[],r=s().map((function(e){return e.value}));return o&&"protectedFields"in o&&o.protectedFields&&"dimension"in o.protectedFields&&o.protectedFields.dimension&&(n=null!=(e=null==(t=o.protectedFields)||null==(t=t.dimension)?void 0:t.map((function(e){return r.findIndex((function(t){return(null==t?void 0:t.field)===e.field}))})))?e:[]),n}()),g=v[0],b=v[1],x=function(){null==e||e.onClose()};return c.jsxs(kv,{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(kv.Header,{title:l("click_settings","Click Settings"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx(Ov,{children:c.jsx(mS,{label:l("view_id","View Id"),value:c.jsx(Fw.Panel,{children:c.jsx(cC,{content:o.viewId,textOverride:l})})})}),"basicTable"!==o.type&&c.jsx(Ov,{children:c.jsx(bS,{options:s(),selectedDimension:g,setSelectedDimesion:b})}),c.jsx(Ov,{children:c.jsx(xS,{attributes:o,results:null==e||null==(n=e.component)?void 0:n.results,selectedMeasure:m,setSelectedMeasure:h,label:l("protected_measure_select","Protected [[type]]",{type:"basicTable"===o.type?"Columns":"Metrics"})})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,onClick:function(){d||(x(),null==e||e.onClose())},disabled:d,children:l("cancel","Cancel")}),c.jsx(Ch,{onClick:function(){return d?void 0:function(){p(!0);var t={};"measure"in o&&i.isArray(m)&&(t.measure=m.map((function(e){return null==o?void 0:o.measure[e]})));var n=s();n.length>0&&i.isArray(g)&&(t.dimension=g.map((function(e){return n[e]})).map((function(e){return e.value}))),"protectedFields"in o&&a({type:"setAttributes",attributes:Q({},o,{protectedFields:t}),cellIndex:e.cellIndex,rowIndex:e.rowIndex}),p(!1),x()}()},disabled:d,primary:!0,children:l("confirm","Confirm")})]})})]})},bS=function(e){var t=md();return c.jsx(Gv,{label:(0,t.textOverride)("protected-grouping-fields","Protected Grouping Fields"),id:"protected-grouping-fields",setSelected:function(t){return e.setSelectedDimesion(t)},selected:e.selectedDimension,options:e.options})},xS=function(e){var t=e.attributes,n=e.results,r=e.setSelectedMeasure;return c.jsx(Gv,{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=_t(e);i.push({value:e,label:r[t]+("none"!==e.function?" ("+e.function+")":"")})})),i}()})},yS=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"})})]})]})},wS=function(e){var t;return c.jsxs(zf,{justifyContent:"center",direction:"column",alignItems:"center",height:"100%","data-component":"empty-state",children:[c.jsx(yS,{height:null!=(t=e.height)?t:160,color:null==e?void 0:e.illustrationColor}),c.jsxs(zf,{direction:"column",gap:"1rem",alignItems:"center",children:[c.jsx(_f,{className:""+jS,children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx(_f,{children:null==e?void 0:e.children})]})]})},jS=As({fontSize:16,fontWeight:500}),CS=function(e){return c.jsx("div",{className:tu.height100+" "+SS,"data-component":"cell-contents","data-vizzlycomponentloaded":e.showComponent?"true":"false",children:e.children})},SS="vizzly-component",FS=function(){return Array.from(document.querySelectorAll('[class*="'+SS+'"]')).map((function(e){return{element:e,isLoaded:"true"===e.getAttribute("data-vizzlycomponentloaded")}}))},kS=function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===t&&(t=500),n=function(){return FS().every((function(e){return e.isLoaded}))};case 2:if(n()){e.next=7;break}return e.next=5,new Promise((function(e){return setTimeout(e,t)}));case 5:e.next=2;break;case 7:return e.abrupt("return",FS());case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_S=function(e){var t=md().textOverride,n=zh().addToast;return c.jsxs(kv,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:t("json_results","Data in raw JSON format"),show:!0}),c.jsx(kv.Content,{children:c.jsx(_f,{maxHeight:"400px",overflowY:"scroll",children:c.jsx("pre",{"data-testid":"raw-results-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.results,null,2)})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("close","Close")}),c.jsx(Ch,{primary:!0,testId:"modal-copy-json-results-btn",onClick:function(){var t=q(JSON.stringify(e.results));n(t?function(){return c.jsx(Mh,{message:"Copied results"})}:function(){return c.jsx(Ph,{message:"Failed to copy results"})})},children:t("copy","Copy")})]})})]})},TS=function(e){var t=md().textOverride,n=zh().addToast;return c.jsxs(kv,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(kv.Header,{title:t("json_attributes","Attributes in raw JSON format"),show:!0}),c.jsx(_f,{position:"absolute",top:20,right:20,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/services/views/"+e.attributes.type,children:c.jsx(v.QuestionMarkCircleIcon,{color:"#000",width:20,height:20})})}),c.jsx(kv.Content,{children:c.jsx(_f,{maxHeight:"400px",overflowY:"scroll",children:c.jsx("pre",{"data-testid":"raw-attributes-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.attributes,null,2)})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("close","Close")}),c.jsx(Ch,{primary:!0,testId:"modal-copy-json-attributes-btn",onClick:function(){var t=q(JSON.stringify(e.attributes));n(t?function(){return c.jsx(Mh,{message:"Copied attributes"})}:function(){return c.jsx(Ph,{message:"Failed to copy attributes"})})},children:t("copy","Copy")})]})})]})},AS={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},DS={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},IS={name:"1q8mru7",styles:"margin-left:0.25rem;display:inline-block"},OS=function(e){var n=Xd(),r=md(),i=r.featureToggles,o=r.textOverride,a=i.canUseComponentLibrary,l=i.canCreateStandaloneComponents;return 0===(null==e?void 0:e.rowIndex)&&0===(null==e?void 0:e.cellIndex)&&i.canSeeEmptyState?c.jsx(oy,{vizzlyPrefix:Qf("populated-cell"),children:c.jsxs("div",{css:AS,children:[!e.generatingPDF&&c.jsx(jy,{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(wS,{title:c.jsx(t.Fragment,{children:o("empty_state_call_to_action","Build a dashboard with your data and delight your customer.")}),illustrationColor:"#43BA73",children:l&&c.jsx(hh,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:o("add_view_call_to_action","+ Add View")})})]})}):c.jsx("div",{className:Hd(Qf("empty-cell"),""+fS.emptyCell(null==n?void 0:n.dashboard)),"data-themeapi":"dashboard","data-chipposition":"top.left",children:c.jsxs("div",{css:DS,children:[!e.generatingPDF&&c.jsx(jy,{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(zf,{gap:"0.5rem",wrap:!0,justifyContent:"center",children:[a&&c.jsx(hh,{onChange:e.onPickFromLibrary,size:"small","data-component":"select-template",testId:"add-view-from-library",children:c.jsxs(zf,{alignItems:"center",as:"span",children:[c.jsx(Id,{}),c.jsx("span",{css:IS,children:o("select_template","Select Template")})]})}),l&&c.jsx(hh,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:o("add_view_call_to_action","+ Add View")})]})]})})},PS=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=t.useState(!1),g=v[0],x=v[1],y=t.useState(!1),w=y[0],j=y[1],C=Rm().dispatch,S=md(),F=S.featureToggles,k=S.developerTools,_=S.reportScheduleOptions,T=S.scope,A=S.textOverride,D=F.canDownloadComponentData,I=F.canEditComponentsOnDashboard,O=F.canRemoveComponentsFromDashboard,P=!0===k||"object"==typeof k&&k.viewRawResults,E=!0===k||"object"==typeof k&&k.viewRawAttributes,M=n.useState(!1),R=M[0],L=M[1],N=t.useState(!1),q=N[0],B=N[1],W=n.useState(!1),V=W[0],H=W[1],Y=e.generatingPDF||window.disableViewCheck||V,U=!i.isEmpty(_)&&e.hasWebhookSetup,G=(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}}}}))),K=G[1],X=G[2],Q=function(t){C({type:"setLocalFilters",localFilters:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},J=function(t){C({type:"setParameterBasedUpdate",payload:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},Z=t.useState(!1),$=Z[0],ee=Z[1];return c.jsxs(c.Fragment,{children:[c.jsx(z,{active:!V,partialVisibility:!0,onChange:H,children:c.jsxs(oy,{vizzlyPrefix:Qf("populated-cell"),"data-testid":e.testId,ref:X,onHover:ee,children:[c.jsx(ah,{dragSource:K,active:"read_write"===T&&$,enabled:"read_write"===T,top:ES(e.component.attributes).top,height:ES(e.component.attributes).height}),!e.generatingPDF&&c.jsx(wy,{canDownloadComponentData:D&&e.componentValidWithDataSet,canEditComponentsOnDashboard:I&&e.componentValidWithDataSet,canRemoveComponentsFromDashboard:O,onEdit:e.onEdit,onRemove:function(){return s(!0)},onDownload:e.onDownload,canSetupReportSchedule:U,onManageReport:function(){return L(!0)},onClickSettings:function(){return B(!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 j(!0)},onViewRawJSONResults:function(){return h(!0)},onViewRawAttributes:function(){return x(!0)},canViewRawJSONResults:P,canViewRawViewAttributes:E}),c.jsxs(CS,{showComponent:Y,children:[Y&&c.jsx(zC,{cellWidth:e.cellWidth,id:e.id,setLocalFilters:Q,setParameterUpdate:J,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes,height:e.height}),!Y&&c.jsx(nm,{})]})]})}),U&&c.jsx(pS,{setComponentReports:e.setComponentReports,currentReports:e.component.reports||[],isOpen:R,onClose:function(){return L(!1)}}),q&&c.jsx(gS,{show:q,component:null==e?void 0:e.component,onClose:function(){return B(!1)},cellIndex:e.cellIndex,rowIndex:e.rowIndex}),c.jsx(Jw,{message:A("delete_view_from_dashboard_message","This view will be deleted from your dashboard."),onClose:function(t){t&&(null==e||e.onRemove()),s(!1)},show:l}),c.jsx(qC,{component:e.component,onClose:function(){return p(!1)},show:d,setLocalFilters:Q}),c.jsx(Ij,{cellIndex:e.cellIndex,setParameterUpdate:J,rowIndex:e.rowIndex,show:w,component:e.component,onClose:function(){return j(!1)}}),c.jsx(_S,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:m,results:e.component.results,onClose:function(){return h(!1)}}),c.jsx(TS,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:g,attributes:e.component.attributes,onClose:function(){return x(!1)}})]})},ES=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}},MS=function(e,t){if(e){var n=[[].concat(e.fields).map((function(t,n){var r;if(!e.groupTitles)return t.publicName;var i=null==(r=e.groupTitles.unconsolidated)||null==(r=r[n])?void 0:r.content;return(i?"["+i+"] ":"")+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")},RS=function(e){var t=new Blob([e],{type:"text/csv;charset=utf-8"});W.saveAs(t,"download.csv")},LS=function(){var e=X(G().mark((function e(t,n,r,o,a,l,s,u,d,c,p){var f,m,h,v,g,b,x;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===c&&(c=RS),f=i.cloneDeep(a),e.prev=2,"limit"in f&&(f.limit=o),m=new AbortController,h="view-download-type"==t?f:[$r(n,o,"filter"in f?f.filter:[])],e.next=8,Nm(h,r,m.signal,d);case 8:cs(g=null==(v=e.sent)?void 0:v[0])||ps(g)||ds(g)||(b=i.isArray(h)?h[0]:h,x=yC(b.type,g,"exportNames"in f?f.exportNames:void 0,"prefixes"in f&&Array.isArray(f.prefixes)?f.prefixes:void 0,"dateTimeFormat"in f?f.dateTimeFormat:void 0,l,"numberFormat"in f?f.numberFormat:void 0,s,u.supportedAggregates,u.supportedTimeTruncFunctions,p,"",b.measure,b.xMeasure,b.yMeasure,null==b?void 0:b.dimension),MS(x,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,c){return e.apply(this,arguments)}}(),NS=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=Rm().dispatch,s=md().textOverride;return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return t()},children:[c.jsx(kv.Header,{title:s("update_header","Update Header"),show:!0}),c.jsx(kv.Content,{children:c.jsx(Ov,{children:c.jsx(jm,{id:"header-title",label:s("header_title","Title"),labelHidden:!0,value:o,onChange:function(e){return a(e.target.value)}})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return t()},secondary:!0,children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return n=Q({},r,{displayTitle:o}),l({type:"setHeaderComponent",component:n,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),void t();var n},children:s("update","Update")})]})})]})},zS=function(e){var t,n,r,i=Xd();return c.jsxs(zf,{justifyContent:"space-between",alignItems:"center",margin:null!=(t=null==e?void 0:e.margin)?t:"0 0 1rem","data-component":"action-section",className:""+qS(null==i?void 0:i.header),"data-themeapi":"header",children:[c.jsx(_f,{children:(null==e?void 0:e.title)&&c.jsxs(zf,{direction:"column",gap:"0.5rem",children:[c.jsx(_f,{as:null!=(n=e.titleLevel)?n:null==i||null==(r=i.header)||null==(r=r.title)?void 0:r.htmlElement,className:""+BS(null==i?void 0:i.header),"data-themeapi":"header.title",children:null==e?void 0:e.title}),(null==e?void 0:e.subTitle)&&c.jsx("p",{className:""+WS,children:null==e?void 0:e.subTitle})]})}),(null==e?void 0:e.extra)&&c.jsx(_f,{children:null==e?void 0:e.extra})]})},qS=function(e){var t;return As({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})},BS=function(e){var t,n,r,i,o,a;return As({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})},WS=As({margin:0,fontSize:14}),VS=function(e){var t=[],r=n.useState(!1),i=r[0],o=r[1],a=md(),l=a.featureToggles,s=a.scope;return t.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Sy,{})},onClick:function(){return o(!0)},testId:"edit"}),l.canRemoveComponentsFromDashboard&&t.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Cy,{})},onClick:function(){return e.onRemove()},testId:"remove"}),c.jsxs(_f,{position:"relative",height:"100%",margin:"0 0.1rem 0.5rem 0.1rem",children:[c.jsx(zS,{title:e.component.displayTitle,margin:0}),!e.generatingPDF&&"read_write"===s&&c.jsx(yy,{cellOptions:t,chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1)}),c.jsx(NS,{show:i,component:e.component,onClose:function(){return o(!1)},rowIndex:e.rowIndex,cellIndex:e.cellIndex})]})};function HS(e,t){return!(t<=0||t>=e.length)&&e[t-1].components.some((function(e){return mi(e)}))}var YS,US=function(e,t,n){return e.slice(-15)+"_"+t+"_"+n},GS=function(e){var t=e.onCreateNew,n=e.onPickFromLibrary,r=e.onRemoveCell,i=e.rowIndex,o=e.cellIndex,a=e.trackEvent,l=md(),s=l.queryEngineConfig,u=l.dateTimeFormatOptions,d=l.numberFormatOptions,p=l.labelFormat,f=Rm(),m=f.dispatch,h=f.dashboard,v=f.runQueriesCallback,g=h.display[i].components[o],x=Li(g)?"empty":mi(g)?"header":"populated",y=null!=h.webhookId,w=b.useDrop((function(){return{accept:"moveComponentPositionDragHandle",drop:function(t,n){m({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:w[1],css:["height:100%;padding:0.5rem;",w[0].isOver&&{opacity:"0.2"},"",""],children:["populated"==x&&!Li(g)&&!mi(g)&&c.jsx(PS,{cellWidth:e.cellWidth,rowIndex:i,cellIndex:o,id:US(h.id,i,o),hasWebhookSetup:y,componentValidWithDataSet:!0,generatingPDF:e.generatingPDF,setComponentReports:function(e){m({type:"setComponentReports",rowIndex:i,cellIndex:o,reports:e})},testId:"populated_cell_"+i+"_cell_"+o,isBeingSizeAdjusted:e.isBeingSizeAdjusted,component:g,runQueriesCallback:v,updateComponentAttributes:function(e){m({type:"updateDisplayComponentAttributes",rowIndex:i,cellIndex:o,attributes:e})},height:e.height,setResults:function(e){m({type:"setResultsForComponentInDisplay",rowIndex:i,cellIndex:o,results:e})},onEdit:function(){a("component.startEditing"),m({type:"startEditingComponent",displayTarget:{rowIndex:i,cellIndex:o},libraryIndex:null,component:g})},onRemove:function(){a("component.removeFromDisplay"),m({type:"clearCell",rowIndex:i,cellIndex:o})},onDownload:function(){var t=X(G().mark((function t(n){var r,i;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=Vr(h.dataSets,g.attributes.dataSetId),i={globalFilters:h.globalFilters,localFilters:g.localFilters},r&&LS(n,r,v,e.maxCSVDownloadLimit,g.attributes,u,d,s,i,void 0,p);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),"empty"==x&&c.jsx(OS,{onCreateNew:function(){return t(i,o)},onPickFromLibrary:function(){return n(i,o)},onRemoveCell:function(){return r(i,o)},cellIndex:o,rowIndex:i,generatingPDF:e.generatingPDF}),"header"==x&&mi(g)&&c.jsx(VS,{component:g,onRemove:function(){return r(i,o)},rowIndex:i,cellIndex:o,generatingPDF:e.generatingPDF})]},"row_"+i+"_cell_"+o)},KS=As(Q({width:"100%",cursor:"ns-resize",opacity:0,paddingTop:"0.75rem",paddingBottom:"0.75rem"},Ts,{"&:hover":Q({},Ts,{opacity:100})})),XS=As({position:"relative",height:"0.25rem",marginLeft:"40%",width:"20%"}),QS=As(Q({cursor:"ew-resize",position:"absolute",right:"-0.75rem",height:"25%",width:"0.25rem",top:"40%"},Ts,{"&:hover":Q({},Ts,{opacity:80}),variants:{highlighted:(YS={},YS.true={opacity:100},YS.false={opacity:0},YS)}})),JS=Object.assign((function(){return null}),{dragHandle:function(e){return As({borderRadius:"0.75rem",background:null==e?void 0:e.borderColor})},cellDragHandle:QS,rowDragHandle:XS,rowDragHandleContainer:KS}),ZS=Object.assign((function(){return null}),{tooltip:As({height:"100%",width:"100%",justifyContent:"center",alignItems:"center",display:"flex"})}),$S=function(e){return null!=e&&e.narrow?c.jsx(ih,{placement:"right-start",tooltipContent:function(){return c.jsx(ih.Content,{children:null==e?void 0:e.tooltipLabel})},className:""+ZS.tooltip,classNameTrigger:""+ZS.tooltip,children:c.jsx(eF,Q({},e))}):c.jsx(eF,Q({},e))},eF=function(e){var t;return c.jsxs(hh,{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})]})},tF=function(e){var n=Xd(),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(B.getEmptyImage(),{captureDraggingState:!1})}),[]),i.isDragging?null:c.jsx("div",{ref:o,className:""+JS.rowDragHandleContainer,children:c.jsx("div",{className:" "+JS.dragHandle(null==n?void 0:n.dashboard)+" "+JS.rowDragHandle,"data-themeapi":"dashboard"})})},nF=function(e){var t=Xd(),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:JS.dragHandle(null==t?void 0:t.dashboard)+" "+JS.cellDragHandle({highlighted:null!=e&&e.rowHighlighted?"true":"false"})})},rF={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"},iF={name:"1vjyfqt",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.8)"},oF={name:"ve8olc",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.1)"},aF=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:rF,children:t[0].isOver?c.jsx("div",{style:{left:"calc(50% - 10px)"},css:iF}):c.jsx(c.Fragment,{children:e.active&&c.jsx("div",{style:{left:"calc(50% - 10px)"},css:oF})})})},lF={name:"1kzq5ms",styles:"height:100%;width:100%"},sF={name:"cvkgqy",styles:"display:inline-block;overflow-y:hidden"},uF={name:"1wv4onu",styles:"position:relative;height:100%"},dF=function(e){var n,r,o=e.generatingPDF,a=t.useState(!1),l=a[0],s=a[1],u=md(),d=u.scope,p=u.textOverride,f=Rm().dispatch,m=(r=null!=(n=e.containerWidth)?n:0,parseFloat(((r-1)/12).toFixed(2))),h=b.useDragLayer((function(t){var n=t.getItem(),r=t.getItemType(),i=t.getDifferenceFromInitialOffset(),o=[].concat($l(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}})),v=h.rowHeightAdjustment,g=h.widthAdjustments,x=h.activeCell,y=h.activeRow,w=h.moveType,j=h.isDraggingComponentWidth,C=e.displayRow.components.some((function(e){return mi(e)})),S=v+(C?52:e.displayRow.height);return void 0===e.containerWidth?null: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(Ud,{columns:e.columns,"data-component":"panel-row",marginBottom:C?void 0:26,children:[c.jsx(zf,{alignItems:"stretch",paddingBottom:10,paddingTop:8,"data-component":"add-cell",direction:"column",gap:"0.5rem",children:!C&&l&&e.canAddNewCells&&c.jsxs(t.Fragment,{children:[!e.hideAddNewHeaderRow&&c.jsx(_f,{minHeight:32,width:32,children:c.jsx($S,{onChange:e.onAddHeaderRow,narrow:!0,tooltipLabel:p("add_header_tooltip","Add Header Row"),label:p("add_header","Add Header"),"data-component":"add-header-row"})}),c.jsx($S,{onChange:e.onAppendCell,narrow:!0,tooltipLabel:p("add_cell_tooltip","Add Cell to Row"),label:p("add_cell","Add Cell"),"data-component":"add-cell-button"})]})}),c.jsxs("div",{className:""+pF(S,d,e.displayRow.components.length),"data-component":"rowContainer",children:[j&&!C&&c.jsx(c.Fragment,{children:$l(12).map((function(t,n){return c.jsx(aF,{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:m,active:null!=x},n)}))}),c.jsx("div",{css:lF,children:[].concat(e.displayRow.components).map((function(t,n){var r=n==e.displayRow.components.length-1,i=m*t.colSpan+(g[n]||0),a="componentWidthDragHandle"==w&&null!=x&&e.rowIndex==y&&(x==n||x+1==n),s="rowHeightDragHandle"==w&&e.rowIndex==y;return c.jsx("div",{css:sF,className:""+cF(S,i,d,e.containerWidth),"data-component":"cell-container",children:c.jsxs("div",{css:uF,style:{width:"calc(100% - 20px)"},children:[c.jsx(GS,{generatingPDF:o,maxCSVDownloadLimit:e.maxCSVDownloadLimit,isBeingSizeAdjusted:a||s,onCreateNew:e.onCreateNew,onPickFromLibrary:e.onPickFromLibrary,onRemoveCell:e.onRemoveCell,rowIndex:e.rowIndex,cellIndex:n,trackEvent:e.trackEvent,height:S,cellWidth:i}),!r&&"read_write"===d&&!C&&c.jsx(nF,{displayRow:e.displayRow,rowIndex:e.rowIndex,cellIndex:n,rowHighlighted:l})]})},"row_"+e.rowIndex+"_cell_"+n)}))}),"read_write"===d&&c.jsx(tF,{onNewHeight:function(e,t){f({type:"setRowHeight",rowIndex:e,height:t})},displayRow:e.displayRow,rowIndex:e.rowIndex})]},"actual_resizable_row_"+e.rowIndex)]})})},cF=function(e,t,n,r){var i;return As("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%"})},pF=function(e,t,n){var r;return As("read"===t?((r={})["@media (min-width: 768px)"]={height:e},r["@media (max-width: 767px)"]={height:e*n},r):{height:e})},fF=function(e){var t,n;return c.jsx(_f,{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(zf,{className:""+mF,children:[c.jsxs("a",{href:e.logo.href,className:""+hF,target:null!=(t=null==e||null==(n=e.logo)?void 0:n.target)?t:void 0,children:[c.jsx("span",{className:""+tu.srOnly,children:"Vizzly"}),c.jsx(Mu,{}),(null==e?void 0:e.logo.text)&&c.jsx(_f,{as:"span",paddingTop:2,children:e.logo.text})]}),null==e?void 0:e.children]})})},mF=As({background:"#E7EAF1",color:"#151515",padding:"0 0.75rem",borderRadius:12,position:"relative",minHeight:40}),hF=As({position:"absolute",left:12,top:7.5,display:"flex",gap:"0.5rem",alignItems:"center",fontSize:12,fontWeight:600}),vF=As({height:30,background:Ms.colors.brand[20],width:1}),gF={background:"transparent",color:Ds(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:Ms.colors.brand.base},"&:focus":{background:"rgba(48, 116, 217, 0.1)",border:"1px solid transparent",color:Ms.colors.brand.base},"&:disabled":{background:"transparent",opacity:.5},"&:hover:disabled":{background:"transparent",opacity:.5},fontSize:12,fontWeight:600},bF=function(e){return JSON.stringify({display:e.display,componentLibrary:e.componentLibrary,globalFilters:e.globalFilters,customFields:e.customFields})},xF={name:"1gok8e8",styles:"margin-bottom:0.5rem"},yF={name:"1gok8e8",styles:"margin-bottom:0.5rem"},wF=function(e){var n=t.useState("small"),r=n[0],i=n[1],o=Rm().dashboard,a=t.useState(!1),l=a[0],s=a[1],u=md(),d=u.featureToggles,p=u.scope,f=u.mode,m=u.onSave,h=u.queryEngineConfig,v=u.onOpenConfigManagerUi,g=u.disableToolbar,b=za(o),x=Ko(h,"configManagerUi")&&v;t.useEffect((function(){!function(){var e=X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:d.disableAutoSave||"endUser"!=f?Fe("Auto-save is disabled, so the dashboard will not be saved."):y();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[b&&JSON.stringify({changes:bF(b)})]);var y=function(){"read_write"==p&&m(o)};if(eS((function(e){e.save&&(Fe("Received from vizzlyState, `save()`"),y())})),g)return null;var w=function(){s(!1)};return c.jsxs(c.Fragment,{children:[("admin"==f||x)&&"hidden"!==r&&c.jsx(fF,{"data-component":"admin-tools",logo:{href:"https://docs.vizzly.co/",target:"_blank"},children:c.jsx(zf,{justifyContent:"end",alignItems:"center",padding:"0.1rem 0",children:c.jsxs(Dv,{buttons:"end",children:[x&&c.jsx(Fh,{testId:"manage-data-sets",secondary:!0,onClick:function(){v()},internal:!0,themeOverride:gF,children:"Config Manager"}),"admin"==f&&c.jsx(Fh,{secondary:!0,testId:"save-dashboard",onClick:function(){s(!0)},internal:!0,themeOverride:gF,disabled:e.isProgrammaticParent,children:"Save"}),c.jsx("div",{className:""+vF}),c.jsxs(Fh,{secondary:!0,onClick:function(){return i("hidden")},internal:!0,themeOverride:gF,children:[c.jsx("span",{className:""+tu.srOnly,children:"Hide Tools"}),c.jsx(pu,{})]})]})})}),c.jsxs(kv,{width:"sm",isOpen:l,onClose:function(){return w()},children:[c.jsx(kv.Header,{title:"Confirm changes?"}),c.jsxs(kv.Content,{children:[c.jsx("p",{css:xF,children:"Are you sure you want to save this dashboard?"}),c.jsx("p",{css:yF,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(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:function(){return w()},children:"Cancel"}),c.jsx(Fh,{testId:"confirm-save",onClick:function(){y(),w()},children:"Save"})]})})]})]})},jF=function(e){var n=Rm(),r=n.dashboard,o=n.dispatch,a=md().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 Q({},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!Ci(n,e)})));return e.globalFilters.length==l.length?i.cloneDeep(l):(Te("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},CF={name:"firlg",styles:"grid-column:span 2 / span 2"},SF=function(e){return c.jsx("div",{css:CF,children:e.children})},FF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(zf,{gap:"0.75rem",direction:"column",children:e.section.subSection.map((function(t,n){return c.jsxs(SF,{children:[c.jsx(fv,{children:t.title}),c.jsx(Ny,Q({componentType:e.attributes.type},e,{allowsMultiple:t.allowsMultiple,propKey:t.propKey,setPartialAttributes:e.setAttributes,supportedAggregates:e.queryEngineConfig.supportedAggregates}))]},n)}))})})},kF=function(e){var t=e.dataSets.filter((function(e){return!e.hide}));return t.length<2&&!e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"dataset-section",children:c.jsx(Ay,Q({},e,{dataSets:t,setPartialAttributes:e.setAttributes}))})},_F=function(e){var t=md();return 0==rj(t.featureToggles,e.attributes.type,null==e?void 0:e.queryEngineConfig,t.textOverride).length||e.dataSet.preAggregated?null:c.jsx(c.Fragment,{children:e.featureToggles.canEditCustomMetrics&&c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"custom-metric-section",children:c.jsx(cj,{queryEngineConfig:e.queryEngineConfig,setDataSets:e.setDataSets,dataSetId:e.attributes.dataSetId,dataSets:e.dataSets,componentType:e.attributes.type})})})},TF=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(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"sort-section",children:c.jsx(By,Q({},e,{attributes:t,timeDimension:"timeDimension"in t&&t.timeDimension||null,dimension:n,measure:r,setPartialAttributes:e.setAttributes}))})},AF=function(e){var n=t.useState([]),r=n[0],i=n[1],o=md(),a=o.mode,l=o.queryEngineConfig,s=o.textOverride,u=vj(r,null==e?void 0:e.dataSet,"grouping",l,i),d=hj(null==e?void 0:e.dataSet,{onlyDimensions:!0},!0,[].concat(r,null==e?void 0:e.dimension)),p=mj(r,"grouping",l,i);return c.jsxs(kv,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(kv.Header,{title:s("add_drilldown","Add Drilldown")}),c.jsx(kv.Content,{children:c.jsx(Ud,{columns:["1fr"],gap:"1rem",children:c.jsxs(Ov,{children:[c.jsx(vm,{as:"p",children:s("drilldown_field","Drilldown field")}),c.jsx(xh,{mode:a,onDeleteItem:function(){return i([])},items:u,newItem:{callToAction:s("add_drilldown_field","Add drilldown field"),onNew:p,initValues:d,hide:r.length>0}})]})})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:s("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){var t;0===r.length||e.onClose({subsetDimension:Ee({field:r[0].field,function:null==(t=r[0])?void 0:t.function})})},primary:!0,disabled:0===r.length,children:s("update","Update")})]})})]})},DF=function(e){var n=md(),r=n.mode,o=n.queryEngineConfig,a=n.textOverride,l=t.useState(!1),s=l[0],u=l[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 d=function(t){if(!(null==e||null==(t=e.drilldown)?void 0:t[0]))return[];var n=Me(null==e?void 0:e.drilldown[0].subsetDimension,o),r=Yr(e.dataSet,n.field);return[{title:qy(r.publicName,n.function&&"none"!=n.function&&le(n.function,a))}]}();return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:r,newItemBtn:i.isEmpty(null==e?void 0:e.drilldown)?{callToAction:a("add_drilldown","Add drilldown"),onClick:function(){u(!0)}}:void 0,onDeleteItem:function(){return e.onSetDrilldown([])},items:d}),s&&c.jsx(AF,{show:s,onClose:function(t){t&&e.onSetDrilldown([t]),u(!1)},dimension:null==e?void 0:e.dimensions,dataSet:e.dataSet})]})},IF=function(e){return"tableDrilldown"in e.attributes?c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(DF,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldown:null==e?void 0:e.attributes.tableDrilldown,onSetDrilldown:function(t){return e.setAttributes({tableDrilldown:t})}})}):null},OF=function(e){var t=md();return"filter"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(wj,Q({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,textOverride:t.textOverride}))}):null},PF=function(e){var t=md();return"limit"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Cj,{label:(0,t.textOverride)("limit","Limit"),labelHidden:!0,id:"limit",currentValue:e.attributes.limit,setNumber:function(t){return e.setAttributes({limit:t||0})}})}):null},EF=function(e){var t=md().textOverride;if(!("limit"in e.attributes))return null;var n=e.section.options.map((function(e){return{value:e,label:e}}));return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Fm,{children:c.jsx(Sm,{label:t("rows_per_page","Rows per page"),id:"pagination-limit-input",testId:"pagination-limit-input",onChange:function(t){e.setAttributes({limit:t||0,offset:0})},options:n,selected:e.attributes.limit,textOverride:t,onClick:function(){return uj("bottom","editor-panel")}})})})},MF=function(e){var t=md().textOverride;return"comboChart"!=e.attributes.type?null:c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsxs(zf,{gap:"0.75rem",direction:"column","data-component":"combo-chart-compare",children:[c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.line","Line")}),c.jsx(My,Q({propKey:"lineDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.bar","Bar")}),c.jsx(My,Q({propKey:"barDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(_f,{children:[c.jsx(fv,{children:t("combo_chart.data_panel.dimension.time","Time")}),c.jsx(Ry,Q({},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}))}}))]})]})})},RF=function(e){return"measure"in e.attributes?c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(zy,Q({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},LF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,"data-component":"views-section",children:c.jsx(lw,Q({},e,{setPartialAttributes:e.setAttributes}))})},NF=function(e){return c.jsx(Fw,{title:e.section.title,tooltip:e.section.description,children:c.jsx(fj,Q({},e,e.section,{setPartialAttributes:e.setAttributes}))})},zF=function(e){return c.jsx(Ud,{gap:"1.5rem",children:null==e?void 0:e.children})},qF=function(e){var t=Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),n=Wr(e.dataSet.fields,{onlyFieldTypes:["date_time"]}),r=md(),i=r.mode,o=r.textOverride;if(0===n.length)return null;var a,l=[];e.deltaTimeDimension&&l.push({title:Yr(e.dataSet,e.deltaTimeDimension.field).publicName,subtext:e.queryEngineConfig.supportedTimeTruncFunctions[null==(a=e.deltaTimeDimension)?void 0:a.truncate].publicName+" window",select:{onChange:function(t){e.deltaTimeDimension&&e.setDeltaTimeDimension(Q({},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 s=[].concat(n).map((function(e){return{title:""+e.publicName,subtext:"",value:e.id}}));return c.jsx(xh,{mode:i,onDeleteItem:function(){e.setDeltaTimeDimension(null)},items:l,newItem:{callToAction:o("add_percentage_and_absolute_change","Add percentage and absolute change"),hide:null!=e.deltaTimeDimension,initValues:s,onNew:function(n){e.setDeltaTimeDimension({truncate:t[0],field:n,bucketFill:!1})}}})},BF=function(e){var t,n=md().queryEngineConfig,r=null==e?void 0:e.attributes;return t=Wr((null==e?void 0:e.dataSet).fields,{onlyFieldTypes:["date_time"]}),a(t)?null:c.jsx(Fw,{title:"Comparison",children:c.jsx(qF,{dataSet:null==e?void 0:e.dataSet,deltaTimeDimension:r.deltaTimeDimension,setDeltaTimeDimension:function(t){e.setAttributes({deltaTimeDimension:t})},queryEngineConfig:n})})},WF=function(e){return c.jsx(Ov,{children:c.jsx("div",{className:""+VF,children:c.jsx(jm,{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})})})},VF=As({width:"100%",flexDirection:"column",flexGrow:1,height:"100%",display:"flex"}),HF=function(e){return c.jsxs(zf,{alignItems:"top"===(null==e?void 0:e.checkboxPosition)?"flex-start":"center",children:[c.jsx(Qm,{onChange:function(t){e.setChecked(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(vm,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},YF=function(e){return c.jsx("div",{children:c.jsx(jm,{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})})},UF=function(e){var t=md();return c.jsx(Fm,{children:c.jsx(Sm,{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,textOverride:t.textOverride})})},GF=function(e){var n,r,i=t.useState((null==(n=e.progressMetric)?void 0:n.measure)||null),o=i[0],a=i[1],l=t.useState((null==(r=e.progressMetric)?void 0:r.goal)||null),s=l[0],u=l[1],d=md(),p=d.queryEngineConfig,f=d.textOverride;return c.jsxs(kv,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(kv.Header,{title:f("add_progress_metric","Add Progress Metric")}),c.jsxs(kv.Content,{children:[c.jsxs(Ov,{children:[c.jsx(vm,{children:f("metric","Metric")}),c.jsx(Ny,{componentType:"progress",maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){a(e.measure[0])},supportedAggregates:p.supportedAggregates,attributes:{measure:o?[o]:[]},dataSet:e.dataSet,fieldFilterOptions:{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:"progress",removePercentage:!1,removeSimpleMaths:!1,removeRuleGrouping:!1,removeAggregateMaths:!1},disableRemove:!0})]}),c.jsx(Ov,{children:c.jsx(Cj,{label:f("goal","Goal"),currentValue:s,setNumber:function(e){return u(e)},id:"progress-goal"})})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:f("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){o&&s&&e.onClose({measure:o,goal:s})},primary:!0,disabled:null===s||null===o,children:e.progressMetric?f("update","Update"):f("add","Add")})]})})]})},KF=function(e){var n=e.attributes,r=e.dataSet,i=e.setAttributes,o=n.measure,a=md(),l=a.mode,s=a.queryEngineConfig,u=a.textOverride,d=t.useState(!1),p=d[0],f=d[1],m=[].concat(o).map((function(e){var t,i,o,a=Yr(r,e.field),l=null!=(t=null==(i=n.goals.find((function(t){return t.field===_t(e)})))?void 0:i.value)?t:"-";return{title:c.jsxs(zf,{gap:"0.25rem",direction:"column",children:[c.jsx("div",{children:gs(a.publicName,null==(o=s.supportedAggregates[e.function])?void 0:o.publicName)}),c.jsxs("div",{children:[u("goal_set_to","Goal set to"),": ",c.jsx("span",{className:""+tu.bold,children:l})]})]}),icon:a.dataType,onClick:function(){return f({measure:e,goal:l})}}}));return c.jsxs(Fw,{title:e.section.title,tooltip:e.section.description,children:[p&&c.jsx(GF,{show:!!p,onClose:function(e){if(f(!1),e){var t=_t(e.measure);i({measure:JF(o,t,e),goals:QF(n.goals,t,e),progressType:XF(n.progressType,t)})}},dataSet:r,progressMetric:"boolean"!=typeof p?p:void 0}),c.jsx(Fw.Container,{"data-component":"progress-input",children:c.jsx(xh,{mode:l,onOrderChange:function(e,t){var n=Iy([].concat(o),e,t);i({measure:n})},newItemBtn:{callToAction:u("add_metric","Add metric"),onClick:function(){f(!0)}},onDeleteItem:function(e){var t=_t(o[e]);i({measure:es(o,e),goals:n.goals.filter((function(e){return e.field!==t})),progressType:n.progressType.filter((function(e){return e.field!==t}))})},items:m})})]})};function XF(e,t){var n=e.findIndex((function(e){return e.field===t})),r=[].concat(e);return-1!==n?r[n]={field:t,value:OC(e)}:r.push({field:t,value:OC(e)}),r}function QF(e,t,n){var r=e.findIndex((function(e){return e.field===t})),i=[].concat(e);return-1!==r?i[r]={field:t,value:n.goal}:i.push({field:t,value:n.goal}),i}function JF(e,t,n){var r=[].concat(e),i=r.findIndex((function(e){return _t(e)===t}));return-1!==i?r[i]=n.measure:r.push(n.measure),r}var ZF=function(e){var r=md().textOverride,i=e.dataPanelConfig.some((function(e){return"function"!=typeof e&&("filter"===e.type||"customMetrics"==e.type||"limit"==e.type)}))&&!e.dataSet.preAggregated;return c.jsxs(zF,{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(NF,Q({},e,{section:t})),"drilldown"==t.type&&c.jsx(IF,Q({},e,{section:t})),"labelledMetrics"==t.type&&c.jsx(FF,Q({},e,{section:t})),"fields"==t.type&&c.jsx(RF,Q({},e,{section:t})),"progressGoals"===t.type&&c.jsx(KF,Q({},e,{section:t})),"dataSet"==t.type&&c.jsx(kF,Q({},e,{section:t})),"views"==t.type&&c.jsx(LF,Q({},e,{section:t})),"sort"==t.type&&c.jsx(TF,Q({},e,{section:t})),"pagination"==t.type&&c.jsx(EF,Q({},e,{section:t})),"comboChartDimension"==t.type&&c.jsx(MF,Q({},e,{section:t})),"comparison"==t.type&&c.jsx(BF,Q({},e,{section:t}))]},t.type+"_"+r)})),i&&c.jsx(Xm,{title:r("advanced_options","Advanced Options"),defaultOpen:!1,showAccordionIcon:!0,onOpened:function(){uj("bottom","editor-panel")},children:c.jsx(zF,{children:e.dataPanelConfig.map((function(n,r){return"function"!=typeof n?c.jsxs(t.Fragment,{children:["filter"==n.type&&c.jsx(OF,Q({},e,{section:n})),"customMetrics"==n.type&&c.jsx(_F,Q({},e,{section:n})),"limit"==n.type&&c.jsx(PF,Q({},e,{section:n}))]},r):null}))})})]})},$F=function(){var e=Ky(),t=md();if(!e)return c.jsx(nm,{});var n=e.dataSet,r=e.queryEngineConfig,i=e.dataPanel,o=e.dashboard,a=e.setPartialAttributes,l=e.component.attributes;if(!n)throw"Data set required to show data props editor.";var s=Br(l.type,{queryEngineConfig:r,textOverride:e.textOverride});return c.jsx(Il,{renderOnError:function(e){return c.jsx(dv,{onManualRetry:e})},onError:t.onError,children:c.jsx(ZF,{setDataSets:e.setDataSets,setAttributes:a,setDataSet:e.setDataSet,dataSets:o.dataSets,dataSet:n,featureToggles:e.featureToggles,attributes:l,queryEngineConfig:r,dataPanelConfig:i(s.dataPanelConfig(),{type:l.type})})})},ek=function(e){var n,r=e.section,i=e.setAttributes,o=e.attributes;return c.jsx(Fw,{title:r.title,tooltip:null==r?void 0:r.description,children:c.jsx(Fw.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(jm,{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(jm,{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)}))})})},tk=function(e){var t,n=md(),r=n.numberFormatOptions,i=n.textOverride,o=Object.keys(r).map((function(e){return{value:e,label:r[e].description}}));return c.jsx(Fm,{children:c.jsx(Sm,{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:i("format","Format"),onChange:function(t){return null==e?void 0:e.onChange(t)},options:o,textOverride:i})})},nk=function(e){var n=e.section,r=e.attributes,i=e.setAttributes,o=md().textOverride,a=n.subSection.some((function(e){return"legend"===e.type||"numberFormat"===e.type})),l=n.subSection.some((function(e){return"stacked"===e.type||"curve"===e.type}));return c.jsx(Fw,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsxs(Ud,{gap:"1rem",children:[l&&c.jsx(Fw.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(UF,{id:"format-layout-stacked",label:e.title,currentValue:void 0!==r.stacked&&r.stacked,onSelect:function(e){return i({stacked:e})},options:[{label:o("grouped","Grouped"),value:!1},{label:o("stacked","Stacked"),value:!0},{label:o("stacked_100prc","Stacked (100%)"),value:"100%"}]}),"curve"===e.type&&c.jsx(UF,{label:e.title,id:"format-layout-curve",currentValue:r.lineCurve,onSelect:function(e){return i({lineCurve:e})},options:[{value:"natural",label:o("natural","Natural")},{value:"straight",label:o("straight","Straight")},{value:"step",label:o("step","Step")}]})]},n)}))}),a&&c.jsx(Fw.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(HF,{label:e.title,setChecked:function(e){return i({legend:e})},currentValue:r.legend,id:"show-legend-input"}),"numberFormat"===e.type&&c.jsx(tk,{label:e.title,onChange:function(e){return i({labelFormat:e})},id:"format-number",currentValue:r.labelFormat,testId:"format-number"})]},n)}))})]})})},rk=function(e){return c.jsxs(zf,{alignItems:"center",children:[c.jsx(Qm,{onChange:function(t){e.onChange(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(vm,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},ik=function(e){var t,n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b=md(),x=b.textOverride,y=b.dateTimeFormatOptions,w=[{label:x("auto","Auto"),value:"auto"},{label:x("minimal","Minimal"),value:2},{label:x("None","None"),value:0}],j=Object.keys(y).map((function(e){return{label:y[e].description,value:e}})),C="horizontalBarChart"==e.attributes.type,S=(null==(t=e.attributes)||null==(t=t.dimension)?void 0:t.length)>0&&"number"===Yr(e.dataSet,null==(n=e.attributes)||null==(n=n.dimension[0])?void 0:n.field).dataType&&!(null!=(r=e.attributes)&&r.timeDimension),F=!(null==(i=e.attributes)||!i.timeDimension),k=C?{x:"y",y:"x"}:{x:"x",y:"y"},_=k.x,T=k.y;return c.jsx(Fw,{title:null==(o=e.section)?void 0:o.title,tooltip:null==(a=e.section)?void 0:a.description,"data-component":"axis-preference-section",children:c.jsxs(Fw.Container,{"data-component":"single-stats-labels",children:[c.jsxs(Fw.Panel,{title:null==(l=e.section[T])?void 0:l.title,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{label:e.section[T].prefix.title,setText:function(t){return e.setAttributes({yAxisPrefix:t})},currentValue:e.attributes.yAxisPrefix,maxLength:4,id:"axis-"+T+"-prefix"}),c.jsx(YF,{label:e.section[T].postfix.title,setText:function(t){return e.setAttributes({yAxisPostfix:t})},currentValue:e.attributes.yAxisPostfix,maxLength:4,id:"axis-"+T+"-postfix"})]}),c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(tk,{label:null==(s=e.section[T].format)?void 0:s.title,id:"axis-"+T+"-format",onChange:function(t){return e.setAttributes({yAxisFormat:t})},currentValue:e.attributes.yAxisFormat,testId:"axis-"+T+"-format"}),c.jsx(UF,{id:"axis-"+T+"-label-count",label:e.section.y.count.title,currentValue:e.attributes.approxYAxisLabelCount,onSelect:function(t){return e.setAttributes({approxYAxisLabelCount:t})},options:w})]}),c.jsx(Fw.Grid,{children:c.jsx(YF,{label:null!=(u=null==(d=e.section[T].axisTitle)?void 0:d.title)?u:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[T]=t,n)})},currentValue:null==(p=e.attributes.axisTitles)?void 0:p[T],id:"axis-"+[T]+"-axisTitle"})})]}),c.jsxs(Fw.Panel,{title:e.section[_].title,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{label:e.section[_].prefix.title,setText:function(t){return e.setAttributes({xAxisPrefix:t})},currentValue:e.attributes.xAxisPrefix,maxLength:4,id:"axis-"+_+"-prefix"}),c.jsx(YF,{label:e.section[_].postfix.title,setText:function(t){return e.setAttributes({xAxisPostfix:t})},currentValue:e.attributes.xAxisPostfix,maxLength:4,id:"axis-"+_+"-postfix"})]}),c.jsx(Fw.Grid,{columns:S||F?2:1,children:c.jsxs(c.Fragment,{children:[S&&c.jsx(tk,{label:null==(f=e.section[_].format)?void 0:f.title,id:"axis-"+_+"-format",onChange:function(t){e.setAttributes({xAxisFormat:t})},currentValue:e.attributes.xAxisFormat,testId:"axis-"+T+"-format"}),F?c.jsxs(c.Fragment,{children:[c.jsx(UF,{id:"axis-"+_+"-label-date-format",label:(null==(m=e.section.x)||null==(m=m.format)?void 0:m.title)||"Format",currentValue:e.attributes.xAxisFormat,onSelect:function(t){return e.setAttributes({xAxisFormat:t})},options:j}),c.jsx(UF,{id:"axis-"+_+"-label-count",label:e.section.x.count.title,currentValue:e.attributes.approxXAxisLabelCount,onSelect:function(t){return e.setAttributes({approxXAxisLabelCount:t})},options:w})]}):c.jsx(rk,{label:x("hide_labels","Hide Labels"),onChange:function(t){return e.setAttributes({approxXAxisLabelCount:t?0:"auto"})},id:"hide-labels",currentValue:0===e.attributes.approxXAxisLabelCount})]})}),c.jsx(Fw.Grid,{children:c.jsx(YF,{label:null!=(h=null==(v=e.section[_].axisTitle)?void 0:v.title)?h:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[_]=t,n)})},currentValue:null==(g=e.attributes.axisTitles)?void 0:g[_],id:"axis-"+[_]+"-axisTitle"})})]})]})})},ok={filters:[[]],ruleValue:"#1FF985",ruleValueEnd:void 0,ruleType:"backgroundColor"},ak=function(e,t){return!!Ve(t).validate(e).error},lk=function(e){return null!=e&&e.show?c.jsx(sk,Q({},e)):null},sk=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=t.useState(null!=(n=e.conditionalFormatting)&&n.ruleValueEnd?"gradient":"single"),l=a[0],s=a[1],u=md(),d=u.queryEngineConfig,p=u.textOverride,f="basicTable"!=e.componentType,m=function(e,t,n,r,i,o){return[].concat(function(e,t){return[].concat(t).flatMap((function(t){var n=Yr(e,t.field);return"date_time"==n.dataType?[]:[{label:n.publicName,value:n,icon:c.jsx(Uf,{icon:n.dataType,paddingTop:0}),function:t.function}]}))}(e,t),function(e,t,n,r,i){return t.map((function(t){var o=Yr(e,t.field);return{label:o.publicName+(At(t)?" ("+le(t.function,r)+")":""),value:kw(o,t.function,i,n),icon:c.jsx(Uf,{icon:n?"number":o.dataType,paddingTop:0}),function:t.function}}))}(e,n,r,i,o))}(e.dataSet,e.dimension,e.measures,f,p,d.supportedAggregates),h=function(e,n,r,i,o){void 0===o&&(o=!1);var a=md().queryEngineConfig,l=t.useState(null!=e?e:Q({},ok,{ruleType:r})),s=l[0],u=l[1],d=Aw(s.filters,i,a.supportedAggregates,{startWithEmptyField:!0,maxFilters:1,enableChangeToNumber:o}),c=d.completedFilters,p=d.wipFilters,f=d.deleteWipFilter,m=d.updateWipFilter;t.useEffect((function(){u(e||ok)}),[JSON.stringify(e)]);var h=function(e){u(Q({},s,e))};return t.useEffect((function(){return h({filters:c})}),[JSON.stringify(c)]),Q({},s,{completedFilters:c,wipFilters:p,handleUpsert:function(){n(Q({},s,{ruleType:r}))},deleteWipFilter:f,updateWipFilter:m,onChange:h,disabled:ak(Q({},s,{ruleType:r}),a)})}(null==e?void 0:e.conditionalFormatting,e.onSave,e.ruleType,e.dataSet,f),v=h.onChange,g=h.ruleValue,b=h.ruleValueEnd,x=h.disabled,y=h.handleUpsert,w=h.completedFilters,j=h.wipFilters,C=h.deleteWipFilter,S=h.updateWipFilter,F=Br(e.componentType);t.useEffect((function(){var e,t,n,r;void 0===(null==(e=j[0][0])?void 0:e.field)&&(o(!1),s("single")),"none"!==(null==(t=j[0][0])?void 0:t.function)&&void 0!==(null==(n=j[0][0])?void 0:n.function)||"number"===(null==(r=j[0][0])||null==(r=r.field)?void 0:r.dataType)?o(!0):(o(!1),s("single"))}),[j]);var k=function(){if(e.numberConditionalFormattingOnly)return[].concat(Object.keys(d.supportedOperators)).flatMap((function(e,t){return">="===e||"<="===e?{label:d.supportedOperators[e].publicName,value:e,testId:"pick-op-"+t}:[]}))}();return c.jsxs(kv,{isOpen:!0,onClose:e.onClose,width:"4xl",children:[c.jsx(kv.Header,{title:p("add_conditional_formatting","Add Conditional Formatting"),hiddenUnlessEnabledInCss:!1}),c.jsx(kv.Content,{children:c.jsxs(Ud,{gap:"1rem",children:[c.jsx(Fw.Panel,{children:c.jsx(ww,{fieldHeadingOverride:p("field","Field"),queryEngineConfig:d,dataSet:e.dataSet,completedFilters:w,wipFilters:j,updateWipFilter:S,deleteWipFilter:C,overrideFieldOptions:m,maxOrFilters:1,textOverride:p,supportedQueryOperators:k})}),c.jsx(Fw.Panel,{children:c.jsxs(zf,{gap:"1rem",direction:"column",children:[i&&F.supportedFeatures.colorGradient&&c.jsx(sy,{options:[{label:p("color_format.single","Single"),value:"single"},{label:p("color_format.gradient","Gradient"),value:"gradient"}],name:"gradient-check",label:p("select_percentage_type","Select Percentage Type"),selected:l,labelHidden:!0,onChange:function(e){s(e),v({ruleValueEnd:"gradient"===e?"#16A257":void 0})}}),c.jsxs(zf,{gap:"0.5rem",children:[c.jsx(_f,{flex:1,children:c.jsx(WF,{id:"color-formatting",label:"gradient"===l?p("start_color","Start Color"):p("color","Color"),currentValue:g,setColor:function(e){return v({ruleValue:e})}})}),c.jsx(_f,{flex:1,children:"gradient"===l&&i&&F.supportedFeatures.colorGradient&&c.jsx(WF,{id:"color-formatting-end",label:p("end_color","End Color"),currentValue:null!=b?b:"#16A257",setColor:function(e){return v({ruleValueEnd:e})}})})]})]})})]})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:e.onClose,children:p("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return y()},disabled:x,children:p("save","Save")})]})})]})};function uk(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}var dk=Object.assign((function(){}),{Swatch:function(e){return c.jsx("span",{className:""+ck(e.color)})}}),ck=function(e){return As({backgroundColor:e,width:"1rem",height:"1rem",borderRadius:"0.125rem",display:"inline-block"})},pk=function(e){var t,n=md().textOverride,r=null==(t=e.rule.filters)?void 0:t[0][0],i=r.function,o=r.value,a=r.op,l=Yr(e.dataSet,r.field);return c.jsxs(zf,{alignItems:"center",as:"span",direction:"row",children:[c.jsx("span",{className:""+tu.text,dangerouslySetInnerHTML:{__html:n("display_conditional_format_configuration","If <strong>[[fieldName]] [[fieldFunction]]</strong> is <strong>[[operator]]</strong> <strong>[[value]]</strong> then color is",{fieldName:l.publicName,fieldFunction:i&&"none"!=i?"("+i+")":"",operator:a,value:o})}}),c.jsxs(_f,{as:"span",marginLeft:"0.5rem",height:"1rem",children:[c.jsx(dk.Swatch,{color:e.rule.ruleValue}),e.rule.ruleValueEnd&&c.jsx(dk.Swatch,{color:e.rule.ruleValueEnd})]})]})},fk=function(e){var n=t.useState(!1),r=n[0],i=n[1],o=md(),a=o.textOverride;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:o.mode,onOrderChange:function(t,n){var r=Iy([].concat(e.conditionalFormattingRules),t,n);e.onSetConditionalFormattingRules(r)},items:mk(e.queryEngineConfig,e.conditionalFormattingRules,e.dataSet,a,i),newItemBtn:{callToAction:a("add_condition","Add Condition"),onClick:function(){return i(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.conditionalFormattingRules)?n:[]);r.splice(t,1),e.onSetConditionalFormattingRules(r)}}),c.jsx(lk,{ruleType:e.ruleType,dataSet:e.dataSet,conditionalFormatting:"boolean"!=typeof r?r:void 0,show:!!r,onClose:function(){return i(!1)},measures:e.measure,dimension:e.dimension||[],onSave:function(t){var n=uk(r,e.conditionalFormattingRules,t);e.onSetConditionalFormattingRules(n),i(!1)},componentType:e.componentType,numberConditionalFormattingOnly:e.numberConditionalFormattingOnly})]})};function mk(e,t,n,r,o){return(null!=t?t:[]).map((function(t){var a;if(!i.isArray(t.filters)||i.isArray(t.filters),0===t.filters[0].length)return{title:r("error","Error"),subtext:r("invalid_rule","Invalid or broken rule")};var l=Me(null==(a=t.filters)?void 0:a[0][0].field,e);try{return{title:Yr(n,l.field).publicName,subtext:c.jsx(pk,{dataSet:n,rule:t,queryEngineConfig:e}),onClick:function(){return o(t)}}}catch(e){return{title:r("error","Error"),subtext:r("invalid_rule","Invalid or broken rule")}}}))}var hk=function(e){var t,n=e.section,r=e.attributes;return c.jsx(Fw,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsx(zf,{gap:"0.75rem",direction:"column",children:n.subSection?null==(t=n.subSection)?void 0:t.map((function(t,i){var o,a,l="bar"===t.propKey?r.barMeasure:"line"===t.propKey?r.lineMeasure:[];return c.jsxs("div",{children:[c.jsx(fv,{children:t.title}),c.jsx(fk,{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:l,dataSet:e.dataSet,conditionalFormattingRules:null!=(o=null==r||null==(a=r.conditionalFormattingRules)?void 0:a[t.propKey])?o:void 0,queryEngineConfig:e.queryEngineConfig,componentType:e.attributes.type,numberConditionalFormattingOnly:"line"===t.propKey})]},i)})):c.jsx(fk,{dimension:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)?[]: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,componentType:e.attributes.type,numberConditionalFormattingOnly:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)})})})},vk=function(e){var n,r,i=md(),o=i.dateTimeFormatOptions,a=i.textOverride;return c.jsx(Fw,{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==(r=r.subSection)?void 0:r.map((function(n,r){return c.jsxs(t.Fragment,{children:["time"===n.type&&c.jsx("div",{children:c.jsx(Sm,{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,textOverride:a})}),"fontSize"===n.type&&c.jsx(YF,{label:null==n?void 0:n.title,currentValue:e.attributes.fontSize,setText:function(t){return e.setAttributes({fontSize:t})}})]},r)}))})},gk=function(e,t){return t.map((function(t){return{label:Yr(e,t.field).publicName,value:_t(t)}}))};function bk(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],m=md().textOverride;return c.jsxs(kv,{isOpen:r,onClose:i,width:"sm",children:[c.jsx(kv.Header,{title:m("choose_a_prefix","Choose a prefix")}),c.jsxs(kv.Content,{children:[c.jsxs(Ov,{children:[c.jsx(fv,{children:m("field","Field")}),c.jsx(Sm,{options:gk(n,o),selected:s,onChange:function(e){return u(e)},textOverride:m})]}),c.jsx(YF,{label:m("prefix","Prefix"),currentValue:p,setText:f})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:i,children:m("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){s&&p&&(a({field:s,prefix:p}),i())},children:m("save","Save")})]})})]})}var xk=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1],l=md(),s=l.textOverride;return c.jsxs(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[c.jsx(xh,{mode:l.mode,items:(null!=(r=e.attributes.prefixes)?r:[]).map((function(t){var n=Re(t.field,e.queryEngineConfig),r=n.function;return{title:Yr(e.dataSet,n.fieldId).publicName+("none"!=r?" ("+e.queryEngineConfig.supportedAggregates[r].publicName+")":""),subtext:t.prefix}})),newItemBtn:{callToAction:s("add_prefix","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(bk,{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])})}})]})},yk=function(e){var t,n=md().textOverride;if("mercatorMap"!=e.attributes.type)return null;var r=e.attributes,o=r.backgroundColor,a=r.noDataColor,l=r.maxValueColor,s=r.minValueColor,u=i.debounce(e.setAttributes,200);return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsxs(Fw.Grid,{columns:2,children:[c.jsx("div",{children:c.jsx(WF,{id:"map-background-color",label:n("background","Background"),currentValue:o,setColor:function(e){return u({backgroundColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-no-data-color",label:n("no_data","No data"),currentValue:a,setColor:function(e){return u({noDataColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-min-value-color",label:n("min_value","Min value"),currentValue:s,setColor:function(e){return u({minValueColor:e})}})}),c.jsx("div",{children:c.jsx(WF,{id:"map-max-value-color",label:n("max_value","Max value"),currentValue:l,setColor:function(e){return u({maxValueColor:e})}})})]})})},wk={name:"135831l",styles:"font-size:0.75rem;line-height:1rem;opacity:0.8"},jk=function(e){var t,n,r=md(),i=r.numberFormatOptions,o=r.textOverride,a=r.labelFormat,l=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return c.jsxs(Fw,{title:null==e||null==(t=e.section)?void 0:t.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[0==e.attributes.measure.length&&c.jsx("p",{css:wk,children:o("stats_label_warning","Please select a metric on the data panel.")}),c.jsx(Fw.Container,{"data-component":"single-stats-labels",children:[].concat(e.attributes.measure).map((function(t,n){var r,i,o,s,u,d=gs(Yr(e.dataSet,t.field).publicName,null==(r=e.queryEngineConfig.supportedAggregates[t.function])?void 0:r.publicName),p=a({fieldId:t.field,func:t.function,type:e.attributes.type,defaultLabel:d,viewId:e.attributes.viewId});return c.jsxs(Fw.Panel,{title:null!=p?p:d,children:[c.jsxs(Fw.Grid,{columns:2,children:[c.jsx(YF,{id:"prefix_"+n,label:null==e||null==(i=e.section)?void 0:i.prefix.title,currentValue:e.attributes.prefixes?e.attributes.prefixes[_t(t)]:void 0,setText:function(n){var r,i=Q({},e.attributes.prefixes,((r={})[_t(t)]=n,r));e.setAttributes({prefixes:i})}}),c.jsx(YF,{id:"postfix_"+n,label:null==e||null==(o=e.section)?void 0:o.postfix.title,currentValue:e.attributes.postfixes?e.attributes.postfixes[_t(t)]:void 0,setText:function(n){var r,i=Q({},e.attributes.postfixes,((r={})[_t(t)]=n,r));e.setAttributes({postfixes:i})}})]}),c.jsx(Fw.Grid,{children:c.jsx(UF,{id:"format_"+n,options:l,currentValue:e.attributes.formatter&&e.attributes.formatter[_t(t)]||"_vizzly_number",onSelect:function(n){var r,i=Q({},e.attributes.formatter,((r={})[_t(t)]=n,r));e.setAttributes({formatter:i})},label:null!=(s=null==e||null==(u=e.section)||null==(u=u.format)?void 0:u.title)?s:"Format"})})]},n)}))})]})},Ck={value:void 0,strokeStyle:"dashed",strokeWidth:2,color:Ds(0),label:void 0},Sk=function(e){return!!ft().validate(e).error},Fk=function(e){return null!=e&&e.show?c.jsx(kk,Q({},e)):null},kk=function(e){var n=md().textOverride,r=function(e,n){var r=t.useState(null!=e?e:Ck),i=r[0],o=r[1];return t.useEffect((function(){o(e||Ck)}),[JSON.stringify(e)]),Q({},i,{handleUpsert:function(){n(i)},onChange:function(e){o(Q({},i,e))},disabled:Sk(i)})}(null==e?void 0:e.goalLine,null==e?void 0:e.onSave),i=r.value,o=r.onChange,a=r.color,l=r.disabled,s=r.handleUpsert;return c.jsxs(kv,{isOpen:!0,onClose:null==e?void 0:e.onClose,width:"xl",children:[c.jsx(kv.Header,{title:n("add_goal_line","Add Goal Line")}),c.jsx(kv.Content,{children:c.jsxs(Ud,{columns:["1fr","1fr"],gap:"1rem",children:[c.jsx(Ov,{children:c.jsx(Cj,{id:"goal-line-value",label:n("value","Value"),currentValue:i,setNumber:function(e){return o({value:e})}})}),c.jsx(WF,{id:"color-formatting",label:n("color","Color"),currentValue:a,setColor:function(e){return o({color:e})}})]})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{secondary:!0,onClick:null==e?void 0:e.onClose,children:n("cancel","Cancel")}),c.jsx(Fh,{onClick:function(){return s()},disabled:l,children:n("save","Save")})]})})]})},_k=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=md(),l=a.textOverride;return c.jsxs(c.Fragment,{children:[c.jsx(xh,{mode:a.mode,onOrderChange:function(t,n){var r=Iy([].concat(e.goalLines),t,n);e.onSetGoalLineRules(r)},items:(null!=(n=e.goalLines)?n:[]).map((function(e){return{title:c.jsxs(zf,{alignItems:"center",gap:"0.25rem",children:[c.jsx(dk.Swatch,{color:e.color}),c.jsx("span",{dangerouslySetInnerHTML:{__html:l("goal_line_configuration","Set to <strong>[[ruleValue]]</strong>",{ruleValue:e.value})}})]}),onClick:function(){return o(e)}}})),newItemBtn:{callToAction:l("add_goal_line","Add Goal Line"),onClick:function(){return o(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.goalLines)?n:[]);r.splice(t,1),e.onSetGoalLineRules(r)}}),c.jsx(Fk,{show:!!i,goalLine:"boolean"!=typeof i?i:void 0,onClose:function(){return o(!1)},onSave:function(t){o(!1);var n=uk(i,e.goalLines,t);e.onSetGoalLineRules(n)}})]})},Tk=function(e){var t;return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(_k,{onSetGoalLineRules:function(t){return e.setAttributes({goalLines:t})},goalLines:e.attributes.goalLines})})},Ak=Object.assign((function(){return null}),{container:As({position:"relative"}),overlay:As({position:"absolute",inset:0,zIndex:2}),content:As({opacity:.5})}),Dk=function(e){return null!=e&&e.enabled?c.jsxs("div",{className:""+Ak.container,"aria-disabled":"true",children:[c.jsx("div",{className:""+Ak.overlay,children:(null==e?void 0:e.message)&&c.jsx(zf,{justifyContent:"center",alignItems:"center",height:"100%",className:""+Ak.overlay,children:c.jsx(_f,{marginX:"3.5rem",children:c.jsx("div",{style:{textAlign:"center"},children:null==e?void 0:e.message})})})}),c.jsx("div",{className:""+Ak.content,children:null==e?void 0:e.children})]}):c.jsx(t.Fragment,{children:null==e?void 0:e.children})},Ik=function(e){var n=md().textOverride;return c.jsx(t.Fragment,{children:c.jsxs(Fw.Grid,{children:[0===e.attributes.goals.length&&c.jsx(vy,{type:"info",title:n("progress.goals_need to be set","Goals need to be set")}),c.jsx(Dk,{enabled:0===e.attributes.goals.length,children:c.jsx(UF,{options:[{value:wr.Linear,label:n("linear","Linear")},{value:wr.Circular,label:n("circular","Circular")}],currentValue:OC(e.attributes.progressType),onSelect:function(t){var n=e.attributes.progressType.map((function(e){return Q({},e,{value:t})}));e.setAttributes({progressType:n})},label:n("type","Type")})})]})})},Ok=function(e){var t,n,r,i=md().textOverride;if(e.dataSet.preAggregated)return null;if(!dx(e.attributes.order,e.attributes.timeDimension))return null;var o=[{label:i("none","None"),value:null},{label:i("current","Current"),value:"current"}];return c.jsx(Fw,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(Sm,{id:"headline-options",label:i("options","Options"),labelHidden:!0,onChange:function(t){e.setAttributes({headline:{func:t}})},options:o,selected:null!=(n=null==(r=e.attributes.headline)?void 0:r.func)?n:null,textOverride:i,onClick:function(){uj("bottom","editor-panel")}})})},Pk=function(e){return c.jsx(zF,{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(ek,Q({},e,{section:r})),"progressType"===r.type&&c.jsx(Ik,Q({},e,{section:r})),"format"===r.type&&c.jsx(vk,Q({},e,{section:r})),"prefixes"===r.type&&c.jsx(xk,Q({},e,{section:r})),"axisLabels"===r.type&&c.jsx(ik,Q({},e,{section:r})),"mapColors"===r.type&&c.jsx(yk,Q({},e,{section:r})),"conditionalFormatting"===r.type&&c.jsx(hk,Q({},e,{section:r})),"goalLine"===r.type&&c.jsx(Tk,Q({},e,{section:r})),"chartStyles"===r.type&&c.jsx(nk,Q({},e,{section:r})),"headline"===r.type&&c.jsx(Ok,Q({},e,{section:r})),"statsLabels"===r.type&&c.jsx(jk,Q({},e,{section:r}))]},i)}))})},Ek=function(){var e=Ky(),t=md();if(!e)return c.jsx(nm,{});var n=Br(e.component.attributes.type,{queryEngineConfig:e.queryEngineConfig,textOverride:e.textOverride});return c.jsx(Il,{renderOnError:function(e){return c.jsx(dv,{onManualRetry:e})},onError:t.onError,children:c.jsx(Pk,{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(n.formatPanelConfig(),{type:e.component.attributes.type})})})};function Mk(e){var t=md().textOverride;return c.jsxs(Av.Group,{defaultIndex:e.defaultTabOpen||0,children:[c.jsxs(Av.List,{columns:"1fr 1fr",children:[c.jsx(Av.Button,{"data-component":"tab-data",children:t("editor.tab.heading.data","Data")}),c.jsx(Av.Button,{"data-component":"tab-format",children:t("editor.tab.heading.format","Format")})]}),c.jsxs(Av.Panels,{children:[c.jsx(Av.Panel,{children:c.jsx($F,{})}),c.jsx(Av.Panel,{children:c.jsx(Ek,{})})]})]})}var Rk=function(e){return yn(null==e?void 0:e.component.attributes)?null:c.jsx(_f,{paddingX:24,paddingTop:16,children:c.jsx(vy,{title:"Feedback",type:"info",children:xn(null==e?void 0:e.component.attributes)})})},Lk=Object.assign((function(){return null}),{panel:function(e){return As(Q({height:"100%",overflow:"overlay",padding:2===e?0:"0 8px",marginLeft:2===e?"-0.5rem":void 0},Ef))},view:As(Q({height:"100%",overflow:"overlay"},Ef))}),Nk=t.createContext(void 0),zk=t.forwardRef((function(e,n){var r,i,o,a=Xd(),l=t.useRef(null),s=function(){var e=l.current;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")};t.useImperativeHandle(n,(function(){return{focus:function(){var e;null==(e=l.current)||e.focus()}}})),t.useEffect((function(){l.current&&e.enableFocus&&l.current.focus()}),[]),t.useEffect((function(){s()}),[e.value]);var u=!e.submitDisabled&&"\n"!==e.value&&"\n\n"!==e.value;return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(vm,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),c.jsxs(zf,{className:""+gm(null!=(r=null==e?void 0:e.inputTheme)?r:null==a||null==(i=a.forms)?void 0:i.input,null==e?void 0:e.error),alignItems:"flex-start",maxHeight:200,children:[c.jsx("textarea",{id:null==e?void 0:e.id,ref:l,className:""+qk({isDisabled:null!=e&&e.disabled?"true":"false"}),"data-themeapi":"forms.input","data-chipposition":"above.right",onKeyDown:function(t){"Enter"===t.key&&!t.shiftKey&&u&&(t.preventDefault(),e.handleSubmit())},disabled:null==e?void 0:e.disabled,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.placeholder,onChange:null==e?void 0:e.onChange,rows:1,onInput:s,onFocus:null==e?void 0:e.onFocus,onBlur:null==e?void 0:e.onBlur}),c.jsx("button",{"aria-label":null==e?void 0:e.submit.label,onClick:null==e?void 0:e.handleSubmit,className:""+Bk(null==a?void 0:a.icons),children:c.jsx("span",{children:null!=(o=e.submit.icon)?o:null==e?void 0:e.submit.label})})]})]})})),qk=As(Q({flex:1,border:"none",background:"transparent",marginRight:6,resize:"none",lineHeight:"1.5",maxHeight:180,"&:focus":{outline:"none"},fontStyle:"inherit",fontSize:"inherit",fontFamily:"inherit"},Ef,{variants:{isDisabled:{true:{opacity:.5}}}})),Bk=function(e){var t;return As({border:"none",background:"transparent",cursor:"pointer",padding:0,paddingBottom:2,alignSelf:"flex-end","&:focus":{outline:"none"},"&[disabled]":{cursor:"initial"},"& svg":{fill:null==e?void 0:e.color,"&:hover":{fill:null==e||null==(t=e["&:hover"])?void 0:t.color}}})},Wk=function(e){var t=md().textOverride;return c.jsxs(zf,{children:[e.onReload&&c.jsx(Vk,{label:t("refetch_response","Refetch response"),icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"18",height:"18",children:c.jsx("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})}),onChange:e.onReload,"data-id":e["data-id"]+"-reload"}),e.onThumbsUp&&c.jsx(Vk,{label:t("ai.good_response","Good response"),icon:c.jsx(e.thumbsUp?zd:Nd,{}),onChange:e.onThumbsUp,"data-id":e["data-id"]+"-thumbs-up","data-selected":e.thumbsUp?"true":"false"}),e.onThumbsDown&&c.jsx(Vk,{label:t("ai.bad_response","Bad response"),icon:c.jsx(e.thumbsDown?Bd:qd,{}),onChange:e.onThumbsDown,"data-id":e["data-id"]+"-thumbs-down","data-selected":e.thumbsUp?"true":"false"}),e.onSelect&&c.jsx(Vk,{label:t("show_this_change","Show this change"),onChange:e.onSelect,icon:c.jsx(Wd,{}),"data-id":e["data-id"]+"-select"})]})},Vk=function(e){var t=Xd();return c.jsx(_f,{children:c.jsx(ih,{tooltipContent:function(){return e.label},children:c.jsx("button",{onClick:function(){return e.onChange()},"aria-label":e.label,className:""+Hk(null==t?void 0:t.icons),"data-testid":e["data-id"],"data-select":e["data-selected"],children:e.icon})})})},Hk=function(e){var t;return As(Q({border:"none",background:"transparent",cursor:"pointer",padding:0,width:30,height:30,borderRadius:"50%",stroke:null==e?void 0:e.color},Ts,{"&:hover":Q({},Ts,{stroke:null==e||null==(t=e["&:hover"])?void 0:t.color})}))},Yk=function(e){return e.User="user",e.AI="ai",e}({}),Uk=function(e){return e.WaitingForMessage="waitingForMessage",e.Thinking="thinking",e}({}),Gk=function(e){return e.ThumbsUp="thumbs_up",e.ThumbsDown="thumbs_down",e}({}),Kk=function(e){return e.Warning="warning",e.Critical="critical",e.Info="info",e}({}),Xk=function(e){var t=md();return c.jsx(Qk,Q({},e,{label:(0,t.textOverride)("ai.you","You"),icon:c.jsx(Md,{width:16,height:16})}))},Qk=function(e){var t=Xd();return c.jsxs(Ud,{columnGap:"0.5rem",as:"li",areas:'"icon title"\n "empty content"',columns:["max-content","1fr"],children:[c.jsx(_f,{width:30,area:"icon",children:c.jsx("div",{className:""+Jk(null==t?void 0:t.ai),"data-conversationid":e.id,children:e.icon})}),c.jsx(_f,{area:"title",alignSelf:"end",children:c.jsx(vm,{as:"p",children:e.label})}),c.jsxs(_f,{area:"content",children:[e.loading&&c.jsx(_f,{width:40,paddingY:8,children:c.jsx(im,{color:"#3074d9"})}),!e.loading&&e.message&&c.jsxs(zf,{gap:"0.5rem",direction:"column",children:[c.jsx(_f,{children:e.message}),e.options&&c.jsx(Wk,Q({},e.options))]})]})]})},Jk=function(e){var t,n,r;return As({border:null==e||null==(t=e.avatar)?void 0:t.border,width:30,height:30,borderRadius:"50%",backgroundColor:null==e||null==(n=e.avatar)?void 0:n.background,display:"flex",alignItems:"center",justifyContent:"center","& svg":{fill:null==e||null==(r=e.avatar)?void 0:r.color}})},Zk=Object.assign({},{Replies:function(e){return e.sender_type===Yk.AI?c.jsx(Qk,{message:e.content,label:"Vizzly AI",icon:c.jsx(Rd,{}),onTypingEnd:e.onTypingEnd,options:e.options,id:e.id}):c.jsx(Xk,{message:e.content,id:e.id})},Loading:function(){return c.jsx(Qk,{label:"Vizzly AI",icon:c.jsx(Mu,{width:20,height:20}),loading:!0,id:"loading"})},Reply:Qk,You:Xk}),$k={conversationId:void 0,message:"",messageState:Uk.WaitingForMessage,messageHistory:[]},e_=["How could I improve this visualisation?","Show me a line chart."],t_=t.createContext({}),n_=function(e){var n=t.useState(void 0),r=n[0],i=n[1],o=t.useState(!1),a=o[0],l=o[1],s=function(){var t=X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l(!0),a||r){t.next=15;break}return t.prev=2,t.next=5,e.fetchSuggestions();case 5:i(t.sent),l(!1),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),Ae(t.t0),i(e_),l(!1);case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(){return t.apply(this,arguments)}}();return c.jsx(t_.Provider,{value:{onAsk:e.onAsk,onAction:e.onAction,suggestions:r,fetchSuggestions:s},children:e.children})},r_=function(){return t.useContext(t_)},i_=function(e){var t=r_().suggestions,n=md().textOverride,r=Xd();return c.jsxs(_f,{as:"li",children:[c.jsx(_f,{as:"p",paddingBottom:"0.25rem",children:n("ai.ask_a_question_or_pick_a_suggestion","Ask a question or pick a suggestion:")}),c.jsxs(zf,{as:"ul",padding:0,margin:0,gap:"0.75rem",direction:"column",children:[!t&&c.jsx(_f,{as:"li",width:40,paddingY:8,children:c.jsx(im,{color:"#3074d9"})}),null==t?void 0:t.map((function(t,n){return c.jsx(_f,{as:"li",listStyle:"none",children:c.jsx("button",{className:""+o_(null==r?void 0:r.ai),onClick:function(){return e.onChange(t)},children:t})},n)}))]})]})},o_=function(e){var t,n,r,i,o,a,l,s;return As({border:null==e||null==(t=e.suggestions)?void 0:t.border,background:null==e||null==(n=e.suggestions)?void 0:n.background,color:null==e||null==(r=e.suggestions)?void 0:r.color,padding:null==e||null==(i=e.suggestions)?void 0:i.padding,borderRadius:null==e||null==(o=e.suggestions)?void 0:o.borderRadius,cursor:"pointer",minHeight:40,textAlign:"left",width:"100%","&:focus":{outline:"none"},"&:hover":{background:null==e||null==(a=e.suggestions)||null==(a=a["&:hover"])?void 0:a.background,color:null==e||null==(l=e.suggestions)||null==(l=l["&:hover"])?void 0:l.color,border:null==e||null==(s=e.suggestions)||null==(s=s["&:hover"])?void 0:s.border}})},a_=function(e){var r,i,o,a,l,s,u,d=md().textOverride,p=n.useState(!1),f=p[0],m=p[1],h=t.useRef(null),v=(i=t.useRef(r=e.attributes),t.useEffect((function(){i.current=r}),[]),i.current),g=r_(),b=g.onAction,x=function(e,n,r,i){var o=t.useRef(null),a=t.useState($k),l=a[0],s=a[1],u=t.useState(void 0),d=u[0],c=u[1],p=t.useCallback((function(e){s((function(t){return Q({},t,{message:e})})),c(void 0)}),[]),f=t.useCallback(function(){var t=X(G().mark((function t(a){var u,d,p,f,m,h,v,g;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c(void 0),o.current&&o.current.abort(),o.current=new AbortController,void 0!==a&&void 0!==a.message&&(u=a.message,s((function(e){return Q({},e,{message:u})}))),t.prev=4,!n||l.messageState===Uk.Thinking){t.next=16;break}return s((function(e){return Q({},e,{messageState:Uk.Thinking})})),t.next=9,n(null!=(d=null==a?void 0:a.message)?d:l.message,l.conversationId,e,o.current.signal);case 9:return m=(p=t.sent).conversationId,h=p.messageHistory,v=Br((f=p.attributes).type,{queryEngineConfig:r}),g=v.init(f.dataSetId,f),s(Q({},l,{conversationId:m,messageHistory:h,message:""})),i(g),t.abrupt("return",{status:"success"});case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),t.t0 instanceof vo?c({error:Kk.Info,message:"We stopped your question from being sent."}):t.t0 instanceof mo?c({error:Kk.Warning,message:t.t0.message}):t.t0 instanceof ho||t.t0 instanceof uo?c({error:Kk.Critical,message:t.t0.message}):Ae(t.t0),s((function(e){return Q({},e,{messageState:Uk.WaitingForMessage})}));case 22:return t.abrupt("return",{status:"failed"});case 23:case"end":return t.stop()}}),t,null,[[4,18]])})));return function(e){return t.apply(this,arguments)}}(),[n,l.message,l.messageState,e]);return Q({send:f,setMessage:p},l,{feedback:d,reset:function(){s($k),c(void 0)}})}(e.attributes,g.onAsk,e.queryEngineConfig,e.setAttributes),y=function(e,n){var r=t.useState({reactions:[]}),i=r[0],o=r[1],a=t.useCallback(function(){var t=X(G().mark((function t(r,i){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e||!n){t.next=6;break}return t.next=4,e(n,r,{reaction:i});case 4:t.sent.success&&o((function(e){return Q({},e,{reactions:[].concat(e.reactions||[],[{messageId:r,reaction:i}])})}));case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error sending AI reaction",t.t0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n){return t.apply(this,arguments)}}(),[e,n,i]);return Q({sendReaction:a},i)}(b,x.conversationId),w=x.messageState,j=x.messageHistory,C=x.message,S=x.feedback,F=(o=C,a=t.useRef(null),s=(l=t.useState(0))[0],u=l[1],t.useEffect((function(){var e=function(){u(a.current?a.current.clientHeight:0)};return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}),[o]),[a,s]),k=F[0],_=F[1],T=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&(e.current.scrollTop=e.current.scrollHeight)})),e}();return t.useEffect((function(){var e;w!==Uk.Thinking&&(null==(e=h.current)||e.focus())}),[w]),e.closed?null:c.jsxs(zf,{direction:"column",height:"100%",gap:"1.5rem",children:[e.closeAI&&c.jsxs(Dv,{buttons:"space-between",children:[c.jsx(Ch,{onClick:function(){return e.closeAI&&e.closeAI()},suppressed:!0,icon:{Icon:function(){return c.jsx(Vd,{})}},children:d("back_to_editor","Back to Editor")}),c.jsx(Ch,{onClick:function(){return m(!0)},children:d("new_chat","New Chat")})]}),c.jsxs(_f,{position:"relative",height:"100%",children:[c.jsx(_f,{height:0,children:c.jsx(Jw,{onClose:function(){var t=X(G().mark((function t(n){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n&&(x.reset(),e.setAttributes(v)),m(!1),t.abrupt("return",!0);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),message:d("ai.new_chat_modal_message","Are you sure you want to start a new chat? This will delete all your current changes."),show:f,deleteButtonLabel:d("ai.new_chat_modal_cta","Start new chat")})}),c.jsx("div",{className:""+s_(_),ref:T,children:c.jsx(zf,{gap:"2rem",direction:"column",overflow:"overlay",children:c.jsxs(zf,{gap:"1.25rem",direction:"column",as:"ul",padding:0,margin:0,children:[w!==Uk.Thinking&&(!j||0===(null==j?void 0:j.length))&&c.jsx(i_,{onChange:function(e){return x.send({message:e})}}),w===Uk.Thinking&&(!j||0===(null==j?void 0:j.length))&&c.jsxs(t.Fragment,{children:[c.jsx(Zk.You,{message:C,id:"thinking"}),void 0===S&&c.jsx(Zk.Loading,{})]}),j.length>0&&c.jsxs(t.Fragment,{children:[null==j?void 0:j.map((function(e,n){var r,i=null==(r=y.reactions)?void 0:r.filter((function(t){return t.messageId===e.id})),o=void 0;return console.log("ai",x),e.sender_type===Yk.AI&&void 0===S&&(o={onThumbsUp:x.conversationId?function(){return y.sendReaction(e.id,Gk.ThumbsUp)}:void 0,onThumbsDown:x.conversationId?function(){return y.sendReaction(e.id,Gk.ThumbsDown)}:void 0,thumbsUp:null==i?void 0:i.some((function(e){return e.reaction===Gk.ThumbsUp})),thumbsDown:null==i?void 0:i.some((function(e){return e.reaction===Gk.ThumbsDown})),"data-id":e.id}),c.jsx(t.Fragment,{children:c.jsx(Zk.Replies,Q({},e,{content:e.content,options:o}))},n+"_"+e.id)})),w===Uk.Thinking&&c.jsxs(t.Fragment,{children:[c.jsx(Zk.You,{message:C,id:"thinking"}),void 0===S&&c.jsx(Zk.Loading,{})]})]})]})})}),c.jsx("div",{className:""+l_,ref:k,children:c.jsxs(zf,{gap:"1rem",direction:"column",children:[S&&c.jsx(vy,{title:S.message,type:S.error}),c.jsxs(zf,{gap:"0.5rem",direction:"column",children:[c.jsx(zk,{ref:h,id:"input",label:"Message Vizzly",placeholder:d("ai.ask_me_a_question","Ask me a question..."),value:C,onChange:function(e){return x.setMessage(e.currentTarget.value)},labelHidden:!0,handleSubmit:X(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.send();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),submitDisabled:!C||w===Uk.Thinking,enableFocus:!0,disabled:w===Uk.Thinking,submit:w===Uk.Thinking?{label:d("stop_question","Stop Question"),icon:c.jsx(Ed,{})}:{label:d("submit_question","Submit Question"),icon:c.jsx(Pd,{})}}),c.jsx(_f,{as:"p",className:tu.textSize("xs")+" "+tu.color(Ds(50)),margin:0,padding:0,paddingLeft:"0.5rem",children:d("ai.ai_may_hallucinate","Responses may be inaccurate; verify details in the Editor.")})]})]})})]})]})},l_=As({position:"absolute",left:0,right:0,bottom:0}),s_=function(e){return As(Q({position:"absolute",left:0,top:0,right:0,overflowY:"scroll",bottom:e,paddingBottom:"1.5rem"},Ef))},u_=function(e){return c.jsx(a_,Q({},e))},d_=function(e){var r,o,a=Ky(),l=n.useState(!1),s=l[0],u=l[1],d=t.useContext(Nk),p=r_().fetchSuggestions,f=md().textOverride,m=Xd();if(!a)return c.jsx(nm,{});var h=a.setAttributes,v=a.dashboard,g=a.setResults,b=a.mode,x=a.origin,y=a.componentEditor,w=a.runQueriesCallback,j=a.component,C=a.dispatch,S=a.trackEvent,F=a.dataSet,k=a.queryEngineConfig,_=null==d?void 0:d.active,T="boolean"==typeof(null==m||null==(r=m.modals)||null==(r=r.options)||null==(r=r.showTitle)?void 0:r.editor)&&!(null!=m&&null!=(o=m.modals)&&null!=(o=o.options)&&null!=(o=o.showTitle)&&o.editor),A=(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(vv,{title:f("editor","Editor"),"data-component":"editor-header",hide:T}),c.jsx(bv,{"data-component":"editor-content",children:c.jsx(_f,{height:"40rem",width:"100%",children:c.jsxs(Ud,{columns:["24rem","1fr"],height:"100%",children:[!s&&c.jsx("div",{id:"editor-panel",className:""+Lk.panel(null==m?void 0:m.version),children:c.jsx(Mk,{})}),_&&c.jsx(u_,{closeAI:function(){return u(!1)},dataSet:F,attributes:j.attributes,setAttributes:h,queryEngineConfig:k,closed:!s}),c.jsxs(Ud,{rows:["1fr","100px"],className:""+Lk.view,children:[c.jsx(_f,{paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:c.jsx(zC,{id:"editor_"+Math.floor(1e11*Math.random()),isBeingSizeAdjusted:!1,setLocalFilters:a.setLocalFilters,setParameterUpdate:a.setParameterUpdate,runQueriesCallback:w,setResults:g,component:j,updateComponentAttributes:h,editor:!0,cellWidth:784})}),c.jsx(Rk,{component:j})]})]})})}),c.jsxs(gv,{buttons:_?"space-between":"end","data-component":"editor-footer",children:[_&&c.jsx(Dv,{children:c.jsx(Dk,{enabled:s,children:c.jsx(Fh,{secondary:!0,onClick:function(){return u(!0)},icon:{Icon:function(){return c.jsx(Ld,{})}},onMouseEnter:function(){p&&p()},children:f("ask_ai","Ask AI")})})}),c.jsxs(Dv,{buttons:"end",children:[c.jsx(Fh,{secondary:!0,onClick:function(){S("editor.changesCancelled"),e.onClose?e.onClose():C({type:"clearModal"}),u(!1)},children:A?f("cancel","Cancel"):f("close","Close")}),A&&c.jsx(Fh,{onClick:function(){S("editor.changesConfirmed"),C({type:"saveComponent",protectedComponent:"library"===x&&"admin"===b}),u(!1)},children:c_(b,f,x,(null==y?void 0:y.target.libraryIndex)!==v.componentLibrary.length)})]})]})]})};function c_(e,t,n,r){return"library"===n&&r?t("save","Save"):"library"===n?t("add_to_library","Add to Library"):"endUser"===e?t("save","Save"):t("confirm","Confirm")}var p_=function(e){var t=Xd();return c.jsxs("button",{onClick:e.onChange,disabled:null==e?void 0:e.disabled,className:Hd(""+f_(null==t?void 0:t.icons),e.className),children:[c.jsx("span",{className:""+eu,children:e.label}),e.children]})},f_=function(e){var t,n;return As(Q({},nu.button,{color:null==e?void 0:e.color,borderRadius:null==e?void 0:e.borderRadius,padding:null==e?void 0:e.padding,width:null==e?void 0:e.width,height:null==e?void 0:e.height,"&:hover":{background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}}))},m_=function(e){var n=Rm().dispatch,r=md(),i=r.onReset,o=r.textOverride,a=t.useState(!1),l=a[0],s=a[1],u=function(){var t=X(G().mark((function t(){var r;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(!0),t.next=3,i();case 3:(r=t.sent)&&n({type:"setDashboard",dashboard:r}),s(!1),null==e||e.onClose();case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=t.useState(!1),p=d[0],f=d[1];return t.useEffect((function(){e.show||(f(!1),s(!1))}),[e.show]),c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:o("confirm_reset","Confirm Reset"),show:!0}),c.jsx(kv.Content,{children:c.jsx(HF,{label:o("delete_all_dashboard_content","Any change you have made will be lost and the default dashboard will be restored."),setChecked:function(e){return f(e)},currentValue:p,id:"reset-dashboard",checkboxPosition:"top"})}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Ch,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},disabled:l,children:o("cancel","Cancel")}),c.jsx(Ch,{onClick:function(){p&&u()},disabled:!p||l,primary:!0,children:o("reset_dashboard","Reset Dashboard")})]})})]})},h_=function(e){var t=md(),n=t.textOverride;return!1===t.featureToggles.showResetButton?null:c.jsx(ih,{tooltipContent:function(){return n("reset_dashboard_to_default","Reset dashboard to default")},children:c.jsx(p_,{label:n("reset","Reset"),onChange:e.onChange,className:"vizzly_reset-button",disabled:null==e?void 0:e.disabled,children:c.jsx(Ku,{})})})},v_=function(e){return e[e.LOW=1]="LOW",e[e.NORMAL=2]="NORMAL",e[e.MEDIUM=3]="MEDIUM",e[e.HIGH=7]="HIGH",e[e.EXTREME=12]="EXTREME",e}({}),g_=function(e){return e[e.NONE=0]="NONE",e[e.SMALL=5]="SMALL",e[e.MEDIUM=10]="MEDIUM",e[e.LARGE=25]="LARGE",e}({}),b_={orientation:"portrait",format:"A4",margin:g_.NONE},x_=function(e){var n=t.useState(!1),r=n[0],i=n[1],o=md().textOverride,a=t.useState(b_),l=a[0],s=a[1];return c.jsxs(kv,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(kv.Header,{title:o("download_dashboard_to_pdf","Download dashboard to PDF"),show:!0}),c.jsxs(kv.Content,{children:[c.jsx("p",{children:o("pdf_download.description","Download the dashboard you see in this view.")}),c.jsx(sy,{options:[{label:o("pdf_download.page.orientation.portrait","Portrait"),value:"portrait"},{label:o("pdf_download.page.orientation.landscape","Landscape"),value:"landscape"}],name:"page-orientation",label:o("pdf_download.page.orientation","Orientation"),selected:l.orientation,labelHidden:!0,onChange:function(e){return s(Q({},l,{orientation:e}))}})]}),c.jsx(kv.Footer,{buttons:"end",children:c.jsxs(Dv,{children:[c.jsx(Fh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:o("cancel","Cancel")}),c.jsx(Fh,{primary:!0,onClick:function(){i(!0),kS().then((function(){i(!1),null==e||e.onClose(l)}))},disabled:r,children:o("download","Download")})]})})]})},y_=function(e){var n=md().textOverride;return c.jsxs(t.Fragment,{children:[e.showLabel&&c.jsx(Fh,{secondary:!0,onClick:e.onChange,disabled:e.disabled,children:c.jsxs(zf,{gap:"0.25rem",children:[c.jsx(Ad,{})," ",n("download_dashboard_to_pdf.button","Download to PDF")]})}),!e.showLabel&&c.jsx(ih,{tooltipContent:function(){return n("download_dashboard_to_pdf","Download dashboard to PDF")},children:c.jsx(p_,{onChange:e.onChange,disabled:e.disabled,label:n("download_dashboard_to_pdf.button","Download to PDF"),className:""+tu.pt(6),children:c.jsx(Ad,{})})})]})},w_=3.77952755906,j_={method:"save",resolution:v_.MEDIUM,page:{margin:g_.NONE,format:"A4",orientation:"portrait"},canvas:{mimeType:"image/jpeg",qualityRatio:1,useCORS:!0,logging:!1},overrides:{}},C_=function(){function e(e,t){var n,r,i,o,a;this.pdf=void 0,this.canvas=void 0,this.options=void 0,this.canvas=e,this.options=t,this.pdf=new H(Q({format:null!=(n=null==(r=this.options)||null==(r=r.page)?void 0:r.format)?n:j_.page.format,orientation:null!=(i=null==(o=this.options)||null==(o=o.page)?void 0:o.orientation)?i:j_.page.orientation},null==(a=this.options.overrides)?void 0:a.pdf,{unit:"mm"}))}var t=e.prototype;return t.getMarginTopMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginLeftMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginRightMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginBottomMM=function(){var e,t,n,r,i,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:j_.page.margin:null!=(r=null==(i=this.options)||null==(i=i.page)?void 0:i.margin)?r:j_.page.margin;return Number(o)},t.getMarginTop=function(){return this.getMarginTopMM()*w_},t.getMarginBottom=function(){return this.getMarginBottomMM()*w_},t.getMarginLeft=function(){return this.getMarginLeftMM()*w_},t.getMarginRight=function(){return this.getMarginRightMM()*w_},t.getScale=function(){var e;return null!=(e=this.options.resolution)?e:j_.resolution},t.getPageHeight=function(){return this.getPageHeightMM()*w_},t.getPageHeightMM=function(){return this.pdf.internal.pageSize.height},t.getPageWidthMM=function(){return this.pdf.internal.pageSize.width},t.getPageWidth=function(){return this.getPageWidthMM()*w_},t.getOriginalCanvasWidth=function(){return this.canvas.width/this.getScale()},t.getOriginalCanvasHeight=function(){return this.canvas.height/this.getScale()},t.getCanvasPageAvailableHeight=function(){return this.getPageAvailableHeight()*this.getScale()*this.getHorizontalFitFactor()},t.getPageAvailableWidth=function(){return this.getPageWidth()-(this.getMarginLeft()+this.getMarginRight())},t.getPageAvailableHeight=function(){return this.getPageHeight()-(this.getMarginTop()+this.getMarginBottom())},t.getPageAvailableWidthMM=function(){return this.getPageAvailableWidth()/w_},t.getPageAvailableHeightMM=function(){return this.getPageAvailableHeight()/w_},t.getNumberPages=function(){return Math.ceil(this.canvas.height/this.getCanvasPageAvailableHeight())},t.getHorizontalFitFactor=function(){return this.getPageAvailableWidth()<this.getOriginalCanvasWidth()?this.getOriginalCanvasWidth()/this.getPageAvailableWidth():1},t.getCanvasOffsetY=function(e){return this.getCanvasPageAvailableHeight()*(e-1)},t.getCanvasHeightLeft=function(e){return this.canvas.height-this.getCanvasOffsetY(e)},t.getCanvasPageHeight=function(e){if(this.canvas.height<this.getCanvasPageAvailableHeight())return this.canvas.height;var t=this.getCanvasHeightLeft(e);return t<this.getCanvasPageAvailableHeight()?t:this.getCanvasPageAvailableHeight()},t.getCanvasPageWidth=function(){return this.canvas.width},t.createCanvasPage=function(e){var t=this.getCanvasPageWidth(),n=this.getCanvasPageHeight(e),r=document.createElement("canvas");r.setAttribute("width",String(t)),r.setAttribute("height",String(n));var i=r.getContext("2d");return i&&i.drawImage(this.canvas,0,this.getCanvasOffsetY(e),this.canvas.width,n,0,0,this.canvas.width,n),r},t.convert=function(){for(var e=1,t=this.getNumberPages();e<=t;){var n,r,i,o,a,l,s,u;e>1&&this.pdf.addPage(null!=(a=null==(l=this.options)||null==(l=l.page)?void 0:l.format)?a:j_.page.format,null!=(s=null==(u=this.options)||null==(u=u.page)?void 0:u.orientation)?s:j_.page.orientation);var d=this.createCanvasPage(e),c=d.toDataURL(null!=(n=null==(r=this.options.canvas)?void 0:r.mimeType)?n:j_.canvas.mimeType,null!=(i=null==(o=this.options.canvas)?void 0:o.qualityRatio)?i:j_.canvas.qualityRatio);this.pdf.setPage(e),this.pdf.addImage({imageData:c,width:d.width/(this.getScale()*w_*this.getHorizontalFitFactor()),height:d.height/(this.getScale()*w_*this.getHorizontalFitFactor()),x:this.getMarginLeftMM(),y:this.getMarginTopMM()}),e+=1}return this.pdf},e}(),S_=function(e){return e?Q({},j_,e,{canvas:Q({},j_.canvas,e.canvas),page:Q({},j_.page,e.page)}):j_},F_=function(e){return e()},k_=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l,s,u,d,c,p,f;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=S_(n),o=F_(t)){e.next=4;break}throw new Error("Target element not found");case 4:return a=Q({useCORS:i.canvas.useCORS,logging:i.canvas.logging,scale:i.resolution},i.overrides.canvas),e.next=7,V(o,a);case 7:if(l=e.sent,null==n||!n.header){e.next=15;break}if(!(u=F_(null==n?void 0:n.header))){e.next=15;break}return e.next=13,V(u,a);case 13:s=__(s,e.sent,l);case 15:d=new C_(null!=(r=s)?r:l,i),c=d.convert(),e.t0=i.method,e.next="build"===e.t0?20:"open"===e.t0?21:23;break;case 20:return e.abrupt("return",c);case 21:return window.open(c.output("bloburl"),"_blank"),e.abrupt("return",c);case 23:return f=null!=(p=i.filename)?p:(new Date).getTime()+".pdf",e.next=26,c.save(f,{returnPromise:!0});case 26:return e.abrupt("return",c);case 27:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function __(e,t,n){e=document.createElement("canvas");var r=(t?t.height:0)+n.height,i=Math.max(t?t.width:0,n.width);e.width=i,e.height=r;var o=e.getContext("2d");return o&&(o.clearRect(0,0,i,r),t&&o.drawImage(t,0,0),o.drawImage(n,0,t?t.height:0)),e}var T_=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,A_=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,D_=/on[a-z]+\s*=\s*["'][^"']*["']/gi,I_=/javascript:[^\s"']+/gi;function O_(e){return X(G().mark((function t(){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,k_((function(){return document.getElementById("vizzly_dashboard_content")}),{method:"save",filename:"dashboard.pdf",page:null==e?void 0:e.page,header:function(){return document.getElementById("vizzly_dashboard_header")}});case 2:case"end":return t.stop()}}),t)})))}var P_,E_,M_=function(e){var t,n=e.pdfSettings,r=null==(t=document.getElementById("vizzly_dashboard_content"))?void 0:t.offsetWidth;if(null!=n&&n.header&&function(e){return function(e){return T_.test(e)||A_.test(e)||D_.test(e)||I_.test(e)}(e)}(null==n?void 0:n.header))throw new Error("Invalid content: potentially malicious elements detected.");return null!=n&&n.header?c.jsx("div",{dangerouslySetInnerHTML:{__html:(null==n?void 0:n.header)||""},id:"vizzly_dashboard_header",style:{position:"absolute",left:-9999,width:r}}):null},R_=function(){var e=t.useState(!1),n=e[0],r=e[1],o=t.useState(!1),a=o[0],l=o[1],s=Rm(),u=s.dashboard,d=s.dispatch,p=s.componentEditor,f=s.pickFromComponentLibrary,m=s.trackEvent,h=md(),v=h.maxCSVDownloadLimit,g=h.featureToggles,x=h.scope,y=h.isProgrammaticParent,w=h.textOverride,j=h.pdfSettings,C=h.containerWidth,S=h.componentOverrides,F=dC(JSON.stringify(u)),k=F[0],_=F[1],T=t.useState(!1),A=T[0],D=T[1];t.useEffect((function(){if(!window.disableViewCheck){var e=function(){D(!0),setTimeout((function(){return D(!1)}),1e3)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}),[]);var I=function(e,t){m("library.open"),d({type:"startPickingComponentFromLibraryForDisplay",rowIndex:e,cellIndex:t})},O=function(e,t){m("manageDisplay.removeCell"),d({type:"removeCell",rowIndex:e,cellIndex:t})},P=function(e,t){d({type:"startEditingComponent",displayTarget:{rowIndex:e,cellIndex:t},libraryIndex:null,component:null})},E=null!=p||null!=f,M="neither",R=void 0;null!=p?(M="editor",R="modal-editor"):null!=f&&(M="library",R="modal-library");var L=g.showGlobalFilters,N=g.canAddNewRows,z=function e(t){return i.isArray(t)?i.every(t,e):!t.requiresValue||!(!t.requiresValue||!t.value)}(u.globalFilters);z||Fe("Required dashboard filters do not have values, so the display of the dashboard will not render.",u.globalFilters);var q=g.canDownloadPDF,W="read"===x,V=W&&!q,H=(null==j?void 0:j.generatingPDF)||0===u.globalFilters.length&&V,Y=(W||!q)&&u.globalFilters.length>0?["1fr"]:W||!1===N?["auto"]:["32px","auto"],U=!1===g.canAddNewCells?["1fr","auto"]:Y;return c.jsxs(b.DndProvider,{backend:B.HTML5Backend,children:[!(null!=j&&j.generatingPDF)&&c.jsx(wF,{isProgrammaticParent:y}),c.jsxs(_f,{padding:"0.25rem","data-component":"dashboard",overflow:"hidden",className:"vizzly-studio",children:[c.jsx(_f,{marginLeft:1+(N?32:0),"data-component":"width-detection",children:c.jsx("div",{ref:k,style:{width:"100%",height:0},"data-width":_})}),c.jsx(jF,{children:c.jsxs(_f,{position:"relative",children:[A&&c.jsx(nm,{override:S.renderLoadingComponent}),c.jsx("div",{style:A?{display:"none"}:{display:"block"},children:c.jsxs(Ud,{rows:H?["auto"]:L_(),columns:U,gap:8,className:Qf("dashboard"),"data-component":"dashboard-grid",children:[!H&&c.jsxs(zf,{gridRow:1,gap:"16px","data-component":"action-bar",className:""+N_(x),justifyContent:"space-between",gridArea:!1===g.canAddNewCells?"1 / 1 / 2 / 2":void 0,children:[c.jsx(_f,{flexGrow:1,paddingLeft:W||!1===g.canAddNewCells?"0.5rem":void 0,"data-component":"action-bar-filters",children:L&&c.jsx(aS,{})}),!V&&c.jsxs(zf,{gap:"0.25rem",width:"auto",paddingTop:4,"data-component":"action-bar-tools",children:[q&&c.jsx(y_,{onChange:function(){return r(!0)},disabled:!0===n,showLabel:"read"===x&&(!1===L||0===u.globalFilters.length)}),"read_write"===x&&c.jsx(h_,{onChange:function(){return l(!0)}})]})]}),z&&c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{gridColumn:"span 2/span 2",gridRow:2},"data-component":"panels",id:"vizzly_dashboard_content",children:u.display.map((function(e,t){var r,i;return c.jsx(dF,{maxCSVDownloadLimit:v,onCreateNew:P,onPickFromLibrary:I,onRemoveCell:O,rowIndex:t,trackEvent:m,displayRow:u.display[t],generatingPDF:null!=(r=null==j?void 0:j.generatingPDF)?r:!0===n,containerWidth:null!=C?C:_,onColSpanChange:function(e){d({type:"setColSpans",colSpans:e,rowIndex:t})},canAddNewCells:(i=e,g.canAddNewCells&&i.components.length<6),columns:Y,onAppendCell:function(){return function(e){m("manageDisplay.appendCell"),d({type:"appendCell",rowIndex:e})}(t)},onAddHeaderRow:function(){return function(e){d({type:"addHeaderRow",rowIndex:e,initialTitle:w("header.new_header","New Header")})}(t)},hideAddNewHeaderRow:HS(u.display,t)},"dashboard_"+u.id+"_row_"+t)}))}),u.display.length<u.theme.rowLimit&&g.canAddNewRows&&c.jsx(zf,{alignItems:"stretch",gridRow:3,gridColumn:2,paddingRight:28,"data-component":"add-row",children:c.jsx($S,{label:w("add_row","Add Row"),onChange:function(){var e;e=u.display.length,m("manageDisplay.newRow"),d({type:"insertRow",rowIndex:e}),uj(350)}})})]})]})})]})})]}),n&&c.jsx(M_,{pdfSettings:j}),c.jsxs(kv,{width:"7xl",isOpen:E,onClose:function(){m("library.close"),d({type:"clearModal"})},transparentBackground:"modal-library"==R,namespace:R,children:["library"==M&&c.jsx(GC,{}),"editor"==M&&c.jsx(d_,{})]}),c.jsx(x_,{show:!0===n,onClose:function(){var e=X(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=O_({page:t}),!t){e.next=4;break}return e.next=4,n();case 4:r(null!=t&&t);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),c.jsx(cS,{}),c.jsx(m_,{show:a,onClose:function(){return l(!1)}})]})},L_=function(){return["minmax(28px, 1fr)","auto","72px"]},N_=function(e){return As("read"===e?{"@media (min-width: 767px)":{paddingRight:24,gridColumn:1},"@media (max-width: 768px)":{paddingRight:28,gridColumn:"span 2/span 2"}}:{paddingRight:29,gridColumn:2})},z_=function(e){var t,r=n.useState(0),i=r[0],o=r[1],a=function(){var t=X(G().mark((function t(){var n;return G().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 o(i+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(fd,{isProgrammaticParent:e.dashboardBehaviour.isProgrammaticParent,mode:e.dashboardBehaviour.mode,includeComponentTypes:e.includeComponents,excludeComponentTypes:e.excludeComponents,dashboardBehaviour:e.dashboardBehaviour,onError:e.onError,onViewClick:e.onViewClick,onReset:a,disableToolbar:e.dashboardBehaviour.disableToolbar,cascadeFilterSelection:e.dashboardBehaviour.cascadeFilterSelection,textOverride:e.dashboardBehaviour.textOverride,labelFormat:null!=(t=e.dashboardBehaviour.labelFormat)?t:function(){},pdfSettings:e.dashboardBehaviour.pdfSettings,id:e.dashboardBehaviour.id,containerWidth:e.containerWidth,children:c.jsx(Mm,{theme:e.theme,trackEvent:e.trackEvent,dashboard:e.dashboard,componentEditor:e.componentEditor,onDashboardUpdate:e.onDashboardUpdate,runQueriesCallback:function(t,n){var r;return e.runQueriesCallback(t,Q({},n,{dataAccessToken:null==(r=e.identityConfig.dataAccess)?void 0:r.signature}))},children:c.jsx(n_,Q({},e.ai,{children:c.jsx("div",{children:c.jsx(Nh,{children:e.children})},"_vizzly_dashboard_"+e.dashboard.id+"_"+i)}))})})},q_=t.createContext(void 0);!function(e){e.Admin="admin",e.EndUser="endUser"}(P_||(P_={})),function(e){e.Read="read",e.ReadWrite="read_write"}(E_||(E_={}));var B_=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("exact"!=t.type){e.next=7;break}return r=sl(t.dashboardId,n.permissions),Fe("A specific dashboard has been requested. This will be rendered with",i=r?E_.ReadWrite:E_.Read,"scope.",t.dashboardId),e.abrupt("return",{dashboardId:t.dashboardId,mode:r&&t.dashboardId==n.defaultParentDashboardId?P_.Admin:P_.EndUser,scope:i});case 7:if("instantCopyOf"!=t.type){e.next=27;break}if(!sl(t.parentDashboardId,n.permissions)){e.next=12;break}return Fe("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:P_.Admin,scope:E_.ReadWrite});case 12:if(o=Va(t.parentDashboardId,n.writeAccessDashboards),!(a=Ga(o))){e.next=17;break}return Fe("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:P_.EndUser,scope:E_.ReadWrite});case 17:if(l=Ka(n.dashboards,n.defaultParentDashboardId)){e.next=20;break}throw"Failed to find parent dashboard. "+n.defaultParentDashboardId;case 20:return Fe("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:za(l),meta:{},metadata:{},permissions:[{scope:E_.ReadWrite}]});case 23:return e.abrupt("return",{dashboardId:e.sent.id,scope:E_.ReadWrite,mode:P_.EndUser});case 27:throw"Unsupported strategy";case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),W_=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 J(t,e),t}(ee(Error)),V_=function(){var e=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Zo(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 ra("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)}}(),H_=function(e,t){if(e)return e;if(t)return n=t,function(){var e=X(G().mark((function e(t){var r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V_(n,null==(r=t.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 n;throw new oa},Y_=function(e){return"runQueries"in e?{type:"custom",queryEngineEndpoint:e.queryEngineEndpoint}:"data"in e?{type:"in-browser",queryEngineEndpoint:e.queryEngineEndpoint}:{type:"query-engine",queryEngineEndpoint:e.queryEngineEndpoint}},U_=function(e){return X(G().mark((function t(){var n;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=Y_(e),!("queryEngineConfig"in e)||!e.queryEngineConfig){t.next=5;break}return t.abrupt("return",ta(e.queryEngineConfig));case 5:if(!("queryEngineEndpoint"in e)||!e.queryEngineEndpoint||"query-engine"!==n.type){t.next=7;break}return t.abrupt("return",ta(e.queryEngineEndpoint));case 7:return t.abrupt("return",ea);case 8:case"end":return t.stop()}}),t)})))},G_={file:"local file",environment:"environment variables",github:"GitHub",s3:"AWS S3",vizzlyEncrypted:"Vizzly API",customEndpoint:"Custom endpoint"},K_={dynamic:"Dynamic",vizzlyApiStore:"Vizzly",static:"Static"},X_={name:"1gqeage",styles:"margin-right:0.75rem"},Q_=function(e){return c.jsx("div",{children:c.jsxs("span",{children:[c.jsxs("span",{css:X_,children:[!0===e.status&&c.jsx(eT,{}),!1===e.status&&c.jsx(nT,{}),null===e.status&&c.jsx(iT,{})]}),!0===e.status&&e.successMessage,!1===e.status&&e.errorMessage,null===e.status&&e.unknownMessage]})})},J_={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));}"},Z_=function(e){return c.jsxs("div",{css:J_,children:[c.jsx(Q_,{status:e.statusReport.configFound,successMessage:e.statusReport.configSources?"Config was fetched from "+(n=e.statusReport.configSources.dataSets,be(n.map((function(e){return G_[e]})))+" with ")+(t=e.statusReport.dataSetsCount||0,t+" "+(1==t?"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(Q_,{status:e.statusReport.configValid,successMessage:"Data sets are valid",errorMessage:"Config is not valid",unknownMessage:"We did not run any config validation checks"}),c.jsx(Q_,{status:e.statusReport.connectionOk,successMessage:"Connection check passed",errorMessage:"Connection check failed. Please check the logs",unknownMessage:"We did not run a connection check"}),c.jsx(Q_,{status:!!e.statusReport.projectId||null,successMessage:"Project ID found",errorMessage:"Failed to find your project ID. Please ensure environment variables have been setup correctly",unknownMessage:"Failed to find your project ID. Please ensure environment variables have been setup correctly"}),c.jsx(Q_,{status:!!e.statusReport.strategy||null,successMessage:"'"+K_[e.statusReport.strategy]+"' strategy loaded",errorMessage:"Failed to determine Query Engine Strategy",unknownMessage:"Failed to determine Query Engine Strategy"}),!1===e.statusReport.allowGetStarted&&c.jsx(Q_,{status:!0,successMessage:"Get started steps have been completed",errorMessage:"",unknownMessage:""})]});var t,n},$_={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},eT=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:$_,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"})})},tT={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},nT=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:tT,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"})})},rT={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},iT=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:rT,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"})})},oT=function(){var e=X(G().mark((function e(t,n){var r,i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Zo(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)}}(),aT=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},lT={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"},sT={name:"1flj9lk",styles:"text-align:left"},uT={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},dT={name:"1gok8e8",styles:"margin-bottom:0.5rem"},cT={name:"1f0dvzm",styles:"margin-top:1.5rem;text-align:right"},pT={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"},fT={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},mT={name:"12q5llh",styles:"margin-top:0.5rem;text-align:right"},hT={name:"fevti5",styles:"margin-bottom:0.75rem;margin-top:0.75rem;font-weight:700"},vT=function(e){var n=t.useState(void 0),r=n[0],i=n[1];return t.useEffect((function(){var t=new AbortController;return"query-engine"==e.implementationMeta.type&&e.implementationMeta.queryEngineEndpoint&&function(){var e=X(G().mark((function e(n){var o,a;return G().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,oT(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(Uh,{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:lT,children:[c.jsxs("div",{css:sT,children:[c.jsx("h2",{css:uT,className:""+tu.text,children:e.title}),e.text.map((function(e,t){return c.jsx("p",{css:dT,className:""+tu.text,children:e},t)}))]}),e.callToAction&&c.jsx("div",{css:cT,children:c.jsx("a",{target:"_blank",href:e.callToAction.link,children:c.jsx(Fh,{children:e.callToAction.text})})})]},t)})),void 0!==r&&c.jsxs("div",{css:pT,children:[null===r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:fT,className:""+tu.text,children:"Vizzly Query Engine not found"}),c.jsxs("p",{className:""+tu.text,children:["If you have deployed the Vizzly Query Engine, then please set the ",c.jsx(aT,{children:"queryEngineEndpoint"})," ","property to the URL where it is deployed too."]}),c.jsx("div",{css:mT,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/query-engines/self-hosted-query-engine",children:c.jsx(Fh,{children:"Deploy the Query Engine"})})})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:hT,className:""+tu.text,children:"Query engine status"}),c.jsx(Z_,{statusReport:r})]})]})]})}})},gT=function(e){return c.jsx(vT,{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(aT,{children:"identity"})," function with your own identity logic."]}),"Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens."]}]})},bT=function(e){return c.jsx(vT,{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."]}]})},xT=function(e){var t=[];switch(e.implementationMeta.type){case"custom":case"in-browser":t=[c.jsxs(c.Fragment,{children:["The ",c.jsx(aT,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"}),"function must provide at least one data set"]})];break;case"query-engine":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(vT,{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}]})},yT=function(e){return c.jsx(vT,{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(aT,{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(aT,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"})," property is required, and it must be an async function."]})]}]})},wT={name:"185o5ba",styles:"text-decoration-line:underline"},jT=function(e){return c.jsx(vT,{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(aT,{children:"queryEngineEndpoint"})," value",e.invalidEndpoint?" ("+JSON.stringify(e.invalidEndpoint)+")":"",". Please deploy the"," ",c.jsx("a",{css:wT,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."]})]}]})},CT=function(e){return c.jsx(vT,{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(aT,{children:"identity"})," must be an async function that returns your Vizzly identity tokens."]})]}]})},ST=function(e){Ae(e.error);var t=c.jsx("p",{children:"Unknown error"});return e.error instanceof W_&&(t=c.jsx(xT,{implementationMeta:e.implementationMeta})),e.error instanceof oa&&(t=c.jsx(yT,{implementationMeta:e.implementationMeta})),e.error instanceof Qo&&(t=c.jsx(jT,{implementationMeta:e.implementationMeta,invalidType:!0})),e.error instanceof Xo&&(t=c.jsx(jT,{implementationMeta:e.implementationMeta,invalidEndpoint:e.error.invalidEndpoint})),e.error instanceof ia&&(t=c.jsx(CT,{implementationMeta:e.implementationMeta})),e.error instanceof Ho&&(t=c.jsx(ev,{})),e.error instanceof Yo&&(t=c.jsx(bT,{implementationMeta:e.implementationMeta})),e.error instanceof Uo&&(t=c.jsx(Qh,{})),e.error instanceof ra&&(t=c.jsx(Jh,{})),e.error instanceof Go&&(t=c.jsx(gT,{implementationMeta:e.implementationMeta})),c.jsxs(rc,{children:[c.jsx(Rl,{}),t]})},FT=function(e,t){return e.map((function(e){return e.map((function(e){var t=e.field;return{id:_t({field:t.id,function:e.functionId}),publicName:t.publicName,dataType:t.dataType}}))}))},kT=function(e,t,n){var r=t.map((function(t){var r=Vr(e,t.dataSetId);if(!r)throw"Data set not found for query attributes query";return tn(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:FT([].concat(r).map((function(e){return e.measureDescription})))}};function _T(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 TT=function(e,t,n,r){var i=nn(t,e.measure,e.order,Jt(e.filter,n),e.dimension,e.timeDimension||null,e.limit,e.offset,r);return{queries:[i.query],resultFields:FT([i.measureDescription])}},AT=TT,DT=TT,IT=TT,OT=TT,PT=TT,ET=TT,MT=TT,RT=function(e,t,n){var r=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){var o,a=Vr(n.dataSets,e[0].dataSetId);if(!a)throw"Data set not found for pre aggregated query";var l=a.preAggregated[0],s=function(e,t){return{query:e,resultFields:t.fields.map((function(e){return{id:e.id,publicName:e.publicName,dataType:e.dataType}}))}}(e[0],a),u=s.query,d=s.resultFields,c=Vr(n.dataSets,l),p=wi(n.filterConfig,c,n.timeRangeOptions),f=Zt([p],t,c);r=[Q({},u,{filter:(o={},o[c.id]=f,o)})],i=[d]}else if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"uniqueArrayValues"==e[0].preparedQueryType){r=[e[0]];var m=Vr(n.dataSets,e[0].dataSetId);if(!m)throw"Data set not found for view attributes query";var h=Yr(m,e[0].fieldId),v=on(e[0].dataSetId,h);r=[v.query],i=[v.resultFields]}else if(Array.isArray(e)){var g=[].concat(e).map((function(e){var t=Vr(n.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";var r=wi(n.filterConfig,t,n.timeRangeOptions);return Q({},e,{filter:Jt(e.filter,r)})})),b=kT(n.dataSets,g,t);r=b.queries,i=b.resultFields}else if("type"in e&&("order"in e||"measure"in e)){var x=Vr(n.dataSets,e.dataSetId);if(!x)throw"Data set not found for view attributes query";var y=function(e,t,n,r){switch(e.type){case"areaChart":return AT(e,t,n,r);case"barChart":return DT(e,t,n,r);case"horizontalBarChart":return IT(e,t,n,r);case"lineChart":return OT(e,t,n,r);case"pieChart":return PT(e,t,n,r);case"dataTable":return ET(e,t,n,r);case"basicTable":return MT(e,t,n,r);case"comboChart":return function(e,t,n,r){var i=function(e,t,n,r){var i=nn(t,e.lineMeasure,e.order,Jt(e.filter,r),e.lineDimension,e.timeDimension,e.limit,e.offset,n);return{bar:nn(t,e.barMeasure,e.order,Jt(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:FT([o.measureDescription,a.measureDescription])}}(e,t,n,r);case"singleStat":case"progress":return function(e,t,n,r){var i=function(e,t,n,r){var i=function(e,t,n,r){var i=nn(n,e.measure,[],Jt(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=null;return"deltaTimeDimension"in e&&(o=function(e,t,n,r){return t.deltaTimeDimension?nn(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],Jt(t.filter,n),[],t.deltaTimeDimension,t.limit,t.offset,r):null}(t,e,r,n)),{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:FT(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=nn(t,i,e.order,Jt(e.filter,n),e.dimension,e.timeDimension,e.limit,e.offset,r);return{queries:[o.query],resultFields:FT([o.measureDescription])}}(e,t,n,r);case"mercatorMap":return function(e,t,n,r){return kT([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:Jt(e.filter,n),order:[],timeDimension:null}],r)}(e,t,n,r);default:throw"Unsupported."}}(e,x,wi(n.filterConfig,x,n.timeRangeOptions),t);r=y.queries,i=y.resultFields}else if("custom"!=e.type){var w=function(e,t,n){var r=[].concat(e.appliesToFields).map((function(r){var i=Vr(t,r.dataSetId);if(!i)throw"Data set not found for additional filter query";var o=Yr(i,r.fieldId);if("string[]"==o.dataType){var a=Zt([_T(e,r)],n,i),l=on(r.dataSetId,o,a);return{queries:[l.query],resultFields:[l.resultFields]}}var s=an(i,r.fieldId,_T(e,r));return kT(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=w.queries,i=w.resultFields}return{queries:r,resultFields:i}},LT={},NT=function(e,t,n){var r=JSON.stringify(e),i=new Date;i.setSeconds(i.getSeconds()+n),Fe("Browser cache new object set.",r),LT[r]={item:t,expires:i}},zT=function(e){var t=JSON.stringify(e),n=LT[t];if(!n)return Fe("Browser cache miss.",e),null;Fe("Browser cache hit.",e);var r=n.item,i=n.expires;return new Date<i?r:(delete LT[t],null)},qT=function e(t){return Array.isArray(t)?0==t.length:"object"==typeof t&&e(Object.keys(t))},BT=function(){var e=X(G().mark((function e(t,n,r,i){var o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},t.forEach((function(e,t){var n=zT(i(e));n&&(Fe("Query result received from the cache."),o[t]=n)})),t.forEach((function(e,t){n(e)||(Fe("Query is not runnable."),o[t]=null)})),a=t.filter((function(e,t){return n(e)&&void 0===o[t]})),l=[],qT(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(!qT(l)||!qT(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,NT(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)}}(),WT=function(){var e=X(G().mark((function e(t,n,r,i){var o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Zo(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)}}(),VT=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return!0}),function(){var e=X(G().mark((function e(n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,WT(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)}}(),HT={},YT=[],UT=function(){var e=X(G().mark((function e(t,n,r){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Fe("Fetching data for in-browser query engine. DataSet;",t.id,"CacheKey;",r),!HT[r]){e.next=5;break}return e.abrupt("return",HT[r]);case 5:return e.next=7,n(t);case 7:return(i=e.sent)||YT.includes(t.id)||(YT.push(t.id),console.error("Failed to download data for data set "+t.id)),HT[r]=i,e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),GT=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingVizzlyInMemoryDb",n}return J(t,e),t}(ee(Error)),KT=function(){var e=window.VizzlyInMemoryDb;if(!e)throw new GT("VizzlyInMemoryDb missing! This means that 'window.VizzlyInMemoryDb' was not set. This is required for the in-browser vizzly setup.\n\nPlease ensure you have added the script tag to load the in-browser query engine.\n\nFor example, this should be added within the <head> tag;\n<script src=\"https://static.app.vizzly.co/query-engine/0.8.10/vizzly-in-memory-db.umd.js\"><\/script>\n\nNote, you can change the version of the in-memory database by changing '0.8.3' to the version you require.\n");return e},XT=function(e,t){var n=[].concat(e).filter((function(e){return!i.isEmpty(e)})),r={type:"orWhere",value:[].concat(n).map((function(e){return{type:"andWhere",value:e.map((function(e){return{type:"where",left:QT(e.field,t),op:e.op,right:{type:i.isArray(e.value)?"list":i.isNumber(e.value)?"number":"unsafeString",value:i.isArray(e.value)?e.value.map((function(e){return{type:"unsafeString",value:e}})):e.value}}}))}}))},o={type:"andWhere",value:[]};return i.isEmpty(r.value)||(o.value=[].concat(o.value,[r])),o},QT=function e(t,n){if("subquery"==t.type)return{type:"subquery",value:{select:[e(t.value.measure[0],n)],where:XT(t.value.filter,n),join:[]}};if("maths"==t.type)return{type:"maths",left:e(t.left,n),right:e(t.right,n),op:t.op};if("number"==t.type)return t;if("null"==t.type)return t;if("string"==t.type)return{type:"unsafeString",value:t.value};if("function"==t.type)return{type:"function",function:t.function,value:e(t.value,n)};if("switchField"==t.type)return{type:"case",value:{cases:t.value.cases.map((function(t){return{result:e(t.returns,n),where:XT(t.filter,n)}}))}};if("field"==t.type&&"none"!=t.function){var r=Yr(n,t.value);return{type:"function",function:t.function,value:{type:"field",value:{nativeDataType:r.dataType,address:["_",n.id,r.id]}}}}if("field"===t.type){var i=Yr(n,t.value);return{type:"field",value:{nativeDataType:i.dataType,address:["_",n.id,i.id]}}}throw"Unsupported measure in JS query engine "+JSON.stringify(t)},JT=function(){var e=X(G().mark((function e(t,n){var r,i,o,a,l,s,u;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("query"!==t.type){e.next=10;break}if(0!==(null==t||null==(r=t.measure)?void 0:r.length)){e.next=3;break}return e.abrupt("return",[[]]);case 3:return o={select:t.measure.map((function(e){return QT(e,n)})),where:XT(t.filter,n),order:t.order,group:t.group,join:[],limit:t.limit||5e3,offset:t.offset||0,from:["_",t.dataSetId]},e.next=6,KT().query(o);case 6:return e.abrupt("return",(null==(a=e.sent)||null==(i=a[0])?void 0:i.values)||[]);case 10:if("preparedQuery"!==t.type||"uniqueArrayValues"!==t.preparedQueryType){e.next=16;break}return s={type:"uniqueArrayValues",field:{type:"field",value:{address:["_",t.dataSetId,t.fieldId],nativeDataType:"JSON"}},where:XT(t.filter,n)},e.next=14,KT().query(s);case 14:return e.abrupt("return",(null==(u=e.sent)||null==(l=u[0])?void 0:l.values)||[]);case 16:throw"Unsupported query";case 17:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ZT=function(e,t){return e+"::"+t},$T=function(){var e=X(G().mark((function e(t,n,r){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[].concat(t).map(function(){var e=X(G().mark((function e(t){var i,o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Gr(n,t.dataSetId),o=i[0],a=ZT(r,t.dataSetId),!HT[a]||!o){e.next=10;break}return e.next=6,JT(t,o);case 6:return e.abrupt("return",e.sent);case 10:return console.warn("Returning an empty result."),e.abrupt("return",[]);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=3,Promise.all(i);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),eA=function(){var e=X(G().mark((function e(t,n,r,i){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,KT().init(n.map((function(e){return{id:null==e?void 0:e.id,fields:null==e?void 0:e.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))}})));case 2:return e.next=4,Promise.all([].concat(t).flatMap(function(){var e=X(G().mark((function e(t){var o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Gr(n,t.dataSetId),!(a=o[0])){e.next=8;break}return e.next=4,UT(a,r,ZT(i,t.dataSetId));case 4:return l=e.sent,s={id:null==a?void 0:a.id,fields:null==a?void 0:a.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))},e.next=8,KT().ingest(s,l||[]);case 8:return e.abrupt("return",[]);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:return e.next=6,$T(t,n,i);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),tA=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l,s;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,ea,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return!0}),function(){var e=X(G().mark((function e(n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,eA(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)}}(),nA=function(){var e=X(G().mark((function e(t,n,r){var i,o,a,l;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=RT(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,BT(o,(function(e){return"preparedQuery"==e.type&&Te("Custom query engine does not support prepared queries."),"query"==e.type}),function(){var e=X(G().mark((function e(n){var i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.runQueries(n,Q({},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 rA(e,t,n){return iA.apply(this,arguments)}function iA(){return(iA=X(G().mark((function e(t,n,r){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyQueryEngine"!=t.type){e.next=4;break}return e.next=3,VT(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,tA(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,nA(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 oA=function(e){var n=t.useState(0),r=n[0],i=n[1];return eS((function(e){e.reload&&(Fe("Received from vizzlyState, `reload()`"),i((function(e){return e+1})))}),e.id),d.createElement(aA,Q({},e,{key:e.parentDashboardId+"_"+e.dashboardId+"_"+r}))},aA=function(e){var n,r,i,o,a,l,s,u,d,p=Y_(e),f=e.vizzlyApiHost?{host:e.vizzlyApiHost}:{host:"https://api.vizzly.co"},m=Vo(f),h=function(t,n,r){var i;return Mr(t,n,r,e.textOverrides,"object"==typeof e.developerTools&&!0===(null==(i=e.developerTools)?void 0:i.translationKeys))},v=(a={dashboardId:e.dashboardId,parentDashboardId:e.parentDashboardId,identityCallback:e.identity,loadDataSetsCallback:(i=e.dataSets,o=e.queryEngineEndpoint,function(){var e=X(G().mark((function e(t,n){var r,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"function"==typeof(r=H_(i,o))){e.next=4;break}throw new oa;case 4:return e.next=6,r(t,n);case 6:if(a=e.sent){e.next=9;break}throw new ra("Failed to fetch data sets from the query engine endpoint");case 9:return e.abrupt("return",a.map((function(e){return Kr(e,n)})));case 12:if(e.prev=12,e.t0=e.catch(0),!(e.t0 instanceof oa)){e.next=16;break}throw e.t0;case 16:throw new ra("Failed to fetch data sets.");case 17:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t,n){return e.apply(this,arguments)}}()),vizzlyAPI:m,implementationMeta:p,loadQueryEngineConfigCallback:U_(e),programmaticDashboard:e.parentDashboard,textOverride:h},s=ha(a.identityCallback,a.loadDataSetsCallback,a.loadQueryEngineConfigCallback,a.textOverride),d=function(e,n,r){var i=t.useState(),o=i[0],a=i[1];if(t.useEffect((function(){!function(){var t=X(G().mark((function t(){var r,i,l,s;return G().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,B_(e,n);case 6:i=(r=t.sent).mode,s=r.scope,(l=r.dashboardId)!=(null==o?void 0:o.dashboardId)&&a({mode:i,dashboardId:l,scope:s});case 11:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify(e),n]),!o)return null;if("isLoading"in n)return null;var l=n.dashboards.find((function(e){return e.id==o.dashboardId}))||null;return{mode:o.mode,dashboard:l,scope:o.scope,isProgrammaticParent:!!r}}(function(e,t,n){if("accessType"in e&&"admin"==e.accessType){Fe("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&&(Fe("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?(Fe("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)?(Fe("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.find((function(e){return null!=e.parentDashboardId})).id}):"read"==(null==t?void 0:t.dashboardAccess.scope)&&"defaultParentDashboardId"in e?(Fe("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?(Fe("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}):(Fe("Strategy will be to show a child of the parent dashboard",e.defaultParentDashboardId),{type:"instantCopyOf",parentDashboardId:e.defaultParentDashboardId}):void 0;var o,a}(u=Sl(null==s?void 0:s.identityConfig,null==s?void 0:s.dataSets,a.vizzlyAPI,a.parentDashboardId,jl(a.implementationMeta.queryEngineEndpoint,s.queryEngineConfig),s.queryEngineConfig,a.programmaticDashboard),s.identityConfig,a.dashboardId),u,a.programmaticDashboard),0===(null==(l=s.dataSets)?void 0:l.length)?{error:new W_}:s.error?{error:s.error}:s.identityConfig&&s.queryEngineConfig?"isLoading"in u?null:d?{dashboardAPI:u,scope:d.scope,queryEngineConfig:s.queryEngineConfig,dashboard:d.dashboard,identityConfig:s.identityConfig,mode:d.mode,vizzlyApiConfig:a.vizzlyAPI.config,isProgrammaticParent:d.isProgrammaticParent}:null:null);if(function(e,n){var r;t.useEffect((function(){var t;e&&"dashboard"in e&&null!=e&&null!=(t=e.dashboard)&&t.id&&(null==n||n({id:e.dashboard.id,metadata:e.dashboard.metadata,scope:e.scope}))}),[JSON.stringify({loaded:!!e,dashboardId:e&&"dashboard"in e&&(null==e||null==(r=e.dashboard)?void 0:r.id)})])}(v,e.onDashboardLoad),null===v)return c.jsx(nm,{override:e.renderLoadingComponent});if("error"in v)return c.jsx(ST,{implementationMeta:p,error:v.error});if(!v.dashboard)return c.jsx(nm,{override:e.renderLoadingComponent});var g=function(){var e=X(G().mark((function e(t,n){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n||!v.dashboard){e.next=7;break}return e.next=3,v.dashboardAPI.saveScheduledReport({dashboardId:v.dashboard.id,cronSchedule:null,scheduledReportId:t});case 3:return e.abrupt("return",e.sent?"deleted":null);case 7:if(null==n||!v.dashboard){e.next=12;break}return e.next=10,v.dashboardAPI.saveScheduledReport({dashboardId:v.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)}}(),b=function(){var e=X(G().mark((function e(t){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"read_write"==v.scope&&v.dashboardAPI.updateDashboard(t.id,{definition:za(t)});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),x=function(){var e=X(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===v||!("dashboard"in v)||null===v.dashboard){e.next=4;break}return t=Ja(v.dashboard,v.dashboardAPI.dashboards,v.dashboardAPI.defaultParentDashboardId),b(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)}}(),y=(null==(n=v.identityConfig)||null==(n=n.queryEngineAccessConfig)?void 0:n.allowDatabaseSchemaAccess)&&"query-engine"==p.type,w=null!=(r=e.dateFilterOptions)?r:e.dateTimeFilterOptions,j=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("runQueries"in e&&e.runQueries)return function(){var r=X(G().mark((function r(i,a){var l;return G().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rA({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=X(G().mark((function t(r,i){return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,rA({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)}}();if("queryEngineEndpoint"in e&&e.queryEngineEndpoint&&null!=(r=t.identityConfig.dataAccess)&&r.signature)return function(){var r=X(G().mark((function r(i,a){var l;return G().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rA({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)}}();throw"Missing required props."}(e,v,id(h,w)),C=function(){var e=X(G().mark((function e(t,n,r){var i,o;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=5;break}return o=ll(null==(i=v.dashboard)?void 0:i.id,v.dashboardAPI.permissions),e.next=4,m.aiActions(t,n,o.token,r);case 4:return e.abrupt("return",e.sent);case 5:throw"Dashboard has not yet been loaded.";case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),S=function(){var e=X(G().mark((function e(t,n,r,i){var o,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=5;break}return a=ll(null==(o=v.dashboard)?void 0:o.id,v.dashboardAPI.permissions),e.next=4,m.askAi(n,r,t,a.token,v.dashboard.dataSets,v.queryEngineConfig,i);case 4:return e.abrupt("return",e.sent);case 5:throw"Dashboard has not yet been loaded.";case 6:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),F=function(){var e=X(G().mark((function e(){var t,n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.dashboard){e.next=7;break}return n=ll(null==(t=v.dashboard)?void 0:t.id,v.dashboardAPI.permissions),e.next=4,m.askAiForQuestionSuggestions(n.token,v.dashboard.dataSets);case 4:return e.abrupt("return",e.sent.suggestions);case 7:throw"Dashboard has not yet been loaded.";case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return c.jsx(q_.Provider,{value:Q({},e,{onSave:b}),children:c.jsx(z_,{trackEvent:e.trackEvent,dashboardBehaviour:{id:e.id,isProgrammaticParent:v.isProgrammaticParent,mode:v.mode,scope:v.scope,dateFilterOptions:w,numberFormatOptions:null==e?void 0:e.numberFormatOptions,dateTimeFormatOptions:null==e?void 0:e.dateTimeFormatOptions,onEditorUpdate:null==e?void 0:e.onEditorUpdate,onScheduledReportChange:g,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:b,onOpenConfigManagerUi:y?function(){var e,t,n,r,i;y&&"query-engine"===p.type&&p.queryEngineEndpoint&&(window.location.href=(t=p.queryEngineEndpoint,(n=null==(e=v.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"),Ui(na(t),"/sign-in#"+i)):""))}:void 0,organizationName:e.organizationName,featureToggles:e.featureToggles,customComponents:e.customComponents,componentOverrides:Pj(e),queryEngineConfig:v.queryEngineConfig,disableToolbar:null==e?void 0:e.disableToolbar,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:h,pdfSettings:null==e?void 0:e.pdfSettings,labelFormat:null==e?void 0:e.labelFormat},ai:{onAction:C,onAsk:S,fetchSuggestions:F},onDashboardUpdate:null==e?void 0:e.onDashboardUpdate,dashboard:v.dashboard,runQueriesCallback:j,implementationMeta:p,identityConfig:v.identityConfig,includeComponents:null==e?void 0:e.includeComponents,excludeComponents:null==e?void 0:e.excludeComponents,onReset:x,onError:null==e?void 0:e.onError,theme:e.theme,vizzlyApiConfig:f,onViewClick:null==e?void 0:e.onViewClick,children:null==e?void 0:e.children})})},lA=function(e){return c.jsxs(Il,{renderOnError:function(){return c.jsx("p",{children:"Unexpected error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[c.jsx(Rl,{}),c.jsx(oA,Q({},e,{children:c.jsx(R_,{})}))]})},sA={Dashboard:lA,useDashboardManager:Al,useInBrowserDashboardManager:Dl,NewVizzlyImplementation:Go,displayPositions:Wi,DataSetField:Pl};exports.Dashboard=lA,exports.DataSetField=Pl,exports.NewVizzlyImplementation=Go,exports.default=sA,exports.displayPositions=Wi,exports.useDashboardManager=Al,exports.useInBrowserDashboardManager=Dl,exports.vizzlyState=Nl;
|