eservices-core 1.3.325 → 1.3.326

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.
@@ -22,6 +22,11 @@ export interface IClientContent {
22
22
  * разберётся, что данный параметр используется и установка новых будет завершаться ошибкой.
23
23
  */
24
24
  constContextId?: number | null;
25
+ /**
26
+ * @description Идентификатор контекста, который должен быть установлен в систему. Аналогичен constContextId, однако
27
+ * с возможностью изменения
28
+ */
29
+ selectedContextId?: number | null;
25
30
  }
26
31
  export interface IOrganizationContent {
27
32
  /**
@@ -0,0 +1,11 @@
1
+ export interface ITemplateConfiguration {
2
+ /**
3
+ * @description Название текущей сущности к которой относится template
4
+ */
5
+ entityName: string;
6
+ /**
7
+ * @description Название template
8
+ */
9
+ templateName: string;
10
+ [k: string]: unknown;
11
+ }
@@ -1,6 +1,6 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('*{--extra-fast:.1s;--fast:.2s;--medium:.3s;box-sizing:border-box;--primary: #3949ab }html,body,#app{height:100%}body{margin:0}ul{text-align:left}.justify-content-center{justify-content:center}.user-select-none{-webkit-user-select:none;user-select:none}.flex{display:flex}.flex_column,.flex-column{display:flex;flex-direction:column}.flex_center{display:flex;align-items:center;justify-content:center}.flex_full,.flex_grow,.flex-grow{flex-grow:1}.flex-align_center{align-items:center}.grid{display:grid}.grid-center{display:grid;place-content:center}.link{text-decoration:var(--link-decoration);color:var(--link-color)}.link_hover-underline:hover,.link_hover_underline:hover{text-decoration:underline}.link_full{position:absolute;height:100%;width:100%;left:0;top:0}.text_sm{font-weight:400;font-size:12px;line-height:16px}.text_md{font-size:14px;line-height:20px}.text_lg{font-size:16px;line-height:24px}.text_size_xxl{font-size:18px;line-height:25px}.text_bold,.text-bold{font-weight:600}.text_nowrap{white-space:nowrap}.text_right{text-align:right}.text_center{text-align:center}.text_size_sm{font-size:12px;line-height:130%}.text_size_md{font-size:14px;line-height:140%}.text_error{color:red}.text_overflow{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.title_sm{font-weight:600;font-size:16px;line-height:24px}.title_md{font-weight:600;font-size:24px;line-height:32px}.title_lg{font-weight:700;font-size:32px;line-height:48px}.title_xxl,.title_xl{font-weight:700;font-size:48px;line-height:64px}.cursor_pointer{cursor:pointer}.cursor_default{cursor:default}button{outline:none;-webkit-user-select:none;user-select:none;transition:background-color .2s}.button{display:flex;align-items:center;justify-content:center;outline:none}.button_main{background-color:var(--button-background);color:var(--button-color)}.button_main:focus{background-color:var(--button-background-active)}.button_main:active{background-color:var(--button-background-active)}.button_white{background-color:var(--white);color:var(--main)}.button_sm{height:30px;width:130px}.button_shadow{box-shadow:0 2px 4px #00000040}.button_lg{font-weight:600;font-size:16px;line-height:24px;padding:12px 0;height:50px;width:200px}.button_disabled{background-color:var(--gray-1)}.button_resolve{background-color:var(--main);color:var(--white);border-radius:2px}.button_reject{border:1px solid var(--color-dark);border-radius:2px}.button_md{height:30px;padding:0 10px;min-width:80px}.button_disabled{background-color:var(--button-disabled-background-color);cursor:pointer!important}.color-light{color:var(--color-light)}.color-primary{color:var(--color-primary)}.color_main,.color__text_main{color:var(--main)}.color__text_black{color:var(--black-1)}.color__text_gray{color:var(--text-gray)}.color__text_red,.color_red{color:var(--red)}.color__text_white{color:var(--white)}.background_orange{background-color:var(--orange)}.background_red{background-color:var(--red)}.color_dark{color:var(--dark)}.color_light{color:var(--light)}.move-vertical-enter-active,.move-vertical-leave-active{transition:transform .5s ease}.move-vertical-enter-from,.move-vertical-leave-to{transform:translateY(-10px)}.move-horizontal-enter-active,.move-horizontal-leave-active{transition:transform .5s}.move-horizontal-enter-from,.move-horizontal-leave-to{transform:translate(-40px)}.modal-vertical-enter-active,.modal-vertical-leave-active,.modal-default{transition:transform var(--medium)}.modal-vertical-enter-active .modal-default,.modal-vertical-leave-active .modal-default{transform:translateY(-100px)}.move-vertical-fast-enter-active,.move-vertical-fast-leave-active{transition:transform var(--fast) ease}.move-vertical-fast-enter-from,.move-vertical-fast-leave-to{transform:translateY(-20px)}.slide-up-enter-active,.slide-up-leave-active{transition:transform var(--fast) ease,opacity var(--fast)}.slide-up-enter-from,.slide-up-leave-to{transform:translateY(20px);opacity:0}.opacity-enter-active,.opacity-leave-active{transition:opacity var(--fast) ease}.opacity-enter-from,.opacity-leave-to{opacity:0}.list-move,.list-enter-active,.list-leave-active{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translate(30px)}.list-leave-active{position:absolute}.transition-fast{transition:.1s}.modal-default{background-color:var(--white);position:relative;z-index:1;width:auto;background:var(--white);border-radius:var(--border-radius)}.modal-default__head{background-color:var(--black-1);text-align:center;padding:5px 0;border-radius:6px 6px 0 0}.modal-default__body{gap:20px;padding:0 15px}.modal-default__foot{padding:30px 0;display:flex;justify-content:center}.hint-tooltip{display:block;z-index:222;margin:auto;pointer-events:none;box-shadow:0 0 0 9999px #00000080}.tooltip-help-circle-in,.tooltip-help-circle-out{border-radius:50%}.tooltip-help-undefined{border-radius:50px}.tooltip-card{position:fixed;z-index:315;display:flex;flex-direction:column;width:480px;height:fit-content;margin:auto;border-radius:10px;background-color:var(--hint-background);cursor:default}.tooltip-card__foot{display:flex;justify-content:space-between;align-items:center;background-color:var(--hint-background-navigation);border-radius:10px;padding:20px}.tooltip-card__foot-current{font-weight:600;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body{position:relative;display:flex;flex-direction:column;gap:8px;padding:20px 20px 10px}.tooltip-card__body-title{font-weight:700;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body-text{font-size:16px;line-height:24px;color:var(--white)}.tooltip-card__foot-button_back{background-color:var(--main-1)}.tooltip-card__foot-button_next{background-color:var(--hint)}.tooltip-card__body-close{position:absolute;right:22px;top:12px;width:20px;height:16px;opacity:.3;cursor:pointer}.tooltip-card__body-close:hover{opacity:1}.tooltip-card__body-close:before,.tooltip-card__body-close:after{position:absolute;left:15px;content:" ";height:21px;width:2px;background-color:#fff}.tooltip-card__body-close:before{transform:rotate(45deg)}.tooltip-card__body-close:after{transform:rotate(-45deg)}.tooltip-card-container-wrap{pointer-events:none;position:absolute;left:0;top:0;z-index:123132;height:100%;width:100%}.tooltip-card-container-wrap>div{height:100%;width:100%;display:flex;justify-content:center;align-items:center}.tester-box-tooltip{pointer-events:all}.position_relative{position:relative}.position_absolute{position:absolute}.gap_5{gap:5px}.gap_10{gap:10px}.gap_15{gap:15px}.gap_20{gap:20px}.gap-25{gap:25px}.margin-0,.margin_0{margin:0}.widget-input{background-color:var(--input-background);border:var(--input-border);border-radius:var(--input-border-radius);color:var(--input-color)}.widget-input:disabled{background-color:var(--input-background-disabled);border:var(--input-border-disabled)}.widget-input[error=true]{border:var(--input-border-error)}.widget-input::placeholder{color:var(--input-placeholder-color)}.widget-input:disabled::placeholder{color:var(--input-placeholder-color-disabled)}.input_error{border:1px solid red!important}.input_size_md{height:var(--input-height)}.input-title{font-size:12px;line-height:16px;color:#667085;margin:4px 0}.widget-table{border-collapse:collapse}.widget-table_mini p{margin:0}.list-cell-link>a{position:absolute;left:0;top:0;z-index:1;height:100%;width:100%;cursor:pointer}.list-cell-link>p{font-weight:500}.widget-table__cell{padding:0 20px;font-weight:400;font-size:14px;line-height:19px}.widget-table-cell_use{cursor:pointer}.widget-table-cell_select{width:min-content}.table-cell-toggle{--border-color: black;position:relative;display:grid;place-content:center;border:1px solid var(--border-color);height:15px;aspect-ratio:1 / 1;border-radius:50%}.table-cell-toggle_active:after{content:"";border-radius:50%;background-color:var(--border-color);height:9px;aspect-ratio:1/1}.widget-table-cell_number,.widget-table-cell_money{text-align:end}.widget-list-cell-history{cursor:pointer}.widget-list-cell-history>span{color:var(--color-primary);font-size:16px;padding:0 10px}.widget-table-cell_multi-select>.container-input-wrap{align-items:center}.overflow_auto{overflow:auto}.overflow_hidden{overflow:hidden}.padding_5{padding:5px}.padding_10{padding:10px}.padding_0{padding:0}.padding_15{padding:15px}.padding_20{padding:20px}.padding-5{padding:5px}.padding-0{padding:0}.padding-15{padding:15px}.padding-20{padding:20px}.radius_5{border-radius:5px}.radius_10{border-radius:10px}.radius_15{border-radius:15px}.radius_20{border-radius:20px}.es-card-list{box-shadow:#959da533 0 8px 24px;border:1px solid #f1f1f1;border-radius:4px;background-color:#fff}.color-gray{color:#ccc}.es-container-full{height:100%;width:100%}.es-cursor-pointer{cursor:pointer}.es-cursor-default{cursor:default}.flex,.es-flex{display:flex}.es-flex-column{display:flex;flex-direction:column}.es-flex-center{display:flex;align-items:center;justify-content:center}.es-flex-grow{flex-grow:1}.es-flex-justify-center{justify-content:center}.es-flex-justify-between{justify-content:space-between}.es-flex-align-center{align-items:center}.es-gap-1{gap:1px}.es-gap-2{gap:2px}.es-gap-3{gap:3px}.es-gap-4{gap:4px}.es-gap-5{gap:5px}.es-gap-6{gap:6px}.es-gap-7{gap:7px}.es-gap-8{gap:8px}.es-gap-9{gap:9px}.es-gap-10{gap:10px}.es-gap-15{gap:15px}.es-gap-20{gap:20px}.gap-10{gap:10px}.gap-15{gap:15px}.gap-5{gap:5px}.gap-20{gap:20px}.es-list-container,.es-overflow-auto{overflow:auto}.es-overflow-hidden{overflow:hidden}.es-padding-2{padding:2px}.es-padding-3{padding:3px}.es-padding-4{padding:4px}.es-padding-5{padding:5px}.es-padding-10{padding:10px}.es-padding-0{padding:0}.es-padding-7{padding:7px}.es-padding-15{padding:15px}.es-padding-20{padding:20px}.es-padding-v-5{padding:5px 0}.es-padding-h-5{padding:0 5px}.es-padding-is-5{padding-inline-start:5px}.es-padding-ie-5{padding-inline-end:5px}.padding-bottom-10{padding-bottom:10px}.padding-10{padding:10px}.es-position-relative{position:relative}.es-position-absolute{position:absolute}.es-position-absolute-full{position:absolute;left:0;top:0;width:100%;height:100%}.es-position-absolute-center{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}.es-radius-2{border-radius:2px}.es-radius-3{border-radius:3px}.es-radius-4{border-radius:4px}.es-radius-5{border-radius:5px}.es-radius-6{border-radius:6px}.es-radius-7{border-radius:7px}.es-radius-8{border-radius:8px}.es-radius-9{border-radius:9px}.es-radius-10{border-radius:10px}.es-radius-15{border-radius:15px}.es-radius-20{border-radius:20px}.es-text-xs{font-weight:400;font-size:10px;line-height:13px}.es-text-sm{font-weight:400;font-size:12px;line-height:16px}.es-text-md{font-size:14px;line-height:20px}.es-text-lg{font-size:16px;line-height:24px}.es-text-xl{font-size:18px;line-height:25px}.es-text-center{text-align:center}.es-text-bold{font-weight:700}.es-text-no-wrap{text-wrap:nowrap}.es-weight-600{font-weight:600}.es-zindex-0{z-index:0}.es-zindex-1{z-index:1}.es-zindex-2{z-index:2}.es-zindex-3{z-index:3}.es-zindex-4{z-index:4}.es-zindex-5{z-index:5}.es-grid{display:grid}.es-grid-center{display:grid;place-content:center}.es-margin-0{margin:0}.widget-table__head-cell[data-v-aa18d6fa]{padding:18px;text-align:start}.widget-table__head-label[data-v-aa18d6fa]{font-weight:600;font-size:14px;line-height:19px}.widget-filter-text[data-v-f6da3bed]{padding:20px 10px}.widget-filter-enum[data-v-4c82f6e7]{padding:3px 0;max-height:400px;max-width:340px;min-width:180px;overflow:hidden auto}.widget-filter-enum-item[data-v-4c82f6e7]{padding:6px 11px;transition:.1s;cursor:pointer}.widget-filter-enum-item[data-v-4c82f6e7]:hover{background-color:#f1f1f1}.widget-filter-number[data-v-f9cd559e]{padding:4px 6px}[dir=rtl] .icon[data-v-8a72b45f]{transform:scaleX(-1)}.widget-spinner[data-v-0ef9ae88],.widget-spinner[data-v-0ef9ae88]:after{border-radius:50%;width:14px;height:14px}.widget-spinner[data-v-0ef9ae88]{font-size:2px;position:relative;text-indent:-9999em;border-top:1.1em solid rgba(255,255,255,.2);border-right:1.1em solid rgba(255,255,255,.2);border-bottom:1.1em solid rgba(255,255,255,.2);border-left:1.1em solid #ffffff;transform:translateZ(0);animation:spinnerAnimation-0ef9ae88 1.1s infinite linear}@keyframes spinnerAnimation-0ef9ae88{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.widget-button[data-v-450dc564]{position:relative}.widget-button-spinner[data-v-450dc564]{position:absolute;top:0;bottom:0;left:5px;margin:auto}.widget-multi-button-wrap[data-v-d43a76ce]{--button-size: 40px;max-height:var(--button-size);z-index:1;width:fit-content}.widget-multi-button[data-v-d43a76ce]{grid-template-columns:1fr var(--button-size);background-color:var(--primary);grid-template-rows:var(--button-size);transition:var(--fast)}.widget-multi-button_active[data-v-d43a76ce]{grid-template-rows:calc(var(--button-size) * var(--04895bf1))}.widget-multi-button-body[data-v-d43a76ce]{min-width:80px}.widget-multi-button-body-label[data-v-d43a76ce]{padding:10px 10px 10px 20px;color:#fff;transition:background-color var(--fast)}.widget-multi-button-body-label[data-v-d43a76ce]:hover{background-color:#223296}.widget-multi-button-side[data-v-d43a76ce]{height:var(--button-size);transition:transform var(--fast),background-color var(--fast);color:#fff}.widget-multi-button-side_active[data-v-d43a76ce]{transform:rotate(180deg)}.widget-multi-button-side[data-v-d43a76ce]:hover{background-color:#223296}tr[data-v-344a8cc1]{border:1px solid #F3F4FC;height:30px}th[data-v-344a8cc1],td[data-v-344a8cc1]{position:relative;padding:0 11px}th[data-v-344a8cc1]{text-align:left}p[data-v-344a8cc1]{margin:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.widget-list-head-cell[data-v-bf495d6a]{padding:0 0 0 10px;display:flex}.widget-list-head-cell[data-v-bf495d6a]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-bf495d6a]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-bf495d6a]{position:absolute;inset-inline-end:22px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-bf495d6a]{transform:rotate(180deg)}.head-cell-resize[data-v-bf495d6a]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-bf495d6a]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-bf495d6a]:after{content:"";margin:auto;width:1px;height:100%;display:block;background-color:#d2d2d2}.widget-list-head[data-v-ccffc6bd]{position:sticky;top:-1px;z-index:1}.test-block[data-v-ccffc6bd]{position:absolute;z-index:2;display:none;height:calc(100% + 1px);place-content:center;inset-block-start:-1px;padding-inline:10px;background-color:#e7f2ff;-webkit-user-select:none;user-select:none;white-space:nowrap}.widget-list-head th[data-v-ccffc6bd]{position:sticky;top:0;z-index:2;-webkit-user-select:none;user-select:none}.widget-head-cell[data-v-d131e64e]{display:flex;gap:4px}.widget-head-cell-order[data-v-d131e64e]{display:flex;flex-direction:column;justify-content:center;gap:2px}.widget-head-cell-label[data-v-d131e64e]{cursor:pointer}.widget-fast-table-head-cell-td[data-v-d131e64e]{padding:7px}.widget-head-cell-order-icon[data-v-d131e64e]{transition:.1s;height:18px;width:18px}.widget-head-cell-order-icon_desc[data-v-d131e64e]{transform:rotate(180deg)}.widget-filter-item-container[data-v-43ed0322]{position:relative}.widget-filter-item-arrow[data-v-43ed0322]{transform:rotate(180deg)}.widget-filter-item-label_active[data-v-43ed0322]{font-weight:700}.widget-filter-item[data-v-43ed0322]{display:grid;grid-template-columns:max-content max-content;align-items:center;cursor:pointer;padding:0 10px;color:#fff}.widget-filter-item[data-v-43ed0322]:not(.widget-filter-item_active){opacity:.6}.widget-filter-item-label[data-v-43ed0322]{-webkit-user-select:none;user-select:none;padding:4px 2px 4px 8px}.widget-filter-item-popup[data-v-43ed0322]{position:absolute;z-index:2;inset-block-start:100%;inset-inline-end:0;box-shadow:0 2px 2px #00000040;background-color:#fff}.widget-filter-item-arrow[data-v-43ed0322]{transition:.2s}.widget-table-search[data-v-99052614]{gap:5px;padding:0 10px 0 12px}.widget-table-search-icon[data-v-99052614]{align-self:center}.widget-table-search-input[data-v-99052614]{outline:none;background-color:transparent;border:0;padding:6px 5px;font-size:16px}.widget-table-panel-filter[data-v-8f09ec8d]{justify-content:space-between;background-color:var(--color-primary)}.widget-fast-table[data-v-2fae7c36]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:max-content minmax(0,1fr);gap:15px}.widget-fast-table-body[data-v-2fae7c36]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:max-content minmax(0,1fr)}.widget-fast-table-head[data-v-2fae7c36]{display:grid;gap:15px}.main-table[data-v-2fae7c36]{overflow:auto}.version-item[data-v-66cf2326]{display:grid;gap:2px 10px;grid-template-rows:max-content;grid-template-columns:min-content minmax(100px,200px) 1fr 1fr}.version-item-date[data-v-66cf2326]{white-space:nowrap}.line-clamp_5[data-v-66cf2326]{text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}.history-header[data-v-cc723f37]{align-items:center;position:sticky;top:0;background-color:#fff;grid-template-rows:max-content;grid-template-columns:20px 210px 1fr 1fr}.container-history[data-v-cc723f37]{display:flex;flex-direction:column-reverse;overflow:auto}.wrap-modal-version-history[data-v-cc723f37]{min-height:380px}@media screen and (min-width: 756px){.wrap-modal-version-history[data-v-cc723f37]{min-width:800px;max-width:1000px}}.wrap-history[data-v-cc723f37]{height:100%;overflow:auto}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  "use strict";var ht=e=>{throw TypeError(e)};var yt=(e,t,n)=>t.has(e)||ht("Cannot "+n);var Ie=(e,t,n)=>(yt(e,t,"read from private field"),n?n.call(e):t.get(e)),Ne=(e,t,n)=>t.has(e)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ue=(e,t,n,o)=>(yt(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);/*!
3
- * eservices-core v1.3.325
3
+ * eservices-core v1.3.326
4
4
  * (c) 2025 ESERVICES
5
5
  */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),L=require("jenesius-vue-form"),se=require("vue-router"),Sn=require("date-and-time"),De=require("debug"),q=require("jenesius-vue-modal"),O=class O extends Error{constructor(t,n=null){super(),this.message=t,this.details=n,this.id=O.ID++}static ParentFormNotFound(){return new O("Can't found parent form.")}static UndefinedNameOfCompositeFormController(t){return new O("Composite object name is undefined",t)}static EntityWithoutName(t){return new O("'Entity doesn't have a name",t)}static NotResolvedNameEventEmitter(t){return new O(`'${t}' is not a valid Event emitter name`)}static FormIsNotValidated(t){return new O("Form is not validated",t)}static ListWorkerIsRunningOrEnd(t){return new O("List data request is running or already done",t)}static ObjectIdNotNumber(t){return new O(`${t} (id) is not a number`)}static UndefinedErrorId(t,n){return O.ApiNotAvailable()}static ApiError(t){return new O("Request error",t)}static ApiNotAvailable(){return new O(`Sorry, we experience difficulties here.
6
6
  Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(t,n){return!t&&!n?O.ApiNotAvailable():new O(t||"Authorization Error",n)}static ApiResponseParseFailed(){return O.ApiNotAvailable()}static MissingIdInValuesEntity(t){return new O("Object doesn't have id",t)}static ObjectWithIdNotFound(t,n){return new O(`Can't find object with id: ${t}`,n)}static ObjectWithoutConnectToPresentArray(t,n){return new O("Object is not found.",{object:t,array:n})}static EntityWithoutId(t){return new O("Entity doesn't have id.",t)}static NotFoundedTableIndex(t,n){return new O(`Can't find the element with tableIndex ${t}`,n)}static UndefinedError(t,n=[]){return new O(t,n)}static TableArrayAlreadyIncludeProvidedIndexValue(t,n,o){return new O(`Array already includes the element with value ${t}`,{array:n,table:o})}static MetadataEntityIsNotAvailable(t){return new O(`Metadata for the ${t} is not currently available.`)}static RequestTookToLong(){return new O("The request took too long to complete. Try again later.")}};O.ID=0;let re=O;const An="Please try again later or submit a feedback if problem doesn't go.";function In(e){return e.text().then(t=>{try{return JSON.parse(t)}catch{return An}})}function fe(e,t={}){return t.redirect="manual",fetch(e,t).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw re.ApiNotAvailable()}).then(n=>In(n).then(o=>{if(!n.ok)throw o;return o}))}class Nn{constructor(){this.public=!1,this.errors=new Proxy([],{set:(t,n,o)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(o)}`),t[n]=o,!0)}),window._journal=this}get error(){return{add:(...t)=>{this.errors.push(t)},clean:()=>{this.errors.splice(0,this.errors.length)},console:()=>{console.log(this.errors)}}}welcome(){console.log("The journal has been initialized. To get access check %c_journal in console.","background: blue; color: white")}}new Nn;class Rn{static invite(t,n,o){return fe("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:t,personKey:n,relatedRoleCode:o})})}static accept(t,n){return fe("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:t,version:n,mark:!0})})}static decline(t,n){return fe("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:t,version:n,mark:!1})})}}class Ln{static getRequiredDocuments(t,n,o){const i=new URLSearchParams({entity:t,primaryKey:n,statusCode:o});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(a=>a.json())}}class de{static url(){return"close-api/billing"}static getBillingMetadata(t){return fetch(`/${de.url()}/calculator/${t}`)}static calculate(t,n){return fe(`/${de.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:t,values:n})}).then(o=>{if(o&&o.status===1)return o;throw Array.isArray(o.notes)?new Error(o.notes[0]):re.ApiNotAvailable()})}static parseMetadataField(t){function n(o){switch(o.type){case"ValueType":switch(o.dataType){case"Integer":return"number";default:return o.dataType}case"EntityReference":return o.dataType}}return{name:t.name,label:t.title,required:t.required,type:n(t)}}static createOnlinePayment(t,n){return fe(`/${de.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:t,returnURL:n})})}static applyOnlinePayment(t){return fe(`/${de.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:t})})}}const On={class:"widget-table__head-cell"},Fn={key:1,class:"widget-table__head-label margin_0 text_overflow"},Lt=r.defineComponent({__name:"widget-table-head-cell",props:{label:{},type:{}},emits:["select"],setup(e,{emit:t}){const n=t;function o(){n("select")}return(i,a)=>(r.openBlock(),r.createElementBlock("th",On,[i.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(L.FormField),{key:0,onClick:o})):(r.openBlock(),r.createElementBlock("span",Fn,r.toDisplayString(i.label),1))]))}}),xn={class:"widget-table__head"},Bn=r.defineComponent({__name:"widget-table-head",props:{config:{}},setup(e){return r.computed(()=>Lt),(t,n)=>(r.openBlock(),r.createElementBlock("tr",xn,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.config,o=>r.renderSlot(t.$slots,"default",r.mergeProps({ref_for:!0},o),void 0,!0)),256))]))}}),M=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},Vn=M(Bn,[["__scopeId","data-v-aa18d6fa"]]);function Qe(e){return Array.isArray(e)?Qe(e[0]):typeof e!="string"?null:e}function ne(e){return Qe(e.name)}function $n(e){const t=new RegExp(/\$\{([a-zA-Z0-9_.]+)}/,"g"),n=[];let o;for(;(o=t.exec(e))!==null;)n.push(o[1]);return n}function Dn(e,t){return $n(e).forEach(o=>{e=e.replace(new RegExp("\\$\\{"+o+"}","g"),L.utils.getPropFromObject(t,o))}),e}function qe(e){return t=>typeof t=="string"||typeof t=="number"?`${t} ${e}`:""}function Ce(e,t){const n=ne(e);if(typeof e.value=="string")return Dn(e.value,t);let o=n?L.utils.getPropFromObject(t,n):null;if(o===void 0&&(o=null),typeof e.value=="function")return e.value(o,t);if(e.value===null)return null;switch(e.unitValue&&(o=qe(e.unitValue)(o)),e.unit&&(o=qe(e.unit)(o)),e.type){case"number":{typeof o=="number"&&(o=new Intl.NumberFormat().format(o));break}case"date":{o=Be(typeof o=="string"?o:null);break}case"TimeSpan":{const i=o==null?void 0:o.match(/((\d)+.)?(\d+:\d+:\d+)/);i&&(o=`${i[2]||0} D ${i[3]}`);break}case"dateTime":case"dateWithTime":{o=nt(typeof o=="string"?o:null);break}case"money":{o=Gt(o);break}case"DateTime":{o=Be(typeof o=="string"?o:null,e.format||A.dateTimeFormat);break}}return e.formatter&&(o=he(e.formatter).exec(o,t)),typeof o=="boolean"&&(o=o?"✓":"—"),o}const Pn=1,Mn=5e3,jn="static-folder",Ot="request-error",Ft="EntityTypeName",Un="REFERENCE_CHANGES",T={LIST_ACTIVE_NEW:-1,DEFAULT_ERROR_MESSAGE:"Please try again later or submit a feedback if problem doesn't go.",LOCALSTORAGE_CURRENT_CONTEXT_KEY:"CurrentContext",LOCALSTORAGE_LANGUAGE_KEY:"CurrentLanguage",DELAY_SOCKET_RECONNECT:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",PROVIDE_ENTITY_NAME:"provide-entity-name",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",MODAL_LIST_DOWNLOAD:"list-download",MODAL_LIST_SETTINGS:"list-settings",MODAL_SIMPLE_TOOL_PARAMETERS:"SimpleToolParameters",MODAL_BATCH_VALUES:"batch-values",MODAL_ENTITY:"form-entity",MODAL_HISTORY:"entity-history",TIME_TO_LIVE_SOCKET_REQUEST:45e3,CORE_DEBUG_LABEL:"eservices-core",VISIBLE_ITEM_PROVIDE_NAME:"visible-item-provider",EVENT_FORM_UPDATE:"form-update",EVENT_AFFECTED_ENTITY:"affected-entity",DEFAULT_ORDER_DIR:"asc",TABLE_MOCK_FIELD:"_A_MOCK_ID_FIELD",OBJECT_TYPE_NAME_FIELD:Ft,FIELD_NAME_REFERENCE_CHANGES:Un,PATH_RESOLVER_ENTITY:"resolver",TOOL_PRINT_NAME:"Print"};function Pe(e){return[T.CORE_DEBUG_LABEL,e].join(":")}const Wn={class:"widget-filter-text flex-column gap_10"},Hn={class:"flex gap_20"},qn=r.defineComponent({__name:"widget-filter-text",props:{values:{}},emits:["update:values","clear"],setup(e,{emit:t}){const n=e,o=t,i=new L.Form({parent:!1}),a={begin:"Begin with",end:"End with",include:"Contains"};function l(u="",f="include"){return{text:u,option:f}}r.onMounted(()=>{const u=n.values?typeof n.values=="string"?l(n.values):n.values:l();i.setValues(u)});function c(){o("update:values",i.values)}function s(){o("clear")}return r.watch(()=>n.values,u=>i.setValues(u||l()),{immediate:!0}),(u,f)=>{const d=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",Wn,[r.createElementVNode("div",Hn,[r.createVNode(r.unref(L.FormField),{name:"text",type:"text",label:"Search"})]),r.createVNode(r.unref(L.FormField),{name:"option",type:"radio",options:a}),r.createElementVNode("div",null,[r.createVNode(d,{onClick:c,type:"primary"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(Y)("Apply")),1)]),_:1}),r.createVNode(d,{onClick:s},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(Y)("Clear")),1)]),_:1})])])}}}),Gn=M(qn,[["__scopeId","data-v-f6da3bed"]]),zn={class:"widget-filter-enum"},Kn={class:"flex gap-10 padding-10"},Yn=r.defineComponent({__name:"widget-filter-entity",props:{baseEntity:{},filters:{},values:{},filterMetadata:{}},emits:["update:values","readProcess"],setup(e,{emit:t}){const n=e,o=r.ref([]),i=Se(n.filterMetadata.entity),a=f=>(n.values||[]).includes(f),l=t;function c(f){const d=n.values||[];return d.includes(f)?l("update:values",d.filter(b=>b!==f)):l("update:values",[...d,f])}const s=oe(async()=>{o.value=await le(n.baseEntity,{fields:n.filterMetadata.name.join(" "),order:[n.filterMetadata.name[1],"asc"],distinct:!0,filter:R(n.filters)}).then(f=>f.map(d=>({label:d[n.filterMetadata.name[1]],value:d[n.filterMetadata.name[0]]})))});function u(){l("update:values",[])}return r.watch(()=>s.loading,f=>{l("readProcess",f?"start":"end")},{immediate:!0}),r.watch(()=>i.value,()=>{s.loading||s.call()},{immediate:!0}),(f,d)=>{const b=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",zn,[r.createElementVNode("div",Kn,[r.createVNode(b,{label:"Reload filter",loading:r.unref(s).loading||!1,icon:"reload",onClick:d[0]||(d[0]=()=>r.unref(s).call())},null,8,["loading"]),r.createVNode(b,{label:"Clear",onClick:u})]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.value,h=>(r.openBlock(),r.createBlock(r.unref(L.FormField),{class:"widget-filter-enum-item",key:h.value,onClick:()=>c(h.value),type:"single-checkbox","model-value":a(h.value),label:h.label},null,8,["onClick","model-value","label"]))),128))])}}}),Xn=M(Yn,[["__scopeId","data-v-4c82f6e7"]]),Ee=r.reactive({});function Jn(){vt(),setInterval(vt,50)}function xt(){return Ee}function vt(){const e={};Object.entries(localStorage).forEach(([t,n])=>{e[t]=!0,Ee[t]!==n&&(Ee[t]=n)}),Object.keys(Ee).forEach(t=>{e[t]||delete Ee[t]})}const Qn={class:"widget-filter-number flex-column es-gap-10"},Zn={class:"flex es-gap-10"},er={class:"flex gap-10"},tr=r.defineComponent({__name:"widget-filter-number",props:{baseEntity:{},values:{}},emits:["update:values","readProcess"],setup(e,{emit:t}){const n=e,o=t,i=new L.Form({parent:!1}),a=zt(()=>{const c=i.getValueByName("min"),s=i.getValueByName("max");return o("update:values",{min:c,max:s})},800);i.onvalue(a),r.watch(()=>n.values,()=>{n.values&&i.setValues(n.values)},{immediate:!0});function l(){i.cleanValues()}return(c,s)=>{const u=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",Qn,[r.createElementVNode("div",Zn,[r.createVNode(r.unref(L.FormField),{name:"min",label:"More than",type:"number"}),r.createVNode(r.unref(L.FormField),{name:"max",label:"Less than",type:"number"})]),r.createElementVNode("div",er,[r.createVNode(u,{label:"Clear",onClick:l})])])}}}),wt=M(tr,[["__scopeId","data-v-f9cd559e"]]),A={getEntityLink(e,t){return`/forms/${e}/${t}`},iconHandlerText(){return""},iconTag:"i",dateTimeFormat:"DD/MM/YYYY HH:mm:ss",tableFilterEntityBind:{String:Gn,Entity:Xn,Decimal:wt,Integer:wt},arrayListCellHandlers:[],arrayListRowHandlers:[],arrayFieldParamsHandlers:[]};function nr(e){Jn();for(let t in e)A[t]=e[t]}const rr={props:{name:String},setup(e,t){let n="unknown";try{n=t.slots.default()[0].children}catch{n=e.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>r.h(A.iconTag,{class:A.iconHandler?A.iconHandler(n):`icon icon-${n}`},A.iconHandlerText(n))}},ge=M(rr,[["__scopeId","data-v-8a72b45f"]]),or=De(Pe("setup-list-row"));function ir(e,t){const n=e.config.map(o=>ar(o,e,t));return r.h("tr",{class:"widget-table__row widget-table-row"},n)}function ar(e,t,n){const o=t.values;let i=Ce(e,o);const a={onClick:[],title:e.hint,class:["widget-table__cell widget-table-cell"]};function l(f){a.onClick.push(()=>f(o,e,n))}function c(f){Array.isArray(f)?a.class.push(...f):a.class.push(f)}const s=[],u=[];if(e.hide&&e.hide(o))return[r.h("td")];if(e.type)switch(c(`widget-table-cell_${e.type}`),e.type){case"multi-select":{u.push(r.h(L.FormField,{type:"single-checkbox",modelValue:t.selected})),l(bt.bind(null,n,!0));break}case"select":{u.push(r.h(L.FormField,{type:"single-radio",modelValue:t.selected})),l(bt.bind(null,n,!1));break}}if(e.onClick&&l(e.onClick),e.link)try{const f=e.link(o);if(f){const d=r.h(se.RouterLink,{to:f});u.push(d),c("widget-table-cell_link")}}catch(f){or("Can't add router link",f)}if(e.href&&(u.push(r.h("a",{href:e.href(o),target:"_blank"})),c("widget-table-cell_link")),(typeof i=="string"||typeof i=="number")&&u.push(r.h("p",{class:"widget-list-cell-text"},i)),e.icon&&(typeof e.icon=="string"&&u.push(r.h(ge,{name:e.icon})),typeof e.icon=="function")){const f=e.icon(o);f!==null&&u.push(r.h(ge,{name:f}))}return e.class&&(typeof e.class=="function"?c(e.class(o)):c(e.class)),A.listCellHandler&&(console.log("listCellHandler is deprecated. Please use coreUtils.addListCellHandler instead."),A.listCellHandler(e,o,{cellNodeChildren:u,addClass:c,addHandleClick:l,context:n})),A.arrayListCellHandlers&&A.arrayListCellHandlers.forEach(f=>f(e,o,{cellNodeChildren:u,addClass:c,addHandleClick:l,context:n})),s.push(r.h("td",a,u)),s}function bt(e,t){e.emit("select",t)}function Ze(e,t){return()=>{try{return ir(e,t)}catch(n){return console.warn(n),null}}}const sr={props:{values:Object,config:Object,selected:Boolean},setup:Ze},lr=["colspan"],Et=r.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(e,{emit:t}){const n=t,o=r.ref();return r.onMounted(()=>{setTimeout(()=>{o.value&&o.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(i,a)=>(r.openBlock(),r.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:o},[r.createElementVNode("td",{colspan:i.rowLength},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.component),r.mergeProps(i.$attrs,{values:i.values,new:i.isNew,onClose:a[0]||(a[0]=l=>n("close")),onSave:a[1]||(a[1]=l=>n("save",l))}),null,16,["values","new"]))],8,lr)],512))}}),We="update:selectedRows",cr="update:activeRow",Bt=r.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1},rowOptionsHandler:{type:Function,default:()=>({})}},emits:["save","order"],setup(e,{emit:t}){const n=e,o=r.ref(),i=t,a=r.useSlots(),l=r.computed(()=>{var h;return(h=a==null?void 0:a.default)==null?void 0:h.call(a)[0]});function c(){const g=n.selectedRows.length!==0?[]:[...n.array];i(We,g)}function s(h,g=!0){if(!n.selectedRows)return;if(!g)return i(We,n.selectedRows.includes(h)?[]:[h]);const m=[...n.selectedRows],v=m.indexOf(h);return v===-1?m.push(h):m.splice(v,1),i(We,m)}function u(h){i(cr,h)}function f(h){i("save",h),i("update:activeRow",null)}const d=r.computed(()=>{const h=n.config.filter(g=>g.visible!==!1);return n.shortcut?h.filter(g=>g.name?!!n.array.find(m=>![null,""].includes(Ce(g,m))):!0):h});r.watch(()=>n.activeRow,(h,g)=>{h===null&&typeof g=="number"&&setTimeout(()=>{if(!o.value)return;const m=o.value.querySelector(`tbody>tr:nth-child(${g+1})`)||o.value;m&&m.scrollIntoView({block:"center",behavior:"smooth"})},100)});function b(h){var m;const g={};return(m=A.arrayListRowHandlers)==null||m.forEach(v=>{try{Object.assign(g,v(h,n.rowOptionsHandler()))}catch{console.warn("Problem with arrayListRowHandler.")}}),g}return(h,g)=>(r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("table",{class:"widget-table",ref_key:"refTable",ref:o},[r.createElementVNode("thead",null,[r.createVNode(Vn,{config:d.value,onOrder:g[0]||(g[0]=m=>h.$emit("order",m))},{default:r.withCtx(m=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(h.$slots["head-cell"]||Lt),r.mergeProps(m,{onSelect:c}),null,16))]),_:1},8,["config"])]),r.createElementVNode("tbody",null,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h.array,(m,v)=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:v},[r.createVNode(sr,r.mergeProps({test:v,config:d.value,values:m,selected:h.selectedRows.includes(m),onSelect:p=>s(m,p),onActivate:p=>u(v),class:h.classCallback?h.classCallback(m):"",ref_for:!0},b(m)),null,16,["test","config","values","selected","onSelect","onActivate","class"]),l.value&&h.activeRow===v?(r.openBlock(),r.createBlock(Et,{key:0,component:l.value,"row-length":h.config.length,values:m,onClose:g[1]||(g[1]=p=>i("update:activeRow",null)),onSave:f,"is-new":!1},null,8,["component","row-length","values"])):r.createCommentVNode("",!0)],64))),128)),h.activeRow===r.unref(T).LIST_ACTIVE_NEW?(r.openBlock(),r.createBlock(Et,{key:0,component:l.value,"row-length":d.value.length,onClose:g[2]||(g[2]=m=>i("update:activeRow",null)),onSave:f,"is-new":!0},null,8,["component","row-length"])):r.createCommentVNode("",!0)])],512),r.renderSlot(h.$slots,"footer")]))}}),ur=r.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{class:"widget-spinner",style:r.normalizeStyle({"border-left":`1.1em solid ${t.color}`})},null,4))}}),Te=M(ur,[["__scopeId","data-v-0ef9ae88"]]),dr={class:"widget-button"},fr=r.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("button",dr,[t.wait?(r.openBlock(),r.createBlock(Te,{key:0,class:"widget-button-spinner"})):r.createCommentVNode("",!0),r.renderSlot(t.$slots,"default",{},void 0,!0)]))}}),pr=M(fr,[["__scopeId","data-v-450dc564"]]),mr={class:"widget-multi-button-wrap position_relative cursor_pointer"},gr={class:"widget-multi-button-body grid"},hr=["onClick"],yr={class:"widget-multi-button-side-wrap"},vr=r.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(e){r.useCssVars(l=>({"04895bf1":o.value}));const t=e,n=r.reactive({active:!1,wait:!1}),o=r.computed(()=>t.array.length+(t.label?1:0));function i(l){if(!(typeof l!="function"||n.wait))return n.wait=!0,Promise.resolve().then(l).finally(()=>{n.wait=!1})}function a(l=!n.active){n.active=l}return(l,c)=>(r.openBlock(),r.createElementBlock("div",mr,[r.createElementVNode("div",{class:r.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[r.createElementVNode("div",gr,[l.label?(r.openBlock(),r.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:c[0]||(c[0]=s=>a())},r.toDisplayString(l.label),1)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(l.array,(s,u)=>(r.openBlock(),r.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:u,onClick:f=>{i(s.callback),a(!1)}},r.toDisplayString(s.label),9,hr))),128))]),r.createElementVNode("div",yr,[r.createElementVNode("div",{class:r.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:c[1]||(c[1]=s=>a())},[n.wait?(r.openBlock(),r.createBlock(r.unref(Te),{key:0,class:"widget-multi-button-side-spinner"})):l.array.length>1?(r.openBlock(),r.createBlock(r.unref(ge),{key:1,class:"widget-multi-button-side-icon"},{default:r.withCtx(()=>[r.createTextVNode("angle-small-down")]),_:1})):r.createCommentVNode("",!0)],2)])],2)]))}}),wr=M(vr,[["__scopeId","data-v-d43a76ce"]]),br={class:"widget-loader flex flex-align_center gap_10 padding_15"},Er={class:"text_md"},Me=r.defineComponent({__name:"widget-loader",props:{label:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",br,[r.createVNode(Te,{color:"var(--primary)",class:"padding_10"}),r.createElementVNode("span",Er,r.toDisplayString(t.label),1)]))}}),_r=["alt","src"],kr=r.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(e){const t=e,n=r.ref();return r.onMounted(()=>{n.value&&(n.value.src=t.src),n.value.onerror=function(){t.default&&(n.value.src=t.default)}}),(o,i)=>(r.openBlock(),r.createElementBlock("img",{alt:o.alt,ref_key:"refImage",ref:n,src:o.src||o.$props.default},null,8,_r))}}),Cr={props:{config:Array,values:Object,selected:Boolean},setup:Ze},Tr=M(Cr,[["__scopeId","data-v-344a8cc1"]]),Sr=e=>(r.pushScopeId("data-v-bf495d6a"),e=e(),r.popScopeId(),e),Ar={class:"widget-list-head-cell"},Ir=Sr(()=>r.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Nr=r.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(e,{emit:t}){const n=e,o=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(i,a)=>(r.openBlock(),r.createElementBlock("th",null,[r.createElementVNode("div",Ar,[r.createElementVNode("div",{class:"head-cell-content flex_grow",style:r.normalizeStyle({"min-width":i.minWidth,"max-width":i.maxWidth,width:i.width})},[i.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(L.FormField),{key:0,type:"single-checkbox",onClick:a[0]||(a[0]=r.withModifiers(l=>o("select"),["stop","prevent"]))})):(r.openBlock(),r.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:a[1]||(a[1]=l=>o("order"))},r.toDisplayString(i.title||i.label),1))],4),i.name&&i.order.length&&i.order[0]===i.name?(r.openBlock(),r.createBlock(r.unref(ge),{key:0,class:r.normalizeClass(["head-cell-order",{"head-cell-order_down":i.order.length>1&&i.order[1]==="desc"}])},{default:r.withCtx(()=>[r.createTextVNode("core-arrow-up")]),_:1},8,["class"])):r.createCommentVNode("",!0),Ir])]))}}),Rr=M(Nr,[["__scopeId","data-v-bf495d6a"]]),Lr=r.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(e,{emit:t}){const n=e,o=t,i=r.ref(),a=r.ref();r.onMounted(()=>{function u(g,m){let v=-1;do v++,m-=g[v];while(m>0&&v<g.length);return v}function f(g,m){let v=0;for(;m>0&&m>g[v]&&v<g.length;)m-=g[v],v++;return console.log(m,v),v>0?v:0}function d(g){try{a.value.style.insetInlineStart=g+"px"}catch(m){console.log(m)}}function b(g){try{a.value.style.width=g+"px",a.value.style.minWidth=g+"px",a.value.style.maxWidth=g+"px"}catch(m){console.log(m)}}function h(g){return g===null?!1:g.classList.contains("head-cell-resize")}i.value.addEventListener("pointerdown",function(m){var I;function v(S){return S.screenX+y-F}const p=i.value,w=[...p.children].filter(S=>S.localName==="th"),y=((I=p.offsetParent)==null?void 0:I.scrollLeft)||0,_=w.map(S=>S.clientWidth),C=h(m.target),F=p.getBoundingClientRect().left,E=v(m),k=u(_,E),N=_.slice(0,k).reduce((S,$)=>S+$,0),V=E-N,D=p.offsetWidth,Q=w[k].clientWidth;if(n.config[k].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",m.screenX),console.log("Widths",_),console.log("max width",D),console.log("Start Position",E),console.log("Position From",k),console.log("Start Position",k),console.log("Global offset (Отступ самой таблицы от края экрана)",F),console.log("Del",V),console.groupEnd(),a.value.innerText=w[k].textContent||"",a.value.style.display="grid",a.value.style.width=Q+"px",a.value.style.cursor="grabbing",d(N),b(Q),document.addEventListener("pointermove",ve,{passive:!0}),document.addEventListener("pointerup",Ae);function Ae(S){if(console.group("END"),document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",Ae),C&&(n.config[k].width=a.value.style.width,n.config[k].minWidth=a.value.style.width,n.config[k].maxWidth=a.value.style.width,l(n.config)),!C){const $=S.screenX+y-F;console.log("ENP Position",$);const G=f(_,$);if(console.log(k,"->",G),G!==k){const W=n.config[k],j=n.config;j.splice(k,1),j.splice(G,0,W),l(j)}else{const W=n.config[k].name;c(W)}}a.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function ve(S){if(C){const W=v(S)-E+Q;b(W);return}let $=S.screenX+y-F-V;$<0&&($=0),$+Q>D&&($=D-Q),d($)}})});function l(u){o("update:config",u)}function c(u){if(!u)return;if(Array.isArray(u)){if(u.length<1)return;u=u[0]}if(n.order.length===0||n.order[0]!==u)return void s([u]);const f=n.order.length===1||n.order[1]==="asc"?"asc":"desc";s([u,f==="asc"?"desc":"asc"])}function s(u){o("update:order",u)}return(u,f)=>(r.openBlock(),r.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:i},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.config,(d,b)=>(r.openBlock(),r.createBlock(Rr,r.mergeProps({key:d,ref_for:!0},d,{onOrder:h=>c(d.name),onSelect:f[0]||(f[0]=h=>o("select")),order:u.order}),null,16,["onOrder","order"]))),128)),r.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:a},"test",512)],512))}}),Or=M(Lr,[["__scopeId","data-v-ccffc6bd"]]),Fr={class:"widget-list"},xr={class:"widget-list-body position_relative"},Br=50,Vr=r.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(e,{emit:t}){const n=e,o=t;function i(s,u=!0){if(n.selectedRows)if(!u)l(n.selectedRows.includes(s)?[]:[s]);else{const f=[...n.selectedRows],d=f.indexOf(s);d===-1?f.push(s):f==null||f.splice(d,1),l(f)}}function a(){var s;if(((s=n.selectedRows)==null?void 0:s.length)!==n.array.length)return l([...n.array]);l([])}function l(s){o("update:selectedRows",s)}function c(s){if(!s)return;const u=s.target;u.scrollTop+u.clientHeight+Br>u.scrollHeight&&o("scrollEnd")}return(s,u)=>(r.openBlock(),r.createElementBlock("div",{class:"es-list-container",onScrollPassive:c},[r.createElementVNode("table",Fr,[r.createElementVNode("thead",null,[r.createVNode(Or,{onSelect:u[0]||(u[0]=f=>a()),"onUpdate:order":u[1]||(u[1]=f=>o("update:order",f)),"onUpdate:config":u[2]||(u[2]=f=>o("update:config",f)),config:s.config,order:s.order},null,8,["config","order"])]),r.createElementVNode("tbody",xr,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.array,(f,d)=>{var b;return r.openBlock(),r.createBlock(Tr,{key:d,class:"widget-list-row",values:f,config:s.config,selected:(b=s.selectedRows)==null?void 0:b.includes(f),onSelect:h=>i(f,h)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function et(){var a;const e=r.computed(()=>Object.keys(n).length===0||Object.values(n).includes(!0)),t=(a=r.getCurrentInstance())==null?void 0:a.uid;if(!t)throw"Undefined instance. Please check it.";const n=r.reactive({});r.provide(T.VISIBLE_ITEM_PROVIDE_NAME,{show(l){n[l]=!0},hide(l){n[l]=!1},remove(l){delete n[l]}});const o=r.inject(T.VISIBLE_ITEM_PROVIDE_NAME,{show(){},hide(){},remove(){}});return{visible:e,controller:{show(){o==null||o.show(t)},hide(){o==null||o.hide(t)},remove(){o==null||o.remove(t)}},visibleItems:n}}function Vt(e){const t={name:e,entity:r.inject(T.PROVIDE_ENTITY_NAME)};if(!t.name)throw new Error("Field without name try use metadata.");const n=r.ref(!1),o=r.ref(null);return e.split(".").reduce((i,a,l,c)=>l===c.length-1?i:i.then(()=>{var u,f;const s=(f=(u=o.value)==null?void 0:u.fieldsByName[a])==null?void 0:f.referencedEntity;if(!s)throw new Error("---");return ee.initEntity(s).then(()=>s)}).then(s=>{o.value=ee.get(s),t.entity=s,t.name=c[l+1]}),Promise.resolve().then(()=>ee.initEntity(t.entity)).then(()=>{o.value=ee.get(t.entity)})).finally(()=>n.value=!0),r.computed(()=>{if(!n.value||!o.value)return;const i=o.value.fieldsByName[t.name];if(i)return i})}const $r=r.defineComponent({__name:"widget-field",props:{name:{},type:{},label:{},usageContext:{type:Boolean,default:!0}},setup(e){const t=e,n=L.Form.getParentForm();Se();const o=dt(),i=r.computed(()=>{var g,m,v;const d=c.value,b=s(d),h={type:b,disabled:t.usageContext?!((g=l.value)!=null&&g.canSet):!1,label:t.label};return b==="Decimal"&&((v=(m=d==null?void 0:d.presentationType)==null?void 0:m.toLowerCase)==null?void 0:v.call(m))==="money"&&(h.money=!0),d&&Object.assign(h,{suffix:d.valueUnit||void 0,label:t.label||d.displayName}),Array.isArray(A.arrayFieldParamsHandlers)&&A.arrayFieldParamsHandlers.forEach(p=>Object.assign(h,p(d,l.value,h,n,t.name))),h}),a=["MultiText","MultiWideText"],l=r.computed(()=>{var d;return(d=o==null?void 0:o.value)==null?void 0:d.fields[t.name]}),c=Vt(t.name);function s(d){if(typeof t.type=="string"&&t.type.length!==0)return t.type;if(d){if(d.type==="Reference"||d.type==="Owned")return d.referencedEntity;if(d.dataType==="Boolean")return"single-checkbox";if(d.dataType==="DateTime")return"date";if(d.dataType==="Integer"||d.dataType==="Decimal")return"number";if(d.dataType==="List")return d.aggregatedEntity;if(a.includes(d.presentationType))return"textarea";if(d.presentationType==="PhoneNumber")return"tel"}return"text"}const u=r.computed(()=>{var d;return t.usageContext?((d=l.value)==null?void 0:d.canGet)===!0:!0}),{controller:f}=et();return r.watch(()=>u.value,d=>d?f.show():f.hide(),{immediate:!0}),r.onUnmounted(()=>f.remove()),(d,b)=>u.value?(r.openBlock(),r.createBlock(r.unref(L.FormField),r.mergeProps({key:0},{...d.$attrs,...i.value},{name:d.name}),null,16,["name"])):r.createCommentVNode("",!0)}});function Dr(e){return Array.isArray(e)&&(e==null?void 0:e[1])||T.DEFAULT_ORDER_DIR}const Pr=["fill"],Mr=r.createElementVNode("path",{d:"M440-647 244-451q-12 12-28 11.5T188-452q-11-12-11.5-28t11.5-28l264-264q6-6 13-8.5t15-2.5q8 0 15 2.5t13 8.5l264 264q11 11 11 27.5T772-452q-12 12-28.5 12T715-452L520-647v447q0 17-11.5 28.5T480-160q-17 0-28.5-11.5T440-200v-447Z"},null,-1),jr=[Mr],Ur=r.defineComponent({__name:"widget-icon-arrow-up",props:{color:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:t.color},jr,8,Pr))}}),Wr={class:"widget-fast-table-head-cell-td"},Hr={key:1,class:"widget-head-cell-label"},qr={key:2,class:"widget-head-cell-order"},Gr=r.defineComponent({__name:"widget-fast-table-head-cell",props:{label:{},name:{},order:{},type:{},isFullSelected:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=e,o=r.computed(()=>Qe(n.name));r.computed(()=>Dr(n.order));const i=t;function a(){i("select")}return(l,c)=>{var s;return r.openBlock(),r.createElementBlock("td",Wr,[r.createElementVNode("div",{class:r.normalizeClass(["widget-head-cell",[l.type==="multi-select"?"justify-content-center":""]]),onClick:c[0]||(c[0]=u=>l.$emit("order",l.name))},[l.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(L.FormField),{key:0,"model-value":l.isFullSelected,onClick:a,type:"single-checkbox"},null,8,["model-value"])):(r.openBlock(),r.createElementBlock("span",Hr,r.toDisplayString(l.label),1)),o.value===((s=l.order)==null?void 0:s[0])?(r.openBlock(),r.createElementBlock("div",qr,[r.createVNode(Ur,{color:"var(--color-primary)",class:r.normalizeClass(["widget-head-cell-order-icon",`widget-head-cell-order-icon_${l.order[1]==="desc"?"desc":"asc"}`])},null,8,["class"])])):r.createCommentVNode("",!0)],2)])}}}),$t=M(Gr,[["__scopeId","data-v-d131e64e"]]),zr=["fill"],Kr=r.createElementVNode("path",{d:"M480-361q-8 0-15-2.5t-13-8.5L268-556q-11-11-11-28t11-28q11-11 28-11t28 11l156 156 156-156q11-11 28-11t28 11q11 11 11 28t-11 28L508-372q-6 6-13 8.5t-15 2.5Z"},null,-1),Yr=[Kr],Xr=r.defineComponent({__name:"widget-icon-keyboard-arrow-down",props:{color:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:t.color},Yr,8,zr))}}),Jr={class:"widget-filter-item-popup"},Qr=r.defineComponent({__name:"widget-table-panel-filter-item",props:{entity:{},values:{},filters:{},filterItem:{}},emits:["update:values","clear"],setup(e,{emit:t}){const n=e,o=t,i=A.tableFilterEntityBind,a=r.ref(),l=r.computed(()=>{const h=n.filterItem;return h.entity?"Entity":h.type?h.type:null});function c(h){s.value=h==="start"}const s=r.ref(!1),u=r.computed(()=>Array.isArray(n.values)||typeof n.values=="string"?n.values.length>0:!!n.values),f=r.ref(!1);let d=null;function b(h=!f.value){f.value=h,!f.value&&d?(d(),d=null):a.value&&(d=L.utils.clickOutside(a.value,b.bind(null,!1)))}return(h,g)=>{var m;return r.openBlock(),r.createElementBlock("div",{class:"widget-filter-item-container grid",ref_key:"refFilterItem",ref:a},[r.createElementVNode("div",{class:r.normalizeClass(["widget-filter-item",{"widget-filter-item_active":u.value}]),onClick:g[0]||(g[0]=()=>b())},[r.createElementVNode("span",{class:r.normalizeClass(["widget-filter-item-label",{"widget-filter-item-label_active":u.value}])},r.toDisplayString(h.filterItem.label||"--"),3),s.value?(r.openBlock(),r.createBlock(Te,{key:0})):(r.openBlock(),r.createBlock(Xr,{key:1,color:"white",class:r.normalizeClass({"widget-filter-item-arrow":f.value})},null,8,["class"]))],2),r.withDirectives(r.createElementVNode("div",Jr,[l.value?(r.openBlock(),r.createBlock(r.resolveDynamicComponent((m=r.unref(i))==null?void 0:m[l.value]),{key:0,"filter-metadata":h.filterItem,values:h.values,filters:h.filters,"base-entity":h.entity,onClear:g[1]||(g[1]=v=>o("clear")),"onUpdate:values":g[2]||(g[2]=v=>o("update:values",v)),onReadProcess:c},null,40,["filter-metadata","values","filters","base-entity"])):r.createCommentVNode("",!0)],512),[[r.vShow,f.value]])],512)}}}),Dt=M(Qr,[["__scopeId","data-v-43ed0322"]]),Zr={class:"widget-table-search flex"},eo=["value"],to=r.defineComponent({__name:"widget-table-search",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;function o(i){const a=i.target;if(!a)return;const l=a.value;n("update:modelValue",l)}return(i,a)=>(r.openBlock(),r.createElementBlock("div",Zr,[r.createVNode(ge,{class:"widget-table-search-icon"},{default:r.withCtx(()=>[r.createTextVNode("search")]),_:1}),r.createElementVNode("input",{class:"widget-table-search-input",type:"text",alt:"Searching for data in a table",value:i.modelValue,onInput:o,placeholder:"Filter by random text"},null,40,eo)]))}}),no=M(to,[["__scopeId","data-v-99052614"]]),ro={class:"widget-table-panel-filter flex"},oo={class:"flex"},io=r.defineComponent({__name:"widget-table-panel-filters",props:{filtersConfig:{},filters:{},entity:{},search:{}},emits:["update:filters","update:search"],setup(e,{emit:t}){const n=e,o=t;function i(l,c){o("update:filters",{...n.filters,[l]:c})}function a(l){const c={...n.filters};delete c[l],o("update:filters",c)}return(l,c)=>(r.openBlock(),r.createElementBlock("div",ro,[r.createVNode(no,{"model-value":l.search,"onUpdate:modelValue":c[0]||(c[0]=s=>o("update:search",s))},null,8,["model-value"]),r.createElementVNode("div",oo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(l.filtersConfig,(s,u)=>{var f;return r.openBlock(),r.createBlock(Dt,{key:u,entity:l.entity,"filter-item":s,values:(f=l.filters)==null?void 0:f[r.unref(ne)(s)],filters:l.filters,"onUpdate:values":d=>i(r.unref(ne)(s),d),onClear:d=>a(r.unref(ne)(s))},null,8,["entity","filter-item","values","filters","onUpdate:values","onClear"])}),128))])]))}}),ao=M(io,[["__scopeId","data-v-8f09ec8d"]]);function Pt(e,t){const n=document.createElement("a");n.href=e,t!=null&&t.blank&&(n.target="_blank"),n.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),setTimeout(()=>{n.remove()},100)}const so={class:"widget-fast-table-tools flex gap-15"},lo=r.defineComponent({__name:"widget-fast-table-tools",props:{tools:{},loading:{type:Boolean},selectedRows:{},metadata:{},canCreate:{type:Boolean}},emits:["reload","export","new"],setup(e,{emit:t}){const n=e,o=se.useRouter(),i=t,a=[{name:"export",label:"Save as CSV",icon:"list-download",buttonStyle:"default",callback:()=>i("export")},{name:"reload",label:"Reload",icon:"reload",buttonStyle:"default",callback:()=>i("reload")},{name:"new",label:"Add New",icon:"new",buttonStyle:"primary",callback:()=>i("new")}],l=r.inject(T.PROVIDE_NAME_ACTIONS,null),c=r.computed(()=>(Array.isArray(n.tools)?n.tools:[]).reduce((g,m)=>(m.name==="*"?g.push(...a):g.push(m),g),[]));function s(g){return a.find(m=>m.name===g.name)}function u(g){return{...g,label:g.label||"Batch update",callback:async()=>{const m=n.metadata,v=m.name,p=n.selectedRows||[];if(n.selectedRows.length===0)return Ue.add("error","Kindly select at least one record to update");const w=await q.promptModal(T.MODAL_BATCH_VALUES,{entity:v,availableFields:g.availableFields||[]});if(!w)return;const y=ut(v),_=p.map(C=>({primaryKey:C[y],version:m.versioned?C.Version:void 0}));await Zt(v,{values:w,elements:_}).then(C=>{C.forEach(F=>{F.type==="reject"&&P("error")(F.data)})}).catch(P("error")),i("reload")}}}function f(g){return{...g,callback:()=>o.push(g.to)}}function d(g){return{...g,callback:()=>{const m=tn(g.filename);Pt(m,{blank:!0})}}}const b=r.computed(()=>{var v;const g=((v=l==null?void 0:l.actions)==null?void 0:v.value)||[],m=[];return c.value.forEach(p=>{if(!(typeof p.override=="string"&&!g.find(w=>w.name===p.override))){if(s(p)){if(p.name==="new"&&!n.canCreate)return;const w=a.find(y=>y.name===p.name);if(w)return m.push(w)}if(p.name==="redirect")return m.push(f(p));if(p.name==="batch-update")return m.push(u(p));if(p.name==="static-file")return m.push(d(p));{const w=g.find(y=>y.name===p.name);if(w)return m.push({label:w.title,...p,callback:()=>h(w)})}}}),m.map(p=>({...p,process:oe(p.callback)}))});function h(g){var p;const m=(p=g.action.parameters.find(w=>w.dataTypeName==="IntegerArray"))==null?void 0:p.name,v={};return m&&(v[m]=n.selectedRows.map(w=>{if(!(typeof w=="object"&&w!==null))return null;const y=n.metadata.fieldNameForIdentification;return y?w[y]:null})),g.callback(v)}return(g,m)=>{const v=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",so,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(b.value,p=>(r.openBlock(),r.createBlock(v,{label:r.unref(Y)(p.label),title:p.name,icon:p.icon,type:p.buttonStyle,loading:p.name==="reload"?g.loading:p.process.loading,onClick:()=>p.process.call()},null,8,["label","title","icon","type","loading","onClick"]))),256)),r.renderSlot(g.$slots,"default")])}}});function co(e,t){const n=xt(),o=se.useRouter(),i=r.reactive({entity:null,mark:null,settings:null});function a(y){const _={...f.value,...y};l(_)}function l(y){{const _=y.prefilters;_&&(Object.keys(_).forEach(C=>{var E,k;const F=_[C];Array.isArray(_[C])&&_[C].length===0&&i.settings&&!((k=(E=i.settings)==null?void 0:E.prefilters)!=null&&k[C])&&delete _[C],Tn(F)&&(typeof F.min!="number"&&delete F.min,typeof F.max!="number"&&delete F.max,Object.keys(F).length===0&&delete _[C])}),L.utils.isEmptyObject(_)&&delete y.prefilters)}localStorage.setItem(u(i.entity,i.mark),JSON.stringify(y)),t&&t()}function c(){return i.entity?JSON.parse(localStorage[u(i.entity,i.mark)]||"{}"):null}function s(y,_){i.entity=y,i.mark=_,b.call()}function u(y,_){return"list-configuration:"+y+(_?"-"+_:"")}const f=r.computed(()=>i.entity?JSON.parse(n[u(i.entity,i.mark)]||"{}"):null),d=r.computed(()=>i.settings?Ye(i.entity,i.settings.config,{router:o,activate:e}):[]),b=oe(async function(){if(!i.entity)return;const _=await Yt(i.entity,i.mark);i.settings=Object.freeze(_),t&&t()}),h=r.computed(()=>{var C;const y=f.value.order||null,_=((C=i.settings)==null?void 0:C.order)||null;return y||_||[]}),g=r.computed(()=>{var C;const y=f.value.prefilters||{};return{...((C=i.settings)==null?void 0:C.prefilters)||{},...y}}),m=r.computed(()=>{var y;return((y=i.settings)==null?void 0:y.filters)||[]}),v=r.computed(()=>{var y;return((y=i.settings)==null?void 0:y.label)||null}),p=r.computed(()=>{var y;return((y=i.settings)==null?void 0:y.tools)||[]}),w=r.computed(()=>!L.utils.isEmptyObject(f.value));return{state:i,get customFilters(){return i.settings.customFilters||[]},set:s,get:c,configuration:f,update:a,computedPrefilter:g,computedFiltersConfiguration:m,get cellConfig(){return i.settings?Ye(i.entity,i.settings.config,{router:o,activate:e}):[]},get prefilters(){var y;return((y=c())==null?void 0:y.prefilters)||i.settings.prefilters||{}},get order(){var y;return((y=c())==null?void 0:y.order)||i.settings.order||[]},clean(){localStorage.removeItem(u(i.entity,i.mark)),t&&t()},cellConfiguration:d,computedLabel:v,computedTools:p,computedHasLocalConfiguration:w,computedOrder:h,get displayModeForNew(){return i.settings.displayModeForNew||"inline"}}}var pe;class Mt{constructor(t){Ne(this,pe);this.unloaded=!1,this.offset=0,this.array=r.reactive([]),ue(this,pe,null),this.process=oe(this.load.bind(this)),this.entity=t,this.limit=50}set options(t){ue(this,pe,t)}get requestReadOptions(){return Object.assign({},Ie(this,pe)||null,{offset:this.offset,limit:this.limit})}async next(){this.unloaded||this.process.loading||await this.process.call()}reload(){return this.clear(),this.next()}clear(){this.array.splice(0,this.array.length),this.offset=0,this.unloaded=!1}get loading(){return this.process.loading}init(t){this.options=t,this.clear()}async load(){const t=await le(this.entity,this.requestReadOptions);this.addData(t),t.length!==this.limit&&(this.unloaded=!0)}addData(t){this.array.push(...t.map(n=>Object.freeze(n))),this.offset+=t.length}}pe=new WeakMap;function uo(e,t){const n=setInterval(()=>{fo(t)&&e.next()},2e3);r.onUnmounted(()=>{clearInterval(n)})}function fo(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}const po=["count","test"],mo={class:"widget-fast-table-head"},go={key:0,class:"title-md color-primary margin-0 widget-fast-table-label"},ho={class:"widget-fast-table-body"},yo=r.defineComponent({__name:"widget-fast-table",props:{entity:{},mark:{},masterEntities:{},binding:{},actions:{},hideLabel:{type:Boolean},hideActions:{type:Boolean},disableUsageContext:{type:Boolean}},setup(e,{expose:t}){const n=e,o=se.useRouter(),i=r.ref(null),a=r.computed(()=>i.value?u.value.indexOf(i.value[2]):null);function l(I,S,$){i.value=[I,S,$]}const c=new Mt(n.entity),s=r.ref(""),u=r.computed(()=>Array.isArray(k.value)?s.value.length===0?c.array:c.array.filter(I=>!!k.value.find($=>{const G=Ce($,I);return typeof G=="string"?G.includes(s.value):!1})):[]),f=r.ref(null),d=L.Form.getParentForm(),b=r.ref([]),h=Se(n.entity),{state:g,update:m}=dt(n.entity,{masterEntities:n.masterEntities||[]}),v=oe(async()=>{try{b.value=[],await c.reload(),n.disableUsageContext||await m()}catch(I){const{message:S}=rt(I);f.value=S}});d instanceof L.Form&&d.subscribe({read:v.call.bind(null),name:n.entity,type:"table"}),r.watch(()=>n.mark,()=>{E.set(n.entity,n.mark)});function p(){return R.and(R(E.prefilters),R(n.binding||{}))}const{controller:w}=et();r.watch(()=>g.value,I=>{I&&(I.canRead?w.show():w.hide())},{immediate:!0});let y=[_e.on("affected-entity",I=>{I.name===n.entity&&v.call()}),_e.on("display-entity",async I=>{I.name===n.entity&&(c.loading&&await c.process.promise,l(I.name,I.primaryKey,u.value.find(S=>S[h.value.fieldNameForIdentification]===I.primaryKey)))})];r.onUnmounted(()=>{y.map(I=>I()),w.remove()});function _(I){function S(W){return Array.isArray(W)?S(W[0]):typeof W!="string"?null:W}const $=S(I);if(!$)return;const G=E.order;C("order",G[0]!==$?[$,"asc"]:G[1]==="desc"?[]:[$,"desc"])}function C(I,S){E.update({[I]:S})}const F=r.computed(()=>v.wait),E=co(l,()=>{c.init({customFilters:E.customFilters,fields:it(k.value).join(" "),order:E.order,filter:p(),useContextFilter:E.state.settings.useContextFilter}),c.next()}),k=E.cellConfiguration;E.set(n.entity,n.mark),r.watch(()=>E.state.settings,()=>setTimeout(v.call,50));const N=r.computed(()=>E.state.settings);t({listSettings:N,array:u,config:k,listDataController:c,selectedRows:b});function V(){q.openModal(T.MODAL_LIST_DOWNLOAD,{entity:n.entity,cellConfig:E.cellConfig,order:E.order,prefilters:p(),customFilters:E.customFilters})}function D(){switch(E.displayModeForNew){case"modal":return q.openModal(T.MODAL_ENTITY,{entity:n.entity});case"form":return o.push(ct(n.entity));case"inline":return i.value=[n.entity]}}function Q(){E.clean()}function Ae(){return{entity:n.entity}}const ve=r.ref();return r.onMounted(()=>{uo(c,ve.value)}),(I,S)=>{var W;const $=r.resolveComponent("widget-button"),G=r.resolveComponent("widget-fast-table-form");return r.openBlock(),r.createElementBlock("div",{class:"widget-fast-table",count:b.value.length,test:i.value},[r.createElementVNode("div",mo,[r.unref(E).computedLabel.value&&!I.hideLabel?(r.openBlock(),r.createElementBlock("p",go,r.toDisplayString(r.unref(Y)(r.unref(E).computedLabel.value)),1)):r.createCommentVNode("",!0),r.unref(h)&&!I.hideActions?(r.openBlock(),r.createBlock(lo,{key:1,metadata:r.unref(h),tools:r.unref(E).computedTools.value,loading:F.value,"selected-rows":b.value||[],onReload:r.unref(v).call,onExport:V,onNew:D,"can-create":((W=r.unref(g))==null?void 0:W.canCreate)||!1},{default:r.withCtx(()=>[r.renderSlot(I.$slots,"tools",{},void 0,!0),r.unref(E).computedHasLocalConfiguration.value?(r.openBlock(),r.createBlock($,{key:0,onClick:Q,type:"primary",label:"Clear all filters"})):r.createCommentVNode("",!0)]),_:3},8,["metadata","tools","loading","selected-rows","onReload","can-create"])):r.createCommentVNode("",!0)]),r.createElementVNode("div",ho,[r.createVNode(ao,{search:s.value,"onUpdate:search":S[0]||(S[0]=j=>s.value=j),entity:I.entity,"filters-config":r.unref(E).computedFiltersConfiguration.value,filters:r.unref(E).computedPrefilter.value,"onUpdate:filters":S[1]||(S[1]=j=>C("prefilters",j))},null,8,["search","entity","filters-config","filters"]),r.createVNode(r.unref(Bt),{config:r.unref(k),array:u.value,"active-row":a.value,"onUpdate:activeRow":S[3]||(S[3]=j=>i.value=null),onOrder:_,class:"table main-table",selectedRows:b.value,"onUpdate:selectedRows":S[4]||(S[4]=j=>b.value=j),"row-options-handler":Ae},{"head-cell":r.withCtx(j=>{var we,mt,gt;return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(I.$slots["head-cell"]?I.$slots["head-cell"]:$t),r.mergeProps({label:j.label},j,{onOrder:_,order:r.unref(E).computedOrder.value,type:j.type,"is-full-selected":((we=b.value)==null?void 0:we.length)===((mt=u.value)==null?void 0:mt.length)&&((gt=u.value)==null?void 0:gt.length)>0}),null,16,["label","order","type","is-full-selected"]))]}),footer:r.withCtx(()=>[r.createElementVNode("div",{style:{padding:"10px"},ref_key:"endOfTheScroll",ref:ve},null,512)]),default:r.withCtx(()=>{var j,we;return[r.createVNode(G,{entity:(j=i.value)==null?void 0:j[0],"primary-key":((we=i.value)==null?void 0:we[1])||null,"master-entities":I.masterEntities||void 0,binding:I.binding,onFormUpdate:S[2]||(S[2]=()=>{i.value=null,r.unref(c).reload()})},null,8,["entity","primary-key","master-entities","binding"])]}),_:1},8,["config","array","active-row","selectedRows"])])],8,po)}}}),vo=M(yo,[["__scopeId","data-v-2fae7c36"]]);function jt(e,t={},n={}){const o=r.inject(T.PROVIDE_NAME_ACTIONS,null),i=typeof e=="string"?e:t,a=typeof t=="string"?n:t;return r.computed(()=>{var s;const c=((typeof e=="string"?(s=o==null?void 0:o.actions)==null?void 0:s.value:r.unref(e))||[]).find(u=>u.name===i);return c?{...c,...a}:null})}const wo=r.defineComponent({__name:"widget-action",props:{name:{},overrideParams:{}},setup(e){const t=e,n=jt(t.name,t.overrideParams||{}),o=r.computed(()=>{if(n.value)return oe(n.value.callback)});return(i,a)=>{var c;const l=r.resolveComponent("widget-button");return r.unref(n)?(r.openBlock(),r.createBlock(l,{key:0,label:r.unref(n).label,loading:((c=o.value)==null?void 0:c.loading)||!1,onClick:a[0]||(a[0]=()=>{var s,u;return(u=(s=o.value)==null?void 0:s.call)==null?void 0:u.call(s,i.overrideParams||{})})},null,8,["label","loading"])):r.createCommentVNode("",!0)}}}),bo=r.defineComponent({__name:"WidgetResolverEntity",setup(e){const t=se.useRouter(),n=se.useRoute();function o(){const i=n.params.entity,a=n.params.primaryKey;at(i,a).then(l=>t.replace(ct(l,a))).catch(l=>{P("error")(l),t.back()})}return r.onMounted(o),(i,a)=>(r.openBlock(),r.createElementBlock("div",null,[r.createVNode(Me,{label:"Loading..."})]))}}),Eo=r.defineComponent({__name:"modal-list-download",props:{entity:{},cellConfig:{},prefilters:{},order:{},customFilters:{}},setup(e){const t=e,n=r.computed(()=>o.finished?"Download CSV":`Download ${o.count} records.`),{state:o,downloadFile:i,reject:a,start:l}=En({entity:t.entity,config:t.cellConfig,prefilters:t.prefilters,order:t.order,customFilters:t.customFilters});return q.onBeforeModalClose(a),r.onMounted(l),r.watch(()=>o.finished,()=>{i(),q.popModal()}),(c,s)=>{const u=r.resolveComponent("widget-button"),f=r.resolveComponent("widget-modal-wrap");return r.openBlock(),r.createBlock(f,null,{footer:r.withCtx(()=>[r.createVNode(u,{onClick:s[0]||(s[0]=d=>{r.unref(i)(),r.unref(q.popModal)()})},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(n.value),1)]),_:1})]),default:r.withCtx(()=>[r.createElementVNode("div",null,[r.createVNode(Me,{label:"Loading"})])]),_:1})}}}),Ut=e=>(r.pushScopeId("data-v-66cf2326"),e=e(),r.popScopeId(),e),_o={class:"version-item"},ko={class:"text_md"},Co={class:"version-item-date text_md"},To=Ut(()=>r.createElementVNode("span",null,null,-1)),So=Ut(()=>r.createElementVNode("span",null,null,-1)),Ao={class:"text_sm"},Io={class:"text_sm line-clamp_5"},No={class:"text_sm line-clamp_5"},Ro=r.defineComponent({__name:"version-item",props:{selectedFields:{},date:{},customerName:{},version:{},changes:{},entity:{}},setup(e){const t=e;function n(a,l){const c=a.name.toLowerCase(),s=l.name.toLowerCase();return s==="version"?-1:c==="version"?1:s.startsWith("utc")?-1:c.startsWith("utc")?1:0}const o=r.computed(()=>[...t.changes||[]].sort(n)),i=r.computed(()=>(o.value||[]).filter(a=>Array.isArray(t.selectedFields)&&t.selectedFields.length!==0?t.selectedFields.includes(a.name):!0));return(a,l)=>(r.openBlock(),r.createElementBlock("div",_o,[r.createElementVNode("span",ko,[r.createElementVNode("b",null,r.toDisplayString(a.version),1)]),r.createElementVNode("span",Co,[r.createElementVNode("b",null,r.toDisplayString(r.unref(nt)(a.date)),1)]),To,r.createElementVNode("span",null,[r.createTextVNode("by "),r.createElementVNode("b",null,r.toDisplayString(a.customerName),1)]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.value,c=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:c.name},[So,r.createElementVNode("span",Ao,r.toDisplayString(c.name),1),r.createElementVNode("span",Io,r.toDisplayString(r.unref(Ge)(a.entity,c.name,c.newValue)),1),r.createElementVNode("span",No,r.toDisplayString(r.unref(Ge)(a.entity,c.name,c.oldValue)),1)],64))),128))]))}}),Lo=M(Ro,[["__scopeId","data-v-66cf2326"]]),tt=e=>(r.pushScopeId("data-v-cc723f37"),e=e(),r.popScopeId(),e),Oo={key:1,class:"wrap-history"},Fo={class:"history-header grid gap_10"},xo=tt(()=>r.createElementVNode("span",null,null,-1)),Bo=tt(()=>r.createElementVNode("span",{class:"text_md"},"New Value",-1)),Vo=tt(()=>r.createElementVNode("span",{class:"text_md"},"Old Value",-1)),$o={class:"padding_15 grid gap_10 container-history"},Do=r.defineComponent({__name:"modal-version-history",props:{entity:{},primaryKey:{}},setup(e){const t=e,n=r.computed(()=>`${l.value.description} Version History`),o=r.ref(),i=r.computed(()=>!s.value||Array.isArray(s.value)&&s.value.length===0?o.value:(o.value||[]).filter(d=>{var b;return d.action==="Insert"?!0:(b=d.changes)==null?void 0:b.find(h=>s.value&&s.value.includes(h.name))})),a=oe(u),l=Se(t.entity),c=r.computed(()=>l.value.fields.map(d=>({label:d.displayName,value:d.name}))),s=r.ref(null);async function u(){try{const d=await en({entity:t.entity,primaryKey:t.primaryKey});o.value=d.history}catch(d){P("error")(d)}}r.onMounted(()=>a.call());function f(d){return d.currentValues.map(b=>({name:b.fieldName,newValue:b.value})).filter(b=>b.newValue)}return(d,b)=>{const h=r.resolveComponent("widget-modal-wrap");return r.openBlock(),r.createBlock(h,{label:n.value,class:"wrap-modal-version-history"},{default:r.withCtx(()=>[r.unref(a).loading?(r.openBlock(),r.createBlock(r.unref(Me),{key:0,label:"Loading history..."})):(r.openBlock(),r.createElementBlock("div",Oo,[r.createElementVNode("div",Fo,[xo,r.createVNode(r.unref(L.FormField),{type:"select",options:c.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=g=>s.value=g),multiple:""},null,8,["options","modelValue"]),Bo,Vo]),r.createElementVNode("div",$o,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.value,(g,m)=>(r.openBlock(),r.createBlock(Lo,{"selected-fields":s.value,date:g.utcCreated,"customer-name":g.userName,version:g.version,changes:g.action==="Insert"?f(g):g.changes,entity:d.entity,key:m},null,8,["selected-fields","date","customer-name","version","changes","entity"]))),128))])]))]),_:1},8,["label"])}}}),Po=M(Do,[["__scopeId","data-v-cc723f37"]]);function Wt(e,t,n){const o=window.URL.createObjectURL(e);Pt(o,n),setTimeout(()=>{window.URL.revokeObjectURL(o)},100)}function Mo(e,t){return fetch(`/close-api/document-builder/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({CatalogId:t})}).then(n=>n.blob()).then(n=>{Wt(n,e+t+"-print-form.pdf",{blank:!0})})}function nt(e){return Be(e,"YYYY/MM/DD HH:mm:ss")}function Be(e,t="YYYY/MM/DD"){if(!e)return"";try{const n=new Date(e);return Sn.format(n,t)}catch(n){return console.log(n),"Invalid date"}}function oe(e){function t(i){o.status=i}function n(...i){if(o.loading)return Promise.reject("The process has already started.");o.loading=!0,o.wait=!0;const a=Promise.resolve().then(()=>t(1)).then(()=>e(...i)).then(l=>(t(3),l)).catch(l=>{throw t(2),l}).finally(()=>{o.wait=!1,o.loading=!1,o.promise=null});return o.promise=a,a}const o=r.reactive({status:0,wait:!1,loading:!1,call:n,promise:null});return o}var Ht=(e=>(e[e.init=0]="init",e[e.loading=1]="loading",e[e.error=2]="error",e[e.done=3]="done",e))(Ht||{});function rt(e){return typeof e=="string"?Re(e):jo(e)?Re(e.message,e.children||e.details||[],e.traceId):Uo(e)?Re(e.title,[e.detail||""],e.traceId):Re(T.DEFAULT_ERROR_MESSAGE)}function jo(e){return!!(typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,"message"))}function Uo(e){return!!(typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,"title"))}function Re(e,t=[],n){return{message:e,children:t,traceId:n}}function P(e="error"){return function(t){const{message:n,children:o,traceId:i}=rt(t);Ue.add(e,n,{children:o,traceId:i})}}function le(e,t={}){const n=x();return qt(t)&&t.id&&(t.primaryKey=t.id,delete t.id),n.emit("entity:read",{entity:e,...t})}function qt(e){return!!(e.id||e.primaryKey)}function ot(e,t){const n=x();return qt(t)&&t.id&&(t.primaryKey=t.id,delete t.id),n.emit("entity:update",{...t,entity:e})}function it(e){return e.reduce((t,n)=>(n.name&&(typeof n.name=="string"?t.push(n.name):t.push(...n.name)),t),[])}function Gt(e,t=2){if(!(typeof e=="string"||typeof e=="number"))return"";let o=String(e).split(".");return o[0]=o[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o.length<2&&(o[1]=""),o[1]=o[1].padEnd(t,"0"),o[1].length>t&&(o[1]=o[1].substring(0,t)),o.join(".")}function Wo(e,t){const n=new Map;return e.forEach(o=>{var a;const i=t(o);n.has(i)||n.set(i,[]),(a=n.get(i))==null||a.push(o)}),n}function Ho(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function qo(e){return e.text().then(t=>{try{return JSON.parse(t)}catch{return T.DEFAULT_ERROR_MESSAGE}})}function H(e,t={}){return K.isFront&&(t.headers||(t.headers={}),t.headers["Context-Id"]=K.contextId),t.redirect="manual",fetch(e,t).then(n=>n.type==="opaqueredirect"?void window.location.reload():n).catch(()=>{throw new Error(T.DEFAULT_ERROR_MESSAGE)}).then(n=>qo(n).then(o=>{if(!n.ok)throw o;return o}))}function zt(e,t=1e3){let n=0;return(...o)=>{clearTimeout(n),n=window.setTimeout(()=>e(...o),t)}}function Go(e,t){let n=!1;return(...o)=>{if(!n)return n=!0,setTimeout(()=>n=!1,t),e(...o)}}const zo=De(Pe("pretty-value-field-by-entity"));function Ge(e,t,n){try{const o=ee.get(e);if(!o)throw new Error("For entity metadata is not loaded");const i=o.fieldsByName[t];if(!i)throw new Error(`For entity ${e} can't found fieldMetadata for field ${t}`);return i.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(o){return zo('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',o,e,t,n),n}}const ie=De(Pe("use-socket"));function x(){return Yo}function Ko(e){return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Blob]"}const Yo=function(){let e=1,t,n;const o=new Set;let i=0;const a=new Set;function l(){if(t)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{t.close()},Mn*2);const p=new Uint8Array(1);p[0]=Pn,t.send(p)}setInterval(()=>{Array.from(o).forEach(p=>{v(p)&&(ie("Handler for event %s requestId %d was expired",p.event,p.requestId),p.requestId?s({requestId:p.requestId,event:Ot,data:{message:re.RequestTookToLong().message}}):o.delete(p))})},1e3),setInterval(()=>{(!t||t.readyState===3)&&u()},T.DELAY_SOCKET_RECONNECT);function c(){return{safeQueue:a,requestId:e,handlers:o,socketInstance:t}}function s(p){const w=[...o.values()];ie("Handlers array length is %d. Response event: %s. Request id: %d",o.size,p.event,p.requestId),w.forEach(y=>{const _=p.requestId;(y.requestId&&y.requestId===_||!y.requestId&&y.event===p.event)&&(ie("Find appropriated handler: %d, event: %s",e,y.event),y.callback(p.data,p),y.once&&(o.delete(y),ie("Handler was removed by *once* params was passed. %o",y)))})}function u(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),t=new WebSocket(n),t.onclose=function(p){ie("Connection to server was stopped: %d %s",p.code,p.reason),Array.from(o).forEach(w=>{w.guaranteedAnswer&&w.serializeString&&a.add(w.serializeString)})},t.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(p=>{f(p),a.delete(p)})},t.onerror=function(p){console.warn(p)},t.onmessage=p=>{var w;try{if(Ko(p.data)){l();return}const y=JSON.parse(p.data);if(!Kt(y)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(y);return}y.event==="progress"&&o.forEach(_=>{_.event===y.data.for.event&&_.requestId===y.data.for.requestId&&(console.log("UPDATE TIME"),_.timeToLive=new Date().getTime()-_.created+T.TIME_TO_LIVE_SOCKET_REQUEST)}),(w=y==null?void 0:y.data)!=null&&w.refresh&&location.reload(),s(y)}catch(y){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(y)}}}function f(p){t.send(p)}function d(p,w){m({event:p,callback:w})}function b(p,w){m({event:p,callback:w,once:!0})}function h(){return t&&(t==null?void 0:t.readyState)===1}function g(p,w,y){const _=++e,C=JSON.stringify({requestId:_,event:p,data:w,contextId:K.contextId,url:A.socketURLHandler?A.socketURLHandler():window.location.href});return h()?f(C):(a.add(C),ie("Socket is not connected. Message was send to save-queue")),new Promise((F,E)=>{m({event:p,requestId:_,once:!0,guaranteedAnswer:!0,serializeString:C,callback:(k,N)=>{if(ie("Promise was resolve with next data:",k),Xo(N))return void E(k);y&&y(k,N),F(k)},timeToLive:T.TIME_TO_LIVE_SOCKET_REQUEST})})}function m(p){const w={timeToLive:0,...p,created:new Date().getTime()};o.add(w)}function v(p){return p.timeToLive===0||typeof p.timeToLive!="number"?!1:new Date().getTime()-p.created>p.timeToLive}return{get socket(){return t},on:d,once:b,emit:g,initialization(p){n=p},getDevInfo:c}}(),Xo=e=>!!Kt(e)&&e.event===Ot,Kt=e=>typeof e=="object"&&e!==null&&"event"in e&&typeof e.event=="string"&&"requestId"in e&&typeof e.requestId=="number"&&"data"in e;function Yt(e,t){return x().emit("list-setting:read",{entity:e,mark:t})}function Jo(e,t){return x().emit("metadata-field:treat",{entity:e,fieldName:t})}function Xt(e,t){return x().emit("entity:create",{...t,entity:e})}function Jt(e,t){return x().emit("entity:delete",{...t,entity:e})}function Qo(e,t){return x().emit("usage-context:read",{...t,entity:e})}function Qt(e={}){return x().emit("tool:read",e)}function Zo(){return x().emit("metadata-list:read",{})}function Zt(e,t){return x().emit("batch:update",{...t,entity:e})}function at(e,t){return x().emit("entity:resolve",{primaryKey:t,entity:e})}function en(e){return x().emit("history:read",e)}function ei(e,t){return x().emit("entity:count",{...t,entity:e})}function tn(e){return`/${jn}/${e}`}function he(e){return{exec(t,n){switch(e.name){case"replace-boolean":return he.replaceBoolean(t,e.values);case"replace-record-operation":return he.replaceRecordOperation(t)}}}}he.replaceBoolean=ti;he.replaceRecordOperation=ni;function ti(e,t){return typeof e!="boolean"?"":e?t[1]:t[0]}function ni(e){switch(e){case"A":case null:return"+";case"M":return"~";case"N":return"";case"D":return"✖";default:return"?"}}function ri(e={}){return x().emit("tool:execute",e)}const oi=De(Pe("wrap-tool-response"));function nn(e,t){return e.handleConfirmation===void 0&&(e.handleConfirmation=si),e.handleAffectedEntity===void 0&&(e.handleAffectedEntity=ci),e.handleCloseForm===void 0&&(e.handleCloseForm=ui),e.handleValidationResult===void 0&&(e.handleValidationResult=li),{...t,label:t.title,async callback(n={}){var l;const o=typeof e.values=="function"?e.values(t,e):e.values;let i={};t.action.targetName==="Record"&&o.hasOwnProperty("Id")&&(i.Id=o.Id,delete o.Id);const a=()=>ri({name:t.name,values:{...o,...n},primaryKeys:i,usageContext:t.usageContext}).then(async c=>{var s,u,f,d;if(!ii(c))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(e.handlers))for await(const b of e.handlers)await b(t,c,e);if(!c.success)throw e.handleValidationResult&&c.validationEffect&&((u=(s=c.validationEffect)==null?void 0:s.results)!=null&&u.length)&&e.handleValidationResult(t,c.validationEffect,e),new Error(c.message);return t.showValidationResults&&e.handleValidationResult&&c.validationEffect&&(d=(f=c.validationEffect)==null?void 0:f.results)!=null&&d.length&&e.handleValidationResult(t,c.validationEffect,e),c.message&&Ue.add("info",c.message),Array.isArray(c.affectedEntities)&&e.handleAffectedEntity&&c.affectedEntities.forEach(b=>{var h;return(h=e.handleAffectedEntity)==null?void 0:h.call(e,t,b,e)}),t.closeHostForm&&e.handleCloseForm&&e.handleCloseForm(t,e),c}).catch(c=>{if(P("error")(c),e.handleReject)return e.handleReject(t,c,e)});if((l=e.overrides)!=null&&l[t.name])return e.overrides[t.name](t,e);if(t.paramDialog){const c=await di(t,e);if(c===null)return;n=Object.assign(n,c||{})}return t.requireSave&&e.form&&e.form.changed?e.form.save().then(a):!t.confirmation||!e.handleConfirmation||t.paramDialog?a():e.handleConfirmation(t,a)}}}function ii(e){return!!(e&&typeof e=="object"&&"affectedEntities"in e&&"success"in e)}function ai(e){const t="Are you sure?";return e===!0||typeof e=="string"&&e.toLowerCase()==="true"||e==="1"?t:typeof e=="string"?e:t}async function si(e,t){const n=ai(e.confirmation);if(!q.getComponentFromStore(T.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await q.promptModal(T.MODAL_CONFIRM,{message:n}))return t()}function li(e,t){const n=T.MODAL_VALIDATION_EFFECT;if(!q.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{q.pushModal(n,t)})}function ci(e,t,n){var s;function o(u){return u!==null&&typeof u=="object"&&typeof u.read=="function"}function i(u,f){u&&(oi("Affected Entity %s. Find form with name %s.",f,u.name),u.name===f&&o(u)&&u.read(),u instanceof L.Form&&u.dependencies.forEach(d=>i(d,f)))}_e.emit("affected-entity",t);const{router:a,form:l}=n,c=typeof t.primaryKey=="string"?t.primaryKey:(s=t.primaryKey)==null?void 0:s.Id;if(a&&t&&t.name===e.redirectEntity){_e.emit("display-entity",{primaryKey:c,name:t.name}),A.getEntityLink&&a.push(A.getEntityLink(t.name,c));return}i(l,t.name)}function ui(e,t){const{router:n}=t;n&&e.closeHostForm&&n.back()}function di(e,t){var n;if((n=e.paramDialog)!=null&&n.name)return q.promptModal(e.paramDialog.name,{paramDialog:e.paramDialog,tool:e,options:t})}let ae={};function Y(e,...t){if(typeof e!="string")return console.trace(`Label is not provided for translation: ${e}`),"undefined";let n=L.utils.getPropFromObject((this==null?void 0:this.vocabulary)||ae,e);if(typeof n=="string")return _t(n,t);const o=L.utils.getPropFromObject(ae==null?void 0:ae.root,e);return typeof o=="string"?_t(o,t):(typeof n===void 0&&console.warn(`Translation for label "${e}" is not founded.`),e)}function _t(e,t){return t.forEach((n,o)=>{e=e.replaceAll(new RegExp(`\\{${o}}`,"g"),n)}),e}Y.setGlobalVocabulary=function(e){ae=e};Y.getScope=function(e){const t=typeof e=="string"?e:"root";return typeof e!="string"&&console.warn(`SCOPE ${e} for translate is not string.`),Y.bind({vocabulary:L.utils.getPropFromObject(ae,t.toLowerCase())})};Y.setVocabulary=function(e){return typeof e=="string"&&(e=L.utils.getPropFromObject(ae,e)),Y.bind({vocabulary:e})};function fi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ze={exports:{}},B={},Ke={exports:{}},ce={};function rn(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function pi(e,t,n){}function mi(e,t,n){}var gi=/javascript\s*\:/img;function hi(e,t){return gi.test(t)?"":t}ce.whiteList=rn();ce.getDefaultWhiteList=rn;ce.onAttr=pi;ce.onIgnoreAttr=mi;ce.safeAttrValue=hi;var yi={indexOf:function(e,t){var n,o;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,o=e.length;n<o;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var o,i;if(Array.prototype.forEach)return e.forEach(t,n);for(o=0,i=e.length;o<i;o++)t.call(n,e[o],o,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}},be=yi;function vi(e,t){e=be.trimRight(e),e[e.length-1]!==";"&&(e+=";");var n=e.length,o=!1,i=0,a=0,l="";function c(){if(!o){var f=be.trim(e.slice(i,a)),d=f.indexOf(":");if(d!==-1){var b=be.trim(f.slice(0,d)),h=be.trim(f.slice(d+1));if(b){var g=t(i,l.length,b,h,f);g&&(l+=g+"; ")}}}i=a+1}for(;a<n;a++){var s=e[a];if(s==="/"&&e[a+1]==="*"){var u=e.indexOf("*/",a+2);if(u===-1)break;a=u+1,i=a+1,o=!1}else s==="("?o=!0:s===")"?o=!1:s===";"?o||c():s===`
@@ -9,5 +9,5 @@
9
9
  * jenesius-event-emitter v1.0.2
10
10
  * (c) 2022 Jenesius
11
11
  * @license MIT
12
- */const At=function(e,t){return e in this.events||(this.events[e]=[]),this.events[e].push(t),this.off.bind(this,e,t)},It=function(e,t){e in this.events&&this.events[e].forEach(n=>n(t))},Nt=function(e,t){const n=this.events[e];if(!n)return;const o=n.indexOf(t);o!==-1&&n.splice(o,1)},Rt=function(){this.events={}};class Z{constructor(){this.events={}}on(t,n){return At.call(this,t,n)}emit(t,n){return It.call(this,t,n)}off(t,n){return Nt.call(this,t,n)}cleanEvents(){Rt.call(this)}static on(t,n){return At.call(Z,t,n)}static emit(t,n){return It.call(Z,t,n)}static off(t,n){return Nt.call(Z,t,n)}static cleanEvents(){Rt.call(Z)}}Z.events={};class Wa extends Z{constructor(t){super(),this.name="Communication",this.read=()=>{},this.id=t}sendMessage(t){return ka(this.id,t)}static checkAndGenerate(t,n,o){return _a(t,n,o).then(i=>i.length===0?Ea(t,n,o):i[0])}}function Ha(){return x().emit("client:read",{})}class ft extends Error{static ConstContextCannotBeChanged(){return new ft("The current context is set to constant. In order to change it, you need to put Manager into a changeable state.")}}var ke,me;const J=class J extends Z{constructor(){super(...arguments);Ne(this,ke);Ne(this,me);this.isConstContext=!1,this.type="front",this.organizations=[],ue(this,me,!1)}set language(n){localStorage.setItem(T.LOCALSTORAGE_LANGUAGE_KEY,n)}get language(){return localStorage.getItem(T.LOCALSTORAGE_LANGUAGE_KEY)||J.DEFAULT_LANGUAGE}get contextId(){return Ie(this,ke)}set contextId(n){if(this.isConstContext)throw ft.ConstContextCannotBeChanged();ue(this,ke,n)}get contextType(){var n;if(this.contextId)return((n=this.person)==null?void 0:n.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(n){ue(this,me,n),this.emit(J.EVENT_READY_UPDATE,n)}get ready(){return Ie(this,me)}onReady(n){return this.on(J.EVENT_READY_UPDATE,n)}onupdateContext(n){return this.on(J.EVENT_CONTEXT_UPDATE,n)}setCurrentContext(n){if(this.contextId===n)return console.warn("[application-manager] The current context has already been installed.");this.contextId=n,localStorage.setItem(T.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(n)),this.emit(J.EVENT_CONTEXT_UPDATE,n),console.log(`Current context id %c${n}`,"color: purple")}get context(){var n;return this.contextId?this.contextId===((n=this.person)==null?void 0:n.id)?this.person:this.organizations.find(o=>o.id===this.contextId)||null:null}async init(){try{const n=await this.loadCustomerData();this.customer=n,this.person=n,this.organizations=n.organizations,this.userId=n.userId,this.restoreCurrentContext(),this.ready=!0}catch(n){P()(n)}}restoreCurrentContext(){var o,i;if(typeof((o=this.customer)==null?void 0:o.constContextId)=="number"||((i=this.customer)==null?void 0:i.constContextId)===null)return this.setCurrentContext(this.customer.constContextId),this.isConstContext=!0;const n=Number.parseInt(localStorage.getItem(T.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(n)&&this.validateContextId(Number(n)))this.setCurrentContext(n);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Ha()}validateContextId(n){var o;try{return((o=this.person)==null?void 0:o.id)==n?!0:!!this.organizations.find(i=>i.id===n)}catch{return!1}}};ke=new WeakMap,me=new WeakMap,J.DEFAULT_LANGUAGE="en",J.EVENT_CONTEXT_UPDATE="event:context-update",J.EVENT_READY_UPDATE="event:ready-update";let Je=J;function qa(e){return x().emit("metadata:read",{entity:e})}const ee=function(){const t=r.reactive({}),n=new Map;function o(c){return t[c]}async function i(c){if(n.has(c)&&await n.get(c),t[c])return o(c);const s=await a(c);return l(c,s),o(c)}function a(c){const s=qa(c).finally(()=>{n.delete(c)});return n.set(c,s),s}function l(c,s){t[c]=s}return{state:t,initEntity:i,get:o,loadingFlags:n}}();class Ga extends Z{on(t,n){return super.on(t,n)}emit(t,n){console.log("[event-bus] emit",t,n),super.emit(t,n)}off(t,n){super.off(t,n)}}class X{static login(t){return H(A.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...t,AppName:A.applicationName})})}static parseProcessAnswer(t){if(t.statusCode>4)throw new Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startRegistrationProcess(t){return X.requestStepRegistrationProcess("StartRegistration",t)}static confirmPhoneRegistrationProcess(t){return X.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",t)}static confirmEmailRegistrationProcess(t){return X.requestStepRegistrationProcess("ConfirmEmailByRegistration",t)}static finishEmailRegistrationProcess(t){return X.requestStepRegistrationProcess("FinishRegistration",t)}static requestStepRegistrationProcess(t,n){return H(`${A.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(t){return X.requestStepLoginProcess("StartLogin",t)}static loginWithPassword(t){return X.requestStepLoginProcess("LoginWithPassword",t)}static loginWithOtpCode(t){return X.requestStepLoginProcess("LoginWithOtpCode",t)}static requestStepLoginProcess(t,n){return H(`${A.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(X.parseLoginProcessAnswer)}static parseLoginProcessAnswer(t){if(t.statusCode>3)throw Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startPasswordReset(t,n){return H(`${A.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:t})})}static confirmPhoneNumberByAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:o,Code:i})})}static confirmEmailByAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:o,Code:i})})}static finishAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Password:o,ConfirmedPassword:i})})}}class za{static readHistoryById(t,n){return H(`/close-api/audits/history/${t}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ka{static getConfiguration(){return H("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(t){return await H(`/open-api/data/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ya{static getDictionary(t){if(!t)throw new Error(`Can't get dictionary for ${t}.`);return H(`/open-api/internationalization/language/${t}`)}}class Xa{static async upload(t,n){const o=new FormData;return o.append("file",t),o.append("entityName",n),H("/close-api/files",{method:"POST",body:o}).then(i=>(i.filename=t.name,i))}static getFileLink(t){return`/close-api/files/${t}`}}var _n=(e=>(e.Add="A",e.Delete="D",e.Modify="M",e.None="N",e))(_n||{}),kn=(e=>(e.Approved="A",e.AwaitingFeedback="AF",e.AssignedForExam="AFE",e.Cancelled="C",e.Closed="CLS",e.Completed="CT",e.Draft="D",e.NotSatisfied="NSF",e.OnClarification="OC",e.Processing="P",e.Rejected="R",e.ReadyForExam="RFE",e.Submitted="S",e.SecurityCheck="SCK",e.Satisfied="SF",e.Withdrawn="W",e))(kn||{});function Cn(e){return typeof e!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function Ja(e){return typeof e!="object"||e===null?!1:!!(e.hasOwnProperty("start")||e.hasOwnProperty("end"))}function R(e){return Object.keys(e).reduce((t,n)=>{const o=e[n];if(Array.isArray(o))return t.push(R.in(n,o)),t;if(Tn(o)&&(typeof o.min=="number"&&t.push(R.ge(n,o.min)),typeof o.max=="number"&&t.push(R.le(n,o.max))),Qa(o)){if(o.text){const a=(l=>{switch(l){case"end":return R.endWith;case"begin":return R.beginWith;default:return R.includes}})(o.option);t.push(a(n,o.text))}return t}if(Ja(o)){let i=function(a){var l;return((l=a.match(/([^Z]*)/))==null?void 0:l[0])+"0000Z"};return o.start&&t.push(`@${n} ge ${i(o.start)}`),o.end&&t.push(`@${n} le ${i(o.end)}`),t}return typeof o=="number"||typeof o=="boolean"||typeof o=="string"?(t.push(R.eq(n,o)),t):(o===null&&t.push(R.is(n,o)),t)},[]).join(" and ")}function Tn(e){return e!==null&&typeof e=="object"&&("min"in e||"max"in e)}function Qa(e){return e!==null&&typeof e=="object"&&"text"in e&&"option"in e}function ye(e){return typeof e=="string"&&Cn(e)?`{${e}}`:typeof e=="string"?`'${e}'`:`${e}`}R.includes=function(t,n){return`@${t} Contains ${ye(n)}`};R.beginWith=function(t,n){return`@${t} BeginWith ${ye(n)}`};R.endWith=function(t,n){return`@${t} EndWith ${ye(n)}`};R.notEq=function(t,n){return`@${t} nq ${ye(n)}`};R.eq=function(t,n){return Array.isArray(n)?R.in(t,n):`@${t} eq ${ye(n)}`};R.ge=function(t,n){return`@${t} ge ${n}`};R.le=function(t,n){return`@${t} le ${n}`};R.in=function(t,n){const o=n.map(ye).join(", ");return`@${t} in (${o})`};R.notIn=function(t,n){return!Array.isArray(n)||n.length===0?"":R.and(...n.map(o=>R.notEq(t,o)))};R.and=function(...t){return t.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(R.wrap).join(" and ")};R.wrap=function(t){return`(${t})`};R.is=function(t,n){return`@${t} is ${n}`};R.or=function(...t){return t.join(" or ")};function pt(e){return Object.keys(e).reduce((t,n)=>{let o=e[n];const i=n.charAt(0).toUpperCase()+n.slice(1);return typeof o=="object"&&!(o==null||Array.isArray(o))&&(o=pt(o)),t[i]=o,t},{})}var U=(e=>(e.Completed="Completed",e.FinalStep="FinalStep",e.NextStep="NextStep",e.FinalStepWithConfirmation="FinalStepWithConfirmation",e.NextStepWithConfirmation="NextStepWithConfirmation",e.ValidationError="ValidationError",e.Undefined="Undefined",e))(U||{});const K=new Je,_e=new Ga;exports.ApplicationStatus=kn;exports.AsyncProcessStatus=Ht;exports.Communication=Wa;exports.CoreError=re;exports.DisplayListRow=wn;exports.EventBus=_e;exports.Filter=R;exports.ListDataController=Mt;exports.Manager=K;exports.MetadataStore=ee;exports.ModalListDownload=Eo;exports.ModalVersionHistory=Po;exports.NotificationSystem=Ue;exports.OBJECT_TYPE_NAME_FIELD=Ft;exports.RecordOperation=_n;exports.WidgetAction=wo;exports.WidgetButton=pr;exports.WidgetFastTable=vo;exports.WidgetFastTableHeadCell=$t;exports.WidgetField=$r;exports.WidgetIcon=ge;exports.WidgetImage=kr;exports.WidgetList=Vr;exports.WidgetLoader=Me;exports.WidgetMultiButton=wr;exports.WidgetResolverEntity=bo;exports.WidgetSpinner=Te;exports.WidgetTable=Bt;exports.WidgetTablePanelFilterItem=Dt;exports.asyncProcess=oe;exports.authService=X;exports.billingService=de;exports.catchUniversal=P;exports.config=nr;exports.configuration=A;exports.constants=T;exports.convertDDToDMS=sa;exports.convertDMSToDD=aa;exports.convertListConfig=Ye;exports.coreUtils=ha;exports.debounce=zt;exports.documentsService=Ln;exports.downloadDocumentBuilderFile=Mo;exports.fileService=Xa;exports.formatter=he;exports.getCellName=ne;exports.getCellValue=Ce;exports.getEntityLink=ct;exports.getEntityResolveLink=vn;exports.getNamesFromListConfig=it;exports.getPathForResolveRouter=la;exports.getPrimaryFieldNameForEntity=ut;exports.getUnitValue=qe;exports.groupArrayByField=Wo;exports.historyService=za;exports.injectAction=jt;exports.internationalizationService=Ya;exports.invitationService=Rn;exports.isUUID=Cn;exports.openBlobFile=Wt;exports.openService=Ka;exports.parseError=rt;exports.parseTextByMarkdown=ia;exports.prettyDate=Be;exports.prettyDateWithTime=nt;exports.prettyMoney=Gt;exports.prettyValueFieldByEntity=Ge;exports.request=H;exports.setupListRow=Ze;exports.staticLink=tn;exports.t=Y;exports.throttle=Go;exports.universalBatchUpdate=Zt;exports.universalEntityCount=ei;exports.universalEntityCreate=Xt;exports.universalEntityDelete=Jt;exports.universalEntityRead=le;exports.universalEntityResolve=at;exports.universalEntityUpdate=ot;exports.universalHistoryRead=en;exports.universalListSettingRead=Yt;exports.universalMandatoryFieldsRead=da;exports.universalMetadataFieldTreat=Jo;exports.universalMetadataListRead=Zo;exports.universalToolRead=Qt;exports.useActions=Ia;exports.useCommunication=Ta;exports.useEnter=Na;exports.useFormEntity=Sa;exports.useListActiveRow=ya;exports.useListDownload=En;exports.useListEntity=wa;exports.useListSearch=La;exports.useListSelect=Ra;exports.useLocalStorage=xt;exports.useManagerState=ba;exports.useMetadata=Se;exports.useMetadataField=Vt;exports.usePrintForm=Ma;exports.useSocket=x;exports.useUsageContext=dt;exports.useVisibleItem=et;exports.useWizard=Va;exports.uuidv4=Ho;exports.valuesToUpperCase=pt;exports.wrapToolResponse=nn;
12
+ */const At=function(e,t){return e in this.events||(this.events[e]=[]),this.events[e].push(t),this.off.bind(this,e,t)},It=function(e,t){e in this.events&&this.events[e].forEach(n=>n(t))},Nt=function(e,t){const n=this.events[e];if(!n)return;const o=n.indexOf(t);o!==-1&&n.splice(o,1)},Rt=function(){this.events={}};class Z{constructor(){this.events={}}on(t,n){return At.call(this,t,n)}emit(t,n){return It.call(this,t,n)}off(t,n){return Nt.call(this,t,n)}cleanEvents(){Rt.call(this)}static on(t,n){return At.call(Z,t,n)}static emit(t,n){return It.call(Z,t,n)}static off(t,n){return Nt.call(Z,t,n)}static cleanEvents(){Rt.call(Z)}}Z.events={};class Wa extends Z{constructor(t){super(),this.name="Communication",this.read=()=>{},this.id=t}sendMessage(t){return ka(this.id,t)}static checkAndGenerate(t,n,o){return _a(t,n,o).then(i=>i.length===0?Ea(t,n,o):i[0])}}function Ha(){return x().emit("client:read",{})}class ft extends Error{static ConstContextCannotBeChanged(){return new ft("The current context is set to constant. In order to change it, you need to put Manager into a changeable state.")}}var ke,me;const J=class J extends Z{constructor(){super(...arguments);Ne(this,ke);Ne(this,me);this.isConstContext=!1,this.type="front",this.organizations=[],ue(this,me,!1)}set language(n){localStorage.setItem(T.LOCALSTORAGE_LANGUAGE_KEY,n)}get language(){return localStorage.getItem(T.LOCALSTORAGE_LANGUAGE_KEY)||J.DEFAULT_LANGUAGE}get contextId(){return Ie(this,ke)}set contextId(n){if(this.isConstContext)throw ft.ConstContextCannotBeChanged();ue(this,ke,n)}get contextType(){var n;if(this.contextId)return((n=this.person)==null?void 0:n.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(n){ue(this,me,n),this.emit(J.EVENT_READY_UPDATE,n)}get ready(){return Ie(this,me)}onReady(n){return this.on(J.EVENT_READY_UPDATE,n)}onupdateContext(n){return this.on(J.EVENT_CONTEXT_UPDATE,n)}setCurrentContext(n){if(this.contextId===n)return console.warn("[application-manager] The current context has already been installed.");this.contextId=n,localStorage.setItem(T.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(n)),this.emit(J.EVENT_CONTEXT_UPDATE,n),console.log(`Current context id %c${n}`,"color: purple")}get context(){var n;return this.contextId?this.contextId===((n=this.person)==null?void 0:n.id)?this.person:this.organizations.find(o=>o.id===this.contextId)||null:null}async init(){try{const n=await this.loadCustomerData();this.customer=n,this.person=n,this.organizations=n.organizations,this.userId=n.userId,this.restoreCurrentContext(),this.ready=!0}catch(n){P()(n)}}restoreCurrentContext(){var o,i,a;if(typeof((o=this.customer)==null?void 0:o.constContextId)=="number"||((i=this.customer)==null?void 0:i.constContextId)===null)return this.setCurrentContext(this.customer.constContextId),this.isConstContext=!0;const n=Number.parseInt(localStorage.getItem(T.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"")||((a=this.customer)==null?void 0:a.selectedContextId);if(!Number.isNaN(n)&&n&&this.validateContextId(Number(n)))this.setCurrentContext(n);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Ha()}validateContextId(n){var o;try{return((o=this.person)==null?void 0:o.id)==n?!0:!!this.organizations.find(i=>i.id===n)}catch{return!1}}};ke=new WeakMap,me=new WeakMap,J.DEFAULT_LANGUAGE="en",J.EVENT_CONTEXT_UPDATE="event:context-update",J.EVENT_READY_UPDATE="event:ready-update";let Je=J;function qa(e){return x().emit("metadata:read",{entity:e})}const ee=function(){const t=r.reactive({}),n=new Map;function o(c){return t[c]}async function i(c){if(n.has(c)&&await n.get(c),t[c])return o(c);const s=await a(c);return l(c,s),o(c)}function a(c){const s=qa(c).finally(()=>{n.delete(c)});return n.set(c,s),s}function l(c,s){t[c]=s}return{state:t,initEntity:i,get:o,loadingFlags:n}}();class Ga extends Z{on(t,n){return super.on(t,n)}emit(t,n){console.log("[event-bus] emit",t,n),super.emit(t,n)}off(t,n){super.off(t,n)}}class X{static login(t){return H(A.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...t,AppName:A.applicationName})})}static parseProcessAnswer(t){if(t.statusCode>4)throw new Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startRegistrationProcess(t){return X.requestStepRegistrationProcess("StartRegistration",t)}static confirmPhoneRegistrationProcess(t){return X.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",t)}static confirmEmailRegistrationProcess(t){return X.requestStepRegistrationProcess("ConfirmEmailByRegistration",t)}static finishEmailRegistrationProcess(t){return X.requestStepRegistrationProcess("FinishRegistration",t)}static requestStepRegistrationProcess(t,n){return H(`${A.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(t){return X.requestStepLoginProcess("StartLogin",t)}static loginWithPassword(t){return X.requestStepLoginProcess("LoginWithPassword",t)}static loginWithOtpCode(t){return X.requestStepLoginProcess("LoginWithOtpCode",t)}static requestStepLoginProcess(t,n){return H(`${A.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(X.parseLoginProcessAnswer)}static parseLoginProcessAnswer(t){if(t.statusCode>3)throw Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startPasswordReset(t,n){return H(`${A.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:t})})}static confirmPhoneNumberByAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:o,Code:i})})}static confirmEmailByAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:o,Code:i})})}static finishAccessRecovery(t,n,o,i){return H(`${A.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Password:o,ConfirmedPassword:i})})}}class za{static readHistoryById(t,n){return H(`/close-api/audits/history/${t}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ka{static getConfiguration(){return H("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(t){return await H(`/open-api/data/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ya{static getDictionary(t){if(!t)throw new Error(`Can't get dictionary for ${t}.`);return H(`/open-api/internationalization/language/${t}`)}}class Xa{static async upload(t,n){const o=new FormData;return o.append("file",t),o.append("entityName",n),H("/close-api/files",{method:"POST",body:o}).then(i=>(i.filename=t.name,i))}static getFileLink(t){return`/close-api/files/${t}`}}var _n=(e=>(e.Add="A",e.Delete="D",e.Modify="M",e.None="N",e))(_n||{}),kn=(e=>(e.Approved="A",e.AwaitingFeedback="AF",e.AssignedForExam="AFE",e.Cancelled="C",e.Closed="CLS",e.Completed="CT",e.Draft="D",e.NotSatisfied="NSF",e.OnClarification="OC",e.Processing="P",e.Rejected="R",e.ReadyForExam="RFE",e.Submitted="S",e.SecurityCheck="SCK",e.Satisfied="SF",e.Withdrawn="W",e))(kn||{});function Cn(e){return typeof e!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function Ja(e){return typeof e!="object"||e===null?!1:!!(e.hasOwnProperty("start")||e.hasOwnProperty("end"))}function R(e){return Object.keys(e).reduce((t,n)=>{const o=e[n];if(Array.isArray(o))return t.push(R.in(n,o)),t;if(Tn(o)&&(typeof o.min=="number"&&t.push(R.ge(n,o.min)),typeof o.max=="number"&&t.push(R.le(n,o.max))),Qa(o)){if(o.text){const a=(l=>{switch(l){case"end":return R.endWith;case"begin":return R.beginWith;default:return R.includes}})(o.option);t.push(a(n,o.text))}return t}if(Ja(o)){let i=function(a){var l;return((l=a.match(/([^Z]*)/))==null?void 0:l[0])+"0000Z"};return o.start&&t.push(`@${n} ge ${i(o.start)}`),o.end&&t.push(`@${n} le ${i(o.end)}`),t}return typeof o=="number"||typeof o=="boolean"||typeof o=="string"?(t.push(R.eq(n,o)),t):(o===null&&t.push(R.is(n,o)),t)},[]).join(" and ")}function Tn(e){return e!==null&&typeof e=="object"&&("min"in e||"max"in e)}function Qa(e){return e!==null&&typeof e=="object"&&"text"in e&&"option"in e}function ye(e){return typeof e=="string"&&Cn(e)?`{${e}}`:typeof e=="string"?`'${e}'`:`${e}`}R.includes=function(t,n){return`@${t} Contains ${ye(n)}`};R.beginWith=function(t,n){return`@${t} BeginWith ${ye(n)}`};R.endWith=function(t,n){return`@${t} EndWith ${ye(n)}`};R.notEq=function(t,n){return`@${t} nq ${ye(n)}`};R.eq=function(t,n){return Array.isArray(n)?R.in(t,n):`@${t} eq ${ye(n)}`};R.ge=function(t,n){return`@${t} ge ${n}`};R.le=function(t,n){return`@${t} le ${n}`};R.in=function(t,n){const o=n.map(ye).join(", ");return`@${t} in (${o})`};R.notIn=function(t,n){return!Array.isArray(n)||n.length===0?"":R.and(...n.map(o=>R.notEq(t,o)))};R.and=function(...t){return t.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(R.wrap).join(" and ")};R.wrap=function(t){return`(${t})`};R.is=function(t,n){return`@${t} is ${n}`};R.or=function(...t){return t.join(" or ")};function pt(e){return Object.keys(e).reduce((t,n)=>{let o=e[n];const i=n.charAt(0).toUpperCase()+n.slice(1);return typeof o=="object"&&!(o==null||Array.isArray(o))&&(o=pt(o)),t[i]=o,t},{})}var U=(e=>(e.Completed="Completed",e.FinalStep="FinalStep",e.NextStep="NextStep",e.FinalStepWithConfirmation="FinalStepWithConfirmation",e.NextStepWithConfirmation="NextStepWithConfirmation",e.ValidationError="ValidationError",e.Undefined="Undefined",e))(U||{});const K=new Je,_e=new Ga;exports.ApplicationStatus=kn;exports.AsyncProcessStatus=Ht;exports.Communication=Wa;exports.CoreError=re;exports.DisplayListRow=wn;exports.EventBus=_e;exports.Filter=R;exports.ListDataController=Mt;exports.Manager=K;exports.MetadataStore=ee;exports.ModalListDownload=Eo;exports.ModalVersionHistory=Po;exports.NotificationSystem=Ue;exports.OBJECT_TYPE_NAME_FIELD=Ft;exports.RecordOperation=_n;exports.WidgetAction=wo;exports.WidgetButton=pr;exports.WidgetFastTable=vo;exports.WidgetFastTableHeadCell=$t;exports.WidgetField=$r;exports.WidgetIcon=ge;exports.WidgetImage=kr;exports.WidgetList=Vr;exports.WidgetLoader=Me;exports.WidgetMultiButton=wr;exports.WidgetResolverEntity=bo;exports.WidgetSpinner=Te;exports.WidgetTable=Bt;exports.WidgetTablePanelFilterItem=Dt;exports.asyncProcess=oe;exports.authService=X;exports.billingService=de;exports.catchUniversal=P;exports.config=nr;exports.configuration=A;exports.constants=T;exports.convertDDToDMS=sa;exports.convertDMSToDD=aa;exports.convertListConfig=Ye;exports.coreUtils=ha;exports.debounce=zt;exports.documentsService=Ln;exports.downloadDocumentBuilderFile=Mo;exports.fileService=Xa;exports.formatter=he;exports.getCellName=ne;exports.getCellValue=Ce;exports.getEntityLink=ct;exports.getEntityResolveLink=vn;exports.getNamesFromListConfig=it;exports.getPathForResolveRouter=la;exports.getPrimaryFieldNameForEntity=ut;exports.getUnitValue=qe;exports.groupArrayByField=Wo;exports.historyService=za;exports.injectAction=jt;exports.internationalizationService=Ya;exports.invitationService=Rn;exports.isUUID=Cn;exports.openBlobFile=Wt;exports.openService=Ka;exports.parseError=rt;exports.parseTextByMarkdown=ia;exports.prettyDate=Be;exports.prettyDateWithTime=nt;exports.prettyMoney=Gt;exports.prettyValueFieldByEntity=Ge;exports.request=H;exports.setupListRow=Ze;exports.staticLink=tn;exports.t=Y;exports.throttle=Go;exports.universalBatchUpdate=Zt;exports.universalEntityCount=ei;exports.universalEntityCreate=Xt;exports.universalEntityDelete=Jt;exports.universalEntityRead=le;exports.universalEntityResolve=at;exports.universalEntityUpdate=ot;exports.universalHistoryRead=en;exports.universalListSettingRead=Yt;exports.universalMandatoryFieldsRead=da;exports.universalMetadataFieldTreat=Jo;exports.universalMetadataListRead=Zo;exports.universalToolRead=Qt;exports.useActions=Ia;exports.useCommunication=Ta;exports.useEnter=Na;exports.useFormEntity=Sa;exports.useListActiveRow=ya;exports.useListDownload=En;exports.useListEntity=wa;exports.useListSearch=La;exports.useListSelect=Ra;exports.useLocalStorage=xt;exports.useManagerState=ba;exports.useMetadata=Se;exports.useMetadataField=Vt;exports.usePrintForm=Ma;exports.useSocket=x;exports.useUsageContext=dt;exports.useVisibleItem=et;exports.useWizard=Va;exports.uuidv4=Ho;exports.valuesToUpperCase=pt;exports.wrapToolResponse=nn;
13
13
  //# sourceMappingURL=eservices-core.cjs.js.map
@@ -11,7 +11,7 @@ import Hn from "date-and-time";
11
11
  import lt from "debug";
12
12
  import { promptModal as Tt, openModal as nt, onBeforeModalClose as qn, popModal as Ft, getComponentFromStore as Zt, pushModal as Gn } from "jenesius-vue-modal";
13
13
  /*!
14
- * eservices-core v1.3.325
14
+ * eservices-core v1.3.326
15
15
  * (c) 2025 ESERVICES
16
16
  */
17
17
  const V = class V extends Error {
@@ -4164,11 +4164,11 @@ const le = class le extends he {
4164
4164
  * @description Метод восстанавливает текущий контекст из локального хранилища.
4165
4165
  * */
4166
4166
  restoreCurrentContext() {
4167
- var r, i;
4167
+ var r, i, a;
4168
4168
  if (typeof ((r = this.customer) == null ? void 0 : r.constContextId) == "number" || ((i = this.customer) == null ? void 0 : i.constContextId) === null)
4169
4169
  return this.setCurrentContext(this.customer.constContextId), this.isConstContext = !0;
4170
- const n = Number.parseInt(localStorage.getItem(O.LOCALSTORAGE_CURRENT_CONTEXT_KEY) || "");
4171
- if (!Number.isNaN(n) && this.validateContextId(Number(n))) this.setCurrentContext(n);
4170
+ const n = Number.parseInt(localStorage.getItem(O.LOCALSTORAGE_CURRENT_CONTEXT_KEY) || "") || ((a = this.customer) == null ? void 0 : a.selectedContextId);
4171
+ if (!Number.isNaN(n) && n && this.validateContextId(Number(n))) this.setCurrentContext(n);
4172
4172
  else {
4173
4173
  if (!this.person) return console.warn("Make sure you call ID recovery after saving user data");
4174
4174
  this.setCurrentContext(this.person.id);
@@ -1,6 +1,6 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('*{--extra-fast:.1s;--fast:.2s;--medium:.3s;box-sizing:border-box;--primary: #3949ab }html,body,#app{height:100%}body{margin:0}ul{text-align:left}.justify-content-center{justify-content:center}.user-select-none{-webkit-user-select:none;user-select:none}.flex{display:flex}.flex_column,.flex-column{display:flex;flex-direction:column}.flex_center{display:flex;align-items:center;justify-content:center}.flex_full,.flex_grow,.flex-grow{flex-grow:1}.flex-align_center{align-items:center}.grid{display:grid}.grid-center{display:grid;place-content:center}.link{text-decoration:var(--link-decoration);color:var(--link-color)}.link_hover-underline:hover,.link_hover_underline:hover{text-decoration:underline}.link_full{position:absolute;height:100%;width:100%;left:0;top:0}.text_sm{font-weight:400;font-size:12px;line-height:16px}.text_md{font-size:14px;line-height:20px}.text_lg{font-size:16px;line-height:24px}.text_size_xxl{font-size:18px;line-height:25px}.text_bold,.text-bold{font-weight:600}.text_nowrap{white-space:nowrap}.text_right{text-align:right}.text_center{text-align:center}.text_size_sm{font-size:12px;line-height:130%}.text_size_md{font-size:14px;line-height:140%}.text_error{color:red}.text_overflow{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.title_sm{font-weight:600;font-size:16px;line-height:24px}.title_md{font-weight:600;font-size:24px;line-height:32px}.title_lg{font-weight:700;font-size:32px;line-height:48px}.title_xxl,.title_xl{font-weight:700;font-size:48px;line-height:64px}.cursor_pointer{cursor:pointer}.cursor_default{cursor:default}button{outline:none;-webkit-user-select:none;user-select:none;transition:background-color .2s}.button{display:flex;align-items:center;justify-content:center;outline:none}.button_main{background-color:var(--button-background);color:var(--button-color)}.button_main:focus{background-color:var(--button-background-active)}.button_main:active{background-color:var(--button-background-active)}.button_white{background-color:var(--white);color:var(--main)}.button_sm{height:30px;width:130px}.button_shadow{box-shadow:0 2px 4px #00000040}.button_lg{font-weight:600;font-size:16px;line-height:24px;padding:12px 0;height:50px;width:200px}.button_disabled{background-color:var(--gray-1)}.button_resolve{background-color:var(--main);color:var(--white);border-radius:2px}.button_reject{border:1px solid var(--color-dark);border-radius:2px}.button_md{height:30px;padding:0 10px;min-width:80px}.button_disabled{background-color:var(--button-disabled-background-color);cursor:pointer!important}.color-light{color:var(--color-light)}.color-primary{color:var(--color-primary)}.color_main,.color__text_main{color:var(--main)}.color__text_black{color:var(--black-1)}.color__text_gray{color:var(--text-gray)}.color__text_red,.color_red{color:var(--red)}.color__text_white{color:var(--white)}.background_orange{background-color:var(--orange)}.background_red{background-color:var(--red)}.color_dark{color:var(--dark)}.color_light{color:var(--light)}.move-vertical-enter-active,.move-vertical-leave-active{transition:transform .5s ease}.move-vertical-enter-from,.move-vertical-leave-to{transform:translateY(-10px)}.move-horizontal-enter-active,.move-horizontal-leave-active{transition:transform .5s}.move-horizontal-enter-from,.move-horizontal-leave-to{transform:translate(-40px)}.modal-vertical-enter-active,.modal-vertical-leave-active,.modal-default{transition:transform var(--medium)}.modal-vertical-enter-active .modal-default,.modal-vertical-leave-active .modal-default{transform:translateY(-100px)}.move-vertical-fast-enter-active,.move-vertical-fast-leave-active{transition:transform var(--fast) ease}.move-vertical-fast-enter-from,.move-vertical-fast-leave-to{transform:translateY(-20px)}.slide-up-enter-active,.slide-up-leave-active{transition:transform var(--fast) ease,opacity var(--fast)}.slide-up-enter-from,.slide-up-leave-to{transform:translateY(20px);opacity:0}.opacity-enter-active,.opacity-leave-active{transition:opacity var(--fast) ease}.opacity-enter-from,.opacity-leave-to{opacity:0}.list-move,.list-enter-active,.list-leave-active{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translate(30px)}.list-leave-active{position:absolute}.transition-fast{transition:.1s}.modal-default{background-color:var(--white);position:relative;z-index:1;width:auto;background:var(--white);border-radius:var(--border-radius)}.modal-default__head{background-color:var(--black-1);text-align:center;padding:5px 0;border-radius:6px 6px 0 0}.modal-default__body{gap:20px;padding:0 15px}.modal-default__foot{padding:30px 0;display:flex;justify-content:center}.hint-tooltip{display:block;z-index:222;margin:auto;pointer-events:none;box-shadow:0 0 0 9999px #00000080}.tooltip-help-circle-in,.tooltip-help-circle-out{border-radius:50%}.tooltip-help-undefined{border-radius:50px}.tooltip-card{position:fixed;z-index:315;display:flex;flex-direction:column;width:480px;height:fit-content;margin:auto;border-radius:10px;background-color:var(--hint-background);cursor:default}.tooltip-card__foot{display:flex;justify-content:space-between;align-items:center;background-color:var(--hint-background-navigation);border-radius:10px;padding:20px}.tooltip-card__foot-current{font-weight:600;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body{position:relative;display:flex;flex-direction:column;gap:8px;padding:20px 20px 10px}.tooltip-card__body-title{font-weight:700;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body-text{font-size:16px;line-height:24px;color:var(--white)}.tooltip-card__foot-button_back{background-color:var(--main-1)}.tooltip-card__foot-button_next{background-color:var(--hint)}.tooltip-card__body-close{position:absolute;right:22px;top:12px;width:20px;height:16px;opacity:.3;cursor:pointer}.tooltip-card__body-close:hover{opacity:1}.tooltip-card__body-close:before,.tooltip-card__body-close:after{position:absolute;left:15px;content:" ";height:21px;width:2px;background-color:#fff}.tooltip-card__body-close:before{transform:rotate(45deg)}.tooltip-card__body-close:after{transform:rotate(-45deg)}.tooltip-card-container-wrap{pointer-events:none;position:absolute;left:0;top:0;z-index:123132;height:100%;width:100%}.tooltip-card-container-wrap>div{height:100%;width:100%;display:flex;justify-content:center;align-items:center}.tester-box-tooltip{pointer-events:all}.position_relative{position:relative}.position_absolute{position:absolute}.gap_5{gap:5px}.gap_10{gap:10px}.gap_15{gap:15px}.gap_20{gap:20px}.gap-25{gap:25px}.margin-0,.margin_0{margin:0}.widget-input{background-color:var(--input-background);border:var(--input-border);border-radius:var(--input-border-radius);color:var(--input-color)}.widget-input:disabled{background-color:var(--input-background-disabled);border:var(--input-border-disabled)}.widget-input[error=true]{border:var(--input-border-error)}.widget-input::placeholder{color:var(--input-placeholder-color)}.widget-input:disabled::placeholder{color:var(--input-placeholder-color-disabled)}.input_error{border:1px solid red!important}.input_size_md{height:var(--input-height)}.input-title{font-size:12px;line-height:16px;color:#667085;margin:4px 0}.widget-table{border-collapse:collapse}.widget-table_mini p{margin:0}.list-cell-link>a{position:absolute;left:0;top:0;z-index:1;height:100%;width:100%;cursor:pointer}.list-cell-link>p{font-weight:500}.widget-table__cell{padding:0 20px;font-weight:400;font-size:14px;line-height:19px}.widget-table-cell_use{cursor:pointer}.widget-table-cell_select{width:min-content}.table-cell-toggle{--border-color: black;position:relative;display:grid;place-content:center;border:1px solid var(--border-color);height:15px;aspect-ratio:1 / 1;border-radius:50%}.table-cell-toggle_active:after{content:"";border-radius:50%;background-color:var(--border-color);height:9px;aspect-ratio:1/1}.widget-table-cell_number,.widget-table-cell_money{text-align:end}.widget-list-cell-history{cursor:pointer}.widget-list-cell-history>span{color:var(--color-primary);font-size:16px;padding:0 10px}.widget-table-cell_multi-select>.container-input-wrap{align-items:center}.overflow_auto{overflow:auto}.overflow_hidden{overflow:hidden}.padding_5{padding:5px}.padding_10{padding:10px}.padding_0{padding:0}.padding_15{padding:15px}.padding_20{padding:20px}.padding-5{padding:5px}.padding-0{padding:0}.padding-15{padding:15px}.padding-20{padding:20px}.radius_5{border-radius:5px}.radius_10{border-radius:10px}.radius_15{border-radius:15px}.radius_20{border-radius:20px}.es-card-list{box-shadow:#959da533 0 8px 24px;border:1px solid #f1f1f1;border-radius:4px;background-color:#fff}.color-gray{color:#ccc}.es-container-full{height:100%;width:100%}.es-cursor-pointer{cursor:pointer}.es-cursor-default{cursor:default}.flex,.es-flex{display:flex}.es-flex-column{display:flex;flex-direction:column}.es-flex-center{display:flex;align-items:center;justify-content:center}.es-flex-grow{flex-grow:1}.es-flex-justify-center{justify-content:center}.es-flex-justify-between{justify-content:space-between}.es-flex-align-center{align-items:center}.es-gap-1{gap:1px}.es-gap-2{gap:2px}.es-gap-3{gap:3px}.es-gap-4{gap:4px}.es-gap-5{gap:5px}.es-gap-6{gap:6px}.es-gap-7{gap:7px}.es-gap-8{gap:8px}.es-gap-9{gap:9px}.es-gap-10{gap:10px}.es-gap-15{gap:15px}.es-gap-20{gap:20px}.gap-10{gap:10px}.gap-15{gap:15px}.gap-5{gap:5px}.gap-20{gap:20px}.es-list-container,.es-overflow-auto{overflow:auto}.es-overflow-hidden{overflow:hidden}.es-padding-2{padding:2px}.es-padding-3{padding:3px}.es-padding-4{padding:4px}.es-padding-5{padding:5px}.es-padding-10{padding:10px}.es-padding-0{padding:0}.es-padding-7{padding:7px}.es-padding-15{padding:15px}.es-padding-20{padding:20px}.es-padding-v-5{padding:5px 0}.es-padding-h-5{padding:0 5px}.es-padding-is-5{padding-inline-start:5px}.es-padding-ie-5{padding-inline-end:5px}.padding-bottom-10{padding-bottom:10px}.padding-10{padding:10px}.es-position-relative{position:relative}.es-position-absolute{position:absolute}.es-position-absolute-full{position:absolute;left:0;top:0;width:100%;height:100%}.es-position-absolute-center{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}.es-radius-2{border-radius:2px}.es-radius-3{border-radius:3px}.es-radius-4{border-radius:4px}.es-radius-5{border-radius:5px}.es-radius-6{border-radius:6px}.es-radius-7{border-radius:7px}.es-radius-8{border-radius:8px}.es-radius-9{border-radius:9px}.es-radius-10{border-radius:10px}.es-radius-15{border-radius:15px}.es-radius-20{border-radius:20px}.es-text-xs{font-weight:400;font-size:10px;line-height:13px}.es-text-sm{font-weight:400;font-size:12px;line-height:16px}.es-text-md{font-size:14px;line-height:20px}.es-text-lg{font-size:16px;line-height:24px}.es-text-xl{font-size:18px;line-height:25px}.es-text-center{text-align:center}.es-text-bold{font-weight:700}.es-text-no-wrap{text-wrap:nowrap}.es-weight-600{font-weight:600}.es-zindex-0{z-index:0}.es-zindex-1{z-index:1}.es-zindex-2{z-index:2}.es-zindex-3{z-index:3}.es-zindex-4{z-index:4}.es-zindex-5{z-index:5}.es-grid{display:grid}.es-grid-center{display:grid;place-content:center}.es-margin-0{margin:0}.widget-table__head-cell[data-v-aa18d6fa]{padding:18px;text-align:start}.widget-table__head-label[data-v-aa18d6fa]{font-weight:600;font-size:14px;line-height:19px}.widget-filter-text[data-v-f6da3bed]{padding:20px 10px}.widget-filter-enum[data-v-4c82f6e7]{padding:3px 0;max-height:400px;max-width:340px;min-width:180px;overflow:hidden auto}.widget-filter-enum-item[data-v-4c82f6e7]{padding:6px 11px;transition:.1s;cursor:pointer}.widget-filter-enum-item[data-v-4c82f6e7]:hover{background-color:#f1f1f1}.widget-filter-number[data-v-f9cd559e]{padding:4px 6px}[dir=rtl] .icon[data-v-8a72b45f]{transform:scaleX(-1)}.widget-spinner[data-v-0ef9ae88],.widget-spinner[data-v-0ef9ae88]:after{border-radius:50%;width:14px;height:14px}.widget-spinner[data-v-0ef9ae88]{font-size:2px;position:relative;text-indent:-9999em;border-top:1.1em solid rgba(255,255,255,.2);border-right:1.1em solid rgba(255,255,255,.2);border-bottom:1.1em solid rgba(255,255,255,.2);border-left:1.1em solid #ffffff;transform:translateZ(0);animation:spinnerAnimation-0ef9ae88 1.1s infinite linear}@keyframes spinnerAnimation-0ef9ae88{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.widget-button[data-v-450dc564]{position:relative}.widget-button-spinner[data-v-450dc564]{position:absolute;top:0;bottom:0;left:5px;margin:auto}.widget-multi-button-wrap[data-v-d43a76ce]{--button-size: 40px;max-height:var(--button-size);z-index:1;width:fit-content}.widget-multi-button[data-v-d43a76ce]{grid-template-columns:1fr var(--button-size);background-color:var(--primary);grid-template-rows:var(--button-size);transition:var(--fast)}.widget-multi-button_active[data-v-d43a76ce]{grid-template-rows:calc(var(--button-size) * var(--04895bf1))}.widget-multi-button-body[data-v-d43a76ce]{min-width:80px}.widget-multi-button-body-label[data-v-d43a76ce]{padding:10px 10px 10px 20px;color:#fff;transition:background-color var(--fast)}.widget-multi-button-body-label[data-v-d43a76ce]:hover{background-color:#223296}.widget-multi-button-side[data-v-d43a76ce]{height:var(--button-size);transition:transform var(--fast),background-color var(--fast);color:#fff}.widget-multi-button-side_active[data-v-d43a76ce]{transform:rotate(180deg)}.widget-multi-button-side[data-v-d43a76ce]:hover{background-color:#223296}tr[data-v-344a8cc1]{border:1px solid #F3F4FC;height:30px}th[data-v-344a8cc1],td[data-v-344a8cc1]{position:relative;padding:0 11px}th[data-v-344a8cc1]{text-align:left}p[data-v-344a8cc1]{margin:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.widget-list-head-cell[data-v-bf495d6a]{padding:0 0 0 10px;display:flex}.widget-list-head-cell[data-v-bf495d6a]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-bf495d6a]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-bf495d6a]{position:absolute;inset-inline-end:22px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-bf495d6a]{transform:rotate(180deg)}.head-cell-resize[data-v-bf495d6a]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-bf495d6a]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-bf495d6a]:after{content:"";margin:auto;width:1px;height:100%;display:block;background-color:#d2d2d2}.widget-list-head[data-v-ccffc6bd]{position:sticky;top:-1px;z-index:1}.test-block[data-v-ccffc6bd]{position:absolute;z-index:2;display:none;height:calc(100% + 1px);place-content:center;inset-block-start:-1px;padding-inline:10px;background-color:#e7f2ff;-webkit-user-select:none;user-select:none;white-space:nowrap}.widget-list-head th[data-v-ccffc6bd]{position:sticky;top:0;z-index:2;-webkit-user-select:none;user-select:none}.widget-head-cell[data-v-d131e64e]{display:flex;gap:4px}.widget-head-cell-order[data-v-d131e64e]{display:flex;flex-direction:column;justify-content:center;gap:2px}.widget-head-cell-label[data-v-d131e64e]{cursor:pointer}.widget-fast-table-head-cell-td[data-v-d131e64e]{padding:7px}.widget-head-cell-order-icon[data-v-d131e64e]{transition:.1s;height:18px;width:18px}.widget-head-cell-order-icon_desc[data-v-d131e64e]{transform:rotate(180deg)}.widget-filter-item-container[data-v-43ed0322]{position:relative}.widget-filter-item-arrow[data-v-43ed0322]{transform:rotate(180deg)}.widget-filter-item-label_active[data-v-43ed0322]{font-weight:700}.widget-filter-item[data-v-43ed0322]{display:grid;grid-template-columns:max-content max-content;align-items:center;cursor:pointer;padding:0 10px;color:#fff}.widget-filter-item[data-v-43ed0322]:not(.widget-filter-item_active){opacity:.6}.widget-filter-item-label[data-v-43ed0322]{-webkit-user-select:none;user-select:none;padding:4px 2px 4px 8px}.widget-filter-item-popup[data-v-43ed0322]{position:absolute;z-index:2;inset-block-start:100%;inset-inline-end:0;box-shadow:0 2px 2px #00000040;background-color:#fff}.widget-filter-item-arrow[data-v-43ed0322]{transition:.2s}.widget-table-search[data-v-99052614]{gap:5px;padding:0 10px 0 12px}.widget-table-search-icon[data-v-99052614]{align-self:center}.widget-table-search-input[data-v-99052614]{outline:none;background-color:transparent;border:0;padding:6px 5px;font-size:16px}.widget-table-panel-filter[data-v-8f09ec8d]{justify-content:space-between;background-color:var(--color-primary)}.widget-fast-table[data-v-2fae7c36]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:max-content minmax(0,1fr);gap:15px}.widget-fast-table-body[data-v-2fae7c36]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:max-content minmax(0,1fr)}.widget-fast-table-head[data-v-2fae7c36]{display:grid;gap:15px}.main-table[data-v-2fae7c36]{overflow:auto}.version-item[data-v-66cf2326]{display:grid;gap:2px 10px;grid-template-rows:max-content;grid-template-columns:min-content minmax(100px,200px) 1fr 1fr}.version-item-date[data-v-66cf2326]{white-space:nowrap}.line-clamp_5[data-v-66cf2326]{text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}.history-header[data-v-cc723f37]{align-items:center;position:sticky;top:0;background-color:#fff;grid-template-rows:max-content;grid-template-columns:20px 210px 1fr 1fr}.container-history[data-v-cc723f37]{display:flex;flex-direction:column-reverse;overflow:auto}.wrap-modal-version-history[data-v-cc723f37]{min-height:380px}@media screen and (min-width: 756px){.wrap-modal-version-history[data-v-cc723f37]{min-width:800px;max-width:1000px}}.wrap-history[data-v-cc723f37]{height:100%;overflow:auto}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  (function(p,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("jenesius-vue-form"),require("vue-router"),require("date-and-time"),require("debug"),require("jenesius-vue-modal")):typeof define=="function"&&define.amd?define(["exports","vue","jenesius-vue-form","vue-router","date-and-time","debug","jenesius-vue-modal"],r):(p=typeof globalThis<"u"?globalThis:p||self,r(p["eservices-core"]={},p.Vue,p.JenesiusVueForm,p.VueRouter,p.DateAndTime,p.Debug,p.JenesiusVueModal))})(this,function(p,r,S,J,Nn,Ie,H){"use strict";var Sn=p=>{throw TypeError(p)};var An=(p,r,S)=>r.has(p)||Sn("Cannot "+S);var We=(p,r,S)=>(An(p,r,"read from private field"),S?S.call(p):r.get(p)),je=(p,r,S)=>r.has(p)?Sn("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(p):r.set(p,S),we=(p,r,S,J)=>(An(p,r,"write to private field"),J?J.call(p,S):r.set(p,S),S);/*!
3
- * eservices-core v1.3.325
3
+ * eservices-core v1.3.326
4
4
  * (c) 2025 ESERVICES
5
5
  */var he,Se,ye;const $=class $ extends Error{constructor(t,n=null){super(),this.message=t,this.details=n,this.id=$.ID++}static ParentFormNotFound(){return new $("Can't found parent form.")}static UndefinedNameOfCompositeFormController(t){return new $("Composite object name is undefined",t)}static EntityWithoutName(t){return new $("'Entity doesn't have a name",t)}static NotResolvedNameEventEmitter(t){return new $(`'${t}' is not a valid Event emitter name`)}static FormIsNotValidated(t){return new $("Form is not validated",t)}static ListWorkerIsRunningOrEnd(t){return new $("List data request is running or already done",t)}static ObjectIdNotNumber(t){return new $(`${t} (id) is not a number`)}static UndefinedErrorId(t,n){return $.ApiNotAvailable()}static ApiError(t){return new $("Request error",t)}static ApiNotAvailable(){return new $(`Sorry, we experience difficulties here.
6
6
  Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(t,n){return!t&&!n?$.ApiNotAvailable():new $(t||"Authorization Error",n)}static ApiResponseParseFailed(){return $.ApiNotAvailable()}static MissingIdInValuesEntity(t){return new $("Object doesn't have id",t)}static ObjectWithIdNotFound(t,n){return new $(`Can't find object with id: ${t}`,n)}static ObjectWithoutConnectToPresentArray(t,n){return new $("Object is not found.",{object:t,array:n})}static EntityWithoutId(t){return new $("Entity doesn't have id.",t)}static NotFoundedTableIndex(t,n){return new $(`Can't find the element with tableIndex ${t}`,n)}static UndefinedError(t,n=[]){return new $(t,n)}static TableArrayAlreadyIncludeProvidedIndexValue(t,n,i){return new $(`Array already includes the element with value ${t}`,{array:n,table:i})}static MetadataEntityIsNotAvailable(t){return new $(`Metadata for the ${t} is not currently available.`)}static RequestTookToLong(){return new $("The request took too long to complete. Try again later.")}};$.ID=0;let re=$;const In="Please try again later or submit a feedback if problem doesn't go.";function Rn(e){return e.text().then(t=>{try{return JSON.parse(t)}catch{return In}})}function fe(e,t={}){return t.redirect="manual",fetch(e,t).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw re.ApiNotAvailable()}).then(n=>Rn(n).then(i=>{if(!n.ok)throw i;return i}))}class Ln{constructor(){this.public=!1,this.errors=new Proxy([],{set:(t,n,i)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(i)}`),t[n]=i,!0)}),window._journal=this}get error(){return{add:(...t)=>{this.errors.push(t)},clean:()=>{this.errors.splice(0,this.errors.length)},console:()=>{console.log(this.errors)}}}welcome(){console.log("The journal has been initialized. To get access check %c_journal in console.","background: blue; color: white")}}new Ln;class On{static invite(t,n,i){return fe("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:t,personKey:n,relatedRoleCode:i})})}static accept(t,n){return fe("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:t,version:n,mark:!0})})}static decline(t,n){return fe("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:t,version:n,mark:!1})})}}class vn{static getRequiredDocuments(t,n,i){const o=new URLSearchParams({entity:t,primaryKey:n,statusCode:i});return fetch(`/close-api/views/required-documents?${o.toString()}`).then(a=>a.json())}}class ue{static url(){return"close-api/billing"}static getBillingMetadata(t){return fetch(`/${ue.url()}/calculator/${t}`)}static calculate(t,n){return fe(`/${ue.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:t,values:n})}).then(i=>{if(i&&i.status===1)return i;throw Array.isArray(i.notes)?new Error(i.notes[0]):re.ApiNotAvailable()})}static parseMetadataField(t){function n(i){switch(i.type){case"ValueType":switch(i.dataType){case"Integer":return"number";default:return i.dataType}case"EntityReference":return i.dataType}}return{name:t.name,label:t.title,required:t.required,type:n(t)}}static createOnlinePayment(t,n){return fe(`/${ue.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:t,returnURL:n})})}static applyOnlinePayment(t){return fe(`/${ue.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:t})})}}const $n={class:"widget-table__head-cell"},Bn={key:1,class:"widget-table__head-label margin_0 text_overflow"},gt=r.defineComponent({__name:"widget-table-head-cell",props:{label:{},type:{}},emits:["select"],setup(e,{emit:t}){const n=t;function i(){n("select")}return(o,a)=>(r.openBlock(),r.createElementBlock("th",$n,[o.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(S.FormField),{key:0,onClick:i})):(r.openBlock(),r.createElementBlock("span",Bn,r.toDisplayString(o.label),1))]))}}),Fn={class:"widget-table__head"},Dn=r.defineComponent({__name:"widget-table-head",props:{config:{}},setup(e){return r.computed(()=>gt),(t,n)=>(r.openBlock(),r.createElementBlock("tr",Fn,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.config,i=>r.renderSlot(t.$slots,"default",r.mergeProps({ref_for:!0},i),void 0,!0)),256))]))}}),x=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},Pn=x(Dn,[["__scopeId","data-v-aa18d6fa"]]);function He(e){return Array.isArray(e)?He(e[0]):typeof e!="string"?null:e}function ie(e){return He(e.name)}function Vn(e){const t=new RegExp(/\$\{([a-zA-Z0-9_.]+)}/,"g"),n=[];let i;for(;(i=t.exec(e))!==null;)n.push(i[1]);return n}function Mn(e,t){return Vn(e).forEach(i=>{e=e.replace(new RegExp("\\$\\{"+i+"}","g"),S.utils.getPropFromObject(t,i))}),e}function qe(e){return t=>typeof t=="string"||typeof t=="number"?`${t} ${e}`:""}function be(e,t){const n=ie(e);if(typeof e.value=="string")return Mn(e.value,t);let i=n?S.utils.getPropFromObject(t,n):null;if(i===void 0&&(i=null),typeof e.value=="function")return e.value(i,t);if(e.value===null)return null;switch(e.unitValue&&(i=qe(e.unitValue)(i)),e.unit&&(i=qe(e.unit)(i)),e.type){case"number":{typeof i=="number"&&(i=new Intl.NumberFormat().format(i));break}case"date":{i=Oe(typeof i=="string"?i:null);break}case"TimeSpan":{const o=i==null?void 0:i.match(/((\d)+.)?(\d+:\d+:\d+)/);o&&(i=`${o[2]||0} D ${o[3]}`);break}case"dateTime":case"dateWithTime":{i=Xe(typeof i=="string"?i:null);break}case"money":{i=Bt(i);break}case"DateTime":{i=Oe(typeof i=="string"?i:null,e.format||I.dateTimeFormat);break}}return e.formatter&&(i=me(e.formatter).exec(i,t)),typeof i=="boolean"&&(i=i?"✓":"—"),i}const xn=1,Un=5e3,Wn="static-folder",ht="request-error",yt="EntityTypeName",A={LIST_ACTIVE_NEW:-1,DEFAULT_ERROR_MESSAGE:"Please try again later or submit a feedback if problem doesn't go.",LOCALSTORAGE_CURRENT_CONTEXT_KEY:"CurrentContext",LOCALSTORAGE_LANGUAGE_KEY:"CurrentLanguage",DELAY_SOCKET_RECONNECT:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",PROVIDE_ENTITY_NAME:"provide-entity-name",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",MODAL_LIST_DOWNLOAD:"list-download",MODAL_LIST_SETTINGS:"list-settings",MODAL_SIMPLE_TOOL_PARAMETERS:"SimpleToolParameters",MODAL_BATCH_VALUES:"batch-values",MODAL_ENTITY:"form-entity",MODAL_HISTORY:"entity-history",TIME_TO_LIVE_SOCKET_REQUEST:45e3,CORE_DEBUG_LABEL:"eservices-core",VISIBLE_ITEM_PROVIDE_NAME:"visible-item-provider",EVENT_FORM_UPDATE:"form-update",EVENT_AFFECTED_ENTITY:"affected-entity",DEFAULT_ORDER_DIR:"asc",TABLE_MOCK_FIELD:"_A_MOCK_ID_FIELD",OBJECT_TYPE_NAME_FIELD:yt,FIELD_NAME_REFERENCE_CHANGES:"REFERENCE_CHANGES",PATH_RESOLVER_ENTITY:"resolver",TOOL_PRINT_NAME:"Print"};function Re(e){return[A.CORE_DEBUG_LABEL,e].join(":")}const jn={class:"widget-filter-text flex-column gap_10"},Hn={class:"flex gap_20"},qn=x(r.defineComponent({__name:"widget-filter-text",props:{values:{}},emits:["update:values","clear"],setup(e,{emit:t}){const n=e,i=t,o=new S.Form({parent:!1}),a={begin:"Begin with",end:"End with",include:"Contains"};function l(d="",u="include"){return{text:d,option:u}}r.onMounted(()=>{const d=n.values?typeof n.values=="string"?l(n.values):n.values:l();o.setValues(d)});function c(){i("update:values",o.values)}function s(){i("clear")}return r.watch(()=>n.values,d=>o.setValues(d||l()),{immediate:!0}),(d,u)=>{const f=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",jn,[r.createElementVNode("div",Hn,[r.createVNode(r.unref(S.FormField),{name:"text",type:"text",label:"Search"})]),r.createVNode(r.unref(S.FormField),{name:"option",type:"radio",options:a}),r.createElementVNode("div",null,[r.createVNode(f,{onClick:c,type:"primary"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(Y)("Apply")),1)]),_:1}),r.createVNode(f,{onClick:s},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(r.unref(Y)("Clear")),1)]),_:1})])])}}}),[["__scopeId","data-v-f6da3bed"]]),Gn={class:"widget-filter-enum"},zn={class:"flex gap-10 padding-10"},Kn=x(r.defineComponent({__name:"widget-filter-entity",props:{baseEntity:{},filters:{},values:{},filterMetadata:{}},emits:["update:values","readProcess"],setup(e,{emit:t}){const n=e,i=r.ref([]),o=Ce(n.filterMetadata.entity),a=u=>(n.values||[]).includes(u),l=t;function c(u){const f=n.values||[];return f.includes(u)?l("update:values",f.filter(_=>_!==u)):l("update:values",[...f,u])}const s=oe(async()=>{i.value=await se(n.baseEntity,{fields:n.filterMetadata.name.join(" "),order:[n.filterMetadata.name[1],"asc"],distinct:!0,filter:O(n.filters)}).then(u=>u.map(f=>({label:f[n.filterMetadata.name[1]],value:f[n.filterMetadata.name[0]]})))});function d(){l("update:values",[])}return r.watch(()=>s.loading,u=>{l("readProcess",u?"start":"end")},{immediate:!0}),r.watch(()=>o.value,()=>{s.loading||s.call()},{immediate:!0}),(u,f)=>{const _=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",Gn,[r.createElementVNode("div",zn,[r.createVNode(_,{label:"Reload filter",loading:r.unref(s).loading||!1,icon:"reload",onClick:f[0]||(f[0]=()=>r.unref(s).call())},null,8,["loading"]),r.createVNode(_,{label:"Clear",onClick:d})]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.value,y=>(r.openBlock(),r.createBlock(r.unref(S.FormField),{class:"widget-filter-enum-item",key:y.value,onClick:()=>c(y.value),type:"single-checkbox","model-value":a(y.value),label:y.label},null,8,["onClick","model-value","label"]))),128))])}}}),[["__scopeId","data-v-4c82f6e7"]]),Ee=r.reactive({});function Yn(){bt(),setInterval(bt,50)}function wt(){return Ee}function bt(){const e={};Object.entries(localStorage).forEach(([t,n])=>{e[t]=!0,Ee[t]!==n&&(Ee[t]=n)}),Object.keys(Ee).forEach(t=>{e[t]||delete Ee[t]})}const Xn={class:"widget-filter-number flex-column es-gap-10"},Jn={class:"flex es-gap-10"},Qn={class:"flex gap-10"},Et=x(r.defineComponent({__name:"widget-filter-number",props:{baseEntity:{},values:{}},emits:["update:values","readProcess"],setup(e,{emit:t}){const n=e,i=t,o=new S.Form({parent:!1}),a=Ft(()=>{const c=o.getValueByName("min"),s=o.getValueByName("max");return i("update:values",{min:c,max:s})},800);o.onvalue(a),r.watch(()=>n.values,()=>{n.values&&o.setValues(n.values)},{immediate:!0});function l(){o.cleanValues()}return(c,s)=>{const d=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",Xn,[r.createElementVNode("div",Jn,[r.createVNode(r.unref(S.FormField),{name:"min",label:"More than",type:"number"}),r.createVNode(r.unref(S.FormField),{name:"max",label:"Less than",type:"number"})]),r.createElementVNode("div",Qn,[r.createVNode(d,{label:"Clear",onClick:l})])])}}}),[["__scopeId","data-v-f9cd559e"]]),I={getEntityLink(e,t){return`/forms/${e}/${t}`},iconHandlerText(){return""},iconTag:"i",dateTimeFormat:"DD/MM/YYYY HH:mm:ss",tableFilterEntityBind:{String:qn,Entity:Kn,Decimal:Et,Integer:Et},arrayListCellHandlers:[],arrayListRowHandlers:[],arrayFieldParamsHandlers:[]};function Zn(e){Yn();for(let t in e)I[t]=e[t]}const pe=x({props:{name:String},setup(e,t){let n="unknown";try{n=t.slots.default()[0].children}catch{n=e.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>r.h(I.iconTag,{class:I.iconHandler?I.iconHandler(n):`icon icon-${n}`},I.iconHandlerText(n))}},[["__scopeId","data-v-8a72b45f"]]),er=Ie(Re("setup-list-row"));function tr(e,t){const n=e.config.map(i=>nr(i,e,t));return r.h("tr",{class:"widget-table__row widget-table-row"},n)}function nr(e,t,n){const i=t.values;let o=be(e,i);const a={onClick:[],title:e.hint,class:["widget-table__cell widget-table-cell"]};function l(u){a.onClick.push(()=>u(i,e,n))}function c(u){Array.isArray(u)?a.class.push(...u):a.class.push(u)}const s=[],d=[];if(e.hide&&e.hide(i))return[r.h("td")];if(e.type)switch(c(`widget-table-cell_${e.type}`),e.type){case"multi-select":{d.push(r.h(S.FormField,{type:"single-checkbox",modelValue:t.selected})),l(_t.bind(null,n,!0));break}case"select":{d.push(r.h(S.FormField,{type:"single-radio",modelValue:t.selected})),l(_t.bind(null,n,!1));break}}if(e.onClick&&l(e.onClick),e.link)try{const u=e.link(i);if(u){const f=r.h(J.RouterLink,{to:u});d.push(f),c("widget-table-cell_link")}}catch(u){er("Can't add router link",u)}if(e.href&&(d.push(r.h("a",{href:e.href(i),target:"_blank"})),c("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&d.push(r.h("p",{class:"widget-list-cell-text"},o)),e.icon&&(typeof e.icon=="string"&&d.push(r.h(pe,{name:e.icon})),typeof e.icon=="function")){const u=e.icon(i);u!==null&&d.push(r.h(pe,{name:u}))}return e.class&&(typeof e.class=="function"?c(e.class(i)):c(e.class)),I.listCellHandler&&(console.log("listCellHandler is deprecated. Please use coreUtils.addListCellHandler instead."),I.listCellHandler(e,i,{cellNodeChildren:d,addClass:c,addHandleClick:l,context:n})),I.arrayListCellHandlers&&I.arrayListCellHandlers.forEach(u=>u(e,i,{cellNodeChildren:d,addClass:c,addHandleClick:l,context:n})),s.push(r.h("td",a,d)),s}function _t(e,t){e.emit("select",t)}function Ge(e,t){return()=>{try{return tr(e,t)}catch(n){return console.warn(n),null}}}const rr={props:{values:Object,config:Object,selected:Boolean},setup:Ge},ir=["colspan"],kt=r.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(e,{emit:t}){const n=t,i=r.ref();return r.onMounted(()=>{setTimeout(()=>{i.value&&i.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(o,a)=>(r.openBlock(),r.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:i},[r.createElementVNode("td",{colspan:o.rowLength},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(o.component),r.mergeProps(o.$attrs,{values:o.values,new:o.isNew,onClose:a[0]||(a[0]=l=>n("close")),onSave:a[1]||(a[1]=l=>n("save",l))}),null,16,["values","new"]))],8,ir)],512))}}),ze="update:selectedRows",or="update:activeRow",Ct=r.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1},rowOptionsHandler:{type:Function,default:()=>({})}},emits:["save","order"],setup(e,{emit:t}){const n=e,i=r.ref(),o=t,a=r.useSlots(),l=r.computed(()=>{var y;return(y=a==null?void 0:a.default)==null?void 0:y.call(a)[0]});function c(){const h=n.selectedRows.length!==0?[]:[...n.array];o(ze,h)}function s(y,h=!0){if(!n.selectedRows)return;if(!h)return o(ze,n.selectedRows.includes(y)?[]:[y]);const g=[...n.selectedRows],b=g.indexOf(y);return b===-1?g.push(y):g.splice(b,1),o(ze,g)}function d(y){o(or,y)}function u(y){o("save",y),o("update:activeRow",null)}const f=r.computed(()=>{const y=n.config.filter(h=>h.visible!==!1);return n.shortcut?y.filter(h=>h.name?!!n.array.find(g=>![null,""].includes(be(h,g))):!0):y});r.watch(()=>n.activeRow,(y,h)=>{y===null&&typeof h=="number"&&setTimeout(()=>{if(!i.value)return;const g=i.value.querySelector(`tbody>tr:nth-child(${h+1})`)||i.value;g&&g.scrollIntoView({block:"center",behavior:"smooth"})},100)});function _(y){var g;const h={};return(g=I.arrayListRowHandlers)==null||g.forEach(b=>{try{Object.assign(h,b(y,n.rowOptionsHandler()))}catch{console.warn("Problem with arrayListRowHandler.")}}),h}return(y,h)=>(r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("table",{class:"widget-table",ref_key:"refTable",ref:i},[r.createElementVNode("thead",null,[r.createVNode(Pn,{config:f.value,onOrder:h[0]||(h[0]=g=>y.$emit("order",g))},{default:r.withCtx(g=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(y.$slots["head-cell"]||gt),r.mergeProps(g,{onSelect:c}),null,16))]),_:1},8,["config"])]),r.createElementVNode("tbody",null,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(y.array,(g,b)=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:b},[r.createVNode(rr,r.mergeProps({test:b,config:f.value,values:g,selected:y.selectedRows.includes(g),onSelect:m=>s(g,m),onActivate:m=>d(b),class:y.classCallback?y.classCallback(g):"",ref_for:!0},_(g)),null,16,["test","config","values","selected","onSelect","onActivate","class"]),l.value&&y.activeRow===b?(r.openBlock(),r.createBlock(kt,{key:0,component:l.value,"row-length":y.config.length,values:g,onClose:h[1]||(h[1]=m=>o("update:activeRow",null)),onSave:u,"is-new":!1},null,8,["component","row-length","values"])):r.createCommentVNode("",!0)],64))),128)),y.activeRow===r.unref(A).LIST_ACTIVE_NEW?(r.openBlock(),r.createBlock(kt,{key:0,component:l.value,"row-length":f.value.length,onClose:h[2]||(h[2]=g=>o("update:activeRow",null)),onSave:u,"is-new":!0},null,8,["component","row-length"])):r.createCommentVNode("",!0)])],512),r.renderSlot(y.$slots,"footer")]))}}),_e=x(r.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{class:"widget-spinner",style:r.normalizeStyle({"border-left":`1.1em solid ${t.color}`})},null,4))}}),[["__scopeId","data-v-0ef9ae88"]]),ar={class:"widget-button"},sr=x(r.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("button",ar,[t.wait?(r.openBlock(),r.createBlock(_e,{key:0,class:"widget-button-spinner"})):r.createCommentVNode("",!0),r.renderSlot(t.$slots,"default",{},void 0,!0)]))}}),[["__scopeId","data-v-450dc564"]]),lr={class:"widget-multi-button-wrap position_relative cursor_pointer"},cr={class:"widget-multi-button-body grid"},dr=["onClick"],fr={class:"widget-multi-button-side-wrap"},ur=x(r.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(e){r.useCssVars(l=>({"04895bf1":i.value}));const t=e,n=r.reactive({active:!1,wait:!1}),i=r.computed(()=>t.array.length+(t.label?1:0));function o(l){if(!(typeof l!="function"||n.wait))return n.wait=!0,Promise.resolve().then(l).finally(()=>{n.wait=!1})}function a(l=!n.active){n.active=l}return(l,c)=>(r.openBlock(),r.createElementBlock("div",lr,[r.createElementVNode("div",{class:r.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[r.createElementVNode("div",cr,[l.label?(r.openBlock(),r.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:c[0]||(c[0]=s=>a())},r.toDisplayString(l.label),1)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(l.array,(s,d)=>(r.openBlock(),r.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:d,onClick:u=>{o(s.callback),a(!1)}},r.toDisplayString(s.label),9,dr))),128))]),r.createElementVNode("div",fr,[r.createElementVNode("div",{class:r.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:c[1]||(c[1]=s=>a())},[n.wait?(r.openBlock(),r.createBlock(r.unref(_e),{key:0,class:"widget-multi-button-side-spinner"})):l.array.length>1?(r.openBlock(),r.createBlock(r.unref(pe),{key:1,class:"widget-multi-button-side-icon"},{default:r.withCtx(()=>[r.createTextVNode("angle-small-down")]),_:1})):r.createCommentVNode("",!0)],2)])],2)]))}}),[["__scopeId","data-v-d43a76ce"]]),pr={class:"widget-loader flex flex-align_center gap_10 padding_15"},mr={class:"text_md"},Le=r.defineComponent({__name:"widget-loader",props:{label:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",pr,[r.createVNode(_e,{color:"var(--primary)",class:"padding_10"}),r.createElementVNode("span",mr,r.toDisplayString(t.label),1)]))}}),gr=["alt","src"],hr=r.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(e){const t=e,n=r.ref();return r.onMounted(()=>{n.value&&(n.value.src=t.src),n.value.onerror=function(){t.default&&(n.value.src=t.default)}}),(i,o)=>(r.openBlock(),r.createElementBlock("img",{alt:i.alt,ref_key:"refImage",ref:n,src:i.src||i.$props.default},null,8,gr))}}),yr=x({props:{config:Array,values:Object,selected:Boolean},setup:Ge},[["__scopeId","data-v-344a8cc1"]]),wr=e=>(r.pushScopeId("data-v-bf495d6a"),e=e(),r.popScopeId(),e),br={class:"widget-list-head-cell"},Er=wr(()=>r.createElementVNode("div",{class:"head-cell-resize"},null,-1)),_r=x(r.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(e,{emit:t}){const n=e,i=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(o,a)=>(r.openBlock(),r.createElementBlock("th",null,[r.createElementVNode("div",br,[r.createElementVNode("div",{class:"head-cell-content flex_grow",style:r.normalizeStyle({"min-width":o.minWidth,"max-width":o.maxWidth,width:o.width})},[o.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(S.FormField),{key:0,type:"single-checkbox",onClick:a[0]||(a[0]=r.withModifiers(l=>i("select"),["stop","prevent"]))})):(r.openBlock(),r.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:a[1]||(a[1]=l=>i("order"))},r.toDisplayString(o.title||o.label),1))],4),o.name&&o.order.length&&o.order[0]===o.name?(r.openBlock(),r.createBlock(r.unref(pe),{key:0,class:r.normalizeClass(["head-cell-order",{"head-cell-order_down":o.order.length>1&&o.order[1]==="desc"}])},{default:r.withCtx(()=>[r.createTextVNode("core-arrow-up")]),_:1},8,["class"])):r.createCommentVNode("",!0),Er])]))}}),[["__scopeId","data-v-bf495d6a"]]),kr=x(r.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(e,{emit:t}){const n=e,i=t,o=r.ref(),a=r.ref();r.onMounted(()=>{function d(h,g){let b=-1;do b++,g-=h[b];while(g>0&&b<h.length);return b}function u(h,g){let b=0;for(;g>0&&g>h[b]&&b<h.length;)g-=h[b],b++;return console.log(g,b),b>0?b:0}function f(h){try{a.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function _(h){try{a.value.style.width=h+"px",a.value.style.minWidth=h+"px",a.value.style.maxWidth=h+"px"}catch(g){console.log(g)}}function y(h){return h===null?!1:h.classList.contains("head-cell-resize")}o.value.addEventListener("pointerdown",function(g){var L;function b(R){return R.screenX+w-F}const m=o.value,E=[...m.children].filter(R=>R.localName==="th"),w=((L=m.offsetParent)==null?void 0:L.scrollLeft)||0,C=E.map(R=>R.clientWidth),N=y(g.target),F=m.getBoundingClientRect().left,k=b(g),T=d(C,k),v=C.slice(0,T).reduce((R,V)=>R+V,0),P=k-v,M=m.offsetWidth,ne=E[T].clientWidth;if(n.config[T].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",g.screenX),console.log("Widths",C),console.log("max width",M),console.log("Start Position",k),console.log("Position From",T),console.log("Start Position",T),console.log("Global offset (Отступ самой таблицы от края экрана)",F),console.log("Del",P),console.groupEnd(),a.value.innerText=E[T].textContent||"",a.value.style.display="grid",a.value.style.width=ne+"px",a.value.style.cursor="grabbing",f(v),_(ne),document.addEventListener("pointermove",Ae,{passive:!0}),document.addEventListener("pointerup",Ue);function Ue(R){if(console.group("END"),document.removeEventListener("pointermove",Ae),document.removeEventListener("pointerup",Ue),N&&(n.config[T].width=a.value.style.width,n.config[T].minWidth=a.value.style.width,n.config[T].maxWidth=a.value.style.width,l(n.config)),!N){const V=R.screenX+w-F;console.log("ENP Position",V);const K=u(C,V);if(console.log(T,"->",K),K!==T){const G=n.config[T],W=n.config;W.splice(T,1),W.splice(K,0,G),l(W)}else{const G=n.config[T].name;c(G)}}a.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Ae(R){if(N){const G=b(R)-k+ne;_(G);return}let V=R.screenX+w-F-P;V<0&&(V=0),V+ne>M&&(V=M-ne),f(V)}})});function l(d){i("update:config",d)}function c(d){if(!d)return;if(Array.isArray(d)){if(d.length<1)return;d=d[0]}if(n.order.length===0||n.order[0]!==d)return void s([d]);const u=n.order.length===1||n.order[1]==="asc"?"asc":"desc";s([d,u==="asc"?"desc":"asc"])}function s(d){i("update:order",d)}return(d,u)=>(r.openBlock(),r.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:o},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(d.config,(f,_)=>(r.openBlock(),r.createBlock(_r,r.mergeProps({key:f,ref_for:!0},f,{onOrder:y=>c(f.name),onSelect:u[0]||(u[0]=y=>i("select")),order:d.order}),null,16,["onOrder","order"]))),128)),r.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:a},"test",512)],512))}}),[["__scopeId","data-v-ccffc6bd"]]),Cr={class:"widget-list"},Tr={class:"widget-list-body position_relative"},Sr=50,Ar=r.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(e,{emit:t}){const n=e,i=t;function o(s,d=!0){if(n.selectedRows)if(!d)l(n.selectedRows.includes(s)?[]:[s]);else{const u=[...n.selectedRows],f=u.indexOf(s);f===-1?u.push(s):u==null||u.splice(f,1),l(u)}}function a(){var s;if(((s=n.selectedRows)==null?void 0:s.length)!==n.array.length)return l([...n.array]);l([])}function l(s){i("update:selectedRows",s)}function c(s){if(!s)return;const d=s.target;d.scrollTop+d.clientHeight+Sr>d.scrollHeight&&i("scrollEnd")}return(s,d)=>(r.openBlock(),r.createElementBlock("div",{class:"es-list-container",onScrollPassive:c},[r.createElementVNode("table",Cr,[r.createElementVNode("thead",null,[r.createVNode(kr,{onSelect:d[0]||(d[0]=u=>a()),"onUpdate:order":d[1]||(d[1]=u=>i("update:order",u)),"onUpdate:config":d[2]||(d[2]=u=>i("update:config",u)),config:s.config,order:s.order},null,8,["config","order"])]),r.createElementVNode("tbody",Tr,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.array,(u,f)=>{var _;return r.openBlock(),r.createBlock(yr,{key:f,class:"widget-list-row",values:u,config:s.config,selected:(_=s.selectedRows)==null?void 0:_.includes(u),onSelect:y=>o(u,y)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function Ke(){var a;const e=r.computed(()=>Object.keys(n).length===0||Object.values(n).includes(!0)),t=(a=r.getCurrentInstance())==null?void 0:a.uid;if(!t)throw"Undefined instance. Please check it.";const n=r.reactive({});r.provide(A.VISIBLE_ITEM_PROVIDE_NAME,{show(l){n[l]=!0},hide(l){n[l]=!1},remove(l){delete n[l]}});const i=r.inject(A.VISIBLE_ITEM_PROVIDE_NAME,{show(){},hide(){},remove(){}});return{visible:e,controller:{show(){i==null||i.show(t)},hide(){i==null||i.hide(t)},remove(){i==null||i.remove(t)}},visibleItems:n}}function Tt(e){const t={name:e,entity:r.inject(A.PROVIDE_ENTITY_NAME)};if(!t.name)throw new Error("Field without name try use metadata.");const n=r.ref(!1),i=r.ref(null);return e.split(".").reduce((o,a,l,c)=>l===c.length-1?o:o.then(()=>{var d,u;const s=(u=(d=i.value)==null?void 0:d.fieldsByName[a])==null?void 0:u.referencedEntity;if(!s)throw new Error("---");return te.initEntity(s).then(()=>s)}).then(s=>{i.value=te.get(s),t.entity=s,t.name=c[l+1]}),Promise.resolve().then(()=>te.initEntity(t.entity)).then(()=>{i.value=te.get(t.entity)})).finally(()=>n.value=!0),r.computed(()=>{if(!n.value||!i.value)return;const o=i.value.fieldsByName[t.name];if(o)return o})}const Nr=r.defineComponent({__name:"widget-field",props:{name:{},type:{},label:{},usageContext:{type:Boolean,default:!0}},setup(e){const t=e,n=S.Form.getParentForm();Ce();const i=ct(),o=r.computed(()=>{var h,g,b;const f=c.value,_=s(f),y={type:_,disabled:t.usageContext?!((h=l.value)!=null&&h.canSet):!1,label:t.label};return _==="Decimal"&&((b=(g=f==null?void 0:f.presentationType)==null?void 0:g.toLowerCase)==null?void 0:b.call(g))==="money"&&(y.money=!0),f&&Object.assign(y,{suffix:f.valueUnit||void 0,label:t.label||f.displayName}),Array.isArray(I.arrayFieldParamsHandlers)&&I.arrayFieldParamsHandlers.forEach(m=>Object.assign(y,m(f,l.value,y,n,t.name))),y}),a=["MultiText","MultiWideText"],l=r.computed(()=>{var f;return(f=i==null?void 0:i.value)==null?void 0:f.fields[t.name]}),c=Tt(t.name);function s(f){if(typeof t.type=="string"&&t.type.length!==0)return t.type;if(f){if(f.type==="Reference"||f.type==="Owned")return f.referencedEntity;if(f.dataType==="Boolean")return"single-checkbox";if(f.dataType==="DateTime")return"date";if(f.dataType==="Integer"||f.dataType==="Decimal")return"number";if(f.dataType==="List")return f.aggregatedEntity;if(a.includes(f.presentationType))return"textarea";if(f.presentationType==="PhoneNumber")return"tel"}return"text"}const d=r.computed(()=>{var f;return t.usageContext?((f=l.value)==null?void 0:f.canGet)===!0:!0}),{controller:u}=Ke();return r.watch(()=>d.value,f=>f?u.show():u.hide(),{immediate:!0}),r.onUnmounted(()=>u.remove()),(f,_)=>d.value?(r.openBlock(),r.createBlock(r.unref(S.FormField),r.mergeProps({key:0},{...f.$attrs,...o.value},{name:f.name}),null,16,["name"])):r.createCommentVNode("",!0)}});function Ir(e){return Array.isArray(e)&&(e==null?void 0:e[1])||A.DEFAULT_ORDER_DIR}const Rr=["fill"],Lr=[r.createElementVNode("path",{d:"M440-647 244-451q-12 12-28 11.5T188-452q-11-12-11.5-28t11.5-28l264-264q6-6 13-8.5t15-2.5q8 0 15 2.5t13 8.5l264 264q11 11 11 27.5T772-452q-12 12-28.5 12T715-452L520-647v447q0 17-11.5 28.5T480-160q-17 0-28.5-11.5T440-200v-447Z"},null,-1)],Or=r.defineComponent({__name:"widget-icon-arrow-up",props:{color:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:t.color},Lr,8,Rr))}}),vr={class:"widget-fast-table-head-cell-td"},$r={key:1,class:"widget-head-cell-label"},Br={key:2,class:"widget-head-cell-order"},St=x(r.defineComponent({__name:"widget-fast-table-head-cell",props:{label:{},name:{},order:{},type:{},isFullSelected:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=e,i=r.computed(()=>He(n.name));r.computed(()=>Ir(n.order));const o=t;function a(){o("select")}return(l,c)=>{var s;return r.openBlock(),r.createElementBlock("td",vr,[r.createElementVNode("div",{class:r.normalizeClass(["widget-head-cell",[l.type==="multi-select"?"justify-content-center":""]]),onClick:c[0]||(c[0]=d=>l.$emit("order",l.name))},[l.type==="multi-select"?(r.openBlock(),r.createBlock(r.unref(S.FormField),{key:0,"model-value":l.isFullSelected,onClick:a,type:"single-checkbox"},null,8,["model-value"])):(r.openBlock(),r.createElementBlock("span",$r,r.toDisplayString(l.label),1)),i.value===((s=l.order)==null?void 0:s[0])?(r.openBlock(),r.createElementBlock("div",Br,[r.createVNode(Or,{color:"var(--color-primary)",class:r.normalizeClass(["widget-head-cell-order-icon",`widget-head-cell-order-icon_${l.order[1]==="desc"?"desc":"asc"}`])},null,8,["class"])])):r.createCommentVNode("",!0)],2)])}}}),[["__scopeId","data-v-d131e64e"]]),Fr=["fill"],Dr=[r.createElementVNode("path",{d:"M480-361q-8 0-15-2.5t-13-8.5L268-556q-11-11-11-28t11-28q11-11 28-11t28 11l156 156 156-156q11-11 28-11t28 11q11 11 11 28t-11 28L508-372q-6 6-13 8.5t-15 2.5Z"},null,-1)],Pr=r.defineComponent({__name:"widget-icon-keyboard-arrow-down",props:{color:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:t.color},Dr,8,Fr))}}),Vr={class:"widget-filter-item-popup"},At=x(r.defineComponent({__name:"widget-table-panel-filter-item",props:{entity:{},values:{},filters:{},filterItem:{}},emits:["update:values","clear"],setup(e,{emit:t}){const n=e,i=t,o=I.tableFilterEntityBind,a=r.ref(),l=r.computed(()=>{const y=n.filterItem;return y.entity?"Entity":y.type?y.type:null});function c(y){s.value=y==="start"}const s=r.ref(!1),d=r.computed(()=>Array.isArray(n.values)||typeof n.values=="string"?n.values.length>0:!!n.values),u=r.ref(!1);let f=null;function _(y=!u.value){u.value=y,!u.value&&f?(f(),f=null):a.value&&(f=S.utils.clickOutside(a.value,_.bind(null,!1)))}return(y,h)=>{var g;return r.openBlock(),r.createElementBlock("div",{class:"widget-filter-item-container grid",ref_key:"refFilterItem",ref:a},[r.createElementVNode("div",{class:r.normalizeClass(["widget-filter-item",{"widget-filter-item_active":d.value}]),onClick:h[0]||(h[0]=()=>_())},[r.createElementVNode("span",{class:r.normalizeClass(["widget-filter-item-label",{"widget-filter-item-label_active":d.value}])},r.toDisplayString(y.filterItem.label||"--"),3),s.value?(r.openBlock(),r.createBlock(_e,{key:0})):(r.openBlock(),r.createBlock(Pr,{key:1,color:"white",class:r.normalizeClass({"widget-filter-item-arrow":u.value})},null,8,["class"]))],2),r.withDirectives(r.createElementVNode("div",Vr,[l.value?(r.openBlock(),r.createBlock(r.resolveDynamicComponent((g=r.unref(o))==null?void 0:g[l.value]),{key:0,"filter-metadata":y.filterItem,values:y.values,filters:y.filters,"base-entity":y.entity,onClear:h[1]||(h[1]=b=>i("clear")),"onUpdate:values":h[2]||(h[2]=b=>i("update:values",b)),onReadProcess:c},null,40,["filter-metadata","values","filters","base-entity"])):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])],512)}}}),[["__scopeId","data-v-43ed0322"]]),Mr={class:"widget-table-search flex"},xr=["value"],Ur=x(r.defineComponent({__name:"widget-table-search",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;function i(o){const a=o.target;if(!a)return;const l=a.value;n("update:modelValue",l)}return(o,a)=>(r.openBlock(),r.createElementBlock("div",Mr,[r.createVNode(pe,{class:"widget-table-search-icon"},{default:r.withCtx(()=>[r.createTextVNode("search")]),_:1}),r.createElementVNode("input",{class:"widget-table-search-input",type:"text",alt:"Searching for data in a table",value:o.modelValue,onInput:i,placeholder:"Filter by random text"},null,40,xr)]))}}),[["__scopeId","data-v-99052614"]]),Wr={class:"widget-table-panel-filter flex"},jr={class:"flex"},Hr=x(r.defineComponent({__name:"widget-table-panel-filters",props:{filtersConfig:{},filters:{},entity:{},search:{}},emits:["update:filters","update:search"],setup(e,{emit:t}){const n=e,i=t;function o(l,c){i("update:filters",{...n.filters,[l]:c})}function a(l){const c={...n.filters};delete c[l],i("update:filters",c)}return(l,c)=>(r.openBlock(),r.createElementBlock("div",Wr,[r.createVNode(Ur,{"model-value":l.search,"onUpdate:modelValue":c[0]||(c[0]=s=>i("update:search",s))},null,8,["model-value"]),r.createElementVNode("div",jr,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(l.filtersConfig,(s,d)=>{var u;return r.openBlock(),r.createBlock(At,{key:d,entity:l.entity,"filter-item":s,values:(u=l.filters)==null?void 0:u[r.unref(ie)(s)],filters:l.filters,"onUpdate:values":f=>o(r.unref(ie)(s),f),onClear:f=>a(r.unref(ie)(s))},null,8,["entity","filter-item","values","filters","onUpdate:values","onClear"])}),128))])]))}}),[["__scopeId","data-v-8f09ec8d"]]);function Nt(e,t){const n=document.createElement("a");n.href=e,t!=null&&t.blank&&(n.target="_blank"),n.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),setTimeout(()=>{n.remove()},100)}const qr={class:"widget-fast-table-tools flex gap-15"},Gr=r.defineComponent({__name:"widget-fast-table-tools",props:{tools:{},loading:{type:Boolean},selectedRows:{},metadata:{},canCreate:{type:Boolean}},emits:["reload","export","new"],setup(e,{emit:t}){const n=e,i=J.useRouter(),o=t,a=[{name:"export",label:"Save as CSV",icon:"list-download",buttonStyle:"default",callback:()=>o("export")},{name:"reload",label:"Reload",icon:"reload",buttonStyle:"default",callback:()=>o("reload")},{name:"new",label:"Add New",icon:"new",buttonStyle:"primary",callback:()=>o("new")}],l=r.inject(A.PROVIDE_NAME_ACTIONS,null),c=r.computed(()=>(Array.isArray(n.tools)?n.tools:[]).reduce((h,g)=>(g.name==="*"?h.push(...a):h.push(g),h),[]));function s(h){return a.find(g=>g.name===h.name)}function d(h){return{...h,label:h.label||"Batch update",callback:async()=>{const g=n.metadata,b=g.name,m=n.selectedRows||[];if(n.selectedRows.length===0)return Me.add("error","Kindly select at least one record to update");const E=await H.promptModal(A.MODAL_BATCH_VALUES,{entity:b,availableFields:h.availableFields||[]});if(!E)return;const w=st(b),C=m.map(N=>({primaryKey:N[w],version:g.versioned?N.Version:void 0}));await Ut(b,{values:E,elements:C}).then(N=>{N.forEach(F=>{F.type==="reject"&&U("error")(F.data)})}).catch(U("error")),o("reload")}}}function u(h){return{...h,callback:()=>i.push(h.to)}}function f(h){return{...h,callback:()=>{const g=jt(h.filename);Nt(g,{blank:!0})}}}const _=r.computed(()=>{var b;const h=((b=l==null?void 0:l.actions)==null?void 0:b.value)||[],g=[];return c.value.forEach(m=>{if(!(typeof m.override=="string"&&!h.find(E=>E.name===m.override))){if(s(m)){if(m.name==="new"&&!n.canCreate)return;const E=a.find(w=>w.name===m.name);if(E)return g.push(E)}if(m.name==="redirect")return g.push(u(m));if(m.name==="batch-update")return g.push(d(m));if(m.name==="static-file")return g.push(f(m));{const E=h.find(w=>w.name===m.name);if(E)return g.push({label:E.title,...m,callback:()=>y(E)})}}}),g.map(m=>({...m,process:oe(m.callback)}))});function y(h){var m;const g=(m=h.action.parameters.find(E=>E.dataTypeName==="IntegerArray"))==null?void 0:m.name,b={};return g&&(b[g]=n.selectedRows.map(E=>{if(!(typeof E=="object"&&E!==null))return null;const w=n.metadata.fieldNameForIdentification;return w?E[w]:null})),h.callback(b)}return(h,g)=>{const b=r.resolveComponent("widget-button");return r.openBlock(),r.createElementBlock("div",qr,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,m=>(r.openBlock(),r.createBlock(b,{label:r.unref(Y)(m.label),title:m.name,icon:m.icon,type:m.buttonStyle,loading:m.name==="reload"?h.loading:m.process.loading,onClick:()=>m.process.call()},null,8,["label","title","icon","type","loading","onClick"]))),256)),r.renderSlot(h.$slots,"default")])}}});function zr(e,t){const n=wt(),i=J.useRouter(),o=r.reactive({entity:null,mark:null,settings:null});function a(w){const C={...u.value,...w};l(C)}function l(w){{const C=w.prefilters;C&&(Object.keys(C).forEach(N=>{var k,T;const F=C[N];Array.isArray(C[N])&&C[N].length===0&&o.settings&&!((T=(k=o.settings)==null?void 0:k.prefilters)!=null&&T[N])&&delete C[N],kn(F)&&(typeof F.min!="number"&&delete F.min,typeof F.max!="number"&&delete F.max,Object.keys(F).length===0&&delete C[N])}),S.utils.isEmptyObject(C)&&delete w.prefilters)}localStorage.setItem(d(o.entity,o.mark),JSON.stringify(w)),t&&t()}function c(){return o.entity?JSON.parse(localStorage[d(o.entity,o.mark)]||"{}"):null}function s(w,C){o.entity=w,o.mark=C,_.call()}function d(w,C){return"list-configuration:"+w+(C?"-"+C:"")}const u=r.computed(()=>o.entity?JSON.parse(n[d(o.entity,o.mark)]||"{}"):null),f=r.computed(()=>o.settings?lt(o.entity,o.settings.config,{router:i,activate:e}):[]),_=oe(async function(){if(!o.entity)return;const C=await Pt(o.entity,o.mark);o.settings=Object.freeze(C),t&&t()}),y=r.computed(()=>{var N;const w=u.value.order||null,C=((N=o.settings)==null?void 0:N.order)||null;return w||C||[]}),h=r.computed(()=>{var N;const w=u.value.prefilters||{};return{...((N=o.settings)==null?void 0:N.prefilters)||{},...w}}),g=r.computed(()=>{var w;return((w=o.settings)==null?void 0:w.filters)||[]}),b=r.computed(()=>{var w;return((w=o.settings)==null?void 0:w.label)||null}),m=r.computed(()=>{var w;return((w=o.settings)==null?void 0:w.tools)||[]}),E=r.computed(()=>!S.utils.isEmptyObject(u.value));return{state:o,get customFilters(){return o.settings.customFilters||[]},set:s,get:c,configuration:u,update:a,computedPrefilter:h,computedFiltersConfiguration:g,get cellConfig(){return o.settings?lt(o.entity,o.settings.config,{router:i,activate:e}):[]},get prefilters(){var w;return((w=c())==null?void 0:w.prefilters)||o.settings.prefilters||{}},get order(){var w;return((w=c())==null?void 0:w.order)||o.settings.order||[]},clean(){localStorage.removeItem(d(o.entity,o.mark)),t&&t()},cellConfiguration:f,computedLabel:b,computedTools:m,computedHasLocalConfiguration:E,computedOrder:y,get displayModeForNew(){return o.settings.displayModeForNew||"inline"}}}class It{constructor(t){je(this,he);this.unloaded=!1,this.offset=0,this.array=r.reactive([]),we(this,he,null),this.process=oe(this.load.bind(this)),this.entity=t,this.limit=50}set options(t){we(this,he,t)}get requestReadOptions(){return Object.assign({},We(this,he)||null,{offset:this.offset,limit:this.limit})}async next(){this.unloaded||this.process.loading||await this.process.call()}reload(){return this.clear(),this.next()}clear(){this.array.splice(0,this.array.length),this.offset=0,this.unloaded=!1}get loading(){return this.process.loading}init(t){this.options=t,this.clear()}async load(){const t=await se(this.entity,this.requestReadOptions);this.addData(t),t.length!==this.limit&&(this.unloaded=!0)}addData(t){this.array.push(...t.map(n=>Object.freeze(n))),this.offset+=t.length}}he=new WeakMap;function Kr(e,t){const n=setInterval(()=>{Yr(t)&&e.next()},2e3);r.onUnmounted(()=>{clearInterval(n)})}function Yr(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}const Xr=["count","test"],Jr={class:"widget-fast-table-head"},Qr={key:0,class:"title-md color-primary margin-0 widget-fast-table-label"},Zr={class:"widget-fast-table-body"},ei=x(r.defineComponent({__name:"widget-fast-table",props:{entity:{},mark:{},masterEntities:{},binding:{},actions:{},hideLabel:{type:Boolean},hideActions:{type:Boolean},disableUsageContext:{type:Boolean}},setup(e,{expose:t}){const n=e,i=J.useRouter(),o=r.ref(null),a=r.computed(()=>o.value?d.value.indexOf(o.value[2]):null);function l(L,R,V){o.value=[L,R,V]}const c=new It(n.entity),s=r.ref(""),d=r.computed(()=>Array.isArray(T.value)?s.value.length===0?c.array:c.array.filter(L=>!!T.value.find(V=>{const K=be(V,L);return typeof K=="string"?K.includes(s.value):!1})):[]),u=r.ref(null),f=S.Form.getParentForm(),_=r.ref([]),y=Ce(n.entity),{state:h,update:g}=ct(n.entity,{masterEntities:n.masterEntities||[]}),b=oe(async()=>{try{_.value=[],await c.reload(),n.disableUsageContext||await g()}catch(L){const{message:R}=Je(L);u.value=R}});f instanceof S.Form&&f.subscribe({read:b.call.bind(null),name:n.entity,type:"table"}),r.watch(()=>n.mark,()=>{k.set(n.entity,n.mark)});function m(){return O.and(O(k.prefilters),O(n.binding||{}))}const{controller:E}=Ke();r.watch(()=>h.value,L=>{L&&(L.canRead?E.show():E.hide())},{immediate:!0});let w=[Te.on("affected-entity",L=>{L.name===n.entity&&b.call()}),Te.on("display-entity",async L=>{L.name===n.entity&&(c.loading&&await c.process.promise,l(L.name,L.primaryKey,d.value.find(R=>R[y.value.fieldNameForIdentification]===L.primaryKey)))})];r.onUnmounted(()=>{w.map(L=>L()),E.remove()});function C(L){function R(G){return Array.isArray(G)?R(G[0]):typeof G!="string"?null:G}const V=R(L);if(!V)return;const K=k.order;N("order",K[0]!==V?[V,"asc"]:K[1]==="desc"?[]:[V,"desc"])}function N(L,R){k.update({[L]:R})}const F=r.computed(()=>b.wait),k=zr(l,()=>{c.init({customFilters:k.customFilters,fields:Ze(T.value).join(" "),order:k.order,filter:m(),useContextFilter:k.state.settings.useContextFilter}),c.next()}),T=k.cellConfiguration;k.set(n.entity,n.mark),r.watch(()=>k.state.settings,()=>setTimeout(b.call,50));const v=r.computed(()=>k.state.settings);t({listSettings:v,array:d,config:T,listDataController:c,selectedRows:_});function P(){H.openModal(A.MODAL_LIST_DOWNLOAD,{entity:n.entity,cellConfig:k.cellConfig,order:k.order,prefilters:m(),customFilters:k.customFilters})}function M(){switch(k.displayModeForNew){case"modal":return H.openModal(A.MODAL_ENTITY,{entity:n.entity});case"form":return i.push(at(n.entity));case"inline":return o.value=[n.entity]}}function ne(){k.clean()}function Ue(){return{entity:n.entity}}const Ae=r.ref();return r.onMounted(()=>{Kr(c,Ae.value)}),(L,R)=>{var G;const V=r.resolveComponent("widget-button"),K=r.resolveComponent("widget-fast-table-form");return r.openBlock(),r.createElementBlock("div",{class:"widget-fast-table",count:_.value.length,test:o.value},[r.createElementVNode("div",Jr,[r.unref(k).computedLabel.value&&!L.hideLabel?(r.openBlock(),r.createElementBlock("p",Qr,r.toDisplayString(r.unref(Y)(r.unref(k).computedLabel.value)),1)):r.createCommentVNode("",!0),r.unref(y)&&!L.hideActions?(r.openBlock(),r.createBlock(Gr,{key:1,metadata:r.unref(y),tools:r.unref(k).computedTools.value,loading:F.value,"selected-rows":_.value||[],onReload:r.unref(b).call,onExport:P,onNew:M,"can-create":((G=r.unref(h))==null?void 0:G.canCreate)||!1},{default:r.withCtx(()=>[r.renderSlot(L.$slots,"tools",{},void 0,!0),r.unref(k).computedHasLocalConfiguration.value?(r.openBlock(),r.createBlock(V,{key:0,onClick:ne,type:"primary",label:"Clear all filters"})):r.createCommentVNode("",!0)]),_:3},8,["metadata","tools","loading","selected-rows","onReload","can-create"])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Zr,[r.createVNode(Hr,{search:s.value,"onUpdate:search":R[0]||(R[0]=W=>s.value=W),entity:L.entity,"filters-config":r.unref(k).computedFiltersConfiguration.value,filters:r.unref(k).computedPrefilter.value,"onUpdate:filters":R[1]||(R[1]=W=>N("prefilters",W))},null,8,["search","entity","filters-config","filters"]),r.createVNode(r.unref(Ct),{config:r.unref(T),array:d.value,"active-row":a.value,"onUpdate:activeRow":R[3]||(R[3]=W=>o.value=null),onOrder:C,class:"table main-table",selectedRows:_.value,"onUpdate:selectedRows":R[4]||(R[4]=W=>_.value=W),"row-options-handler":Ue},{"head-cell":r.withCtx(W=>{var Ne,Cn,Tn;return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(L.$slots["head-cell"]?L.$slots["head-cell"]:St),r.mergeProps({label:W.label},W,{onOrder:C,order:r.unref(k).computedOrder.value,type:W.type,"is-full-selected":((Ne=_.value)==null?void 0:Ne.length)===((Cn=d.value)==null?void 0:Cn.length)&&((Tn=d.value)==null?void 0:Tn.length)>0}),null,16,["label","order","type","is-full-selected"]))]}),footer:r.withCtx(()=>[r.createElementVNode("div",{style:{padding:"10px"},ref_key:"endOfTheScroll",ref:Ae},null,512)]),default:r.withCtx(()=>{var W,Ne;return[r.createVNode(K,{entity:(W=o.value)==null?void 0:W[0],"primary-key":((Ne=o.value)==null?void 0:Ne[1])||null,"master-entities":L.masterEntities||void 0,binding:L.binding,onFormUpdate:R[2]||(R[2]=()=>{o.value=null,r.unref(c).reload()})},null,8,["entity","primary-key","master-entities","binding"])]}),_:1},8,["config","array","active-row","selectedRows"])])],8,Xr)}}}),[["__scopeId","data-v-2fae7c36"]]);function Rt(e,t={},n={}){const i=r.inject(A.PROVIDE_NAME_ACTIONS,null),o=typeof e=="string"?e:t,a=typeof t=="string"?n:t;return r.computed(()=>{var s;const c=((typeof e=="string"?(s=i==null?void 0:i.actions)==null?void 0:s.value:r.unref(e))||[]).find(d=>d.name===o);return c?{...c,...a}:null})}const ti=r.defineComponent({__name:"widget-action",props:{name:{},overrideParams:{}},setup(e){const t=e,n=Rt(t.name,t.overrideParams||{}),i=r.computed(()=>{if(n.value)return oe(n.value.callback)});return(o,a)=>{var c;const l=r.resolveComponent("widget-button");return r.unref(n)?(r.openBlock(),r.createBlock(l,{key:0,label:r.unref(n).label,loading:((c=i.value)==null?void 0:c.loading)||!1,onClick:a[0]||(a[0]=()=>{var s,d;return(d=(s=i.value)==null?void 0:s.call)==null?void 0:d.call(s,o.overrideParams||{})})},null,8,["label","loading"])):r.createCommentVNode("",!0)}}}),ni=r.defineComponent({__name:"WidgetResolverEntity",setup(e){const t=J.useRouter(),n=J.useRoute();function i(){const o=n.params.entity,a=n.params.primaryKey;tt(o,a).then(l=>t.replace(at(l,a))).catch(l=>{U("error")(l),t.back()})}return r.onMounted(i),(o,a)=>(r.openBlock(),r.createElementBlock("div",null,[r.createVNode(Le,{label:"Loading..."})]))}}),ri=r.defineComponent({__name:"modal-list-download",props:{entity:{},cellConfig:{},prefilters:{},order:{},customFilters:{}},setup(e){const t=e,n=r.computed(()=>i.finished?"Download CSV":`Download ${i.count} records.`),{state:i,downloadFile:o,reject:a,start:l}=mn({entity:t.entity,config:t.cellConfig,prefilters:t.prefilters,order:t.order,customFilters:t.customFilters});return H.onBeforeModalClose(a),r.onMounted(l),r.watch(()=>i.finished,()=>{o(),H.popModal()}),(c,s)=>{const d=r.resolveComponent("widget-button"),u=r.resolveComponent("widget-modal-wrap");return r.openBlock(),r.createBlock(u,null,{footer:r.withCtx(()=>[r.createVNode(d,{onClick:s[0]||(s[0]=f=>{r.unref(o)(),r.unref(H.popModal)()})},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(n.value),1)]),_:1})]),default:r.withCtx(()=>[r.createElementVNode("div",null,[r.createVNode(Le,{label:"Loading"})])]),_:1})}}}),Lt=e=>(r.pushScopeId("data-v-66cf2326"),e=e(),r.popScopeId(),e),ii={class:"version-item"},oi={class:"text_md"},ai={class:"version-item-date text_md"},si=Lt(()=>r.createElementVNode("span",null,null,-1)),li=Lt(()=>r.createElementVNode("span",null,null,-1)),ci={class:"text_sm"},di={class:"text_sm line-clamp_5"},fi={class:"text_sm line-clamp_5"},ui=x(r.defineComponent({__name:"version-item",props:{selectedFields:{},date:{},customerName:{},version:{},changes:{},entity:{}},setup(e){const t=e;function n(a,l){const c=a.name.toLowerCase(),s=l.name.toLowerCase();return s==="version"?-1:c==="version"?1:s.startsWith("utc")?-1:c.startsWith("utc")?1:0}const i=r.computed(()=>[...t.changes||[]].sort(n)),o=r.computed(()=>(i.value||[]).filter(a=>Array.isArray(t.selectedFields)&&t.selectedFields.length!==0?t.selectedFields.includes(a.name):!0));return(a,l)=>(r.openBlock(),r.createElementBlock("div",ii,[r.createElementVNode("span",oi,[r.createElementVNode("b",null,r.toDisplayString(a.version),1)]),r.createElementVNode("span",ai,[r.createElementVNode("b",null,r.toDisplayString(r.unref(Xe)(a.date)),1)]),si,r.createElementVNode("span",null,[r.createTextVNode("by "),r.createElementVNode("b",null,r.toDisplayString(a.customerName),1)]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.value,c=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:c.name},[li,r.createElementVNode("span",ci,r.toDisplayString(c.name),1),r.createElementVNode("span",di,r.toDisplayString(r.unref(et)(a.entity,c.name,c.newValue)),1),r.createElementVNode("span",fi,r.toDisplayString(r.unref(et)(a.entity,c.name,c.oldValue)),1)],64))),128))]))}}),[["__scopeId","data-v-66cf2326"]]),Ye=e=>(r.pushScopeId("data-v-cc723f37"),e=e(),r.popScopeId(),e),pi={key:1,class:"wrap-history"},mi={class:"history-header grid gap_10"},gi=Ye(()=>r.createElementVNode("span",null,null,-1)),hi=Ye(()=>r.createElementVNode("span",{class:"text_md"},"New Value",-1)),yi=Ye(()=>r.createElementVNode("span",{class:"text_md"},"Old Value",-1)),wi={class:"padding_15 grid gap_10 container-history"},bi=x(r.defineComponent({__name:"modal-version-history",props:{entity:{},primaryKey:{}},setup(e){const t=e,n=r.computed(()=>`${l.value.description} Version History`),i=r.ref(),o=r.computed(()=>!s.value||Array.isArray(s.value)&&s.value.length===0?i.value:(i.value||[]).filter(f=>{var _;return f.action==="Insert"?!0:(_=f.changes)==null?void 0:_.find(y=>s.value&&s.value.includes(y.name))})),a=oe(d),l=Ce(t.entity),c=r.computed(()=>l.value.fields.map(f=>({label:f.displayName,value:f.name}))),s=r.ref(null);async function d(){try{const f=await Wt({entity:t.entity,primaryKey:t.primaryKey});i.value=f.history}catch(f){U("error")(f)}}r.onMounted(()=>a.call());function u(f){return f.currentValues.map(_=>({name:_.fieldName,newValue:_.value})).filter(_=>_.newValue)}return(f,_)=>{const y=r.resolveComponent("widget-modal-wrap");return r.openBlock(),r.createBlock(y,{label:n.value,class:"wrap-modal-version-history"},{default:r.withCtx(()=>[r.unref(a).loading?(r.openBlock(),r.createBlock(r.unref(Le),{key:0,label:"Loading history..."})):(r.openBlock(),r.createElementBlock("div",pi,[r.createElementVNode("div",mi,[gi,r.createVNode(r.unref(S.FormField),{type:"select",options:c.value,modelValue:s.value,"onUpdate:modelValue":_[0]||(_[0]=h=>s.value=h),multiple:""},null,8,["options","modelValue"]),hi,yi]),r.createElementVNode("div",wi,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.value,(h,g)=>(r.openBlock(),r.createBlock(ui,{"selected-fields":s.value,date:h.utcCreated,"customer-name":h.userName,version:h.version,changes:h.action==="Insert"?u(h):h.changes,entity:f.entity,key:g},null,8,["selected-fields","date","customer-name","version","changes","entity"]))),128))])]))]),_:1},8,["label"])}}}),[["__scopeId","data-v-cc723f37"]]);function Ot(e,t,n){const i=window.URL.createObjectURL(e);Nt(i,n),setTimeout(()=>{window.URL.revokeObjectURL(i)},100)}function Ei(e,t){return fetch(`/close-api/document-builder/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({CatalogId:t})}).then(n=>n.blob()).then(n=>{Ot(n,e+t+"-print-form.pdf",{blank:!0})})}function Xe(e){return Oe(e,"YYYY/MM/DD HH:mm:ss")}function Oe(e,t="YYYY/MM/DD"){if(!e)return"";try{const n=new Date(e);return Nn.format(n,t)}catch(n){return console.log(n),"Invalid date"}}function oe(e){function t(o){i.status=o}function n(...o){if(i.loading)return Promise.reject("The process has already started.");i.loading=!0,i.wait=!0;const a=Promise.resolve().then(()=>t(1)).then(()=>e(...o)).then(l=>(t(3),l)).catch(l=>{throw t(2),l}).finally(()=>{i.wait=!1,i.loading=!1,i.promise=null});return i.promise=a,a}const i=r.reactive({status:0,wait:!1,loading:!1,call:n,promise:null});return i}var vt=(e=>(e[e.init=0]="init",e[e.loading=1]="loading",e[e.error=2]="error",e[e.done=3]="done",e))(vt||{});function Je(e){return typeof e=="string"?ve(e):_i(e)?ve(e.message,e.children||e.details||[],e.traceId):ki(e)?ve(e.title,[e.detail||""],e.traceId):ve(A.DEFAULT_ERROR_MESSAGE)}function _i(e){return!!(typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,"message"))}function ki(e){return!!(typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,"title"))}function ve(e,t=[],n){return{message:e,children:t,traceId:n}}function U(e="error"){return function(t){const{message:n,children:i,traceId:o}=Je(t);Me.add(e,n,{children:i,traceId:o})}}function se(e,t={}){const n=B();return $t(t)&&t.id&&(t.primaryKey=t.id,delete t.id),n.emit("entity:read",{entity:e,...t})}function $t(e){return!!(e.id||e.primaryKey)}function Qe(e,t){const n=B();return $t(t)&&t.id&&(t.primaryKey=t.id,delete t.id),n.emit("entity:update",{...t,entity:e})}function Ze(e){return e.reduce((t,n)=>(n.name&&(typeof n.name=="string"?t.push(n.name):t.push(...n.name)),t),[])}function Bt(e,t=2){if(!(typeof e=="string"||typeof e=="number"))return"";let i=String(e).split(".");return i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i.length<2&&(i[1]=""),i[1]=i[1].padEnd(t,"0"),i[1].length>t&&(i[1]=i[1].substring(0,t)),i.join(".")}function Ci(e,t){const n=new Map;return e.forEach(i=>{var a;const o=t(i);n.has(o)||n.set(o,[]),(a=n.get(o))==null||a.push(i)}),n}function Ti(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function Si(e){return e.text().then(t=>{try{return JSON.parse(t)}catch{return A.DEFAULT_ERROR_MESSAGE}})}function q(e,t={}){return X.isFront&&(t.headers||(t.headers={}),t.headers["Context-Id"]=X.contextId),t.redirect="manual",fetch(e,t).then(n=>n.type==="opaqueredirect"?void window.location.reload():n).catch(()=>{throw new Error(A.DEFAULT_ERROR_MESSAGE)}).then(n=>Si(n).then(i=>{if(!n.ok)throw i;return i}))}function Ft(e,t=1e3){let n=0;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>e(...i),t)}}function Ai(e,t){let n=!1;return(...i)=>{if(!n)return n=!0,setTimeout(()=>n=!1,t),e(...i)}}const Ni=Ie(Re("pretty-value-field-by-entity"));function et(e,t,n){try{const i=te.get(e);if(!i)throw new Error("For entity metadata is not loaded");const o=i.fieldsByName[t];if(!o)throw new Error(`For entity ${e} can't found fieldMetadata for field ${t}`);return o.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(i){return Ni('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',i,e,t,n),n}}const le=Ie(Re("use-socket"));function B(){return Ri}function Ii(e){return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Blob]"}const Ri=function(){let e=1,t,n;const i=new Set;let o=0;const a=new Set;function l(){if(t)o&&(clearTimeout(o),o=0);else return;o=setTimeout(()=>{t.close()},Un*2);const m=new Uint8Array(1);m[0]=xn,t.send(m)}setInterval(()=>{Array.from(i).forEach(m=>{b(m)&&(le("Handler for event %s requestId %d was expired",m.event,m.requestId),m.requestId?s({requestId:m.requestId,event:ht,data:{message:re.RequestTookToLong().message}}):i.delete(m))})},1e3),setInterval(()=>{(!t||t.readyState===3)&&d()},A.DELAY_SOCKET_RECONNECT);function c(){return{safeQueue:a,requestId:e,handlers:i,socketInstance:t}}function s(m){const E=[...i.values()];le("Handlers array length is %d. Response event: %s. Request id: %d",i.size,m.event,m.requestId),E.forEach(w=>{const C=m.requestId;(w.requestId&&w.requestId===C||!w.requestId&&w.event===m.event)&&(le("Find appropriated handler: %d, event: %s",e,w.event),w.callback(m.data,m),w.once&&(i.delete(w),le("Handler was removed by *once* params was passed. %o",w)))})}function d(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),t=new WebSocket(n),t.onclose=function(m){le("Connection to server was stopped: %d %s",m.code,m.reason),Array.from(i).forEach(E=>{E.guaranteedAnswer&&E.serializeString&&a.add(E.serializeString)})},t.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(m=>{u(m),a.delete(m)})},t.onerror=function(m){console.warn(m)},t.onmessage=m=>{var E;try{if(Ii(m.data)){l();return}const w=JSON.parse(m.data);if(!Dt(w)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(w);return}w.event==="progress"&&i.forEach(C=>{C.event===w.data.for.event&&C.requestId===w.data.for.requestId&&(console.log("UPDATE TIME"),C.timeToLive=new Date().getTime()-C.created+A.TIME_TO_LIVE_SOCKET_REQUEST)}),(E=w==null?void 0:w.data)!=null&&E.refresh&&location.reload(),s(w)}catch(w){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(w)}}}function u(m){t.send(m)}function f(m,E){g({event:m,callback:E})}function _(m,E){g({event:m,callback:E,once:!0})}function y(){return t&&(t==null?void 0:t.readyState)===1}function h(m,E,w){const C=++e,N=JSON.stringify({requestId:C,event:m,data:E,contextId:X.contextId,url:I.socketURLHandler?I.socketURLHandler():window.location.href});return y()?u(N):(a.add(N),le("Socket is not connected. Message was send to save-queue")),new Promise((F,k)=>{g({event:m,requestId:C,once:!0,guaranteedAnswer:!0,serializeString:N,callback:(T,v)=>{if(le("Promise was resolve with next data:",T),Li(v))return void k(T);w&&w(T,v),F(T)},timeToLive:A.TIME_TO_LIVE_SOCKET_REQUEST})})}function g(m){const E={timeToLive:0,...m,created:new Date().getTime()};i.add(E)}function b(m){return m.timeToLive===0||typeof m.timeToLive!="number"?!1:new Date().getTime()-m.created>m.timeToLive}return{get socket(){return t},on:f,once:_,emit:h,initialization(m){n=m},getDevInfo:c}}(),Li=e=>!!Dt(e)&&e.event===ht,Dt=e=>typeof e=="object"&&e!==null&&"event"in e&&typeof e.event=="string"&&"requestId"in e&&typeof e.requestId=="number"&&"data"in e;function Pt(e,t){return B().emit("list-setting:read",{entity:e,mark:t})}function Oi(e,t){return B().emit("metadata-field:treat",{entity:e,fieldName:t})}function Vt(e,t){return B().emit("entity:create",{...t,entity:e})}function Mt(e,t){return B().emit("entity:delete",{...t,entity:e})}function vi(e,t){return B().emit("usage-context:read",{...t,entity:e})}function xt(e={}){return B().emit("tool:read",e)}function $i(){return B().emit("metadata-list:read",{})}function Ut(e,t){return B().emit("batch:update",{...t,entity:e})}function tt(e,t){return B().emit("entity:resolve",{primaryKey:t,entity:e})}function Wt(e){return B().emit("history:read",e)}function Bi(e,t){return B().emit("entity:count",{...t,entity:e})}function jt(e){return`/${Wn}/${e}`}function me(e){return{exec(t,n){switch(e.name){case"replace-boolean":return me.replaceBoolean(t,e.values);case"replace-record-operation":return me.replaceRecordOperation(t)}}}}me.replaceBoolean=Fi,me.replaceRecordOperation=Di;function Fi(e,t){return typeof e!="boolean"?"":e?t[1]:t[0]}function Di(e){switch(e){case"A":case null:return"+";case"M":return"~";case"N":return"";case"D":return"✖";default:return"?"}}function Pi(e={}){return B().emit("tool:execute",e)}const Vi=Ie(Re("wrap-tool-response"));function Ht(e,t){return e.handleConfirmation===void 0&&(e.handleConfirmation=Ui),e.handleAffectedEntity===void 0&&(e.handleAffectedEntity=ji),e.handleCloseForm===void 0&&(e.handleCloseForm=Hi),e.handleValidationResult===void 0&&(e.handleValidationResult=Wi),{...t,label:t.title,async callback(n={}){var l;const i=typeof e.values=="function"?e.values(t,e):e.values;let o={};t.action.targetName==="Record"&&i.hasOwnProperty("Id")&&(o.Id=i.Id,delete i.Id);const a=()=>Pi({name:t.name,values:{...i,...n},primaryKeys:o,usageContext:t.usageContext}).then(async c=>{var s,d,u,f;if(!Mi(c))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(e.handlers))for await(const _ of e.handlers)await _(t,c,e);if(!c.success)throw e.handleValidationResult&&c.validationEffect&&((d=(s=c.validationEffect)==null?void 0:s.results)!=null&&d.length)&&e.handleValidationResult(t,c.validationEffect,e),new Error(c.message);return t.showValidationResults&&e.handleValidationResult&&c.validationEffect&&(f=(u=c.validationEffect)==null?void 0:u.results)!=null&&f.length&&e.handleValidationResult(t,c.validationEffect,e),c.message&&Me.add("info",c.message),Array.isArray(c.affectedEntities)&&e.handleAffectedEntity&&c.affectedEntities.forEach(_=>{var y;return(y=e.handleAffectedEntity)==null?void 0:y.call(e,t,_,e)}),t.closeHostForm&&e.handleCloseForm&&e.handleCloseForm(t,e),c}).catch(c=>{if(U("error")(c),e.handleReject)return e.handleReject(t,c,e)});if((l=e.overrides)!=null&&l[t.name])return e.overrides[t.name](t,e);if(t.paramDialog){const c=await qi(t,e);if(c===null)return;n=Object.assign(n,c||{})}return t.requireSave&&e.form&&e.form.changed?e.form.save().then(a):!t.confirmation||!e.handleConfirmation||t.paramDialog?a():e.handleConfirmation(t,a)}}}function Mi(e){return!!(e&&typeof e=="object"&&"affectedEntities"in e&&"success"in e)}function xi(e){const t="Are you sure?";return e===!0||typeof e=="string"&&e.toLowerCase()==="true"||e==="1"?t:typeof e=="string"?e:t}async function Ui(e,t){const n=xi(e.confirmation);if(!H.getComponentFromStore(A.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await H.promptModal(A.MODAL_CONFIRM,{message:n}))return t()}function Wi(e,t){const n=A.MODAL_VALIDATION_EFFECT;if(!H.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{H.pushModal(n,t)})}function ji(e,t,n){var s;function i(d){return d!==null&&typeof d=="object"&&typeof d.read=="function"}function o(d,u){d&&(Vi("Affected Entity %s. Find form with name %s.",u,d.name),d.name===u&&i(d)&&d.read(),d instanceof S.Form&&d.dependencies.forEach(f=>o(f,u)))}Te.emit("affected-entity",t);const{router:a,form:l}=n,c=typeof t.primaryKey=="string"?t.primaryKey:(s=t.primaryKey)==null?void 0:s.Id;if(a&&t&&t.name===e.redirectEntity){Te.emit("display-entity",{primaryKey:c,name:t.name}),I.getEntityLink&&a.push(I.getEntityLink(t.name,c));return}o(l,t.name)}function Hi(e,t){const{router:n}=t;n&&e.closeHostForm&&n.back()}function qi(e,t){var n;if((n=e.paramDialog)!=null&&n.name)return H.promptModal(e.paramDialog.name,{paramDialog:e.paramDialog,tool:e,options:t})}let ce={};function Y(e,...t){if(typeof e!="string")return console.trace(`Label is not provided for translation: ${e}`),"undefined";let n=S.utils.getPropFromObject((this==null?void 0:this.vocabulary)||ce,e);if(typeof n=="string")return qt(n,t);const i=S.utils.getPropFromObject(ce==null?void 0:ce.root,e);return typeof i=="string"?qt(i,t):(typeof n===void 0&&console.warn(`Translation for label "${e}" is not founded.`),e)}function qt(e,t){return t.forEach((n,i)=>{e=e.replaceAll(new RegExp(`\\{${i}}`,"g"),n)}),e}Y.setGlobalVocabulary=function(e){ce=e},Y.getScope=function(e){const t=typeof e=="string"?e:"root";return typeof e!="string"&&console.warn(`SCOPE ${e} for translate is not string.`),Y.bind({vocabulary:S.utils.getPropFromObject(ce,t.toLowerCase())})},Y.setVocabulary=function(e){return typeof e=="string"&&(e=S.utils.getPropFromObject(ce,e)),Y.bind({vocabulary:e})};function Gi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nt={exports:{}},D={},rt={exports:{}},de={};function Gt(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function zi(e,t,n){}function Ki(e,t,n){}var Yi=/javascript\s*\:/img;function Xi(e,t){return Yi.test(t)?"":t}de.whiteList=Gt(),de.getDefaultWhiteList=Gt,de.onAttr=zi,de.onIgnoreAttr=Ki,de.safeAttrValue=Xi;var Ji={indexOf:function(e,t){var n,i;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var i,o;if(Array.prototype.forEach)return e.forEach(t,n);for(i=0,o=e.length;i<o;i++)t.call(n,e[i],i,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}},ke=Ji;function Qi(e,t){e=ke.trimRight(e),e[e.length-1]!==";"&&(e+=";");var n=e.length,i=!1,o=0,a=0,l="";function c(){if(!i){var u=ke.trim(e.slice(o,a)),f=u.indexOf(":");if(f!==-1){var _=ke.trim(u.slice(0,f)),y=ke.trim(u.slice(f+1));if(_){var h=t(o,l.length,_,y,u);h&&(l+=h+"; ")}}}o=a+1}for(;a<n;a++){var s=e[a];if(s==="/"&&e[a+1]==="*"){var d=e.indexOf("*/",a+2);if(d===-1)break;a=d+1,o=a+1,i=!1}else s==="("?i=!0:s===")"?i=!1:s===";"?i||c():s===`
@@ -9,5 +9,5 @@
9
9
  * jenesius-event-emitter v1.0.2
10
10
  * (c) 2022 Jenesius
11
11
  * @license MIT
12
- */const gn=function(e,t){return e in this.events||(this.events[e]=[]),this.events[e].push(t),this.off.bind(this,e,t)},hn=function(e,t){e in this.events&&this.events[e].forEach(n=>n(t))},yn=function(e,t){const n=this.events[e];if(!n)return;const i=n.indexOf(t);i!==-1&&n.splice(i,1)},wn=function(){this.events={}};class ee{constructor(){this.events={}}on(t,n){return gn.call(this,t,n)}emit(t,n){return hn.call(this,t,n)}off(t,n){return yn.call(this,t,n)}cleanEvents(){wn.call(this)}static on(t,n){return gn.call(ee,t,n)}static emit(t,n){return hn.call(ee,t,n)}static off(t,n){return yn.call(ee,t,n)}static cleanEvents(){wn.call(ee)}}ee.events={};class Ta extends ee{constructor(t){super(),this.name="Communication",this.read=()=>{},this.id=t}sendMessage(t){return ia(this.id,t)}static checkAndGenerate(t,n,i){return ra(t,n,i).then(o=>o.length===0?na(t,n,i):o[0])}}function Sa(){return B().emit("client:read",{})}class ut extends Error{static ConstContextCannotBeChanged(){return new ut("The current context is set to constant. In order to change it, you need to put Manager into a changeable state.")}}const Z=class Z extends ee{constructor(){super(...arguments);je(this,Se);je(this,ye);this.isConstContext=!1,this.type="front",this.organizations=[],we(this,ye,!1)}set language(n){localStorage.setItem(A.LOCALSTORAGE_LANGUAGE_KEY,n)}get language(){return localStorage.getItem(A.LOCALSTORAGE_LANGUAGE_KEY)||Z.DEFAULT_LANGUAGE}get contextId(){return We(this,Se)}set contextId(n){if(this.isConstContext)throw ut.ConstContextCannotBeChanged();we(this,Se,n)}get contextType(){var n;if(this.contextId)return((n=this.person)==null?void 0:n.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(n){we(this,ye,n),this.emit(Z.EVENT_READY_UPDATE,n)}get ready(){return We(this,ye)}onReady(n){return this.on(Z.EVENT_READY_UPDATE,n)}onupdateContext(n){return this.on(Z.EVENT_CONTEXT_UPDATE,n)}setCurrentContext(n){if(this.contextId===n)return console.warn("[application-manager] The current context has already been installed.");this.contextId=n,localStorage.setItem(A.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(n)),this.emit(Z.EVENT_CONTEXT_UPDATE,n),console.log(`Current context id %c${n}`,"color: purple")}get context(){var n;return this.contextId?this.contextId===((n=this.person)==null?void 0:n.id)?this.person:this.organizations.find(i=>i.id===this.contextId)||null:null}async init(){try{const n=await this.loadCustomerData();this.customer=n,this.person=n,this.organizations=n.organizations,this.userId=n.userId,this.restoreCurrentContext(),this.ready=!0}catch(n){U()(n)}}restoreCurrentContext(){var i,o;if(typeof((i=this.customer)==null?void 0:i.constContextId)=="number"||((o=this.customer)==null?void 0:o.constContextId)===null)return this.setCurrentContext(this.customer.constContextId),this.isConstContext=!0;const n=Number.parseInt(localStorage.getItem(A.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(n)&&this.validateContextId(Number(n)))this.setCurrentContext(n);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Sa()}validateContextId(n){var i;try{return((i=this.person)==null?void 0:i.id)==n?!0:!!this.organizations.find(o=>o.id===n)}catch{return!1}}};Se=new WeakMap,ye=new WeakMap,Z.DEFAULT_LANGUAGE="en",Z.EVENT_CONTEXT_UPDATE="event:context-update",Z.EVENT_READY_UPDATE="event:ready-update";let pt=Z;function Aa(e){return B().emit("metadata:read",{entity:e})}const te=function(){const t=r.reactive({}),n=new Map;function i(c){return t[c]}async function o(c){if(n.has(c)&&await n.get(c),t[c])return i(c);const s=await a(c);return l(c,s),i(c)}function a(c){const s=Aa(c).finally(()=>{n.delete(c)});return n.set(c,s),s}function l(c,s){t[c]=s}return{state:t,initEntity:o,get:i,loadingFlags:n}}();class Na extends ee{on(t,n){return super.on(t,n)}emit(t,n){console.log("[event-bus] emit",t,n),super.emit(t,n)}off(t,n){super.off(t,n)}}class Q{static login(t){return q(I.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...t,AppName:I.applicationName})})}static parseProcessAnswer(t){if(t.statusCode>4)throw new Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startRegistrationProcess(t){return Q.requestStepRegistrationProcess("StartRegistration",t)}static confirmPhoneRegistrationProcess(t){return Q.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",t)}static confirmEmailRegistrationProcess(t){return Q.requestStepRegistrationProcess("ConfirmEmailByRegistration",t)}static finishEmailRegistrationProcess(t){return Q.requestStepRegistrationProcess("FinishRegistration",t)}static requestStepRegistrationProcess(t,n){return q(`${I.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(t){return Q.requestStepLoginProcess("StartLogin",t)}static loginWithPassword(t){return Q.requestStepLoginProcess("LoginWithPassword",t)}static loginWithOtpCode(t){return Q.requestStepLoginProcess("LoginWithOtpCode",t)}static requestStepLoginProcess(t,n){return q(`${I.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(Q.parseLoginProcessAnswer)}static parseLoginProcessAnswer(t){if(t.statusCode>3)throw Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startPasswordReset(t,n){return q(`${I.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:t})})}static confirmPhoneNumberByAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:i,Code:o})})}static confirmEmailByAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:i,Code:o})})}static finishAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Password:i,ConfirmedPassword:o})})}}class Ia{static readHistoryById(t,n){return q(`/close-api/audits/history/${t}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ra{static getConfiguration(){return q("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(t){return await q(`/open-api/data/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class La{static getDictionary(t){if(!t)throw new Error(`Can't get dictionary for ${t}.`);return q(`/open-api/internationalization/language/${t}`)}}class Oa{static async upload(t,n){const i=new FormData;return i.append("file",t),i.append("entityName",n),q("/close-api/files",{method:"POST",body:i}).then(o=>(o.filename=t.name,o))}static getFileLink(t){return`/close-api/files/${t}`}}var bn=(e=>(e.Add="A",e.Delete="D",e.Modify="M",e.None="N",e))(bn||{}),En=(e=>(e.Approved="A",e.AwaitingFeedback="AF",e.AssignedForExam="AFE",e.Cancelled="C",e.Closed="CLS",e.Completed="CT",e.Draft="D",e.NotSatisfied="NSF",e.OnClarification="OC",e.Processing="P",e.Rejected="R",e.ReadyForExam="RFE",e.Submitted="S",e.SecurityCheck="SCK",e.Satisfied="SF",e.Withdrawn="W",e))(En||{});function _n(e){return typeof e!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function va(e){return typeof e!="object"||e===null?!1:!!(e.hasOwnProperty("start")||e.hasOwnProperty("end"))}function O(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];if(Array.isArray(i))return t.push(O.in(n,i)),t;if(kn(i)&&(typeof i.min=="number"&&t.push(O.ge(n,i.min)),typeof i.max=="number"&&t.push(O.le(n,i.max))),$a(i)){if(i.text){const a=(l=>{switch(l){case"end":return O.endWith;case"begin":return O.beginWith;default:return O.includes}})(i.option);t.push(a(n,i.text))}return t}if(va(i)){let o=function(a){var l;return((l=a.match(/([^Z]*)/))==null?void 0:l[0])+"0000Z"};return i.start&&t.push(`@${n} ge ${o(i.start)}`),i.end&&t.push(`@${n} le ${o(i.end)}`),t}return typeof i=="number"||typeof i=="boolean"||typeof i=="string"?(t.push(O.eq(n,i)),t):(i===null&&t.push(O.is(n,i)),t)},[]).join(" and ")}function kn(e){return e!==null&&typeof e=="object"&&("min"in e||"max"in e)}function $a(e){return e!==null&&typeof e=="object"&&"text"in e&&"option"in e}function ge(e){return typeof e=="string"&&_n(e)?`{${e}}`:typeof e=="string"?`'${e}'`:`${e}`}O.includes=function(t,n){return`@${t} Contains ${ge(n)}`},O.beginWith=function(t,n){return`@${t} BeginWith ${ge(n)}`},O.endWith=function(t,n){return`@${t} EndWith ${ge(n)}`},O.notEq=function(t,n){return`@${t} nq ${ge(n)}`},O.eq=function(t,n){return Array.isArray(n)?O.in(t,n):`@${t} eq ${ge(n)}`},O.ge=function(t,n){return`@${t} ge ${n}`},O.le=function(t,n){return`@${t} le ${n}`},O.in=function(t,n){const i=n.map(ge).join(", ");return`@${t} in (${i})`},O.notIn=function(t,n){return!Array.isArray(n)||n.length===0?"":O.and(...n.map(i=>O.notEq(t,i)))},O.and=function(...t){return t.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(O.wrap).join(" and ")},O.wrap=function(t){return`(${t})`},O.is=function(t,n){return`@${t} is ${n}`},O.or=function(...t){return t.join(" or ")};function mt(e){return Object.keys(e).reduce((t,n)=>{let i=e[n];const o=n.charAt(0).toUpperCase()+n.slice(1);return typeof i=="object"&&!(i==null||Array.isArray(i))&&(i=mt(i)),t[o]=i,t},{})}var j=(e=>(e.Completed="Completed",e.FinalStep="FinalStep",e.NextStep="NextStep",e.FinalStepWithConfirmation="FinalStepWithConfirmation",e.NextStepWithConfirmation="NextStepWithConfirmation",e.ValidationError="ValidationError",e.Undefined="Undefined",e))(j||{});const X=new pt,Te=new Na;p.ApplicationStatus=En,p.AsyncProcessStatus=vt,p.Communication=Ta,p.CoreError=re,p.DisplayListRow=un,p.EventBus=Te,p.Filter=O,p.ListDataController=It,p.Manager=X,p.MetadataStore=te,p.ModalListDownload=ri,p.ModalVersionHistory=bi,p.NotificationSystem=Me,p.OBJECT_TYPE_NAME_FIELD=yt,p.RecordOperation=bn,p.WidgetAction=ti,p.WidgetButton=sr,p.WidgetFastTable=ei,p.WidgetFastTableHeadCell=St,p.WidgetField=Nr,p.WidgetIcon=pe,p.WidgetImage=hr,p.WidgetList=Ar,p.WidgetLoader=Le,p.WidgetMultiButton=ur,p.WidgetResolverEntity=ni,p.WidgetSpinner=_e,p.WidgetTable=Ct,p.WidgetTablePanelFilterItem=At,p.asyncProcess=oe,p.authService=Q,p.billingService=ue,p.catchUniversal=U,p.config=Zn,p.configuration=I,p.constants=A,p.convertDDToDMS=Wo,p.convertDMSToDD=Uo,p.convertListConfig=lt,p.coreUtils=Jo,p.debounce=Ft,p.documentsService=vn,p.downloadDocumentBuilderFile=Ei,p.fileService=Oa,p.formatter=me,p.getCellName=ie,p.getCellValue=be,p.getEntityLink=at,p.getEntityResolveLink=fn,p.getNamesFromListConfig=Ze,p.getPathForResolveRouter=jo,p.getPrimaryFieldNameForEntity=st,p.getUnitValue=qe,p.groupArrayByField=Ci,p.historyService=Ia,p.injectAction=Rt,p.internationalizationService=La,p.invitationService=On,p.isUUID=_n,p.openBlobFile=Ot,p.openService=Ra,p.parseError=Je,p.parseTextByMarkdown=xo,p.prettyDate=Oe,p.prettyDateWithTime=Xe,p.prettyMoney=Bt,p.prettyValueFieldByEntity=et,p.request=q,p.setupListRow=Ge,p.staticLink=jt,p.t=Y,p.throttle=Ai,p.universalBatchUpdate=Ut,p.universalEntityCount=Bi,p.universalEntityCreate=Vt,p.universalEntityDelete=Mt,p.universalEntityRead=se,p.universalEntityResolve=tt,p.universalEntityUpdate=Qe,p.universalHistoryRead=Wt,p.universalListSettingRead=Pt,p.universalMandatoryFieldsRead=Go,p.universalMetadataFieldTreat=Oi,p.universalMetadataListRead=$i,p.universalToolRead=xt,p.useActions=ca,p.useCommunication=aa,p.useEnter=da,p.useFormEntity=sa,p.useListActiveRow=Qo,p.useListDownload=mn,p.useListEntity=ea,p.useListSearch=ua,p.useListSelect=fa,p.useLocalStorage=wt,p.useManagerState=ta,p.useMetadata=Ce,p.useMetadataField=Tt,p.usePrintForm=_a,p.useSocket=B,p.useUsageContext=ct,p.useVisibleItem=Ke,p.useWizard=ya,p.uuidv4=Ti,p.valuesToUpperCase=mt,p.wrapToolResponse=Ht,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
12
+ */const gn=function(e,t){return e in this.events||(this.events[e]=[]),this.events[e].push(t),this.off.bind(this,e,t)},hn=function(e,t){e in this.events&&this.events[e].forEach(n=>n(t))},yn=function(e,t){const n=this.events[e];if(!n)return;const i=n.indexOf(t);i!==-1&&n.splice(i,1)},wn=function(){this.events={}};class ee{constructor(){this.events={}}on(t,n){return gn.call(this,t,n)}emit(t,n){return hn.call(this,t,n)}off(t,n){return yn.call(this,t,n)}cleanEvents(){wn.call(this)}static on(t,n){return gn.call(ee,t,n)}static emit(t,n){return hn.call(ee,t,n)}static off(t,n){return yn.call(ee,t,n)}static cleanEvents(){wn.call(ee)}}ee.events={};class Ta extends ee{constructor(t){super(),this.name="Communication",this.read=()=>{},this.id=t}sendMessage(t){return ia(this.id,t)}static checkAndGenerate(t,n,i){return ra(t,n,i).then(o=>o.length===0?na(t,n,i):o[0])}}function Sa(){return B().emit("client:read",{})}class ut extends Error{static ConstContextCannotBeChanged(){return new ut("The current context is set to constant. In order to change it, you need to put Manager into a changeable state.")}}const Z=class Z extends ee{constructor(){super(...arguments);je(this,Se);je(this,ye);this.isConstContext=!1,this.type="front",this.organizations=[],we(this,ye,!1)}set language(n){localStorage.setItem(A.LOCALSTORAGE_LANGUAGE_KEY,n)}get language(){return localStorage.getItem(A.LOCALSTORAGE_LANGUAGE_KEY)||Z.DEFAULT_LANGUAGE}get contextId(){return We(this,Se)}set contextId(n){if(this.isConstContext)throw ut.ConstContextCannotBeChanged();we(this,Se,n)}get contextType(){var n;if(this.contextId)return((n=this.person)==null?void 0:n.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(n){we(this,ye,n),this.emit(Z.EVENT_READY_UPDATE,n)}get ready(){return We(this,ye)}onReady(n){return this.on(Z.EVENT_READY_UPDATE,n)}onupdateContext(n){return this.on(Z.EVENT_CONTEXT_UPDATE,n)}setCurrentContext(n){if(this.contextId===n)return console.warn("[application-manager] The current context has already been installed.");this.contextId=n,localStorage.setItem(A.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(n)),this.emit(Z.EVENT_CONTEXT_UPDATE,n),console.log(`Current context id %c${n}`,"color: purple")}get context(){var n;return this.contextId?this.contextId===((n=this.person)==null?void 0:n.id)?this.person:this.organizations.find(i=>i.id===this.contextId)||null:null}async init(){try{const n=await this.loadCustomerData();this.customer=n,this.person=n,this.organizations=n.organizations,this.userId=n.userId,this.restoreCurrentContext(),this.ready=!0}catch(n){U()(n)}}restoreCurrentContext(){var i,o,a;if(typeof((i=this.customer)==null?void 0:i.constContextId)=="number"||((o=this.customer)==null?void 0:o.constContextId)===null)return this.setCurrentContext(this.customer.constContextId),this.isConstContext=!0;const n=Number.parseInt(localStorage.getItem(A.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"")||((a=this.customer)==null?void 0:a.selectedContextId);if(!Number.isNaN(n)&&n&&this.validateContextId(Number(n)))this.setCurrentContext(n);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Sa()}validateContextId(n){var i;try{return((i=this.person)==null?void 0:i.id)==n?!0:!!this.organizations.find(o=>o.id===n)}catch{return!1}}};Se=new WeakMap,ye=new WeakMap,Z.DEFAULT_LANGUAGE="en",Z.EVENT_CONTEXT_UPDATE="event:context-update",Z.EVENT_READY_UPDATE="event:ready-update";let pt=Z;function Aa(e){return B().emit("metadata:read",{entity:e})}const te=function(){const t=r.reactive({}),n=new Map;function i(c){return t[c]}async function o(c){if(n.has(c)&&await n.get(c),t[c])return i(c);const s=await a(c);return l(c,s),i(c)}function a(c){const s=Aa(c).finally(()=>{n.delete(c)});return n.set(c,s),s}function l(c,s){t[c]=s}return{state:t,initEntity:o,get:i,loadingFlags:n}}();class Na extends ee{on(t,n){return super.on(t,n)}emit(t,n){console.log("[event-bus] emit",t,n),super.emit(t,n)}off(t,n){super.off(t,n)}}class Q{static login(t){return q(I.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...t,AppName:I.applicationName})})}static parseProcessAnswer(t){if(t.statusCode>4)throw new Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startRegistrationProcess(t){return Q.requestStepRegistrationProcess("StartRegistration",t)}static confirmPhoneRegistrationProcess(t){return Q.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",t)}static confirmEmailRegistrationProcess(t){return Q.requestStepRegistrationProcess("ConfirmEmailByRegistration",t)}static finishEmailRegistrationProcess(t){return Q.requestStepRegistrationProcess("FinishRegistration",t)}static requestStepRegistrationProcess(t,n){return q(`${I.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(t){return Q.requestStepLoginProcess("StartLogin",t)}static loginWithPassword(t){return Q.requestStepLoginProcess("LoginWithPassword",t)}static loginWithOtpCode(t){return Q.requestStepLoginProcess("LoginWithOtpCode",t)}static requestStepLoginProcess(t,n){return q(`${I.identityServerURL}/api/Authenticate/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(Q.parseLoginProcessAnswer)}static parseLoginProcessAnswer(t){if(t.statusCode>3)throw Error(t.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return t}static startPasswordReset(t,n){return q(`${I.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:t})})}static confirmPhoneNumberByAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:i,Code:o})})}static confirmEmailByAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Prefix:i,Code:o})})}static finishAccessRecovery(t,n,i,o){return q(`${I.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:t,Token:n,Password:i,ConfirmedPassword:o})})}}class Ia{static readHistoryById(t,n){return q(`/close-api/audits/history/${t}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class Ra{static getConfiguration(){return q("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(t){return await q(`/open-api/data/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class La{static getDictionary(t){if(!t)throw new Error(`Can't get dictionary for ${t}.`);return q(`/open-api/internationalization/language/${t}`)}}class Oa{static async upload(t,n){const i=new FormData;return i.append("file",t),i.append("entityName",n),q("/close-api/files",{method:"POST",body:i}).then(o=>(o.filename=t.name,o))}static getFileLink(t){return`/close-api/files/${t}`}}var bn=(e=>(e.Add="A",e.Delete="D",e.Modify="M",e.None="N",e))(bn||{}),En=(e=>(e.Approved="A",e.AwaitingFeedback="AF",e.AssignedForExam="AFE",e.Cancelled="C",e.Closed="CLS",e.Completed="CT",e.Draft="D",e.NotSatisfied="NSF",e.OnClarification="OC",e.Processing="P",e.Rejected="R",e.ReadyForExam="RFE",e.Submitted="S",e.SecurityCheck="SCK",e.Satisfied="SF",e.Withdrawn="W",e))(En||{});function _n(e){return typeof e!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}function va(e){return typeof e!="object"||e===null?!1:!!(e.hasOwnProperty("start")||e.hasOwnProperty("end"))}function O(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];if(Array.isArray(i))return t.push(O.in(n,i)),t;if(kn(i)&&(typeof i.min=="number"&&t.push(O.ge(n,i.min)),typeof i.max=="number"&&t.push(O.le(n,i.max))),$a(i)){if(i.text){const a=(l=>{switch(l){case"end":return O.endWith;case"begin":return O.beginWith;default:return O.includes}})(i.option);t.push(a(n,i.text))}return t}if(va(i)){let o=function(a){var l;return((l=a.match(/([^Z]*)/))==null?void 0:l[0])+"0000Z"};return i.start&&t.push(`@${n} ge ${o(i.start)}`),i.end&&t.push(`@${n} le ${o(i.end)}`),t}return typeof i=="number"||typeof i=="boolean"||typeof i=="string"?(t.push(O.eq(n,i)),t):(i===null&&t.push(O.is(n,i)),t)},[]).join(" and ")}function kn(e){return e!==null&&typeof e=="object"&&("min"in e||"max"in e)}function $a(e){return e!==null&&typeof e=="object"&&"text"in e&&"option"in e}function ge(e){return typeof e=="string"&&_n(e)?`{${e}}`:typeof e=="string"?`'${e}'`:`${e}`}O.includes=function(t,n){return`@${t} Contains ${ge(n)}`},O.beginWith=function(t,n){return`@${t} BeginWith ${ge(n)}`},O.endWith=function(t,n){return`@${t} EndWith ${ge(n)}`},O.notEq=function(t,n){return`@${t} nq ${ge(n)}`},O.eq=function(t,n){return Array.isArray(n)?O.in(t,n):`@${t} eq ${ge(n)}`},O.ge=function(t,n){return`@${t} ge ${n}`},O.le=function(t,n){return`@${t} le ${n}`},O.in=function(t,n){const i=n.map(ge).join(", ");return`@${t} in (${i})`},O.notIn=function(t,n){return!Array.isArray(n)||n.length===0?"":O.and(...n.map(i=>O.notEq(t,i)))},O.and=function(...t){return t.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(O.wrap).join(" and ")},O.wrap=function(t){return`(${t})`},O.is=function(t,n){return`@${t} is ${n}`},O.or=function(...t){return t.join(" or ")};function mt(e){return Object.keys(e).reduce((t,n)=>{let i=e[n];const o=n.charAt(0).toUpperCase()+n.slice(1);return typeof i=="object"&&!(i==null||Array.isArray(i))&&(i=mt(i)),t[o]=i,t},{})}var j=(e=>(e.Completed="Completed",e.FinalStep="FinalStep",e.NextStep="NextStep",e.FinalStepWithConfirmation="FinalStepWithConfirmation",e.NextStepWithConfirmation="NextStepWithConfirmation",e.ValidationError="ValidationError",e.Undefined="Undefined",e))(j||{});const X=new pt,Te=new Na;p.ApplicationStatus=En,p.AsyncProcessStatus=vt,p.Communication=Ta,p.CoreError=re,p.DisplayListRow=un,p.EventBus=Te,p.Filter=O,p.ListDataController=It,p.Manager=X,p.MetadataStore=te,p.ModalListDownload=ri,p.ModalVersionHistory=bi,p.NotificationSystem=Me,p.OBJECT_TYPE_NAME_FIELD=yt,p.RecordOperation=bn,p.WidgetAction=ti,p.WidgetButton=sr,p.WidgetFastTable=ei,p.WidgetFastTableHeadCell=St,p.WidgetField=Nr,p.WidgetIcon=pe,p.WidgetImage=hr,p.WidgetList=Ar,p.WidgetLoader=Le,p.WidgetMultiButton=ur,p.WidgetResolverEntity=ni,p.WidgetSpinner=_e,p.WidgetTable=Ct,p.WidgetTablePanelFilterItem=At,p.asyncProcess=oe,p.authService=Q,p.billingService=ue,p.catchUniversal=U,p.config=Zn,p.configuration=I,p.constants=A,p.convertDDToDMS=Wo,p.convertDMSToDD=Uo,p.convertListConfig=lt,p.coreUtils=Jo,p.debounce=Ft,p.documentsService=vn,p.downloadDocumentBuilderFile=Ei,p.fileService=Oa,p.formatter=me,p.getCellName=ie,p.getCellValue=be,p.getEntityLink=at,p.getEntityResolveLink=fn,p.getNamesFromListConfig=Ze,p.getPathForResolveRouter=jo,p.getPrimaryFieldNameForEntity=st,p.getUnitValue=qe,p.groupArrayByField=Ci,p.historyService=Ia,p.injectAction=Rt,p.internationalizationService=La,p.invitationService=On,p.isUUID=_n,p.openBlobFile=Ot,p.openService=Ra,p.parseError=Je,p.parseTextByMarkdown=xo,p.prettyDate=Oe,p.prettyDateWithTime=Xe,p.prettyMoney=Bt,p.prettyValueFieldByEntity=et,p.request=q,p.setupListRow=Ge,p.staticLink=jt,p.t=Y,p.throttle=Ai,p.universalBatchUpdate=Ut,p.universalEntityCount=Bi,p.universalEntityCreate=Vt,p.universalEntityDelete=Mt,p.universalEntityRead=se,p.universalEntityResolve=tt,p.universalEntityUpdate=Qe,p.universalHistoryRead=Wt,p.universalListSettingRead=Pt,p.universalMandatoryFieldsRead=Go,p.universalMetadataFieldTreat=Oi,p.universalMetadataListRead=$i,p.universalToolRead=xt,p.useActions=ca,p.useCommunication=aa,p.useEnter=da,p.useFormEntity=sa,p.useListActiveRow=Qo,p.useListDownload=mn,p.useListEntity=ea,p.useListSearch=ua,p.useListSelect=fa,p.useLocalStorage=wt,p.useManagerState=ta,p.useMetadata=Ce,p.useMetadataField=Tt,p.usePrintForm=_a,p.useSocket=B,p.useUsageContext=ct,p.useVisibleItem=Ke,p.useWizard=ya,p.uuidv4=Ti,p.valuesToUpperCase=mt,p.wrapToolResponse=Ht,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
13
13
  //# sourceMappingURL=eservices-core.umd.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.3.325",
3
+ "version": "1.3.326",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {