polymatica-widget-component-legacy 2.1.1 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polymatica-widget-component-legacy",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "",
5
5
  "main": "polymatica-widget-component-legacy.js",
6
6
  "types": "types",
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PolymaticaWidgetComponentLegacy=t():e.PolymaticaWidgetComponentLegacy=t()}(self,(()=>(()=>{var e={10:e=>{function t(e){return!e}e.exports=Object.defineProperties(t,{default:{value:t},not:{value:t},__esModule:{value:!0}})},279:e=>{var t;self,t=()=>(()=>{var e={10:e=>{function t(e){return!e}e.exports=Object.defineProperties(t,{default:{value:t},not:{value:t},__esModule:{value:!0}})},107:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.JsxElementType=void 0,(n=t.JsxElementType||(t.JsxElementType={})).Component="component",n.Primitive="primitive"},517:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.listeners=t.elementBindings=void 0,t.elementBindings="⇠ element bindings",t.listeners="⇠ listeners"},292:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,a)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(671),t)},671:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;const o=n(10),a=n(107),r=n(517);var i;function s(e,t){switch(e.type){case a.JsxElementType.Component:return c(e,t);case a.JsxElementType.Primitive:return e.value}}function c(e,t){const{tagName:n}=e;if((0,o.not)(n))return d(e.children,t);switch(n){case"link":if(t.target!==i.Head)return"";l(e.attributes,"href",t.baseUrl);case"script":if(t.target!==i.Head)return"";l(e.attributes,"src",t.baseUrl)}const a=(r=e.attributes,Object.entries(r).map((([e,t])=>"data"===e?function(e){return Object.entries(e).map((([e,t])=>`data-${e}="${t}"`)).join(" ")}(t):("style"===e&&t instanceof Object&&(t=function(e){const t=Object.entries(e).map((([e,t])=>`${function(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}(e)}: ${t};`));return t.join("")}(t)),`${e}="${t}"`))).join(""));var r;return"input"===n?`<${n} ${a} />`:`<${n} ${a}>${d(e.children,t)}</${n}>`}function l(e,t,n){if(!(0,o.not)(t in e))try{const o=new URL(e[t],n);e[t]=o.toString()}catch(n){delete e[t]}}function d(e,t){return e.map((e=>{switch(e.type){case a.JsxElementType.Component:return c(e,t);case a.JsxElementType.Primitive:return e.value}})).join("")}t.Renderer=class{#e;#t;#n;constructor(e,t,n){e.innerHTML='<div style="display: contents;"></div>',this.#e=e.querySelector("div"),this.#t=t,this.#n=n,this.#o(t)}renderHead(e){const t=s(e,{target:i.Head,baseUrl:this.#n});this.#e.insertAdjacentHTML("beforebegin",t)}render(e){this.#e.innerHTML=s(e,{target:i.Body,baseUrl:this.#n}),this.#a()}#o(e){const t=e.constructor?.[r.listeners];if(Array.isArray(t)){const n=this.#e;t.forEach((({eventName:t,selector:a,callbackName:r})=>{const i=e[r];"function"==typeof i&&n.addEventListener(t,(t=>{if((0,o.not)(a)&&i.call(e,t),(0,o.not)(t.target))return;let r=t.target;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.matches(a)){i.call(e,r,t);break}if(!r.parentElement)break;r=r.parentElement}}))}))}}#a(){const e=this.#t,t=e.constructor?.[r.elementBindings];if(Array.isArray(t)){const n=this.#e;t.forEach((({propertyName:t,selector:o,multi:a})=>{e[t]=a?n.querySelectorAll(o):n.querySelector(o)||void 0}))}}},function(e){e[e.Head=0]="Head",e[e.Body=1]="Body"}(i||(i={}))}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";var e;function t(e){for(const t of e){const e=t.target,{attributeName:n}=t;switch(n){case"render-env":e.renderEnv=a(e,"render-env");break;case"widget-base-path":e.widgetBasePath=a(e,"widget-base-path");break;case"locale":e.locale=a(e,"locale")}}}function a(e,t){return e.getAttribute(t)||""}n.r(o),n.d(o,{EventType:()=>e,PolymaticaWidget:()=>O}),function(e){e.ConfigProvided="plmt-config-provided",e.Ready="plmt-ready",e.Interact="plmt-interact"}(e||(e={}));class r{constructor(e){this.component=e}dispatch(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0});this.component.dispatchEvent(n)}}var i=n(10);class s{constructor(e,t){this.shadowRoot=e,this.events=t,this.widgetBasePath=""}load(e){if((0,i.not)(e))return;if(e===this.widgetBasePath)return;this.widgetBasePath=e;const t=function(e){const t=`id${c()}${c()}${c()}${c()}`,n=window;return n[t]=o=>{delete n[t],e(o)},t}((e=>{var t;t=e,(0,i.not)(t)||"function"!=typeof t.Widget||"object"!=typeof t.config||this.events.onLoad({entity:e,widgetBasePath:this.widgetBasePath})})),n=`\n import * as data from "${this.widgetBasePath}/index.js";\n\n ${t}(data);\n `;!function(e,t){const n=document.createElement("script");n.type="module",n.textContent=t,function(e,t){const{firstChild:n}=e;n?e.insertBefore(t,n):e.appendChild(t)}(e,n)}(this.shadowRoot,n)}}function c(){return Math.random().toString(16).slice(2)}var l=n(292);class d{constructor(){this.cache=Object.create(null)}load(e,t){const n=`${e}/assets/i18n/${t}.json`;return this.cache[n]?Promise.resolve(this.cache[n]):fetch(n).then((e=>e.json())).then((e=>(this.cache[n]=e,e)))}}class u{constructor(e){this.events=e,this.datasetsById=new Map}apply(e,t){var n;t.dataset?e.dataset=this.createWidgetDataset(t.dataset):h(t)?e.datasets=t.datasets.map((e=>this.createWidgetDataset(e))):(n=t).datasets&&(0,i.not)(h(n))&&(e.datasets={},Object.entries(t.datasets).forEach((([t,n])=>{const o=Array.isArray(n)?n.map((e=>this.createWidgetDataset(e))):this.createWidgetDataset(n);e.datasets[t]=o}))),t.options&&(e.options=t.options)}getDatasetById(e){return this.datasetsById.get(e)}reset(){this.datasetsById.clear()}createWidgetDataset(e){const{events:t}=this,{datasetId:n,name:o,rows:a}=e,r={},i=e.columns.map((e=>{const o=e.id,a={...p(e,"id"),interact(e){t.onInteract({datasetId:n,columnId:o,rowIndex:e})}};return r[o]=a,a})),s={};Object.entries(e.columnsByBlock).forEach((([e,t])=>{s[e]=[],t.forEach((t=>{const n=r[t];n&&s[e].push(n)}))}));const c={name:o,columns:i,columnsByBlock:s,rows:a,heatmap:{},events:{onHighlight(){}}};return this.datasetsById.set(n,c),c}}function h(e){return Array.isArray(e.datasets)}function p(e,t){const n={};return Object.entries(e).forEach((([e,o])=>{e!==t&&(n[e]=o)})),n}var f=function(e,t,n,o){var a,r=arguments.length,i=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(r<3?a(i):r>3?a(t,n,i):a(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};class g{set renderEnv(e){}set theme(e){this.instance.theme=e,this.instance.onThemeChange()}set locale(e){this.loadTranslations(e)}set state(e){this.clearState(),this.stateManager.apply(this.instance,e),this.instance.onChange()}constructor(e,t){this.shadowRoot=e,this.events=t,this.context={translations:{loading:!1,first:!0}},this.stateManager=new u({onInteract:this.events.onInteract}),this.asyncCallbackMap={state:!1,theme:!1},this.translationsLoader=new d}provideWidgetEntity(e,t){this.context.entity=e,this.context.widgetBasePath=t,this.instantiate()}highlight(e,t){this.stateManager.getDatasetById(e)?.events.onHighlight(t)}async instantiate(){const{entity:e,renderEnv:t,theme:n,locale:o,state:a,widgetBasePath:r}=this.context;if((0,i.not)(e))return;if((0,i.not)(t))return;if((0,i.not)(n))return;if((0,i.not)(o))return;const s=new e.Widget;this.disposePrevious(),this.instance=s,s.renderEnv=t,s.theme=n,s.ready=()=>{this.events.onReady()};const c=new l.Renderer(this.shadowRoot,s,r),d=s.renderHead();d&&c.renderHead(d);const u=s.render;s.render=()=>{const e=u.call(s);return c.render(e),e},s.init(),e.config.useTranslations&&this.loadTranslations(o),a&&(this.state=a)}async loadTranslations(e){const{widgetBasePath:t}=this.context;if((0,i.not)(t))return;const{instance:n}=this;this.context.translations.loading=!0;const o=await this.translationsLoader.load(t,e);this.context.locale===e&&this.instance===n&&(this.instance&&(this.instance.translate=(e,t)=>{const n=o[e];return"string"!=typeof n?"":(0,i.not)(t)?n:n.replace(/\{\{(.+?)\}\}/g,((e,n)=>0===t[n]?"0":t[n]||""))}),this.context.translations.loading=!1,(0,i.not)(this.context.translations.first)&&this.instance?.onLangChange(),this.context.translations.first=!1,this.runAsyncCallback())}runAsyncCallback(){if((0,i.not)(this.instance))return;const{state:e,theme:t}=this.asyncCallbackMap;this.clearAsyncCallbackMap(),t&&this.context.theme&&(this.theme=this.context.theme),e&&this.context.state&&(this.state=this.context.state)}disposePrevious(){this.instance&&this.delete("render"),this.context.entity=void 0,this.context.state=void 0,this.context.translations={loading:!1,first:!0},this.clearAsyncCallbackMap()}delete(e){delete this.instance[e]}clearState(){const e=this.instance;delete e.dataset,delete e.datasets,delete e.options}clearAsyncCallbackMap(){this.asyncCallbackMap.state=!1,this.asyncCallbackMap.theme=!1}}function m(){return(e,t)=>{const{set:n}=Object.getOwnPropertyDescriptor(e,t),o=t;return{set(e){if(this.context[o]=e,this.context.translations.loading)switch(o){case"state":return void(this.asyncCallbackMap.state=!0);case"theme":return void(this.asyncCallbackMap.theme=!0)}(0,i.not)(this.instance)?this.instantiate():n.call(this,e)}}}}f([m()],g.prototype,"renderEnv",null),f([m()],g.prototype,"theme",null),f([m()],g.prototype,"locale",null),f([m()],g.prototype,"state",null);var y,v,b,w,C=function(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)};class O extends HTMLElement{set renderEnv(e){C(this,b,"f").renderEnv=e}set widgetBasePath(e){C(this,w,"f").load(e)}set locale(e){C(this,b,"f").locale=e}constructor(){super(),y.set(this,this.attachShadow({mode:"open"})),v.set(this,new r(this)),b.set(this,new g(C(this,y,"f"),{onReady:()=>{C(this,v,"f").dispatch(e.Ready,null)},onInteract:t=>{C(this,v,"f").dispatch(e.Interact,t)}})),w.set(this,new s(C(this,y,"f"),{onLoad:({entity:t,widgetBasePath:n})=>{C(this,b,"f").provideWidgetEntity(t,n),C(this,v,"f").dispatch(e.ConfigProvided,t.config)}})),new MutationObserver(t).observe(this,{attributes:!0})}provide(e,t){(e||t)&&(C(this,b,"f").state={...e,options:t})}provideTheme(e){C(this,b,"f").theme=e}highlight(e,t){}}y=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,customElements.define("polymatica-widget",O)})(),o})(),e.exports=t()},649:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.encodeDrilldownData=t.decodeDrilldownData=t.blockColorizeKey=t.blockSortKey=t.blockFilterKey=t.configDataBlock_Server=t.ConfigDataBlockType_Server=void 0,(n=t.ConfigDataBlockType_Server||(t.ConfigDataBlockType_Server={})).Column="column",n.Filter="filter",n.Sort="sort",n.Colorizer="colorizer",n.Drilldown="drilldown",t.configDataBlock_Server="8316067a-d04b-4b21-bd4d-35529846617b",t.blockFilterKey="34642664-dbd1-4e35-b0ea-2eaabe796b48",t.blockSortKey="2c849ed6-6105-4aa2-a961-9f95135dfe3b",t.blockColorizeKey="badd51f7-82ce-45b2-a67e-37d52df88c5c",t.decodeDrilldownData=function(e,t){const n=[o(e.length),e];return t.forEach((e=>n.push(o(e.length),e))),n.join("");function o(e){if(e>255)throw new RangeError;return e>15?`0x${e.toString(16)}`:`0x0${e.toString(16)}`}},t.encodeDrilldownData=function(e){const t=[];!function n(o=0){const a=o+4,r=a+parseInt(e.slice(o,a));t.push(e.slice(a,r)),r<e.length&&n(r)}();const[n,...o]=t;return{source:n,additionalFilterSources:o}}},661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DatasetColumnType_Server=t.ColumnFieldType_Server=void 0;var o,a=n(764);Object.defineProperty(t,"ColumnFieldType_Server",{enumerable:!0,get:function(){return a.ColumnType}}),(o=t.DatasetColumnType_Server||(t.DatasetColumnType_Server={})).Dimension="dimension",o.Fact="fact",o.Any="any"},539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createColorizeColors=t.colorizeClassName=t.provideCssVariables=t.themeProjectKeys=t.themeKeys=void 0;const o=n(10);t.themeKeys=["background","backgroundBright","backgroundTint","text","textTint"],t.themeProjectKeys=["colors"];const a=document.querySelector("head"),r=document.querySelector("body"),i={};let s="",c="";function l(e,t){return`ptnl-colorize-${e}-${t}`}t.provideCssVariables=function({theme:e,themeKey:n,themeProjectKey:a}){const r=`ptnl-theme-${g(n)}`;if((0,o.not)(r in i)){const n=[];Object.entries(e).forEach((([e,o])=>{if(t.themeKeys.includes(e)){const t=g(e);Array.isArray(o)?o.forEach(((e,o)=>n.push({name:`--${t}-${o}`,value:e}))):n.push({name:`--${t}`,value:o})}})),p(r,[{className:r,cssProperties:n}])}s=f(s,r);const d=`ptnl-project-${a}`;if((0,o.not)(d in i)&&p(d,[{className:d,cssProperties:e.colors.map(((e,t)=>({name:`--ptnl-color-${t}`,value:e})))}]),c=f(c,d),(0,o.not)("colorize"in i)){const t=[];e.colorize.forEach(((e,n)=>{e.forEach(((e,o)=>t.push({className:l(n,o),cssProperties:[{name:"background-color",value:e}]})))})),p("colorize",t)}},t.colorizeClassName=l;const d=[...Array(10)].map(((e,t)=>t));t.createColorizeColors=function(e){return e.map((e=>{const[t,n,o]=function(e){const[,t,n,o]=e.match(u)||e.match(h)||[,"0","0","0"];return[parseInt(t,16),parseInt(n,16),parseInt(o,16)]}(e);return d.map((e=>`rgba(${t},${n},${o},${++e>9?"1":`0.${e}`})`))}))};const u=/([0-9abcdef]{2})([0-9abcdef]{2})([0-9abcdef]{2})/i,h=/([0-9abcdef])([0-9abcdef])([0-9abcdef])/i;function p(e,t){const n=document.createElement("style");i[e]=n;const o=[];t.forEach((({className:e,cssProperties:t})=>{o.push(".",e,"{\n"),t.forEach((({name:e,value:t})=>o.push(" ",e,": ",t,";\n"))),o.push("}\n")})),n.innerHTML=o.join(""),a.append(n)}function f(e,t){return e&&r.classList.remove(e),r.classList.add(t),t}function g(e){const t=Array(e.length);for(let n=0,o=e.length;n<o;n++){const o=e.charAt(n),a=o.toLowerCase();t[n]=o===a?o:"-"+a}return t.join("")}},386:(e,t)=>{"use strict";var n;function o(e,t){switch(e){case n.Input:case n.Radio:case n.Select:case n.ColorPicker:case n.TextArea:return t?String(t):"";case n.Checkbox:return Boolean(t);default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.valueConversion=t.viewSettingsExtract=t.viewSettingsItemValue=t.ViewSettingsItemType=void 0,function(e){e.Input="text",e.Checkbox="checkbox",e.Radio="radio",e.Select="select",e.ColorPicker="color-picker",e.Title="title",e.TextArea="textArea"}(n=t.ViewSettingsItemType||(t.ViewSettingsItemType={})),t.viewSettingsItemValue="418d9556-a046-4623-be0b-4f4f69ccb783",t.viewSettingsExtract=function(e){return e.map((e=>e[t.viewSettingsItemValue])).map((e=>{return{type:e.type,key:e.key,label:e.label,defaultValue:o(e.type,e.defaultValue),options:e.options||[],span:(t=e.span,(t|=0)>24?24:t<0?0:t)};var t}))},t.valueConversion=o},897:(e,t)=>{"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),t.Output=t.Input=void 0,(o=t.Input||(t.Input={})).Change="ptnl.input.change",o.ChangeLang="ptnl.input.changeLang",o.ChangeTheme="ptnl.input.changeTheme",o.ChangeOtherFilters="ptnl.input.ChangeOtherFilters",o.ChangeWidgetRenderEnv="ptnl.input.changeWidgetRenderEnv",(n=t.Output||(t.Output={})).Init="ptnl.output.init",n.Ready="ptnl.output.ready",n.SetFilter="ptnl.output.setFilter",n.RemoveFilterAt="ptnl.output.RemoveFilterAt",n.SetSort="ptnl.output.setSort",n.RemoveSortAt="ptnl.output.RemoveSortAt",n.Interact="ptnl.output.interact"},300:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.provideDataTo=void 0;const o=n(649),a=n(757),r={setFilter(){},removeFilterAt(){},setSort(){},removeSortAt(){},interact(){}};function i(e,t){const n=t===a.widgetDefaultKey?e.dataSettings:e.dataSettings[t];return n?{events:n.events}:{events:{}}}t.provideDataTo=function(e,{dataOptionsMap:t,viewOptions:n},s=r){const c={},l={},d=window.format||{};e.viewSettings={},Object.values(t).forEach((({data_option:t,rows:n,total:r})=>{c[t.key]=n;const u=t.dataset.columns_id.map((e=>({type:e.base_type,id:e.id,path:e.path,format:d[e.path]||(e=>String(e)),name:e.name}))),h={},p=[],f=[],g=[];t.blocks.forEach((t=>{if(t.block_type!==o.ConfigDataBlockType_Server.Drilldown)switch(t.key){case o.blockFilterKey:t.columns.forEach((({column_id:e,action:t,value:n})=>{const o=u.find((({id:t})=>e===t));p.push({column:o,method:t,value:n})}));break;case o.blockSortKey:t.columns.forEach((({column_id:e,value:t})=>{const n=u.find((({id:t})=>e===t));f.push({column:n,direction:t})}));break;case o.blockColorizeKey:t.columns.forEach((({value:t})=>{const n=t,o=u.find((({id:e})=>n.columnId===e));g.push((0,a.createColorizeItem)(e,o,n))}));break;default:h[t.key]=t.columns.map((({column_id:e})=>u.find((t=>t.id===e))))}}));const m={columns:u,columnsByBlock:h,filters:p,sort:f,colorize:g,total:r,limit:t.limit_rows,offset:t.offset,...{...s,interact:s.interact.bind(t)},...i(e,t.key)};l[t.key]=m})),a.widgetDefaultKey in l?Object.assign(e,{data:c[a.widgetDefaultKey],dataSettings:l[a.widgetDefaultKey]}):Object.assign(e,{data:c,dataSettings:l}),e.viewSettings={},n.forEach((({key:t,value:n})=>e.viewSettings[t]=n))}},757:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchChangeOtherFilters=t.createColorizeItem=t.widgetDefaultKey=void 0;const o=n(764);function a(e){return e||"transparent"}t.widgetDefaultKey="ffed0a4d-4a9d-417f-b502-eb50142c6956",t.createColorizeItem=function(e,t,n){const o=+n.max||0,r=+n.min||0,i=+n.threshold||0,s=n.colorAbove,c=n.colorBelow,l=o-i,d=i-r;return{column:t,getColor(t){if((t=+t||0)>o||t<r)return a();if(t>=i){const n=e.theme.colorize[s]||[];return a(t===o?n[n.length-1]:n[Math.floor((t-i)/l*n.length)])}{const n=e.theme.colorize[c]||[];return a(t===r?n[n.length-1]:n[Math.floor((i-t)/d*n.length)])}}}},t.dispatchChangeOtherFilters=function(e,t){t.forEach((({column_id:t,value:n})=>{const a=function(e,t){if(Array.isArray(e.data))return e.dataSettings;for(let n of Object.values(e.dataSettings))if(n.columns.find((({id:e})=>e===t)))return n;return null}(e,t);if(a&&"function"==typeof a.events.onOtherFilterChange){const e=a.columns.find((({id:e})=>e===t));e&&a.events.onOtherFilterChange({column:e,method:o.FilterMethod.InList,value:n})}}))}},836:(e,t,n)=>{"use strict";t.wD=t.y8=t.JG=void 0;n(764),n(649),n(661),n(386);var o,a;(a=t.JG||(t.JG={})).Table="table",a.Aggregate="aggregate",(o=t.y8||(t.y8={})).Group="group",o.Sum="sum",o.Average="avg",o.Min="min",o.Max="max",o.First="first",o.Last="last",function(e){e.AxisX="sys:axis-x",e.AxisY="sys:axis-y",e.Value="sys:value-column"}(t.wD||(t.wD={}));Symbol()},764:(e,t)=>{"use strict";var n,o,a,r;Object.defineProperty(t,"__esModule",{value:!0}),t.Target=t.SortDirection=t.FilterMethod=t.ColumnType=void 0,(r=t.ColumnType||(t.ColumnType={})).String="string",r.Number="number",r.Boolean="boolean",r.Date="date",r.Array="array",r.Object="object",(a=t.FilterMethod||(t.FilterMethod={})).Equal="equally",a.NotEqual="not_equal",a.GreaterThen="gt",a.LessThen="lt",a.GreaterThenOrEqual="gte",a.LessThenOrEqual="lte",a.Period="period",a.DateList="date_list",a.InList="in_list",a.NotInList="nin_list",a.StartsOnIndex="starts_on_i",a.StartsOn="starts_on",a.EndsOnIndex="ends_on_i",a.EndsOn="ends_on",a.ContainsIndex="contains_i",a.Contains="contains",a.NotContainIndex="not_contain_i",a.NotContain="not_contain",(o=t.SortDirection||(t.SortDirection={})).Asc="ASC",o.Desc="DESC",(n=t.Target||(t.Target={})).Self="self",n.Other="other",n.All="all"},362:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Declare=void 0;const o=n(10),a=n(764),r=n(897),i=n(300),s=n(539),c=n(757);function l(e,t){window.addEventListener("message",(({data:n})=>{n.type===e&&t(n.payload)}))}function d(e,t,n){const o={type:t,token:e,payload:n};window.parent.postMessage(o,"*")}t.Declare=function(e){return(0,o.not)(e)&&(e={provideCssVariables:!1}),t=>{const n=new t,u=function(e){const t="token=",n=window.location.search.split(/[?&]/).find((e=>e.startsWith(t)));return n?n.slice(t.length):""}();Object.assign(n,{viewSettings:{},ready(){d(u,r.Output.Ready)}});const h={setFilter(e,t=a.Target.Self){d(u,r.Output.SetFilter,{filter:e,target:t})},removeFilterAt(e){d(u,r.Output.RemoveFilterAt,{index:e})},setSort(e,t=a.Target.Self){d(u,r.Output.SetSort,{sort:e,target:t})},removeSortAt(e){d(u,r.Output.RemoveSortAt,{index:e})},interact(e){d(u,r.Output.Interact,{dataOptionId:this.id,dataIndex:e})}};let p=!1;return l(r.Input.Change,(e=>{(0,i.provideDataTo)(n,e,h),(0,o.not)(p)&&(p=!0,"function"==typeof n.onInit&&n.onInit()),"function"==typeof n.onChange&&n.onChange()})),l(r.Input.ChangeLang,(e=>{n.lang=e,n.onLangChange&&p&&n.onLangChange()})),l(r.Input.ChangeTheme,(t=>{n.theme=t.theme,e.provideCssVariables&&(0,s.provideCssVariables)(t),n.onThemeChange&&p&&n.onThemeChange()})),l(r.Input.ChangeOtherFilters,(e=>(0,c.dispatchChangeOtherFilters)(n,e))),l(r.Input.ChangeWidgetRenderEnv,(e=>{n.renderEnv=e})),d(u,r.Output.Init),t}}},391:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,a)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(362),t),a(n(830),t)},830:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetRenderEnv=t.Widget=void 0,t.Widget=class{constructor(){this.renderEnv=n.Default}ready(){}onInit(){}onThemeChange(){}onLangChange(){}},function(e){e.Default="default",e.Print="print"}(n=t.WidgetRenderEnv||(t.WidgetRenderEnv={}))}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{PolymaticaWidgetLegacy:()=>f});var e=n(10),t=n(391),a=n(836),r=n(764),i=n(649),s=n(757),c=n(897);function l(e){for(const t of e){const e=t.target;switch(t.attributeName){case"render-env":e.renderEnv=e.getAttribute("render-env");break;case"widget-base-path":e.widgetBasePath=e.getAttribute("widget-base-path");break;case"locale":e.locale=e.getAttribute("locale")}}}var d=n(279);const u=(e,t,n)=>{const o=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(o)};class h{constructor(e){this.widget=e,this.token=this.createToken(),this.isReady=!1,window.addEventListener("message",(({data:e})=>{e.token===this.token&&this.process(e)}))}get context(){return h.widgetContextMap.get(this.widget)}send(e,t){this.context.iframe.contentWindow?.postMessage({type:e,payload:t},"*")}process(e){switch(e.type){case c.Output.Init:{if(this.isReady)break;this.isReady=!0;const{context:e}=this;this.send(c.Input.ChangeWidgetRenderEnv,e.widgetRenderEnv||t.WidgetRenderEnv.Default),this.send(c.Input.ChangeTheme,e.theme),this.send(c.Input.ChangeLang,e.locale),this.send(c.Input.Change,e.widgetRepresent);break}case c.Output.Ready:u(this.widget,d.EventType.Ready,{});break;case c.Output.SetFilter:{const{filter:t,target:n}=e.payload;if(n===r.Target.Other){const{data_option:e,rows:n}=this.context.widgetRepresent.dataOptionsMap[s.widgetDefaultKey],{column:{path:o,type:a},value:i}=t,c=a===r.ColumnType.Number?Number(i):i;this.context.otherFilterColumnId=t.column.id,u(this.widget,d.EventType.Interact,{datasetId:e.dataset.id,columnId:t.column.id,dataIndex:n.findIndex((e=>e[o]===c))})}break}}}createToken(){return Math.random().toString(16).slice(2)}}const p=new WeakMap;h.widgetContextMap=p;class f extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"closed"}),t=document.createElement("iframe"),n=document.createElement("style");n.textContent="\n:host {\n display: block;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n}\n",e.append(n);const o={iframe:t,inited:!1,shadowRoot:e,connector:new h(this),otherFilterColumnId:0};p.set(this,o),function(e){new MutationObserver(l).observe(e,{attributes:!0})}(this)}set renderEnv(e){e===t.WidgetRenderEnv.Print&&m(this,{widgetRenderEnv:e})}set widgetBasePath(e){m(this,{widgetBasePath:e})}set locale(e){m(this,{locale:e})}set uid(e){this._uid=e}get uid(){return this._uid}initFormatterToWindow(e,t){const n=window.format||{};n[t]=n[t]||{},e.columns.forEach((e=>{n[t][e.path]=e.format})),window.format=n}provide(e,t){const{dataset:n}=e;this.uid&&this.initFormatterToWindow(n,this.uid);const o=Object.entries(n.columnsByBlock).map((([e,t])=>({key:e,block_type:i.ConfigDataBlockType_Server.Column,function:a.y8.Group,columns:t.map((e=>({column_id:e})))}))),r=n.columns.map((e=>({id:e.id,name:e.name,path:e.path,base_type:e.type})));m(this,{uid:this.uid,widgetRepresent:{dataOptionsMap:{[s.widgetDefaultKey]:{data_option:{key:s.widgetDefaultKey,id:n.datasetId,dataset:{id:n.datasetId,name:"",columns_id:r},method:a.JG.Aggregate,limit_rows:-1,offset:0,blocks:o},rows:n.rows,total:n.rows.length}},viewOptions:Object.entries(t||{}).map((([e,t])=>({key:e,value:t})))}})}provideTheme(e){m(this,{theme:{theme:{background:"rgb(241, 241, 242)",backgroundBright:"rgb(32, 33, 39)",backgroundTint:["rgb(230, 230, 234)","rgb(208, 208, 213)","rgb(163, 163, 172)","rgb(118, 118, 133)","rgb(64, 64, 83)","rgb(32, 33, 39)"],text:"rgb(0, 175, 215)",textTint:["#0d131e","#111827","#1f2937","#374151","#4b5563"],colors:e.palette,colorize:e.heatmap},themeKey:"polymatica",themeProjectKey:"polymatica"}})}highlight(e,t){const{connector:n,otherFilterColumnId:o,widgetRepresent:a}=g(this),i=[],l=a?.dataOptionsMap[s.widgetDefaultKey];if(l){const e=l.data_option.dataset.columns_id.find((({id:e})=>e===o));e&&t.forEach((t=>{t in l.rows&&i.push(l.rows[t][e.path])}))}n.send(c.Input.ChangeOtherFilters,[{column_id:o,value:i,action:r.FilterMethod.InList}])}}function g(e){return p.get(e)}function m(t,n){const o=g(t);Object.assign(o,n);const{iframe:a,inited:r,widgetRepresent:i,locale:s,theme:l,widgetBasePath:d}=o;if(!((0,e.not)(i)||(0,e.not)(s)||(0,e.not)(l)||(0,e.not)(d)))if((0,e.not)(r)){o.inited=!0;let t=d;(0,e.not)(t.endsWith("/"))&&(t+="/"),t+=`index.html?token=${o.connector.token}`,o.uid&&(t+=`&uid=${o.uid}`),a.src=t,o.shadowRoot.append(a)}else{const{connector:e}=o;n.theme&&e.send(c.Input.ChangeTheme,l),n.locale&&e.send(c.Input.ChangeLang,s),n.widgetRepresent&&e.send(c.Input.Change,i)}}customElements.define("polymatica-widget-legacy",f)})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PolymaticaWidgetComponentLegacy=t():e.PolymaticaWidgetComponentLegacy=t()}(self,(()=>(()=>{var e={10:e=>{function t(e){return!e}e.exports=Object.defineProperties(t,{default:{value:t},not:{value:t},__esModule:{value:!0}})},279:e=>{var t;self,t=()=>(()=>{var e={10:e=>{function t(e){return!e}e.exports=Object.defineProperties(t,{default:{value:t},not:{value:t},__esModule:{value:!0}})},107:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.JsxElementType=void 0,(n=t.JsxElementType||(t.JsxElementType={})).Component="component",n.Primitive="primitive"},517:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.listeners=t.elementBindings=void 0,t.elementBindings="⇠ element bindings",t.listeners="⇠ listeners"},292:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,o)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(671),t)},671:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;const a=n(10),o=n(107),i=n(517);var r;function s(e,t){switch(e.type){case o.JsxElementType.Component:return c(e,t);case o.JsxElementType.Primitive:return e.value}}function c(e,t){const{tagName:n}=e;if((0,a.not)(n))return d(e.children,t);switch(n){case"link":if(t.target!==r.Head)return"";l(e.attributes,"href",t.baseUrl);case"script":if(t.target!==r.Head)return"";l(e.attributes,"src",t.baseUrl)}const o=(i=e.attributes,Object.entries(i).map((([e,t])=>"data"===e?function(e){return Object.entries(e).map((([e,t])=>`data-${e}="${t}"`)).join(" ")}(t):("style"===e&&t instanceof Object&&(t=function(e){const t=Object.entries(e).map((([e,t])=>`${function(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}(e)}: ${t};`));return t.join("")}(t)),`${e}="${t}"`))).join(""));var i;return"input"===n?`<${n} ${o} />`:`<${n} ${o}>${d(e.children,t)}</${n}>`}function l(e,t,n){if(!(0,a.not)(t in e))try{const a=new URL(e[t],n);e[t]=a.toString()}catch(n){delete e[t]}}function d(e,t){return e.map((e=>{switch(e.type){case o.JsxElementType.Component:return c(e,t);case o.JsxElementType.Primitive:return e.value}})).join("")}t.Renderer=class{#e;#t;#n;constructor(e,t,n){e.innerHTML='<div style="display: contents;"></div>',this.#e=e.querySelector("div"),this.#t=t,this.#n=n,this.#a(t)}renderHead(e){const t=s(e,{target:r.Head,baseUrl:this.#n});this.#e.insertAdjacentHTML("beforebegin",t)}render(e){this.#e.innerHTML=s(e,{target:r.Body,baseUrl:this.#n}),this.#o()}#a(e){const t=e.constructor?.[i.listeners];if(Array.isArray(t)){const n=this.#e;t.forEach((({eventName:t,selector:o,callbackName:i})=>{const r=e[i];"function"==typeof r&&n.addEventListener(t,(t=>{if((0,a.not)(o)&&r.call(e,t),(0,a.not)(t.target))return;let i=t.target;for(;i&&i!==n;){if(i instanceof HTMLElement&&i.matches(o)){r.call(e,i,t);break}if(!i.parentElement)break;i=i.parentElement}}))}))}}#o(){const e=this.#t,t=e.constructor?.[i.elementBindings];if(Array.isArray(t)){const n=this.#e;t.forEach((({propertyName:t,selector:a,multi:o})=>{e[t]=o?n.querySelectorAll(a):n.querySelector(a)||void 0}))}}},function(e){e[e.Head=0]="Head",e[e.Body=1]="Body"}(r||(r={}))}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={exports:{}};return e[a].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";var e;function t(e){for(const t of e){const e=t.target,{attributeName:n}=t;switch(n){case"render-env":e.renderEnv=o(e,"render-env");break;case"widget-base-path":e.widgetBasePath=o(e,"widget-base-path");break;case"locale":e.locale=o(e,"locale")}}}function o(e,t){return e.getAttribute(t)||""}n.r(a),n.d(a,{EventType:()=>e,PolymaticaWidget:()=>k}),function(e){e.ConfigProvided="plmt-config-provided",e.Ready="plmt-ready",e.Interact="plmt-interact"}(e||(e={}));class i{constructor(e){this.component=e}dispatch(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0});this.component.dispatchEvent(n)}}var r=n(10);class s{constructor(e,t){this.shadowRoot=e,this.events=t,this.widgetBasePath=""}load(e){if((0,r.not)(e))return;if(e===this.widgetBasePath)return;this.widgetBasePath=e;const t=function(e){const t=`id${c()}${c()}${c()}${c()}`,n=window;return n[t]=a=>{delete n[t],e(a)},t}((e=>{var t;t=e,(0,r.not)(t)||"function"!=typeof t.Widget||"object"!=typeof t.config||this.events.onLoad({entity:e,widgetBasePath:this.widgetBasePath})})),n=`\n import * as data from "${this.widgetBasePath}/index.js";\n\n ${t}(data);\n `;!function(e,t){const n=document.createElement("script");n.type="module",n.textContent=t,function(e,t){const{firstChild:n}=e;n?e.insertBefore(t,n):e.appendChild(t)}(e,n)}(this.shadowRoot,n)}}function c(){return Math.random().toString(16).slice(2)}var l=n(292);class d{constructor(){this.cache=Object.create(null)}load(e,t){const n=`${e}/assets/i18n/${t}.json`;return this.cache[n]?Promise.resolve(this.cache[n]):fetch(n).then((e=>e.json())).then((e=>(this.cache[n]=e,e)))}}class u{constructor(e){this.events=e,this.datasetsById=new Map}apply(e,t){var n;t.dataset?e.dataset=this.createWidgetDataset(t.dataset):h(t)?e.datasets=t.datasets.map((e=>this.createWidgetDataset(e))):(n=t).datasets&&(0,r.not)(h(n))&&(e.datasets={},Object.entries(t.datasets).forEach((([t,n])=>{const a=Array.isArray(n)?n.map((e=>this.createWidgetDataset(e))):this.createWidgetDataset(n);e.datasets[t]=a}))),t.options&&(e.options=t.options)}getDatasetById(e){return this.datasetsById.get(e)}reset(){this.datasetsById.clear()}createWidgetDataset(e){const{events:t}=this,{datasetId:n,name:a,rows:o}=e,i={},r=e.columns.map((e=>{const a=e.id,o={...p(e,"id"),interact(e){t.onInteract({datasetId:n,columnId:a,rowIndex:e})}};return i[a]=o,o})),s={};Object.entries(e.columnsByBlock).forEach((([e,t])=>{s[e]=[],t.forEach((t=>{const n=i[t];n&&s[e].push(n)}))}));const c={name:a,columns:r,columnsByBlock:s,rows:o,heatmap:{},events:{onHighlight(){}}};return this.datasetsById.set(n,c),c}}function h(e){return Array.isArray(e.datasets)}function p(e,t){const n={};return Object.entries(e).forEach((([e,a])=>{e!==t&&(n[e]=a)})),n}var g=function(e,t,n,a){var o,i=arguments.length,r=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(r=(i<3?o(r):i>3?o(t,n,r):o(t,n))||r);return i>3&&r&&Object.defineProperty(t,n,r),r};class f{set renderEnv(e){}set theme(e){this.instance.theme=e,this.instance.onThemeChange()}set locale(e){this.loadTranslations(e)}set state(e){this.clearState(),this.stateManager.apply(this.instance,e),this.instance.onChange()}constructor(e,t){this.shadowRoot=e,this.events=t,this.context={translations:{loading:!1,first:!0}},this.stateManager=new u({onInteract:this.events.onInteract}),this.asyncCallbackMap={state:!1,theme:!1},this.translationsLoader=new d}provideWidgetEntity(e,t){this.context.entity=e,this.context.widgetBasePath=t,this.instantiate()}highlight(e,t){this.stateManager.getDatasetById(e)?.events.onHighlight(t)}async instantiate(){const{entity:e,renderEnv:t,theme:n,locale:a,state:o,widgetBasePath:i}=this.context;if((0,r.not)(e))return;if((0,r.not)(t))return;if((0,r.not)(n))return;if((0,r.not)(a))return;const s=new e.Widget;this.disposePrevious(),this.instance=s,s.renderEnv=t,s.theme=n,s.ready=()=>{this.events.onReady()};const c=new l.Renderer(this.shadowRoot,s,i),d=s.renderHead();d&&c.renderHead(d);const u=s.render;s.render=()=>{const e=u.call(s);return c.render(e),e},s.init(),e.config.useTranslations&&this.loadTranslations(a),o&&(this.state=o)}async loadTranslations(e){const{widgetBasePath:t}=this.context;if((0,r.not)(t))return;const{instance:n}=this;this.context.translations.loading=!0;const a=await this.translationsLoader.load(t,e);this.context.locale===e&&this.instance===n&&(this.instance&&(this.instance.translate=(e,t)=>{const n=a[e];return"string"!=typeof n?"":(0,r.not)(t)?n:n.replace(/\{\{(.+?)\}\}/g,((e,n)=>0===t[n]?"0":t[n]||""))}),this.context.translations.loading=!1,(0,r.not)(this.context.translations.first)&&this.instance?.onLangChange(),this.context.translations.first=!1,this.runAsyncCallback())}runAsyncCallback(){if((0,r.not)(this.instance))return;const{state:e,theme:t}=this.asyncCallbackMap;this.clearAsyncCallbackMap(),t&&this.context.theme&&(this.theme=this.context.theme),e&&this.context.state&&(this.state=this.context.state)}disposePrevious(){this.instance&&this.delete("render"),this.context.entity=void 0,this.context.state=void 0,this.context.translations={loading:!1,first:!0},this.clearAsyncCallbackMap()}delete(e){delete this.instance[e]}clearState(){const e=this.instance;delete e.dataset,delete e.datasets,delete e.options}clearAsyncCallbackMap(){this.asyncCallbackMap.state=!1,this.asyncCallbackMap.theme=!1}}function y(){return(e,t)=>{const{set:n}=Object.getOwnPropertyDescriptor(e,t),a=t;return{set(e){if(this.context[a]=e,this.context.translations.loading)switch(a){case"state":return void(this.asyncCallbackMap.state=!0);case"theme":return void(this.asyncCallbackMap.theme=!0)}(0,r.not)(this.instance)?this.instantiate():n.call(this,e)}}}}g([y()],f.prototype,"renderEnv",null),g([y()],f.prototype,"theme",null),g([y()],f.prototype,"locale",null),g([y()],f.prototype,"state",null);var m,b,v,w,C=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class k extends HTMLElement{set renderEnv(e){C(this,v,"f").renderEnv=e}set widgetBasePath(e){C(this,w,"f").load(e)}set locale(e){C(this,v,"f").locale=e}constructor(){super(),m.set(this,this.attachShadow({mode:"open"})),b.set(this,new i(this)),v.set(this,new f(C(this,m,"f"),{onReady:()=>{C(this,b,"f").dispatch(e.Ready,null)},onInteract:t=>{C(this,b,"f").dispatch(e.Interact,t)}})),w.set(this,new s(C(this,m,"f"),{onLoad:({entity:t,widgetBasePath:n})=>{C(this,v,"f").provideWidgetEntity(t,n),C(this,b,"f").dispatch(e.ConfigProvided,t.config)}})),new MutationObserver(t).observe(this,{attributes:!0})}provide(e,t){(e||t)&&(C(this,v,"f").state={...e,options:t})}provideTheme(e){C(this,v,"f").theme=e}highlight(e,t){}}m=new WeakMap,b=new WeakMap,v=new WeakMap,w=new WeakMap,customElements.define("polymatica-widget",k)})(),a})(),e.exports=t()},611:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.widgetOptionsTargetKey=void 0,t.widgetOptionsTargetKey="6ba1fa0f-7eab-49f8-80ef-0fed376661e2"},701:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetOptionType=void 0,(n=t.WidgetOptionType||(t.WidgetOptionType={})).Title="title",n.Label="label",n.Spacer="spacer",n.LineHorizontal="line-horizontal",n.Tabs="tabs",n.TabPanels="tab-panels",n.Text="text",n.Number="number",n.Integer="integer",n.Range="range",n.Interval="interval",n.Date="date",n.Time="time",n.DateTime="datetime",n.DateInterval="date-interval",n.Checkbox="checkbox",n.ColorPicker="color-picker",n.Radio="radio",n.RadioButtons="radio-buttons",n.Select="select",n.Suggestion="suggestion",n.Button="button"},643:(e,t,n)=>{"use strict";t.HN=t.Ys=t.k0=t.MJ=t.fL=t.TN=t.n$=t.$u=void 0;const a=n(611),o=n(701);function i(e){globalThis[a.widgetOptionsTargetKey].push(e)}var r,s;(s=t.$u||(t.$u={})).Small="small",s.Medium="medium",s.Large="large",(r=t.n$||(t.n$={})).Aggregate="aggregate",r.Table="table",r.PivotTable="pivot",t.TN=function(e,t){i({type:o.WidgetOptionType.Title,label:e,hint:t})},t.fL=function(e){i(Object.assign(Object.assign({},e),{type:o.WidgetOptionType.Text}))},t.MJ=function(e){i(Object.assign(Object.assign({},e),{type:o.WidgetOptionType.Checkbox}))},t.k0=function(e){i(Object.assign(Object.assign({},e),{type:o.WidgetOptionType.Radio}))},t.Ys=function(e){i(Object.assign(Object.assign({},e),{type:o.WidgetOptionType.Select}))},t.HN=function(e){i(Object.assign(Object.assign({},e),{type:o.WidgetOptionType.ColorPicker}))}},649:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.encodeDrilldownData=t.decodeDrilldownData=t.blockColorizeKey=t.blockSortKey=t.blockFilterKey=t.configDataBlock_Server=t.ConfigDataBlockType_Server=void 0,(n=t.ConfigDataBlockType_Server||(t.ConfigDataBlockType_Server={})).Column="column",n.Filter="filter",n.Sort="sort",n.Colorizer="colorizer",n.Drilldown="drilldown",t.configDataBlock_Server="8316067a-d04b-4b21-bd4d-35529846617b",t.blockFilterKey="34642664-dbd1-4e35-b0ea-2eaabe796b48",t.blockSortKey="2c849ed6-6105-4aa2-a961-9f95135dfe3b",t.blockColorizeKey="badd51f7-82ce-45b2-a67e-37d52df88c5c",t.decodeDrilldownData=function(e,t){const n=[a(e.length),e];return t.forEach((e=>n.push(a(e.length),e))),n.join("");function a(e){if(e>255)throw new RangeError;return e>15?`0x${e.toString(16)}`:`0x0${e.toString(16)}`}},t.encodeDrilldownData=function(e){const t=[];!function n(a=0){const o=a+4,i=o+parseInt(e.slice(a,o));t.push(e.slice(o,i)),i<e.length&&n(i)}();const[n,...a]=t;return{source:n,additionalFilterSources:a}}},661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DatasetColumnType_Server=t.ColumnFieldType_Server=void 0;var a,o=n(764);Object.defineProperty(t,"ColumnFieldType_Server",{enumerable:!0,get:function(){return o.ColumnType}}),(a=t.DatasetColumnType_Server||(t.DatasetColumnType_Server={})).Dimension="dimension",a.Fact="fact",a.Any="any"},539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createColorizeColors=t.colorizeClassName=t.provideCssVariables=t.themeProjectKeys=t.themeKeys=void 0;const a=n(10);t.themeKeys=["background","backgroundBright","backgroundTint","text","textTint"],t.themeProjectKeys=["colors"];const o=document.querySelector("head"),i=document.querySelector("body"),r={};let s="",c="";function l(e,t){return`ptnl-colorize-${e}-${t}`}t.provideCssVariables=function({theme:e,themeKey:n,themeProjectKey:o}){const i=`ptnl-theme-${f(n)}`;if((0,a.not)(i in r)){const n=[];Object.entries(e).forEach((([e,a])=>{if(t.themeKeys.includes(e)){const t=f(e);Array.isArray(a)?a.forEach(((e,a)=>n.push({name:`--${t}-${a}`,value:e}))):n.push({name:`--${t}`,value:a})}})),p(i,[{className:i,cssProperties:n}])}s=g(s,i);const d=`ptnl-project-${o}`;if((0,a.not)(d in r)&&p(d,[{className:d,cssProperties:e.colors.map(((e,t)=>({name:`--ptnl-color-${t}`,value:e})))}]),c=g(c,d),(0,a.not)("colorize"in r)){const t=[];e.colorize.forEach(((e,n)=>{e.forEach(((e,a)=>t.push({className:l(n,a),cssProperties:[{name:"background-color",value:e}]})))})),p("colorize",t)}},t.colorizeClassName=l;const d=[...Array(10)].map(((e,t)=>t));t.createColorizeColors=function(e){return e.map((e=>{const[t,n,a]=function(e){const[,t,n,a]=e.match(u)||e.match(h)||[,"0","0","0"];return[parseInt(t,16),parseInt(n,16),parseInt(a,16)]}(e);return d.map((e=>`rgba(${t},${n},${a},${++e>9?"1":`0.${e}`})`))}))};const u=/([0-9abcdef]{2})([0-9abcdef]{2})([0-9abcdef]{2})/i,h=/([0-9abcdef])([0-9abcdef])([0-9abcdef])/i;function p(e,t){const n=document.createElement("style");r[e]=n;const a=[];t.forEach((({className:e,cssProperties:t})=>{a.push(".",e,"{\n"),t.forEach((({name:e,value:t})=>a.push(" ",e,": ",t,";\n"))),a.push("}\n")})),n.innerHTML=a.join(""),o.append(n)}function g(e,t){return e&&i.classList.remove(e),i.classList.add(t),t}function f(e){const t=Array(e.length);for(let n=0,a=e.length;n<a;n++){const a=e.charAt(n),o=a.toLowerCase();t[n]=a===o?a:"-"+o}return t.join("")}},386:(e,t)=>{"use strict";var n;function a(e,t){switch(e){case n.Input:case n.Radio:case n.Select:case n.ColorPicker:case n.TextArea:return t?String(t):"";case n.Checkbox:return Boolean(t);default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.valueConversion=t.viewSettingsExtract=t.viewSettingsItemValue=t.ViewSettingsItemType=void 0,function(e){e.Input="text",e.Checkbox="checkbox",e.Radio="radio",e.Select="select",e.ColorPicker="color-picker",e.Title="title",e.TextArea="textArea"}(n=t.ViewSettingsItemType||(t.ViewSettingsItemType={})),t.viewSettingsItemValue="418d9556-a046-4623-be0b-4f4f69ccb783",t.viewSettingsExtract=function(e){return e.map((e=>e[t.viewSettingsItemValue])).map((e=>{return{type:e.type,key:e.key,label:e.label,defaultValue:a(e.type,e.defaultValue),options:e.options||[],span:(t=e.span,(t|=0)>24?24:t<0?0:t)};var t}))},t.valueConversion=a},897:(e,t)=>{"use strict";var n,a;Object.defineProperty(t,"__esModule",{value:!0}),t.Output=t.Input=void 0,(a=t.Input||(t.Input={})).Change="ptnl.input.change",a.ChangeLang="ptnl.input.changeLang",a.ChangeTheme="ptnl.input.changeTheme",a.ChangeOtherFilters="ptnl.input.ChangeOtherFilters",a.ChangeWidgetRenderEnv="ptnl.input.changeWidgetRenderEnv",(n=t.Output||(t.Output={})).Init="ptnl.output.init",n.Ready="ptnl.output.ready",n.SetFilter="ptnl.output.setFilter",n.RemoveFilterAt="ptnl.output.RemoveFilterAt",n.SetSort="ptnl.output.setSort",n.RemoveSortAt="ptnl.output.RemoveSortAt",n.Interact="ptnl.output.interact"},300:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.provideDataTo=void 0;const a=n(649),o=n(757),i={setFilter(){},removeFilterAt(){},setSort(){},removeSortAt(){},interact(){}};function r(e,t){const n=t===o.widgetDefaultKey?e.dataSettings:e.dataSettings[t];return n?{events:n.events}:{events:{}}}t.provideDataTo=function(e,{dataOptionsMap:t,viewOptions:n},s=i){const c={},l={},d=window.format||{};e.viewSettings={},Object.values(t).forEach((({data_option:t,rows:n,total:i})=>{c[t.key]=n;const u=t.dataset.columns_id.map((e=>({type:e.base_type,id:e.id,path:e.path,format:d[e.path]||(e=>String(e)),name:e.name}))),h={},p=[],g=[],f=[];t.blocks.forEach((t=>{if(t.block_type!==a.ConfigDataBlockType_Server.Drilldown)switch(t.key){case a.blockFilterKey:t.columns.forEach((({column_id:e,action:t,value:n})=>{const a=u.find((({id:t})=>e===t));p.push({column:a,method:t,value:n})}));break;case a.blockSortKey:t.columns.forEach((({column_id:e,value:t})=>{const n=u.find((({id:t})=>e===t));g.push({column:n,direction:t})}));break;case a.blockColorizeKey:t.columns.forEach((({value:t})=>{const n=t,a=u.find((({id:e})=>n.columnId===e));f.push((0,o.createColorizeItem)(e,a,n))}));break;default:h[t.key]=t.columns.map((({column_id:e})=>u.find((t=>t.id===e))))}}));const y={columns:u,columnsByBlock:h,filters:p,sort:g,colorize:f,total:i,limit:t.limit_rows,offset:t.offset,...{...s,interact:s.interact.bind(t)},...r(e,t.key)};l[t.key]=y})),o.widgetDefaultKey in l?Object.assign(e,{data:c[o.widgetDefaultKey],dataSettings:l[o.widgetDefaultKey]}):Object.assign(e,{data:c,dataSettings:l}),e.viewSettings={},n.forEach((({key:t,value:n})=>e.viewSettings[t]=n))}},757:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchChangeOtherFilters=t.createColorizeItem=t.widgetDefaultKey=void 0;const a=n(764);function o(e){return e||"transparent"}t.widgetDefaultKey="ffed0a4d-4a9d-417f-b502-eb50142c6956",t.createColorizeItem=function(e,t,n){const a=+n.max||0,i=+n.min||0,r=+n.threshold||0,s=n.colorAbove,c=n.colorBelow,l=a-r,d=r-i;return{column:t,getColor(t){if((t=+t||0)>a||t<i)return o();if(t>=r){const n=e.theme.colorize[s]||[];return o(t===a?n[n.length-1]:n[Math.floor((t-r)/l*n.length)])}{const n=e.theme.colorize[c]||[];return o(t===i?n[n.length-1]:n[Math.floor((r-t)/d*n.length)])}}}},t.dispatchChangeOtherFilters=function(e,t){t.forEach((({column_id:t,value:n})=>{const o=function(e,t){if(Array.isArray(e.data))return e.dataSettings;for(let n of Object.values(e.dataSettings))if(n.columns.find((({id:e})=>e===t)))return n;return null}(e,t);if(o&&"function"==typeof o.events.onOtherFilterChange){const e=o.columns.find((({id:e})=>e===t));e&&o.events.onOtherFilterChange({column:e,method:a.FilterMethod.InList,value:n})}}))}},836:(e,t,n)=>{"use strict";t.wD=t.y8=t.JG=void 0;n(764),n(649),n(661),n(386);var a,o;(o=t.JG||(t.JG={})).Table="table",o.Aggregate="aggregate",(a=t.y8||(t.y8={})).Group="group",a.Sum="sum",a.Average="avg",a.Min="min",a.Max="max",a.First="first",a.Last="last",function(e){e.AxisX="sys:axis-x",e.AxisY="sys:axis-y",e.Value="sys:value-column"}(t.wD||(t.wD={}));Symbol()},764:(e,t)=>{"use strict";var n,a,o,i;Object.defineProperty(t,"__esModule",{value:!0}),t.Target=t.SortDirection=t.FilterMethod=t.ColumnType=void 0,(i=t.ColumnType||(t.ColumnType={})).String="string",i.Number="number",i.Boolean="boolean",i.Date="date",i.Array="array",i.Object="object",(o=t.FilterMethod||(t.FilterMethod={})).Equal="equally",o.NotEqual="not_equal",o.GreaterThen="gt",o.LessThen="lt",o.GreaterThenOrEqual="gte",o.LessThenOrEqual="lte",o.Period="period",o.DateList="date_list",o.InList="in_list",o.NotInList="nin_list",o.StartsOnIndex="starts_on_i",o.StartsOn="starts_on",o.EndsOnIndex="ends_on_i",o.EndsOn="ends_on",o.ContainsIndex="contains_i",o.Contains="contains",o.NotContainIndex="not_contain_i",o.NotContain="not_contain",(a=t.SortDirection||(t.SortDirection={})).Asc="ASC",a.Desc="DESC",(n=t.Target||(t.Target={})).Self="self",n.Other="other",n.All="all"},362:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Declare=void 0;const a=n(10),o=n(764),i=n(897),r=n(300),s=n(539),c=n(757);function l(e,t){window.addEventListener("message",(({data:n})=>{n.type===e&&t(n.payload)}))}function d(e,t,n){const a={type:t,token:e,payload:n};window.parent.postMessage(a,"*")}t.Declare=function(e){return(0,a.not)(e)&&(e={provideCssVariables:!1}),t=>{const n=new t,u=function(e){const t="token=",n=window.location.search.split(/[?&]/).find((e=>e.startsWith(t)));return n?n.slice(t.length):""}();Object.assign(n,{viewSettings:{},ready(){d(u,i.Output.Ready)}});const h={setFilter(e,t=o.Target.Self){d(u,i.Output.SetFilter,{filter:e,target:t})},removeFilterAt(e){d(u,i.Output.RemoveFilterAt,{index:e})},setSort(e,t=o.Target.Self){d(u,i.Output.SetSort,{sort:e,target:t})},removeSortAt(e){d(u,i.Output.RemoveSortAt,{index:e})},interact(e){d(u,i.Output.Interact,{dataOptionId:this.id,dataIndex:e})}};let p=!1;return l(i.Input.Change,(e=>{(0,r.provideDataTo)(n,e,h),(0,a.not)(p)&&(p=!0,"function"==typeof n.onInit&&n.onInit()),"function"==typeof n.onChange&&n.onChange()})),l(i.Input.ChangeLang,(e=>{n.lang=e,n.onLangChange&&p&&n.onLangChange()})),l(i.Input.ChangeTheme,(t=>{n.theme=t.theme,e.provideCssVariables&&(0,s.provideCssVariables)(t),n.onThemeChange&&p&&n.onThemeChange()})),l(i.Input.ChangeOtherFilters,(e=>(0,c.dispatchChangeOtherFilters)(n,e))),l(i.Input.ChangeWidgetRenderEnv,(e=>{n.renderEnv=e})),d(u,i.Output.Init),t}}},391:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,o)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(362),t),o(n(830),t)},830:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetRenderEnv=t.Widget=void 0,t.Widget=class{constructor(){this.renderEnv=n.Default}ready(){}onInit(){}onThemeChange(){}onLangChange(){}},function(e){e.Default="default",e.Print="print"}(n=t.WidgetRenderEnv||(t.WidgetRenderEnv={}))}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={exports:{}};return e[a].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";n.r(a),n.d(a,{PolymaticaWidgetLegacy:()=>m});var e=n(10),t=n(279),o=n(391),i=n(836),r=n(764),s=n(649),c=n(757),l=n(897);function d(e){for(const t of e){const e=t.target;switch(t.attributeName){case"render-env":e.renderEnv=e.getAttribute("render-env");break;case"widget-base-path":e.widgetBasePath=e.getAttribute("widget-base-path");break;case"locale":e.locale=e.getAttribute("locale")}}}const u=(e,t,n)=>{const a=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(a)};class h{constructor(e){this.widget=e,this.token=this.createToken(),this.isReady=!1,window.addEventListener("message",(({data:e})=>{e.token===this.token&&this.process(e)}))}get context(){return h.widgetContextMap.get(this.widget)}send(e,t){this.context.iframe.contentWindow?.postMessage({type:e,payload:t},"*")}process(e){switch(e.type){case l.Output.Init:{if(this.isReady)break;this.isReady=!0;const{context:e}=this;this.send(l.Input.ChangeWidgetRenderEnv,e.widgetRenderEnv||o.WidgetRenderEnv.Default),this.send(l.Input.ChangeTheme,e.theme),this.send(l.Input.ChangeLang,e.locale),this.send(l.Input.Change,e.widgetRepresent);break}case l.Output.Ready:u(this.widget,t.EventType.Ready,{});break;case l.Output.SetFilter:{const{filter:n,target:a}=e.payload;if(a===r.Target.Other){const{data_option:e,rows:a}=this.context.widgetRepresent.dataOptionsMap[c.widgetDefaultKey],{column:{path:o,type:i},value:s}=n,l=i===r.ColumnType.Number?Number(s):s;this.context.otherFilterColumnId=n.column.id,u(this.widget,t.EventType.Interact,{datasetId:e.dataset.id,columnId:n.column.id,dataIndex:a.findIndex((e=>e[o]===l))})}break}}}createToken(){return Math.random().toString(16).slice(2)}}var p=n(643),g=n(386);function f({createViewSettings:e,validation:t}){return{options:{render(t){(0,g.viewSettingsExtract)(e({dataSettings:void 0,viewSettings:t})).forEach((e=>{switch(e.type){case g.ViewSettingsItemType.Input:(0,p.fL)({key:e.key,label:e.label,span:e.span});break;case g.ViewSettingsItemType.Checkbox:(0,p.MJ)({key:e.key,label:e.label,span:e.span});break;case g.ViewSettingsItemType.Radio:(0,p.k0)({key:e.key,label:e.label,options:e.options,span:e.span});break;case g.ViewSettingsItemType.Select:(0,p.Ys)({key:e.key,label:e.label,options:e.options,span:e.span});break;case g.ViewSettingsItemType.ColorPicker:(0,p.HN)({key:e.key,label:e.label,span:e.span});break;case g.ViewSettingsItemType.Title:(0,p.TN)(e.label)}}))},default:{},validators:t}}}const y=new WeakMap;h.widgetContextMap=y;class m extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"closed"}),t=document.createElement("iframe"),n=document.createElement("style");n.textContent="\n:host {\n display: block;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n}\n",e.append(n);const a={iframe:t,inited:!1,shadowRoot:e,connector:new h(this),otherFilterColumnId:0};y.set(this,a),function(e){new MutationObserver(d).observe(e,{attributes:!0})}(this)}set renderEnv(e){e===o.WidgetRenderEnv.Print&&v(this,{widgetRenderEnv:e})}set widgetBasePath(n){v(this,{widgetBasePath:n});const a=b(this);!function(t,n){const{widgetBasePath:a}=t;(0,e.not)(a)||fetch(`${a}/view-settings.js`).then((e=>e.text())).then((e=>{if(t.widgetBasePath!==a)return;const o={};Function("exports",e)(o),n({createViewSettings:o.createViewSettings="function"==typeof o.createViewSettings?o.createViewSettings:()=>[],validation:o.validation||{}})})).catch()}(a,(e=>u(this,t.EventType.ConfigProvided,{...w(a),...f(e)})))}set locale(e){v(this,{locale:e})}set uid(e){this._uid=e}get uid(){return this._uid}initFormatterToWindow(e,t){const n=window.format||{};n[t]=n[t]||{},e.columns.forEach((e=>{n[t][e.path]=e.format})),window.format=n}setDataConfig(e){v(this,{dataConfig:e})}provide(e,t){const{dataset:n}=e;this.uid&&this.initFormatterToWindow(n,this.uid);const a=Object.entries(n.columnsByBlock).map((([e,t])=>({key:e,block_type:s.ConfigDataBlockType_Server.Column,function:i.y8.Group,columns:t.map((e=>({column_id:e})))}))),o=n.columns.map((e=>({id:e.id,name:e.name,path:e.path,base_type:e.type})));v(this,{uid:this.uid,widgetRepresent:{dataOptionsMap:{[c.widgetDefaultKey]:{data_option:{key:c.widgetDefaultKey,id:n.datasetId,dataset:{id:n.datasetId,name:"",columns_id:o},method:i.JG.Aggregate,limit_rows:-1,offset:0,blocks:a},rows:n.rows,total:n.rows.length}},viewOptions:Object.entries(t||{}).map((([e,t])=>({key:e,value:t})))}})}provideTheme(e){v(this,{theme:{theme:{background:"rgb(241, 241, 242)",backgroundBright:"rgb(32, 33, 39)",backgroundTint:["rgb(230, 230, 234)","rgb(208, 208, 213)","rgb(163, 163, 172)","rgb(118, 118, 133)","rgb(64, 64, 83)","rgb(32, 33, 39)"],text:"rgb(0, 175, 215)",textTint:["#0d131e","#111827","#1f2937","#374151","#4b5563"],colors:e.palette,colorize:e.heatmap},themeKey:"polymatica",themeProjectKey:"polymatica"}})}highlight(e,t){const{connector:n,otherFilterColumnId:a,widgetRepresent:o}=b(this),i=[],s=o?.dataOptionsMap[c.widgetDefaultKey];if(s){const e=s.data_option.dataset.columns_id.find((({id:e})=>e===a));e&&t.forEach((t=>{t in s.rows&&i.push(s.rows[t][e.path])}))}n.send(l.Input.ChangeOtherFilters,[{column_id:a,value:i,action:r.FilterMethod.InList}])}}function b(e){return y.get(e)}function v(t,n){const a=b(t);Object.assign(a,n);const{iframe:o,inited:i,widgetRepresent:r,locale:s,theme:c,widgetBasePath:d}=a;if(!((0,e.not)(r)||(0,e.not)(s)||(0,e.not)(c)||(0,e.not)(d)))if((0,e.not)(i)){a.inited=!0;let t=d;(0,e.not)(t.endsWith("/"))&&(t+="/"),t+=`index.html?token=${a.connector.token}`,a.uid&&(t+=`&uid=${a.uid}`),o.src=t,a.shadowRoot.append(o)}else{const{connector:e}=a;n.theme&&e.send(l.Input.ChangeTheme,c),n.locale&&e.send(l.Input.ChangeLang,s),n.widgetRepresent&&e.send(l.Input.Change,r)}}function w(t){const n=t.dataConfig;if((0,e.not)(n))return;const a={method:n.method,blocks:[]};return n.blocks.forEach((e=>{switch(e.type){case s.ConfigDataBlockType_Server.Column:a.blocks.push({key:e.key,label:e.label,icon:e.icon,aggregation:Boolean(e.function)&&e.function!==i.y8.Group,max:e.max});break;case s.ConfigDataBlockType_Server.Drilldown:a.drilldown={sources:[(0,s.encodeDrilldownData)(e.key).source]};break;case s.ConfigDataBlockType_Server.Colorizer:a.heatmap={targets:[]}}})),a.validation={requiredSome:n.validation?.required_some,requiredEvery:n.validation?.required_every},{data:a}}customElements.define("polymatica-widget-legacy",m)})(),a})()));
@@ -1,11 +1,13 @@
1
1
  import { WidgetRenderEnv } from 'ptnl-constructor-sdk';
2
2
  import { Locale } from 'ptnl-constructor-sdk/config';
3
+ import { ConfigDataOption_Server } from 'ptnl-constructor-sdk/__internal__/config';
3
4
  import { ThemeProvide } from 'ptnl-constructor-sdk/__internal__/theme';
4
5
  import { WidgetRepresent } from 'ptnl-constructor-sdk/__internal__/widget';
5
6
  import { Connector } from './tools/connector';
6
7
  export declare type UID = string;
7
8
  export interface Context {
8
9
  readonly iframe: HTMLIFrameElement;
10
+ dataConfig?: ConfigDataOption_Server;
9
11
  widgetRepresent?: WidgetRepresent;
10
12
  locale?: Locale;
11
13
  theme?: ThemeProvide;
@@ -1,6 +1,7 @@
1
1
  import { Locale, Options, Theme } from 'polymatica-widget';
2
- import type { WidgetColumn, WidgetData } from 'polymatica-widget-component';
2
+ import { WidgetColumn, WidgetData } from 'polymatica-widget-component';
3
3
  import { WidgetRenderEnv } from 'ptnl-constructor-sdk';
4
+ import { ConfigDataOption_Server } from 'ptnl-constructor-sdk/__internal__/config';
4
5
  import { UID } from './context';
5
6
  declare global {
6
7
  interface Window {
@@ -20,6 +21,7 @@ export declare class PolymaticaWidgetLegacy extends HTMLElement {
20
21
  get uid(): UID;
21
22
  constructor();
22
23
  private initFormatterToWindow;
24
+ setDataConfig(dataConfig: ConfigDataOption_Server): void;
23
25
  provide(data: WidgetData | undefined, options: Options | undefined): void;
24
26
  provideTheme(theme: Theme): void;
25
27
  highlight(_: number, rowIndexArray: number[]): void;
@@ -0,0 +1,7 @@
1
+ import { OptionsConfig } from 'polymatica-widget/config';
2
+ import { CreateViewSettings, ViewSettingsValidation } from 'ptnl-constructor-sdk/config';
3
+ export interface ViewSettings {
4
+ createViewSettings: CreateViewSettings<any>;
5
+ validation: ViewSettingsValidation;
6
+ }
7
+ export declare function createOptionsConfig({ createViewSettings, validation, }: ViewSettings): OptionsConfig;