@luzmo/embed 5.0.0

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/README.md ADDED
@@ -0,0 +1,209 @@
1
+ # Web Component for Luzmo dashboard
2
+
3
+ A modern [Web Component](https://developer.mozilla.org/en-US/docs/Web/Web_Components) for [Luzmo](https://luzmo.com) dashboards in your web application.
4
+
5
+ ## Table of contents
6
+
7
+ 1. [Installation instructions](#installation-instructions)
8
+ 2. [Usage](#usage)
9
+ 3. [Events](#events)
10
+ 4. [Public Methods](#public-methods)
11
+ 5. [Examples](#examples)
12
+ 6. [Changelog](#changelog)
13
+ 7. [Migration](#migration)
14
+ 8. [Quick links](#quick-links)
15
+
16
+ ## Installation instructions
17
+
18
+ ### 1. Install the component from npm
19
+
20
+ ```bash
21
+ npm i @luzmo/embed
22
+ ```
23
+
24
+ ### 2. Import the component
25
+
26
+ In a JavaScript module:
27
+
28
+ ```bash
29
+ import '@luzmo/embed';
30
+ ```
31
+
32
+ OR In an HTML page:
33
+
34
+ ```html
35
+ <script type="module">
36
+ import './node_modules/@luzmo/embed/index.js';
37
+ </script>
38
+ ```
39
+
40
+ OR
41
+
42
+ ```html
43
+ <script type="module" src="./node_modules/@luzmo/embed/index.js"></script>
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ Use the dashboard components as if they were native HTML tags. Use the id of the dashboard you wish to embed.
49
+ **In your HTML template.**
50
+
51
+ ```html
52
+ <luzmo-dashboard dashboardId="55cfb99c-d602-492b-b192-6c15277fdb9a" language="en"> </luzmo-dashboard>
53
+
54
+ OR
55
+
56
+ <!-- Embed a item by passing the item id as well -->
57
+ <luzmo-dashboard dashboardId="55cfb99c-d602-492b-b192-6c15277fdb9a" itemId="59fe5bd7-5070-42f5-98f4-da7f931e316c"> </luzmo-dashboard>
58
+ ```
59
+
60
+ **Properties:**
61
+
62
+ Below a list of available properties on the dashboard web component
63
+
64
+ | Property | Type | Description |
65
+ | -------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | `dashboardId` | string | The id of the Luzmo dashboard you wish to embed |
67
+ | `dashboardSlug` | string | The slug of the Luzmo dashboard you wish to embed (if a dashboardId is supplied that one will be used) |
68
+ | `itemId` | string | The id of the Luzmo item you wish to embed |
69
+ | `itemDimensions` | { width: number/string; height: number/string; } | width and height of item only applies when itemId is provided. Accepts a JSON string. |
70
+ | `authKey` | string | Authorization key generated via Luzmo API |
71
+ | `authToken` | string | Authorization token generated via Luzmo API |
72
+ | `language` | string | The language of the dashboard: eg. 'en' (Default: 'auto') |
73
+ | `screenMode` | string | The screen mode of your dashboard: 'mobile', 'tablet', 'desktop', 'largeScreen', 'fixed' or 'auto' (Default: 'auto') |
74
+ | `switchScreenModeOnResize` | boolean | true: the embedded dashboard can switch screenModes on resize of the container , false: Dashboard will keep the same screenMode (Default: true) |
75
+ | `loaderBackground` | string | Background color of the loader element (Default: '#f9f9f9') |
76
+ | `loaderFontColor` | string | Font color of the text of the loaders (Default: '#5a5a5a') |
77
+ | `loaderSpinnerColor` | string | Spinner color of the loader (Default: 'rgba(255, 165, 0, 0.7)') |
78
+ | `loaderSpinnerBackground` | string | Background color of the spinner (Default: 'rgba(169, 169, 169, 0.14)') |
79
+ | `appServer` | string | Tenancy of luzmo.com to connect to (Default: 'https://app.luzmo.com/' for US set appServer to 'https://app.us.luzmo.com/') |
80
+ | `timezoneId` | string | The timezone you you wish to use in your dashboard. This timezone id needs to be a valid id that is available in the [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List), for example: Europe/Brussels or America/New_York. |
81
+ | `apiHost` | string | API server to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
82
+ | `editMode` | string | Specifies if the embedded dashboard should be editable or not. Accepted values: "view" , "editLimited" , "editFull" . Use "view" if you don't want the embedded dashboard to be editable. (Default: "view" ) |
83
+ | `mainColor` | string | Optional override of the main color used in the whitelabeling of the embedded dashboard editor. If not provided, the main color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |
84
+ | `accentColor` | string | Optional override of the accent color used in the whitelabeling of the embedded dashboard editor. If not provided, the accent color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |
85
+
86
+ <br/><br/>
87
+
88
+ ## Events
89
+
90
+ | Name | Description | Event Arguments |
91
+ | -------------- | -------------------------------------- | --------------------- |
92
+ | changedFilters | Emitted when filters are changed | `ChangedFiltersEvent` |
93
+ | customEvent | Emitted when a custom event is fired | `CustomEvent` |
94
+ | exported | Emitted when export completes or fails | `ExportedEvent` |
95
+ | itemsRendered | Emitted when all items are rendered | `ItemsRenderedEvent` |
96
+ | load | Emitted when dashboard is loaded | `LoadEvent` |
97
+
98
+ <br/>
99
+
100
+ ## Public methods
101
+
102
+ ```typescript
103
+ getDashboards(): Promise<LuzmoDashboard[]>
104
+ // Returns an instantly resolved promise with an array of all the visible dashboards on a page with their information.
105
+
106
+ getData(itemId: string): Promise<ItemData>
107
+ // Returns an array the data of a chart of a certain dashboard by adding the dashboardId or the container of the iframe.
108
+
109
+ getFilters(): Promise<FilterGroup[]>
110
+ // Returns an array of active filters.
111
+
112
+ setAuthorization(key: string, token: string): Promise<void>
113
+ // Changes the authorization of all or one dashboard. To fetch data based on new authorization parameters, reloadDashboard() or refreshData() needs to be called.
114
+
115
+ refreshData(itemId?: string): Promise<void>
116
+ // Refreshes the data of a specific chart when the id of that item is supplied. Without a itemId this refreshes the data in all items.
117
+
118
+ reloadDashboard(): Promise<void>
119
+ // Reload the dashboard. (useful when the authorization is changed, and dashboard needs to be reloaded without reloading the iFrame)
120
+
121
+ exportDashboard(type?: ExportType): Promise<ExportDashboard>
122
+ // Exports the current dashboard as either pdf or png. A container class needs to be passed as an argument and an optional type parameter.
123
+
124
+ getAccessibleDashboards(): Promise<AccessibleDashboard[]>
125
+ // Get accessible dashboards in a integration, make sure 'apiHost', 'authKey', 'authToken' are set correctly on the instance.
126
+
127
+ setEditMode(editMode: DashboardEditMode): Promise<SetEditMode>
128
+ // Sets the editMode of the current dashboard. Accepted parameters: "view" , "editLimited" , "editFull".
129
+ ```
130
+
131
+ <br/>
132
+
133
+ ## Examples
134
+
135
+ A dashboard with a gray loader background
136
+
137
+ ```html
138
+ <luzmo-dashboard dashboardId="035c0304-0bfe-4b7c-8c10-a4acb8eb9d76" loaderBackground="rgb(238,243,246)"> </luzmo-dashboard>
139
+ ```
140
+
141
+ A secured dashboard using an [authorization key & token](https://developer.luzmo.com/#quickstart)
142
+
143
+ ```html
144
+ <luzmo-dashboard dashboardId="035c0304-0bfe-4b7c-8c10-a4acb8eb9d76" authKey="<!-- your generated authKey-->" authToken="<!-- your generated authToken -->"> </luzmo-dashboard>
145
+ ```
146
+
147
+ A dashboard with a purple spinner color of the loader with screenMode="mobile" and switchScreenModeOnResize=false, so that the dashboard will stay in mobile mode
148
+
149
+ ```html
150
+ <luzmo-dashboard id="dashboard" dashboardId="55cfb99c-d602-492b-b192-6c15277fdb9a" loaderSpinnerColor="purple" screenMode="mobile" switchScreenModeOnResize="false"> </luzmo-dashboard>
151
+ ```
152
+
153
+ Add an event listener when all items are rendered
154
+
155
+ ```typescript
156
+ // get the component, here we query the component that has an id 'dashboard'
157
+ const dashboardComponent = document.getElementById('dashboard');
158
+ dashboardComponent.addEventListener('itemsRendered', (event) => {
159
+ // do something after all items are rendered
160
+ console.log(event);
161
+ });
162
+ ```
163
+
164
+ Get data from an item
165
+
166
+ ```typescript
167
+ dashboardComponent.getData('59fe5bd7-5070-42f5-98f4-da7f931e316c').then((data) => {
168
+ // do something with the item data
169
+ console.log('Item data', data);
170
+ });
171
+ ```
172
+
173
+ Get filters used in the dashboard
174
+
175
+ ```typescript
176
+ dashboardComponent.getFilters().then((data) => {
177
+ // do something with the item data
178
+ console.log('Item data', data);
179
+ });
180
+ ```
181
+
182
+ Export the dashboard
183
+
184
+ ```typescript
185
+ dashboardComponent.exportDashboard('png').then((data) => {
186
+ // do something with the item data
187
+ console.log('Item data', data);
188
+ });
189
+ ```
190
+
191
+ Get accessible dashboards of an integration
192
+
193
+ ```typescript
194
+ dashboardComponent.getAccessibleDashboards().then((dashboards) => {
195
+ // do something with the dashboards
196
+ console.log('Accessible dashboards', dashboards);
197
+ });
198
+ ```
199
+
200
+ ## Changelog
201
+
202
+ - [Changelog](https://embed-libs.luzmo.com/changelogs/dashboard/)
203
+
204
+ ## Quick links
205
+
206
+ [Luzmo](https://luzmo.com) |
207
+ [Demo - Sample Integration](https://luzmo.com/sample-integration) |
208
+ [Changelog](https://embed-libs.luzmo.com/changelogs/embed/) |
209
+ [Migrations](https://embed-libs.luzmo.com/migrations/embed/)
package/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@luzmo/shared-embed"),t=require("lit"),r=require("lit/decorators.js"),o=require("lit/directives/style-map.js");function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=a(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(a=o.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),o)}var a,n}function d(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function u(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=l(e);if(t){var a=l(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return u(this,r)}}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},h.apply(this,arguments)}function y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,i,s=[],d=!0,l=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(o=n.call(r)).done)&&(s.push(o.value),s.length!==t);d=!0);}catch(e){l=!0,a=e}finally{try{if(!d&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw a}}return s}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}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 n,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,n=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw n}}}}function g(e,t,r,o){var a,n=arguments.length,i=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(n<3?a(i):n>3?a(t,r,i):a(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i}function S(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var _,z,w,O,D,x,j=new(d((function e(){i(this,e),this._components=[]}))),k=t.css(_||(_=y(["\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n :host {\n position: relative;\n width: 100%;\n }\n\n .luzmo-embed-dashboard {\n background: transparent;\n padding: 0;\n border: 0;\n }\n\n .luzmo-container-loader {\n width: 100%;\n position: relative;\n }\n\n .luzmo-lc {\n margin: 0 auto;\n }\n\n .luzmo-loading-message {\n width: 100%;\n height: 20px;\n text-align: center;\n margin-bottom: 16px;\n font-family: Helvetica, Arial, sans-serif;\n font-size: 14px;\n }\n\n .luzmo-loading-circle {\n box-sizing: border-box;\n margin: 16px auto;\n position: relative;\n text-indent: -9999em;\n animation: spin 0.6s infinite linear;\n }\n\n .luzmo-loading-circle,\n .luzmo-loading-circle:after {\n border-radius: 50%;\n width: 32px;\n height: 32px;\n }\n\n .itemEmbedding:after {\n width: 24px;\n height: 24px;\n }\n\n .luzmo-error {\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .dashboard-error {\n font-size: 30px;\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .luzmo-loader {\n top: 0;\n left: 0;\n width: 100%;\n min-height: 400px;\n position: absolute;\n transition-duration: 0.3s;\n }\n"])));exports.LuzmoDashboard=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(a,t.LitElement);var r=c(a);function a(e){var t;return i(this,a),(t=r.call(this)).language="auto",t.screenMode="auto",t.switchScreenModeOnResize=!0,t.editMode="view",t.iframeStyle={},t._containerStyle={},t._loaderStyle={},t._lcStyle={},t._loadingCircleStyle={},t._containerLoaderStyle={},t._loaderMsg="",t._itemEmbedding=!1,t.browserError=!1,t.browserErrorMsg="",t.dashboardError=!1,t.browserNotSupported=[],t.VERSION="5.0.0-wc-luzmo",t.loaderSize=32,t.borderWidth=3,t.minHeight=400,t._containerId=n.uuidv4(),t._iframeId="luzmo-dashboard-".concat(t._containerId),t.iframeLoaded=!1,t.promises={},t.setInputParameters(e),t.params=t._setOptions(),t._onResize=function(){var e;if(null!==(e=t.shadowRoot)&&void 0!==e&&e.querySelector(".dashboard-container")){if(t.containerWidth=t.container.clientWidth,t.params.switchScreenModeOnResize&&"auto"===t.params.screenMode){var r,o=v(n.EXTENTS);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.width[0]<=window.innerWidth&&window.innerWidth<=a.width[1]&&(t.currentScreenMode=a.mode)}}catch(e){o.e(e)}finally{o.f()}}t.iframeLoaded&&t._calculateDimAfterDashboardLoaded()}},t._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&e.length&&t._onResize()}))})),t}return d(a,[{key:"setInputParameters",value:function(e){if(e){for(var t=0,r=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];t<r.length;t++){var o=r[t],a=e[o];a&&(this[o]=a)}e.appServer&&(this.appServer=n.addTrailingSlash(e.appServer))}}},{key:"connectedCallback",value:function(){h(l(a.prototype),"connectedCallback",this).call(this)}},{key:"disconnectedCallback",value:function(){h(l(a.prototype),"disconnectedCallback",this).call(this),this._resizeObserver.disconnect();for(var e=0,t=Object.keys(this.promises);e<t.length;e++){var r=t[e];this.promises[r].reject(new Error("Dashboard component was removed"))}}},{key:"firstUpdated",value:function(){var e;(j._components.push(this),this.containerWidth=this.container.clientWidth,this.params=this._setOptions(),n._extendAndValidate(this),n._browserCheck(this),this._setupLoader(),this.params.error)||(this._loaderStyles(),"function"!=typeof window.__luzmoMessageHandler&&(window.__luzmoMessageHandler=function(e){var t,r=j._components.find((function(t){return e.data.name===t._iframeId}));if(r)switch(null===(t=e.data)||void 0===t?void 0:t.type){case"load":r.dispatchEvent(new CustomEvent("load",{detail:{data:e.data}})),r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r.dimensions=e.data.dimensions,r._calculateDimAfterDashboardLoaded();break;case"error":r.dashboardError=!0,r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r._displayError();break;case"data":n.resolvePromise(r,e.data.requestId,e.data.data);break;case"filters":n.resolvePromise(r,e.data.requestId,e.data.filters);break;case"getAccessibleDashboards":n.resolvePromise(r,e.data.requestId,e.data.accessibleDashboards);break;case"dashboardAction":r.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:e.data}}));break;case"export":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):(r.dispatchEvent(new CustomEvent("exported",{detail:{data:e.data}})),n.resolvePromise(r,e.data.requestId,e.data));break;case"changedFilters":r.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:e.data}}));break;case"customEvent":r.dispatchEvent(new CustomEvent("customEvent",{detail:{data:e.data}}));break;case"chartsRendered":case"itemsRendered":e.data.type="itemsRendered",r.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:e.data}}));break;case"setEditMode":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):(n.resolvePromise(r,e.data.requestId,e.data),r.params.editMode=e.data.editMode,r._containerStyle=n.containerStyles(r),r.dimensions&&n._setCalculatedDimensions(r));break;case"setFilters":case"setPreview":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):n.resolvePromise(r,e.data.requestId,e.data)}},window.addEventListener("message",window.__luzmoMessageHandler,!1)),this._iframeUrl=n.createIframeUrl(this),null===(e=this.iframe)||void 0===e||e.setAttribute("src",this._iframeUrl),this.iframeStyle=n.calculateIframeStyles(this));this.container&&this._resizeObserver.observe(this.container)}},{key:"updated",value:function(e){var t,r=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),o=v(e.entries());try{for(o.s();!(t=o.n()).done;){var a=m(t.value,1)[0];r.has(a)&&"editMode"!==a?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout((function(){console.error("Failed to load dashboard, appServer is likely down or unreachable.")}),15e3),this.params=this._setOptions(),n._extendAndValidate(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=n.createIframeUrl(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=n.calculateIframeStyles(this)):r.has(a)&&"editMode"===a&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}}catch(e){o.e(e)}finally{o.f()}}},{key:"_setOptions",value:function(){var e={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(e.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(e.language=this.language),this.qeVersion&&(e.qeVersion=this.qeVersion),this.screenMode&&(e.screenMode=this.screenMode),e.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(e.token=this.authToken),this.authKey&&(e.key=this.authKey),this.editMode&&(e.editMode=this.editMode),this.mainColor&&(e.mainColor=this.mainColor),this.accentColor&&(e.accentColor=this.accentColor),this.loaderBackground&&(e.loaderBackground=this.loaderBackground),this.loaderFontColor&&(e.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(e.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(e.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(e.timezoneId=this.timezoneId),this.itemDimensions&&(e.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=n.addTrailingSlash(this.appServer),e.appServer=this.appServer):(this.appServer=n.addTrailingSlash(n.DEFAULT_PARAMETERS.appServer),e.appServer=this.appServer),this.apiHost?(this.apiHost=n.addTrailingSlash(this.apiHost),e.apiHost=this.apiHost):(this.apiHost=this.appServer.endsWith("luzmo.com/")?this.appServer.replace("app","api"):this.appServer,e.apiHost=this.apiHost),e}},{key:"_updateIframeUrl",value:function(){n.updateIframeUrl(this.iframe,this._iframeUrl)}},{key:"_setupLoader",value:function(){var e=n.getLoader(this);this._loaderMsg=e.loadingMsg,e.errorMsg&&(this.browserError=!0,this.browserErrorMsg=e.errorMsg,this._displayError())}},{key:"_displayError",value:function(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}},{key:"_calculateDimAfterDashboardLoaded",value:function(){this.dashboardError=!1,this._loaderStyles(),n._setCalculatedDimensions(this)}},{key:"_loaderStyles",value:function(){this._containerStyle=n.containerStyles(this),this._loaderStyle=n.loaderStyles(this),this._loadingCircleStyle=n.plStyles(this),this._containerLoaderStyle=n.containerLoaderStyles(this),this._lcStyle=n.lcStyles(this)}},{key:"render",value:function(){return t.html(z||(z=y(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),o.styleMap(this._containerStyle),this.dashboardId||this.dashboardSlug?t.html(w||(w=y(['\n <div\n class="luzmo-container-loader"\n id="luzmo-container-loader-','"\n style=','\n >\n <div\n class="luzmo-loader"\n id="luzmo-loader-','"\n style=','\n >\n <div\n class="luzmo-lc"\n style=','\n >\n <div\n class="luzmo-loading-circle"\n style=',"\n ></div>\n ",'\n </div>\n </div>\n </div>\n\n <iframe\n class="luzmo-embed-dashboard"\n id="','"\n name="','"\n style=','\n frameborder="0"\n ></iframe>\n '])),this._containerId,o.styleMap(this._containerLoaderStyle),this._containerId,o.styleMap(this._loaderStyle),o.styleMap(this._lcStyle),o.styleMap(this._loadingCircleStyle),this._itemEmbedding?"":t.html(O||(O=y([' <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>"])),o.styleMap({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,o.styleMap(this.iframeStyle)):t.html(D||(D=y(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?t.html(x||(x=y([' <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>"])),this._containerId,this.browserErrorMsg):"")}},{key:"getDashboards",value:function(){return new Promise((function(e,t){return e(j._components)}))}},{key:"getData",value:function(e){return n.getData(this,this.iframe,e)}},{key:"getFilters",value:function(){return n.getFilters(this,this.iframe)}},{key:"setFilters",value:function(e,t){return n.setFilters(this,this.iframe,e,t)}},{key:"setAuthorization",value:function(e,t){return n.setAuthorization(this,this.iframe,e,t)}},{key:"refreshData",value:function(e){return e?n.refreshData(this,this.iframe,e):n.refreshData(this,this.iframe)}},{key:"reloadDashboard",value:function(){return n.reloadDashboard(this,this.iframe)}},{key:"exportDashboard",value:function(e){return e?n.exportDashboard(this,this.iframe,e):n.exportDashboard(this,this.iframe)}},{key:"getAccessibleDashboards",value:function(){return n.getAccessibleDashboards(this,this.iframe)}},{key:"setEditMode",value:function(e){return n.setEditMode(this,this.iframe,e)}},{key:"setPreview",value:function(e){return n.setPreview(this,this.iframe,e)}}],[{key:"styles",get:function(){return[k]}}]),a}(),g([r.query(".dashboard-container"),S("design:type",HTMLElement)],exports.LuzmoDashboard.prototype,"container",void 0),g([r.query("iframe"),S("design:type",HTMLIFrameElement)],exports.LuzmoDashboard.prototype,"iframe",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardSlug",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"itemId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"language",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"qeVersion",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"screenMode",void 0),g([r.property({converter:{fromAttribute:function(e){return"true"===e},toAttribute:function(e){return String(e)}}}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"switchScreenModeOnResize",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"editMode",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"mainColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"accentColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"authToken",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"authKey",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderBackground",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderFontColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderSpinnerColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderSpinnerBackground",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"appServer",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"timezoneId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"apiHost",void 0),g([r.property({type:Object}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"itemDimensions",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_containerId",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_iframeId",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"params",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_iframeUrl",void 0),g([r.property({attribute:!1}),S("design:type",Boolean)],exports.LuzmoDashboard.prototype,"iframeLoaded",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"promises",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"iframeStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_containerStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loaderStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_lcStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loadingCircleStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_containerLoaderStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loaderMsg",void 0),g([r.property({attribute:!1}),S("design:type",Number)],exports.LuzmoDashboard.prototype,"containerWidth",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dimensions",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"currentScreenMode",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_itemEmbedding",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserError",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserErrorMsg",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardError",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserNotSupported",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"VERSION",void 0),exports.LuzmoDashboard=g([r.customElement("luzmo-dashboard"),S("design:paramtypes",[Object])],exports.LuzmoDashboard);
package/index.js ADDED
@@ -0,0 +1 @@
1
+ import*as e from"@luzmo/shared-embed";import{css as t,html as r,LitElement as i}from"lit";import{query as n,property as o,customElement as a}from"lit/decorators.js";import{styleMap as s}from"lit/directives/style-map.js";function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(n=i.key,o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(n,"string"))?o:String(o)),i)}var n,o}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=u(e);if(t){var n=u(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return h(this,r)}}function y(){return y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},y.apply(this,arguments)}function m(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],d=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);d=!0);}catch(e){l=!0,n=e}finally{try{if(!d&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return s}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function S(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=v(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function _(e,t,r,i){var n,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function w(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var O,j,k,E,I,z,M=new(c((function e(){d(this,e),this._components=[]}))),C=t(O||(O=m(["\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n :host {\n position: relative;\n width: 100%;\n }\n\n .luzmo-embed-dashboard {\n background: transparent;\n padding: 0;\n border: 0;\n }\n\n .luzmo-container-loader {\n width: 100%;\n position: relative;\n }\n\n .luzmo-lc {\n margin: 0 auto;\n }\n\n .luzmo-loading-message {\n width: 100%;\n height: 20px;\n text-align: center;\n margin-bottom: 16px;\n font-family: Helvetica, Arial, sans-serif;\n font-size: 14px;\n }\n\n .luzmo-loading-circle {\n box-sizing: border-box;\n margin: 16px auto;\n position: relative;\n text-indent: -9999em;\n animation: spin 0.6s infinite linear;\n }\n\n .luzmo-loading-circle,\n .luzmo-loading-circle:after {\n border-radius: 50%;\n width: 32px;\n height: 32px;\n }\n\n .itemEmbedding:after {\n width: 24px;\n height: 24px;\n }\n\n .luzmo-error {\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .dashboard-error {\n font-size: 30px;\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .luzmo-loader {\n top: 0;\n left: 0;\n width: 100%;\n min-height: 400px;\n position: absolute;\n transition-duration: 0.3s;\n }\n"]))),x=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(o,i);var n=f(o);function o(t){var r;return d(this,o),(r=n.call(this)).language="auto",r.screenMode="auto",r.switchScreenModeOnResize=!0,r.editMode="view",r.iframeStyle={},r._containerStyle={},r._loaderStyle={},r._lcStyle={},r._loadingCircleStyle={},r._containerLoaderStyle={},r._loaderMsg="",r._itemEmbedding=!1,r.browserError=!1,r.browserErrorMsg="",r.dashboardError=!1,r.browserNotSupported=[],r.VERSION="5.0.0-wc-luzmo",r.loaderSize=32,r.borderWidth=3,r.minHeight=400,r._containerId=e.uuidv4(),r._iframeId="luzmo-dashboard-".concat(r._containerId),r.iframeLoaded=!1,r.promises={},r.setInputParameters(t),r.params=r._setOptions(),r._onResize=function(){var t;if(null!==(t=r.shadowRoot)&&void 0!==t&&t.querySelector(".dashboard-container")){if(r.containerWidth=r.container.clientWidth,r.params.switchScreenModeOnResize&&"auto"===r.params.screenMode){var i,n=S(e.EXTENTS);try{for(n.s();!(i=n.n()).done;){var o=i.value;o.width[0]<=window.innerWidth&&window.innerWidth<=o.width[1]&&(r.currentScreenMode=o.mode)}}catch(e){n.e(e)}finally{n.f()}}r.iframeLoaded&&r._calculateDimAfterDashboardLoaded()}},r._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&e.length&&r._onResize()}))})),r}return c(o,[{key:"setInputParameters",value:function(t){if(t){for(var r=0,i=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];r<i.length;r++){var n=i[r],o=t[n];o&&(this[n]=o)}t.appServer&&(this.appServer=e.addTrailingSlash(t.appServer))}}},{key:"connectedCallback",value:function(){y(u(o.prototype),"connectedCallback",this).call(this)}},{key:"disconnectedCallback",value:function(){y(u(o.prototype),"disconnectedCallback",this).call(this),this._resizeObserver.disconnect();for(var e=0,t=Object.keys(this.promises);e<t.length;e++){var r=t[e];this.promises[r].reject(new Error("Dashboard component was removed"))}}},{key:"firstUpdated",value:function(){var t;(M._components.push(this),this.containerWidth=this.container.clientWidth,this.params=this._setOptions(),e._extendAndValidate(this),e._browserCheck(this),this._setupLoader(),this.params.error)||(this._loaderStyles(),"function"!=typeof window.__luzmoMessageHandler&&(window.__luzmoMessageHandler=function(t){var r,i=M._components.find((function(e){return t.data.name===e._iframeId}));if(i)switch(null===(r=t.data)||void 0===r?void 0:r.type){case"load":i.dispatchEvent(new CustomEvent("load",{detail:{data:t.data}})),i._loadTimeoutHandle&&(clearTimeout(i._loadTimeoutHandle),i._loadTimeoutHandle=void 0),i.iframeLoaded=!0,i.dimensions=t.data.dimensions,i._calculateDimAfterDashboardLoaded();break;case"error":i.dashboardError=!0,i._loadTimeoutHandle&&(clearTimeout(i._loadTimeoutHandle),i._loadTimeoutHandle=void 0),i.iframeLoaded=!0,i._displayError();break;case"data":e.resolvePromise(i,t.data.requestId,t.data.data);break;case"filters":e.resolvePromise(i,t.data.requestId,t.data.filters);break;case"getAccessibleDashboards":e.resolvePromise(i,t.data.requestId,t.data.accessibleDashboards);break;case"dashboardAction":i.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:t.data}}));break;case"export":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):(i.dispatchEvent(new CustomEvent("exported",{detail:{data:t.data}})),e.resolvePromise(i,t.data.requestId,t.data));break;case"changedFilters":i.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:t.data}}));break;case"customEvent":i.dispatchEvent(new CustomEvent("customEvent",{detail:{data:t.data}}));break;case"chartsRendered":case"itemsRendered":t.data.type="itemsRendered",i.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:t.data}}));break;case"setEditMode":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):(e.resolvePromise(i,t.data.requestId,t.data),i.params.editMode=t.data.editMode,i._containerStyle=e.containerStyles(i),i.dimensions&&e._setCalculatedDimensions(i));break;case"setFilters":case"setPreview":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):e.resolvePromise(i,t.data.requestId,t.data)}},window.addEventListener("message",window.__luzmoMessageHandler,!1)),this._iframeUrl=e.createIframeUrl(this),null===(t=this.iframe)||void 0===t||t.setAttribute("src",this._iframeUrl),this.iframeStyle=e.calculateIframeStyles(this));this.container&&this._resizeObserver.observe(this.container)}},{key:"updated",value:function(t){var r,i=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),n=S(t.entries());try{for(n.s();!(r=n.n()).done;){var o=b(r.value,1)[0];i.has(o)&&"editMode"!==o?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout((function(){console.error("Failed to load dashboard, appServer is likely down or unreachable.")}),15e3),this.params=this._setOptions(),e._extendAndValidate(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=e.createIframeUrl(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=e.calculateIframeStyles(this)):i.has(o)&&"editMode"===o&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}}catch(e){n.e(e)}finally{n.f()}}},{key:"_setOptions",value:function(){var t={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(t.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(t.language=this.language),this.qeVersion&&(t.qeVersion=this.qeVersion),this.screenMode&&(t.screenMode=this.screenMode),t.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(t.token=this.authToken),this.authKey&&(t.key=this.authKey),this.editMode&&(t.editMode=this.editMode),this.mainColor&&(t.mainColor=this.mainColor),this.accentColor&&(t.accentColor=this.accentColor),this.loaderBackground&&(t.loaderBackground=this.loaderBackground),this.loaderFontColor&&(t.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(t.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(t.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(t.timezoneId=this.timezoneId),this.itemDimensions&&(t.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=e.addTrailingSlash(this.appServer),t.appServer=this.appServer):(this.appServer=e.addTrailingSlash(e.DEFAULT_PARAMETERS.appServer),t.appServer=this.appServer),this.apiHost?(this.apiHost=e.addTrailingSlash(this.apiHost),t.apiHost=this.apiHost):(this.apiHost=this.appServer.endsWith("luzmo.com/")?this.appServer.replace("app","api"):this.appServer,t.apiHost=this.apiHost),t}},{key:"_updateIframeUrl",value:function(){e.updateIframeUrl(this.iframe,this._iframeUrl)}},{key:"_setupLoader",value:function(){var t=e.getLoader(this);this._loaderMsg=t.loadingMsg,t.errorMsg&&(this.browserError=!0,this.browserErrorMsg=t.errorMsg,this._displayError())}},{key:"_displayError",value:function(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}},{key:"_calculateDimAfterDashboardLoaded",value:function(){this.dashboardError=!1,this._loaderStyles(),e._setCalculatedDimensions(this)}},{key:"_loaderStyles",value:function(){this._containerStyle=e.containerStyles(this),this._loaderStyle=e.loaderStyles(this),this._loadingCircleStyle=e.plStyles(this),this._containerLoaderStyle=e.containerLoaderStyles(this),this._lcStyle=e.lcStyles(this)}},{key:"render",value:function(){return r(j||(j=m(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),s(this._containerStyle),this.dashboardId||this.dashboardSlug?r(k||(k=m(['\n <div\n class="luzmo-container-loader"\n id="luzmo-container-loader-','"\n style=','\n >\n <div\n class="luzmo-loader"\n id="luzmo-loader-','"\n style=','\n >\n <div\n class="luzmo-lc"\n style=','\n >\n <div\n class="luzmo-loading-circle"\n style=',"\n ></div>\n ",'\n </div>\n </div>\n </div>\n\n <iframe\n class="luzmo-embed-dashboard"\n id="','"\n name="','"\n style=','\n frameborder="0"\n ></iframe>\n '])),this._containerId,s(this._containerLoaderStyle),this._containerId,s(this._loaderStyle),s(this._lcStyle),s(this._loadingCircleStyle),this._itemEmbedding?"":r(E||(E=m([' <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>"])),s({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,s(this.iframeStyle)):r(I||(I=m(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?r(z||(z=m([' <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>"])),this._containerId,this.browserErrorMsg):"")}},{key:"getDashboards",value:function(){return new Promise((function(e,t){return e(M._components)}))}},{key:"getData",value:function(t){return e.getData(this,this.iframe,t)}},{key:"getFilters",value:function(){return e.getFilters(this,this.iframe)}},{key:"setFilters",value:function(t,r){return e.setFilters(this,this.iframe,t,r)}},{key:"setAuthorization",value:function(t,r){return e.setAuthorization(this,this.iframe,t,r)}},{key:"refreshData",value:function(t){return t?e.refreshData(this,this.iframe,t):e.refreshData(this,this.iframe)}},{key:"reloadDashboard",value:function(){return e.reloadDashboard(this,this.iframe)}},{key:"exportDashboard",value:function(t){return t?e.exportDashboard(this,this.iframe,t):e.exportDashboard(this,this.iframe)}},{key:"getAccessibleDashboards",value:function(){return e.getAccessibleDashboards(this,this.iframe)}},{key:"setEditMode",value:function(t){return e.setEditMode(this,this.iframe,t)}},{key:"setPreview",value:function(t){return e.setPreview(this,this.iframe,t)}}],[{key:"styles",get:function(){return[C]}}]),o}();_([n(".dashboard-container"),w("design:type",HTMLElement)],x.prototype,"container",void 0),_([n("iframe"),w("design:type",HTMLIFrameElement)],x.prototype,"iframe",void 0),_([o(),w("design:type",Object)],x.prototype,"dashboardId",void 0),_([o(),w("design:type",Object)],x.prototype,"dashboardSlug",void 0),_([o(),w("design:type",Object)],x.prototype,"itemId",void 0),_([o(),w("design:type",Object)],x.prototype,"language",void 0),_([o(),w("design:type",Object)],x.prototype,"qeVersion",void 0),_([o(),w("design:type",Object)],x.prototype,"screenMode",void 0),_([o({converter:{fromAttribute:function(e){return"true"===e},toAttribute:function(e){return String(e)}}}),w("design:type",Object)],x.prototype,"switchScreenModeOnResize",void 0),_([o(),w("design:type",Object)],x.prototype,"editMode",void 0),_([o(),w("design:type",Object)],x.prototype,"mainColor",void 0),_([o(),w("design:type",Object)],x.prototype,"accentColor",void 0),_([o(),w("design:type",Object)],x.prototype,"authToken",void 0),_([o(),w("design:type",Object)],x.prototype,"authKey",void 0),_([o(),w("design:type",Object)],x.prototype,"loaderBackground",void 0),_([o(),w("design:type",Object)],x.prototype,"loaderFontColor",void 0),_([o(),w("design:type",Object)],x.prototype,"loaderSpinnerColor",void 0),_([o(),w("design:type",Object)],x.prototype,"loaderSpinnerBackground",void 0),_([o(),w("design:type",Object)],x.prototype,"appServer",void 0),_([o(),w("design:type",Object)],x.prototype,"timezoneId",void 0),_([o(),w("design:type",Object)],x.prototype,"apiHost",void 0),_([o({type:Object}),w("design:type",Object)],x.prototype,"itemDimensions",void 0),_([o({attribute:!1}),w("design:type",String)],x.prototype,"_containerId",void 0),_([o({attribute:!1}),w("design:type",String)],x.prototype,"_iframeId",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"params",void 0),_([o({attribute:!1}),w("design:type",String)],x.prototype,"_iframeUrl",void 0),_([o({attribute:!1}),w("design:type",Boolean)],x.prototype,"iframeLoaded",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"promises",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"iframeStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_containerStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_loaderStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_lcStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_loadingCircleStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_containerLoaderStyle",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_loaderMsg",void 0),_([o({attribute:!1}),w("design:type",Number)],x.prototype,"containerWidth",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"dimensions",void 0),_([o({attribute:!1}),w("design:type",String)],x.prototype,"currentScreenMode",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"_itemEmbedding",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"browserError",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"browserErrorMsg",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"dashboardError",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"browserNotSupported",void 0),_([o({attribute:!1}),w("design:type",Object)],x.prototype,"VERSION",void 0),x=_([a("luzmo-dashboard"),w("design:paramtypes",[Object])],x);export{x as LuzmoDashboard};
@@ -0,0 +1,2 @@
1
+ (()=>{"use strict";var e=function(e,t){var r="The dashboard component encountered an error";"string"==typeof(null==t?void 0:t.dashboardId)&&(r+=" for dashboard with id ".concat(t.dashboardId)),"string"==typeof(null==t?void 0:t.dashboardSlug)&&(r+=" for dashboard with slug ".concat(t.dashboardSlug)),"string"==typeof(null==t?void 0:t.container)&&(r+=" in container ".concat(t.container)),e&&(r+=":\n".concat(e),console.error(r))},t={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null},r=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}];const n={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement..."},errorDashboard:{en:"Oops, we could not load this dashboard!",nl:"Oeps, we konden het dashboard niet laden.",fr:"Le chargement a echou\xe9."},errorItem:{en:"Oops, we could not load this item!",nl:"Oeps, we konden de grafiek niet laden.",fr:"Le chargement a echou\xe9."}};function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],d=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);d=!0);}catch(c){l=!0,i=c}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function a(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=d(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function d(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var c=function(e){return e?e.endsWith("/")?e:"".concat(e,"/"):""},h=function(e){return JSON.parse(JSON.stringify(e))},p=function e(t,r){return Object.entries(r).forEach((function(r){var n=i(r,2),o=n[0],a=n[1];o in t?void 0===t[o]?t[o]=a:t[o]=function(e){return e&&"object"===s(e)}(a)?e(t[o],a):t[o]:t[o]=a})),t},m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},f=function(e){var t=[],r=e.params,n=r.appServer,i=r.language,o=r.qeVersion,s=r.loaderBackground,a=r.loaderSpinnerColor,d=r.loaderSpinnerBackground,l=r.loaderFontColor,c=r.screenMode,h=r.key,p=r.token,m=r.timezoneId,f=r.itemEmbedding,v=r.itemDimensions,y=r.dashboardId,g=r.dashboardSlug,b=r.itemId,w=r.mainColor,_=r.accentColor,S=r.editMode;i&&"auto"!==i&&t.push("language="+i),o&&t.push("qe_version=".concat(o)),s&&t.push("ldrbg=".concat(s)),l&&t.push("ldrftclr=".concat(l)),a&&t.push("ldrspclr=".concat(a)),d&&t.push("ldrspbg=".concat(d)),w&&t.push("mainColor=".concat(w)),_&&t.push("accentColor=".concat(_)),c&&"auto"!==c&&t.push("screenMode="+c),m&&t.push("timezoneId="+m),f&&v&&v.width&&t.push("width="+v.width),f&&v&&v.height&&t.push("height="+v.height),S&&t.push("editMode="+S);var E=h&&p?"#"+h+":"+p:"";return t.push("version="+(e.VERSION||"0.0.0-shared-luzmo")),function(e){var t=new Set([".","/"]);if(!e)return"about:blank";var r,n=e.replace(/[^\u0020-\u007E]/gim,"").trim();if(r=n,t.has(r[0]))return n;var i=n.match(/^([^:]+):/gm);if(!i)return n;var o=i[0];return/^(%20|\s)*(javascript|data)/im.test(o)?"about:blank":n}(f?"".concat(n,"i/").concat(y||g,"/").concat(b,"?").concat(encodeURIComponent(t.join("&"))).concat(E):"".concat(n,"i/").concat(y||g,"?").concat(encodeURIComponent(t.join("&"))).concat(E))};function v(e,t,r){e.promises[t]&&(e.promises[t].resolve(r),delete e.promises[t])}function y(e,t,r){e.promises[t]&&(e.promises[t].reject(r),delete e.promises[t])}function g(e){var t={width:"100%",height:"100%"};return e.params.loaderBackground&&!e.iframeLoaded&&(t.background=e.params.loaderBackground),t}function b(e){var r=e.params.itemDimensions.height||t.itemDimensions.height,n=e.params.itemDimensions.width||t.itemDimensions.width;e.params.itemEmbedding&&"auto"!==r?e.iframeHeight="".concat(r,"px"):e.params.itemEmbedding?e.iframeHeight="200px":["editFull","editLimited"].includes(e.params.editMode)?e.iframeHeight="100%":e.iframeHeight="400px",e.iframeWidth=e.params.itemEmbedding&&"auto"!==n?"".concat(n,"px"):"100%";var i={height:e.iframeHeight,width:e.iframeWidth};return e.iframeLoaded?i.opacity=1:e.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function w(e,t){return"".concat(e,"px solid ").concat(t)}var _=function(e,t,r){var n=m();return null!=t&&t.contentWindow?(t.contentWindow.postMessage({action:"exportDashboard",format:r||"png",_version:e.VERSION,requestId:n},"*"),new Promise((function(t,r){e.promises[n]={resolve:t,reject:r},setTimeout((function(){if(e.promises[n]){e.promises[n].reject(new Error("exportDashboard request timed out.")),delete e.promises[n]}}),12e5)}))):Promise.reject(new Error("Cannot retrieve contentWindow."))},S=function(e,t){if((e.dashboardId||e.dashboardSlug)&&null!=t&&t.contentWindow){var r=m();return t.contentWindow.postMessage({action:"getAccessibleDashboards",_version:e.VERSION,requestId:r},"*"),new Promise((function(t,n){e.promises[r]={resolve:t,reject:n},setTimeout((function(){if(e.promises[r]){e.promises[r].reject(new Error("getAccessibleDashboards request timed out.")),delete e.promises[r]}}),2e3)}))}var n=new Promise((function(t,r){!function(){try{window.fetch("".concat(String(e.params.apiHost),"0.1.0/authorization"),{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:e.authKey,token:e.authToken,find:{where:{id:e.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then((function(e){return e.json()})).then((function(e){e&&e.rows&&0!==e.rows.length&&e.rows[0].user&&e.rows[0].integration_id?(e.rows[0].user.userGroups=e.rows[0].user.groups.map((function(e){return e.id})),delete e.rows[0].user.groups,t({integrationId:e.rows[0].integration_id,user:e.rows[0].user})):r()}))}catch(n){r(n)}}()}));return new Promise((function(t,r){!function(){try{n.then((function(r){window.fetch("".concat(String(e.params.apiHost),"0.1.0/securable"),{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:e.authKey,token:e.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then((function(e){return e.json()})).then((function(n){var i=n.rows.length>0?function(e,t,r,n){var i,d=function(e,t){var r,n,i=e.users.find((function(e){return e.id===t.id})),o=i&&i.userAccessRight?{flagRead:i.userAccessRight.flagRead,flagUse:i.userAccessRight.flagUse,flagModify:i.userAccessRight.flagModify,flagOwn:i.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},s=a(e.groups.filter((function(e){return t.userGroups.includes(e.id)||!0===e.public})).map((function(e){if(e.groupAccessRight)return e.groupAccessRight})));try{for(s.s();!(n=s.n()).done;){var d=n.value;!o.flagRead&&d.flagRead&&(o.flagRead=d.flagRead),!o.flagUse&&d.flagUse&&(o.flagUse=d.flagUse),!o.flagModify&&d.flagModify&&(o.flagModify=d.flagModify),!o.flagOwn&&d.flagOwn&&(o.flagOwn=d.flagOwn)}}catch(p){s.e(p)}finally{s.f()}var l,c=a((null===(r=e.integrations)||void 0===r?void 0:r.length)>0?e.integrations.map((function(e){if(e.integrationAccessRight)return e.integrationAccessRight})):[]);try{for(c.s();!(l=c.n()).done;){var h=l.value;!o.flagRead&&h.flagRead&&(o.flagRead=h.flagRead),!o.flagUse&&h.flagUse&&(o.flagUse=h.flagUse),!o.flagModify&&h.flagModify&&(o.flagModify=h.flagModify)}}catch(p){c.e(p)}finally{c.f()}return o},l=function(e,t){return null==e?"":"object"!==s(e)||0===Object.keys(e).length?"object"===s(e)&&0===Object.keys(e).length?"":e:(null==(r=t&&e[t]?e[t]:e[Object.keys(e)[0]])&&(r=""),r);var r},c=[],h=a(e);try{for(h.s();!(i=h.n()).done;){var p,m=i.value,f={accessibleBy:[],accessRights:d(m,r),id:m.id,modifiedAt:m.modified_at,name:l(m.name,n.language),slug:null,tags:m.tags.map((function(e){return e.tag})).sort((function(e,t){return e.localeCompare(t)}))},v=m.integrations.find((function(e){return e.id===t}));null!=v&&null!==(p=v.integrationAccessRight)&&void 0!==p&&p.slug&&(f.slug=v.integrationAccessRight.slug);var y=m.users.map((function(e){return{model:"User",id:e.id,name:l(e.name,r.locale_id)}})),g=m.groups.map((function(e){return{model:"Group",id:e.id,name:l(e.name,r.locale_id)||{}}})),b=m.integrations.map((function(e){return{model:"Integration",id:e.id,name:l(e.name,r.locale_id)||{}}}));f.accessibleBy=[].concat(o(y),o(g),o(b)),c.push(f)}}catch(w){h.e(w)}finally{h.f()}return c}(n.rows,r.integrationId,r.user,e):[];t(i)}))})).catch((function(e){r(e)}))}catch(i){r(i)}}()}))},E=function(e,t,r){return t?(t.contentWindow.postMessage({action:"refreshData",id:r||null,_version:e.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."))};function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==A(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===A(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],d=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);d=!0);}catch(c){l=!0,i=c}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=j(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function j(e,t){if(e){if("string"==typeof e)return D(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(e,t):void 0}}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var T=function(t){t.dimensions||(t.params.error=!0,e("Got no valid dimensions.",t.params));var n,i=Object.keys(t.dimensions),o=[],s=0,a=0;if(!t.params.switchScreenModeOnResize&&t.currentScreenMode&&(t.params.screenMode=t.currentScreenMode),t.dimensions&&"fixed"===(null==i?void 0:i[0]))n="fixed",s=t.dimensions.fixed[0],a=t.dimensions.fixed[1];else{var d=["mobile","tablet","desktop","largeScreen"];if(t.params.itemEmbedding){var l,c=i[0],p=h(c),m=P(d);try{var f=function(){var e=l.value,r=i.find((function(t){return t===e}));r?p=h(r):t.dimensions[e]=t.dimensions[p]};for(m.s();!(l=m.n()).done;)f()}catch(Z){m.e(Z)}finally{m.f()}}var v,y=P(i);try{var g=function(){var e=v.value;if(d.includes(e)){var n=r.find((function(t){return t.mode===e}));o.push(x(x({},n),{},{height:t.dimensions[e][1]||50}))}};for(y.s();!(v=y.n()).done;)g()}catch(Z){y.e(Z)}finally{y.f()}if(o.map((function(e){return e.mode})).includes(t.params.screenMode)||(t.params.screenMode="auto"),"auto"===t.params.screenMode){o.sort((function(e,t){return d.indexOf(e.mode)-d.indexOf(t.mode)}));var b,w=P(o);try{for(w.s();!(b=w.n()).done;){var _,S,E,A,$=b.value,O=C($.width,2),j=O[0],D=O[1];if(t.params.itemEmbedding&&t.params.itemDimensions&&"auto"!==t.params.itemDimensions.width&&"auto"===t.params.itemDimensions.height)j<t.params.itemDimensions.width&&(n=$.mode,s=Number.parseInt(t.params.itemDimensions.width,10),a=t.dimensions[n][1]);else if(j<t.containerWidth)if(n=$.mode,t.params.itemEmbedding)s=null!==(_=t.params.itemDimensions)&&void 0!==_&&_.width&&"auto"!==(null===(S=t.params.itemDimensions)||void 0===S?void 0:S.width)?Number.parseInt(t.params.itemDimensions.width,10):Math.min(t.containerWidth,D),a=null!==(E=t.params.itemDimensions)&&void 0!==E&&E.height&&"auto"!==(null===(A=t.params.itemDimensions)||void 0===A?void 0:A.height)?Number.parseInt(t.params.itemDimensions.height,10):t.dimensions[n][1],t.params.itemDimensions&&"auto"!==t.params.itemDimensions.width&&"auto"===t.params.itemDimensions.height&&(s=Number.parseInt(t.params.itemDimensions.width,10),a=t.dimensions[n][1]);else s=Math.max(Math.min(D,t.containerWidth),j),a=$.height}}catch(Z){w.e(Z)}finally{w.f()}}else{var T,H,U,N,W=o.find((function(e){return e.mode===t.params.screenMode})),B=W.height,q=C(W.width,2),F=q[0],K=q[1];if(n=t.params.screenMode,s=Math.max(Math.min(K,t.containerWidth),F),a=B,t.params.itemEmbedding)null!==(T=t.params.itemDimensions)&&void 0!==T&&T.width&&"auto"!==(null===(H=t.params.itemDimensions)||void 0===H?void 0:H.width)&&(s=Number.parseInt(t.params.itemDimensions.width,10)),null!==(U=t.params.itemDimensions)&&void 0!==U&&U.height&&"auto"!==(null===(N=t.params.itemDimensions)||void 0===N?void 0:N.height)&&(a=Number.parseInt(t.params.itemDimensions.height,10))}if(!n&&o.length>0){var G=o[0];n=G.mode,s=G.width[0],a=G.height}}t.currentScreenMode=n;var J={height:0===a?"100%":"".concat(String(a),"px"),width:0===s?"100%":"".concat(String(s),"px"),opacity:1};["editFull","editLimited"].includes(t.params.editMode)?(J.height="100%",J.width="100%"):t.params.itemEmbedding&&t.params.itemDimensions?(J.height="auto"===t.params.itemDimensions.height?J.height:"".concat(String(t.params.itemDimensions.height).replace("px",""),"px"),J.width="auto"===t.params.itemDimensions.width?J.width:"".concat(String(t.params.itemDimensions.width).replace("px",""),"px")):(J.height=0===a?"100%":"".concat(String(a),"px"),J.width=0===s?"100%":"".concat(String(s),"px")),t.currentScreenMode=n,t.iframeStyle=J};function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}var U=function(r){for(var n=[],i=["mobile","tablet","desktop","largeScreen","fixed","auto"],o=0,s=Object.keys(t);o<s.length;o++){var a=s[o];null===r.params[a]&&delete r.params[a]}r.params=p(r.params,t),r.params.dashboardId&&"string"==typeof r.params.dashboardId||r.params.dashboardSlug&&"string"==typeof r.params.dashboardSlug||(delete r.params.dashboardId,delete r.params.dashboardSlug);for(var d=0,l=["appServer","language","apiHost"];d<l.length;d++){var c=l[d];"string"!=typeof r.params[c]&&(delete r.params[c],n.push("".concat(c," needs to be of type string.")))}for(var h=0,m=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"];h<m.length;h++){var f=m[h];"string"!=typeof r.params[f]&&null!==r.params[f]&&void 0!==r.params[f]&&(delete r.params[f],n.push("".concat(f," needs to be of type string or empty.")))}if(r.params.screenMode&&!i.includes(r.params.screenMode)){var v=i.map((function(e){return'"'.concat(e,'"')})).join(", ");n.push('"screenMode" needs should be one of these types: '.concat(v)),r.params.screenMode="auto"}r.params.itemId&&(r.params.itemEmbedding=!0);for(var y=0,g=["itemDimensions"];y<g.length;y++){var b=g[y];"object"!==H(r.params[b])&&null!==r.params[b]&&(delete r.params[b],n.push("".concat(b," needs to be of type object or empty.")))}if("boolean"!=typeof r.params.switchScreenModeOnResize&&(n.push("switchScreenModeOnResize needs to be of type boolean."),r.params.switchScreenModeOnResize=!0),r.params.itemDimensions)for(var w=0,_=["width","height"];w<_.length;w++){var S=_[w];["string","number"].includes(H(r.params.itemDimensions[S]))||null===r.params.itemDimensions[S]||n.push("itemDimensions ".concat(S," needs to be of type string, number or empty."))}r.params=p(r.params,t),r.params.screenMode&&"auto"!==r.params.screenMode&&(r.params.switchScreenModeOnResize=!1),"auto"!==r.params.itemDimensions.width&&(r.params.itemDimensions.width=Number.parseInt("".concat(r.params.itemDimensions.width).replace("px",""),10)||"auto"),"auto"!==r.params.itemDimensions.height&&(r.params.itemDimensions.height=Number.parseInt("".concat(r.params.itemDimensions.height).replace("px",""),10)||"auto"),r.params.itemEmbedding=!!r.params.itemId,(r.params.error||n.length)&&e(n.join("\n"),r.params)};const N=window,W=N.ShadowRoot&&(void 0===N.ShadyCSS||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,B=Symbol(),q=new WeakMap;class css_tag_o{constructor(e,t,r){if(this._$cssResult$=!0,r!==B)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(W&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=q.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&q.set(t,e))}return e}toString(){return this.cssText}}const F=W?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new css_tag_o("string"==typeof e?e:e+"",void 0,B))(t)})(e):e;var K;const G=window,J=G.trustedTypes,Z=J?J.emptyScript:"",Y=G.reactiveElementPolyfillSupport,Q={toAttribute(e,t){switch(t){case Boolean:e=e?Z:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},X=(e,t)=>t!==e&&(t==t||e==e),ee={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:X},te="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,r)=>{const n=this._$Ep(r,t);void 0!==n&&(this._$Ev.set(n,r),e.push(n))})),e}static createProperty(e,t=ee){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const r="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){const i=this[e];this[t]=n,this.requestUpdate(e,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||ee}static finalize(){if(this.hasOwnProperty(te))return!1;this[te]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of t)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(F(e))}else void 0!==e&&t.push(F(e));return t}static _$Ep(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,r;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(r=e.hostConnected)||void 0===r||r.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{W?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),n=N.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=t.cssText,e.appendChild(r)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=ee){var n;const i=this.constructor._$Ep(e,r);if(void 0!==i&&!0===r.reflect){const o=(void 0!==(null===(n=r.converter)||void 0===n?void 0:n.toAttribute)?r.converter:Q).toAttribute(t,r.type);this._$El=e,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$El=null}}_$AK(e,t){var r;const n=this.constructor,i=n._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=n.getPropertyOptions(i),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(r=e.converter)||void 0===r?void 0:r.fromAttribute)?e.converter:Q;this._$El=i,this[i]=o.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;void 0!==e&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||X)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(r)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var re;u[te]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==Y||Y({ReactiveElement:u}),(null!==(K=G.reactiveElementVersions)&&void 0!==K?K:G.reactiveElementVersions=[]).push("1.6.2");const ne=window,ie=ne.trustedTypes,oe=ie?ie.createPolicy("lit-html",{createHTML:e=>e}):void 0,se="$lit$",ae=`lit$${(Math.random()+"").slice(9)}$`,de="?"+ae,le=`<${de}>`,ce=document,ue=()=>ce.createComment(""),he=e=>null===e||"object"!=typeof e&&"function"!=typeof e,pe=Array.isArray,me=e=>pe(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),fe="[ \t\n\f\r]",ve=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,ge=/>/g,be=RegExp(`>|${fe}(?:([^\\s"'>=/]+)(${fe}*=${fe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),we=/'/g,_e=/"/g,ke=/^(?:script|style|textarea|title)$/i,Se=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),Ee=Se(1),Ae=(Se(2),Symbol.for("lit-noChange")),$e=Symbol.for("lit-nothing"),xe=new WeakMap,Oe=ce.createTreeWalker(ce,129,null,!1),Me=(e,t)=>{const r=e.length-1,n=[];let i,o=2===t?"<svg>":"",s=ve;for(let d=0;d<r;d++){const t=e[d];let r,a,l=-1,c=0;for(;c<t.length&&(s.lastIndex=c,a=s.exec(t),null!==a);)c=s.lastIndex,s===ve?"!--"===a[1]?s=ye:void 0!==a[1]?s=ge:void 0!==a[2]?(ke.test(a[2])&&(i=RegExp("</"+a[2],"g")),s=be):void 0!==a[3]&&(s=be):s===be?">"===a[0]?(s=null!=i?i:ve,l=-1):void 0===a[1]?l=-2:(l=s.lastIndex-a[2].length,r=a[1],s=void 0===a[3]?be:'"'===a[3]?_e:we):s===_e||s===we?s=be:s===ye||s===ge?s=ve:(s=be,i=void 0);const h=s===be&&e[d+1].startsWith("/>")?" ":"";o+=s===ve?t+le:l>=0?(n.push(r),t.slice(0,l)+se+t.slice(l)+ae+h):t+ae+(-2===l?(n.push(void 0),d):h)}const a=o+(e[r]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==oe?oe.createHTML(a):a,n]};class V{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,o=0;const s=e.length-1,a=this.parts,[d,l]=Me(e,t);if(this.el=V.createElement(d,r),Oe.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=Oe.nextNode())&&a.length<s;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith(se)||t.startsWith(ae)){const r=l[o++];if(e.push(t),void 0!==r){const e=n.getAttribute(r.toLowerCase()+se).split(ae),t=/([.?@])?(.*)/.exec(r);a.push({type:1,index:i,name:t[2],strings:e,ctor:"."===t[1]?k:"?"===t[1]?I:"@"===t[1]?L:R})}else a.push({type:6,index:i})}for(const t of e)n.removeAttribute(t)}if(ke.test(n.tagName)){const e=n.textContent.split(ae),t=e.length-1;if(t>0){n.textContent=ie?ie.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],ue()),Oe.nextNode(),a.push({type:2,index:++i});n.append(e[t],ue())}}}else if(8===n.nodeType)if(n.data===de)a.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(ae,e+1));)a.push({type:7,index:i}),e+=ae.length-1}i++}}static createElement(e,t){const r=ce.createElement("template");return r.innerHTML=e,r}}function Ce(e,t,r=e,n){var i,o,s,a;if(t===Ae)return t;let d=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const l=he(t)?void 0:t._$litDirective$;return(null==d?void 0:d.constructor)!==l&&(null===(o=null==d?void 0:d._$AO)||void 0===o||o.call(d,!1),void 0===l?d=void 0:(d=new l(e),d._$AT(e,r,n)),void 0!==n?(null!==(s=(a=r)._$Co)&&void 0!==s?s:a._$Co=[])[n]=d:r._$Cl=d),void 0!==d&&(t=Ce(e,d._$AS(e,t.values),d,n)),t}class lit_html_S{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:r},parts:n}=this._$AD,i=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:ce).importNode(r,!0);Oe.currentNode=i;let o=Oe.nextNode(),s=0,a=0,d=n[0];for(;void 0!==d;){if(s===d.index){let t;2===d.type?t=new M(o,o.nextSibling,this,e):1===d.type?t=new d.ctor(o,d.name,d.strings,this,e):6===d.type&&(t=new z(o,this,e)),this._$AV.push(t),d=n[++a]}s!==(null==d?void 0:d.index)&&(o=Oe.nextNode(),s++)}return Oe.currentNode=ce,i}v(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class M{constructor(e,t,r,n){var i;this.type=2,this._$AH=$e,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ce(this,e,t),he(e)?e===$e||null==e||""===e?(this._$AH!==$e&&this._$AR(),this._$AH=$e):e!==this._$AH&&e!==Ae&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):me(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==$e&&he(this._$AH)?this._$AA.nextSibling.data=e:this.$(ce.createTextNode(e)),this._$AH=e}g(e){var t;const{values:r,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=V.createElement(n.h,this.options)),n);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===i)this._$AH.v(r);else{const e=new lit_html_S(i,this),t=e.u(this.options);e.v(r),this.$(t),this._$AH=e}}_$AC(e){let t=xe.get(e.strings);return void 0===t&&xe.set(e.strings,t=new V(e)),t}T(e){pe(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,n=0;for(const i of e)n===t.length?t.push(r=new M(this.k(ue()),this.k(ue()),this,this.options)):r=t[n],r._$AI(i),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class R{constructor(e,t,r,n,i){this.type=1,this._$AH=$e,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=$e}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){const i=this.strings;let o=!1;if(void 0===i)e=Ce(this,e,t,0),o=!he(e)||e!==this._$AH&&e!==Ae,o&&(this._$AH=e);else{const n=e;let s,a;for(e=i[0],s=0;s<i.length-1;s++)a=Ce(this,n[r+s],t,s),a===Ae&&(a=this._$AH[s]),o||(o=!he(a)||a!==this._$AH[s]),a===$e?e=$e:e!==$e&&(e+=(null!=a?a:"")+i[s+1]),this._$AH[s]=a}o&&!n&&this.j(e)}j(e){e===$e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class k extends R{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===$e?void 0:e}}const Ie=ie?ie.emptyScript:"";class I extends R{constructor(){super(...arguments),this.type=4}j(e){e&&e!==$e?this.element.setAttribute(this.name,Ie):this.element.removeAttribute(this.name)}}class L extends R{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){var r;if((e=null!==(r=Ce(this,e,t,0))&&void 0!==r?r:$e)===Ae)return;const n=this._$AH,i=e===$e&&n!==$e||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==$e&&(n===$e||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==r?r:this.element,e):this._$AH.handleEvent(e)}}class z{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Ce(this,e)}}const Pe=ne.litHtmlPolyfillSupport;null==Pe||Pe(V,M),(null!==(re=ne.litHtmlVersions)&&void 0!==re?re:ne.litHtmlVersions=[]).push("2.7.4");var je,De;class lit_element_s extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const r=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=r.firstChild),r}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{var n,i;const o=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:t;let s=o._$litPart$;if(void 0===s){const e=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;o._$litPart$=s=new M(t.insertBefore(ue(),e),e,void 0,null!=r?r:{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return Ae}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(je=globalThis.litElementHydrateSupport)||void 0===je||je.call(globalThis,{LitElement:lit_element_s});const ze=globalThis.litElementPolyfillSupport;null==ze||ze({LitElement:lit_element_s});(null!==(De=globalThis.litElementVersions)&&void 0!==De?De:globalThis.litElementVersions=[]).push("3.3.2");const Re=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}};function Te(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):Re(e,t)}function He(e,t){return(({finisher:e,descriptor:t})=>(r,n)=>{var i;if(void 0===n){const n=null!==(i=r.originalKey)&&void 0!==i?i:r.key,o=null!=t?{kind:"method",placement:"prototype",key:n,descriptor:t(r.key)}:{...r,key:n};return null!=e&&(o.finisher=function(t){e(t,n)}),o}{const i=r.constructor;void 0!==t&&Object.defineProperty(r,n,t(n)),null==e||e(i,n)}})({descriptor:r=>{const n={get(){var t,r;return null!==(r=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==r?r:null},enumerable:!0,configurable:!0};if(t){const t="symbol"==typeof r?Symbol():"__"+r;n.get=function(){var r,n;return void 0===this[t]&&(this[t]=null!==(n=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e))&&void 0!==n?n:null),this[t]}}return n}})}var Ue;null===(Ue=window.HTMLSlotElement)||void 0===Ue||Ue.prototype.assignedElements;const Ne=1;class directive_i{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const We="important",Le=" !"+We,Be=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends directive_i{constructor(e){var t;if(super(e),e.type!==Ne||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,r)=>{const n=e[r];return null==n?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(e,[t]){const{style:r}=e.element;if(void 0===this.ut){this.ut=new Set;for(const e in t)this.ut.add(e);return this.render(t)}this.ut.forEach((e=>{null==t[e]&&(this.ut.delete(e),e.includes("-")?r.removeProperty(e):r[e]="")}));for(const n in t){const e=t[n];if(null!=e){this.ut.add(n);const t="string"==typeof e&&e.endsWith(Le);n.includes("-")||t?r.setProperty(n,t?e.slice(0,-11):e,t?We:""):r[n]=e}}return Ae}}),qe="5.0.0";function Ve(e){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ve(e)}function Fe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ge(n.key),n)}}function Ke(e,t,r){return t&&Fe(e.prototype,t),r&&Fe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ge(e){var t=function(e,t){if("object"!==Ve(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ve(t)?t:String(t)}const Je=new(Ke((function e(){var t,r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,n=[],(r=Ge(r="_components"))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n})));var Ze;var Ye,Qe,Xe,et,tt,rt,nt,it=((e,...t)=>{const r=1===e.length?e[0]:t.reduce(((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1]),e[0]);return new css_tag_o(r,e,B)})(Ze||(Ye=["\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n :host {\n position: relative;\n width: 100%;\n }\n\n .luzmo-embed-dashboard {\n background: transparent;\n padding: 0;\n border: 0;\n }\n\n .luzmo-container-loader {\n width: 100%;\n position: relative;\n }\n\n .luzmo-lc {\n margin: 0 auto;\n }\n\n .luzmo-loading-message {\n width: 100%;\n height: 20px;\n text-align: center;\n margin-bottom: 16px;\n font-family: Helvetica, Arial, sans-serif;\n font-size: 14px;\n }\n\n .luzmo-loading-circle {\n box-sizing: border-box;\n margin: 16px auto;\n position: relative;\n text-indent: -9999em;\n animation: spin 0.6s infinite linear;\n }\n\n .luzmo-loading-circle,\n .luzmo-loading-circle:after {\n border-radius: 50%;\n width: 32px;\n height: 32px;\n }\n\n .itemEmbedding:after {\n width: 24px;\n height: 24px;\n }\n\n .luzmo-error {\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .dashboard-error {\n font-size: 30px;\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .luzmo-loader {\n top: 0;\n left: 0;\n width: 100%;\n min-height: 400px;\n position: absolute;\n transition-duration: 0.3s;\n }\n"],Qe||(Qe=Ye.slice(0)),Ze=Object.freeze(Object.defineProperties(Ye,{raw:{value:Object.freeze(Qe)}}))));function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function st(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function at(e,t){return St(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],d=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);d=!0);}catch(c){l=!0,i=c}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||_t(e,t)||wt()}function dt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_t(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,bt(n.key),n)}}function ct(e,t){return ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ct(e,t)}function ut(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=At(e);if(t){var i=At(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ot(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ht(e)}(this,r)}}function ht(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pt(){pt=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!vt(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],i=e.decorators,o=i.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e),d=this.toElementFinisherExtras((0,i[o])(a)||a);e=d.element,this.addElementPlacement(e,t),d.finisher&&n.push(d.finisher);var l=d.extras;if(l){for(var c=0;c<l.length;c++)this.addElementPlacement(l[c],t);r.push.apply(r,l)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var s=0;s<e.length-1;s++)for(var a=s+1;a<e.length;a++)if(e[s].key===e[a].key&&e[s].placement===e[a].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,St(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||_t(t)||wt()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=bt(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:gt(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=gt(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function mt(e){var t,r=bt(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function ft(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function vt(e){return e.decorators&&e.decorators.length}function yt(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function gt(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function bt(e){var t=function(e,t){if("object"!==ot(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ot(t)?t:String(t)}function wt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _t(e,t){if(e){if("string"==typeof e)return kt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(e,t):void 0}}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function St(e){if(Array.isArray(e))return e}function Et(){return Et="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=At(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Et.apply(this,arguments)}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},At(e)}!function(e,t,r,n){var i=pt();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var s=t((function(e){i.initializeInstanceElements(e,a.elements)}),r),a=i.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var i,o=e[n];if("method"===o.kind&&(i=t.find(r)))if(yt(o.descriptor)||yt(i.descriptor)){if(vt(o)||vt(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(vt(o)){if(vt(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}ft(o,i)}else t.push(o)}return t}(s.d.map(mt)),e);i.initializeClassElements(s.F,a.elements),i.runClassFinishers(s.F,a.finishers)}([(e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:r,elements:n}=t;return{kind:r,elements:n,finisher(t){customElements.define(e,t)}}})(e,t))("luzmo-dashboard")],(function(i,o){var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ct(e,t)}(a,e);var t,n,o,s=ut(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=s.call(this),i(ht(t)),t._containerId=m(),t._iframeId="luzmo-dashboard-".concat(t._containerId),t.iframeLoaded=!1,t.promises={},t.setInputParameters(e),t.params=t._setOptions(),t._onResize=function(){var e;if(null!==(e=t.shadowRoot)&&void 0!==e&&e.querySelector(".dashboard-container")){if(t.containerWidth=t.container.clientWidth,t.params.switchScreenModeOnResize&&"auto"===t.params.screenMode){var n,i=dt(r);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.width[0]<=window.innerWidth&&window.innerWidth<=o.width[1]&&(t.currentScreenMode=o.mode)}}catch(s){i.e(s)}finally{i.f()}}t.iframeLoaded&&t._calculateDimAfterDashboardLoaded()}},t._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&e.length&&t._onResize()}))})),t}return t=a,n&&lt(t.prototype,n),o&&lt(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}(o);return{F:s,d:[{kind:"field",decorators:[He(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[He("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[Te()],key:"dashboardId",value:void 0},{kind:"field",decorators:[Te()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[Te()],key:"itemId",value:void 0},{kind:"field",decorators:[Te()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[Te()],key:"qeVersion",value:void 0},{kind:"field",decorators:[Te()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[Te({converter:{fromAttribute:function(e){return"true"===e},toAttribute:function(e){return String(e)}}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[Te()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[Te()],key:"mainColor",value:void 0},{kind:"field",decorators:[Te()],key:"accentColor",value:void 0},{kind:"field",decorators:[Te()],key:"authToken",value:void 0},{kind:"field",decorators:[Te()],key:"authKey",value:void 0},{kind:"field",decorators:[Te()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[Te()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[Te()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[Te()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[Te()],key:"appServer",value:void 0},{kind:"field",decorators:[Te()],key:"timezoneId",value:void 0},{kind:"field",decorators:[Te()],key:"apiHost",value:void 0},{kind:"field",decorators:[Te({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[Te({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[Te({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[Te({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[Te({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[Te({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[Te({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[Te({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[Te({attribute:!1})],key:"VERSION",value:function(){return qe+"-wc-luzmo"}},{kind:"field",key:"_loadTimeoutHandle",value:void 0},{kind:"field",key:"_onResize",value:void 0},{kind:"field",key:"loaderSize",value:function(){return 32}},{kind:"field",key:"borderWidth",value:function(){return 3}},{kind:"field",key:"minHeight",value:function(){return 400}},{kind:"field",key:"iframeHeight",value:void 0},{kind:"field",key:"iframeWidth",value:void 0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"method",key:"setInputParameters",value:function(e){if(e){for(var t=0,r=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];t<r.length;t++){var n=r[t],i=e[n];i&&(this[n]=i)}e.appServer&&(this.appServer=c(e.appServer))}}},{kind:"method",key:"connectedCallback",value:function(){Et(At(s.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){Et(At(s.prototype),"disconnectedCallback",this).call(this),this._resizeObserver.disconnect();for(var e=0,t=Object.keys(this.promises);e<t.length;e++){var r=t[e];this.promises[r].reject(new Error("Dashboard component was removed"))}}},{kind:"method",key:"firstUpdated",value:function(){var t;(Je._components.push(this),this.containerWidth=this.container.clientWidth,this.params=this._setOptions(),U(this),function(t){for(var r=!1,n="",i=(document.body||document.documentElement).style,o=({svg:!(!("createElementNS"in document)||!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:""===i.webkitFlexWrap||""===i.flexWrap,postMessage:!!window.postMessage}),s=0,a=["svg","flexbox","postMessage"];s<a.length;s++){var d=a[s];o[d]||(r=!0,t.browserNotSupported=t.browserNotSupported||[],t.browserNotSupported.push(d),n+="Your browser does not support: ".concat(d,"\n"))}var l=window.navigator.userAgent,c=l.includes("MSIE"),h=l.includes("Trident/");(c||h)&&(r=!0,n="IE is not supported."),r&&e(n)}(this),this._setupLoader(),this.params.error)||(this._loaderStyles(),"function"!=typeof window.__luzmoMessageHandler&&(window.__luzmoMessageHandler=function(e){var t,r=Je._components.find((function(t){return e.data.name===t._iframeId}));if(r)switch(null===(t=e.data)||void 0===t?void 0:t.type){case"load":r.dispatchEvent(new CustomEvent("load",{detail:{data:e.data}})),r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r.dimensions=e.data.dimensions,r._calculateDimAfterDashboardLoaded();break;case"error":r.dashboardError=!0,r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r._displayError();break;case"data":v(r,e.data.requestId,e.data.data);break;case"filters":v(r,e.data.requestId,e.data.filters);break;case"getAccessibleDashboards":v(r,e.data.requestId,e.data.accessibleDashboards);break;case"dashboardAction":r.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:e.data}}));break;case"export":e.data.error?y(r,e.data.requestId,e.data):(r.dispatchEvent(new CustomEvent("exported",{detail:{data:e.data}})),v(r,e.data.requestId,e.data));break;case"changedFilters":r.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:e.data}}));break;case"customEvent":r.dispatchEvent(new CustomEvent("customEvent",{detail:{data:e.data}}));break;case"chartsRendered":case"itemsRendered":e.data.type="itemsRendered",r.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:e.data}}));break;case"setEditMode":e.data.error?y(r,e.data.requestId,e.data):(v(r,e.data.requestId,e.data),r.params.editMode=e.data.editMode,r._containerStyle=g(r),r.dimensions&&T(r));break;case"setFilters":case"setPreview":e.data.error?y(r,e.data.requestId,e.data):v(r,e.data.requestId,e.data)}},window.addEventListener("message",window.__luzmoMessageHandler,!1)),this._iframeUrl=f(this),null===(t=this.iframe)||void 0===t||t.setAttribute("src",this._iframeUrl),this.iframeStyle=b(this));this.container&&this._resizeObserver.observe(this.container)}},{kind:"method",key:"updated",value:function(e){var t,r=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),n=dt(e.entries());try{for(n.s();!(t=n.n()).done;){var i=at(t.value,1)[0];r.has(i)&&"editMode"!==i?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout((function(){console.error("Failed to load dashboard, appServer is likely down or unreachable.")}),15e3),this.params=this._setOptions(),U(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=f(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=b(this)):r.has(i)&&"editMode"===i&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}}catch(o){n.e(o)}finally{n.f()}}},{kind:"method",key:"_setOptions",value:function(){var e={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(e.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(e.language=this.language),this.qeVersion&&(e.qeVersion=this.qeVersion),this.screenMode&&(e.screenMode=this.screenMode),e.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(e.token=this.authToken),this.authKey&&(e.key=this.authKey),this.editMode&&(e.editMode=this.editMode),this.mainColor&&(e.mainColor=this.mainColor),this.accentColor&&(e.accentColor=this.accentColor),this.loaderBackground&&(e.loaderBackground=this.loaderBackground),this.loaderFontColor&&(e.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(e.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(e.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(e.timezoneId=this.timezoneId),this.itemDimensions&&(e.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=c(this.appServer),e.appServer=this.appServer):(this.appServer=c(t.appServer),e.appServer=this.appServer),this.apiHost?(this.apiHost=c(this.apiHost),e.apiHost=this.apiHost):(this.apiHost=this.appServer.endsWith("luzmo.com/")?this.appServer.replace("app","api"):this.appServer,e.apiHost=this.apiHost),e}},{kind:"method",key:"_updateIframeUrl",value:function(){var e,t;e=this.iframe,t=this._iframeUrl,null!=e&&e.contentWindow&&e.contentWindow.location.replace(t)}},{kind:"method",key:"_setupLoader",value:function(){var e=function(e){var t;(e.params.error||e.browserNotSupported.length>0)&&(e.params.error=!0,e.browserNotSupported&&(t="Browser is not supported."));var r=n.initializing[e.params.language]||n.initializing.en;return e.browserNotSupported||e.params.error?{loadingMsg:r,errorMsg:t}:{loadingMsg:r,errorMsg:""}}(this);this._loaderMsg=e.loadingMsg,e.errorMsg&&(this.browserError=!0,this.browserErrorMsg=e.errorMsg,this._displayError())}},{kind:"method",key:"_displayError",value:function(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}},{kind:"method",key:"_calculateDimAfterDashboardLoaded",value:function(){this.dashboardError=!1,this._loaderStyles(),T(this)}},{kind:"method",key:"_loaderStyles",value:function(){var e,r,n,i,o,s;this._containerStyle=g(this),this._loaderStyle=function(e){var r=e.params.loaderBackground||t.loaderBackground;if(e.params.itemEmbedding){e.loaderSize=24,e.borderWidth=4,e.minHeight=200;var n=e.params.itemDimensions.width||t.itemDimensions.width,i=e.params.itemDimensions.height||t.itemDimensions.height,o="auto"!==i;return{background:r,width:"auto"!==n?"".concat(n,"px"):"100%",height:"".concat(o?i:"200","px"),"min-height":o?"":"200px"}}return{background:r}}(this),this._loadingCircleStyle=(r=t.loaderSpinnerColor,n=t.loaderSpinnerBackground,i=w((e=this).borderWidth,e.params.loaderSpinnerColor||r),o=w(e.borderWidth,e.params.loaderSpinnerBackground||n),s="".concat(e.loaderSize,"px"),{"border-top":i,"border-right":i,"border-bottom":o,"border-left":o,width:s,height:s}),this._containerLoaderStyle=function(e){var r=e.params.itemDimensions.height||t.itemDimensions.height,n=e.params.itemEmbedding&&"auto"!==r;return{display:e.iframeLoaded?"none":"",height:"".concat(n?r:e.minHeight,"px")}}(this),this._lcStyle=function(e){var r=e.params.itemDimensions.height||t.itemDimensions.height,n=e.params.itemEmbedding&&"auto"!==r,i=function(t){return"".concat((t-e.loaderSize-32)/2,"px")},o=e.params.itemId?i(n?Number.parseInt("".concat(r),10):e.minHeight):"128px";return{padding:"".concat(o," 16px")}}(this)}},{kind:"get",static:!0,key:"styles",value:function(){return[it]}},{kind:"method",key:"render",value:function(){return Ee(Xe||(Xe=st(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),Be(this._containerStyle),this.dashboardId||this.dashboardSlug?Ee(et||(et=st(['\n <div\n class="luzmo-container-loader"\n id="luzmo-container-loader-','"\n style=','\n >\n <div\n class="luzmo-loader"\n id="luzmo-loader-','"\n style=','\n >\n <div\n class="luzmo-lc"\n style=','\n >\n <div\n class="luzmo-loading-circle"\n style=',"\n ></div>\n ",'\n </div>\n </div>\n </div>\n\n <iframe\n class="luzmo-embed-dashboard"\n id="','"\n name="','"\n style=','\n frameborder="0"\n ></iframe>\n '])),this._containerId,Be(this._containerLoaderStyle),this._containerId,Be(this._loaderStyle),Be(this._lcStyle),Be(this._loadingCircleStyle),this._itemEmbedding?"":Ee(tt||(tt=st([' <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>"])),Be({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,Be(this.iframeStyle)):Ee(rt||(rt=st(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?Ee(nt||(nt=st([' <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>"])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e,t){return e(Je._components)}))}},{kind:"method",key:"getData",value:function(e){return function(e,t,r){if(null!=t&&t.contentWindow){var n=m();return t.contentWindow.postMessage({action:"getData",id:r,_version:e.VERSION,requestId:n},"*"),new Promise((function(t,r){e.promises[n]={resolve:t,reject:r},setTimeout((function(){e.promises[n]&&(e.promises[n].reject(new Error("getData request timed out.")),delete e.promises[n])}),2e3)}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))}(this,this.iframe,e)}},{kind:"method",key:"getFilters",value:function(){return function(e,t){if(null!=t&&t.contentWindow){var r=m();return t.contentWindow.postMessage({action:"getFilters",_version:e.VERSION,requestId:r},"*"),new Promise((function(t,n){e.promises[r]={resolve:t,reject:n},setTimeout((function(){e.promises[r]&&(e.promises[r].reject(new Error("getFilters request timed out.")),delete e.promises[r])}),2e3)}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))}(this,this.iframe)}},{kind:"method",key:"setFilters",value:function(e,t){return function(e,t,r,n){if(t){var i=m();return t.contentWindow.postMessage({action:"setFilters",itemId:r,filters:n,_version:e.VERSION,requestId:i},"*"),new Promise((function(t,r){e.promises[i]={resolve:t,reject:r},setTimeout((function(){e.promises[i]&&(e.promises[i].reject(new Error("setFilters request timed out.")),delete e.promises[i])}),2e3)}))}return Promise.reject()}(this,this.iframe,e,t)}},{kind:"method",key:"setAuthorization",value:function(e,t){return function(e,t,r,n){return t?(t.contentWindow.postMessage({action:"setAuthorization",key:r,token:n,_version:e.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."))}(this,this.iframe,e,t)}},{kind:"method",key:"refreshData",value:function(e){return e?E(this,this.iframe,e):E(this,this.iframe)}},{kind:"method",key:"reloadDashboard",value:function(){return e=this,(t=this.iframe)?(t.contentWindow.postMessage({action:"reloadDashboard",_version:e.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."));var e,t}},{kind:"method",key:"exportDashboard",value:function(e){return e?_(this,this.iframe,e):_(this,this.iframe)}},{kind:"method",key:"getAccessibleDashboards",value:function(){return S(this,this.iframe)}},{kind:"method",key:"setEditMode",value:function(e){return function(e,t,r){if(t&&t.contentWindow){var n=m();return e.params.editMode===r?Promise.reject(new Error("editMode parameter is currently already set to "+r)):"editFull"!==r&&"editLimited"!==r&&"view"!==r?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(t.contentWindow.postMessage({action:"setEditMode",editMode:r,_version:e.VERSION,requestId:n},"*"),new Promise((function(t,r){e.promises[n]={resolve:t,reject:r}})))}return Promise.reject(new Error("Cannot retrieve contentWindow."))}(this,this.iframe,e)}},{kind:"method",key:"setPreview",value:function(e){return function(e,t,r){if(t){var n=m();return t.contentWindow.postMessage({action:"setPreview",preview:r,requestId:n,_version:e.VERSION},"*"),new Promise((function(t,r){e.promises[n]={resolve:t,reject:r},setTimeout((function(){e.promises[n]&&(e.promises[n].reject(new Error("setPreview request timed out.")),delete e.promises[n])}),2e3)}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))}(this,this.iframe,e)}}]}}),lit_element_s)})();
2
+ //# sourceMappingURL=luzmo-embed.min.js.map