@luzmo/embed 5.0.1 → 5.0.2
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/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/luzmo-embed.min.js +1 -1
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -1 +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 p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(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=p(e);if(t){var a=p(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=p(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,p=!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){p=!0,a=e}finally{try{if(!d&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(p)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)}"function"==typeof SuppressedError&&SuppressedError;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&&l(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.1-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)&&0!==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(p(a.prototype),"connectedCallback",this).call(this)}},{key:"disconnectedCallback",value:function(){h(p(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(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),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(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{key:"getDashboards",value:function(){return new Promise((function(e){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:String}}),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);
|
|
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 p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(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=p(e);if(t){var a=p(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=p(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,p=!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){p=!0,a=e}finally{try{if(!d&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(p)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)}"function"==typeof SuppressedError&&SuppressedError;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&&l(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.2-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)&&0!==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(p(a.prototype),"connectedCallback",this).call(this)}},{key:"disconnectedCallback",value:function(){h(p(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(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),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(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{key:"getDashboards",value:function(){return new Promise((function(e){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:String}}),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.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"@luzmo/shared-embed";import{css as t,LitElement as r,html as i}from"lit";import{customElement as n,query as o,property 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,E(i.key),i)}}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 f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(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 function(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 h(e)}(this,r)}}function p(){return p="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}},p.apply(this,arguments)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function y(e,t){return b(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)||g(e,t)||S()}function k(e){return b(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||S()}function b(e){if(Array.isArray(e))return e}function g(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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(){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 _(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=g(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(e){var t=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)}(e,"string");return"symbol"==typeof t?t:String(t)}function z(){z=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(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!D(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),d=this.toElementFinisherExtras((0,n[o])(s)||s);e=d.element,this.addElementPlacement(e,t),d.finisher&&i.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:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].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){if(void 0!==e)return k(e).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=E(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)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 "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:P(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=P(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}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 I(e){var t,r=E(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 i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function C(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function D(e){return e.decorators&&e.decorators.length}function O(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function P(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}var x,T,M,A,j,R,H=new(c((function e(){var t,r,i;d(this,e),t=this,i=[],(r=E(r="_components"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}))),F=t(x||(x=v(["\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"]))),L=function(e,t,r,i){var n=z();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(O(o.descriptor)||O(n.descriptor)){if(D(o)||D(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(D(o)){if(D(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}C(o,n)}else t.push(o)}return t}(a.d.map(I)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}([n("luzmo-dashboard")],(function(t,r){var n=function(r){!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&&f(e,t)}(n,r);var i=m(n);function n(r){var o;return d(this,n),o=i.call(this),t(h(o)),o._containerId=e.uuidv4(),o._iframeId="luzmo-dashboard-".concat(o._containerId),o.iframeLoaded=!1,o.promises={},o.setInputParameters(r),o.params=o._setOptions(),o._onResize=function(){var t;if(null!==(t=o.shadowRoot)&&void 0!==t&&t.querySelector(".dashboard-container")){if(o.containerWidth=o.container.clientWidth,o.params.switchScreenModeOnResize&&"auto"===o.params.screenMode){var r,i=_(e.EXTENTS);try{for(i.s();!(r=i.n()).done;){var n=r.value;n.width[0]<=window.innerWidth&&window.innerWidth<=n.width[1]&&(o.currentScreenMode=n.mode)}}catch(e){i.e(e)}finally{i.f()}}o.iframeLoaded&&o._calculateDimAfterDashboardLoaded()}},o._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&0!==e.length&&o._onResize()}))})),o}return c(n)}(r);return{F:n,d:[{kind:"field",decorators:[o(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[o("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[a()],key:"dashboardId",value:void 0},{kind:"field",decorators:[a()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[a()],key:"itemId",value:void 0},{kind:"field",decorators:[a()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[a()],key:"qeVersion",value:void 0},{kind:"field",decorators:[a()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[a({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[a()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[a()],key:"mainColor",value:void 0},{kind:"field",decorators:[a()],key:"accentColor",value:void 0},{kind:"field",decorators:[a()],key:"authToken",value:void 0},{kind:"field",decorators:[a()],key:"authKey",value:void 0},{kind:"field",decorators:[a()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[a()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[a()],key:"appServer",value:void 0},{kind:"field",decorators:[a()],key:"timezoneId",value:void 0},{kind:"field",decorators:[a()],key:"apiHost",value:void 0},{kind:"field",decorators:[a({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[a({attribute:!1})],key:"VERSION",value:function(){return"5.0.1-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(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))}}},{kind:"method",key:"connectedCallback",value:function(){p(u(n.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){p(u(n.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;(H._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=H._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)}},{kind:"method",key:"updated",value:function(t){var r,i=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),n=_(t.entries());try{for(n.s();!(r=n.n()).done;){var o=y(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()}}},{kind:"method",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}},{kind:"method",key:"_updateIframeUrl",value:function(){e.updateIframeUrl(this.iframe,this._iframeUrl)}},{kind:"method",key:"_setupLoader",value:function(){var t=e.getLoader(this);this._loaderMsg=t.loadingMsg,t.errorMsg&&(this.browserError=!0,this.browserErrorMsg=t.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(),e._setCalculatedDimensions(this)}},{kind:"method",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)}},{kind:"get",static:!0,key:"styles",value:function(){return[F]}},{kind:"method",key:"render",value:function(){return i(T||(T=v(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),s(this._containerStyle),this.dashboardId||this.dashboardSlug?i(M||(M=v(['\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?"":i(A||(A=v(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),s({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,s(this.iframeStyle)):i(j||(j=v(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?i(R||(R=v(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e){return e(H._components)}))}},{kind:"method",key:"getData",value:function(t){return e.getData(this,this.iframe,t)}},{kind:"method",key:"getFilters",value:function(){return e.getFilters(this,this.iframe)}},{kind:"method",key:"setFilters",value:function(t,r){return e.setFilters(this,this.iframe,t,r)}},{kind:"method",key:"setAuthorization",value:function(t,r){return e.setAuthorization(this,this.iframe,t,r)}},{kind:"method",key:"refreshData",value:function(t){return t?e.refreshData(this,this.iframe,t):e.refreshData(this,this.iframe)}},{kind:"method",key:"reloadDashboard",value:function(){return e.reloadDashboard(this,this.iframe)}},{kind:"method",key:"exportDashboard",value:function(t){return t?e.exportDashboard(this,this.iframe,t):e.exportDashboard(this,this.iframe)}},{kind:"method",key:"getAccessibleDashboards",value:function(){return e.getAccessibleDashboards(this,this.iframe)}},{kind:"method",key:"setEditMode",value:function(t){return e.setEditMode(this,this.iframe,t)}},{kind:"method",key:"setPreview",value:function(t){return e.setPreview(this,this.iframe,t)}}]}}),r);export{L as LuzmoDashboard};
|
|
1
|
+
import*as e from"@luzmo/shared-embed";import{css as t,LitElement as r,html as i}from"lit";import{customElement as n,query as o,property 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,E(i.key),i)}}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 f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(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 function(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 h(e)}(this,r)}}function p(){return p="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}},p.apply(this,arguments)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function y(e,t){return b(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)||g(e,t)||S()}function k(e){return b(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||S()}function b(e){if(Array.isArray(e))return e}function g(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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(){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 _(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=g(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(e){var t=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)}(e,"string");return"symbol"==typeof t?t:String(t)}function z(){z=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(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!D(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),d=this.toElementFinisherExtras((0,n[o])(s)||s);e=d.element,this.addElementPlacement(e,t),d.finisher&&i.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:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].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){if(void 0!==e)return k(e).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=E(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)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 "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:P(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=P(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}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 I(e){var t,r=E(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 i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function C(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function D(e){return e.decorators&&e.decorators.length}function O(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function P(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}var x,T,M,A,j,R,H=new(c((function e(){var t,r,i;d(this,e),t=this,i=[],(r=E(r="_components"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}))),F=t(x||(x=v(["\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"]))),L=function(e,t,r,i){var n=z();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(O(o.descriptor)||O(n.descriptor)){if(D(o)||D(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(D(o)){if(D(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}C(o,n)}else t.push(o)}return t}(a.d.map(I)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}([n("luzmo-dashboard")],(function(t,r){var n=function(r){!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&&f(e,t)}(n,r);var i=m(n);function n(r){var o;return d(this,n),o=i.call(this),t(h(o)),o._containerId=e.uuidv4(),o._iframeId="luzmo-dashboard-".concat(o._containerId),o.iframeLoaded=!1,o.promises={},o.setInputParameters(r),o.params=o._setOptions(),o._onResize=function(){var t;if(null!==(t=o.shadowRoot)&&void 0!==t&&t.querySelector(".dashboard-container")){if(o.containerWidth=o.container.clientWidth,o.params.switchScreenModeOnResize&&"auto"===o.params.screenMode){var r,i=_(e.EXTENTS);try{for(i.s();!(r=i.n()).done;){var n=r.value;n.width[0]<=window.innerWidth&&window.innerWidth<=n.width[1]&&(o.currentScreenMode=n.mode)}}catch(e){i.e(e)}finally{i.f()}}o.iframeLoaded&&o._calculateDimAfterDashboardLoaded()}},o._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&0!==e.length&&o._onResize()}))})),o}return c(n)}(r);return{F:n,d:[{kind:"field",decorators:[o(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[o("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[a()],key:"dashboardId",value:void 0},{kind:"field",decorators:[a()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[a()],key:"itemId",value:void 0},{kind:"field",decorators:[a()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[a()],key:"qeVersion",value:void 0},{kind:"field",decorators:[a()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[a({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[a()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[a()],key:"mainColor",value:void 0},{kind:"field",decorators:[a()],key:"accentColor",value:void 0},{kind:"field",decorators:[a()],key:"authToken",value:void 0},{kind:"field",decorators:[a()],key:"authKey",value:void 0},{kind:"field",decorators:[a()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[a()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[a()],key:"appServer",value:void 0},{kind:"field",decorators:[a()],key:"timezoneId",value:void 0},{kind:"field",decorators:[a()],key:"apiHost",value:void 0},{kind:"field",decorators:[a({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[a({attribute:!1})],key:"VERSION",value:function(){return"5.0.2-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(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))}}},{kind:"method",key:"connectedCallback",value:function(){p(u(n.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){p(u(n.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;(H._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=H._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)}},{kind:"method",key:"updated",value:function(t){var r,i=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),n=_(t.entries());try{for(n.s();!(r=n.n()).done;){var o=y(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()}}},{kind:"method",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}},{kind:"method",key:"_updateIframeUrl",value:function(){e.updateIframeUrl(this.iframe,this._iframeUrl)}},{kind:"method",key:"_setupLoader",value:function(){var t=e.getLoader(this);this._loaderMsg=t.loadingMsg,t.errorMsg&&(this.browserError=!0,this.browserErrorMsg=t.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(),e._setCalculatedDimensions(this)}},{kind:"method",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)}},{kind:"get",static:!0,key:"styles",value:function(){return[F]}},{kind:"method",key:"render",value:function(){return i(T||(T=v(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),s(this._containerStyle),this.dashboardId||this.dashboardSlug?i(M||(M=v(['\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?"":i(A||(A=v(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),s({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,s(this.iframeStyle)):i(j||(j=v(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?i(R||(R=v(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e){return e(H._components)}))}},{kind:"method",key:"getData",value:function(t){return e.getData(this,this.iframe,t)}},{kind:"method",key:"getFilters",value:function(){return e.getFilters(this,this.iframe)}},{kind:"method",key:"setFilters",value:function(t,r){return e.setFilters(this,this.iframe,t,r)}},{kind:"method",key:"setAuthorization",value:function(t,r){return e.setAuthorization(this,this.iframe,t,r)}},{kind:"method",key:"refreshData",value:function(t){return t?e.refreshData(this,this.iframe,t):e.refreshData(this,this.iframe)}},{kind:"method",key:"reloadDashboard",value:function(){return e.reloadDashboard(this,this.iframe)}},{kind:"method",key:"exportDashboard",value:function(t){return t?e.exportDashboard(this,this.iframe,t):e.exportDashboard(this,this.iframe)}},{kind:"method",key:"getAccessibleDashboards",value:function(){return e.getAccessibleDashboards(this,this.iframe)}},{kind:"method",key:"setEditMode",value:function(t){return e.setEditMode(this,this.iframe,t)}},{kind:"method",key:"setPreview",value:function(t){return e.setPreview(this,this.iframe,t)}}]}}),r);export{L as LuzmoDashboard};
|
package/luzmo-embed.min.js
CHANGED
|
@@ -1,2 +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(e){l=!0,i=e}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".replaceAll(/[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.replaceAll(/[^\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:null!=r?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(e){l=!0,i=e}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||P(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 I(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=P(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 P(e,t){if(e){if("string"==typeof e)return j(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)?j(e,t):void 0}}function j(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 D=function(t){if(!t.dimensions)return t.params.error=!0,void 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=I(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(Y){m.e(Y)}finally{m.f()}}var v,y=I(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(Y){y.e(Y)}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=I(o);try{for(w.s();!(b=w.n()).done;){var _,S,E,A,$=b.value,O=C($.width,2),P=O[0],j=O[1];if(t.params.itemEmbedding&&t.params.itemDimensions&&"auto"!==t.params.itemDimensions.width&&"auto"===t.params.itemDimensions.height)P<t.params.itemDimensions.width&&(n=$.mode,s=Number.parseInt(t.params.itemDimensions.width,10),a=t.dimensions[n][1]);else if(P<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,j),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(j,t.containerWidth),P),a=$.height}}catch(Y){w.e(Y)}finally{w.f()}}else{var D,T,U,W,B=o.find((function(e){return e.mode===t.params.screenMode})),q=B.height,F=C(B.width,2),V=F[0],K=F[1];if(n=t.params.screenMode,s=Math.max(Math.min(K,t.containerWidth),V),a=q,t.params.itemEmbedding)null!==(D=t.params.itemDimensions)&&void 0!==D&&D.width&&"auto"!==(null===(T=t.params.itemDimensions)||void 0===T?void 0:T.width)&&(s=Number.parseInt(t.params.itemDimensions.width,10)),null!==(U=t.params.itemDimensions)&&void 0!==U&&U.height&&"auto"!==(null===(W=t.params.itemDimensions)||void 0===W?void 0:W.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 T(e){return T="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},T(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"!==T(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(T(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>0)&&e(n.join("\n"),r.params)};const W=window,B=W.ShadowRoot&&(void 0===W.ShadyCSS||W.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,q=Symbol(),F=new WeakMap;class css_tag_o{constructor(e,t,r){if(this._$cssResult$=!0,r!==q)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(B&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=F.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&F.set(t,e))}return e}toString(){return this.cssText}}const V=B?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,q))(t)})(e):e;var K;const G=window,J=G.trustedTypes,Y=J?J.emptyScript:"",Q=G.reactiveElementPolyfillSupport,X={toAttribute(e,t){switch(t){case Boolean:e=e?Y: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}},ee=(e,t)=>t!==e&&(t==t||e==e),te={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:ee},re="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}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=te){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)||te}static finalize(){if(this.hasOwnProperty(re))return!1;this[re]=!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(V(e))}else void 0!==e&&t.push(V(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}_$Eu(){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)=>{B?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),n=W.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=te){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:X).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:X;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||ee)(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 ne;u[re]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==Q||Q({ReactiveElement:u}),(null!==(K=G.reactiveElementVersions)&&void 0!==K?K:G.reactiveElementVersions=[]).push("1.6.3");const ie=window,oe=ie.trustedTypes,se=oe?oe.createPolicy("lit-html",{createHTML:e=>e}):void 0,ae="$lit$",de=`lit$${(Math.random()+"").slice(9)}$`,le="?"+de,ce=`<${le}>`,ue=document,he=()=>ue.createComment(""),pe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,me=Array.isArray,fe=e=>me(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),ve="[ \t\n\f\r]",ye=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ge=/-->/g,be=/>/g,we=RegExp(`>|${ve}(?:([^\\s"'>=/]+)(${ve}*=${ve}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ke=/'/g,_e=/"/g,Se=/^(?:script|style|textarea|title)$/i,Ee=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),Ae=Ee(1),$e=(Ee(2),Symbol.for("lit-noChange")),xe=Symbol.for("lit-nothing"),Oe=new WeakMap,Me=ue.createTreeWalker(ue,129,null,!1);function Ce(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==se?se.createHTML(t):t}const Ie=(e,t)=>{const r=e.length-1,n=[];let i,o=2===t?"<svg>":"",s=ye;for(let a=0;a<r;a++){const t=e[a];let r,d,l=-1,c=0;for(;c<t.length&&(s.lastIndex=c,d=s.exec(t),null!==d);)c=s.lastIndex,s===ye?"!--"===d[1]?s=ge:void 0!==d[1]?s=be:void 0!==d[2]?(Se.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=we):void 0!==d[3]&&(s=we):s===we?">"===d[0]?(s=null!=i?i:ye,l=-1):void 0===d[1]?l=-2:(l=s.lastIndex-d[2].length,r=d[1],s=void 0===d[3]?we:'"'===d[3]?_e:ke):s===_e||s===ke?s=we:s===ge||s===be?s=ye:(s=we,i=void 0);const h=s===we&&e[a+1].startsWith("/>")?" ":"";o+=s===ye?t+ce:l>=0?(n.push(r),t.slice(0,l)+ae+t.slice(l)+de+h):t+de+(-2===l?(n.push(void 0),a):h)}return[Ce(e,o+(e[r]||"<?>")+(2===t?"</svg>":"")),n]};class N{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]=Ie(e,t);if(this.el=N.createElement(d,r),Me.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=Me.nextNode())&&a.length<s;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith(ae)||t.startsWith(de)){const r=l[o++];if(e.push(t),void 0!==r){const e=n.getAttribute(r.toLowerCase()+ae).split(de),t=/([.?@])?(.*)/.exec(r);a.push({type:1,index:i,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else a.push({type:6,index:i})}for(const t of e)n.removeAttribute(t)}if(Se.test(n.tagName)){const e=n.textContent.split(de),t=e.length-1;if(t>0){n.textContent=oe?oe.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],he()),Me.nextNode(),a.push({type:2,index:++i});n.append(e[t],he())}}}else if(8===n.nodeType)if(n.data===le)a.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(de,e+1));)a.push({type:7,index:i}),e+=de.length-1}i++}}static createElement(e,t){const r=ue.createElement("template");return r.innerHTML=e,r}}function Pe(e,t,r=e,n){var i,o,s,a;if(t===$e)return t;let d=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const l=pe(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=Pe(e,d._$AS(e,t.values),d,n)),t}class M{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:ue).importNode(r,!0);Me.currentNode=i;let o=Me.nextNode(),s=0,a=0,d=n[0];for(;void 0!==d;){if(s===d.index){let t;2===d.type?t=new R(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=Me.nextNode(),s++)}return Me.currentNode=ue,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 R{constructor(e,t,r,n){var i;this.type=2,this._$AH=xe,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=Pe(this,e,t),pe(e)?e===xe||null==e||""===e?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==$e&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):fe(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!==xe&&pe(this._$AH)?this._$AA.nextSibling.data=e:this.$(ue.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=N.createElement(Ce(n.h,n.h[0]),this.options)),n);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===i)this._$AH.v(r);else{const e=new M(i,this),t=e.u(this.options);e.v(r),this.$(t),this._$AH=e}}_$AC(e){let t=Oe.get(e.strings);return void 0===t&&Oe.set(e.strings,t=new N(e)),t}T(e){me(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 R(this.k(he()),this.k(he()),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 k{constructor(e,t,r,n,i){this.type=1,this._$AH=xe,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=xe}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=Pe(this,e,t,0),o=!pe(e)||e!==this._$AH&&e!==$e,o&&(this._$AH=e);else{const n=e;let s,a;for(e=i[0],s=0;s<i.length-1;s++)a=Pe(this,n[r+s],t,s),a===$e&&(a=this._$AH[s]),o||(o=!pe(a)||a!==this._$AH[s]),a===xe?e=xe:e!==xe&&(e+=(null!=a?a:"")+i[s+1]),this._$AH[s]=a}o&&!n&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}}const je=oe?oe.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==xe?this.element.setAttribute(this.name,je):this.element.removeAttribute(this.name)}}class z extends k{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=Pe(this,e,t,0))&&void 0!==r?r:xe)===$e)return;const n=this._$AH,i=e===xe&&n!==xe||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==xe&&(n===xe||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){Pe(this,e)}}const De=ie.litHtmlPolyfillSupport;null==De||De(N,R),(null!==(ne=ie.litHtmlVersions)&&void 0!==ne?ne:ie.litHtmlVersions=[]).push("2.8.0");var ze,Re;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 R(t.insertBefore(he(),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 $e}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(ze=globalThis.litElementHydrateSupport)||void 0===ze||ze.call(globalThis,{LitElement:lit_element_s});const Te=globalThis.litElementPolyfillSupport;null==Te||Te({LitElement:lit_element_s});(null!==(Re=globalThis.litElementVersions)&&void 0!==Re?Re:globalThis.litElementVersions=[]).push("3.3.3");const He=(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 Ne(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):He(e,t)}function Ue(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 We;null===(We=window.HTMLSlotElement)||void 0===We||We.prototype.assignedElements;const Le=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 Be="important",qe=" !"+Be,Fe=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends directive_i{constructor(e){var t;if(super(e),e.type!==Le||"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.ht){this.ht=new Set;for(const e in t)this.ht.add(e);return this.render(t)}this.ht.forEach((e=>{null==t[e]&&(this.ht.delete(e),e.includes("-")?r.removeProperty(e):r[e]="")}));for(const n in t){const e=t[n];if(null!=e){this.ht.add(n);const t="string"==typeof e&&e.endsWith(qe);n.includes("-")||t?r.setProperty(n,t?e.slice(0,-11):e,t?Be:""):r[n]=e}}return $e}}),Ve="5.0.1";function Ke(e){return Ke="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},Ke(e)}function Ge(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,Ze(n.key),n)}}function Je(e,t,r){return t&&Ge(e.prototype,t),r&&Ge(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ze(e){var t=function(e,t){if("object"!==Ke(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ke(t)?t:String(t)}const Ye=new(Je((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=Ze(r="_components"))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n})));var Qe;var Xe,et,tt,rt,nt,it,ot,st=((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,q)})(Qe||(Xe=["\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"],et||(et=Xe.slice(0)),Qe=Object.freeze(Object.defineProperties(Xe,{raw:{value:Object.freeze(et)}}))));function at(e){return at="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},at(e)}function dt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function lt(e,t){return At(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(e){l=!0,i=e}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||St(e,t)||_t()}function ct(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=St(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 ut(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,kt(n.key),n)}}function ht(e,t){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ht(e,t)}function pt(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=xt(e);if(t){var i=xt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===at(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return mt(e)}(this,r)}}function mt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ft(){ft=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(!gt(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,At(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||St(t)||_t()).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=kt(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:wt(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=wt(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 vt(e){var t,r=kt(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 yt(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function gt(e){return e.decorators&&e.decorators.length}function bt(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function wt(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 kt(e){var t=function(e,t){if("object"!==at(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===at(t)?t:String(t)}function _t(){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 St(e,t){if(e){if("string"==typeof e)return Et(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)?Et(e,t):void 0}}function Et(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 At(e){if(Array.isArray(e))return e}function $t(){return $t="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=xt(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}},$t.apply(this,arguments)}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xt(e)}!function(e,t,r,n){var i=ft();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(bt(o.descriptor)||bt(i.descriptor)){if(gt(o)||gt(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(gt(o)){if(gt(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}yt(o,i)}else t.push(o)}return t}(s.d.map(vt)),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&&ht(e,t)}(a,e);var t,n,o,s=pt(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(mt(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=ct(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)&&0!==e.length&&t._onResize()}))})),t}return t=a,n&&ut(t.prototype,n),o&&ut(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}(o);return{F:s,d:[{kind:"field",decorators:[Ue(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[Ue("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[Ne()],key:"dashboardId",value:void 0},{kind:"field",decorators:[Ne()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[Ne()],key:"itemId",value:void 0},{kind:"field",decorators:[Ne()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[Ne()],key:"qeVersion",value:void 0},{kind:"field",decorators:[Ne()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[Ne({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[Ne()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[Ne()],key:"mainColor",value:void 0},{kind:"field",decorators:[Ne()],key:"accentColor",value:void 0},{kind:"field",decorators:[Ne()],key:"authToken",value:void 0},{kind:"field",decorators:[Ne()],key:"authKey",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[Ne()],key:"appServer",value:void 0},{kind:"field",decorators:[Ne()],key:"timezoneId",value:void 0},{kind:"field",decorators:[Ne()],key:"apiHost",value:void 0},{kind:"field",decorators:[Ne({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[Ne({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[Ne({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[Ne({attribute:!1})],key:"VERSION",value:function(){return Ve+"-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(){$t(xt(s.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){$t(xt(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;(Ye._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=Ye._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&&D(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=ct(e.entries());try{for(n.s();!(t=n.n()).done;){var i=lt(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(),D(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[st]}},{kind:"method",key:"render",value:function(){return Ae(tt||(tt=dt(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),Fe(this._containerStyle),this.dashboardId||this.dashboardSlug?Ae(rt||(rt=dt(['\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,Fe(this._containerLoaderStyle),this._containerId,Fe(this._loaderStyle),Fe(this._lcStyle),Fe(this._loadingCircleStyle),this._itemEmbedding?"":Ae(nt||(nt=dt(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),Fe({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,Fe(this.iframeStyle)):Ae(it||(it=dt(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?Ae(ot||(ot=dt(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e){return e(Ye._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)})();
|
|
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(e){l=!0,i=e}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".replaceAll(/[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.replaceAll(/[^\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:null!=r?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(e){l=!0,i=e}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||P(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 I(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=P(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 P(e,t){if(e){if("string"==typeof e)return j(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)?j(e,t):void 0}}function j(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 D=function(t){if(!t.dimensions)return t.params.error=!0,void 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=I(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(Y){m.e(Y)}finally{m.f()}}var v,y=I(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(Y){y.e(Y)}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=I(o);try{for(w.s();!(b=w.n()).done;){var _,S,E,A,$=b.value,O=C($.width,2),P=O[0],j=O[1];if(t.params.itemEmbedding&&t.params.itemDimensions&&"auto"!==t.params.itemDimensions.width&&"auto"===t.params.itemDimensions.height)P<t.params.itemDimensions.width&&(n=$.mode,s=Number.parseInt(t.params.itemDimensions.width,10),a=t.dimensions[n][1]);else if(P<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,j),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(j,t.containerWidth),P),a=$.height}}catch(Y){w.e(Y)}finally{w.f()}}else{var D,T,U,W,B=o.find((function(e){return e.mode===t.params.screenMode})),q=B.height,F=C(B.width,2),V=F[0],K=F[1];if(n=t.params.screenMode,s=Math.max(Math.min(K,t.containerWidth),V),a=q,t.params.itemEmbedding)null!==(D=t.params.itemDimensions)&&void 0!==D&&D.width&&"auto"!==(null===(T=t.params.itemDimensions)||void 0===T?void 0:T.width)&&(s=Number.parseInt(t.params.itemDimensions.width,10)),null!==(U=t.params.itemDimensions)&&void 0!==U&&U.height&&"auto"!==(null===(W=t.params.itemDimensions)||void 0===W?void 0:W.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 T(e){return T="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},T(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"!==T(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(T(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>0)&&e(n.join("\n"),r.params)};const W=window,B=W.ShadowRoot&&(void 0===W.ShadyCSS||W.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,q=Symbol(),F=new WeakMap;class css_tag_o{constructor(e,t,r){if(this._$cssResult$=!0,r!==q)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(B&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=F.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&F.set(t,e))}return e}toString(){return this.cssText}}const V=B?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,q))(t)})(e):e;var K;const G=window,J=G.trustedTypes,Y=J?J.emptyScript:"",Q=G.reactiveElementPolyfillSupport,X={toAttribute(e,t){switch(t){case Boolean:e=e?Y: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}},ee=(e,t)=>t!==e&&(t==t||e==e),te={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:ee},re="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}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=te){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)||te}static finalize(){if(this.hasOwnProperty(re))return!1;this[re]=!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(V(e))}else void 0!==e&&t.push(V(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}_$Eu(){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)=>{B?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),n=W.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=te){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:X).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:X;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||ee)(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 ne;u[re]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==Q||Q({ReactiveElement:u}),(null!==(K=G.reactiveElementVersions)&&void 0!==K?K:G.reactiveElementVersions=[]).push("1.6.3");const ie=window,oe=ie.trustedTypes,se=oe?oe.createPolicy("lit-html",{createHTML:e=>e}):void 0,ae="$lit$",de=`lit$${(Math.random()+"").slice(9)}$`,le="?"+de,ce=`<${le}>`,ue=document,he=()=>ue.createComment(""),pe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,me=Array.isArray,fe=e=>me(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),ve="[ \t\n\f\r]",ye=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ge=/-->/g,be=/>/g,we=RegExp(`>|${ve}(?:([^\\s"'>=/]+)(${ve}*=${ve}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ke=/'/g,_e=/"/g,Se=/^(?:script|style|textarea|title)$/i,Ee=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),Ae=Ee(1),$e=(Ee(2),Symbol.for("lit-noChange")),xe=Symbol.for("lit-nothing"),Oe=new WeakMap,Me=ue.createTreeWalker(ue,129,null,!1);function Ce(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==se?se.createHTML(t):t}const Ie=(e,t)=>{const r=e.length-1,n=[];let i,o=2===t?"<svg>":"",s=ye;for(let a=0;a<r;a++){const t=e[a];let r,d,l=-1,c=0;for(;c<t.length&&(s.lastIndex=c,d=s.exec(t),null!==d);)c=s.lastIndex,s===ye?"!--"===d[1]?s=ge:void 0!==d[1]?s=be:void 0!==d[2]?(Se.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=we):void 0!==d[3]&&(s=we):s===we?">"===d[0]?(s=null!=i?i:ye,l=-1):void 0===d[1]?l=-2:(l=s.lastIndex-d[2].length,r=d[1],s=void 0===d[3]?we:'"'===d[3]?_e:ke):s===_e||s===ke?s=we:s===ge||s===be?s=ye:(s=we,i=void 0);const h=s===we&&e[a+1].startsWith("/>")?" ":"";o+=s===ye?t+ce:l>=0?(n.push(r),t.slice(0,l)+ae+t.slice(l)+de+h):t+de+(-2===l?(n.push(void 0),a):h)}return[Ce(e,o+(e[r]||"<?>")+(2===t?"</svg>":"")),n]};class N{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]=Ie(e,t);if(this.el=N.createElement(d,r),Me.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=Me.nextNode())&&a.length<s;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith(ae)||t.startsWith(de)){const r=l[o++];if(e.push(t),void 0!==r){const e=n.getAttribute(r.toLowerCase()+ae).split(de),t=/([.?@])?(.*)/.exec(r);a.push({type:1,index:i,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else a.push({type:6,index:i})}for(const t of e)n.removeAttribute(t)}if(Se.test(n.tagName)){const e=n.textContent.split(de),t=e.length-1;if(t>0){n.textContent=oe?oe.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],he()),Me.nextNode(),a.push({type:2,index:++i});n.append(e[t],he())}}}else if(8===n.nodeType)if(n.data===le)a.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(de,e+1));)a.push({type:7,index:i}),e+=de.length-1}i++}}static createElement(e,t){const r=ue.createElement("template");return r.innerHTML=e,r}}function Pe(e,t,r=e,n){var i,o,s,a;if(t===$e)return t;let d=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const l=pe(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=Pe(e,d._$AS(e,t.values),d,n)),t}class M{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:ue).importNode(r,!0);Me.currentNode=i;let o=Me.nextNode(),s=0,a=0,d=n[0];for(;void 0!==d;){if(s===d.index){let t;2===d.type?t=new R(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=Me.nextNode(),s++)}return Me.currentNode=ue,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 R{constructor(e,t,r,n){var i;this.type=2,this._$AH=xe,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=Pe(this,e,t),pe(e)?e===xe||null==e||""===e?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==$e&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):fe(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!==xe&&pe(this._$AH)?this._$AA.nextSibling.data=e:this.$(ue.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=N.createElement(Ce(n.h,n.h[0]),this.options)),n);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===i)this._$AH.v(r);else{const e=new M(i,this),t=e.u(this.options);e.v(r),this.$(t),this._$AH=e}}_$AC(e){let t=Oe.get(e.strings);return void 0===t&&Oe.set(e.strings,t=new N(e)),t}T(e){me(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 R(this.k(he()),this.k(he()),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 k{constructor(e,t,r,n,i){this.type=1,this._$AH=xe,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=xe}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=Pe(this,e,t,0),o=!pe(e)||e!==this._$AH&&e!==$e,o&&(this._$AH=e);else{const n=e;let s,a;for(e=i[0],s=0;s<i.length-1;s++)a=Pe(this,n[r+s],t,s),a===$e&&(a=this._$AH[s]),o||(o=!pe(a)||a!==this._$AH[s]),a===xe?e=xe:e!==xe&&(e+=(null!=a?a:"")+i[s+1]),this._$AH[s]=a}o&&!n&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}}const je=oe?oe.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==xe?this.element.setAttribute(this.name,je):this.element.removeAttribute(this.name)}}class z extends k{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=Pe(this,e,t,0))&&void 0!==r?r:xe)===$e)return;const n=this._$AH,i=e===xe&&n!==xe||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==xe&&(n===xe||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){Pe(this,e)}}const De=ie.litHtmlPolyfillSupport;null==De||De(N,R),(null!==(ne=ie.litHtmlVersions)&&void 0!==ne?ne:ie.litHtmlVersions=[]).push("2.8.0");var ze,Re;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 R(t.insertBefore(he(),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 $e}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(ze=globalThis.litElementHydrateSupport)||void 0===ze||ze.call(globalThis,{LitElement:lit_element_s});const Te=globalThis.litElementPolyfillSupport;null==Te||Te({LitElement:lit_element_s});(null!==(Re=globalThis.litElementVersions)&&void 0!==Re?Re:globalThis.litElementVersions=[]).push("3.3.3");const He=(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 Ne(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):He(e,t)}function Ue(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 We;null===(We=window.HTMLSlotElement)||void 0===We||We.prototype.assignedElements;const Le=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 Be="important",qe=" !"+Be,Fe=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends directive_i{constructor(e){var t;if(super(e),e.type!==Le||"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.ht){this.ht=new Set;for(const e in t)this.ht.add(e);return this.render(t)}this.ht.forEach((e=>{null==t[e]&&(this.ht.delete(e),e.includes("-")?r.removeProperty(e):r[e]="")}));for(const n in t){const e=t[n];if(null!=e){this.ht.add(n);const t="string"==typeof e&&e.endsWith(qe);n.includes("-")||t?r.setProperty(n,t?e.slice(0,-11):e,t?Be:""):r[n]=e}}return $e}}),Ve="5.0.2";function Ke(e){return Ke="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},Ke(e)}function Ge(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,Ze(n.key),n)}}function Je(e,t,r){return t&&Ge(e.prototype,t),r&&Ge(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ze(e){var t=function(e,t){if("object"!==Ke(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ke(t)?t:String(t)}const Ye=new(Je((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=Ze(r="_components"))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n})));var Qe;var Xe,et,tt,rt,nt,it,ot,st=((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,q)})(Qe||(Xe=["\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"],et||(et=Xe.slice(0)),Qe=Object.freeze(Object.defineProperties(Xe,{raw:{value:Object.freeze(et)}}))));function at(e){return at="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},at(e)}function dt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function lt(e,t){return At(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(e){l=!0,i=e}finally{try{if(!d&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||St(e,t)||_t()}function ct(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=St(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 ut(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,kt(n.key),n)}}function ht(e,t){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ht(e,t)}function pt(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=xt(e);if(t){var i=xt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===at(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return mt(e)}(this,r)}}function mt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ft(){ft=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(!gt(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,At(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||St(t)||_t()).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=kt(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:wt(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=wt(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 vt(e){var t,r=kt(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 yt(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function gt(e){return e.decorators&&e.decorators.length}function bt(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function wt(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 kt(e){var t=function(e,t){if("object"!==at(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===at(t)?t:String(t)}function _t(){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 St(e,t){if(e){if("string"==typeof e)return Et(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)?Et(e,t):void 0}}function Et(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 At(e){if(Array.isArray(e))return e}function $t(){return $t="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=xt(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}},$t.apply(this,arguments)}function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xt(e)}!function(e,t,r,n){var i=ft();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(bt(o.descriptor)||bt(i.descriptor)){if(gt(o)||gt(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(gt(o)){if(gt(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}yt(o,i)}else t.push(o)}return t}(s.d.map(vt)),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&&ht(e,t)}(a,e);var t,n,o,s=pt(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(mt(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=ct(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)&&0!==e.length&&t._onResize()}))})),t}return t=a,n&&ut(t.prototype,n),o&&ut(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}(o);return{F:s,d:[{kind:"field",decorators:[Ue(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[Ue("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[Ne()],key:"dashboardId",value:void 0},{kind:"field",decorators:[Ne()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[Ne()],key:"itemId",value:void 0},{kind:"field",decorators:[Ne()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[Ne()],key:"qeVersion",value:void 0},{kind:"field",decorators:[Ne()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[Ne({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[Ne()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[Ne()],key:"mainColor",value:void 0},{kind:"field",decorators:[Ne()],key:"accentColor",value:void 0},{kind:"field",decorators:[Ne()],key:"authToken",value:void 0},{kind:"field",decorators:[Ne()],key:"authKey",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[Ne()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[Ne()],key:"appServer",value:void 0},{kind:"field",decorators:[Ne()],key:"timezoneId",value:void 0},{kind:"field",decorators:[Ne()],key:"apiHost",value:void 0},{kind:"field",decorators:[Ne({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[Ne({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[Ne({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[Ne({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[Ne({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[Ne({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[Ne({attribute:!1})],key:"VERSION",value:function(){return Ve+"-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(){$t(xt(s.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){$t(xt(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;(Ye._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=Ye._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&&D(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=ct(e.entries());try{for(n.s();!(t=n.n()).done;){var i=lt(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(),D(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[st]}},{kind:"method",key:"render",value:function(){return Ae(tt||(tt=dt(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),Fe(this._containerStyle),this.dashboardId||this.dashboardSlug?Ae(rt||(rt=dt(['\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,Fe(this._containerLoaderStyle),this._containerId,Fe(this._loaderStyle),Fe(this._lcStyle),Fe(this._loadingCircleStyle),this._itemEmbedding?"":Ae(nt||(nt=dt(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),Fe({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,Fe(this.iframeStyle)):Ae(it||(it=dt(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?Ae(ot||(ot=dt(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e){return e(Ye._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
2
|
//# sourceMappingURL=luzmo-embed.min.js.map
|