@genesislcap/design-system-configurator 14.499.0 → 14.500.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -911,7 +911,7 @@
911
911
  ${Vt()}
912
912
  `,jt=void 0,Yt={};class Wt extends a.FoundationElement{constructor(){super(...arguments),this.name="",this.autoPosition=!0,this.search=!0,this.disabled=!1,this.clickOutside=e=>this.handleClickOutside(e),this.open=!1,this.options=[],this.selectedOptions=[],this.position=zt.BELOW}openChanged(e,t){var i,o;t?(document.addEventListener("mousedown",this.clickOutside),null===(i=this.optionsElement)||void 0===i||i.classList.add("visible")):(document.removeEventListener("mousedown",this.clickOutside),null===(o=this.optionsElement)||void 0===o||o.classList.remove("visible"))}connectedCallback(){var e;super.connectedCallback(),this.position===zt.ABOVE&&(null===(e=this.optionsElement)||void 0===e||e.classList.add("position-above"))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.clickOutside)}toggle(){this.open||this.setDropdownPosition(),this.open=!this.open}sortFilteredOptions(e){const t=(null!=e?e:this.options).reduce((e,t)=>{const i=t.type||"Other";return e[i]?e[i].options.push(t):e[i]={type:i,options:[t]},e},{});return Object.values(t)}optionsChanged(){this.filteredAvailableOptions=this.sortFilteredOptions()}setDropdownPosition(){let e=this.position;if(this.autoPosition){let t=this.assignedSlot?this.assignedSlot.parentElement:this.parentElement;for(;t&&!t.classList.contains("content-wrapper");)t=t.parentElement;if(t){const i=t.getBoundingClientRect(),o=this.getBoundingClientRect(),n=i.top+i.height/2;e=o.top<n?zt.BELOW:zt.ABOVE}else{const t=this.getBoundingClientRect(),i=window.innerHeight,o=t.top,n=i-t.bottom;e=n<t.height&&o>n?zt.ABOVE:zt.BELOW}}e===zt.ABOVE?(this.optionsElement.classList.add("position-above"),this.optionsElement.classList.remove("position-below")):e===zt.BELOW&&(this.optionsElement.classList.add("position-below"),this.optionsElement.classList.remove("position-above"))}optionGetter(e){return e.value}getItemLabel(e){let t;return e?(t=e.label||e.value||"",this.valueFormatter?this.valueFormatter(t):t):""}isOptionDisabled(e){return e&&"string"!=typeof e&&e.disabled||!1}get getPlaceholder(){return`Search ${this.name}`.trim().concat("...")}isOptionSelected(e){return this.selectedOptions.includes(this.optionGetter(e))}selectCheckboxOne(e){const t=this.optionGetter(e);this.selectedOptions.includes(t)?(this.selectedOptions=[...this.selectedOptions],this.selectedOptions.splice(this.selectedOptions.indexOf(t),1)):this.selectedOptions=[...this.selectedOptions,t],this.$emit("selectionChange",this.selectedOptions)}setFilter(){const e=this.options.filter(e=>{var t;const i=e.description,o=null!==(t=e.label)&&void 0!==t?t:e.value;return(null==i?void 0:i.toLowerCase().includes(this.filterSearchValue.toLowerCase()))||o.toLowerCase().includes(this.filterSearchValue.toLowerCase())?e:void 0});this.filteredAvailableOptions=this.sortFilteredOptions(e)}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}handleClickOutside(e){E(e,this)&&(this.open=!1)}}(0,C.Cg)([l.attr],Wt.prototype,"name",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"auto-position"})],Wt.prototype,"autoPosition",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],Wt.prototype,"search",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],Wt.prototype,"disabled",void 0),(0,C.Cg)([l.observable],Wt.prototype,"defaultSlottedNodes",void 0),(0,C.Cg)([l.observable],Wt.prototype,"valueFormatter",void 0),(0,C.Cg)([l.observable],Wt.prototype,"filterSearchValue",void 0),(0,C.Cg)([l.observable],Wt.prototype,"open",void 0),(0,C.Cg)([l.observable],Wt.prototype,"options",void 0),(0,C.Cg)([l.observable],Wt.prototype,"selectedOptions",void 0),(0,C.Cg)([l.observable],Wt.prototype,"filteredAvailableOptions",void 0),(0,C.Cg)([l.observable],Wt.prototype,"position",void 0),(0,C.Cg)([l.volatile],Wt.prototype,"getPlaceholder",null);const qt=Wt.compose(Object.assign({baseName:"categorized-multiselect",template:Gt,styles:Bt,shadowOptions:jt},Yt)),Kt=(e,t)=>l.css`
913
913
  ${(0,r.checkboxStyles)(e,t)}
914
- `,Xt=(e,t)=>(0,a.checkboxTemplate)(e,t);class Jt extends r.Checkbox{}const Qt=void 0,Zt={checkedIndicator:'\n <svg\n aria-hidden="true"\n part="checked-indicator"\n class="checked-indicator"\n viewBox="0 0 20 20"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"\n />\n </svg>\n ',indeterminateIndicator:'\n <div part="indeterminate-indicator" class="indeterminate-indicator"></div>\n '},ei=Jt.compose(Object.assign({baseName:"checkbox",template:Xt,styles:Kt,shadowOptions:Qt},Zt));var ti=i(62051),ii=i.n(ti),oi=i(39087),ni=i(87917),si=i(40370),ai=i(6884),ri=i(96730),li=i(21281),di=i(34193),ci=i(41119),ui=i(26347),hi=i(49964),pi=i(12066),mi=i(97156);class gi extends((0,si.C)(a.FoundationElement)){constructor(){super(...arguments),this.withGridInit=!0,this.isSnapshot=!1,this.maxRows=ai.OD.MAX_ROWS_250,this.maxView=ai.OD.MAX_VIEW_1000,this.resourceName="",this.reverse=!1,this.withTimestampFormatting=!0,this.requiresFullDataRefresh=!0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.rowsSyncedWithStream=new Map,this.dataSubWasLoggedOff=!1,this.criteriaFromFilters=new Map,this.update=new mi.t(new Map),this.fetchGeneration=0}criteriaChanged(e,t){const i=e!==(0,ri.Q)(t,";");this.refetchIfInitializedAndChanged(i)}dataChanged(e){e&&(this.clearData(),this.reset())}requestChanged(e,t){const i=JSON.stringify(e)!==JSON.stringify(t);this.refetchIfInitializedAndChanged(i)}refetchIfInitializedAndChanged(e){this.datasource.initialized&&e&&this.fetchGenesisData(null)}set datasourceConfig(e){e&&Object.keys(e).forEach(t=>{void 0!==e[t]&&(this[t]=e[t])})}disconnectedCallback(){var e,t;super.disconnectedCallback(),this.clearData(),null===(e=this.dataSub)||void 0===e||e.unsubscribe(),null===(t=this.update)||void 0===t||t.unsubscribe(),delete this.dataSub,delete this.update,this.datasource.destroy(),delete this.datasource}get effectiveRowId(){var e;return this.rowId?this.rowId:(null===(e=this.datasource)||void 0===e?void 0:e.resourceType)===oi.v.REQUEST_SERVER?ai.OD.REQUEST_SERVER_ROW_ID:ai.OD.DATASERVER_ROW_ID}reset(){this.requiresFullDataRefresh=!0,this.fetchGenesisData()}fetchGenesisData(){return(0,C.sH)(this,arguments,void 0,function*(e=!0){var t,i;null===(t=this.dataSub)||void 0===t||t.unsubscribe(),this.dataSub=void 0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.fetchGeneration+=1;const o=this.fetchGeneration,n=()=>o!==this.fetchGeneration;if(this.data)return void this.syncComponentData(this.data);const s=e||!this.datasource.initialized;s||(this.connect.dataLogoff(this.sourceRef),this.clearData()),this.sourceRef=void 0;const a=yield this.datasource.init(this.datasourceOptions(),s);if(!n())if(a){if(this.isSnapshot){const e=yield this.datasource.snapshot();if(n())return;const t=this.filterSnapshotResult(e);return this.updateRequestPagingState(e,null!==(i=null==t?void 0:t.length)&&void 0!==i?i:0,this.initialRequestOffset()),void this.syncComponentData(t)}ot.debug(`requesting stream for ${this.resourceName}`),this.dataSub=this.datasource.stream.subscribe(e=>{if(n())return;e.DISCONNECTED&&this.handleError({message:`Genesis Datasource disconnected for ${this.resourceName}`,loggerType:"error"}),this.sourceRef=e.SOURCE_REF,"boolean"==typeof e.MORE_ROWS&&(this.moreRowsAvailable=e.MORE_ROWS);const t=e.MESSAGE_TYPE;if(t&&t===li.Go.LOGOFF_ACK)this.dataSubWasLoggedOff=!0;else if(this.dataSubWasLoggedOff=!1,e.ROW){const t=(0,di.d)(e);this.handleStreamUpdate(t)}else this.handleStreamUpdate(e)})}else this.handleError({message:`Genesis Datasource init failed for ${this.resourceName}`,loggerType:"error"})})}initDatasource(){return(0,C.sH)(this,void 0,void 0,function*(){yield this.datasource.init(this.datasourceOptions(),!0)})}canRequestMoreRows(){if(!this.isConnected||!this.datasource||!this.moreRowsAvailable)return!1;switch(this.datasource.resourceType){case oi.v.REQUEST_SERVER:return!0;case oi.v.DATASERVER:return!!this.sourceRef&&!this.dataSubWasLoggedOff;default:return!1}}requestMoreRows(){return(0,C.sH)(this,void 0,void 0,function*(){var e;if(this.canRequestMoreRows())try{if(this.datasource.resourceType===oi.v.DATASERVER)return void(yield this.connect.getMoreRows(this.sourceRef));const t=this.fetchGeneration,i=this.nextRequestOffset;this.moreRowsAvailable=!1;const o=yield this.datasource.snapshot({DETAILS:Object.assign(Object.assign({},null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS),{OFFSET:i})});if(t!==this.fetchGeneration)return;const n=Array.isArray(null==o?void 0:o.REPLY)?o.REPLY:[];this.updateRequestPagingState(o,n.length,i),n.length>0&&this.handleStreamInserts(n)}catch(e){throw this.moreRowsAvailable=!0,this.handleError({message:`Failed to request more rows for ${this.resourceName}`,loggerType:"error",loggerArgs:[e]}),e}})}filterSnapshotResult(e){if(e)return Array.isArray(e)?e:e.REPLY?e.REPLY:e.ROW?(0,di.d)(e).inserts:void 0}updateRequestPagingState(e,t,i){if(Array.isArray(e)||!e)return void(this.moreRowsAvailable=!1);const o=e,n=Number(this.maxRows)||0;this.moreRowsAvailable="boolean"==typeof o.MORE_ROWS?o.MORE_ROWS:t>0&&n>0&&t>=n,this.nextRequestOffset="number"==typeof o.NEXT_OFFSET&&o.NEXT_OFFSET>0?o.NEXT_OFFSET:i+t}initialRequestOffset(){var e,t;return Number(null===(t=null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.OFFSET)||0}datasourceOptions(){return{criteria:this.buildCriteria(),fields:this.fields,isSnapshot:this.isSnapshot,orderBy:this.orderBy,resourceName:this.resourceName,request:this.request,reverse:this.reverse,maxRows:this.maxRows,maxView:this.maxView}}handleStreamUpdate(e){if(!e)return;e.hasOwnProperty("REPLY")?this.applyRequestServerData(e):this.applyDataserverData(e)}applyRequestServerData(e){var t,i;if(!Array.isArray(e.REPLY)||!(null===(t=e.MESSAGE_TYPE)||void 0===t?void 0:t.startsWith("REP_")))return void this.handleError({message:"received invalid RequestServerResult",loggerType:"error",loggerArgs:[e]});if(this.requiresFullDataRefresh)return null===(i=e.REPLY)||void 0===i||i.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)}),void this.syncComponentData(Array.from(this.rowsSyncedWithStream.values()));this.handleStreamInserts(e.REPLY);const o=Array.from(this.rowsSyncedWithStream.values()).filter(t=>!e.REPLY.includes(t));this.handleStreamDeletes(o)}applyDataserverData(e){var t,i,o,n;if(this.requiresFullDataRefresh){null===(t=e.inserts)||void 0===t||t.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)});const i=Array.from(this.rowsSyncedWithStream.values());return void this.syncComponentData(i)}(null===(i=e.inserts)||void 0===i?void 0:i.length)>0&&this.handleStreamInserts(e.inserts),(null===(o=e.deletes)||void 0===o?void 0:o.length)>0&&this.handleStreamDeletes(e.deletes),(null===(n=e.updates)||void 0===n?void 0:n.length)>0&&this.handleStreamUpdates(e.updates)}buildCriteria(){var e;const t=(null===(e=this.criteria)||void 0===e?void 0:e.split(";"))||[];return(0,ri.Q)(t.join(" && "),";")}setFilter(e,t){this.criteriaFromFilters.set(e,t),this.update.next(this.criteriaFromFilters)}removeFilter(e){this.criteriaFromFilters.delete(e),this.update.next(this.criteriaFromFilters)}handleError(e={}){const{message:t,loggerType:i,loggerArgs:o=[]}=e;t&&ot[i](t,...o)}getFieldMetadata(e){var t;return null===(t=this.datasource.fieldMetadata)||void 0===t?void 0:t.find(t=>t.name===e)}getDefaultLabelFormat(e,t){return t===ci.w.DATE||t===ci.w.DATETIME?(0,pi.Ey)(e,t===ci.w.DATETIME):e}}function vi(e,t){var i;const o=new j.b;o.withExpression((new G.K).withField(null!==(i=e.labelField)&&void 0!==i?i:e.valueField).withValue(t).withSerialiser(V.n.containsIgnoreCase).build()),e.baseCriteria?e.criteria=`${e.baseCriteria} && ${o.build()}`:e.criteria=o.build()}var fi;(0,C.Cg)([ui.dm],gi.prototype,"connect",void 0),(0,C.Cg)([hi.yW],gi.prototype,"datasource",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"withGridInit",void 0),(0,C.Cg)([l.attr],gi.prototype,"criteria",void 0),(0,C.Cg)([l.observable],gi.prototype,"data",void 0),(0,C.Cg)([l.attr],gi.prototype,"fields",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"isSnapshot",void 0),(0,C.Cg)([l.attr],gi.prototype,"maxRows",void 0),(0,C.Cg)([l.attr],gi.prototype,"maxView",void 0),(0,C.Cg)([l.attr],gi.prototype,"orderBy",void 0),(0,C.Cg)([l.attr],gi.prototype,"request",void 0),(0,C.Cg)([l.attr],gi.prototype,"resourceName",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"reverse",void 0),(0,C.Cg)([l.attr],gi.prototype,"rowId",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"with-timestamp-formatting"})],gi.prototype,"withTimestampFormatting",void 0);let bi=fi=class extends gi{constructor(){super(...arguments),this.emptyDataLabel="No matching records",this.allowCustomOptions=!1,this.infiniteScroll=!1,this.pageSize=fi.defaultPageSize,this.initalSelectedValueInitialized=!1,this.isSnapshot=!0,this.baseCriteria="",this.listboxElement=null,this.loadingMoreRows=!1,this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.selectOpenChangeHandler=e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.open)&&(this.listboxElement||this.attachListboxScrollListener(),this.topUpVisibleListbox())},this.listboxScrollHandler=()=>{const e=this.listboxElement;if(!e)return;e.scrollTop+e.clientHeight>=e.scrollHeight-fi.scrollLoadThresholdPx&&this.loadNextPage()},this.resizeObserverCallback=e=>{e.forEach(e=>{this.checkOverflow(e.target)})},this.selectChangeHandler=e=>{var t;const i=e.target.value,o=null===(t=this.options)||void 0===t?void 0:t.find(e=>String(e.label)===i);!o&&this.allowCustomOptions&&this.select instanceof r.Combobox?this.select.$emit("value-change",{label:i,value:i}):this.select.$emit("value-change",o)}}initialSelectedValueChanged(e,t){t&&t!==e&&(this.select&&this.getDisplayForValue(t)===String(this.select.value||"")||(this.initalSelectedValueInitialized=!1,this.clearData(),this.fetchData()))}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return(0,C.sH)(this,void 0,void 0,function*(){var t,i;if(e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.optionElement=null!==(i=this.optionElement)&&void 0!==i?i:`${T(this.select)}-option`,this.select.addEventListener("change",this.selectChangeHandler),this.resizeObserver=new ResizeObserver(this.resizeObserverCallback),this.infiniteScroll){if(this.maxRows=this.pageSize>0?this.pageSize:fi.defaultPageSize,this.select.addEventListener("open-change",this.selectOpenChangeHandler),yield this.applyInfiniteScrollFetchMode(),!this.isConnected)return;l.DOM.queueUpdate(()=>this.attachListboxScrollListener())}this.fetchData(),this.valueField||ot.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label (e.g label-field="NAME")')})}disconnectedCallback(){var e;super.disconnectedCallback(),this.resizeObserver.disconnect(),null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null,this.select.removeEventListener("open-change",this.selectOpenChangeHandler),this.select.removeEventListener("change",this.selectChangeHandler)}applyInfiniteScrollFetchMode(){return(0,C.sH)(this,void 0,void 0,function*(){if(this.resourceName&&this.connect.isConnected)try{const e=yield this.resources.getResourceTypeFor(this.resourceName);this.isSnapshot=e!==oi.v.DATASERVER}catch(e){ot.warn(`Unable to determine the resource type for ${this.resourceName}`,e)}})}attachListboxScrollListener(){var e,t,i,o,n,s,a;this.isConnected&&(null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null!==(n=null!==(i=null===(t=this.select)||void 0===t?void 0:t.scrollableListbox)&&void 0!==i?i:null===(o=this.select)||void 0===o?void 0:o.listbox)&&void 0!==n?n:null===(a=null===(s=this.select)||void 0===s?void 0:s.shadowRoot)||void 0===a?void 0:a.querySelector(".listbox"),this.listboxElement?this.listboxElement.addEventListener("scroll",this.listboxScrollHandler):ot.warn("Unable to locate listbox element, infinite scroll will not be available."))}loadNextPage(){return(0,C.sH)(this,void 0,void 0,function*(){if(this.loadingMoreRows||!this.canRequestMoreRows())return;this.loadingMoreRows=!0;const e=this.datasource.resourceType===oi.v.REQUEST_SERVER;try{yield this.requestMoreRows()}catch(e){return void(this.loadingMoreRows=!1)}e&&(this.loadingMoreRows=!1)})}topUpVisibleListbox(){this.infiniteScroll&&requestAnimationFrame(()=>{if(!this.isConnected)return;const e=this.listboxElement;e&&0!==e.clientHeight&&(e.scrollHeight>e.clientHeight||e.scrollHeight!==this.lastTopUpScrollHeight&&(this.lastTopUpScrollHeight=e.scrollHeight,this.loadNextPage()))})}fetchData(){this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&(this.select instanceof r.Combobox&&this.select.async&&this.initialSelectedValue?this.asyncModeIntialization():this.fetchGenesisData())}asyncModeIntialization(){return(0,C.sH)(this,void 0,void 0,function*(){(yield this.datasource.init(this.datasourceOptions(),!0))?vi(this,this.initialSelectedValue):this.handleError({message:`Genesis Datasource async mode initialization failed for ${this.resourceName}`,loggerType:"error"})})}clearData(){this.rowsSyncedWithStream.clear(),this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.loadingMoreRows=!1,this.select&&(Array.from(this.select.children).forEach(e=>{e instanceof fi||this.select.removeChild(e)}),this.select.value="",this.select.initialValue="")}checkOverflow(e){const t=e.shadowRoot.querySelector(".content");t&&(t.scrollWidth>t.clientWidth?e.setAttribute("title",e.textContent):e.removeAttribute("title"))}rowToOption(e){var t;return{value:e[this.valueField],label:this.labelRowFormatter?this.labelRowFormatter(e):this.labelFormatter?this.labelFormatter(e[this.labelField]):this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}}renderListboxOptions(e){e.forEach(({value:e,label:t})=>{const i=document.createElement(this.optionElement);i.textContent=t||e,i.value=e,this.select.appendChild(i),this.resizeObserver.observe(i)})}removeEmptyDataOption(){this.emptyDataOption&&(this.emptyDataOption.remove(),this.emptyDataOption=null)}syncComponentData(e){this.loadingMoreRows=!1;const t=null!=e?e:Array.from(this.rowsSyncedWithStream.values());if(t.length>0){this.removeEmptyDataOption(),this.options=t.map(e=>this.rowToOption(e));const e=0===this.renderedOptionsCount;if(this.renderListboxOptions(this.options.slice(this.renderedOptionsCount)),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox(),!this.initalSelectedValueInitialized||this.select instanceof r.Combobox&&!this.select.async&&e){this.resetCombobox();const e=this.getInitialLabel();l.DOM.queueUpdate(()=>{this.select.value=String(e),this.select instanceof r.Combobox&&this.select.async&&this.selectChangeHandler({target:{value:e}})}),this.initalSelectedValueInitialized=!0}}else if(this.allowCustomOptions&&this.initialSelectedValue&&(!this.initalSelectedValueInitialized||this.select instanceof r.Combobox&&!this.select.async)&&(this.resetCombobox(),l.DOM.queueUpdate(()=>{this.select.value=String(this.initialSelectedValue)}),this.initalSelectedValueInitialized=!0),this.select&&!this.emptyDataOption){const e=document.createElement(this.optionElement);e.textContent=this.emptyDataLabel,e.value="",e.disabled=!0,this.select.appendChild(e),this.emptyDataOption=e}}getInitialLabel(){return this.getDisplayForValue(this.initialSelectedValue)}getDisplayForValue(e){var t;if(null==e||0!==e&&!e)return"";const i=null===(t=this.options)||void 0===t?void 0:t.find(t=>t.value===e);return this.allowCustomOptions&&this.select instanceof r.Combobox?String(i?i.label:e):i?String(i.label):""}resetCombobox(){this.select&&this.select instanceof r.Combobox&&this.select.resetCombobox()}handleStreamInserts(e){var t;if(this.loadingMoreRows=!1,!(null==e?void 0:e.length))return;this.removeEmptyDataOption();const i=e.map(e=>this.rowToOption(e));this.options=[...null!==(t=this.options)&&void 0!==t?t:[],...i],this.renderListboxOptions(i),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox()}handleStreamDeletes(e){ot.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){ot.debug("handleStreamUpdates - Method not implemented.")}};bi.defaultPageSize=20,bi.scrollLoadThresholdPx=32,(0,C.Cg)([ni.ME],bi.prototype,"resources",void 0),(0,C.Cg)([(0,l.attr)({attribute:"label-field"})],bi.prototype,"labelField",void 0),(0,C.Cg)([(0,l.attr)({attribute:"option-element"})],bi.prototype,"optionElement",void 0),(0,C.Cg)([(0,l.attr)({attribute:"value-field"})],bi.prototype,"valueField",void 0),(0,C.Cg)([(0,l.attr)({attribute:"empty-data-label"})],bi.prototype,"emptyDataLabel",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"allow-custom-options"})],bi.prototype,"allowCustomOptions",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"infinite-scroll"})],bi.prototype,"infiniteScroll",void 0),(0,C.Cg)([(0,l.attr)({attribute:"page-size",converter:l.nullableNumberConverter})],bi.prototype,"pageSize",void 0),(0,C.Cg)([l.observable],bi.prototype,"labelFormatter",void 0),(0,C.Cg)([l.observable],bi.prototype,"labelRowFormatter",void 0),(0,C.Cg)([l.observable],bi.prototype,"initialSelectedValue",void 0),bi=fi=(0,C.Cg)([(0,l.customElement)({name:"options-datasource"})],bi);const yi=(e,t)=>l.css`
914
+ `,Xt=(e,t)=>(0,a.checkboxTemplate)(e,t);class Jt extends r.Checkbox{}const Qt=void 0,Zt={checkedIndicator:'\n <svg\n aria-hidden="true"\n part="checked-indicator"\n class="checked-indicator"\n viewBox="0 0 20 20"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"\n />\n </svg>\n ',indeterminateIndicator:'\n <div part="indeterminate-indicator" class="indeterminate-indicator"></div>\n '},ei=Jt.compose(Object.assign({baseName:"checkbox",template:Xt,styles:Kt,shadowOptions:Qt},Zt));var ti=i(62051),ii=i.n(ti),oi=i(39087),ni=i(87917),si=i(40370),ai=i(6884),ri=i(96730),li=i(21281),di=i(34193),ci=i(41119),ui=i(57963),hi=i(49964),pi=i(12066),mi=i(97156);class gi extends((0,si.C)(a.FoundationElement)){constructor(){super(...arguments),this.withGridInit=!0,this.isSnapshot=!1,this.maxRows=ai.OD.MAX_ROWS_250,this.maxView=ai.OD.MAX_VIEW_1000,this.resourceName="",this.reverse=!1,this.withTimestampFormatting=!0,this.requiresFullDataRefresh=!0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.rowsSyncedWithStream=new Map,this.dataSubWasLoggedOff=!1,this.criteriaFromFilters=new Map,this.update=new mi.t(new Map),this.fetchGeneration=0}criteriaChanged(e,t){const i=e!==(0,ri.Q)(t,";");this.refetchIfInitializedAndChanged(i)}dataChanged(e){e&&(this.clearData(),this.reset())}requestChanged(e,t){const i=JSON.stringify(e)!==JSON.stringify(t);this.refetchIfInitializedAndChanged(i)}refetchIfInitializedAndChanged(e){this.datasource.initialized&&e&&this.fetchGenesisData(null)}set datasourceConfig(e){e&&Object.keys(e).forEach(t=>{void 0!==e[t]&&(this[t]=e[t])})}disconnectedCallback(){var e,t;super.disconnectedCallback(),this.clearData(),null===(e=this.dataSub)||void 0===e||e.unsubscribe(),null===(t=this.update)||void 0===t||t.unsubscribe(),delete this.dataSub,delete this.update,this.datasource.destroy(),delete this.datasource}get effectiveRowId(){var e;return this.rowId?this.rowId:(null===(e=this.datasource)||void 0===e?void 0:e.resourceType)===oi.v.REQUEST_SERVER?ai.OD.REQUEST_SERVER_ROW_ID:ai.OD.DATASERVER_ROW_ID}reset(){this.requiresFullDataRefresh=!0,this.fetchGenesisData()}fetchGenesisData(){return(0,C.sH)(this,arguments,void 0,function*(e=!0){var t,i;null===(t=this.dataSub)||void 0===t||t.unsubscribe(),this.dataSub=void 0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.fetchGeneration+=1;const o=this.fetchGeneration,n=()=>o!==this.fetchGeneration;if(this.data)return void this.syncComponentData(this.data);const s=e||!this.datasource.initialized;s||(this.connect.dataLogoff(this.sourceRef),this.clearData()),this.sourceRef=void 0;const a=yield this.datasource.init(this.datasourceOptions(),s);if(!n())if(a){if(this.isSnapshot){const e=yield this.datasource.snapshot();if(n())return;const t=this.filterSnapshotResult(e);return this.updateRequestPagingState(e,null!==(i=null==t?void 0:t.length)&&void 0!==i?i:0,this.initialRequestOffset()),void this.syncComponentData(t)}ot.debug(`requesting stream for ${this.resourceName}`),this.dataSub=this.datasource.stream.subscribe(e=>{if(n())return;e.DISCONNECTED&&this.handleError({message:`Genesis Datasource disconnected for ${this.resourceName}`,loggerType:"error"}),this.sourceRef=e.SOURCE_REF,"boolean"==typeof e.MORE_ROWS&&(this.moreRowsAvailable=e.MORE_ROWS);const t=e.MESSAGE_TYPE;if(t&&t===li.Go.LOGOFF_ACK)this.dataSubWasLoggedOff=!0;else if(this.dataSubWasLoggedOff=!1,e.ROW){const t=(0,di.d)(e);this.handleStreamUpdate(t)}else this.handleStreamUpdate(e)})}else this.handleError({message:`Genesis Datasource init failed for ${this.resourceName}`,loggerType:"error"})})}initDatasource(){return(0,C.sH)(this,void 0,void 0,function*(){yield this.datasource.init(this.datasourceOptions(),!0)})}canRequestMoreRows(){if(!this.isConnected||!this.datasource||!this.moreRowsAvailable)return!1;switch(this.datasource.resourceType){case oi.v.REQUEST_SERVER:return!0;case oi.v.DATASERVER:return!!this.sourceRef&&!this.dataSubWasLoggedOff;default:return!1}}requestMoreRows(){return(0,C.sH)(this,void 0,void 0,function*(){var e;if(this.canRequestMoreRows())try{if(this.datasource.resourceType===oi.v.DATASERVER)return void(yield this.connect.getMoreRows(this.sourceRef));const t=this.fetchGeneration,i=this.nextRequestOffset;this.moreRowsAvailable=!1;const o=yield this.datasource.snapshot({DETAILS:Object.assign(Object.assign({},null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS),{OFFSET:i})});if(t!==this.fetchGeneration)return;const n=Array.isArray(null==o?void 0:o.REPLY)?o.REPLY:[];this.updateRequestPagingState(o,n.length,i),n.length>0&&this.handleStreamInserts(n)}catch(e){throw this.moreRowsAvailable=!0,this.handleError({message:`Failed to request more rows for ${this.resourceName}`,loggerType:"error",loggerArgs:[e]}),e}})}filterSnapshotResult(e){if(e)return Array.isArray(e)?e:e.REPLY?e.REPLY:e.ROW?(0,di.d)(e).inserts:void 0}updateRequestPagingState(e,t,i){if(Array.isArray(e)||!e)return void(this.moreRowsAvailable=!1);const o=e,n=Number(this.maxRows)||0;this.moreRowsAvailable="boolean"==typeof o.MORE_ROWS?o.MORE_ROWS:t>0&&n>0&&t>=n,this.nextRequestOffset="number"==typeof o.NEXT_OFFSET&&o.NEXT_OFFSET>0?o.NEXT_OFFSET:i+t}initialRequestOffset(){var e,t;return Number(null===(t=null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.OFFSET)||0}datasourceOptions(){return{criteria:this.buildCriteria(),fields:this.fields,isSnapshot:this.isSnapshot,orderBy:this.orderBy,resourceName:this.resourceName,request:this.request,reverse:this.reverse,maxRows:this.maxRows,maxView:this.maxView}}handleStreamUpdate(e){if(!e)return;e.hasOwnProperty("REPLY")?this.applyRequestServerData(e):this.applyDataserverData(e)}applyRequestServerData(e){var t,i;if(!Array.isArray(e.REPLY)||!(null===(t=e.MESSAGE_TYPE)||void 0===t?void 0:t.startsWith("REP_")))return void this.handleError({message:"received invalid RequestServerResult",loggerType:"error",loggerArgs:[e]});if(this.requiresFullDataRefresh)return null===(i=e.REPLY)||void 0===i||i.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)}),void this.syncComponentData(Array.from(this.rowsSyncedWithStream.values()));this.handleStreamInserts(e.REPLY);const o=Array.from(this.rowsSyncedWithStream.values()).filter(t=>!e.REPLY.includes(t));this.handleStreamDeletes(o)}applyDataserverData(e){var t,i,o,n;if(this.requiresFullDataRefresh){null===(t=e.inserts)||void 0===t||t.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)});const i=Array.from(this.rowsSyncedWithStream.values());return void this.syncComponentData(i)}(null===(i=e.inserts)||void 0===i?void 0:i.length)>0&&this.handleStreamInserts(e.inserts),(null===(o=e.deletes)||void 0===o?void 0:o.length)>0&&this.handleStreamDeletes(e.deletes),(null===(n=e.updates)||void 0===n?void 0:n.length)>0&&this.handleStreamUpdates(e.updates)}buildCriteria(){var e;const t=(null===(e=this.criteria)||void 0===e?void 0:e.split(";"))||[];return(0,ri.Q)(t.join(" && "),";")}setFilter(e,t){this.criteriaFromFilters.set(e,t),this.update.next(this.criteriaFromFilters)}removeFilter(e){this.criteriaFromFilters.delete(e),this.update.next(this.criteriaFromFilters)}handleError(e={}){const{message:t,loggerType:i,loggerArgs:o=[]}=e;t&&ot[i](t,...o)}getFieldMetadata(e){var t;return null===(t=this.datasource.fieldMetadata)||void 0===t?void 0:t.find(t=>t.name===e)}getDefaultLabelFormat(e,t){return t===ci.w.DATE||t===ci.w.DATETIME?(0,pi.Ey)(e,t===ci.w.DATETIME):e}}function vi(e,t){var i;const o=new j.b;o.withExpression((new G.K).withField(null!==(i=e.labelField)&&void 0!==i?i:e.valueField).withValue(t).withSerialiser(V.n.containsIgnoreCase).build()),e.baseCriteria?e.criteria=`${e.baseCriteria} && ${o.build()}`:e.criteria=o.build()}var fi;(0,C.Cg)([ui.dm],gi.prototype,"connect",void 0),(0,C.Cg)([hi.yW],gi.prototype,"datasource",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"withGridInit",void 0),(0,C.Cg)([l.attr],gi.prototype,"criteria",void 0),(0,C.Cg)([l.observable],gi.prototype,"data",void 0),(0,C.Cg)([l.attr],gi.prototype,"fields",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"isSnapshot",void 0),(0,C.Cg)([l.attr],gi.prototype,"maxRows",void 0),(0,C.Cg)([l.attr],gi.prototype,"maxView",void 0),(0,C.Cg)([l.attr],gi.prototype,"orderBy",void 0),(0,C.Cg)([l.attr],gi.prototype,"request",void 0),(0,C.Cg)([l.attr],gi.prototype,"resourceName",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean"})],gi.prototype,"reverse",void 0),(0,C.Cg)([l.attr],gi.prototype,"rowId",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"with-timestamp-formatting"})],gi.prototype,"withTimestampFormatting",void 0);let bi=fi=class extends gi{constructor(){super(...arguments),this.emptyDataLabel="No matching records",this.allowCustomOptions=!1,this.infiniteScroll=!1,this.pageSize=fi.defaultPageSize,this.initalSelectedValueInitialized=!1,this.isSnapshot=!0,this.baseCriteria="",this.listboxElement=null,this.loadingMoreRows=!1,this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.selectOpenChangeHandler=e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.open)&&(this.listboxElement||this.attachListboxScrollListener(),this.topUpVisibleListbox())},this.listboxScrollHandler=()=>{const e=this.listboxElement;if(!e)return;e.scrollTop+e.clientHeight>=e.scrollHeight-fi.scrollLoadThresholdPx&&this.loadNextPage()},this.resizeObserverCallback=e=>{e.forEach(e=>{this.checkOverflow(e.target)})},this.selectChangeHandler=e=>{var t;const i=e.target.value,o=null===(t=this.options)||void 0===t?void 0:t.find(e=>String(e.label)===i);!o&&this.allowCustomOptions&&this.select instanceof r.Combobox?this.select.$emit("value-change",{label:i,value:i}):this.select.$emit("value-change",o)}}initialSelectedValueChanged(e,t){t&&t!==e&&(this.select&&this.getDisplayForValue(t)===String(this.select.value||"")||(this.initalSelectedValueInitialized=!1,this.clearData(),this.fetchData()))}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return(0,C.sH)(this,void 0,void 0,function*(){var t,i;if(e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.optionElement=null!==(i=this.optionElement)&&void 0!==i?i:`${T(this.select)}-option`,this.select.addEventListener("change",this.selectChangeHandler),this.resizeObserver=new ResizeObserver(this.resizeObserverCallback),this.infiniteScroll){if(this.maxRows=this.pageSize>0?this.pageSize:fi.defaultPageSize,this.select.addEventListener("open-change",this.selectOpenChangeHandler),yield this.applyInfiniteScrollFetchMode(),!this.isConnected)return;l.DOM.queueUpdate(()=>this.attachListboxScrollListener())}this.fetchData(),this.valueField||ot.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label (e.g label-field="NAME")')})}disconnectedCallback(){var e;super.disconnectedCallback(),this.resizeObserver.disconnect(),null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null,this.select.removeEventListener("open-change",this.selectOpenChangeHandler),this.select.removeEventListener("change",this.selectChangeHandler)}applyInfiniteScrollFetchMode(){return(0,C.sH)(this,void 0,void 0,function*(){if(this.resourceName&&this.connect.isConnected)try{const e=yield this.resources.getResourceTypeFor(this.resourceName);this.isSnapshot=e!==oi.v.DATASERVER}catch(e){ot.warn(`Unable to determine the resource type for ${this.resourceName}`,e)}})}attachListboxScrollListener(){var e,t,i,o,n,s,a;this.isConnected&&(null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null!==(n=null!==(i=null===(t=this.select)||void 0===t?void 0:t.scrollableListbox)&&void 0!==i?i:null===(o=this.select)||void 0===o?void 0:o.listbox)&&void 0!==n?n:null===(a=null===(s=this.select)||void 0===s?void 0:s.shadowRoot)||void 0===a?void 0:a.querySelector(".listbox"),this.listboxElement?this.listboxElement.addEventListener("scroll",this.listboxScrollHandler):ot.warn("Unable to locate listbox element, infinite scroll will not be available."))}loadNextPage(){return(0,C.sH)(this,void 0,void 0,function*(){if(this.loadingMoreRows||!this.canRequestMoreRows())return;this.loadingMoreRows=!0;const e=this.datasource.resourceType===oi.v.REQUEST_SERVER;try{yield this.requestMoreRows()}catch(e){return void(this.loadingMoreRows=!1)}e&&(this.loadingMoreRows=!1)})}topUpVisibleListbox(){this.infiniteScroll&&requestAnimationFrame(()=>{if(!this.isConnected)return;const e=this.listboxElement;e&&0!==e.clientHeight&&(e.scrollHeight>e.clientHeight||e.scrollHeight!==this.lastTopUpScrollHeight&&(this.lastTopUpScrollHeight=e.scrollHeight,this.loadNextPage()))})}fetchData(){this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&(this.select instanceof r.Combobox&&this.select.async&&this.initialSelectedValue?this.asyncModeIntialization():this.fetchGenesisData())}asyncModeIntialization(){return(0,C.sH)(this,void 0,void 0,function*(){(yield this.datasource.init(this.datasourceOptions(),!0))?vi(this,this.initialSelectedValue):this.handleError({message:`Genesis Datasource async mode initialization failed for ${this.resourceName}`,loggerType:"error"})})}clearData(){this.rowsSyncedWithStream.clear(),this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.loadingMoreRows=!1,this.select&&(Array.from(this.select.children).forEach(e=>{e instanceof fi||this.select.removeChild(e)}),this.select.value="",this.select.initialValue="")}checkOverflow(e){const t=e.shadowRoot.querySelector(".content");t&&(t.scrollWidth>t.clientWidth?e.setAttribute("title",e.textContent):e.removeAttribute("title"))}rowToOption(e){var t;return{value:e[this.valueField],label:this.labelRowFormatter?this.labelRowFormatter(e):this.labelFormatter?this.labelFormatter(e[this.labelField]):this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}}renderListboxOptions(e){e.forEach(({value:e,label:t})=>{const i=document.createElement(this.optionElement);i.textContent=t||e,i.value=e,this.select.appendChild(i),this.resizeObserver.observe(i)})}removeEmptyDataOption(){this.emptyDataOption&&(this.emptyDataOption.remove(),this.emptyDataOption=null)}syncComponentData(e){this.loadingMoreRows=!1;const t=null!=e?e:Array.from(this.rowsSyncedWithStream.values());if(t.length>0){this.removeEmptyDataOption(),this.options=t.map(e=>this.rowToOption(e));const e=0===this.renderedOptionsCount;if(this.renderListboxOptions(this.options.slice(this.renderedOptionsCount)),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox(),!this.initalSelectedValueInitialized||this.select instanceof r.Combobox&&!this.select.async&&e){this.resetCombobox();const e=this.getInitialLabel();l.DOM.queueUpdate(()=>{this.select.value=String(e),this.select instanceof r.Combobox&&this.select.async&&this.selectChangeHandler({target:{value:e}})}),this.initalSelectedValueInitialized=!0}}else if(this.allowCustomOptions&&this.initialSelectedValue&&(!this.initalSelectedValueInitialized||this.select instanceof r.Combobox&&!this.select.async)&&(this.resetCombobox(),l.DOM.queueUpdate(()=>{this.select.value=String(this.initialSelectedValue)}),this.initalSelectedValueInitialized=!0),this.select&&!this.emptyDataOption){const e=document.createElement(this.optionElement);e.textContent=this.emptyDataLabel,e.value="",e.disabled=!0,this.select.appendChild(e),this.emptyDataOption=e}}getInitialLabel(){return this.getDisplayForValue(this.initialSelectedValue)}getDisplayForValue(e){var t;if(null==e||0!==e&&!e)return"";const i=null===(t=this.options)||void 0===t?void 0:t.find(t=>t.value===e);return this.allowCustomOptions&&this.select instanceof r.Combobox?String(i?i.label:e):i?String(i.label):""}resetCombobox(){this.select&&this.select instanceof r.Combobox&&this.select.resetCombobox()}handleStreamInserts(e){var t;if(this.loadingMoreRows=!1,!(null==e?void 0:e.length))return;this.removeEmptyDataOption();const i=e.map(e=>this.rowToOption(e));this.options=[...null!==(t=this.options)&&void 0!==t?t:[],...i],this.renderListboxOptions(i),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox()}handleStreamDeletes(e){ot.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){ot.debug("handleStreamUpdates - Method not implemented.")}};bi.defaultPageSize=20,bi.scrollLoadThresholdPx=32,(0,C.Cg)([ni.ME],bi.prototype,"resources",void 0),(0,C.Cg)([(0,l.attr)({attribute:"label-field"})],bi.prototype,"labelField",void 0),(0,C.Cg)([(0,l.attr)({attribute:"option-element"})],bi.prototype,"optionElement",void 0),(0,C.Cg)([(0,l.attr)({attribute:"value-field"})],bi.prototype,"valueField",void 0),(0,C.Cg)([(0,l.attr)({attribute:"empty-data-label"})],bi.prototype,"emptyDataLabel",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"allow-custom-options"})],bi.prototype,"allowCustomOptions",void 0),(0,C.Cg)([(0,l.attr)({mode:"boolean",attribute:"infinite-scroll"})],bi.prototype,"infiniteScroll",void 0),(0,C.Cg)([(0,l.attr)({attribute:"page-size",converter:l.nullableNumberConverter})],bi.prototype,"pageSize",void 0),(0,C.Cg)([l.observable],bi.prototype,"labelFormatter",void 0),(0,C.Cg)([l.observable],bi.prototype,"labelRowFormatter",void 0),(0,C.Cg)([l.observable],bi.prototype,"initialSelectedValue",void 0),bi=fi=(0,C.Cg)([(0,l.customElement)({name:"options-datasource"})],bi);const yi=(e,t)=>l.css`
915
915
  .combo-box-indicator {
916
916
  transition-property: transform;
917
917
  transition-duration: 0.2s;
@@ -301,7 +301,7 @@
301
301
  `)}
302
302
  </grid-pro-column>
303
303
  `)}
304
- `}},35610(e,a,r){r.d(a,{ML:()=>C,NC:()=>b,S5:()=>x,W_:()=>y,yu:()=>z});var t=r(55823),o=r(17465),i=r(26347),n=r(41119),l=r(6884),g=r(40370),s=r(49964),d=r(39087),c=r(96730),p=r(33681),u=r(38370),h=r(97156),v=r(79270),m=r(32610),f=r(55365),w=r(18070);const b=";",y=" && ";class z extends((0,g.C)(u.FoundationElement)){constructor(){super(...arguments),this.isSnapshot=!1,this.maxRows=l.OD.MAX_ROWS_250,this.maxView=l.OD.MAX_VIEW_1000,this.movingView=!1,this.reverse=!1,this.disablePolling=!1,this.offset=l.OD.DEFAULT_REQ_REP_OFFSET,this.pollingInterval=l.OD.REQ_REP_POLLING_INTERVAL_MS,this.pollTriggerEvents=[],this.requestAutoSetup=!0,this.restartOnReconnection=!0,this.criteriaFromFilters=new Map,this.update=new h.t(new Map)}get rowId(){return this.rowIdAttr?this.rowIdAttr:this.isRequestServer?l.OD.REQUEST_SERVER_ROW_ID:l.OD.DATASERVER_ROW_ID}get hasDefaultRowId(){return!this.rowIdAttr||this.rowIdAttr===l.OD.REQUEST_SERVER_ROW_ID||this.rowIdAttr===l.OD.DATASERVER_ROW_ID}get defaultRowIdByResourceType(){return this.isRequestServer?l.OD.REQUEST_SERVER_ROW_ID:l.OD.DATASERVER_ROW_ID}datasourceOptions(){return{criteria:this.buildCriteria(),isSnapshot:this.isSnapshot,maxRows:+this.maxRows,orderBy:this.orderBy,resourceName:this.resourceName,viewNumber:+this.viewNumber,fields:this.fields,maxView:+this.maxView,movingView:this.movingView,reverse:this.reverse,disablePolling:this.disablePolling,offset:this.offset,pollingInterval:this.pollingInterval,pollTriggerEvents:this.pollTriggerEvents,request:this.request,requestAutoSetup:this.requestAutoSetup}}buildCriteria(){var e;const a=((null===(e=this.criteria)||void 0===e?void 0:e.split(b))||[]).concat(Array.from(this.criteriaFromFilters.values())),r=(0,c.Q)(a.join(y),b);return r||void 0}setFilter(e,a){this.criteriaFromFilters.set(e,a),this.update.next(this.criteriaFromFilters)}removeFilter(e){this.criteriaFromFilters.delete(e),this.update.next(this.criteriaFromFilters)}get isRequestServer(){var e;return(null===(e=this.datasource.status)||void 0===e?void 0:e.type)===d.v.REQUEST_SERVER}datasourceStatusChanged(e,a){}handleErrors(e,a="unknown"){let r;if(Array.isArray(e)){r=e.map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"TEXT"in e?e.TEXT:String(e)).join(", ")}else r="string"==typeof e?e:String(e);r&&(o.v.error(`${a}: ${r}`),this.$emit(w.L.error,{message:r,type:a}),this.$emit(v.c.error,{message:r,type:a}))}clearErrors(){this.$emit(w.L.connected)}initializeDatasource(e){return(0,t.sH)(this,arguments,void 0,function*(e,a=!0,r=!0){try{if(yield this.datasource.init(e,a,r))return this.clearErrors(),!0;{const a=e.resourceName;if(a)if(this.connect.isConnected){(yield this.connect.getMetadata(a).catch(()=>null))?this.handleErrors(`Failed to initialize datasource for ${a}`,"unknown"):this.handleErrors(`Resource '${a}' does not exist on ${this.connect.host}`,"resource-validation")}else this.handleErrors(`Unable to connect to ${this.connect.host}`,"connection");else this.handleErrors("Resource name is required","resource-validation");return!1}}catch(e){let a="Unknown initialization error",r="unknown";return e instanceof Error&&(a=e.message,a.includes("connect")||a.includes("connection")?r="connection":a.includes("resource")||a.includes("does not exist")?r="resource-validation":a.includes("metadata")?r="metadata":a.includes("stream")?r="stream":a.includes("criteria")&&(r="criteria")),this.handleErrors(a,r),!1}})}}var x;(0,t.Cg)([i.dm],z.prototype,"connect",void 0),(0,t.Cg)([s.yW],z.prototype,"datasource",void 0),(0,t.Cg)([p.observable],z.prototype,"deferredGridOptions",void 0),(0,t.Cg)([p.observable],z.prototype,"deferredColumnStates",void 0),(0,t.Cg)([p.observable],z.prototype,"rowDataMapper",void 0),(0,t.Cg)([p.attr],z.prototype,"criteria",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"is-snapshot"})],z.prototype,"isSnapshot",void 0),(0,t.Cg)([(0,p.attr)({attribute:"max-rows",converter:p.nullableNumberConverter})],z.prototype,"maxRows",void 0),(0,t.Cg)([(0,p.attr)({attribute:"order-by"})],z.prototype,"orderBy",void 0),(0,t.Cg)([(0,p.attr)({attribute:"resource-name"})],z.prototype,"resourceName",void 0),(0,t.Cg)([(0,p.attr)({attribute:"view-number",converter:p.nullableNumberConverter})],z.prototype,"viewNumber",void 0),(0,t.Cg)([p.attr],z.prototype,"fields",void 0),(0,t.Cg)([(0,p.attr)({attribute:"max-view",converter:p.nullableNumberConverter})],z.prototype,"maxView",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"moving-view"})],z.prototype,"movingView",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean"})],z.prototype,"reverse",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"disable-polling"})],z.prototype,"disablePolling",void 0),(0,t.Cg)([(0,p.attr)({converter:p.nullableNumberConverter})],z.prototype,"offset",void 0),(0,t.Cg)([(0,p.attr)({attribute:"polling-interval"})],z.prototype,"pollingInterval",void 0),(0,t.Cg)([p.observable],z.prototype,"pollTriggerEvents",void 0),(0,t.Cg)([p.observable],z.prototype,"request",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"request-auto-setup"})],z.prototype,"requestAutoSetup",void 0),(0,t.Cg)([(0,p.attr)({attribute:"row-id"})],z.prototype,"rowIdAttr",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"restart-on-reconnection"})],z.prototype,"restartOnReconnection",void 0),(0,t.Cg)([p.volatile],z.prototype,"isRequestServer",null),function(e){e.Add="add",e.Update="update",e.Remove="remove"}(x||(x={}));class C extends z{constructor(){super(...arguments),this.dataSubWasLoggedOff=!1,this.keepColDefsOnClearRowData=!1,this.rowData=new Map,this.transactionData={add:[],remove:[],update:[]},this._isDisconnected=!1}subscribeToConnection(){var e;this.connect&&this.connect.isConnected$&&(null===(e=this.connectionSub)||void 0===e||e.unsubscribe(),this.connectionSub=this.connect.isConnected$.subscribe(e=>{e&&this.isDisconnected()?(this.setDisconnected(!1),this.restartOnReconnection&&this.reloadResourceData()):e||this.setDisconnected(!0)}))}unsubscribeFromConnection(){var e;null===(e=this.connectionSub)||void 0===e||e.unsubscribe(),this.connectionSub=void 0}generateColumnDefsFromMetadata(e,a,r){return null==e?void 0:e.flatMap(e=>{const t={};switch(t.filterParams=a(e),e.type){case n.w.STRING:t.cellEditor=f.IX.stringEditor;break;case n.w.NUMBER:t.cellEditor=f.IX.numberEditor;break;case n.w.BOOLEAN:t.cellRenderer=f.IX.boolean,t.cellEditor=f.IX.boolean;break;case n.w.DATE:t.valueFormatter=m.sL,t.cellEditor=f.IX.dateEditor;break;case n.w.DATETIME:t.valueFormatter=m.XV,t.cellEditor=f.IX.dateEditor,t.cellEditorParams={withTime:!0};break;case n.w.ENUM:e.enumOptions?(t.cellEditor=f.IX.selectEditor,t.cellEditorParams={values:e.enumOptions.map(e=>({value:e,label:e})),valueField:"value",labelField:"label"}):o.v.warn(`No enumOptions found for field ${e.name}. Default cell editor applied.`)}return this.fields&&!this.fields.includes(e.name)?[]:Object.assign({field:e.name,type:(0,m.nh)(e.type),filter:r(e.type)},t)})}handleStreamInserts(e,a=0){let r=a;null==e||e.forEach(e=>{const t=e[this.rowId];if(!t)return void o.v.warn("Attempted to insert row without valid rowId",e);if(this.rowData.has(t)||this.dataSubWasLoggedOff){const a=this.rowData.get(t),r=Object.assign(Object.assign({},a),e);this.transactionData.update.push(r),this.rowData.set(t,r)}else this.transactionData.add.push(e),this.transactionData.addIndex=r,this.rowData.set(t,e),a>0&&(r+=1)})}handleStreamDeletes(e){null==e||e.forEach(e=>{if(this.hasDefaultRowId||this.isRequestServer)this.transactionData.remove.push({[this.rowId]:e[this.rowId]});else{const a=Object.values(Object.fromEntries(this.rowData)).find(a=>a[this.defaultRowIdByResourceType]===e[this.defaultRowIdByResourceType]);this.transactionData.remove.push({[this.rowId]:a[this.rowId]})}this.rowData.delete(e[this.rowId])})}handleStreamUpdates(e){null==e||e.forEach(e=>{let a;if(this.hasDefaultRowId||this.isRequestServer){const r=this.rowData.get(e[this.rowId]);a=Object.assign(Object.assign({},r),e),this.transactionData.update.push(a)}else{const r=Object.values(Object.fromEntries(this.rowData)).find(a=>a[this.defaultRowIdByResourceType]===e[this.defaultRowIdByResourceType]);a=Object.assign(Object.assign({},r),e),this.transactionData.update.push(a)}this.rowData.set(e[this.rowId],a)})}applyAllTransactions(){var e,a,r,t,o,i;if(!(null===(e=this.transactionData.add)||void 0===e?void 0:e.length)&&!(null===(a=this.transactionData.update)||void 0===a?void 0:a.length)&&!(null===(r=this.transactionData.remove)||void 0===r?void 0:r.length))return this.$emit(v.c.loadingFinished),void(0===this.rowData.size&&this.$emit(v.c.noDataAvailable));(null===(t=this.transactionData.add)||void 0===t?void 0:t.length)>0&&this.applyMappedTransaction({add:this.transactionData.add,addIndex:this.transactionData.addIndex},x.Add),(null===(o=this.transactionData.remove)||void 0===o?void 0:o.length)>0&&this.applyMappedTransaction({remove:this.transactionData.remove},x.Remove),(null===(i=this.transactionData.update)||void 0===i?void 0:i.length)>0&&this.applyMappedTransaction({update:this.transactionData.update},x.Update)}applyMappedTransaction(e,a){const r=this.mapTransaction(e,[a]);this.$emit(v.c.dataChanged,{changes:r})}applyTransaction(e){throw new Error("Method not implemented.")}mapTransaction(e,a=Object.values(x)){if(!this.rowDataMapper)return e;const r={};return a.includes(x.Add)&&(r.add=this.rowDataMapper(e.add,this.rowData)),a.includes(x.Remove)&&(r.remove=this.rowDataMapper(e.remove,this.rowData)),a.includes(x.Update)&&(r.update=this.rowDataMapper(e.update,this.rowData)),void 0!==e.addIndex&&(r.addIndex=e.addIndex),r}loadMore(){throw new Error("loadMore() method must be implemented by subclass")}setVisibleColumns(e){}restart(){throw new Error("restart() method must be implemented by subclass")}reloadResourceData(){throw new Error("reloadResourceData() method must be implemented by subclass")}destroy(){throw new Error("destroy() method must be implemented by subclass")}setDisconnected(e){this._isDisconnected=e,e?this.$emit(v.c.error,{message:"Datasource disconnected",type:"connection"}):this.clearErrors()}isDisconnected(){return this._isDisconnected}getStatusBarActionConfig(e){return"boolean"==typeof e?{enabled:e}:"object"==typeof e&&null!==e?{enabled:!0,config:e}:{enabled:!1}}getDatasourceStatusBarPanels(e,a){var r,t,o,i,n,l;const g=[],s=this.getStatusBarActionConfig(null==a?void 0:a.loadMore);if(s.enabled&&!e){const e={};(null===(r=s.config)||void 0===r?void 0:r.onLoadMore)?e.onLoadMore=s.config.onLoadMore:e.onLoadMore=this.loadMore.bind(this),(null===(t=s.config)||void 0===t?void 0:t.appearance)&&(e.appearance=s.config.appearance),e.tooltip=(null===(o=s.config)||void 0===o?void 0:o.tooltip)||"Load More",g.push({statusPanel:f.k7.loadMore,statusPanelParams:e,align:this.pagination?"left":"right"})}const d=this.getStatusBarActionConfig(null==a?void 0:a.reload);if(d.enabled){const e={};(null===(i=d.config)||void 0===i?void 0:i.onReload)?e.onReload=d.config.onReload:e.onReload=this.reloadResourceData.bind(this),(null===(n=d.config)||void 0===n?void 0:n.icon)&&(e.icon=d.config.icon),e.tooltip=(null===(l=d.config)||void 0===l?void 0:l.tooltip)||"Reload",g.push({statusPanel:f.k7.reload,statusPanelParams:e,align:"right"})}return g}}},18070(e,a,r){r.d(a,{L:()=>t});const t={error:"base-datasource-error",connected:"base-datasource-connected"}},63296(e,a,r){r.d(a,{L:()=>n});var t=r(55823),o=r(33681),i=r(26062);let n=class extends i.D{};n=(0,t.Cg)([(0,o.customElement)({name:"grid-pro-client-side-datasource"})],n)},30335(e,a,r){r.d(a,{B:()=>i,P:()=>n});var t=r(33681),o=r(68858);const i=t.css`
304
+ `}},35610(e,a,r){r.d(a,{ML:()=>C,NC:()=>b,S5:()=>x,W_:()=>y,yu:()=>z});var t=r(55823),o=r(17465),i=r(57963),n=r(41119),l=r(6884),g=r(40370),s=r(49964),d=r(39087),c=r(96730),p=r(33681),u=r(38370),h=r(97156),v=r(79270),m=r(32610),f=r(55365),w=r(18070);const b=";",y=" && ";class z extends((0,g.C)(u.FoundationElement)){constructor(){super(...arguments),this.isSnapshot=!1,this.maxRows=l.OD.MAX_ROWS_250,this.maxView=l.OD.MAX_VIEW_1000,this.movingView=!1,this.reverse=!1,this.disablePolling=!1,this.offset=l.OD.DEFAULT_REQ_REP_OFFSET,this.pollingInterval=l.OD.REQ_REP_POLLING_INTERVAL_MS,this.pollTriggerEvents=[],this.requestAutoSetup=!0,this.restartOnReconnection=!0,this.criteriaFromFilters=new Map,this.update=new h.t(new Map)}get rowId(){return this.rowIdAttr?this.rowIdAttr:this.isRequestServer?l.OD.REQUEST_SERVER_ROW_ID:l.OD.DATASERVER_ROW_ID}get hasDefaultRowId(){return!this.rowIdAttr||this.rowIdAttr===l.OD.REQUEST_SERVER_ROW_ID||this.rowIdAttr===l.OD.DATASERVER_ROW_ID}get defaultRowIdByResourceType(){return this.isRequestServer?l.OD.REQUEST_SERVER_ROW_ID:l.OD.DATASERVER_ROW_ID}datasourceOptions(){return{criteria:this.buildCriteria(),isSnapshot:this.isSnapshot,maxRows:+this.maxRows,orderBy:this.orderBy,resourceName:this.resourceName,viewNumber:+this.viewNumber,fields:this.fields,maxView:+this.maxView,movingView:this.movingView,reverse:this.reverse,disablePolling:this.disablePolling,offset:this.offset,pollingInterval:this.pollingInterval,pollTriggerEvents:this.pollTriggerEvents,request:this.request,requestAutoSetup:this.requestAutoSetup}}buildCriteria(){var e;const a=((null===(e=this.criteria)||void 0===e?void 0:e.split(b))||[]).concat(Array.from(this.criteriaFromFilters.values())),r=(0,c.Q)(a.join(y),b);return r||void 0}setFilter(e,a){this.criteriaFromFilters.set(e,a),this.update.next(this.criteriaFromFilters)}removeFilter(e){this.criteriaFromFilters.delete(e),this.update.next(this.criteriaFromFilters)}get isRequestServer(){var e;return(null===(e=this.datasource.status)||void 0===e?void 0:e.type)===d.v.REQUEST_SERVER}datasourceStatusChanged(e,a){}handleErrors(e,a="unknown"){let r;if(Array.isArray(e)){r=e.map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"TEXT"in e?e.TEXT:String(e)).join(", ")}else r="string"==typeof e?e:String(e);r&&(o.v.error(`${a}: ${r}`),this.$emit(w.L.error,{message:r,type:a}),this.$emit(v.c.error,{message:r,type:a}))}clearErrors(){this.$emit(w.L.connected)}initializeDatasource(e){return(0,t.sH)(this,arguments,void 0,function*(e,a=!0,r=!0){try{if(yield this.datasource.init(e,a,r))return this.clearErrors(),!0;{const a=e.resourceName;if(a)if(this.connect.isConnected){(yield this.connect.getMetadata(a).catch(()=>null))?this.handleErrors(`Failed to initialize datasource for ${a}`,"unknown"):this.handleErrors(`Resource '${a}' does not exist on ${this.connect.host}`,"resource-validation")}else this.handleErrors(`Unable to connect to ${this.connect.host}`,"connection");else this.handleErrors("Resource name is required","resource-validation");return!1}}catch(e){let a="Unknown initialization error",r="unknown";return e instanceof Error&&(a=e.message,a.includes("connect")||a.includes("connection")?r="connection":a.includes("resource")||a.includes("does not exist")?r="resource-validation":a.includes("metadata")?r="metadata":a.includes("stream")?r="stream":a.includes("criteria")&&(r="criteria")),this.handleErrors(a,r),!1}})}}var x;(0,t.Cg)([i.dm],z.prototype,"connect",void 0),(0,t.Cg)([s.yW],z.prototype,"datasource",void 0),(0,t.Cg)([p.observable],z.prototype,"deferredGridOptions",void 0),(0,t.Cg)([p.observable],z.prototype,"deferredColumnStates",void 0),(0,t.Cg)([p.observable],z.prototype,"rowDataMapper",void 0),(0,t.Cg)([p.attr],z.prototype,"criteria",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"is-snapshot"})],z.prototype,"isSnapshot",void 0),(0,t.Cg)([(0,p.attr)({attribute:"max-rows",converter:p.nullableNumberConverter})],z.prototype,"maxRows",void 0),(0,t.Cg)([(0,p.attr)({attribute:"order-by"})],z.prototype,"orderBy",void 0),(0,t.Cg)([(0,p.attr)({attribute:"resource-name"})],z.prototype,"resourceName",void 0),(0,t.Cg)([(0,p.attr)({attribute:"view-number",converter:p.nullableNumberConverter})],z.prototype,"viewNumber",void 0),(0,t.Cg)([p.attr],z.prototype,"fields",void 0),(0,t.Cg)([(0,p.attr)({attribute:"max-view",converter:p.nullableNumberConverter})],z.prototype,"maxView",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"moving-view"})],z.prototype,"movingView",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean"})],z.prototype,"reverse",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"disable-polling"})],z.prototype,"disablePolling",void 0),(0,t.Cg)([(0,p.attr)({converter:p.nullableNumberConverter})],z.prototype,"offset",void 0),(0,t.Cg)([(0,p.attr)({attribute:"polling-interval"})],z.prototype,"pollingInterval",void 0),(0,t.Cg)([p.observable],z.prototype,"pollTriggerEvents",void 0),(0,t.Cg)([p.observable],z.prototype,"request",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"request-auto-setup"})],z.prototype,"requestAutoSetup",void 0),(0,t.Cg)([(0,p.attr)({attribute:"row-id"})],z.prototype,"rowIdAttr",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"restart-on-reconnection"})],z.prototype,"restartOnReconnection",void 0),(0,t.Cg)([p.volatile],z.prototype,"isRequestServer",null),function(e){e.Add="add",e.Update="update",e.Remove="remove"}(x||(x={}));class C extends z{constructor(){super(...arguments),this.dataSubWasLoggedOff=!1,this.keepColDefsOnClearRowData=!1,this.rowData=new Map,this.transactionData={add:[],remove:[],update:[]},this._isDisconnected=!1}subscribeToConnection(){var e;this.connect&&this.connect.isConnected$&&(null===(e=this.connectionSub)||void 0===e||e.unsubscribe(),this.connectionSub=this.connect.isConnected$.subscribe(e=>{e&&this.isDisconnected()?(this.setDisconnected(!1),this.restartOnReconnection&&this.reloadResourceData()):e||this.setDisconnected(!0)}))}unsubscribeFromConnection(){var e;null===(e=this.connectionSub)||void 0===e||e.unsubscribe(),this.connectionSub=void 0}generateColumnDefsFromMetadata(e,a,r){return null==e?void 0:e.flatMap(e=>{const t={};switch(t.filterParams=a(e),e.type){case n.w.STRING:t.cellEditor=f.IX.stringEditor;break;case n.w.NUMBER:t.cellEditor=f.IX.numberEditor;break;case n.w.BOOLEAN:t.cellRenderer=f.IX.boolean,t.cellEditor=f.IX.boolean;break;case n.w.DATE:t.valueFormatter=m.sL,t.cellEditor=f.IX.dateEditor;break;case n.w.DATETIME:t.valueFormatter=m.XV,t.cellEditor=f.IX.dateEditor,t.cellEditorParams={withTime:!0};break;case n.w.ENUM:e.enumOptions?(t.cellEditor=f.IX.selectEditor,t.cellEditorParams={values:e.enumOptions.map(e=>({value:e,label:e})),valueField:"value",labelField:"label"}):o.v.warn(`No enumOptions found for field ${e.name}. Default cell editor applied.`)}return this.fields&&!this.fields.includes(e.name)?[]:Object.assign({field:e.name,type:(0,m.nh)(e.type),filter:r(e.type)},t)})}handleStreamInserts(e,a=0){let r=a;null==e||e.forEach(e=>{const t=e[this.rowId];if(!t)return void o.v.warn("Attempted to insert row without valid rowId",e);if(this.rowData.has(t)||this.dataSubWasLoggedOff){const a=this.rowData.get(t),r=Object.assign(Object.assign({},a),e);this.transactionData.update.push(r),this.rowData.set(t,r)}else this.transactionData.add.push(e),this.transactionData.addIndex=r,this.rowData.set(t,e),a>0&&(r+=1)})}handleStreamDeletes(e){null==e||e.forEach(e=>{if(this.hasDefaultRowId||this.isRequestServer)this.transactionData.remove.push({[this.rowId]:e[this.rowId]});else{const a=Object.values(Object.fromEntries(this.rowData)).find(a=>a[this.defaultRowIdByResourceType]===e[this.defaultRowIdByResourceType]);this.transactionData.remove.push({[this.rowId]:a[this.rowId]})}this.rowData.delete(e[this.rowId])})}handleStreamUpdates(e){null==e||e.forEach(e=>{let a;if(this.hasDefaultRowId||this.isRequestServer){const r=this.rowData.get(e[this.rowId]);a=Object.assign(Object.assign({},r),e),this.transactionData.update.push(a)}else{const r=Object.values(Object.fromEntries(this.rowData)).find(a=>a[this.defaultRowIdByResourceType]===e[this.defaultRowIdByResourceType]);a=Object.assign(Object.assign({},r),e),this.transactionData.update.push(a)}this.rowData.set(e[this.rowId],a)})}applyAllTransactions(){var e,a,r,t,o,i;if(!(null===(e=this.transactionData.add)||void 0===e?void 0:e.length)&&!(null===(a=this.transactionData.update)||void 0===a?void 0:a.length)&&!(null===(r=this.transactionData.remove)||void 0===r?void 0:r.length))return this.$emit(v.c.loadingFinished),void(0===this.rowData.size&&this.$emit(v.c.noDataAvailable));(null===(t=this.transactionData.add)||void 0===t?void 0:t.length)>0&&this.applyMappedTransaction({add:this.transactionData.add,addIndex:this.transactionData.addIndex},x.Add),(null===(o=this.transactionData.remove)||void 0===o?void 0:o.length)>0&&this.applyMappedTransaction({remove:this.transactionData.remove},x.Remove),(null===(i=this.transactionData.update)||void 0===i?void 0:i.length)>0&&this.applyMappedTransaction({update:this.transactionData.update},x.Update)}applyMappedTransaction(e,a){const r=this.mapTransaction(e,[a]);this.$emit(v.c.dataChanged,{changes:r})}applyTransaction(e){throw new Error("Method not implemented.")}mapTransaction(e,a=Object.values(x)){if(!this.rowDataMapper)return e;const r={};return a.includes(x.Add)&&(r.add=this.rowDataMapper(e.add,this.rowData)),a.includes(x.Remove)&&(r.remove=this.rowDataMapper(e.remove,this.rowData)),a.includes(x.Update)&&(r.update=this.rowDataMapper(e.update,this.rowData)),void 0!==e.addIndex&&(r.addIndex=e.addIndex),r}loadMore(){throw new Error("loadMore() method must be implemented by subclass")}setVisibleColumns(e){}restart(){throw new Error("restart() method must be implemented by subclass")}reloadResourceData(){throw new Error("reloadResourceData() method must be implemented by subclass")}destroy(){throw new Error("destroy() method must be implemented by subclass")}setDisconnected(e){this._isDisconnected=e,e?this.$emit(v.c.error,{message:"Datasource disconnected",type:"connection"}):this.clearErrors()}isDisconnected(){return this._isDisconnected}getStatusBarActionConfig(e){return"boolean"==typeof e?{enabled:e}:"object"==typeof e&&null!==e?{enabled:!0,config:e}:{enabled:!1}}getDatasourceStatusBarPanels(e,a){var r,t,o,i,n,l;const g=[],s=this.getStatusBarActionConfig(null==a?void 0:a.loadMore);if(s.enabled&&!e){const e={};(null===(r=s.config)||void 0===r?void 0:r.onLoadMore)?e.onLoadMore=s.config.onLoadMore:e.onLoadMore=this.loadMore.bind(this),(null===(t=s.config)||void 0===t?void 0:t.appearance)&&(e.appearance=s.config.appearance),e.tooltip=(null===(o=s.config)||void 0===o?void 0:o.tooltip)||"Load More",g.push({statusPanel:f.k7.loadMore,statusPanelParams:e,align:this.pagination?"left":"right"})}const d=this.getStatusBarActionConfig(null==a?void 0:a.reload);if(d.enabled){const e={};(null===(i=d.config)||void 0===i?void 0:i.onReload)?e.onReload=d.config.onReload:e.onReload=this.reloadResourceData.bind(this),(null===(n=d.config)||void 0===n?void 0:n.icon)&&(e.icon=d.config.icon),e.tooltip=(null===(l=d.config)||void 0===l?void 0:l.tooltip)||"Reload",g.push({statusPanel:f.k7.reload,statusPanelParams:e,align:"right"})}return g}}},18070(e,a,r){r.d(a,{L:()=>t});const t={error:"base-datasource-error",connected:"base-datasource-connected"}},63296(e,a,r){r.d(a,{L:()=>n});var t=r(55823),o=r(33681),i=r(26062);let n=class extends i.D{};n=(0,t.Cg)([(0,o.customElement)({name:"grid-pro-client-side-datasource"})],n)},30335(e,a,r){r.d(a,{B:()=>i,P:()=>n});var t=r(33681),o=r(68858);const i=t.css`
305
305
  .overlay {
306
306
  position: absolute;
307
307
  inset: 0;
@@ -402,7 +402,7 @@
402
402
  </${r}>
403
403
  </div>
404
404
  `)}
405
- `}},24638(e,a,r){r.d(a,{X:()=>T});var t=r(55823),o=r(96730),i=r(48707),n=r(21281),l=r(34193),g=r(49964),s=r(21409),d=r(52945),c=r(49229),p=r(33681),u=r(90509),h=r(79270),v=r(1510),m=r(35610),f=r(41119),w=r(32610);function b(e){switch(null==e?void 0:e.toLowerCase()){case"int":case"long":case"double":case"bigdecimal":case"number":return"agNumberColumnFilter";case"date":case"datetime":return"agDateColumnFilter";case"enum":return"agSetColumnFilter";default:return"agTextColumnFilter"}}function y(e){switch(e.type){case f.w.BOOLEAN:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["contains",{displayKey:"true",displayName:"True",predicate:(e,a)=>"true"===a||!0===a,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:(e,a)=>"false"===a||!1===a,numberOfInputs:0},{displayKey:"true-false",displayName:"True/False",predicate:(e,a)=>"true"===a||!0===a||"false"===a||!1===a,numberOfInputs:0}]};case f.w.ENUM:return(0,w.O7)(e,b(e.type));case f.w.DATE:case f.w.DATETIME:return{comparator:(e,a)=>{if(!a)return-1;const r=new Date(a).setHours(0,0,0,0),t=e.getTime();return r===t?0:r<t?-1:r>t?1:void 0},buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,browserDatePicker:!0,filterOptions:["equals","lessThan","greaterThan","inRange",{displayKey:"isToday",displayName:"Is today",numberOfInputs:0,predicate:()=>!0},"blank","notBlank"]};case f.w.NUMBER:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"]};default:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["contains","equals","notEqual",{displayKey:"wordStartsWith",displayName:"Word starts with",numberOfInputs:1,predicate:()=>!0},"blank","notBlank"]}}}var z=r(17465),x=r(49874),C=r(40113),k=r(26347),S=r(32808);class D{constructor(e){var a;this.rowData=new Map,this.serverRowsCount=0,this.clientRowsCount=0,this.moreRows=!1,this.calculatedRowsCount=0,this.currentSequenceId=null,this.criteriaRowCountResolved=!1,this.reloadResourceDataFunc=e.reloadResourceDataFunc,this.errorHandlerFunc=e.errorHandlerFunc,this.onNoDataAvailableFunc=e.onNoDataAvailableFunc,this.onDataAvailableFunc=e.onDataAvailableFunc,this.resourceName=e.resourceName,this.resourceParams=e.resourceParams,this.originalCriteriaMatch=this.getResourceParam("CRITERIA_MATCH"),this.resourceIndexes=e.resourceIndexes,this.resourceColDefs=e.resourceColDefs,this.maxRows=e.maxRows,this.maxView=e.maxView,this.rowId=e.rowId,this.pagination=e.pagination,this.zeroBasedViewNumber=e.zeroBasedViewNumber,this.pagingMode=e.pagingMode,this.criteriaOnlyRequest=null!==(a=e.criteriaOnlyRequest)&&void 0!==a&&a}getResourceParam(e){var a,r;return(null===(a=this.resourceParams)||void 0===a?void 0:a.DETAILS)&&"object"==typeof this.resourceParams.DETAILS?this.resourceParams.DETAILS[e]:null===(r=this.resourceParams)||void 0===r?void 0:r[e]}setResourceParam(e,a){var r;(null===(r=this.resourceParams)||void 0===r?void 0:r.DETAILS)&&"object"==typeof this.resourceParams.DETAILS?this.resourceParams.DETAILS[e]=a:this.resourceParams[e]=a}getRows(e){throw new Error("Method not implemented.")}setupFiltering(e){return(0,t.sH)(this,void 0,void 0,function*(){const a=e.request.filterModel,r=Object.keys(a).length>0,t=0===Object.keys(a).length,o=JSON.stringify(a)!==JSON.stringify(this.currentFilterModel);if(o||r){if(t&&this.currentFilterModel)return this.currentFilterModel=null,this.setResourceParam("CRITERIA_MATCH",this.originalCriteriaMatch),yield this.refreshDatasource(e),!0;if(o&&r)return this.currentFilterModel=a,this.setResourceParam("CRITERIA_MATCH",this.buildCriteriaMatchFromFilters()),yield this.refreshDatasource(e),!0}return!1})}setupFilteringAndSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){yield this.setupFiltering(e),yield this.setupSorting(e)})}destroy(){this.rowData=new Map,this.clientRowsCount=0,this.calculatedRowsCount=0,this.serverRowsCount=0,this.currentSequenceId=0,this.moreRows=!1,this.sourceRef=void 0,this.lastSuccessRowData=void 0,this.criteriaRowCountResolved=!1}refreshDatasource(e){return(0,t.sH)(this,void 0,void 0,function*(){this.destroy(),this.updateResourceParams(e),yield this.reloadResourceDataFunc({criteria:this.getResourceParam("CRITERIA_MATCH"),orderBy:this.getResourceParam("ORDER_BY"),reverse:this.getResourceParam("REVERSE")})})}updateResourceParams(e){void 0!==e.criteria&&(this.originalCriteriaMatch=e.criteria,this.setResourceParam("CRITERIA_MATCH",this.buildCriteriaMatchFromFilters())),void 0!==e.orderBy&&this.setResourceParam("ORDER_BY",e.orderBy),void 0!==e.reverse&&this.setResourceParam("REVERSE",e.reverse)}getOrderByAndToBeSortedColIds(e,a){for(const[r,t]of e.entries()){const e=t.findIndex(e=>e===a);if(-1!==e){return{orderBy:r,toBeSorted:[...t].splice(e,1)}}}}buildCriteriaMatchFromFilters(){this.setResourceParam("CRITERIA_MATCH",this.originalCriteriaMatch);let e=this.getResourceParam("CRITERIA_MATCH");e&&"string"==typeof e&&(e=e.split(";"),this.setResourceParam("CRITERIA_MATCH",e)),e||(e=[],this.setResourceParam("CRITERIA_MATCH",e));return e.concat(this.criteriaFromFilters()).join(" && ")}criteriaFromFilters(){const e=[];return this.getFiltersByType("text").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("set").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("number").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("date").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("multi").forEach(a=>{var r;const t=null!==(r=this.currentFilterModel[a].filterModels)&&void 0!==r?r:[],o="OR"===(this.currentFilterModel[a].operator||"AND").toUpperCase()?" || ":" && ",i=t.map(e=>this.criteriaForSingleModel(a,e)).filter(e=>!!e);1===i.length?e.push(i[0]):i.length>1&&e.push(`(${i.join(o)})`)}),e}criteriaForSingleModel(e,a){if(!a)return null;switch(a.filterType){case"text":return this.criteriaForTextModel(e,a);case"set":return this.criteriaForSetModel(e,a);case"number":return this.criteriaForNumberModel(e,a);case"date":return this.criteriaForDateModel(e,a);default:return null}}criteriaForTextModel(e,a){const r=a.type,t=a.filter;if(!t&&("false"===r||"true"===r))return`${e} == ${r}`;const o=t?String(t).replace(/'/g,"\\'"):"";switch(r){case"blank":return`(${e} == '' || ${e} == null)`;case"contains":return`Expr.containsIgnoreCase(${e}, '${o}')`;case"equals":return`${e} == '${o}'`;case"notBlank":return`(${e} != '' && ${e} != null)`;case"notEqual":return`${e} != '${o}'`;case"wordStartsWith":return`Expr.containsWordsStartingWithIgnoreCase(${e}, '${o}')`;default:return null}}criteriaForSetModel(e,a){var r,t;const o=null!==(r=a.values)&&void 0!==r?r:[];if(!o.length)return null;const i=null===(t=this.resourceColDefs)||void 0===t?void 0:t.find(a=>a.NAME===e);let n;if(null==i?void 0:i.VALID_VALUES)try{n=Array.isArray(i.VALID_VALUES)?i.VALID_VALUES:i.VALID_VALUES.split("|")}catch(e){n=void 0}if(n&&n.length===o.length&&n.every(e=>o.includes(e)))return null;const l=o.map(a=>{const r=String(a).replace(/'/g,"\\'");return`${e} == '${r}'`});return l.length?`(${l.join(" || ")})`:null}criteriaForNumberModel(e,a){const r=a.filter,t=a.filterTo,o=e=>null!==e&&""!==e&&!isNaN(Number(e));switch(a.type){case"equals":return o(r)?`${e} == ${r}`:null;case"notEqual":return o(r)?`${e} != ${r}`:null;case"greaterThan":return o(r)?`${e} > ${r}`:null;case"greaterThanOrEqual":return o(r)?`${e} >= ${r}`:null;case"lessThan":return o(r)?`${e} < ${r}`:null;case"lessThanOrEqual":return o(r)?`${e} <= ${r}`:null;case"inRange":return o(r)&&o(t)?`${e} >= ${r} && ${e} <= ${t}`:null;case"blank":return`${e} == 0`;case"notBlank":return`${e} != 0`;default:return null}}criteriaForDateModel(e,a){var r,t;const o=null===(r=a.dateFrom)||void 0===r?void 0:r.replace(/-/g,"").replace("T","-").split(" ")[0],i=null===(t=a.dateTo)||void 0===t?void 0:t.replace(/-/g,"").replace("T","-").split(" ")[0];switch(a.type){case"equals":return`Expr.dateIsEqual(${e}, '${o}')`;case"lessThan":return`Expr.dateIsBefore(${e}, '${o}')`;case"greaterThan":return`Expr.dateIsAfter(${e}, '${o}')`;case"inRange":return`Expr.dateIsAfter(${e}, '${o}') && Expr.dateIsBefore(${e}, '${i}')`;case"isToday":{const a=new Date;return`Expr.dateIsEqual(${e}, '${a.getFullYear()}-${(a.getMonth()+1).toString().padStart(2,"0")}-${a.getDate().toString().padStart(2,"0")} 00:00:00')`}case"blank":return`${e} == null`;case"notBlank":return`${e} != null`;default:return null}}getFiltersByType(e){var a;return Object.keys(null!==(a=this.currentFilterModel)&&void 0!==a?a:{}).filter(e=>-1!==this.resourceColDefs.findIndex(a=>a.NAME===e)).filter(a=>this.currentFilterModel[a].filterType===e)}getPageNumber(e,a,r,t=!0){void 0!==r&&e>r&&(e=Math.floor((r-1)/a)*a+1);const o=Math.ceil(e/a);return t?o:o+1}getCorrectRowCount(e){const a=e.request.endRow;this.calculatedRowsCount=this.clientRowsCount||a;const r=Math.min(this.serverRowsCount,this.maxView);let t;const o=this.getResourceParam("CRITERIA_MATCH");if(this.pagination){if(t=o?void 0:Math.min(this.serverRowsCount,this.maxView),o){const e=this.rowData.size;t=e>0?Math.min(e,this.maxView):r}return t}return t=this.moreRows?this.rowData.size>=this.maxView?this.maxView:void 0:Math.min(this.rowData.size,this.maxView),t}get isNotFirstViewNumber(){return this.zeroBasedViewNumber?this.currentSequenceId>0:this.currentSequenceId>1}completeEmptyResult(e){var a,r;if(null===(r=null===(a=this.lastSuccessRowData)||void 0===a?void 0:a.rowData)||void 0===r?void 0:r.length)return void e.success(this.lastSuccessRowData);this.rowData=new Map;const t={rowData:[],rowCount:0};e.success(t),this.notifyNoDataAvailableIfEmpty(e,t)}notifyNoDataAvailableIfEmpty(e,a){var r;const t=!(null===(r=a.rowData)||void 0===r?void 0:r.length),o=0===e.request.startRow;o&&t?this.notifyNoDataAvailable():o&&!t&&this.notifyDataAvailable()}notifyNoDataAvailable(){var e;null===(e=this.onNoDataAvailableFunc)||void 0===e||e.call(this)}notifyDataAvailable(){var e;null===(e=this.onDataAvailableFunc)||void 0===e||e.call(this)}getEffectivePagingMode(){return this.pagingMode?"offsetBased"!==this.pagingMode||this.criteriaOnlyRequest?this.pagingMode:(z.v.warn("offsetBased paging mode requires criteriaOnlyRequest support. Falling back to viewBased mode."),"viewBased"):this.criteriaOnlyRequest?"offsetBased":"viewBased"}}(0,t.Cg)([C.N],D.prototype,"auth",void 0),(0,t.Cg)([k.dm],D.prototype,"connect",void 0),(0,t.Cg)([S.k],D.prototype,"uuid",void 0);class A extends D{constructor(e){super(e),this.pendingBlocks=new Set,this.deliveredRowCount=0,this.createDataserverStreamFunc=e.createDataserverStreamFunc}refreshDatasource(e){const a=Object.create(null,{refreshDatasource:{get:()=>super.refreshDatasource}});return(0,t.sH)(this,void 0,void 0,function*(){var r;this.cancelAllPendingBlocks(),null===(r=this.dataserverStreamSubscription)||void 0===r||r.unsubscribe(),this.dataserverStreamSubscription=void 0,this.dataserverStream=void 0,this.deliveredRowCount=0,yield a.refreshDatasource.call(this,e)})}getRows(e){return(0,t.sH)(this,void 0,void 0,function*(){var a,r;if(yield this.setupFiltering(e))return void e.fail();if(yield this.setupSorting(e))return void e.fail();if(this.pagination&&!this.isNewPageSize&&this.currentSequenceId>0){if(JSON.stringify(null!==(a=e.request.filterModel)&&void 0!==a?a:{})===JSON.stringify(null!==(r=this.currentFilterModel)&&void 0!==r?r:{})&&this.lastSuccessRowData)return void e.success(this.lastSuccessRowData)}this.dataserverStream||(this.dataserverStream=yield this.createDataserverStreamFunc(this.resourceParams));const o=Number.isFinite(Number(e.request.startRow))?Number(e.request.startRow):0,i=Number.isFinite(Number(e.request.endRow))?Number(e.request.endRow):o+Number(this.maxRows),l=!this.pagination&&this.currentSequenceId>=1&&(this.rowData.size>=i||!this.moreRows);if(this.currentSequenceId>=1&&!l&&(this.moreRows||e.request.startRow>=Number(this.maxRows))){if(this.pagination){const a=Number.isFinite(Number(e.request.startRow))?Number(e.request.startRow):0;this.resourceParams.VIEW_NUMBER=this.getPageNumber(a,this.maxRows,this.maxView,this.zeroBasedViewNumber)}const a=this.pagination?this.resourceParams.VIEW_NUMBER:Number.isFinite(Number(this.resourceParams.VIEW_NUMBER))?Number(this.resourceParams.VIEW_NUMBER):0;Number.isFinite(a)&&this.connect.getMoreRows(this.sourceRef,a)}let g=!0;const s=e=>{void 0!==e&&clearTimeout(e)},d={handle:()=>{},cancel:()=>{}},c=()=>{this.pendingBlocks.delete(d)},u=a=>{if(!g)return;g=!1,s(a),c(),this.pagination||(this.deliveredRowCount=Math.max(this.deliveredRowCount,i));const r=Array.from(this.rowData.values()),t={rowData:this.pagination?r:r.slice(o,i)};t.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=t,e.success(t),this.notifyNoDataAvailableIfEmpty(e,t)},h=a=>{g&&(g=!1,s(a),c(),e.fail())};if(l)return void u();const v=setTimeout(()=>{g&&(z.v.warn(`SSRM block ${o}-${i} for ${this.resourceName} timed out waiting for a full batch; resolving with ${this.rowData.size} accumulated row(s).`),u(v))},A.BLOCK_RESOLVE_TIMEOUT_MS);d.cancel=()=>h(v),d.handle=a=>{var r;const o=null==a?void 0:a.MESSAGE_TYPE;if(!o||o!==n.Go.LOGOFF_ACK&&o!==n.Go.MSG_NACK){if(this.pagination){const o=null===(r=null==a?void 0:a.ROW)||void 0===r?void 0:r.length;if(!(g||o>0&&0===this.rowData.size))return;return void p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){var r,t;if(g||o>0&&0===this.rowData.size){if(g=!1,s(v),this.resourceParams.CRITERIA_MATCH&&!this.criteriaRowCountResolved){const e=yield this.connect.snapshot(this.resourceName,{MAX_ROWS:this.maxView,MAX_VIEW:this.maxView,CRITERIA_MATCH:this.resourceParams.CRITERIA_MATCH});if(e.ROW||e.ROWS_COUNT){const a=null!==(r=e.ROWS_COUNT)&&void 0!==r?r:0,o=null===(t=e.ROW)||void 0===t?void 0:t.length;this.serverRowsCount=void 0!==o?Math.max(a,o):a,this.criteriaRowCountResolved=!0}else z.v.warn("No data returned when criteria is applied."),this.serverRowsCount=0,this.clientRowsCount=0}this.applyServerSideData(e,a),c()}}))}if(g)return 0!==this.currentSequenceId||(null==a?void 0:a.ROW)||this.moreRows?void((this.rowData.size>=i||!this.moreRows)&&p.DOM.queueUpdate(()=>u(v))):(g=!1,s(v),c(),void this.completeEmptyResult(e))}else{if(this.errorHandlerFunc){const e=o===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}h(v)}},this.pendingBlocks.add(d),this.ensureStreamSubscription()})}cancelAllPendingBlocks(){const e=Array.from(this.pendingBlocks);this.pendingBlocks.clear();for(const a of e)a.cancel()}ensureStreamSubscription(){this.dataserverStreamSubscription||(this.dataserverStreamSubscription=this.dataserverStream.subscribe(e=>this.dispatchStreamMessage(e)))}dispatchStreamMessage(e){var a;const r=null==e?void 0:e.MESSAGE_TYPE;if(!r||r!==n.Go.LOGOFF_ACK&&r!==n.Go.MSG_NACK){if(!this.pagination&&(void 0!==(null==e?void 0:e.MORE_ROWS)&&(this.moreRows=e.MORE_ROWS),null==e?void 0:e.ROW)){const r=(0,l.d)(e,this.rowId);this.handleCurrentStreamLoad(r),this.currentSequenceId=e.SEQUENCE_ID,1===this.currentSequenceId&&(this.sourceRef=e.SOURCE_REF,0===this.serverRowsCount&&(this.serverRowsCount=null!==(a=e.ROWS_COUNT)&&void 0!==a?a:this.rowData.size))}for(const a of this.pendingBlocks)a.handle(e)}else for(const a of this.pendingBlocks)a.handle(e)}applyServerSideData(e,a){var r;const t=a.MESSAGE_TYPE;if(t&&(t===n.Go.LOGOFF_ACK||t===n.Go.MSG_NACK)){if(this.errorHandlerFunc){const e=t===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}return void e.fail()}if(this.moreRows=a.MORE_ROWS,!a.ROW){if(this.currentSequenceId>=1&&this.rowData.size>0){const a={rowData:Array.from(this.rowData.values()),rowCount:this.getCorrectRowCount(e)};return this.lastSuccessRowData=a,void e.success(a)}return void this.completeEmptyResult(e)}{const e=(0,l.d)(a,this.rowId);this.handleCurrentStreamLoad(e)}this.currentSequenceId=a.SEQUENCE_ID,1===this.currentSequenceId&&(this.sourceRef=a.SOURCE_REF,0===this.serverRowsCount&&(this.serverRowsCount=null!==(r=a.ROWS_COUNT)&&void 0!==r?r:this.rowData.size));const o={rowData:Array.from(this.rowData.values())};o.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=o,e.success(o),this.notifyNoDataAvailableIfEmpty(e,o)}setupSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){var a,r,t;const o=e.request.sortModel;if((null===(a=this.currentSortModel)||void 0===a?void 0:a.length)!==o.length||o.length>0){if(0===o.length&&this.currentSortModel)return this.calculatedRowsCount=0,this.currentSortModel=null,this.resourceParams.ORDER_BY=null,this.resourceParams.REVERSE=null,yield this.refreshDatasource(e),!0;if(o.length>0){const a=o[0].colId,i=o[0].sort,n=this.getOrderByAndToBeSortedColIds(this.resourceIndexes,a);if(!n){const i=(0,x.i)(this.resourceIndexes),n=(0,x.P)(this.resourceIndexes);z.v.warn(`The FIELD/column (${a}) being sorted is not part of an INDEX, required for the [orderBy] operation - ignoring this sort and loading unsorted data. See https://learn.genesis.global/docs/database/data-types/index-entities/`),z.v.debug("Available indexes:",i),z.v.debug("Columns that can be sorted with the available indexes:",n);const l=JSON.stringify(o)!==JSON.stringify(this.currentSortModel),g=(null!==(t=null===(r=this.currentSortModel)||void 0===r?void 0:r.length)&&void 0!==t?t:0)>0,s=null!=this.resourceParams.ORDER_BY||null!=this.resourceParams.REVERSE;return this.currentSortModel=o,!!(g&&l&&s)&&(this.resourceParams.ORDER_BY=null,this.resourceParams.REVERSE=null,yield this.refreshDatasource(e),!0)}if(JSON.stringify(o)!==JSON.stringify(this.currentSortModel))return this.currentSortModel=o,this.resourceParams.ORDER_BY=n.orderBy,this.resourceParams.REVERSE="desc"===i,yield this.refreshDatasource(e),!0}}return!1})}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return(0,t.sH)(this,void 0,void 0,function*(){var a;this.cancelAllPendingBlocks(),this.dataserverStream=void 0,null===(a=this.dataserverStreamSubscription)||void 0===a||a.unsubscribe(),this.dataserverStreamSubscription=void 0,this.deliveredRowCount=0,yield e.destroy.call(this)})}handleCurrentStreamLoad(e){var a,r,t,o,i;if(!e)return;const n=this.pagination?new Map:new Map(this.rowData);null===(a=e.inserts)||void 0===a||a.forEach(e=>{n.set(e[this.rowId],e)}),null===(r=e.updates)||void 0===r||r.forEach(e=>{const a=null==e?void 0:e[this.rowId];if(void 0===a)return;const r=n.get(a);n.set(a,r?Object.assign(Object.assign({},r),e):e)}),null===(t=e.deletes)||void 0===t||t.forEach(e=>{const a=null==e?void 0:e[this.rowId];if(void 0!==a){if(!this.pagination&&this.deliveredRowCount>0){let e=0;for(const r of n.keys()){if(r===a){if(e<this.deliveredRowCount)return;break}e+=1}}n.delete(a)}}),this.clientRowsCount+=null!==(i=null===(o=e.inserts)||void 0===o?void 0:o.length)&&void 0!==i?i:0,this.rowData=n}}A.BLOCK_RESOLVE_TIMEOUT_MS=1e4;var R=r(62051),M=r.n(R);class E extends D{constructor(e){var a,r,t,o,i;super(e),this.discoveredTotalRowCount=null,this.currentNextOffset=0,this.createReqRepRequestFunc=e.createReqRepRequestFunc,this.createReqRepStreamFunc=e.createReqRepStreamFunc,this.onPollingUpdate=e.onPollingUpdateFunc,this.resetPreviousPollResult=e.resetPreviousPollResultFunc,this.usePolling=null!==(a=e.usePolling)&&void 0!==a&&a,this.debouncedCreateStream=M()(e=>this.createPollingStream(e),300);"viewBased"===this.getEffectivePagingMode()?(null===(t=null===(r=e.resourceParams)||void 0===r?void 0:r.DETAILS)||void 0===t?void 0:t.VIEW_NUMBER)||(this.resourceParams.DETAILS.VIEW_NUMBER=this.zeroBasedViewNumber?0:1):(null===(i=null===(o=e.resourceParams)||void 0===o?void 0:o.DETAILS)||void 0===i?void 0:i.OFFSET)||(this.resourceParams.DETAILS.OFFSET=0)}getRows(e){return(0,t.sH)(this,void 0,void 0,function*(){if(yield this.setupFiltering(e))return void e.fail();if(yield this.setupSorting(e))return void e.fail();if(this.pagination&&!this.isNewPageSize&&this.currentSequenceId>0)return void e.success(this.lastSuccessRowData);const a=this.getEffectivePagingMode();this.updatePaginationParams(e,a);const r={DETAILS:this.buildRequestDetails(a)},t=yield this.createReqRepRequestFunc(r),o=yield this.determineIsLastView(t,r,a);this.applyServerSideData(e,t,o),this.schedulePollingStream(r)})}updatePaginationParams(e,a){"viewBased"===a?null!==this.currentSequenceId&&this.currentSequenceId>=0&&this.moreRows&&(this.pagination?this.resourceParams.DETAILS.VIEW_NUMBER=this.getPageNumber(e.request.startRow,this.maxRows,void 0,this.zeroBasedViewNumber):this.resourceParams.DETAILS.VIEW_NUMBER+=1):this.resourceParams.DETAILS.OFFSET=e.request.startRow}determineIsLastView(e,a,r){return(0,t.sH)(this,void 0,void 0,function*(){var t;const o="MORE_ROWS"in e;let i=!1;if("viewBased"===r){if(o)i=!e.MORE_ROWS;else if(-1!==e.NEXT_VIEW){const r=Object.assign(Object.assign({},a),{DETAILS:Object.assign(Object.assign({},a.DETAILS),{VIEW_NUMBER:e.NEXT_VIEW})}),o=yield this.createReqRepRequestFunc(r);i=-1===o.NEXT_VIEW&&0===(null===(t=o.REPLY)||void 0===t?void 0:t.length)}}else i=o&&!e.MORE_ROWS,"NEXT_OFFSET"in e&&-1!==e.NEXT_OFFSET?this.currentNextOffset=e.NEXT_OFFSET:this.currentNextOffset=0;return i})}schedulePollingStream(e){this.usePolling&&this.createReqRepStreamFunc&&(this.destroyPollingStream(),this.debouncedCreateStream(e))}applyServerSideData(e,a,r){var t,o,i;const l=a.MESSAGE_TYPE;if(l&&(l===n.Go.LOGOFF_ACK||l===n.Go.MSG_NACK)){if(this.errorHandlerFunc){const e=l===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}return void e.fail()}const g=this.getEffectivePagingMode();if(this.moreRows="MORE_ROWS"in a?a.MORE_ROWS:"viewBased"===g?!r&&-1!==a.NEXT_VIEW&&a.NEXT_VIEW>this.resourceParams.DETAILS.VIEW_NUMBER:!r&&-1!==a.NEXT_OFFSET&&a.NEXT_OFFSET>this.resourceParams.DETAILS.OFFSET,!(null===(t=a.REPLY)||void 0===t?void 0:t.length))return void this.completeEmptyResult(e);if(this.handleCurrentStreamLoad(a.REPLY),this.currentSequenceId="viewBased"===g?this.resourceParams.DETAILS.VIEW_NUMBER:Math.floor(this.resourceParams.DETAILS.OFFSET/this.maxRows),this.sourceRef=a.SOURCE_REF,!this.moreRows){const a=this.rowData.size;this.discoveredTotalRowCount=e.request.startRow+a}this.pagination?this.serverRowsCount=null!==(o=a.ROWS_COUNT)&&void 0!==o?o:this.rowData.size:this.serverRowsCount+=null!==(i=a.ROWS_COUNT)&&void 0!==i?i:this.rowData.size;const s={rowData:Array.from(this.rowData.values())};s.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=s,e.success(s),this.notifyNoDataAvailableIfEmpty(e,s)}getCorrectRowCount(e){let a;return this.pagination,a=this.moreRows?-1:this.discoveredTotalRowCount||e.request.startRow+this.rowData.size,a}handleCurrentStreamLoad(e){if(!e||0==e.length)return;const a=new Map;e.forEach(e=>{const r=e[this.rowId];if(r)return void a.set(r,e);const t=`The specified rowId (${this.rowId}) is not present in the data. Since this is a snapshot (isSnapshot=true), an auto-generated UUID will be used. For custom identifiers, use the 'row-id' attribute.`;v.v.error(t);const o=this.uuid.createId();e[this.rowId]=o,a.set(o,e)}),this.rowData=a}setupSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){var a;const r=e.request.sortModel;if((null===(a=this.currentSortModel)||void 0===a?void 0:a.length)!==r.length||r.length>0){if(0===r.length&&this.currentSortModel)return this.calculatedRowsCount=0,this.currentSortModel=null,this.resourceParams.DETAILS.ORDER_BY=void 0,yield this.refreshDatasource(e),!0;if(r.length>0){const a=r[0].colId,t=r[0].sort;if(JSON.stringify(r)!==JSON.stringify(this.currentSortModel))return this.currentSortModel=r,this.resourceParams.DETAILS.ORDER_BY=a+("desc"===t?" DESC":" ASC"),yield this.refreshDatasource(e),!0}}return!1})}refreshDatasource(e){const a=Object.create(null,{refreshDatasource:{get:()=>super.refreshDatasource}});return(0,t.sH)(this,void 0,void 0,function*(){this.destroyPollingStream(),this.debouncedCreateStream&&this.debouncedCreateStream.cancel(),this.discoveredTotalRowCount=null,this.currentNextOffset=0,this.resourceParams.DETAILS.VIEW_NUMBER=this.zeroBasedViewNumber?0:1,this.resourceParams.DETAILS.OFFSET=0,yield a.refreshDatasource.call(this,e)})}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return(0,t.sH)(this,void 0,void 0,function*(){this.destroyPollingStream(),this.debouncedCreateStream&&this.debouncedCreateStream.cancel(),yield e.destroy.call(this)})}createPollingStream(e){return(0,t.sH)(this,void 0,void 0,function*(){try{this.destroyPollingStream(),this.currentStreamParams=e;const{stream:a,datasource:r}=yield this.createReqRepStreamFunc(e);this.reqRepPollingStream=a,this.reqRepPollingDatasource=r,this.reqRepPollingSubscription=this.reqRepPollingStream.subscribe({next:a=>{this.currentStreamParams&&JSON.stringify(this.currentStreamParams)===JSON.stringify(e)&&this.onPollingUpdate&&this.onPollingUpdate(a)},error:e=>{var a;v.v.error("Polling stream error:",e),this.errorHandlerFunc&&this.errorHandlerFunc((null===(a=null==e?void 0:e.receivedMessage)||void 0===a?void 0:a.ERROR)||(null==e?void 0:e.message),"stream")}}),v.v.debug("Polling stream created for params:",e)}catch(e){v.v.error("Failed to create polling stream:",e)}})}destroyPollingStream(){this.reqRepPollingSubscription&&(this.reqRepPollingSubscription.unsubscribe(),this.reqRepPollingSubscription=void 0,v.v.debug("Polling subscription destroyed")),this.reqRepPollingDatasource&&(this.reqRepPollingDatasource.destroy(),this.reqRepPollingDatasource=void 0,v.v.debug("Polling datasource destroyed")),this.reqRepPollingStream=void 0,this.currentStreamParams=void 0,this.resetPreviousPollResult&&this.resetPreviousPollResult()}buildRequestDetails(e){const a={CRITERIA_MATCH:this.resourceParams.DETAILS.CRITERIA_MATCH,MAX_ROWS:this.resourceParams.DETAILS.MAX_ROWS,ORDER_BY:this.resourceParams.DETAILS.ORDER_BY};return"viewBased"===e?Object.assign(Object.assign({},a),{VIEW_NUMBER:this.resourceParams.DETAILS.VIEW_NUMBER}):Object.assign(Object.assign({},a),{OFFSET:this.resourceParams.DETAILS.OFFSET})}}let T=class extends((0,s.S)(m.ML)){constructor(){super(...arguments),this.zeroBasedViewNumber=!1,this.liveUpdates=!1,this.request={},this.sortIndicatorCSSDestroy=null,this.previousPollResult=new Map,this.hasCapturedFirstPollResult=!1}resourceNameChanged(e,a){e&&e!==a&&p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){yield this.restart()}))}criteriaChanged(e,a){const r=e!==(0,o.Q)(a,";");this.ssrmDatasource&&r&&p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){yield this.ssrmDatasource.refreshDatasource({criteria:a})}))}connectedCallback(){super.connectedCallback();const e=this.shouldRunConnect;p.DOM.queueUpdate(()=>{e&&(this.init(),this.subscribeToConnection())})}disconnectedCallback(){super.disconnectedCallback();const e=this.shouldRunDisconnect;p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){e&&(yield this.destroy(),this.unsubscribeFromConnection())}))}deepClone(){const e=super.deepClone();return e.deferredGridOptions=structuredClone(this.deferredGridOptions),e.deferredColumnStates=structuredClone(this.deferredColumnStates),e}reloadResourceData(e){return(0,t.sH)(this,void 0,void 0,function*(){var a;if(this.datasource.destroy(),null===(a=this.liveUpdatesStream)||void 0===a||a.unsubscribe(),this.liveUpdatesStream=void 0,this.$emit(h.c.cacheFilterConfig),this.clearRowData(null),this.setDisconnected(!1),e){const a=Object.assign(Object.assign({},this.datasourceOptions()),e);if(!(yield this.initializeDatasource(a,!0,!1)))return this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.refreshServerSide,{purge:!0}),void v.v.error("Genesis Datasource re-init failed on filtering/sorting.");this.$emit(h.c.refreshServerSide,{purge:!0})}else this.$emit(h.c.refreshServerSide,{purge:!0}),this.ssrmDatasource&&(yield this.ssrmDatasource.destroy(),this.ssrmDatasource=void 0),this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.loadingStarted),yield this.init()})}applyServerSideSortIndicatorStyling(){this.removeServerSideSortIndicatorStyling(),this.$emit(h.c.addGridCssClass,{className:"grid-pro-server-side"}),this.sortIndicatorCSSDestroy=(0,d.O5)('\n .grid-pro-server-side .ag-header-cell-sortable .ag-sort-indicator-container {\n opacity: 1 !important;\n visibility: visible !important;\n }\n \n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-container {\n opacity: 0.4 !important;\n }\n \n .grid-pro-server-side .ag-header-cell-sorted .ag-sort-indicator-container {\n opacity: 1 !important;\n }\n \n .grid-pro-server-side .ag-sort-ascending-icon::before,\n .grid-pro-server-side .ag-sort-descending-icon::before,\n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {\n font-family: var(--ag-icon-font-family, agGridAlpine) !important;\n font-size: var(--ag-icon-size, 16px) !important;\n color: var(--ag-header-foreground-color, var(--ag-foreground-color)) !important;\n }\n \n .grid-pro-server-side .ag-sort-ascending-icon::before {\n content: "\\e90d" !important; /* AG Grid sort up icon */\n }\n \n .grid-pro-server-side .ag-sort-descending-icon::before {\n content: "\\e90c" !important; /* AG Grid sort down icon */\n }\n \n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {\n content: "\\e90b" !important; /* AG Grid sort icon */\n opacity: 0.6 !important;\n }\n \n /* Ensure the sort indicator is always visible for sortable columns in server-side mode */\n .grid-pro-server-side .ag-header-cell-sortable .ag-sort-indicator-icon {\n display: inline-block !important;\n }\n',"grid-pro-server-side-sort")}removeServerSideSortIndicatorStyling(){this.$emit(h.c.removeGridCssClass,{className:"grid-pro-server-side"}),this.sortIndicatorCSSDestroy&&(this.sortIndicatorCSSDestroy(),this.sortIndicatorCSSDestroy=null)}init(){return(0,t.sH)(this,void 0,void 0,function*(){const e=Object.assign({getRowId:e=>e.data?String(e.data[this.rowId]):null,getRowStyle(e){var a,r;if(null===(r=null===(a=e.data)||void 0===a?void 0:a.ROW_REF)||void 0===r?void 0:r.includes("_deleted"))return{color:"grey"}},cacheBlockSize:this.maxRows,defaultColDef:{filter:!0,resizable:!0,sortable:!1,unSortIcon:!0},rowBuffer:0,rowModelType:"serverSide",suppressServerSideInfiniteScroll:!1,suppressMultiSort:!0,onFilterChanged:e=>{},onSortChanged:e=>{},onPaginationChanged:e=>this.onPaginationChanged(e)},this.deferredGridOptions);this.$emit(h.c.initialize,{options:e,keepColDefsOnClearRowData:this.keepColDefsOnClearRowData}),this.addEventListener(h.c.ready,e=>(0,t.sH)(this,void 0,void 0,function*(){const{pagination:a}=e.detail;this.pagination=a;if(!(yield this.initializeDatasource(this.datasourceOptions(),!0,!1)))return v.v.debug(`Genesis Datasource init failed for ${this.resourceName}`),this.clearRowData(),void this.setDisconnected(!0);this.$emit(u.V.dataInit),this.setDisconnected(!1),this.indexes=this.getResourceIndexes(this.datasource.availableIndexes,this.datasource.availableSortableFields);const r=(0,i.X)(this.datasource.originalFieldDef),t=yield this.getAgColumnDefs(r);if(this.$emit(h.c.schemaUpdated,{schema:t,metadata:r}),this.isRequestServer){const e=!this.isSnapshot&&!this.disablePolling;this.ssrmDatasource=new E({createReqRepRequestFunc:this.createReqRepRequest.bind(this),createReqRepStreamFunc:e?this.createReqRepStream.bind(this):void 0,onPollingUpdateFunc:e?this.applyReqRepPollingUpdate.bind(this):void 0,resetPreviousPollResultFunc:e?this.resetPreviousPollResult.bind(this):void 0,usePolling:e,reloadResourceDataFunc:this.reloadResourceData.bind(this),errorHandlerFunc:this.handleErrors.bind(this),onNoDataAvailableFunc:()=>this.$emit(h.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(h.c.loadingFinished),resourceName:this.resourceName,resourceParams:this.datasource.requestOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,maxView:+this.maxView,rowId:this.rowId,pagination:this.pagination,zeroBasedViewNumber:this.zeroBasedViewNumber,pagingMode:this.pagingMode,criteriaOnlyRequest:this.datasource.criteriaOnlyRequest})}else this.ssrmDatasource=new A({createDataserverStreamFunc:this.createDataserverStream.bind(this),reloadResourceDataFunc:this.reloadResourceData.bind(this),errorHandlerFunc:this.handleErrors.bind(this),onNoDataAvailableFunc:()=>this.$emit(h.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(h.c.loadingFinished),resourceName:this.resourceName,resourceParams:this.datasource.dataserverOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,maxView:+this.maxView,rowId:this.rowId,pagination:this.pagination,zeroBasedViewNumber:this.zeroBasedViewNumber});this.$emit(h.c.setServerSideDatasource,{datasource:this.ssrmDatasource}),this.$emit(h.c.filtersRestored),this.applyServerSideSortIndicatorStyling()}),{once:!0}),this.resourceName||this.handleErrors("Application not connected or invalid resource name, datasource will not work.","unknown")})}onPaginationChanged(e){var a;this.ssrmDatasource&&(this.ssrmDatasource.isNewPageSize=null!==(a=e.newPage)&&void 0!==a&&a)}destroy(){return(0,t.sH)(this,void 0,void 0,function*(){var e,a;this.datasource.destroy(),null===(e=this.liveUpdatesStream)||void 0===e||e.unsubscribe(),this.liveUpdatesStream=void 0,this.clearRowData(),this.ssrmDatasource&&(yield this.ssrmDatasource.destroy(),null===(a=this.pollingDatasource)||void 0===a||a.destroy(),this.ssrmDatasource=void 0),this.removeServerSideSortIndicatorStyling(),this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.refreshServerSide,{purge:!0})})}restart(){return(0,t.sH)(this,void 0,void 0,function*(){yield this.destroy(),yield this.init()})}clearRowData(e=!0){this.rowData=new Map,e&&this.$emit(h.c.dataCleared,{includeSchema:!0}),this.transactionData={remove:[]},this.$emit(h.c.applyServerSideTransaction,{transaction:this.transactionData}),this.transactionData=void 0}getResourceIndexes(e,a){const r=new Map,t=new Set;if(null==e||e.forEach(e=>{const a=e.FIELDS.split(" ");r.set(e.NAME,a),a.forEach(e=>t.add(e))}),a&&a.length>0&&a.forEach(e=>t.add(e)),0===r.size&&t.size>0)r.set("SORTABLE_FIELDS",Array.from(t));else if(a&&a.length>0&&r.size>0){const e=new Set;r.forEach(a=>{a.forEach(a=>e.add(a))});const t=a.filter(a=>!e.has(a));t.length>0&&r.set("SORTABLE_FIELDS",t)}return r}createReqRepRequest(){return(0,t.sH)(this,arguments,void 0,function*(e=null){return yield this.datasource.snapshot(e)})}createReqRepStream(){return(0,t.sH)(this,arguments,void 0,function*(e=null){var a,r,t,o,i,n,l,g;const s=null!==(r=null===(a=null==e?void 0:e.DETAILS)||void 0===a?void 0:a.OFFSET)&&void 0!==r?r:0,d=null!==(o=null===(t=null==e?void 0:e.DETAILS)||void 0===t?void 0:t.MAX_ROWS)&&void 0!==o?o:this.maxRows,c=d+s,p=Object.assign(Object.assign({},this.datasourceOptions()),{criteria:null!==(n=null===(i=null==e?void 0:e.DETAILS)||void 0===i?void 0:i.CRITERIA_MATCH)&&void 0!==n?n:this.criteria,maxRows:c,orderBy:null!==(g=null===(l=null==e?void 0:e.DETAILS)||void 0===l?void 0:l.ORDER_BY)&&void 0!==g?g:this.orderBy});v.v.debug("Creating polling datasource for all loaded rows:",{currentOffset:s,baseMaxRows:d,totalRowsToFetch:c});if(yield this.pollingDatasource.init(p,!0,!0))return{stream:this.pollingDatasource.stream,datasource:this.pollingDatasource};v.v.error("Polling datasource init failed")})}resetPreviousPollResult(){this.previousPollResult.clear(),this.hasCapturedFirstPollResult=!1,v.v.debug("Previous poll result cleared")}applyReqRepPollingUpdate(e){var a;if(!this.ssrmDatasource||!e.REPLY)return;const r=e.REPLY;if(!Array.isArray(r)||!(null===(a=e.MESSAGE_TYPE)||void 0===a?void 0:a.startsWith("REP_")))return void v.v.error("received invalid RequestServerResult for polling update",e);if(!this.hasCapturedFirstPollResult)return r.forEach(e=>{this.previousPollResult.set(e[this.rowId],e)}),this.hasCapturedFirstPollResult=!0,void v.v.debug("First poll result stored for future comparison",{rowCount:this.previousPollResult.size});const t=new Map;r.forEach(e=>{t.set(e[this.rowId],e)});const o=[],i=[],n=[];r.forEach(e=>{const a=e[this.rowId];if(this.previousPollResult.has(a)){const r=this.previousPollResult.get(a);this.serializer.serialize(r)!==this.serializer.serialize(e)&&o.push(e)}else i.push(e)}),this.previousPollResult.forEach((e,a)=>{t.has(a)||n.push(e)}),(o.length>0||n.length>0||i.length>0)&&(this.previousPollResult=t,v.v.debug("Applying reqRep polling update via applyServerSideTransaction:",{added:i.length,updated:o.length,removed:n.length,totalInPoll:t.size}),this.$emit(h.c.applyServerSideTransaction,{transaction:{add:i,update:o,remove:n}}))}applyLiveServerSideUpdate(e){var a,r,t;const o=null!==(a=e.inserts)&&void 0!==a?a:[],i=null!==(r=e.updates)&&void 0!==r?r:[],n=null!==(t=e.deletes)&&void 0!==t?t:[];if(!o.length&&!i.length&&!n.length)return;const l=o.length-n.length;this.ssrmDatasource&&(this.ssrmDatasource.serverRowsCount+=l,this.ssrmDatasource.clientRowsCount+=l),this.transactionData={add:[],remove:[],update:[]},this.handleStreamInserts(o),this.handleStreamUpdates(i),this.handleStreamDeletes(n),this.transactionData.add.length>0&&this.$emit(h.c.applyServerSideTransaction,{transaction:{route:[],add:this.transactionData.add,addIndex:this.reverse?0:this.transactionData.addIndex}}),(this.transactionData.update.length>0||this.transactionData.remove.length>0)&&this.$emit(h.c.applyServerSideTransaction,{transaction:{route:[],update:this.transactionData.update,remove:this.transactionData.remove}})}createDataserverStream(){return(0,t.sH)(this,arguments,void 0,function*(e=null){if(this.liveUpdates){const e=e=>(0,t.sH)(this,void 0,void 0,function*(){var a;if(e.MESSAGE_TYPE!==n.Go.QUERY_UPDATE||!e.ROW)return;if(!(null===(a=this.ssrmDatasource)||void 0===a?void 0:a.sourceRef))return;if(void 0!==e.SEQUENCE_ID&&e.SEQUENCE_ID<=1)return;const r=e,t=Array.isArray(r.ROW)?r.ROW:r.ROW?[r.ROW]:[],o=this.ssrmDatasource.rowData,i=t.map(e=>{var a;const r=null!==(a=e.DETAILS)&&void 0!==a?a:{},t=r[this.rowId],i=null!=t?null==o?void 0:o.get(t):void 0;if(!i)return e;const n=Object.assign({},i);for(const[a,r]of Object.entries(e))"DETAILS"!==a&&null!=r&&(n[a]=r);return Object.assign(Object.assign({},n),{DETAILS:r})}),g=Object.assign(Object.assign({},r),{ROW:i}),s=(0,l.d)(g,this.rowId);this.applyLiveServerSideUpdate(s)}),a=e=>{var a;v.v.error(e),this.handleErrors((null===(a=e.receivedMessage)||void 0===a?void 0:a.ERROR)||e.message,"stream")};this.liveUpdatesStream=this.connect.stream(this.resourceName,()=>{},a,this.datasource.dataserverOnlyParams).subscribe(a=>e(a))}return yield this.datasource.startStream(),this.datasource.stream})}getAgColumnDefs(e){return(0,t.sH)(this,void 0,void 0,function*(){const a=this.generateColumnDefsFromMetadata(e,y,b);return a.forEach(e=>{e.sortable=[].concat(...this.indexes.values()).includes(e.field),this.datasource.criteriaOnlyRequest&&(e.filter=this.datasource.availableCriteriaFields.includes(e.field)?e.filter:null)}),a})}applyTransaction(e){this.$emit(h.c.applyServerSideTransaction,{transaction:e})}loadMore(){throw new Error("loadMore() method is not supported for server-side datasource")}};(0,t.Cg)([c.b_],T.prototype,"serializer",void 0),(0,t.Cg)([g.yW],T.prototype,"pollingDatasource",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"zero-based-view-number"})],T.prototype,"zeroBasedViewNumber",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"live-updates"})],T.prototype,"liveUpdates",void 0),(0,t.Cg)([(0,p.attr)({attribute:"paging-mode"})],T.prototype,"pagingMode",void 0),(0,t.Cg)([p.observable],T.prototype,"request",void 0),T=(0,t.Cg)([(0,p.customElement)({name:"grid-pro-server-side-datasource"})],T)},60591(e,a,r){r.d(a,{g:()=>t});const t=r(33681).css`
405
+ `}},24638(e,a,r){r.d(a,{X:()=>T});var t=r(55823),o=r(96730),i=r(48707),n=r(21281),l=r(34193),g=r(49964),s=r(21409),d=r(52945),c=r(49229),p=r(33681),u=r(90509),h=r(79270),v=r(1510),m=r(35610),f=r(41119),w=r(32610);function b(e){switch(null==e?void 0:e.toLowerCase()){case"int":case"long":case"double":case"bigdecimal":case"number":return"agNumberColumnFilter";case"date":case"datetime":return"agDateColumnFilter";case"enum":return"agSetColumnFilter";default:return"agTextColumnFilter"}}function y(e){switch(e.type){case f.w.BOOLEAN:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["contains",{displayKey:"true",displayName:"True",predicate:(e,a)=>"true"===a||!0===a,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:(e,a)=>"false"===a||!1===a,numberOfInputs:0},{displayKey:"true-false",displayName:"True/False",predicate:(e,a)=>"true"===a||!0===a||"false"===a||!1===a,numberOfInputs:0}]};case f.w.ENUM:return(0,w.O7)(e,b(e.type));case f.w.DATE:case f.w.DATETIME:return{comparator:(e,a)=>{if(!a)return-1;const r=new Date(a).setHours(0,0,0,0),t=e.getTime();return r===t?0:r<t?-1:r>t?1:void 0},buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,browserDatePicker:!0,filterOptions:["equals","lessThan","greaterThan","inRange",{displayKey:"isToday",displayName:"Is today",numberOfInputs:0,predicate:()=>!0},"blank","notBlank"]};case f.w.NUMBER:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"]};default:return{buttons:["reset","apply"],closeOnApply:!0,closeOnClear:!0,maxNumConditions:1,filterOptions:["contains","equals","notEqual",{displayKey:"wordStartsWith",displayName:"Word starts with",numberOfInputs:1,predicate:()=>!0},"blank","notBlank"]}}}var z=r(17465),x=r(49874),C=r(40113),k=r(57963),S=r(32808);class D{constructor(e){var a;this.rowData=new Map,this.serverRowsCount=0,this.clientRowsCount=0,this.moreRows=!1,this.calculatedRowsCount=0,this.currentSequenceId=null,this.criteriaRowCountResolved=!1,this.reloadResourceDataFunc=e.reloadResourceDataFunc,this.errorHandlerFunc=e.errorHandlerFunc,this.onNoDataAvailableFunc=e.onNoDataAvailableFunc,this.onDataAvailableFunc=e.onDataAvailableFunc,this.resourceName=e.resourceName,this.resourceParams=e.resourceParams,this.originalCriteriaMatch=this.getResourceParam("CRITERIA_MATCH"),this.resourceIndexes=e.resourceIndexes,this.resourceColDefs=e.resourceColDefs,this.maxRows=e.maxRows,this.maxView=e.maxView,this.rowId=e.rowId,this.pagination=e.pagination,this.zeroBasedViewNumber=e.zeroBasedViewNumber,this.pagingMode=e.pagingMode,this.criteriaOnlyRequest=null!==(a=e.criteriaOnlyRequest)&&void 0!==a&&a}getResourceParam(e){var a,r;return(null===(a=this.resourceParams)||void 0===a?void 0:a.DETAILS)&&"object"==typeof this.resourceParams.DETAILS?this.resourceParams.DETAILS[e]:null===(r=this.resourceParams)||void 0===r?void 0:r[e]}setResourceParam(e,a){var r;(null===(r=this.resourceParams)||void 0===r?void 0:r.DETAILS)&&"object"==typeof this.resourceParams.DETAILS?this.resourceParams.DETAILS[e]=a:this.resourceParams[e]=a}getRows(e){throw new Error("Method not implemented.")}setupFiltering(e){return(0,t.sH)(this,void 0,void 0,function*(){const a=e.request.filterModel,r=Object.keys(a).length>0,t=0===Object.keys(a).length,o=JSON.stringify(a)!==JSON.stringify(this.currentFilterModel);if(o||r){if(t&&this.currentFilterModel)return this.currentFilterModel=null,this.setResourceParam("CRITERIA_MATCH",this.originalCriteriaMatch),yield this.refreshDatasource(e),!0;if(o&&r)return this.currentFilterModel=a,this.setResourceParam("CRITERIA_MATCH",this.buildCriteriaMatchFromFilters()),yield this.refreshDatasource(e),!0}return!1})}setupFilteringAndSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){yield this.setupFiltering(e),yield this.setupSorting(e)})}destroy(){this.rowData=new Map,this.clientRowsCount=0,this.calculatedRowsCount=0,this.serverRowsCount=0,this.currentSequenceId=0,this.moreRows=!1,this.sourceRef=void 0,this.lastSuccessRowData=void 0,this.criteriaRowCountResolved=!1}refreshDatasource(e){return(0,t.sH)(this,void 0,void 0,function*(){this.destroy(),this.updateResourceParams(e),yield this.reloadResourceDataFunc({criteria:this.getResourceParam("CRITERIA_MATCH"),orderBy:this.getResourceParam("ORDER_BY"),reverse:this.getResourceParam("REVERSE")})})}updateResourceParams(e){void 0!==e.criteria&&(this.originalCriteriaMatch=e.criteria,this.setResourceParam("CRITERIA_MATCH",this.buildCriteriaMatchFromFilters())),void 0!==e.orderBy&&this.setResourceParam("ORDER_BY",e.orderBy),void 0!==e.reverse&&this.setResourceParam("REVERSE",e.reverse)}getOrderByAndToBeSortedColIds(e,a){for(const[r,t]of e.entries()){const e=t.findIndex(e=>e===a);if(-1!==e){return{orderBy:r,toBeSorted:[...t].splice(e,1)}}}}buildCriteriaMatchFromFilters(){this.setResourceParam("CRITERIA_MATCH",this.originalCriteriaMatch);let e=this.getResourceParam("CRITERIA_MATCH");e&&"string"==typeof e&&(e=e.split(";"),this.setResourceParam("CRITERIA_MATCH",e)),e||(e=[],this.setResourceParam("CRITERIA_MATCH",e));return e.concat(this.criteriaFromFilters()).join(" && ")}criteriaFromFilters(){const e=[];return this.getFiltersByType("text").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("set").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("number").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("date").forEach(a=>{const r=this.criteriaForSingleModel(a,this.currentFilterModel[a]);r&&e.push(r)}),this.getFiltersByType("multi").forEach(a=>{var r;const t=null!==(r=this.currentFilterModel[a].filterModels)&&void 0!==r?r:[],o="OR"===(this.currentFilterModel[a].operator||"AND").toUpperCase()?" || ":" && ",i=t.map(e=>this.criteriaForSingleModel(a,e)).filter(e=>!!e);1===i.length?e.push(i[0]):i.length>1&&e.push(`(${i.join(o)})`)}),e}criteriaForSingleModel(e,a){if(!a)return null;switch(a.filterType){case"text":return this.criteriaForTextModel(e,a);case"set":return this.criteriaForSetModel(e,a);case"number":return this.criteriaForNumberModel(e,a);case"date":return this.criteriaForDateModel(e,a);default:return null}}criteriaForTextModel(e,a){const r=a.type,t=a.filter;if(!t&&("false"===r||"true"===r))return`${e} == ${r}`;const o=t?String(t).replace(/'/g,"\\'"):"";switch(r){case"blank":return`(${e} == '' || ${e} == null)`;case"contains":return`Expr.containsIgnoreCase(${e}, '${o}')`;case"equals":return`${e} == '${o}'`;case"notBlank":return`(${e} != '' && ${e} != null)`;case"notEqual":return`${e} != '${o}'`;case"wordStartsWith":return`Expr.containsWordsStartingWithIgnoreCase(${e}, '${o}')`;default:return null}}criteriaForSetModel(e,a){var r,t;const o=null!==(r=a.values)&&void 0!==r?r:[];if(!o.length)return null;const i=null===(t=this.resourceColDefs)||void 0===t?void 0:t.find(a=>a.NAME===e);let n;if(null==i?void 0:i.VALID_VALUES)try{n=Array.isArray(i.VALID_VALUES)?i.VALID_VALUES:i.VALID_VALUES.split("|")}catch(e){n=void 0}if(n&&n.length===o.length&&n.every(e=>o.includes(e)))return null;const l=o.map(a=>{const r=String(a).replace(/'/g,"\\'");return`${e} == '${r}'`});return l.length?`(${l.join(" || ")})`:null}criteriaForNumberModel(e,a){const r=a.filter,t=a.filterTo,o=e=>null!==e&&""!==e&&!isNaN(Number(e));switch(a.type){case"equals":return o(r)?`${e} == ${r}`:null;case"notEqual":return o(r)?`${e} != ${r}`:null;case"greaterThan":return o(r)?`${e} > ${r}`:null;case"greaterThanOrEqual":return o(r)?`${e} >= ${r}`:null;case"lessThan":return o(r)?`${e} < ${r}`:null;case"lessThanOrEqual":return o(r)?`${e} <= ${r}`:null;case"inRange":return o(r)&&o(t)?`${e} >= ${r} && ${e} <= ${t}`:null;case"blank":return`${e} == 0`;case"notBlank":return`${e} != 0`;default:return null}}criteriaForDateModel(e,a){var r,t;const o=null===(r=a.dateFrom)||void 0===r?void 0:r.replace(/-/g,"").replace("T","-").split(" ")[0],i=null===(t=a.dateTo)||void 0===t?void 0:t.replace(/-/g,"").replace("T","-").split(" ")[0];switch(a.type){case"equals":return`Expr.dateIsEqual(${e}, '${o}')`;case"lessThan":return`Expr.dateIsBefore(${e}, '${o}')`;case"greaterThan":return`Expr.dateIsAfter(${e}, '${o}')`;case"inRange":return`Expr.dateIsAfter(${e}, '${o}') && Expr.dateIsBefore(${e}, '${i}')`;case"isToday":{const a=new Date;return`Expr.dateIsEqual(${e}, '${a.getFullYear()}-${(a.getMonth()+1).toString().padStart(2,"0")}-${a.getDate().toString().padStart(2,"0")} 00:00:00')`}case"blank":return`${e} == null`;case"notBlank":return`${e} != null`;default:return null}}getFiltersByType(e){var a;return Object.keys(null!==(a=this.currentFilterModel)&&void 0!==a?a:{}).filter(e=>-1!==this.resourceColDefs.findIndex(a=>a.NAME===e)).filter(a=>this.currentFilterModel[a].filterType===e)}getPageNumber(e,a,r,t=!0){void 0!==r&&e>r&&(e=Math.floor((r-1)/a)*a+1);const o=Math.ceil(e/a);return t?o:o+1}getCorrectRowCount(e){const a=e.request.endRow;this.calculatedRowsCount=this.clientRowsCount||a;const r=Math.min(this.serverRowsCount,this.maxView);let t;const o=this.getResourceParam("CRITERIA_MATCH");if(this.pagination){if(t=o?void 0:Math.min(this.serverRowsCount,this.maxView),o){const e=this.rowData.size;t=e>0?Math.min(e,this.maxView):r}return t}return t=this.moreRows?this.rowData.size>=this.maxView?this.maxView:void 0:Math.min(this.rowData.size,this.maxView),t}get isNotFirstViewNumber(){return this.zeroBasedViewNumber?this.currentSequenceId>0:this.currentSequenceId>1}completeEmptyResult(e){var a,r;if(null===(r=null===(a=this.lastSuccessRowData)||void 0===a?void 0:a.rowData)||void 0===r?void 0:r.length)return void e.success(this.lastSuccessRowData);this.rowData=new Map;const t={rowData:[],rowCount:0};e.success(t),this.notifyNoDataAvailableIfEmpty(e,t)}notifyNoDataAvailableIfEmpty(e,a){var r;const t=!(null===(r=a.rowData)||void 0===r?void 0:r.length),o=0===e.request.startRow;o&&t?this.notifyNoDataAvailable():o&&!t&&this.notifyDataAvailable()}notifyNoDataAvailable(){var e;null===(e=this.onNoDataAvailableFunc)||void 0===e||e.call(this)}notifyDataAvailable(){var e;null===(e=this.onDataAvailableFunc)||void 0===e||e.call(this)}getEffectivePagingMode(){return this.pagingMode?"offsetBased"!==this.pagingMode||this.criteriaOnlyRequest?this.pagingMode:(z.v.warn("offsetBased paging mode requires criteriaOnlyRequest support. Falling back to viewBased mode."),"viewBased"):this.criteriaOnlyRequest?"offsetBased":"viewBased"}}(0,t.Cg)([C.N],D.prototype,"auth",void 0),(0,t.Cg)([k.dm],D.prototype,"connect",void 0),(0,t.Cg)([S.k],D.prototype,"uuid",void 0);class A extends D{constructor(e){super(e),this.pendingBlocks=new Set,this.deliveredRowCount=0,this.createDataserverStreamFunc=e.createDataserverStreamFunc}refreshDatasource(e){const a=Object.create(null,{refreshDatasource:{get:()=>super.refreshDatasource}});return(0,t.sH)(this,void 0,void 0,function*(){var r;this.cancelAllPendingBlocks(),null===(r=this.dataserverStreamSubscription)||void 0===r||r.unsubscribe(),this.dataserverStreamSubscription=void 0,this.dataserverStream=void 0,this.deliveredRowCount=0,yield a.refreshDatasource.call(this,e)})}getRows(e){return(0,t.sH)(this,void 0,void 0,function*(){var a,r;if(yield this.setupFiltering(e))return void e.fail();if(yield this.setupSorting(e))return void e.fail();if(this.pagination&&!this.isNewPageSize&&this.currentSequenceId>0){if(JSON.stringify(null!==(a=e.request.filterModel)&&void 0!==a?a:{})===JSON.stringify(null!==(r=this.currentFilterModel)&&void 0!==r?r:{})&&this.lastSuccessRowData)return void e.success(this.lastSuccessRowData)}this.dataserverStream||(this.dataserverStream=yield this.createDataserverStreamFunc(this.resourceParams));const o=Number.isFinite(Number(e.request.startRow))?Number(e.request.startRow):0,i=Number.isFinite(Number(e.request.endRow))?Number(e.request.endRow):o+Number(this.maxRows),l=!this.pagination&&this.currentSequenceId>=1&&(this.rowData.size>=i||!this.moreRows);if(this.currentSequenceId>=1&&!l&&(this.moreRows||e.request.startRow>=Number(this.maxRows))){if(this.pagination){const a=Number.isFinite(Number(e.request.startRow))?Number(e.request.startRow):0;this.resourceParams.VIEW_NUMBER=this.getPageNumber(a,this.maxRows,this.maxView,this.zeroBasedViewNumber)}const a=this.pagination?this.resourceParams.VIEW_NUMBER:Number.isFinite(Number(this.resourceParams.VIEW_NUMBER))?Number(this.resourceParams.VIEW_NUMBER):0;Number.isFinite(a)&&this.connect.getMoreRows(this.sourceRef,a)}let g=!0;const s=e=>{void 0!==e&&clearTimeout(e)},d={handle:()=>{},cancel:()=>{}},c=()=>{this.pendingBlocks.delete(d)},u=a=>{if(!g)return;g=!1,s(a),c(),this.pagination||(this.deliveredRowCount=Math.max(this.deliveredRowCount,i));const r=Array.from(this.rowData.values()),t={rowData:this.pagination?r:r.slice(o,i)};t.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=t,e.success(t),this.notifyNoDataAvailableIfEmpty(e,t)},h=a=>{g&&(g=!1,s(a),c(),e.fail())};if(l)return void u();const v=setTimeout(()=>{g&&(z.v.warn(`SSRM block ${o}-${i} for ${this.resourceName} timed out waiting for a full batch; resolving with ${this.rowData.size} accumulated row(s).`),u(v))},A.BLOCK_RESOLVE_TIMEOUT_MS);d.cancel=()=>h(v),d.handle=a=>{var r;const o=null==a?void 0:a.MESSAGE_TYPE;if(!o||o!==n.Go.LOGOFF_ACK&&o!==n.Go.MSG_NACK){if(this.pagination){const o=null===(r=null==a?void 0:a.ROW)||void 0===r?void 0:r.length;if(!(g||o>0&&0===this.rowData.size))return;return void p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){var r,t;if(g||o>0&&0===this.rowData.size){if(g=!1,s(v),this.resourceParams.CRITERIA_MATCH&&!this.criteriaRowCountResolved){const e=yield this.connect.snapshot(this.resourceName,{MAX_ROWS:this.maxView,MAX_VIEW:this.maxView,CRITERIA_MATCH:this.resourceParams.CRITERIA_MATCH});if(e.ROW||e.ROWS_COUNT){const a=null!==(r=e.ROWS_COUNT)&&void 0!==r?r:0,o=null===(t=e.ROW)||void 0===t?void 0:t.length;this.serverRowsCount=void 0!==o?Math.max(a,o):a,this.criteriaRowCountResolved=!0}else z.v.warn("No data returned when criteria is applied."),this.serverRowsCount=0,this.clientRowsCount=0}this.applyServerSideData(e,a),c()}}))}if(g)return 0!==this.currentSequenceId||(null==a?void 0:a.ROW)||this.moreRows?void((this.rowData.size>=i||!this.moreRows)&&p.DOM.queueUpdate(()=>u(v))):(g=!1,s(v),c(),void this.completeEmptyResult(e))}else{if(this.errorHandlerFunc){const e=o===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}h(v)}},this.pendingBlocks.add(d),this.ensureStreamSubscription()})}cancelAllPendingBlocks(){const e=Array.from(this.pendingBlocks);this.pendingBlocks.clear();for(const a of e)a.cancel()}ensureStreamSubscription(){this.dataserverStreamSubscription||(this.dataserverStreamSubscription=this.dataserverStream.subscribe(e=>this.dispatchStreamMessage(e)))}dispatchStreamMessage(e){var a;const r=null==e?void 0:e.MESSAGE_TYPE;if(!r||r!==n.Go.LOGOFF_ACK&&r!==n.Go.MSG_NACK){if(!this.pagination&&(void 0!==(null==e?void 0:e.MORE_ROWS)&&(this.moreRows=e.MORE_ROWS),null==e?void 0:e.ROW)){const r=(0,l.d)(e,this.rowId);this.handleCurrentStreamLoad(r),this.currentSequenceId=e.SEQUENCE_ID,1===this.currentSequenceId&&(this.sourceRef=e.SOURCE_REF,0===this.serverRowsCount&&(this.serverRowsCount=null!==(a=e.ROWS_COUNT)&&void 0!==a?a:this.rowData.size))}for(const a of this.pendingBlocks)a.handle(e)}else for(const a of this.pendingBlocks)a.handle(e)}applyServerSideData(e,a){var r;const t=a.MESSAGE_TYPE;if(t&&(t===n.Go.LOGOFF_ACK||t===n.Go.MSG_NACK)){if(this.errorHandlerFunc){const e=t===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}return void e.fail()}if(this.moreRows=a.MORE_ROWS,!a.ROW){if(this.currentSequenceId>=1&&this.rowData.size>0){const a={rowData:Array.from(this.rowData.values()),rowCount:this.getCorrectRowCount(e)};return this.lastSuccessRowData=a,void e.success(a)}return void this.completeEmptyResult(e)}{const e=(0,l.d)(a,this.rowId);this.handleCurrentStreamLoad(e)}this.currentSequenceId=a.SEQUENCE_ID,1===this.currentSequenceId&&(this.sourceRef=a.SOURCE_REF,0===this.serverRowsCount&&(this.serverRowsCount=null!==(r=a.ROWS_COUNT)&&void 0!==r?r:this.rowData.size));const o={rowData:Array.from(this.rowData.values())};o.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=o,e.success(o),this.notifyNoDataAvailableIfEmpty(e,o)}setupSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){var a,r,t;const o=e.request.sortModel;if((null===(a=this.currentSortModel)||void 0===a?void 0:a.length)!==o.length||o.length>0){if(0===o.length&&this.currentSortModel)return this.calculatedRowsCount=0,this.currentSortModel=null,this.resourceParams.ORDER_BY=null,this.resourceParams.REVERSE=null,yield this.refreshDatasource(e),!0;if(o.length>0){const a=o[0].colId,i=o[0].sort,n=this.getOrderByAndToBeSortedColIds(this.resourceIndexes,a);if(!n){const i=(0,x.i)(this.resourceIndexes),n=(0,x.P)(this.resourceIndexes);z.v.warn(`The FIELD/column (${a}) being sorted is not part of an INDEX, required for the [orderBy] operation - ignoring this sort and loading unsorted data. See https://learn.genesis.global/docs/database/data-types/index-entities/`),z.v.debug("Available indexes:",i),z.v.debug("Columns that can be sorted with the available indexes:",n);const l=JSON.stringify(o)!==JSON.stringify(this.currentSortModel),g=(null!==(t=null===(r=this.currentSortModel)||void 0===r?void 0:r.length)&&void 0!==t?t:0)>0,s=null!=this.resourceParams.ORDER_BY||null!=this.resourceParams.REVERSE;return this.currentSortModel=o,!!(g&&l&&s)&&(this.resourceParams.ORDER_BY=null,this.resourceParams.REVERSE=null,yield this.refreshDatasource(e),!0)}if(JSON.stringify(o)!==JSON.stringify(this.currentSortModel))return this.currentSortModel=o,this.resourceParams.ORDER_BY=n.orderBy,this.resourceParams.REVERSE="desc"===i,yield this.refreshDatasource(e),!0}}return!1})}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return(0,t.sH)(this,void 0,void 0,function*(){var a;this.cancelAllPendingBlocks(),this.dataserverStream=void 0,null===(a=this.dataserverStreamSubscription)||void 0===a||a.unsubscribe(),this.dataserverStreamSubscription=void 0,this.deliveredRowCount=0,yield e.destroy.call(this)})}handleCurrentStreamLoad(e){var a,r,t,o,i;if(!e)return;const n=this.pagination?new Map:new Map(this.rowData);null===(a=e.inserts)||void 0===a||a.forEach(e=>{n.set(e[this.rowId],e)}),null===(r=e.updates)||void 0===r||r.forEach(e=>{const a=null==e?void 0:e[this.rowId];if(void 0===a)return;const r=n.get(a);n.set(a,r?Object.assign(Object.assign({},r),e):e)}),null===(t=e.deletes)||void 0===t||t.forEach(e=>{const a=null==e?void 0:e[this.rowId];if(void 0!==a){if(!this.pagination&&this.deliveredRowCount>0){let e=0;for(const r of n.keys()){if(r===a){if(e<this.deliveredRowCount)return;break}e+=1}}n.delete(a)}}),this.clientRowsCount+=null!==(i=null===(o=e.inserts)||void 0===o?void 0:o.length)&&void 0!==i?i:0,this.rowData=n}}A.BLOCK_RESOLVE_TIMEOUT_MS=1e4;var R=r(62051),M=r.n(R);class E extends D{constructor(e){var a,r,t,o,i;super(e),this.discoveredTotalRowCount=null,this.currentNextOffset=0,this.createReqRepRequestFunc=e.createReqRepRequestFunc,this.createReqRepStreamFunc=e.createReqRepStreamFunc,this.onPollingUpdate=e.onPollingUpdateFunc,this.resetPreviousPollResult=e.resetPreviousPollResultFunc,this.usePolling=null!==(a=e.usePolling)&&void 0!==a&&a,this.debouncedCreateStream=M()(e=>this.createPollingStream(e),300);"viewBased"===this.getEffectivePagingMode()?(null===(t=null===(r=e.resourceParams)||void 0===r?void 0:r.DETAILS)||void 0===t?void 0:t.VIEW_NUMBER)||(this.resourceParams.DETAILS.VIEW_NUMBER=this.zeroBasedViewNumber?0:1):(null===(i=null===(o=e.resourceParams)||void 0===o?void 0:o.DETAILS)||void 0===i?void 0:i.OFFSET)||(this.resourceParams.DETAILS.OFFSET=0)}getRows(e){return(0,t.sH)(this,void 0,void 0,function*(){if(yield this.setupFiltering(e))return void e.fail();if(yield this.setupSorting(e))return void e.fail();if(this.pagination&&!this.isNewPageSize&&this.currentSequenceId>0)return void e.success(this.lastSuccessRowData);const a=this.getEffectivePagingMode();this.updatePaginationParams(e,a);const r={DETAILS:this.buildRequestDetails(a)},t=yield this.createReqRepRequestFunc(r),o=yield this.determineIsLastView(t,r,a);this.applyServerSideData(e,t,o),this.schedulePollingStream(r)})}updatePaginationParams(e,a){"viewBased"===a?null!==this.currentSequenceId&&this.currentSequenceId>=0&&this.moreRows&&(this.pagination?this.resourceParams.DETAILS.VIEW_NUMBER=this.getPageNumber(e.request.startRow,this.maxRows,void 0,this.zeroBasedViewNumber):this.resourceParams.DETAILS.VIEW_NUMBER+=1):this.resourceParams.DETAILS.OFFSET=e.request.startRow}determineIsLastView(e,a,r){return(0,t.sH)(this,void 0,void 0,function*(){var t;const o="MORE_ROWS"in e;let i=!1;if("viewBased"===r){if(o)i=!e.MORE_ROWS;else if(-1!==e.NEXT_VIEW){const r=Object.assign(Object.assign({},a),{DETAILS:Object.assign(Object.assign({},a.DETAILS),{VIEW_NUMBER:e.NEXT_VIEW})}),o=yield this.createReqRepRequestFunc(r);i=-1===o.NEXT_VIEW&&0===(null===(t=o.REPLY)||void 0===t?void 0:t.length)}}else i=o&&!e.MORE_ROWS,"NEXT_OFFSET"in e&&-1!==e.NEXT_OFFSET?this.currentNextOffset=e.NEXT_OFFSET:this.currentNextOffset=0;return i})}schedulePollingStream(e){this.usePolling&&this.createReqRepStreamFunc&&(this.destroyPollingStream(),this.debouncedCreateStream(e))}applyServerSideData(e,a,r){var t,o,i;const l=a.MESSAGE_TYPE;if(l&&(l===n.Go.LOGOFF_ACK||l===n.Go.MSG_NACK)){if(this.errorHandlerFunc){const e=l===n.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`;this.errorHandlerFunc(e,"connection")}return void e.fail()}const g=this.getEffectivePagingMode();if(this.moreRows="MORE_ROWS"in a?a.MORE_ROWS:"viewBased"===g?!r&&-1!==a.NEXT_VIEW&&a.NEXT_VIEW>this.resourceParams.DETAILS.VIEW_NUMBER:!r&&-1!==a.NEXT_OFFSET&&a.NEXT_OFFSET>this.resourceParams.DETAILS.OFFSET,!(null===(t=a.REPLY)||void 0===t?void 0:t.length))return void this.completeEmptyResult(e);if(this.handleCurrentStreamLoad(a.REPLY),this.currentSequenceId="viewBased"===g?this.resourceParams.DETAILS.VIEW_NUMBER:Math.floor(this.resourceParams.DETAILS.OFFSET/this.maxRows),this.sourceRef=a.SOURCE_REF,!this.moreRows){const a=this.rowData.size;this.discoveredTotalRowCount=e.request.startRow+a}this.pagination?this.serverRowsCount=null!==(o=a.ROWS_COUNT)&&void 0!==o?o:this.rowData.size:this.serverRowsCount+=null!==(i=a.ROWS_COUNT)&&void 0!==i?i:this.rowData.size;const s={rowData:Array.from(this.rowData.values())};s.rowCount=this.getCorrectRowCount(e),this.lastSuccessRowData=s,e.success(s),this.notifyNoDataAvailableIfEmpty(e,s)}getCorrectRowCount(e){let a;return this.pagination,a=this.moreRows?-1:this.discoveredTotalRowCount||e.request.startRow+this.rowData.size,a}handleCurrentStreamLoad(e){if(!e||0==e.length)return;const a=new Map;e.forEach(e=>{const r=e[this.rowId];if(r)return void a.set(r,e);const t=`The specified rowId (${this.rowId}) is not present in the data. Since this is a snapshot (isSnapshot=true), an auto-generated UUID will be used. For custom identifiers, use the 'row-id' attribute.`;v.v.error(t);const o=this.uuid.createId();e[this.rowId]=o,a.set(o,e)}),this.rowData=a}setupSorting(e){return(0,t.sH)(this,void 0,void 0,function*(){var a;const r=e.request.sortModel;if((null===(a=this.currentSortModel)||void 0===a?void 0:a.length)!==r.length||r.length>0){if(0===r.length&&this.currentSortModel)return this.calculatedRowsCount=0,this.currentSortModel=null,this.resourceParams.DETAILS.ORDER_BY=void 0,yield this.refreshDatasource(e),!0;if(r.length>0){const a=r[0].colId,t=r[0].sort;if(JSON.stringify(r)!==JSON.stringify(this.currentSortModel))return this.currentSortModel=r,this.resourceParams.DETAILS.ORDER_BY=a+("desc"===t?" DESC":" ASC"),yield this.refreshDatasource(e),!0}}return!1})}refreshDatasource(e){const a=Object.create(null,{refreshDatasource:{get:()=>super.refreshDatasource}});return(0,t.sH)(this,void 0,void 0,function*(){this.destroyPollingStream(),this.debouncedCreateStream&&this.debouncedCreateStream.cancel(),this.discoveredTotalRowCount=null,this.currentNextOffset=0,this.resourceParams.DETAILS.VIEW_NUMBER=this.zeroBasedViewNumber?0:1,this.resourceParams.DETAILS.OFFSET=0,yield a.refreshDatasource.call(this,e)})}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return(0,t.sH)(this,void 0,void 0,function*(){this.destroyPollingStream(),this.debouncedCreateStream&&this.debouncedCreateStream.cancel(),yield e.destroy.call(this)})}createPollingStream(e){return(0,t.sH)(this,void 0,void 0,function*(){try{this.destroyPollingStream(),this.currentStreamParams=e;const{stream:a,datasource:r}=yield this.createReqRepStreamFunc(e);this.reqRepPollingStream=a,this.reqRepPollingDatasource=r,this.reqRepPollingSubscription=this.reqRepPollingStream.subscribe({next:a=>{this.currentStreamParams&&JSON.stringify(this.currentStreamParams)===JSON.stringify(e)&&this.onPollingUpdate&&this.onPollingUpdate(a)},error:e=>{var a;v.v.error("Polling stream error:",e),this.errorHandlerFunc&&this.errorHandlerFunc((null===(a=null==e?void 0:e.receivedMessage)||void 0===a?void 0:a.ERROR)||(null==e?void 0:e.message),"stream")}}),v.v.debug("Polling stream created for params:",e)}catch(e){v.v.error("Failed to create polling stream:",e)}})}destroyPollingStream(){this.reqRepPollingSubscription&&(this.reqRepPollingSubscription.unsubscribe(),this.reqRepPollingSubscription=void 0,v.v.debug("Polling subscription destroyed")),this.reqRepPollingDatasource&&(this.reqRepPollingDatasource.destroy(),this.reqRepPollingDatasource=void 0,v.v.debug("Polling datasource destroyed")),this.reqRepPollingStream=void 0,this.currentStreamParams=void 0,this.resetPreviousPollResult&&this.resetPreviousPollResult()}buildRequestDetails(e){const a={CRITERIA_MATCH:this.resourceParams.DETAILS.CRITERIA_MATCH,MAX_ROWS:this.resourceParams.DETAILS.MAX_ROWS,ORDER_BY:this.resourceParams.DETAILS.ORDER_BY};return"viewBased"===e?Object.assign(Object.assign({},a),{VIEW_NUMBER:this.resourceParams.DETAILS.VIEW_NUMBER}):Object.assign(Object.assign({},a),{OFFSET:this.resourceParams.DETAILS.OFFSET})}}let T=class extends((0,s.S)(m.ML)){constructor(){super(...arguments),this.zeroBasedViewNumber=!1,this.liveUpdates=!1,this.request={},this.sortIndicatorCSSDestroy=null,this.previousPollResult=new Map,this.hasCapturedFirstPollResult=!1}resourceNameChanged(e,a){e&&e!==a&&p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){yield this.restart()}))}criteriaChanged(e,a){const r=e!==(0,o.Q)(a,";");this.ssrmDatasource&&r&&p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){yield this.ssrmDatasource.refreshDatasource({criteria:a})}))}connectedCallback(){super.connectedCallback();const e=this.shouldRunConnect;p.DOM.queueUpdate(()=>{e&&(this.init(),this.subscribeToConnection())})}disconnectedCallback(){super.disconnectedCallback();const e=this.shouldRunDisconnect;p.DOM.queueUpdate(()=>(0,t.sH)(this,void 0,void 0,function*(){e&&(yield this.destroy(),this.unsubscribeFromConnection())}))}deepClone(){const e=super.deepClone();return e.deferredGridOptions=structuredClone(this.deferredGridOptions),e.deferredColumnStates=structuredClone(this.deferredColumnStates),e}reloadResourceData(e){return(0,t.sH)(this,void 0,void 0,function*(){var a;if(this.datasource.destroy(),null===(a=this.liveUpdatesStream)||void 0===a||a.unsubscribe(),this.liveUpdatesStream=void 0,this.$emit(h.c.cacheFilterConfig),this.clearRowData(null),this.setDisconnected(!1),e){const a=Object.assign(Object.assign({},this.datasourceOptions()),e);if(!(yield this.initializeDatasource(a,!0,!1)))return this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.refreshServerSide,{purge:!0}),void v.v.error("Genesis Datasource re-init failed on filtering/sorting.");this.$emit(h.c.refreshServerSide,{purge:!0})}else this.$emit(h.c.refreshServerSide,{purge:!0}),this.ssrmDatasource&&(yield this.ssrmDatasource.destroy(),this.ssrmDatasource=void 0),this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.loadingStarted),yield this.init()})}applyServerSideSortIndicatorStyling(){this.removeServerSideSortIndicatorStyling(),this.$emit(h.c.addGridCssClass,{className:"grid-pro-server-side"}),this.sortIndicatorCSSDestroy=(0,d.O5)('\n .grid-pro-server-side .ag-header-cell-sortable .ag-sort-indicator-container {\n opacity: 1 !important;\n visibility: visible !important;\n }\n \n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-container {\n opacity: 0.4 !important;\n }\n \n .grid-pro-server-side .ag-header-cell-sorted .ag-sort-indicator-container {\n opacity: 1 !important;\n }\n \n .grid-pro-server-side .ag-sort-ascending-icon::before,\n .grid-pro-server-side .ag-sort-descending-icon::before,\n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {\n font-family: var(--ag-icon-font-family, agGridAlpine) !important;\n font-size: var(--ag-icon-size, 16px) !important;\n color: var(--ag-header-foreground-color, var(--ag-foreground-color)) !important;\n }\n \n .grid-pro-server-side .ag-sort-ascending-icon::before {\n content: "\\e90d" !important; /* AG Grid sort up icon */\n }\n \n .grid-pro-server-side .ag-sort-descending-icon::before {\n content: "\\e90c" !important; /* AG Grid sort down icon */\n }\n \n .grid-pro-server-side .ag-header-cell-sortable:not(.ag-header-cell-sorted) .ag-sort-indicator-icon::before {\n content: "\\e90b" !important; /* AG Grid sort icon */\n opacity: 0.6 !important;\n }\n \n /* Ensure the sort indicator is always visible for sortable columns in server-side mode */\n .grid-pro-server-side .ag-header-cell-sortable .ag-sort-indicator-icon {\n display: inline-block !important;\n }\n',"grid-pro-server-side-sort")}removeServerSideSortIndicatorStyling(){this.$emit(h.c.removeGridCssClass,{className:"grid-pro-server-side"}),this.sortIndicatorCSSDestroy&&(this.sortIndicatorCSSDestroy(),this.sortIndicatorCSSDestroy=null)}init(){return(0,t.sH)(this,void 0,void 0,function*(){const e=Object.assign({getRowId:e=>e.data?String(e.data[this.rowId]):null,getRowStyle(e){var a,r;if(null===(r=null===(a=e.data)||void 0===a?void 0:a.ROW_REF)||void 0===r?void 0:r.includes("_deleted"))return{color:"grey"}},cacheBlockSize:this.maxRows,defaultColDef:{filter:!0,resizable:!0,sortable:!1,unSortIcon:!0},rowBuffer:0,rowModelType:"serverSide",suppressServerSideInfiniteScroll:!1,suppressMultiSort:!0,onFilterChanged:e=>{},onSortChanged:e=>{},onPaginationChanged:e=>this.onPaginationChanged(e)},this.deferredGridOptions);this.$emit(h.c.initialize,{options:e,keepColDefsOnClearRowData:this.keepColDefsOnClearRowData}),this.addEventListener(h.c.ready,e=>(0,t.sH)(this,void 0,void 0,function*(){const{pagination:a}=e.detail;this.pagination=a;if(!(yield this.initializeDatasource(this.datasourceOptions(),!0,!1)))return v.v.debug(`Genesis Datasource init failed for ${this.resourceName}`),this.clearRowData(),void this.setDisconnected(!0);this.$emit(u.V.dataInit),this.setDisconnected(!1),this.indexes=this.getResourceIndexes(this.datasource.availableIndexes,this.datasource.availableSortableFields);const r=(0,i.X)(this.datasource.originalFieldDef),t=yield this.getAgColumnDefs(r);if(this.$emit(h.c.schemaUpdated,{schema:t,metadata:r}),this.isRequestServer){const e=!this.isSnapshot&&!this.disablePolling;this.ssrmDatasource=new E({createReqRepRequestFunc:this.createReqRepRequest.bind(this),createReqRepStreamFunc:e?this.createReqRepStream.bind(this):void 0,onPollingUpdateFunc:e?this.applyReqRepPollingUpdate.bind(this):void 0,resetPreviousPollResultFunc:e?this.resetPreviousPollResult.bind(this):void 0,usePolling:e,reloadResourceDataFunc:this.reloadResourceData.bind(this),errorHandlerFunc:this.handleErrors.bind(this),onNoDataAvailableFunc:()=>this.$emit(h.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(h.c.loadingFinished),resourceName:this.resourceName,resourceParams:this.datasource.requestOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,maxView:+this.maxView,rowId:this.rowId,pagination:this.pagination,zeroBasedViewNumber:this.zeroBasedViewNumber,pagingMode:this.pagingMode,criteriaOnlyRequest:this.datasource.criteriaOnlyRequest})}else this.ssrmDatasource=new A({createDataserverStreamFunc:this.createDataserverStream.bind(this),reloadResourceDataFunc:this.reloadResourceData.bind(this),errorHandlerFunc:this.handleErrors.bind(this),onNoDataAvailableFunc:()=>this.$emit(h.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(h.c.loadingFinished),resourceName:this.resourceName,resourceParams:this.datasource.dataserverOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,maxView:+this.maxView,rowId:this.rowId,pagination:this.pagination,zeroBasedViewNumber:this.zeroBasedViewNumber});this.$emit(h.c.setServerSideDatasource,{datasource:this.ssrmDatasource}),this.$emit(h.c.filtersRestored),this.applyServerSideSortIndicatorStyling()}),{once:!0}),this.resourceName||this.handleErrors("Application not connected or invalid resource name, datasource will not work.","unknown")})}onPaginationChanged(e){var a;this.ssrmDatasource&&(this.ssrmDatasource.isNewPageSize=null!==(a=e.newPage)&&void 0!==a&&a)}destroy(){return(0,t.sH)(this,void 0,void 0,function*(){var e,a;this.datasource.destroy(),null===(e=this.liveUpdatesStream)||void 0===e||e.unsubscribe(),this.liveUpdatesStream=void 0,this.clearRowData(),this.ssrmDatasource&&(yield this.ssrmDatasource.destroy(),null===(a=this.pollingDatasource)||void 0===a||a.destroy(),this.ssrmDatasource=void 0),this.removeServerSideSortIndicatorStyling(),this.$emit(h.c.setServerSideDatasource,{datasource:null}),this.$emit(h.c.refreshServerSide,{purge:!0})})}restart(){return(0,t.sH)(this,void 0,void 0,function*(){yield this.destroy(),yield this.init()})}clearRowData(e=!0){this.rowData=new Map,e&&this.$emit(h.c.dataCleared,{includeSchema:!0}),this.transactionData={remove:[]},this.$emit(h.c.applyServerSideTransaction,{transaction:this.transactionData}),this.transactionData=void 0}getResourceIndexes(e,a){const r=new Map,t=new Set;if(null==e||e.forEach(e=>{const a=e.FIELDS.split(" ");r.set(e.NAME,a),a.forEach(e=>t.add(e))}),a&&a.length>0&&a.forEach(e=>t.add(e)),0===r.size&&t.size>0)r.set("SORTABLE_FIELDS",Array.from(t));else if(a&&a.length>0&&r.size>0){const e=new Set;r.forEach(a=>{a.forEach(a=>e.add(a))});const t=a.filter(a=>!e.has(a));t.length>0&&r.set("SORTABLE_FIELDS",t)}return r}createReqRepRequest(){return(0,t.sH)(this,arguments,void 0,function*(e=null){return yield this.datasource.snapshot(e)})}createReqRepStream(){return(0,t.sH)(this,arguments,void 0,function*(e=null){var a,r,t,o,i,n,l,g;const s=null!==(r=null===(a=null==e?void 0:e.DETAILS)||void 0===a?void 0:a.OFFSET)&&void 0!==r?r:0,d=null!==(o=null===(t=null==e?void 0:e.DETAILS)||void 0===t?void 0:t.MAX_ROWS)&&void 0!==o?o:this.maxRows,c=d+s,p=Object.assign(Object.assign({},this.datasourceOptions()),{criteria:null!==(n=null===(i=null==e?void 0:e.DETAILS)||void 0===i?void 0:i.CRITERIA_MATCH)&&void 0!==n?n:this.criteria,maxRows:c,orderBy:null!==(g=null===(l=null==e?void 0:e.DETAILS)||void 0===l?void 0:l.ORDER_BY)&&void 0!==g?g:this.orderBy});v.v.debug("Creating polling datasource for all loaded rows:",{currentOffset:s,baseMaxRows:d,totalRowsToFetch:c});if(yield this.pollingDatasource.init(p,!0,!0))return{stream:this.pollingDatasource.stream,datasource:this.pollingDatasource};v.v.error("Polling datasource init failed")})}resetPreviousPollResult(){this.previousPollResult.clear(),this.hasCapturedFirstPollResult=!1,v.v.debug("Previous poll result cleared")}applyReqRepPollingUpdate(e){var a;if(!this.ssrmDatasource||!e.REPLY)return;const r=e.REPLY;if(!Array.isArray(r)||!(null===(a=e.MESSAGE_TYPE)||void 0===a?void 0:a.startsWith("REP_")))return void v.v.error("received invalid RequestServerResult for polling update",e);if(!this.hasCapturedFirstPollResult)return r.forEach(e=>{this.previousPollResult.set(e[this.rowId],e)}),this.hasCapturedFirstPollResult=!0,void v.v.debug("First poll result stored for future comparison",{rowCount:this.previousPollResult.size});const t=new Map;r.forEach(e=>{t.set(e[this.rowId],e)});const o=[],i=[],n=[];r.forEach(e=>{const a=e[this.rowId];if(this.previousPollResult.has(a)){const r=this.previousPollResult.get(a);this.serializer.serialize(r)!==this.serializer.serialize(e)&&o.push(e)}else i.push(e)}),this.previousPollResult.forEach((e,a)=>{t.has(a)||n.push(e)}),(o.length>0||n.length>0||i.length>0)&&(this.previousPollResult=t,v.v.debug("Applying reqRep polling update via applyServerSideTransaction:",{added:i.length,updated:o.length,removed:n.length,totalInPoll:t.size}),this.$emit(h.c.applyServerSideTransaction,{transaction:{add:i,update:o,remove:n}}))}applyLiveServerSideUpdate(e){var a,r,t;const o=null!==(a=e.inserts)&&void 0!==a?a:[],i=null!==(r=e.updates)&&void 0!==r?r:[],n=null!==(t=e.deletes)&&void 0!==t?t:[];if(!o.length&&!i.length&&!n.length)return;const l=o.length-n.length;this.ssrmDatasource&&(this.ssrmDatasource.serverRowsCount+=l,this.ssrmDatasource.clientRowsCount+=l),this.transactionData={add:[],remove:[],update:[]},this.handleStreamInserts(o),this.handleStreamUpdates(i),this.handleStreamDeletes(n),this.transactionData.add.length>0&&this.$emit(h.c.applyServerSideTransaction,{transaction:{route:[],add:this.transactionData.add,addIndex:this.reverse?0:this.transactionData.addIndex}}),(this.transactionData.update.length>0||this.transactionData.remove.length>0)&&this.$emit(h.c.applyServerSideTransaction,{transaction:{route:[],update:this.transactionData.update,remove:this.transactionData.remove}})}createDataserverStream(){return(0,t.sH)(this,arguments,void 0,function*(e=null){if(this.liveUpdates){const e=e=>(0,t.sH)(this,void 0,void 0,function*(){var a;if(e.MESSAGE_TYPE!==n.Go.QUERY_UPDATE||!e.ROW)return;if(!(null===(a=this.ssrmDatasource)||void 0===a?void 0:a.sourceRef))return;if(void 0!==e.SEQUENCE_ID&&e.SEQUENCE_ID<=1)return;const r=e,t=Array.isArray(r.ROW)?r.ROW:r.ROW?[r.ROW]:[],o=this.ssrmDatasource.rowData,i=t.map(e=>{var a;const r=null!==(a=e.DETAILS)&&void 0!==a?a:{},t=r[this.rowId],i=null!=t?null==o?void 0:o.get(t):void 0;if(!i)return e;const n=Object.assign({},i);for(const[a,r]of Object.entries(e))"DETAILS"!==a&&null!=r&&(n[a]=r);return Object.assign(Object.assign({},n),{DETAILS:r})}),g=Object.assign(Object.assign({},r),{ROW:i}),s=(0,l.d)(g,this.rowId);this.applyLiveServerSideUpdate(s)}),a=e=>{var a;v.v.error(e),this.handleErrors((null===(a=e.receivedMessage)||void 0===a?void 0:a.ERROR)||e.message,"stream")};this.liveUpdatesStream=this.connect.stream(this.resourceName,()=>{},a,this.datasource.dataserverOnlyParams).subscribe(a=>e(a))}return yield this.datasource.startStream(),this.datasource.stream})}getAgColumnDefs(e){return(0,t.sH)(this,void 0,void 0,function*(){const a=this.generateColumnDefsFromMetadata(e,y,b);return a.forEach(e=>{e.sortable=[].concat(...this.indexes.values()).includes(e.field),this.datasource.criteriaOnlyRequest&&(e.filter=this.datasource.availableCriteriaFields.includes(e.field)?e.filter:null)}),a})}applyTransaction(e){this.$emit(h.c.applyServerSideTransaction,{transaction:e})}loadMore(){throw new Error("loadMore() method is not supported for server-side datasource")}};(0,t.Cg)([c.b_],T.prototype,"serializer",void 0),(0,t.Cg)([g.yW],T.prototype,"pollingDatasource",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"zero-based-view-number"})],T.prototype,"zeroBasedViewNumber",void 0),(0,t.Cg)([(0,p.attr)({mode:"boolean",attribute:"live-updates"})],T.prototype,"liveUpdates",void 0),(0,t.Cg)([(0,p.attr)({attribute:"paging-mode"})],T.prototype,"pagingMode",void 0),(0,t.Cg)([p.observable],T.prototype,"request",void 0),T=(0,t.Cg)([(0,p.customElement)({name:"grid-pro-server-side-datasource"})],T)},60591(e,a,r){r.d(a,{g:()=>t});const t=r(33681).css`
406
406
  .ag-dnd-ghost {
407
407
  background: var(--ag-header-background-color, var(--ag-background-color, #1f2126));
408
408
  border: solid 1px;
@@ -776,7 +776,7 @@
776
776
  overflow: unset;
777
777
  background: var(--ag-scrollbar-background, var(--neutral-layer-4));
778
778
  }
779
- `,shadowOptions:Ae},Re));var ot=a(96598);class st extends ot.t{}const nt=st.compose({baseName:"grid-text-renderer",styles:ot.JN,template:(0,ot.d6)("rapid")}),dt={rapidIconRenderer:_,rapidAgEditableRenderer:I,rapidAgActionRenderer:R,rapidAgActionsMenuRenderer:x,rapidAgBooleanRenderer:P,rapidAgTextRenderer:nt,rapidAgSelectRenderer:M,rapidAgDateEditor:y,rapidAgMultiselectEditor:v,rapidAgSelectEditor:g,rapidAgNumberEditor:p,rapidAgStringEditor:E,rapidStatusPillRenderer:V,rapidGridPro:ke,register(e,...t){if(e)for(const a in this)"register"!==a&&this[a]().register(e,...t)}};var lt=a(26347),gt=a(58749),ct=a(95553),ht=a(14609),pt=a(86636);const ut={fromView(e){if(null==e?void 0:e.trim())return e.includes(",")?e.split(",").map(e=>e.trim()):e.trim()},toView:e=>"string"==typeof e?e:Array.isArray(e)?e.join(","):""},mt="--dropdown-width",vt="options",bt="dnone",ft=n.css`
779
+ `,shadowOptions:Ae},Re));var ot=a(96598);class st extends ot.t{}const nt=st.compose({baseName:"grid-text-renderer",styles:ot.JN,template:(0,ot.d6)("rapid")}),dt={rapidIconRenderer:_,rapidAgEditableRenderer:I,rapidAgActionRenderer:R,rapidAgActionsMenuRenderer:x,rapidAgBooleanRenderer:P,rapidAgTextRenderer:nt,rapidAgSelectRenderer:M,rapidAgDateEditor:y,rapidAgMultiselectEditor:v,rapidAgSelectEditor:g,rapidAgNumberEditor:p,rapidAgStringEditor:E,rapidStatusPillRenderer:V,rapidGridPro:ke,register(e,...t){if(e)for(const a in this)"register"!==a&&this[a]().register(e,...t)}};var lt=a(57963),gt=a(58749),ct=a(95553),ht=a(14609),pt=a(86636);const ut={fromView(e){if(null==e?void 0:e.trim())return e.includes(",")?e.split(",").map(e=>e.trim()):e.trim()},toView:e=>"string"==typeof e?e:Array.isArray(e)?e.join(","):""},mt="--dropdown-width",vt="options",bt="dnone",ft=n.css`
780
780
  label {
781
781
  color: var(--neutral-foreground-hint, rgb(135 155 166));
782
782
  font-style: normal;
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[974],{31274(e,t,o){o.d(t,{u:()=>r});var a=o(60416);const r=(e,t,o)=>{(0,a.u_)(e);const r=t.split("-")[0],i=document.createElement(`${r}-dialog`),n=o?(e=>{let t=e.querySelector("#dialog-container");return t||(t=document.createElement("div"),t.setAttribute("id","dialog-container"),t.style.position="relative",e.appendChild(t)),t})(o):(0,a.jE)("dialog-container",t);n.appendChild(i),i.notification=e,i.show()}},60416(e,t,o){o.d(t,{cL:()=>u,jE:()=>p,uP:()=>d,u_:()=>c});var a=o(66506),r=o(52945),i=o(68424);const n=(0,a.createLogger)("foundation-notifications");let s=null;const l=new Map,d=e=>{var t,o;return`${null!==(t=null==e?void 0:e.title)&&void 0!==t?t:"Error"}: ${null!==(o=null==e?void 0:e.body)&&void 0!==o?o:"Something went wrong"}`},c=e=>{var t,o;n.log({message:d(e),level:(t=e,(null==t?void 0:t.logLevel)||(null===(o=null==t?void 0:t.config)||void 0===o?void 0:o.logLevel)||a.LogLevels.debug)})},p=(e,t)=>{let o=document.querySelector(`#${e}`);if(!o)if(l.has(e))o=l.get(e);else{const t=(0,r.fI)(document).find(t=>t.id===e);t&&(o=t,l.set(e,t))}if(!o){o=document.createElement("div"),o.setAttribute("id",e),o.style.zIndex="9999";const{element:t,prefix:a}=(0,i.DW)(document.body,"rapid");if(t)t.appendChild(o),s=t;else if(s)s.appendChild(o);else{const e=document.createElement(`${a}-design-system-provider`);e.appendChild(o),document.body.appendChild(e),s=e}}return o},u=e=>{for(var t,o;e&&!(e instanceof ShadowRoot);){const a=null===(t=null==e?void 0:e.getRootNode())||void 0===t?void 0:t.getElementById("banner-anchor");if(a)return a.style.position="relative",a;e=null===(o=null==e?void 0:e.getRootNode())||void 0===o?void 0:o.host}return g()},g=()=>{const e=document.createElement("div");return e.setAttribute("id","banner-anchor"),e.style.position="relative",document.body.insertBefore(e,document.body.firstChild),e}},70997(e,t,o){function a(e,t,o){const a=e=>"function"==typeof e?e:()=>e,r=a(t),i=a(o);return(t,o)=>e(t,o)?r(t,o):i(t,o)}o.d(t,{q:()=>a})},80273(e,t,o){o.d(t,{Du:()=>l,IT:()=>n,WP:()=>r,f4:()=>s,zz:()=>i});var a=o(52945);const r=(e,t)=>{(0,a.O5)(e,t)};var i,n;!function(e){e.Italic="italic",e.Normal="normal"}(i||(i={})),function(e){e[e.Thin=100]="Thin",e[e.Light=300]="Light",e[e.Regular=400]="Regular",e[e.Medium=500]="Medium",e[e.Bold=700]="Bold",e[e.Black=900]="Black"}(n||(n={}));const s=(e,t=i.Normal,o=n.Regular)=>`\n font-family: ${e};\n font-style: ${t};\n font-weight: ${o};\n`,l={minusOne:-1,minusTwo:-2,plusOne:1,plusTwo:2,plusThree:3,plusFour:4,plusFive:5,plusSix:6}},20974(e,t,o){o.r(t),o.d(t,{ColorPalette:()=>hc,ColorToken:()=>fc,ColorTokens:()=>Cc,DesignSystemEditor:()=>oc,DesignSystemExport:()=>uc,DesignSystemPreview:()=>Vc,EventName:()=>Vd,PreviewApp:()=>Fc,PreviewComponents:()=>dc,PreviewForm:()=>Pc,PreviewGrid:()=>Gc,TypographyTokens:()=>Rc,defaultBodyFont:()=>Jd,fontFamilies:()=>qd});var a={};o.r(a),o.d(a,{accentFillActive:()=>g.accentFillActive,accentFillActiveDelta:()=>g.accentFillActiveDelta,accentFillFocus:()=>g.accentFillFocus,accentFillFocusDelta:()=>g.accentFillFocusDelta,accentFillHover:()=>g.accentFillHover,accentFillHoverDelta:()=>g.accentFillHoverDelta,accentFillRest:()=>g.accentFillRest,accentFillRestDelta:()=>g.accentFillRestDelta,accentForegroundActive:()=>g.accentForegroundActive,accentForegroundActiveDelta:()=>g.accentForegroundActiveDelta,accentForegroundFocus:()=>g.accentForegroundFocus,accentForegroundFocusDelta:()=>g.accentForegroundFocusDelta,accentForegroundHover:()=>g.accentForegroundHover,accentForegroundHoverDelta:()=>g.accentForegroundHoverDelta,accentForegroundRest:()=>g.accentForegroundRest,accentForegroundRestDelta:()=>g.accentForegroundRestDelta,accentPalette:()=>g.accentPalette,baseHeightMultiplier:()=>g.baseHeightMultiplier,baseLayerLuminance:()=>g.baseLayerLuminance,bodyFont:()=>g.bodyFont,buyColor:()=>Wo,controlCornerRadius:()=>g.controlCornerRadius,defaultBuyColor:()=>Yo,defaultErrorColor:()=>Do,defaultInfoColor:()=>Xo,defaultSellColor:()=>Jo,defaultSeriousNotifyColor:()=>_o,defaultSuccessColor:()=>jo,defaultWarningColor:()=>Go,density:()=>g.density,designUnit:()=>g.designUnit,direction:()=>g.direction,disabledOpacity:()=>g.disabledOpacity,errorColor:()=>No,fillColor:()=>g.fillColor,focusStrokeInner:()=>g.focusStrokeInner,focusStrokeOuter:()=>g.focusStrokeOuter,focusStrokeWidth:()=>g.focusStrokeWidth,foregroundOnAccentActive:()=>g.foregroundOnAccentActive,foregroundOnAccentActiveLarge:()=>g.foregroundOnAccentActiveLarge,foregroundOnAccentFocus:()=>g.foregroundOnAccentFocus,foregroundOnAccentFocusLarge:()=>g.foregroundOnAccentFocusLarge,foregroundOnAccentHover:()=>g.foregroundOnAccentHover,foregroundOnAccentHoverLarge:()=>g.foregroundOnAccentHoverLarge,foregroundOnAccentRest:()=>g.foregroundOnAccentRest,foregroundOnAccentRestLarge:()=>g.foregroundOnAccentRestLarge,infoColor:()=>Ko,neutralFillActive:()=>g.neutralFillActive,neutralFillActiveDelta:()=>g.neutralFillActiveDelta,neutralFillFocus:()=>g.neutralFillFocus,neutralFillFocusDelta:()=>g.neutralFillFocusDelta,neutralFillHover:()=>g.neutralFillHover,neutralFillHoverDelta:()=>g.neutralFillHoverDelta,neutralFillInputActive:()=>g.neutralFillInputActive,neutralFillInputActiveDelta:()=>g.neutralFillInputActiveDelta,neutralFillInputFocus:()=>g.neutralFillInputFocus,neutralFillInputFocusDelta:()=>g.neutralFillInputFocusDelta,neutralFillInputHover:()=>g.neutralFillInputHover,neutralFillInputHoverDelta:()=>g.neutralFillInputHoverDelta,neutralFillInputRest:()=>g.neutralFillInputRest,neutralFillInputRestDelta:()=>g.neutralFillInputRestDelta,neutralFillLayerRest:()=>g.neutralFillLayerRest,neutralFillLayerRestDelta:()=>g.neutralFillLayerRestDelta,neutralFillRest:()=>g.neutralFillRest,neutralFillRestDelta:()=>g.neutralFillRestDelta,neutralFillStealthActive:()=>g.neutralFillStealthActive,neutralFillStealthActiveDelta:()=>g.neutralFillStealthActiveDelta,neutralFillStealthFocus:()=>g.neutralFillStealthFocus,neutralFillStealthFocusDelta:()=>g.neutralFillStealthFocusDelta,neutralFillStealthHover:()=>g.neutralFillStealthHover,neutralFillStealthHoverDelta:()=>g.neutralFillStealthHoverDelta,neutralFillStealthRest:()=>g.neutralFillStealthRest,neutralFillStealthRestDelta:()=>g.neutralFillStealthRestDelta,neutralFillStrongActive:()=>g.neutralFillStrongActive,neutralFillStrongActiveDelta:()=>g.neutralFillStrongActiveDelta,neutralFillStrongFocus:()=>g.neutralFillStrongFocus,neutralFillStrongFocusDelta:()=>g.neutralFillStrongFocusDelta,neutralFillStrongHover:()=>g.neutralFillStrongHover,neutralFillStrongHoverDelta:()=>g.neutralFillStrongHoverDelta,neutralFillStrongRest:()=>g.neutralFillStrongRest,neutralFillStrongRestDelta:()=>g.neutralFillStrongRestDelta,neutralForegroundHint:()=>g.neutralForegroundHint,neutralForegroundRest:()=>g.neutralForegroundRest,neutralLayer1:()=>g.neutralLayer1,neutralLayer2:()=>g.neutralLayer2,neutralLayer3:()=>g.neutralLayer3,neutralLayer4:()=>g.neutralLayer4,neutralLayerCardContainer:()=>g.neutralLayerCardContainer,neutralLayerFloating:()=>g.neutralLayerFloating,neutralPalette:()=>g.neutralPalette,neutralStrokeActive:()=>g.neutralStrokeActive,neutralStrokeActiveDelta:()=>g.neutralStrokeActiveDelta,neutralStrokeDividerRest:()=>g.neutralStrokeDividerRest,neutralStrokeDividerRestDelta:()=>g.neutralStrokeDividerRestDelta,neutralStrokeFocus:()=>g.neutralStrokeFocus,neutralStrokeFocusDelta:()=>g.neutralStrokeFocusDelta,neutralStrokeHover:()=>g.neutralStrokeHover,neutralStrokeHoverDelta:()=>g.neutralStrokeHoverDelta,neutralStrokeRest:()=>g.neutralStrokeRest,neutralStrokeRestDelta:()=>g.neutralStrokeRestDelta,sellColor:()=>Zo,seriousNotifyColor:()=>ea,strokeWidth:()=>g.strokeWidth,successColor:()=>Bo,typeRampBaseFontSize:()=>g.typeRampBaseFontSize,typeRampBaseLineHeight:()=>g.typeRampBaseLineHeight,typeRampMinus1FontSize:()=>g.typeRampMinus1FontSize,typeRampMinus1LineHeight:()=>g.typeRampMinus1LineHeight,typeRampMinus2FontSize:()=>g.typeRampMinus2FontSize,typeRampMinus2LineHeight:()=>g.typeRampMinus2LineHeight,typeRampPlus1FontSize:()=>g.typeRampPlus1FontSize,typeRampPlus1LineHeight:()=>g.typeRampPlus1LineHeight,typeRampPlus2FontSize:()=>g.typeRampPlus2FontSize,typeRampPlus2LineHeight:()=>g.typeRampPlus2LineHeight,typeRampPlus3FontSize:()=>g.typeRampPlus3FontSize,typeRampPlus3LineHeight:()=>g.typeRampPlus3LineHeight,typeRampPlus4FontSize:()=>g.typeRampPlus4FontSize,typeRampPlus4LineHeight:()=>g.typeRampPlus4LineHeight,typeRampPlus5FontSize:()=>g.typeRampPlus5FontSize,typeRampPlus5LineHeight:()=>g.typeRampPlus5LineHeight,typeRampPlus6FontSize:()=>g.typeRampPlus6FontSize,typeRampPlus6LineHeight:()=>g.typeRampPlus6LineHeight,warningColor:()=>Uo});var r={};o.r(r),o.d(r,{accentPaletteValue:()=>ta,baseHeightMultiplierValue:()=>na,baseLayerLuminanceValue:()=>aa,bodyFontValue:()=>ha,controlCornerRadiusValue:()=>sa,densityValue:()=>la,designTokens:()=>fa,designUnitValue:()=>da,directionValue:()=>ra,neutralPaletteValue:()=>oa,strokeWidthValue:()=>ia,typeRampBaseFontSizeValue:()=>ba,typeRampBaseLineHeightValue:()=>va});var i=o(55823),n=o(26347),s=o(21409),l=o(83453),d=o.n(l),c=o(60496),p=o(33681),u=o(38370),g=o(54634),m=o(85090),h=o(31679),b=o(66506);const v=(0,b.createLogger)("foundation-form"),f=(e,t,o,a)=>{var r,i,n;if(!e||!o)return"";const s=e.filter(e=>e&&"anyOf"===e.keyword);if(0===s.length)return"";const l=null===(r=null==t?void 0:t.errorMessage)||void 0===r?void 0:r.anyOf,d=a||l,c="/"+o.replace(/\./g,"/"),p=s.find(e=>{const t=e.instancePath||"",o=e.schema;if(t===c)return!0;if(Array.isArray(o)){return o.flatMap(e=>t+"/"+Object.keys(e).flatMap(t=>e[t])).includes(c)}return!1});if(p){const e=p.schema||(null===(i=p.parentSchema)||void 0===i?void 0:i.anyOf);if(Array.isArray(e)){const t=new Set;e.forEach(e=>{(e&&Array.isArray(e.required)?e.required:[]).forEach(e=>t.add(e))});const a=o.split(".").pop();if(!a||!t.has(a))return"";const r=(null===(n=p.parentSchema)||void 0===n?void 0:n.properties)||{},i=Array.from(t).map(e=>((e,t)=>{const o=t[e]||{},a=["required"];return"number"==typeof o.minLength&&a.push("minLength"),"number"==typeof o.maxLength&&a.push("maxLength"),"number"==typeof o.minimum&&a.push("minimum"),"number"==typeof o.maximum&&a.push("maximum"),"number"!=typeof o.exclusiveMinimum&&!0!==o.exclusiveMinimum||a.push("exclusiveMinimum"),"number"!=typeof o.exclusiveMaximum&&!0!==o.exclusiveMaximum||a.push("exclusiveMaximum"),"string"==typeof o.pattern&&a.push("pattern"),o.type&&a.push(`type:${o.type}`),`${e}${a.length>1?` (${a.join(", ")})`:""}`})(e,r));if(1===i.length)return d||`Field ${i[0]} is required.`;const s=2===i.length?`${i[0]} or ${i[1]}`:`${i.slice(0,-1).join(", ")}, or ${i[i.length-1]}`;return d||`One of ${s} must be provided.`}return d||p.message||""}return""},y=(x="foundation-form",p.css`
1
+ "use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[974],{31274(e,t,o){o.d(t,{u:()=>r});var a=o(60416);const r=(e,t,o)=>{(0,a.u_)(e);const r=t.split("-")[0],i=document.createElement(`${r}-dialog`),n=o?(e=>{let t=e.querySelector("#dialog-container");return t||(t=document.createElement("div"),t.setAttribute("id","dialog-container"),t.style.position="relative",e.appendChild(t)),t})(o):(0,a.jE)("dialog-container",t);n.appendChild(i),i.notification=e,i.show()}},60416(e,t,o){o.d(t,{cL:()=>u,jE:()=>p,uP:()=>d,u_:()=>c});var a=o(66506),r=o(52945),i=o(68424);const n=(0,a.createLogger)("foundation-notifications");let s=null;const l=new Map,d=e=>{var t,o;return`${null!==(t=null==e?void 0:e.title)&&void 0!==t?t:"Error"}: ${null!==(o=null==e?void 0:e.body)&&void 0!==o?o:"Something went wrong"}`},c=e=>{var t,o;n.log({message:d(e),level:(t=e,(null==t?void 0:t.logLevel)||(null===(o=null==t?void 0:t.config)||void 0===o?void 0:o.logLevel)||a.LogLevels.debug)})},p=(e,t)=>{let o=document.querySelector(`#${e}`);if(!o)if(l.has(e))o=l.get(e);else{const t=(0,r.fI)(document).find(t=>t.id===e);t&&(o=t,l.set(e,t))}if(!o){o=document.createElement("div"),o.setAttribute("id",e),o.style.zIndex="9999";const{element:t,prefix:a}=(0,i.DW)(document.body,"rapid");if(t)t.appendChild(o),s=t;else if(s)s.appendChild(o);else{const e=document.createElement(`${a}-design-system-provider`);e.appendChild(o),document.body.appendChild(e),s=e}}return o},u=e=>{for(var t,o;e&&!(e instanceof ShadowRoot);){const a=null===(t=null==e?void 0:e.getRootNode())||void 0===t?void 0:t.getElementById("banner-anchor");if(a)return a.style.position="relative",a;e=null===(o=null==e?void 0:e.getRootNode())||void 0===o?void 0:o.host}return g()},g=()=>{const e=document.createElement("div");return e.setAttribute("id","banner-anchor"),e.style.position="relative",document.body.insertBefore(e,document.body.firstChild),e}},70997(e,t,o){function a(e,t,o){const a=e=>"function"==typeof e?e:()=>e,r=a(t),i=a(o);return(t,o)=>e(t,o)?r(t,o):i(t,o)}o.d(t,{q:()=>a})},80273(e,t,o){o.d(t,{Du:()=>l,IT:()=>n,WP:()=>r,f4:()=>s,zz:()=>i});var a=o(52945);const r=(e,t)=>{(0,a.O5)(e,t)};var i,n;!function(e){e.Italic="italic",e.Normal="normal"}(i||(i={})),function(e){e[e.Thin=100]="Thin",e[e.Light=300]="Light",e[e.Regular=400]="Regular",e[e.Medium=500]="Medium",e[e.Bold=700]="Bold",e[e.Black=900]="Black"}(n||(n={}));const s=(e,t=i.Normal,o=n.Regular)=>`\n font-family: ${e};\n font-style: ${t};\n font-weight: ${o};\n`,l={minusOne:-1,minusTwo:-2,plusOne:1,plusTwo:2,plusThree:3,plusFour:4,plusFive:5,plusSix:6}},20974(e,t,o){o.r(t),o.d(t,{ColorPalette:()=>hc,ColorToken:()=>fc,ColorTokens:()=>Cc,DesignSystemEditor:()=>oc,DesignSystemExport:()=>uc,DesignSystemPreview:()=>Vc,EventName:()=>Vd,PreviewApp:()=>Fc,PreviewComponents:()=>dc,PreviewForm:()=>Pc,PreviewGrid:()=>Gc,TypographyTokens:()=>Rc,defaultBodyFont:()=>Jd,fontFamilies:()=>qd});var a={};o.r(a),o.d(a,{accentFillActive:()=>g.accentFillActive,accentFillActiveDelta:()=>g.accentFillActiveDelta,accentFillFocus:()=>g.accentFillFocus,accentFillFocusDelta:()=>g.accentFillFocusDelta,accentFillHover:()=>g.accentFillHover,accentFillHoverDelta:()=>g.accentFillHoverDelta,accentFillRest:()=>g.accentFillRest,accentFillRestDelta:()=>g.accentFillRestDelta,accentForegroundActive:()=>g.accentForegroundActive,accentForegroundActiveDelta:()=>g.accentForegroundActiveDelta,accentForegroundFocus:()=>g.accentForegroundFocus,accentForegroundFocusDelta:()=>g.accentForegroundFocusDelta,accentForegroundHover:()=>g.accentForegroundHover,accentForegroundHoverDelta:()=>g.accentForegroundHoverDelta,accentForegroundRest:()=>g.accentForegroundRest,accentForegroundRestDelta:()=>g.accentForegroundRestDelta,accentPalette:()=>g.accentPalette,baseHeightMultiplier:()=>g.baseHeightMultiplier,baseLayerLuminance:()=>g.baseLayerLuminance,bodyFont:()=>g.bodyFont,buyColor:()=>Wo,controlCornerRadius:()=>g.controlCornerRadius,defaultBuyColor:()=>Yo,defaultErrorColor:()=>Do,defaultInfoColor:()=>Xo,defaultSellColor:()=>Jo,defaultSeriousNotifyColor:()=>_o,defaultSuccessColor:()=>jo,defaultWarningColor:()=>Go,density:()=>g.density,designUnit:()=>g.designUnit,direction:()=>g.direction,disabledOpacity:()=>g.disabledOpacity,errorColor:()=>No,fillColor:()=>g.fillColor,focusStrokeInner:()=>g.focusStrokeInner,focusStrokeOuter:()=>g.focusStrokeOuter,focusStrokeWidth:()=>g.focusStrokeWidth,foregroundOnAccentActive:()=>g.foregroundOnAccentActive,foregroundOnAccentActiveLarge:()=>g.foregroundOnAccentActiveLarge,foregroundOnAccentFocus:()=>g.foregroundOnAccentFocus,foregroundOnAccentFocusLarge:()=>g.foregroundOnAccentFocusLarge,foregroundOnAccentHover:()=>g.foregroundOnAccentHover,foregroundOnAccentHoverLarge:()=>g.foregroundOnAccentHoverLarge,foregroundOnAccentRest:()=>g.foregroundOnAccentRest,foregroundOnAccentRestLarge:()=>g.foregroundOnAccentRestLarge,infoColor:()=>Ko,neutralFillActive:()=>g.neutralFillActive,neutralFillActiveDelta:()=>g.neutralFillActiveDelta,neutralFillFocus:()=>g.neutralFillFocus,neutralFillFocusDelta:()=>g.neutralFillFocusDelta,neutralFillHover:()=>g.neutralFillHover,neutralFillHoverDelta:()=>g.neutralFillHoverDelta,neutralFillInputActive:()=>g.neutralFillInputActive,neutralFillInputActiveDelta:()=>g.neutralFillInputActiveDelta,neutralFillInputFocus:()=>g.neutralFillInputFocus,neutralFillInputFocusDelta:()=>g.neutralFillInputFocusDelta,neutralFillInputHover:()=>g.neutralFillInputHover,neutralFillInputHoverDelta:()=>g.neutralFillInputHoverDelta,neutralFillInputRest:()=>g.neutralFillInputRest,neutralFillInputRestDelta:()=>g.neutralFillInputRestDelta,neutralFillLayerRest:()=>g.neutralFillLayerRest,neutralFillLayerRestDelta:()=>g.neutralFillLayerRestDelta,neutralFillRest:()=>g.neutralFillRest,neutralFillRestDelta:()=>g.neutralFillRestDelta,neutralFillStealthActive:()=>g.neutralFillStealthActive,neutralFillStealthActiveDelta:()=>g.neutralFillStealthActiveDelta,neutralFillStealthFocus:()=>g.neutralFillStealthFocus,neutralFillStealthFocusDelta:()=>g.neutralFillStealthFocusDelta,neutralFillStealthHover:()=>g.neutralFillStealthHover,neutralFillStealthHoverDelta:()=>g.neutralFillStealthHoverDelta,neutralFillStealthRest:()=>g.neutralFillStealthRest,neutralFillStealthRestDelta:()=>g.neutralFillStealthRestDelta,neutralFillStrongActive:()=>g.neutralFillStrongActive,neutralFillStrongActiveDelta:()=>g.neutralFillStrongActiveDelta,neutralFillStrongFocus:()=>g.neutralFillStrongFocus,neutralFillStrongFocusDelta:()=>g.neutralFillStrongFocusDelta,neutralFillStrongHover:()=>g.neutralFillStrongHover,neutralFillStrongHoverDelta:()=>g.neutralFillStrongHoverDelta,neutralFillStrongRest:()=>g.neutralFillStrongRest,neutralFillStrongRestDelta:()=>g.neutralFillStrongRestDelta,neutralForegroundHint:()=>g.neutralForegroundHint,neutralForegroundRest:()=>g.neutralForegroundRest,neutralLayer1:()=>g.neutralLayer1,neutralLayer2:()=>g.neutralLayer2,neutralLayer3:()=>g.neutralLayer3,neutralLayer4:()=>g.neutralLayer4,neutralLayerCardContainer:()=>g.neutralLayerCardContainer,neutralLayerFloating:()=>g.neutralLayerFloating,neutralPalette:()=>g.neutralPalette,neutralStrokeActive:()=>g.neutralStrokeActive,neutralStrokeActiveDelta:()=>g.neutralStrokeActiveDelta,neutralStrokeDividerRest:()=>g.neutralStrokeDividerRest,neutralStrokeDividerRestDelta:()=>g.neutralStrokeDividerRestDelta,neutralStrokeFocus:()=>g.neutralStrokeFocus,neutralStrokeFocusDelta:()=>g.neutralStrokeFocusDelta,neutralStrokeHover:()=>g.neutralStrokeHover,neutralStrokeHoverDelta:()=>g.neutralStrokeHoverDelta,neutralStrokeRest:()=>g.neutralStrokeRest,neutralStrokeRestDelta:()=>g.neutralStrokeRestDelta,sellColor:()=>Zo,seriousNotifyColor:()=>ea,strokeWidth:()=>g.strokeWidth,successColor:()=>Bo,typeRampBaseFontSize:()=>g.typeRampBaseFontSize,typeRampBaseLineHeight:()=>g.typeRampBaseLineHeight,typeRampMinus1FontSize:()=>g.typeRampMinus1FontSize,typeRampMinus1LineHeight:()=>g.typeRampMinus1LineHeight,typeRampMinus2FontSize:()=>g.typeRampMinus2FontSize,typeRampMinus2LineHeight:()=>g.typeRampMinus2LineHeight,typeRampPlus1FontSize:()=>g.typeRampPlus1FontSize,typeRampPlus1LineHeight:()=>g.typeRampPlus1LineHeight,typeRampPlus2FontSize:()=>g.typeRampPlus2FontSize,typeRampPlus2LineHeight:()=>g.typeRampPlus2LineHeight,typeRampPlus3FontSize:()=>g.typeRampPlus3FontSize,typeRampPlus3LineHeight:()=>g.typeRampPlus3LineHeight,typeRampPlus4FontSize:()=>g.typeRampPlus4FontSize,typeRampPlus4LineHeight:()=>g.typeRampPlus4LineHeight,typeRampPlus5FontSize:()=>g.typeRampPlus5FontSize,typeRampPlus5LineHeight:()=>g.typeRampPlus5LineHeight,typeRampPlus6FontSize:()=>g.typeRampPlus6FontSize,typeRampPlus6LineHeight:()=>g.typeRampPlus6LineHeight,warningColor:()=>Uo});var r={};o.r(r),o.d(r,{accentPaletteValue:()=>ta,baseHeightMultiplierValue:()=>na,baseLayerLuminanceValue:()=>aa,bodyFontValue:()=>ha,controlCornerRadiusValue:()=>sa,densityValue:()=>la,designTokens:()=>fa,designUnitValue:()=>da,directionValue:()=>ra,neutralPaletteValue:()=>oa,strokeWidthValue:()=>ia,typeRampBaseFontSizeValue:()=>ba,typeRampBaseLineHeightValue:()=>va});var i=o(55823),n=o(57963),s=o(21409),l=o(83453),d=o.n(l),c=o(60496),p=o(33681),u=o(38370),g=o(54634),m=o(85090),h=o(31679),b=o(66506);const v=(0,b.createLogger)("foundation-form"),f=(e,t,o,a)=>{var r,i,n;if(!e||!o)return"";const s=e.filter(e=>e&&"anyOf"===e.keyword);if(0===s.length)return"";const l=null===(r=null==t?void 0:t.errorMessage)||void 0===r?void 0:r.anyOf,d=a||l,c="/"+o.replace(/\./g,"/"),p=s.find(e=>{const t=e.instancePath||"",o=e.schema;if(t===c)return!0;if(Array.isArray(o)){return o.flatMap(e=>t+"/"+Object.keys(e).flatMap(t=>e[t])).includes(c)}return!1});if(p){const e=p.schema||(null===(i=p.parentSchema)||void 0===i?void 0:i.anyOf);if(Array.isArray(e)){const t=new Set;e.forEach(e=>{(e&&Array.isArray(e.required)?e.required:[]).forEach(e=>t.add(e))});const a=o.split(".").pop();if(!a||!t.has(a))return"";const r=(null===(n=p.parentSchema)||void 0===n?void 0:n.properties)||{},i=Array.from(t).map(e=>((e,t)=>{const o=t[e]||{},a=["required"];return"number"==typeof o.minLength&&a.push("minLength"),"number"==typeof o.maxLength&&a.push("maxLength"),"number"==typeof o.minimum&&a.push("minimum"),"number"==typeof o.maximum&&a.push("maximum"),"number"!=typeof o.exclusiveMinimum&&!0!==o.exclusiveMinimum||a.push("exclusiveMinimum"),"number"!=typeof o.exclusiveMaximum&&!0!==o.exclusiveMaximum||a.push("exclusiveMaximum"),"string"==typeof o.pattern&&a.push("pattern"),o.type&&a.push(`type:${o.type}`),`${e}${a.length>1?` (${a.join(", ")})`:""}`})(e,r));if(1===i.length)return d||`Field ${i[0]} is required.`;const s=2===i.length?`${i[0]} or ${i[1]}`:`${i.slice(0,-1).join(", ")}, or ${i[i.length-1]}`;return d||`One of ${s} must be provided.`}return d||p.message||""}return""},y=(x="foundation-form",p.css`
2
2
  ${x} .foundation-control-wrapper-root {
3
3
  margin-bottom: var(--wrapper-root-margin-bottom, calc(var(--design-unit) * 4px));
4
4
  }