eservices-core 1.3.23 → 1.3.24

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.
@@ -1,11 +1,11 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.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}.flex{display:flex}.flex_column{display:flex;flex-direction:column}.flex_center{display:flex;align-items:center;justify-content:center}.flex_full,.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{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_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}.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}.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;color:#4f4f4f}.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{text-align:right}.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}.es-list-container{overflow:auto}.radius_5{border-radius:5px}.radius_10{border-radius:10px}.radius_15{border-radius:15px}.radius_20{border-radius:20px}.widget-table__head-cell[data-v-25198f4a]{padding:18px;text-align:start}.widget-table__head-label[data-v-25198f4a]{font-weight:600;font-size:14px;line-height:19px}[dir=rtl] .icon[data-v-e287c8d9]{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-a8d711d1]{--button-size: 40px;max-height:var(--button-size);z-index:1;width:fit-content}.widget-multi-button[data-v-a8d711d1]{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-a8d711d1]{grid-template-rows:calc(var(--button-size) * var(--7025434e))}.widget-multi-button-body[data-v-a8d711d1]{min-width:80px}.widget-multi-button-body-label[data-v-a8d711d1]{padding:10px 10px 10px 20px;color:#fff;transition:background-color var(--fast)}.widget-multi-button-body-label[data-v-a8d711d1]:hover{background-color:#223296}.widget-multi-button-side[data-v-a8d711d1]{height:var(--button-size);transition:transform var(--fast),background-color var(--fast);color:#fff}.widget-multi-button-side_active[data-v-a8d711d1]{transform:rotate(180deg)}.widget-multi-button-side[data-v-a8d711d1]: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}.head-cell[data-v-4e1d87c8]{padding:0 15px 0 10px;display:flex}.head-cell[data-v-4e1d87c8]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-4e1d87c8]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-4e1d87c8]{position:absolute;inset-inline-end:4px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-4e1d87c8]{transform:rotate(180deg)}.head-cell-resize[data-v-4e1d87c8]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-4e1d87c8]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-4e1d87c8]: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}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  "use strict";/*!
3
- * eservices-core v1.3.23
3
+ * eservices-core v1.3.24
4
4
  * (c) 2023 ESERVICES
5
- */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),S=require("jenesius-vue-form"),Vt=require("jenesius-vue-modal"),ut=require("vue-router"),Mt=require("date-and-time");function Ut(n,e){return!!n&&n===e||"password is not equal"}function dt(n){return Number(n.replace(/[^0-9.]/g,""))}function jt(n,e=null){let r=String(dt(n)).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length>1&&e!==null&&r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const Wt=Object.freeze(Object.defineProperty({__proto__:null,numeric:dt,prettyNumeric:jt,validPassword:Ut},Symbol.toStringTag,{value:"Module"})),qt={inputs:Wt};function Ae(n,e){if(typeof n!="object"||n===null)return;if(e in n)return n[e];let t=e.indexOf(".");if(t>-1){const r=e.substring(0,t);return r in n?Ae(n[r],e.substr(t+1)):void 0}return n[e]}function Ne(n,e){if(!n)return console.warn("Element is not provided.");function t(o,s){return o==s.target||o.contains(s.target)}const r=o=>{t(n,o)||(e(),window.removeEventListener("click",r))};window.addEventListener("click",r)}function ft(n){return n.reduce((e,t)=>e.then(r=>t==null?void 0:t(r)),Promise.resolve())}const pt=class v extends Error{constructor(e,t=null){super(),this.message=e,this.details=t,this.id=v.ID++}static ParentFormNotFound(){return new v("Can't found parent form.")}static UndefinedNameOfCompositeFormController(e){return new v("Composite object name is undefined",e)}static EntityWithoutName(e){return new v("'Entity doesn't have a name",e)}static NotResolvedNameEventEmitter(e){return new v(`'${e}' is not a valid Event emitter name`)}static FormIsNotValidated(e){return new v("Form is not validated",e)}static ListWorkerIsRunningOrEnd(e){return new v("List data request is running or already done",e)}static ObjectIdNotNumber(e){return new v(`${e} (id) is not a number`)}static UndefinedErrorId(e,t){return v.ApiNotAvailable()}static ApiError(e){return new v("Request error",e)}static ApiNotAvailable(){return new v(`Sorry, we experience difficulties here.
6
- Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,t){return!e&&!t?v.ApiNotAvailable():new v(e||"Authorization Error",t)}static ApiResponseParseFailed(){return v.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new v("Object doesn't have id",e)}static ObjectWithIdNotFound(e,t){return new v(`Can't find object with id: ${e}`,t)}static ObjectWithoutConnectToPresentArray(e,t){return new v("Object is not found.",{object:e,array:t})}static EntityWithoutId(e){return new v("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,t){return new v(`Can't find the element with tableIndex ${e}`,t)}static UndefinedError(e,t=[]){return new v(e,t)}static TableArrayAlreadyIncludeProvidedIndexValue(e,t,r){return new v(`Array already includes the element with value ${e}`,{array:t,table:r})}static MetadataEntityIsNotAvailable(e){return new v(`Metadata for the ${e} is not currently available.`)}};pt.ID=0;let O=pt;const ht="Please try again later or submit a feedback if problem doesn't go.";function Qe(n){return typeof n=="string"?De(n):Gt(n)?De(n.message):De(ht)}function Gt(n){return!!(typeof n=="object"&&Object.hasOwnProperty.call(n,"message")&&n!==null)}function De(n,e=[]){return{message:n,details:e}}class gt{static getClientData(){return m("/close-api/client-content")}static getNavigation(){return m("/close-api/client/navigation")}}const H=new class{constructor(){this.store=i.reactive([])}add(e,t,{children:r,timeout:o=10,click:s=()=>{}}={}){const d=new zt(e,t,o,r||[],s);return this.store.push(d),o&&setTimeout(this.remove.bind(this,d.id),o*1e3),d}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}removeChild(e,t){throw new Error("Removing children error.")}},mt=class yt{constructor(e,t,r,o,s){this.type=e,this.msg=t,this.timeout=r,this.children=o,this.click=s,this.id=yt.cardId++}};mt.cardId=1;let zt=mt;/*!
5
+ */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),k=require("jenesius-vue-form"),Pt=require("vue-router"),Dt=require("date-and-time");function xt(n,e){return!!n&&n===e||"password is not equal"}function st(n){return Number(n.replace(/[^0-9.]/g,""))}function Bt(n,e=null){let r=String(st(n)).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length>1&&e!==null&&r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const Vt=Object.freeze(Object.defineProperty({__proto__:null,numeric:st,prettyNumeric:Bt,validPassword:xt},Symbol.toStringTag,{value:"Module"})),Ut={inputs:Vt};function Se(n,e){if(typeof n!="object"||n===null)return;if(e in n)return n[e];let t=e.indexOf(".");if(t>-1){const r=e.substring(0,t);return r in n?Se(n[r],e.substr(t+1)):void 0}return n[e]}function be(n,e){if(!n)return console.warn("Element is not provided.");function t(o,s){return o==s.target||o.contains(s.target)}const r=o=>{t(n,o)||(e(),window.removeEventListener("click",r))};window.addEventListener("click",r)}function at(n){return n.reduce((e,t)=>e.then(r=>t==null?void 0:t(r)),Promise.resolve())}const ct=class E extends Error{constructor(e,t=null){super(),this.message=e,this.details=t,this.id=E.ID++}static ParentFormNotFound(){return new E("Can't found parent form.")}static UndefinedNameOfCompositeFormController(e){return new E("Composite object name is undefined",e)}static EntityWithoutName(e){return new E("'Entity doesn't have a name",e)}static NotResolvedNameEventEmitter(e){return new E(`'${e}' is not a valid Event emitter name`)}static FormIsNotValidated(e){return new E("Form is not validated",e)}static ListWorkerIsRunningOrEnd(e){return new E("List data request is running or already done",e)}static ObjectIdNotNumber(e){return new E(`${e} (id) is not a number`)}static UndefinedErrorId(e,t){return E.ApiNotAvailable()}static ApiError(e){return new E("Request error",e)}static ApiNotAvailable(){return new E(`Sorry, we experience difficulties here.
6
+ Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,t){return!e&&!t?E.ApiNotAvailable():new E(e||"Authorization Error",t)}static ApiResponseParseFailed(){return E.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new E("Object doesn't have id",e)}static ObjectWithIdNotFound(e,t){return new E(`Can't find object with id: ${e}`,t)}static ObjectWithoutConnectToPresentArray(e,t){return new E("Object is not found.",{object:e,array:t})}static EntityWithoutId(e){return new E("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,t){return new E(`Can't find the element with tableIndex ${e}`,t)}static UndefinedError(e,t=[]){return new E(e,t)}static TableArrayAlreadyIncludeProvidedIndexValue(e,t,r){return new E(`Array already includes the element with value ${e}`,{array:t,table:r})}static MetadataEntityIsNotAvailable(e){return new E(`Metadata for the ${e} is not currently available.`)}};ct.ID=0;let L=ct;const lt="Please try again later or submit a feedback if problem doesn't go.";function Ye(n){return typeof n=="string"?Re(n):Mt(n)?Re(n.message):Re(lt)}function Mt(n){return!!(typeof n=="object"&&Object.hasOwnProperty.call(n,"message")&&n!==null)}function Re(n,e=[]){return{message:n,details:e}}class ut{static getClientData(){return y("/close-api/client-content")}static getNavigation(){return y("/close-api/client/navigation")}}const Be=new class{constructor(){this.store=i.reactive([])}add(e,t,{children:r,timeout:o=10,click:s=()=>{}}={}){const d=new jt(e,t,o,r||[],s);return this.store.push(d),o&&setTimeout(this.remove.bind(this,d.id),o*1e3),d}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}removeChild(e,t){throw new Error("Removing children error.")}},dt=class ft{constructor(e,t,r,o,s){this.type=e,this.msg=t,this.timeout=r,this.children=o,this.click=s,this.id=ft.cardId++}};dt.cardId=1;let jt=dt;/*!
7
7
  * jenesius-event-emitter v1.0.2
8
8
  * (c) 2022 Jenesius
9
9
  * @license MIT
10
- */const et=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},tt=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},nt=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},rt=function(){this.events={}};class I{constructor(){this.events={}}on(e,t){return et.call(this,e,t)}emit(e,t){return tt.call(this,e,t)}off(e,t){return nt.call(this,e,t)}cleanEvents(){rt.call(this)}static on(e,t){return et.call(I,e,t)}static emit(e,t){return tt.call(I,e,t)}static off(e,t){return nt.call(I,e,t)}static cleanEvents(){rt.call(I)}}I.events={};var wt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},pe=(n,e,t)=>(wt(n,e,"read from private field"),t?t.call(n):e.get(n)),xe=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Be=(n,e,t,r)=>(wt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te,he,ge;const z=class k extends I{constructor(){super(...arguments),xe(this,te,void 0),xe(this,he,"front"),this.organizations=[],xe(this,ge,!1)}set language(e){localStorage.setItem(k.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(k.LOCALSTORAGE_LANGUAGE_KEY)||k.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(k.LOCALSTORAGE_LANGUAGE_KEY)}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}set router(e){Be(this,te,e)}get router(){if(!pe(this,te))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return pe(this,te)}set type(e){Be(this,he,e)}get type(){return pe(this,he)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Be(this,ge,e),this.emit(k.EVENT_READY_UPDATE,e)}get ready(){return pe(this,ge)}onReady(e){return this.on(k.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(k.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(k.EVENT_DATA_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.log("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(k.CURRENT_CONTEXT_KEY,String(e)),this.emit(k.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.user=e.user,this.ready=!0;const t=Number.parseInt(localStorage.getItem(k.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{H.add("error",O.ApiNotAvailable().message)}}loadCustomerData(){return gt.getClientData()}async updateFullClientData(){return this.init()}validateContextId(e){var t;return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}getListKeyById(e){return console.log("DEPRECATED"),`list-information-${e}`}getListInformationFromLocalStorage(e){console.log("DEPRECATED");const t=localStorage.getItem(this.getListKeyById(e));return t&&JSON.parse(t)}setListInformationToLocalStorage(e,t){console.log("DEPRECATED"),localStorage.setItem(this.getListKeyById(e),JSON.stringify(t))}};te=new WeakMap;he=new WeakMap;ge=new WeakMap;z.DEFAULT_LANGUAGE="en";z.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";z.EVENT_CONTEXT_UPDATE="event:context-update";z.EVENT_READY_UPDATE="event:ready-update";z.EVENT_DATA_UPDATE="event:data-update";z.CURRENT_CONTEXT_KEY="CurrentContext";let Kt=z;const Ue=new Kt;function Yt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return ht}})}function m(n,e={}){return Ue.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Ue.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw O.ApiNotAvailable()}).then(t=>Yt(t).then(r=>{if(!t.ok)throw r;return r}))}class ke{constructor(){}static parseNamesFromListConfig(e){let t=ke.parseFieldsToGraphQL(e.reduce((o,s)=>(s.name&&o.push(s.name),o),[]));function r(o){let s="";for(let d in o)typeof o[d]=="boolean"?s+=` ${d} `:s+=` ${d} { ${r(o[d])} }`;return s}return r(t)}static parseSortFromListConfig(e){let t={};for(let r in e)t[r]=e[r]?"ASC":"DESC";return t}static parseFieldsToGraphQL(e){function t(r,o){if(o.includes(".")){const s=o.indexOf("."),d=o.substring(s+1),l=o.substring(0,s);l in r||(r[l]={}),t(r[l],d)}else r[o]=!0;return r}return e.reduce(t,{})}}class Jt{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,t,r)=>(t!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[t]=r,!0)}),window._journal=this}get error(){return{add:(...e)=>{this.errors.push(e)},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")}}const Ct=new Jt;function vt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Ge(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Ge(r)),e[o]=r,e},{})}function Ht(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const ae={Request:m,clickOutside:Ne,getPropFromObject:Ae,runPromiseQueue:ft,GraphQL:ke,firstChapterToLowerCase:vt,valuesToUpperCase:Ge,prettyMoney:Ht},Xt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:ke,Journal:Ct,Request:m,clickOutside:Ne,default:ae,firstChapterToLowerCase:vt,getPropFromObject:Ae,runPromiseQueue:ft,valuesToUpperCase:Ge},Symbol.toStringTag,{value:"Module"}));function Et(n,e=""){for(let t in n){if(typeof n[t]=="object"){Et(n[t],(e.length?`${e}-`:"")+t);continue}let r="--"+((e.length?`${e}-`:"")+t).replace(/([A-Z])/g,o=>`-${o}`.toLowerCase());document.documentElement.style.setProperty(r,n[t])}}const V={};function Zt(n){for(let e in n)V[e]=n[e];n.styles&&Et(n.styles),Ct.welcome(),console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white"),window._config=V}const Qt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));const en=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class tn{static readHistoryById(e,t){return m(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const o=r.history.map(s=>{if(!s.changes)return s;const d=s.changes.map(l=>({...l,oldValue:l.originalValue,name:l.fieldName}));return{...s,changes:d}});return{...r,history:o}})}}class nn extends I{constructor(){super(),this.EVENT_NEW="event:new-metadata",this.store={}}get(e){return this.store[e]}async load(e){return this.store[e]||this.set(e,await this.loadEntityInformation(e)),this.store[e]}set(e,t){this.store[e]=t,this.emit(this.EVENT_NEW,{entityName:e})}async loadEntityInformation(e){return await ze.get(e)}}const ne=new nn;function rn(n){const e=i.ref(ne.get(n));return ne.on(ne.EVENT_NEW,t=>{n===t.entityName&&(e.value=ne.get(n))}),e}function on(n,e){try{return e.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(t){_t().error("prettify value by metadata",n,t)}}class sn{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return m(`/open-api/internationalization/language/${e}`)}}let q={};function X(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=S.utils.getPropFromObject((this==null?void 0:this.vocabulary)||q,n);if(typeof t=="string")return ot(t,e);const r=S.utils.getPropFromObject(q==null?void 0:q.root,n);return typeof r=="string"?ot(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function ot(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}X.setGlobalVocabulary=function(n){q=n};X.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),X.bind({vocabulary:S.utils.getPropFromObject(q,e.toLowerCase())})};X.setVocabulary=function(n){return typeof n=="string"&&(n=S.utils.getPropFromObject(q,n)),X.bind({vocabulary:n})};const an=function(){let n=!1;const e=[];function t(){return n}function r(a,p){t()&&console[a](...p),e.push(p)}function o(...a){r("log",a)}function s(...a){r("warn",a)}function d(...a){r("error",a)}function l(a=!0){n=a}return{info:o,warn:s,history:e,display:l,error:d}}();function _t(){return an}class T{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw O.AuthServiceError(e.title,t)}static login(e){return m(V.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:V.applicationName})}).catch(T.parseError)}static registration(e){return e.AppName=V.applicationName,m(V.identityServerURL+"/api/Authenticate/Registration",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)}).catch(T.parseError)}static parseProcessAnswer(e){if(e.statusCode>4)throw O.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return T.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return m(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError)}static startLoginProcess(e){return T.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return T.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return T.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return m(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError).then(T.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw O.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}}function cn(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const ln="masterId",un="masterEntity";function _e(n,e){if(!Array.isArray(e))return;if(cn(e))return t(e);e.forEach(t);function t(r){n.append(un,r[0]),n.append(ln,r[1].toString())}}class x{static async anonymousGetList(e){return await m(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(o,s)=>r.append(o,s),r=new URLSearchParams;if(e.fields){const o=e.fields;typeof o=="string"?t("fields",o):Array.isArray(o)?t("fields",o.join(" ")):typeof o=="object"&&t("fields",Object.keys(o).join(" "))}if(e.order){let o=e.order;const d=(Array.isArray(o)?[o]:Object.entries(o)).map(([l,a="desc"])=>`@${l} ${a}`).join(",");t("order",d)}return e.limit&&t("limit",e.limit.toString()),e.offset&&t("offset",e.offset.toString()),e.filter&&t("filter",e.filter.toString()),e.useUsageContext&&r.append("useUsageContext",e.useUsageContext.toString()),r}static async getList(e,t){const r=x.getSearchParamsForEntityListRead(t||{});return await m(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=x.getSearchParamsForEntityListRead(t||{});return m(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const o=new URLSearchParams;return _e(o,r==null?void 0:r.masterEntities),m(`/close-api/data/${e}?${o.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,o={}){return m(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const o=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),o.append("fields",s.join(" "))}return m(`/close-api/data/entities/${e}/id/${t}?${o.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,o){const s=new URLSearchParams;return _e(s,o==null?void 0:o.masterEntities),m(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:o==null?void 0:o.version})})}static removeById(e,t,r){const o=typeof t=="number"?{Id:t}:t;return x.removeByKeys(e,o,r)}static removeByKeys(e,t,r){return m(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const St=class re{static async create(e){return m(re.url,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}static async read(e){const t=new URLSearchParams({targetCode:String(e.targetCode),entityName:e.entity.name,entityCatalogId:e.entity.catalogId});return m(re.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return m(`${re.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return m(`${re.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};St.url="/close-api/communications";let ce=St;class dn{static async getDefaultView(e){return m("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function it(n){return{...n,createdEntities:n.createdEntites}}const bt=class me{static async getStartConfig(e,t){return m([me.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return m([me.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(it)}static async runStep(e,t,r,o,s){return m([me.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:o,values:s})}).then(it)}};bt.url="/close-api/views/process-wizard";let ye=bt;class ze{static get url(){return"/close-api/metadata"}static async get(e,t,r){console.warn("GETTING METADATA BY DEPRECATED METHOD."),console.trace();const o=new URLSearchParams;return t&&o.append("criteria",t),r&&o.append("id",String(r)),await fetch(this.url+`/${e}?${o.toString()}`,{method:"GET"}).then(s=>s.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return _e(o,r),t&&o.append("id",t),m([this.url,e].join("/")+`?${o.toString()}`)}static getFieldInformation(e,t){return m(`/open-api/metadata/${e}/fields/${t}`)}static getTreatmentListField(e,t){return m(`/open-api/metadata/${e}/list-fields/${t}`)}}class fn{static async upload(e,t){const r=new FormData;r.append("file",e);const o=`/close-api/files?entityName=${t}`;return await fetch(o,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class pn{static invite(e,t,r){return m("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:t,relatedRoleCode:r})})}static accept(e,t){return m("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!0})})}static decline(e,t){return m("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class Ke{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return m(Ke.url+e,{method:"POST",body:JSON.stringify(t)})}}class hn{static getConfiguration(){return m("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class Tt{static url(){return"/close-api/actions"}static async get({criterion:e}){const t=new URLSearchParams;return e&&t.append("criterion",e),await fetch(this.url()+`?${t.toString()}`,{method:"GET"}).then(r=>r.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return _e(o,r),m([this.url(),e,t].join("/")+`?${o.toString()}`,{method:"GET"})}}class gn extends I{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return ce.createMessage({talkId:this.id,text:e})}static checkAndGenerate(e){return ce.read(e).then(t=>t.length===0?ce.create(e):t[0])}}function mn(n){const e=S.Form.getParentForm();e?e.subscribe(n):console.warn(O.ParentFormNotFound());const t=i.reactive([]);return n.read=()=>ce.readMessages(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function yn(n,e="images"){return`/static-folder/${e}/${n}`}function wn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Cn(n,e){const t=i.ref(null);function r(){return n.name?ze.getById(n.name,e,[]).then(o=>{t.value=o,o.fields.forEach(s=>{s.canSet?n.enable(s.name):n.disable(s.name)})}).catch(()=>{t.value=null;const o=O.MetadataEntityIsNotAvailable(n.name||"FORM_WITHOUT_NAME");H.add("error",o.message)}):Promise.reject()}return n.on(S.Form.EVENT_READ,r),{metadata:t,update:r}}class Ye extends Error{static UndefinedStatus(){return new Ye("Status is undefined.")}}class vn extends Ye{}function En(n,e){const t=i.reactive([]);async function r(s,d){if(!s)throw vn.UndefinedStatus();const l=await Tt.get({criterion:s});t.splice(0,t.length),t.push(...l.map(a=>o(a,d)))}return{actions:t,update:r};function o(s,d){return{title:s.title,callback:()=>(()=>Promise.resolve().then(()=>{if(n.changed)return n.save()}).then(()=>fetch(s.url,{method:"POST",body:JSON.stringify({keys:{Id:d},contextId:Ue.contextId}),headers:{"Content-Type":"application/json"}})).then(a=>a.json()).then(a=>{if(!a.success)throw e!=null&&e.ModalValidationResult&&a.validationEffect?Vt.openModal(e.ModalValidationResult,{rules:a.validationEffect.results}):H.add("error",a.message),new Error;return a}).then(a=>{a.message&&H.add("info",a.message),e!=null&&e.handleAffectedEntities&&e.handleAffectedEntities(a.affectedEntities)}).then(()=>n.read()))()}}}class Se{static url(){return"/close-api/presentation"}static getStatuses(e,t){return fetch(`${Se.url()}/status/${e}/${t}`).then(r=>r.json())}}function _n(n){const e=i.reactive({title:"Loading",type:"wait"});function t(r){if(n.name&&Number.isInteger(r))return Se.getStatuses(n.name,r).then(o=>{e.type=o.type,e.title=o.name})}return n.on(S.Form.EVENT_READ,r=>{var d,l;const{code:o,name:s}={code:(d=r.Status)==null?void 0:d.Code,name:(l=r.Status)==null?void 0:l.Name};return n.name?!Number.isInteger(o)&&!s?void console.log("Undefined code or name is Status prop."):Se.getStatuses(n.name,o).then(a=>{e.type=a.type,e.title=s}):void console.log("Form without name.")}),{label:e,update:t}}function Sn(n,e){const t=ut.useRoute(),r=i.computed(()=>Number(t.params.id)),o=i.reactive({ready:!1,show:!1});return i.watch(()=>r.value,()=>{o.ready=!1}),i.watch(()=>r.value,()=>{Number.isInteger(r.value)&&n.read()},{immediate:!0}),n.read=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return x.readById(n.name,r.value,{fields:e.fields})}).then(ae.valuesToUpperCase).then(s=>(Number.isInteger(s.Version)&&(n.version=s.Version),n.setValues(s),o.show=!0,s)).catch(s=>{throw Object.prototype.hasOwnProperty.call(s,"status")&&[403,404].includes(s.status)&&(o.show=!1),s}).finally(()=>{o.ready=!0})),n.save=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return x.updateById(n.name,r.value,n.changes,{version:n.version})}).then(s=>{n.version=s.version})),n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{formShadowState:o}}function bn(n,e){const t=i.reactive({ready:!1,show:!1});function r(){t.ready=!1,t.show=!1}return n.read=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw O.EntityWithoutName("Use Form Request");return x.readById(n.name,o.id,{fields:o.fields})}).then(ae.valuesToUpperCase).then(s=>(s.hasOwnProperty("Version")&&(n.version=Number(s.Version)),n.setValues(s),t.show=!0,s)).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d}).finally(()=>{t.ready=!0})},n.save=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw O.EntityWithoutName("Use Form Request");return x.updateById(n.name,o.id,n.changes,{version:n.version})}).then(s=>{n.version=s.version||s.Version}).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d})},n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{shadowFormState:t,initShadow:r}}class Tn{static getRequiredDocuments(e,t,r){const o=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${o.toString()}`).then(s=>s.json())}}class J{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${J.url()}/calculator/${e}`)}static calculate(e,t){return m(`/${J.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:t})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):O.ApiNotAvailable()})}static parseMetadataField(e){function t(r){switch(r.type){case"ValueType":switch(r.dataType){case"Integer":return"number";default:return r.dataType}case"EntityReference":return r.dataType}}return{name:e.name,label:e.title,required:e.required,type:t(e)}}static createOnlinePayment(e,t){return m(`/${J.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return m(`/${J.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class An{static getListSettings(e,t){const r=new URLSearchParams;r.set("entity",e),t&&r.set("mark",t);const o=`/close-api/views/list/configs?${r.toString()}`;return m(o)}}var At=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},R=(n,e,t)=>(At(n,e,"read from private field"),t?t.call(n):e.get(n)),U=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},j=(n,e,t,r)=>(At(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),we,oe,Ce,ve,ie,se,je;const W="_______LIST_______ROW_______INDEX________NAME_______",Ie=class L extends I{constructor(e){super(),this.LIST_ROW_KEY=1,U(this,we,void 0),this.array=[],U(this,oe,[]),U(this,Ce,[]),U(this,ve,new Proxy({},{set:(t,r,o,s)=>(t[r]=o,this.emit(L.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(L.EVENT_FILTERS_UPDATE,t),!0)})),U(this,ie,!1),U(this,se,(...t)=>Promise),U(this,je,()=>{}),j(this,we,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&j(this,oe,e.config)}set config(e){j(this,oe,e.map(S.utils.copyObject)),this.emitUpdateConfig()}get config(){return R(this,oe)}emitUpdateConfig(){this.emit(L.EVENT_CONFIG_UPDATE,this.config)}get order(){return R(this,Ce)}set order(e){j(this,Ce,e),this.emit(L.EVENT_ORDER_UPDATE,this.order)}get filters(){return R(this,ve)}set filters(e){kn(R(this,ve),e)}set wait(e){j(this,ie,e),this.emit(S.Form.EVENT_WAIT,R(this,ie))}get wait(){return R(this,ie)}get primaryKeys(){return R(this,we)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[W]===e)}indexByKey(e){return this.array.findIndex(t=>t[W]===e)}static getKey(e){return e[W]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,W)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(L.EVENT_DATA,this.array)}set(e){this.array=[],this.add(...e)}removeByKey(e){const t=this.indexByKey(e);t!==-1&&(this.array.splice(t,1),this.emit(L.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(L.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[W]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,W)}set read(e){j(this,se,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=R(this,se).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){j(this,se,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>R(this,je).call(this)).finally(()=>this.wait=!1)}static GetFieldNames(e){return e.reduce((t,r)=>(r.name&&(typeof r.name=="string"?t.push(r.name):t.push(...r.name)),t),[])}static mergeWithKey(e,t){return{...e,[W]:t}}static getCellName(e){return typeof e.name=="string"?e.name:Array.isArray(e.name)?e.name[0]:null}static getCellInfo(e,t){const r=L.getCellName(e),o=(()=>{let s=r?Ae(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:o}}};we=new WeakMap;oe=new WeakMap;Ce=new WeakMap;ve=new WeakMap;ie=new WeakMap;se=new WeakMap;je=new WeakMap;Ie.EVENT_DATA="list-data: update";Ie.EVENT_CONFIG_UPDATE="list-config:update";Ie.EVENT_ORDER_UPDATE="list-order:update";Ie.EVENT_FILTERS_UPDATE="list-filters:update";function Nn(n){const e=i.ref(""),t=i.computed(()=>{const r=e.value.toLowerCase();return i.unref(n).filter(o=>e.value.length?Object.values(o).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function kn(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function In(n){const e=i.reactive([]);function t(l){return e.includes(l)}function r(l){t(l)||e.push(l)}function o(l){const a=e.findIndex(p=>p===l);a!==-1&&e.splice(a,1)}function s(l){const a=i.unref(n);if(l===void 0){e.length===0?a.forEach(r):a.forEach(o);return}t(l)?o(l):r(l)}const d=i.computed(()=>{const l=i.unref(n);return e.length===l.length&&l.length!==0});return[e,s,d,r,o]}function On(n){return n.statusName==="Completed"}function Fn(n){return n.statusName==="FinalStepWithConfirmation"}function $n(n){return n.statusName==="ValidationError"}function Pn(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],d=null;const l=i.ref(null);function a(){l.value=s.find(y=>y.name===d)||null}function p(){var y;return d?((y=s.find(E=>E.name===d))==null?void 0:y.fields)||[]:[]}function c(y){if(a(),$n(y))return void t.onValidation(y.validationResults);if((y.statusName==="FinalStep"||y.statusName==="NextStep")&&(!p().length||Rn(p(),t.presets)))return C(t.presets||{});On(y)&&t.onCompleted(y),Fn(y)&&t.onConfirmation(y)}async function f(){try{await u(),await w()}catch(y){const{message:E}=be(y);Te.add("error",E)}}function u(){return o.wait="Loading process information.",ye.getStartConfig(e,n).then(y=>{s=y.steps.map(E=>({label:E.title,name:E.stepName,number:E.number,fields:E.frontendEntity.objectTypes.reduce((b,A)=>(A.properties.forEach($=>{b.push({name:$.name,label:$.title,type:$.refEntityName||$.dataType})}),b),[])}))}).then(y=>(o.wait=!1,y))}function h(y){return d=y.nextStepName,r=y.token,y}function g(y){const E=be(y);Te.add("error",E.message)}function w(){return o.wait="Starting process",ye.startProcess(e,n).then(h).then(c).catch(g).finally(()=>{o.wait=null})}function C(y={}){return!r||!d?Promise.reject("Not step or token."):(o.wait="Expect the result",ye.runStep(e,n,d,r,y).then(h).then(c).catch(g).finally(()=>{o.wait=!1}))}return{initialize:f,state:o,currentStepConfig:i.readonly(l),next:C}}function Rn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!S.utils.getPropFromObject(e,r.name))return!1}return!0}const Ln="close-api/proxy/Equipment/Search";class Dn{static search(e,t,r,o,s){const d=new URLSearchParams;d.append("pattern",e||""),t&&d.append("categoryId",t),r&&d.append("useType",String(r)),o&&d.append("statusCode",o),s&&(d.append("limit",String(s.limit)),d.append("offset",String(s.offset)));const l=`/${Ln}?${d.toString()}`;return m(l,{method:"GET",headers:{"Content-Type":"application/json"}})}}const xn={class:"widget-table__head"},Bn={class:"widget-table__head-label margin_0 text_overflow"},Vn=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",xn,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.config,(r,o)=>(i.openBlock(),i.createElementBlock("th",{class:"widget-table__head-cell",key:o},[i.createElementVNode("p",Bn,i.toDisplayString(r.label),1)]))),128))]))}});const M=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Mn=M(Vn,[["__scopeId","data-v-25198f4a"]]);function Un(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function Nt(n,e){const t=Un(n);let r=t?S.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function jn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var We={exports:{}},Ve,st;function Wn(){if(st)return Ve;st=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;Ve=function(c,f){f=f||{};var u=typeof c;if(u==="string"&&c.length>0)return d(c);if(u==="number"&&isFinite(c))return f.long?a(c):l(c);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(c))};function d(c){if(c=String(c),!(c.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(f){var u=parseFloat(f[1]),h=(f[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*t;case"minutes":case"minute":case"mins":case"min":case"m":return u*e;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(c){var f=Math.abs(c);return f>=r?Math.round(c/r)+"d":f>=t?Math.round(c/t)+"h":f>=e?Math.round(c/e)+"m":f>=n?Math.round(c/n)+"s":c+"ms"}function a(c){var f=Math.abs(c);return f>=r?p(c,f,r,"day"):f>=t?p(c,f,t,"hour"):f>=e?p(c,f,e,"minute"):f>=n?p(c,f,n,"second"):c+" ms"}function p(c,f,u,h){var g=f>=u*1.5;return Math.round(c/u)+" "+h+(g?"s":"")}return Ve}function qn(n){t.debug=t,t.default=t,t.coerce=a,t.disable=s,t.enable=o,t.enabled=d,t.humanize=Wn(),t.destroy=p,Object.keys(n).forEach(c=>{t[c]=n[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let f=0;for(let u=0;u<c.length;u++)f=(f<<5)-f+c.charCodeAt(u),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(c){let f,u=null,h,g;function w(...C){if(!w.enabled)return;const y=w,E=Number(new Date),b=E-(f||E);y.diff=b,y.prev=f,y.curr=E,f=E,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let A=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(B,_)=>{if(B==="%%")return"%";A++;const Z=t.formatters[_];if(typeof Z=="function"){const de=C[A];B=Z.call(y,de),C.splice(A,1),A--}return B}),t.formatArgs.call(y,C),(y.log||t.log).apply(y,C)}return w.namespace=c,w.useColors=t.useColors(),w.color=t.selectColor(c),w.extend=r,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(c)),g),set:C=>{u=C}}),typeof t.init=="function"&&t.init(w),w}function r(c,f){const u=t(this.namespace+(typeof f>"u"?":":f)+c);return u.log=this.log,u}function o(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let f;const u=(typeof c=="string"?c:"").split(/[\s,]+/),h=u.length;for(f=0;f<h;f++)u[f]&&(c=u[f].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){const c=[...t.names.map(l),...t.skips.map(l).map(f=>"-"+f)].join(",");return t.enable(""),c}function d(c){if(c[c.length-1]==="*")return!0;let f,u;for(f=0,u=t.skips.length;f<u;f++)if(t.skips[f].test(c))return!1;for(f=0,u=t.names.length;f<u;f++)if(t.names[f].test(c))return!0;return!1}function l(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function a(c){return c instanceof Error?c.stack||c.message:c}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var Gn=qn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=d(),e.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;a.splice(1,0,p,"color: inherit");let c=0,f=0;a[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(c++,u==="%c"&&(f=c))}),a.splice(f,0,p)}e.log=console.debug||console.log||(()=>{});function o(a){try{a?e.storage.setItem("debug",a):e.storage.removeItem("debug")}catch{}}function s(){let a;try{a=e.storage.getItem("debug")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}function d(){try{return localStorage}catch{}}n.exports=Gn(e);const{formatters:l}=n.exports;l.j=function(a){try{return JSON.stringify(a)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}})(We,We.exports);var zn=We.exports;const kt=jn(zn);function It(n){return["eservices-core",n].join(":")}function Ot(n){return Je(n,"YYYY/MM/DD HH:mm:ss")}function Je(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return Mt.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const Kn={props:{name:String},setup(n,e){let t="unknown";try{t=e.slots.default()[0].children}catch{t=n.name}typeof t!="string"&&console.warn(`Name for Icon.vue is not string. ${t}`);try{t=t.replace(/\s+/g,"")}catch{}return()=>i.h("i",{class:`icon icon-${t}`})}},Oe=M(Kn,[["__scopeId","data-v-e287c8d9"]]),Yn=kt(It("setup-list-row"));function Jn(n,e){const t=n.config.map(r=>Hn(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function Hn(n,e,t){const r=e.values;let o=Nt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(c){s.onClick.push(()=>c(r))}function l(c){Array.isArray(c)?s.class.push(...c):s.class.push(c)}const a=[],p=[];if(n.hide&&n.hide(r))return[i.h("td")];if(n.type)switch(l(`widget-table-cell_${n.type}`),n.type){case"number":{typeof o=="number"&&(o=new Intl.NumberFormat().format(o));break}case"date":{o=Je(typeof o=="string"?o:null);break}case"dateTime":case"dateWithTime":{o=Ot(typeof o=="string"?o:null);break}case"money":{o=Pt(o);break}case"multi-select":{p.push(i.h(S.FormField,{type:"single-checkbox",modelValue:e.selected})),d(at.bind(null,t,!0));break}case"select":{p.push(i.h(S.FormField,{type:"single-radio",modelValue:e.selected})),d(at.bind(null,t,!1));break}}if(n.onClick&&d(n.onClick),n.link)try{const c=n.link(r);if(c){const f=i.h(ut.RouterLink,{to:c});p.push(f),l("widget-table-cell_link")}}catch(c){Yn("Can't add router link",c)}return n.href&&(p.push(i.h("a",{href:n.href(r),target:"_blank"})),l("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&p.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&p.push(i.h(Oe,{name:n.icon})),n.class&&(typeof n.class=="function"?l(n.class(r)):l(n.class)),a.push(i.h("td",s,p)),a}function at(n,e){n.emit("select",e)}function Ft(n,e){return()=>{try{return Jn(n,e)}catch(t){return console.warn(t),null}}}const Xn={props:{values:Object,config:Object,selected:Boolean},setup:Ft},Zn=["colspan"],ct=i.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=i.ref();return i.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,o)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[i.createElementVNode("td",{colspan:r.rowLength},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.component),i.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:o[0]||(o[0]=s=>e("close")),onSave:o[1]||(o[1]=s=>e("save",s))}),null,16,["values","new"]))],8,Zn)],512))}}),G={LIST_ACTIVE_NEW:"list-active-new",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"},Qn={class:"widget-table"},lt="update:selectedRows",er=i.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{}},emits:["update:activeRow","save"],setup(n,{emit:e}){const t=n,r=i.useSlots(),o=i.computed(()=>{var l;return(l=r==null?void 0:r.default)==null?void 0:l.call(r)[0]});function s(l,a=!0){if(!t.selectedRows)return;if(!a)return e(lt,t.selectedRows.includes(l)?[]:[l]);const p=[...t.selectedRows],c=p.indexOf(l);return c===-1?p.push(l):p.splice(c,1),e(lt,p)}function d(l){e("save",l),e("update:activeRow",null)}return(l,a)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",Qn,[i.createVNode(Mn,{config:l.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:c},[i.createVNode(Xn,{config:l.config,values:p,selected:l.selectedRows.includes(p),onSelect:f=>s(p,f),class:i.normalizeClass(l.classCallback?l.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&l.activeRow===p?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,values:p,onClose:a[0]||(a[0]=f=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),l.activeRow===i.unref(G).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,onClose:a[1]||(a[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),tr=i.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{class:"widget-spinner",style:i.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const Fe=M(tr,[["__scopeId","data-v-0ef9ae88"]]),nr={class:"widget-button"},rr=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",nr,[e.wait?(i.openBlock(),i.createBlock(Fe,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const or=M(rr,[["__scopeId","data-v-450dc564"]]),ir={class:"widget-multi-button-wrap position_relative cursor_pointer"},sr={class:"widget-multi-button-body grid"},ar=["onClick"],cr={class:"widget-multi-button-side-wrap"},lr=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(d=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(d){if(!(typeof d!="function"||t.wait))return t.wait=!0,Promise.resolve().then(d).finally(()=>{t.wait=!1})}function s(d=!t.active){t.active=d}return(d,l)=>(i.openBlock(),i.createElementBlock("div",ir,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",sr,[d.label?(i.openBlock(),i.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:l[0]||(l[0]=a=>s())},i.toDisplayString(d.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.array,(a,p)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:p,onClick:c=>{o(a.callback),s(!1)}},i.toDisplayString(a.label),9,ar))),128))]),i.createElementVNode("div",cr,[i.createElementVNode("div",{class:i.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:l[1]||(l[1]=a=>s())},[t.wait?(i.openBlock(),i.createBlock(i.unref(Fe),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(i.openBlock(),i.createBlock(i.unref(Oe),{key:1,class:"widget-multi-button-side-icon"},{default:i.withCtx(()=>[i.createTextVNode("angle-small-down")]),_:1})):i.createCommentVNode("",!0)],2)])],2)]))}});const ur=M(lr,[["__scopeId","data-v-a8d711d1"]]),dr={class:"widget-loader flex flex-align_center gap_10 padding_15"},fr={class:"text_md"},pr=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",dr,[i.createVNode(Fe,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",fr,i.toDisplayString(e.label),1)]))}}),hr=["alt","src"],gr=i.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=i.ref();return i.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,o)=>(i.openBlock(),i.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,hr))}}),mr={props:{config:Array,values:Object,selected:Boolean},setup:Ft};const yr=M(mr,[["__scopeId","data-v-344a8cc1"]]),wr=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),Cr={class:"head-cell"},vr=wr(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Er=i.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(n,{emit:e}){const t=n;return t.title&&console.warn(`For cell ${t.name} using title,it should be replaced with label.`),(r,o)=>(i.openBlock(),i.createElementBlock("th",null,[i.createElementVNode("div",Cr,[i.createElementVNode("div",{class:"head-cell-content flex_grow",style:i.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(i.openBlock(),i.createBlock(i.unref(S.FormField),{key:0,type:"single-checkbox",onClick:o[0]||(o[0]=i.withModifiers(s=>e("select"),["stop","prevent"]))})):(i.openBlock(),i.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:o[1]||(o[1]=s=>e("order"))},i.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(i.openBlock(),i.createBlock(i.unref(Oe),{key:0,class:i.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:i.withCtx(()=>[i.createTextVNode("core-arrow-up")]),_:1},8,["class"])):i.createCommentVNode("",!0),vr])]))}});const _r=M(Er,[["__scopeId","data-v-4e1d87c8"]]),Sr=i.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=i.ref(),o=i.ref();i.onMounted(()=>{function a(h,g){let w=-1;do w++,g-=h[w];while(g>0&&w<h.length);return w}function p(h,g){let w=0;for(;g>0&&g>h[w]&&w<h.length;)g-=h[w],w++;return console.log(g,w),w>0?w:0}function c(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function f(h){try{o.value.style.width=h+"px",o.value.style.minWidth=h+"px",o.value.style.maxWidth=h+"px"}catch(g){console.log(g)}}function u(h){return h===null?!1:h.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(g){var Ze;function w(N){return N.screenX+E-$}const C=r.value,y=[...C.children].filter(N=>N.localName==="th"),E=((Ze=C.offsetParent)==null?void 0:Ze.scrollLeft)||0,b=y.map(N=>N.clientWidth),A=u(g.target),$=C.getBoundingClientRect().left,B=w(g),_=a(b,B),Z=b.slice(0,_).reduce((N,P)=>N+P,0),de=B-Z,Re=C.offsetWidth,Q=y[_].clientWidth;if(t.config[_].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",g.screenX),console.log("Widths",b),console.log("max width",Re),console.log("Start Position",B),console.log("Position From",_),console.log("Start Position",_),console.log("Global offset (Отступ самой таблицы от края экрана)",$),console.log("Del",de),console.groupEnd(),o.value.innerText=y[_].textContent||"",o.value.style.display="grid",o.value.style.width=Q+"px",o.value.style.cursor="grabbing",c(Z),f(Q),document.addEventListener("pointermove",Xe,{passive:!0}),document.addEventListener("pointerup",He);function He(N){if(console.group("END"),document.removeEventListener("pointermove",Xe),document.removeEventListener("pointerup",He),A&&(t.config[_].width=o.value.style.width,t.config[_].minWidth=o.value.style.width,t.config[_].maxWidth=o.value.style.width,s(t.config)),!A){const P=N.screenX+E-$;console.log("ENP Position",P);const fe=p(b,P);if(console.log(_,"->",fe),fe!==_){const ee=t.config[_],Le=t.config;Le.splice(_,1),Le.splice(fe,0,ee),s(Le)}else{const ee=t.config[_].name;d(ee)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Xe(N){if(A){const ee=w(N)-B+Q;f(ee);return}let P=N.screenX+E-$-de;P<0&&(P=0),P+Q>Re&&(P=Re-Q),c(P)}})});function s(a){e("update:config",a)}function d(a){if(!a)return;if(Array.isArray(a)){if(a.length<1)return;a=a[0]}if(t.order.length===0||t.order[0]!==a)return void l([a]);const p=t.order.length===1||t.order[1]==="asc"?"asc":"desc";l([a,p==="asc"?"desc":"asc"])}function l(a){e("update:order",a)}return(a,p)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.config,(c,f)=>(i.openBlock(),i.createBlock(_r,i.mergeProps({key:c},c,{onOrder:u=>d(c.name),onSelect:p[0]||(p[0]=u=>e("select")),order:a.order}),null,16,["onOrder","order"]))),128)),i.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:o},"test",512)],512))}});const br=M(Sr,[["__scopeId","data-v-ccffc6bd"]]),Tr={class:"widget-list"},Ar={class:"widget-list-body position_relative"},Nr=50,kr=i.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(n,{emit:e}){const t=n;function r(l,a=!0){if(t.selectedRows)if(!a)s(t.selectedRows.includes(l)?[]:[l]);else{const p=[...t.selectedRows],c=p.indexOf(l);c===-1?p.push(l):p==null||p.splice(c,1),s(p)}}function o(){var l;if(((l=t.selectedRows)==null?void 0:l.length)!==t.array.length)return s([...t.array]);s([])}function s(l){e("update:selectedRows",l)}function d(l){if(!l)return;const a=l.target;a.scrollTop+a.clientHeight+Nr>a.scrollHeight&&e("scrollEnd")}return(l,a)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[i.createElementVNode("table",Tr,[i.createElementVNode("thead",null,[i.createVNode(br,{onSelect:a[0]||(a[0]=p=>o()),"onUpdate:order":a[1]||(a[1]=p=>e("update:order",p)),"onUpdate:config":a[2]||(a[2]=p=>e("update:config",p)),config:l.config,order:l.order},null,8,["config","order"])]),i.createElementVNode("tbody",Ar,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>{var f;return i.openBlock(),i.createBlock(yr,{key:c,class:"widget-list-row",values:p,config:l.config,selected:(f=l.selectedRows)==null?void 0:f.includes(p),onSelect:u=>r(p,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function Ir(n){function e(...r){return t.wait?Promise.reject("The process has already started."):(t.wait=!0,Promise.resolve().then(()=>n(...r)).finally(()=>{t.wait=!1}))}const t=i.reactive({wait:!1,call:e});return t}function be(n){return typeof n=="string"?Me(n):Or(n)?Me(n.message):Me(G.DEFAULT_ERROR_MESSAGE)}function Or(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function Me(n){return{message:n}}function le(n="error"){return function(e){const{message:t}=be(e);Te.add(n,t)}}function qe(n,e){return $e().emit("entity:read",{...e,entity:n})}function $t(n,e){return $e().emit("entity:update",{...e,entity:n})}function Fr(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function Pt(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}function Rt(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Rt(r)),e[o]=r,e},{})}function $r(n,e){const t=new Map;return n.forEach(r=>{var s;const o=e(r);t.has(o)||t.set(o,[]),(s=t.get(o))==null||s.push(r)}),t}function Pr(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Rr(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const K=kt(It("use-socket"));function $e(){return Lr}const Lr=function(){let n=1,e;const t=new Set,r=new Set;function o(){return{safeQueue:r,requestId:n,handlers:t}}function s(u){const h=[...t.values()];K("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const w=u.requestId;(g.requestId&&g.requestId===w||!g.requestId&&g.event===u.event)&&(K("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),K("Handler was removed by *once* params was passed. %o",g)))})}function d(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){K("Connection to server was stopped: %d %s",h.code,h.reason),setTimeout(()=>d(u))},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...r.values()].forEach(h=>{l(h),r.delete(h)})},e.onerror=function(h){console.warn(h)},e.onmessage=h=>{try{const g=JSON.parse(h.data);if(!Lt(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function l(u){e.send(u)}function a(u,h){t.add({event:u,callback:h})}function p(u,h){t.add({event:u,callback:h,once:!0})}function c(){return e&&(e==null?void 0:e.readyState)===1}function f(u,h,g){const w=++n,C=JSON.stringify({requestId:w,event:u,data:h,contextId:D.contextId,url:window.location.href});return c()?l(C):(r.add(C),K("Socket is not connected. Message was send to save-queue. %s")),new Promise((y,E)=>{t.add({event:u,requestId:w,once:!0,callback:(b,A)=>{if(K("Promise was resolve with next data:",b),Dr(A))return void E(b);g&&g(b,A),y(b)}})})}return{get socket(){return e},on:a,once:p,emit:f,initialization:d,getDevInfo:o}}(),Dr=n=>!!Lt(n)&&n.event==="request-error",Lt=n=>!!n&&typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function xr(n,e){const t=i.reactive([]);let r=0;const o=i.ref(!1);function s(){if(o.value)return Promise.reject("The process has already started.");const u=c();return o.value=!0,typeof u.limit!="number"&&(u.limit=100),u.offset=r,qe(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function d(u,h){var w;const g=u.Version||((w=t.find(C=>C.Id===h))==null?void 0:w.Version);if(g===void 0)throw new Error("Object without version.");return g}function l(u,h){const g=t.findIndex(w=>w.Id===u);if(g===-1)throw new Error(`Can't found item with Id ${u}`);t.splice(g,1,h)}async function a(u,h){try{const g=c(),w=d(h,u);delete h.Version,await $t(n,{id:u,values:h,version:w});const C=await qe(n,{fields:g.fields||"",id:u});l(u,C)}catch(g){le()(g)}}async function p(){try{const u=await s();t.push(...u)}catch(u){le()(u)}}function c(){return typeof e=="function"?e():e}async function f(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){le()(u)}}return{array:t,updateById:a,next:p,reload:f,wait:o}}function Br(){function n(){return{organizations:D.organizations,currentContextId:D.contextId,person:D.person,context:D.context,contextType:D.contextType,userId:D.userId}}const e=i.reactive(n());return D.onupdateContext(()=>{Object.assign(e,n())}),e}const Te=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Vr(r),s=new Mr(e,t,o.timeout,o.children,o.click);return this.store.push(s),r.timeout&&setTimeout(this.remove.bind(this,s.id),r.timeout*1e3),s}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}};function Vr(n){function e(r){return!!r&&typeof r=="object"}const t={timeout:10,click:()=>null,children:[]};return e(n)?{timeout:n.timeout||t.timeout,click:n.click||t.click,children:n.children||t.children}:t}const Dt=class xt{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=xt.cardId++}};Dt.cardId=1;let Mr=Dt;function Ur(){return $e().emit("client:read",{})}var Bt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},jr=(n,e,t)=>(Bt(n,e,"read from private field"),t?t.call(n):e.get(n)),Wr=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},qr=(n,e,t,r)=>(Bt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const Pe=class Y extends I{constructor(){super(...arguments),this.type="front",this.organizations=[],Wr(this,Ee,!1)}set language(e){localStorage.setItem(G.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(G.LOCALSTORAGE_LANGUAGE_KEY)||Y.DEFAULT_LANGUAGE}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){qr(this,Ee,e),this.emit(Y.EVENT_READY_UPDATE,e)}get ready(){return jr(this,Ee)}onReady(e){return this.on(Y.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(Y.EVENT_CONTEXT_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.warn("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(G.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(Y.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.userId=e.userId,this.restoreCurrentContext(),this.ready=!0}catch(e){le()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(G.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(e)&&this.validateContextId(Number(e)))this.setCurrentContext(e);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Ur()}validateContextId(e){var t;try{return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};Ee=new WeakMap;Pe.DEFAULT_LANGUAGE="en";Pe.EVENT_CONTEXT_UPDATE="event:context-update";Pe.EVENT_READY_UPDATE="event:ready-update";let Gr=Pe;function zr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function F(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const o=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${o})`),e}if(zr(r)){let o=function(s){var d;return((d=s.match(/([^Z]*)/))==null?void 0:d[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${o(r.start)}`),r.end&&e.push(`@${t} le ${o(r.end)}`),e}return typeof r=="number"?(e.push(`@${t} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${t} eq '${r}'`),e):(r===null&&e.push(F.is(t,r)),e)},[]).join(" and ")}function ue(n){return typeof n=="string"?`'${n}'`:`${n}`}F.includes=function(e,t){return`@${e} Contains ${ue(t)}`};F.beginWith=function(e,t){return`@${e} BeginWith ${ue(t)}`};F.notEq=function(e,t){return`@${e} nq ${ue(t)}`};F.eq=function(e,t){return Array.isArray(t)?F.in(e,t):`@${e} eq ${ue(t)}`};F.in=function(e,t){const r=t.map(ue).join(", ");return`@${e} in (${r})`};F.and=function(...e){return e.join(" and ")};F.is=function(e,t){return`@${e} is ${t}`};F.or=function(...e){return e.join(" or ")};const D=new Gr,Kr={clickOutside:Ne,staticLink:yn,Request:m},Yr={usage:qt,utils:Xt,config:Zt,types:Qt};exports.Communication=gn;exports.ComputedMetadata=rn;exports.CoreError=O;exports.Filter=F;exports.Manager=D;exports.MetadataStore=ne;exports.NotificationSystem=Te;exports.Request=m;exports.WidgetButton=or;exports.WidgetIcon=Oe;exports.WidgetImage=gr;exports.WidgetList=kr;exports.WidgetLoader=pr;exports.WidgetMultiButton=ur;exports.WidgetSpinner=Fe;exports.WidgetTable=er;exports.actionService=Tt;exports.asyncProcess=Ir;exports.authService=T;exports.billingService=J;exports.catchUniversal=le;exports.clickOutside=Ne;exports.clientService=gt;exports.communicationService=ce;exports.configurationService=An;exports.constants=G;exports.dataService=x;exports.debounce=wn;exports.default=Yr;exports.documentsService=Tn;exports.equipmentService=Dn;exports.fileService=fn;exports.getCellValue=Nt;exports.getNamesFromListConfig=Fr;exports.groupArrayByField=$r;exports.historyService=tn;exports.internationalizationService=sn;exports.invitationService=pn;exports.metadataService=ze;exports.openService=hn;exports.parseError=be;exports.prettifyValueByMetadata=on;exports.prettyDate=Je;exports.prettyDateWithTime=Ot;exports.prettyMoney=Pt;exports.processWizardService=ye;exports.ruleValidationService=Ke;exports.t=X;exports.testTypes=en;exports.universalEntityRead=qe;exports.universalEntityUpdate=$t;exports.useCommunication=mn;exports.useFormAction=En;exports.useFormLabel=_n;exports.useFormMetadata=Cn;exports.useFormRequest=bn;exports.useFormRequestData=Sn;exports.useListActiveRow=Rr;exports.useListEntity=xr;exports.useListSearch=Nn;exports.useListSelect=In;exports.useLogger=_t;exports.useManagerState=Br;exports.useSocket=$e;exports.useWizard=Pn;exports.utils=Kr;exports.uuidv4=Pr;exports.valuesToUpperCase=Rt;exports.viewService=dn;
10
+ */const Je=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},He=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},Xe=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},Ze=function(){this.events={}};class ${constructor(){this.events={}}on(e,t){return Je.call(this,e,t)}emit(e,t){return He.call(this,e,t)}off(e,t){return Xe.call(this,e,t)}cleanEvents(){Ze.call(this)}static on(e,t){return Je.call($,e,t)}static emit(e,t){return He.call($,e,t)}static off(e,t){return Xe.call($,e,t)}static cleanEvents(){Ze.call($)}}$.events={};var pt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},de=(n,e,t)=>(pt(n,e,"read from private field"),t?t.call(n):e.get(n)),Le=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Pe=(n,e,t,r)=>(pt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ee,fe,pe;const z=class N extends ${constructor(){super(...arguments),Le(this,ee,void 0),Le(this,fe,"front"),this.organizations=[],Le(this,pe,!1)}set language(e){localStorage.setItem(N.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(N.LOCALSTORAGE_LANGUAGE_KEY)||N.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(N.LOCALSTORAGE_LANGUAGE_KEY)}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}set router(e){Pe(this,ee,e)}get router(){if(!de(this,ee))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return de(this,ee)}set type(e){Pe(this,fe,e)}get type(){return de(this,fe)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Pe(this,pe,e),this.emit(N.EVENT_READY_UPDATE,e)}get ready(){return de(this,pe)}onReady(e){return this.on(N.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(N.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(N.EVENT_DATA_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.log("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(N.CURRENT_CONTEXT_KEY,String(e)),this.emit(N.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.user=e.user,this.ready=!0;const t=Number.parseInt(localStorage.getItem(N.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{Be.add("error",L.ApiNotAvailable().message)}}loadCustomerData(){return ut.getClientData()}async updateFullClientData(){return this.init()}validateContextId(e){var t;return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}getListKeyById(e){return console.log("DEPRECATED"),`list-information-${e}`}getListInformationFromLocalStorage(e){console.log("DEPRECATED");const t=localStorage.getItem(this.getListKeyById(e));return t&&JSON.parse(t)}setListInformationToLocalStorage(e,t){console.log("DEPRECATED"),localStorage.setItem(this.getListKeyById(e),JSON.stringify(t))}};ee=new WeakMap;fe=new WeakMap;pe=new WeakMap;z.DEFAULT_LANGUAGE="en";z.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";z.EVENT_CONTEXT_UPDATE="event:context-update";z.EVENT_READY_UPDATE="event:ready-update";z.EVENT_DATA_UPDATE="event:data-update";z.CURRENT_CONTEXT_KEY="CurrentContext";let Wt=z;const Qe=new Wt;function qt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return lt}})}function y(n,e={}){return Qe.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Qe.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw L.ApiNotAvailable()}).then(t=>qt(t).then(r=>{if(!t.ok)throw r;return r}))}class Te{constructor(){}static parseNamesFromListConfig(e){let t=Te.parseFieldsToGraphQL(e.reduce((o,s)=>(s.name&&o.push(s.name),o),[]));function r(o){let s="";for(let d in o)typeof o[d]=="boolean"?s+=` ${d} `:s+=` ${d} { ${r(o[d])} }`;return s}return r(t)}static parseSortFromListConfig(e){let t={};for(let r in e)t[r]=e[r]?"ASC":"DESC";return t}static parseFieldsToGraphQL(e){function t(r,o){if(o.includes(".")){const s=o.indexOf("."),d=o.substring(s+1),c=o.substring(0,s);c in r||(r[c]={}),t(r[c],d)}else r[o]=!0;return r}return e.reduce(t,{})}}class Gt{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,t,r)=>(t!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[t]=r,!0)}),window._journal=this}get error(){return{add:(...e)=>{this.errors.push(e)},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")}}const ht=new Gt;function gt(n){return n&&n[0].toLowerCase()+n.slice(1)}function je(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=je(r)),e[o]=r,e},{})}function zt(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const yt={Request:y,clickOutside:be,getPropFromObject:Se,runPromiseQueue:at,GraphQL:Te,firstChapterToLowerCase:gt,valuesToUpperCase:je,prettyMoney:zt},Kt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:Te,Journal:ht,Request:y,clickOutside:be,default:yt,firstChapterToLowerCase:gt,getPropFromObject:Se,runPromiseQueue:at,valuesToUpperCase:je},Symbol.toStringTag,{value:"Module"}));function mt(n,e=""){for(let t in n){if(typeof n[t]=="object"){mt(n[t],(e.length?`${e}-`:"")+t);continue}let r="--"+((e.length?`${e}-`:"")+t).replace(/([A-Z])/g,o=>`-${o}`.toLowerCase());document.documentElement.style.setProperty(r,n[t])}}const V={};function Yt(n){for(let e in n)V[e]=n[e];n.styles&&mt(n.styles),ht.welcome(),console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white"),window._config=V}const Jt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));const Ht=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Xt{static readHistoryById(e,t){return y(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const o=r.history.map(s=>{if(!s.changes)return s;const d=s.changes.map(c=>({...c,oldValue:c.originalValue,name:c.fieldName}));return{...s,changes:d}});return{...r,history:o}})}}class Zt extends ${constructor(){super(),this.EVENT_NEW="event:new-metadata",this.store={}}get(e){return this.store[e]}async load(e){return this.store[e]||this.set(e,await this.loadEntityInformation(e)),this.store[e]}set(e,t){this.store[e]=t,this.emit(this.EVENT_NEW,{entityName:e})}async loadEntityInformation(e){return await vt.get(e)}}const te=new Zt;function Qt(n){const e=i.ref(te.get(n));return te.on(te.EVENT_NEW,t=>{n===t.entityName&&(e.value=te.get(n))}),e}function en(n,e){try{return e.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(t){wt().error("prettify value by metadata",n,t)}}class tn{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return y(`/open-api/internationalization/language/${e}`)}}let q={};function H(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=k.utils.getPropFromObject((this==null?void 0:this.vocabulary)||q,n);if(typeof t=="string")return et(t,e);const r=k.utils.getPropFromObject(q==null?void 0:q.root,n);return typeof r=="string"?et(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function et(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}H.setGlobalVocabulary=function(n){q=n};H.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),H.bind({vocabulary:k.utils.getPropFromObject(q,e.toLowerCase())})};H.setVocabulary=function(n){return typeof n=="string"&&(n=k.utils.getPropFromObject(q,n)),H.bind({vocabulary:n})};const nn=function(){let n=!1;const e=[];function t(){return n}function r(l,p){t()&&console[l](...p),e.push(p)}function o(...l){r("log",l)}function s(...l){r("warn",l)}function d(...l){r("error",l)}function c(l=!0){n=l}return{info:o,warn:s,history:e,display:c,error:d}}();function wt(){return nn}class b{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw L.AuthServiceError(e.title,t)}static login(e){return y(V.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:V.applicationName})}).catch(b.parseError)}static registration(e){return e.AppName=V.applicationName,y(V.identityServerURL+"/api/Authenticate/Registration",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)}).catch(b.parseError)}static parseProcessAnswer(e){if(e.statusCode>4)throw L.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return b.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return b.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return b.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return b.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return y(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(b.parseError)}static startLoginProcess(e){return b.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return b.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return b.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return y(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(b.parseError).then(b.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw L.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}}function rn(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const on="masterId",sn="masterEntity";function Ee(n,e){if(!Array.isArray(e))return;if(rn(e))return t(e);e.forEach(t);function t(r){n.append(sn,r[0]),n.append(on,r[1].toString())}}class G{static async anonymousGetList(e){return await y(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(o,s)=>r.append(o,s),r=new URLSearchParams;if(e.fields){const o=e.fields;typeof o=="string"?t("fields",o):Array.isArray(o)?t("fields",o.join(" ")):typeof o=="object"&&t("fields",Object.keys(o).join(" "))}if(e.order){let o=e.order;const d=(Array.isArray(o)?[o]:Object.entries(o)).map(([c,l="desc"])=>`@${c} ${l}`).join(",");t("order",d)}return e.limit&&t("limit",e.limit.toString()),e.offset&&t("offset",e.offset.toString()),e.filter&&t("filter",e.filter.toString()),e.useUsageContext&&r.append("useUsageContext",e.useUsageContext.toString()),r}static async getList(e,t){const r=G.getSearchParamsForEntityListRead(t||{});return await y(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=G.getSearchParamsForEntityListRead(t||{});return y(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const o=new URLSearchParams;return Ee(o,r==null?void 0:r.masterEntities),y(`/close-api/data/${e}?${o.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,o={}){return y(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const o=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),o.append("fields",s.join(" "))}return y(`/close-api/data/entities/${e}/id/${t}?${o.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,o){const s=new URLSearchParams;return Ee(s,o==null?void 0:o.masterEntities),y(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:o==null?void 0:o.version})})}static removeById(e,t,r){const o=typeof t=="number"?{Id:t}:t;return G.removeByKeys(e,o,r)}static removeByKeys(e,t,r){return y(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const Ct=class ne{static async create(e){return y(ne.url,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}static async read(e){const t=new URLSearchParams({targetCode:String(e.targetCode),entityName:e.entity.name,entityCatalogId:e.entity.catalogId});return y(ne.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return y(`${ne.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return y(`${ne.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};Ct.url="/close-api/communications";let se=Ct;class an{static async getDefaultView(e){return y("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function tt(n){return{...n,createdEntities:n.createdEntites}}const Et=class he{static async getStartConfig(e,t){return y([he.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return y([he.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(tt)}static async runStep(e,t,r,o,s){return y([he.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:o,values:s})}).then(tt)}};Et.url="/close-api/views/process-wizard";let ge=Et;class vt{static get url(){return"/close-api/metadata"}static async get(e,t,r){console.warn("GETTING METADATA BY DEPRECATED METHOD."),console.trace();const o=new URLSearchParams;return t&&o.append("criteria",t),r&&o.append("id",String(r)),await fetch(this.url+`/${e}?${o.toString()}`,{method:"GET"}).then(s=>s.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return Ee(o,r),t&&o.append("id",t),y([this.url,e].join("/")+`?${o.toString()}`)}static getFieldInformation(e,t){return y(`/open-api/metadata/${e}/fields/${t}`)}static getTreatmentListField(e,t){return y(`/open-api/metadata/${e}/list-fields/${t}`)}}class cn{static async upload(e,t){const r=new FormData;r.append("file",e);const o=`/close-api/files?entityName=${t}`;return await fetch(o,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class ln{static invite(e,t,r){return y("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:t,relatedRoleCode:r})})}static accept(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!0})})}static decline(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class We{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return y(We.url+e,{method:"POST",body:JSON.stringify(t)})}}class un{static getConfiguration(){return y("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class dn{static url(){return"/close-api/actions"}static async get({criterion:e}){const t=new URLSearchParams;return e&&t.append("criterion",e),await fetch(this.url()+`?${t.toString()}`,{method:"GET"}).then(r=>r.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return Ee(o,r),y([this.url(),e,t].join("/")+`?${o.toString()}`,{method:"GET"})}}class fn extends ${constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return se.createMessage({talkId:this.id,text:e})}static checkAndGenerate(e){return se.read(e).then(t=>t.length===0?se.create(e):t[0])}}function pn(n){const e=k.Form.getParentForm();e?e.subscribe(n):console.warn(L.ParentFormNotFound());const t=i.reactive([]);return n.read=()=>se.readMessages(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function hn(n,e="images"){return`/static-folder/${e}/${n}`}function gn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function yn(n,e){const t=i.reactive({ready:!1,show:!1});function r(){t.ready=!1,t.show=!1}return n.read=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw L.EntityWithoutName("Use Form Request");return G.readById(n.name,o.id,{fields:o.fields})}).then(yt.valuesToUpperCase).then(s=>(s.hasOwnProperty("Version")&&(n.version=Number(s.Version)),n.setValues(s),t.show=!0,s)).catch(s=>{const d=Ye(s);throw Be.add("error",d.message),d}).finally(()=>{t.ready=!0})},n.save=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw L.EntityWithoutName("Use Form Request");return G.updateById(n.name,o.id,n.changes,{version:n.version})}).then(s=>{n.version=s.version||s.Version}).catch(s=>{const d=Ye(s);throw Be.add("error",d.message),d})},n.on(k.Form.EVENT_SAVE,n.read.bind(n)),{shadowFormState:t,initShadow:r}}class mn{static getRequiredDocuments(e,t,r){const o=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${o.toString()}`).then(s=>s.json())}}class J{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${J.url()}/calculator/${e}`)}static calculate(e,t){return y(`/${J.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:t})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):L.ApiNotAvailable()})}static parseMetadataField(e){function t(r){switch(r.type){case"ValueType":switch(r.dataType){case"Integer":return"number";default:return r.dataType}case"EntityReference":return r.dataType}}return{name:e.name,label:e.title,required:e.required,type:t(e)}}static createOnlinePayment(e,t){return y(`/${J.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return y(`/${J.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class wn{static getListSettings(e,t){const r=new URLSearchParams;r.set("entity",e),t&&r.set("mark",t);const o=`/close-api/views/list/configs?${r.toString()}`;return y(o)}}var _t=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},P=(n,e,t)=>(_t(n,e,"read from private field"),t?t.call(n):e.get(n)),M=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},j=(n,e,t,r)=>(_t(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ye,re,me,we,oe,ie,Ve;const W="_______LIST_______ROW_______INDEX________NAME_______",ke=class D extends ${constructor(e){super(),this.LIST_ROW_KEY=1,M(this,ye,void 0),this.array=[],M(this,re,[]),M(this,me,[]),M(this,we,new Proxy({},{set:(t,r,o,s)=>(t[r]=o,this.emit(D.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(D.EVENT_FILTERS_UPDATE,t),!0)})),M(this,oe,!1),M(this,ie,(...t)=>Promise),M(this,Ve,()=>{}),j(this,ye,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&j(this,re,e.config)}set config(e){j(this,re,e.map(k.utils.copyObject)),this.emitUpdateConfig()}get config(){return P(this,re)}emitUpdateConfig(){this.emit(D.EVENT_CONFIG_UPDATE,this.config)}get order(){return P(this,me)}set order(e){j(this,me,e),this.emit(D.EVENT_ORDER_UPDATE,this.order)}get filters(){return P(this,we)}set filters(e){En(P(this,we),e)}set wait(e){j(this,oe,e),this.emit(k.Form.EVENT_WAIT,P(this,oe))}get wait(){return P(this,oe)}get primaryKeys(){return P(this,ye)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[W]===e)}indexByKey(e){return this.array.findIndex(t=>t[W]===e)}static getKey(e){return e[W]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,W)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(D.EVENT_DATA,this.array)}set(e){this.array=[],this.add(...e)}removeByKey(e){const t=this.indexByKey(e);t!==-1&&(this.array.splice(t,1),this.emit(D.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(D.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[W]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,W)}set read(e){j(this,ie,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=P(this,ie).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){j(this,ie,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>P(this,Ve).call(this)).finally(()=>this.wait=!1)}static GetFieldNames(e){return e.reduce((t,r)=>(r.name&&(typeof r.name=="string"?t.push(r.name):t.push(...r.name)),t),[])}static mergeWithKey(e,t){return{...e,[W]:t}}static getCellName(e){return typeof e.name=="string"?e.name:Array.isArray(e.name)?e.name[0]:null}static getCellInfo(e,t){const r=D.getCellName(e),o=(()=>{let s=r?Se(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:o}}};ye=new WeakMap;re=new WeakMap;me=new WeakMap;we=new WeakMap;oe=new WeakMap;ie=new WeakMap;Ve=new WeakMap;ke.EVENT_DATA="list-data: update";ke.EVENT_CONFIG_UPDATE="list-config:update";ke.EVENT_ORDER_UPDATE="list-order:update";ke.EVENT_FILTERS_UPDATE="list-filters:update";function Cn(n){const e=i.ref(""),t=i.computed(()=>{const r=e.value.toLowerCase();return i.unref(n).filter(o=>e.value.length?Object.values(o).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function En(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function vn(n){const e=i.reactive([]);function t(c){return e.includes(c)}function r(c){t(c)||e.push(c)}function o(c){const l=e.findIndex(p=>p===c);l!==-1&&e.splice(l,1)}function s(c){const l=i.unref(n);if(c===void 0){e.length===0?l.forEach(r):l.forEach(o);return}t(c)?o(c):r(c)}const d=i.computed(()=>{const c=i.unref(n);return e.length===c.length&&c.length!==0});return[e,s,d,r,o]}function _n(n){return n.statusName==="Completed"}function Sn(n){return n.statusName==="FinalStepWithConfirmation"}function bn(n){return n.statusName==="ValidationError"}function Tn(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],d=null;const c=i.ref(null);function l(){c.value=s.find(m=>m.name===d)||null}function p(){var m;return d?((m=s.find(v=>v.name===d))==null?void 0:m.fields)||[]:[]}function a(m){if(l(),bn(m))return void t.onValidation(m.validationResults);if((m.statusName==="FinalStep"||m.statusName==="NextStep")&&(!p().length||kn(p(),t.presets)))return C(t.presets||{});_n(m)&&t.onCompleted(m),Sn(m)&&t.onConfirmation(m)}async function f(){try{await u(),await w()}catch(m){const{message:v}=ve(m);_e.add("error",v)}}function u(){return o.wait="Loading process information.",ge.getStartConfig(e,n).then(m=>{s=m.steps.map(v=>({label:v.title,name:v.stepName,number:v.number,fields:v.frontendEntity.objectTypes.reduce((S,T)=>(T.properties.forEach(F=>{S.push({name:F.name,label:F.title,type:F.refEntityName||F.dataType})}),S),[])}))}).then(m=>(o.wait=!1,m))}function h(m){return d=m.nextStepName,r=m.token,m}function g(m){const v=ve(m);_e.add("error",v.message)}function w(){return o.wait="Starting process",ge.startProcess(e,n).then(h).then(a).catch(g).finally(()=>{o.wait=null})}function C(m={}){return!r||!d?Promise.reject("Not step or token."):(o.wait="Expect the result",ge.runStep(e,n,d,r,m).then(h).then(a).catch(g).finally(()=>{o.wait=!1}))}return{initialize:f,state:o,currentStepConfig:i.readonly(c),next:C}}function kn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!k.utils.getPropFromObject(e,r.name))return!1}return!0}const An="close-api/proxy/Equipment/Search";class Nn{static search(e,t,r,o,s){const d=new URLSearchParams;d.append("pattern",e||""),t&&d.append("categoryId",t),r&&d.append("useType",String(r)),o&&d.append("statusCode",o),s&&(d.append("limit",String(s.limit)),d.append("offset",String(s.offset)));const c=`/${An}?${d.toString()}`;return y(c,{method:"GET",headers:{"Content-Type":"application/json"}})}}const On={class:"widget-table__head"},$n={class:"widget-table__head-label margin_0 text_overflow"},In=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",On,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.config,(r,o)=>(i.openBlock(),i.createElementBlock("th",{class:"widget-table__head-cell",key:o},[i.createElementVNode("p",$n,i.toDisplayString(r.label),1)]))),128))]))}});const U=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Fn=U(In,[["__scopeId","data-v-25198f4a"]]);function Rn(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function St(n,e){const t=Rn(n);let r=t?k.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function Ln(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ue={exports:{}},De,nt;function Pn(){if(nt)return De;nt=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;De=function(a,f){f=f||{};var u=typeof a;if(u==="string"&&a.length>0)return d(a);if(u==="number"&&isFinite(a))return f.long?l(a):c(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function d(a){if(a=String(a),!(a.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(f){var u=parseFloat(f[1]),h=(f[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*t;case"minutes":case"minute":case"mins":case"min":case"m":return u*e;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function c(a){var f=Math.abs(a);return f>=r?Math.round(a/r)+"d":f>=t?Math.round(a/t)+"h":f>=e?Math.round(a/e)+"m":f>=n?Math.round(a/n)+"s":a+"ms"}function l(a){var f=Math.abs(a);return f>=r?p(a,f,r,"day"):f>=t?p(a,f,t,"hour"):f>=e?p(a,f,e,"minute"):f>=n?p(a,f,n,"second"):a+" ms"}function p(a,f,u,h){var g=f>=u*1.5;return Math.round(a/u)+" "+h+(g?"s":"")}return De}function Dn(n){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=o,t.enabled=d,t.humanize=Pn(),t.destroy=p,Object.keys(n).forEach(a=>{t[a]=n[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let f=0;for(let u=0;u<a.length;u++)f=(f<<5)-f+a.charCodeAt(u),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(a){let f,u=null,h,g;function w(...C){if(!w.enabled)return;const m=w,v=Number(new Date),S=v-(f||v);m.diff=S,m.prev=f,m.curr=v,f=v,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let T=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(B,_)=>{if(B==="%%")return"%";T++;const X=t.formatters[_];if(typeof X=="function"){const le=C[T];B=X.call(m,le),C.splice(T,1),T--}return B}),t.formatArgs.call(m,C),(m.log||t.log).apply(m,C)}return w.namespace=a,w.useColors=t.useColors(),w.color=t.selectColor(a),w.extend=r,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(a)),g),set:C=>{u=C}}),typeof t.init=="function"&&t.init(w),w}function r(a,f){const u=t(this.namespace+(typeof f>"u"?":":f)+a);return u.log=this.log,u}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let f;const u=(typeof a=="string"?a:"").split(/[\s,]+/),h=u.length;for(f=0;f<h;f++)u[f]&&(a=u[f].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...t.names.map(c),...t.skips.map(c).map(f=>"-"+f)].join(",");return t.enable(""),a}function d(a){if(a[a.length-1]==="*")return!0;let f,u;for(f=0,u=t.skips.length;f<u;f++)if(t.skips[f].test(a))return!1;for(f=0,u=t.names.length;f<u;f++)if(t.names[f].test(a))return!0;return!1}function c(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var xn=Dn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=d(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;l.splice(1,0,p,"color: inherit");let a=0,f=0;l[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(a++,u==="%c"&&(f=a))}),l.splice(f,0,p)}e.log=console.debug||console.log||(()=>{});function o(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function s(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function d(){try{return localStorage}catch{}}n.exports=xn(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}})(Ue,Ue.exports);var Bn=Ue.exports;const bt=Ln(Bn);function Tt(n){return["eservices-core",n].join(":")}function kt(n){return qe(n,"YYYY/MM/DD HH:mm:ss")}function qe(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return Dt.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const Vn={props:{name:String},setup(n,e){let t="unknown";try{t=e.slots.default()[0].children}catch{t=n.name}typeof t!="string"&&console.warn(`Name for Icon.vue is not string. ${t}`);try{t=t.replace(/\s+/g,"")}catch{}return()=>i.h("i",{class:`icon icon-${t}`})}},Ae=U(Vn,[["__scopeId","data-v-e287c8d9"]]),Un=bt(Tt("setup-list-row"));function Mn(n,e){const t=n.config.map(r=>jn(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function jn(n,e,t){const r=e.values;let o=St(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(a){s.onClick.push(()=>a(r))}function c(a){Array.isArray(a)?s.class.push(...a):s.class.push(a)}const l=[],p=[];if(n.hide&&n.hide(r))return[i.h("td")];if(n.type)switch(c(`widget-table-cell_${n.type}`),n.type){case"number":{typeof o=="number"&&(o=new Intl.NumberFormat().format(o));break}case"date":{o=qe(typeof o=="string"?o:null);break}case"dateTime":case"dateWithTime":{o=kt(typeof o=="string"?o:null);break}case"money":{o=Ot(o);break}case"multi-select":{p.push(i.h(k.FormField,{type:"single-checkbox",modelValue:e.selected})),d(rt.bind(null,t,!0));break}case"select":{p.push(i.h(k.FormField,{type:"single-radio",modelValue:e.selected})),d(rt.bind(null,t,!1));break}}if(n.onClick&&d(n.onClick),n.link)try{const a=n.link(r);if(a){const f=i.h(Pt.RouterLink,{to:a});p.push(f),c("widget-table-cell_link")}}catch(a){Un("Can't add router link",a)}return n.href&&(p.push(i.h("a",{href:n.href(r),target:"_blank"})),c("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&p.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&p.push(i.h(Ae,{name:n.icon})),n.class&&(typeof n.class=="function"?c(n.class(r)):c(n.class)),l.push(i.h("td",s,p)),l}function rt(n,e){n.emit("select",e)}function At(n,e){return()=>{try{return Mn(n,e)}catch(t){return console.warn(t),null}}}const Wn={props:{values:Object,config:Object,selected:Boolean},setup:At},qn=["colspan"],ot=i.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=i.ref();return i.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,o)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[i.createElementVNode("td",{colspan:r.rowLength},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.component),i.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:o[0]||(o[0]=s=>e("close")),onSave:o[1]||(o[1]=s=>e("save",s))}),null,16,["values","new"]))],8,qn)],512))}}),x={LIST_ACTIVE_NEW:"list-active-new",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"},Gn={class:"widget-table"},it="update:selectedRows",zn=i.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{}},emits:["update:activeRow","save"],setup(n,{emit:e}){const t=n,r=i.useSlots(),o=i.computed(()=>{var c;return(c=r==null?void 0:r.default)==null?void 0:c.call(r)[0]});function s(c,l=!0){if(!t.selectedRows)return;if(!l)return e(it,t.selectedRows.includes(c)?[]:[c]);const p=[...t.selectedRows],a=p.indexOf(c);return a===-1?p.push(c):p.splice(a,1),e(it,p)}function d(c){e("save",c),e("update:activeRow",null)}return(c,l)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",Gn,[i.createVNode(Fn,{config:c.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(p,a)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:a},[i.createVNode(Wn,{config:c.config,values:p,selected:c.selectedRows.includes(p),onSelect:f=>s(p,f),class:i.normalizeClass(c.classCallback?c.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&c.activeRow===p?(i.openBlock(),i.createBlock(ot,{key:0,component:o.value,"row-length":c.config.length,values:p,onClose:l[0]||(l[0]=f=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),c.activeRow===i.unref(x).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(ot,{key:0,component:o.value,"row-length":c.config.length,onClose:l[1]||(l[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),Kn=i.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{class:"widget-spinner",style:i.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const Ne=U(Kn,[["__scopeId","data-v-0ef9ae88"]]),Yn={class:"widget-button"},Jn=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",Yn,[e.wait?(i.openBlock(),i.createBlock(Ne,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const Hn=U(Jn,[["__scopeId","data-v-450dc564"]]),Xn={class:"widget-multi-button-wrap position_relative cursor_pointer"},Zn={class:"widget-multi-button-body grid"},Qn=["onClick"],er={class:"widget-multi-button-side-wrap"},tr=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(d=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(d){if(!(typeof d!="function"||t.wait))return t.wait=!0,Promise.resolve().then(d).finally(()=>{t.wait=!1})}function s(d=!t.active){t.active=d}return(d,c)=>(i.openBlock(),i.createElementBlock("div",Xn,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",Zn,[d.label?(i.openBlock(),i.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:c[0]||(c[0]=l=>s())},i.toDisplayString(d.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.array,(l,p)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:p,onClick:a=>{o(l.callback),s(!1)}},i.toDisplayString(l.label),9,Qn))),128))]),i.createElementVNode("div",er,[i.createElementVNode("div",{class:i.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:c[1]||(c[1]=l=>s())},[t.wait?(i.openBlock(),i.createBlock(i.unref(Ne),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(i.openBlock(),i.createBlock(i.unref(Ae),{key:1,class:"widget-multi-button-side-icon"},{default:i.withCtx(()=>[i.createTextVNode("angle-small-down")]),_:1})):i.createCommentVNode("",!0)],2)])],2)]))}});const nr=U(tr,[["__scopeId","data-v-a8d711d1"]]),rr={class:"widget-loader flex flex-align_center gap_10 padding_15"},or={class:"text_md"},ir=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",rr,[i.createVNode(Ne,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",or,i.toDisplayString(e.label),1)]))}}),sr=["alt","src"],ar=i.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=i.ref();return i.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,o)=>(i.openBlock(),i.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,sr))}}),cr={props:{config:Array,values:Object,selected:Boolean},setup:At};const lr=U(cr,[["__scopeId","data-v-344a8cc1"]]),ur=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),dr={class:"head-cell"},fr=ur(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),pr=i.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(n,{emit:e}){const t=n;return t.title&&console.warn(`For cell ${t.name} using title,it should be replaced with label.`),(r,o)=>(i.openBlock(),i.createElementBlock("th",null,[i.createElementVNode("div",dr,[i.createElementVNode("div",{class:"head-cell-content flex_grow",style:i.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(i.openBlock(),i.createBlock(i.unref(k.FormField),{key:0,type:"single-checkbox",onClick:o[0]||(o[0]=i.withModifiers(s=>e("select"),["stop","prevent"]))})):(i.openBlock(),i.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:o[1]||(o[1]=s=>e("order"))},i.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(i.openBlock(),i.createBlock(i.unref(Ae),{key:0,class:i.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:i.withCtx(()=>[i.createTextVNode("core-arrow-up")]),_:1},8,["class"])):i.createCommentVNode("",!0),fr])]))}});const hr=U(pr,[["__scopeId","data-v-4e1d87c8"]]),gr=i.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=i.ref(),o=i.ref();i.onMounted(()=>{function l(h,g){let w=-1;do w++,g-=h[w];while(g>0&&w<h.length);return w}function p(h,g){let w=0;for(;g>0&&g>h[w]&&w<h.length;)g-=h[w],w++;return console.log(g,w),w>0?w:0}function a(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function f(h){try{o.value.style.width=h+"px",o.value.style.minWidth=h+"px",o.value.style.maxWidth=h+"px"}catch(g){console.log(g)}}function u(h){return h===null?!1:h.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(g){var Ke;function w(A){return A.screenX+v-F}const C=r.value,m=[...C.children].filter(A=>A.localName==="th"),v=((Ke=C.offsetParent)==null?void 0:Ke.scrollLeft)||0,S=m.map(A=>A.clientWidth),T=u(g.target),F=C.getBoundingClientRect().left,B=w(g),_=l(S,B),X=S.slice(0,_).reduce((A,R)=>A+R,0),le=B-X,Ie=C.offsetWidth,Z=m[_].clientWidth;if(t.config[_].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",g.screenX),console.log("Widths",S),console.log("max width",Ie),console.log("Start Position",B),console.log("Position From",_),console.log("Start Position",_),console.log("Global offset (Отступ самой таблицы от края экрана)",F),console.log("Del",le),console.groupEnd(),o.value.innerText=m[_].textContent||"",o.value.style.display="grid",o.value.style.width=Z+"px",o.value.style.cursor="grabbing",a(X),f(Z),document.addEventListener("pointermove",ze,{passive:!0}),document.addEventListener("pointerup",Ge);function Ge(A){if(console.group("END"),document.removeEventListener("pointermove",ze),document.removeEventListener("pointerup",Ge),T&&(t.config[_].width=o.value.style.width,t.config[_].minWidth=o.value.style.width,t.config[_].maxWidth=o.value.style.width,s(t.config)),!T){const R=A.screenX+v-F;console.log("ENP Position",R);const ue=p(S,R);if(console.log(_,"->",ue),ue!==_){const Q=t.config[_],Fe=t.config;Fe.splice(_,1),Fe.splice(ue,0,Q),s(Fe)}else{const Q=t.config[_].name;d(Q)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function ze(A){if(T){const Q=w(A)-B+Z;f(Q);return}let R=A.screenX+v-F-le;R<0&&(R=0),R+Z>Ie&&(R=Ie-Z),a(R)}})});function s(l){e("update:config",l)}function d(l){if(!l)return;if(Array.isArray(l)){if(l.length<1)return;l=l[0]}if(t.order.length===0||t.order[0]!==l)return void c([l]);const p=t.order.length===1||t.order[1]==="asc"?"asc":"desc";c([l,p==="asc"?"desc":"asc"])}function c(l){e("update:order",l)}return(l,p)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.config,(a,f)=>(i.openBlock(),i.createBlock(hr,i.mergeProps({key:a},a,{onOrder:u=>d(a.name),onSelect:p[0]||(p[0]=u=>e("select")),order:l.order}),null,16,["onOrder","order"]))),128)),i.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:o},"test",512)],512))}});const yr=U(gr,[["__scopeId","data-v-ccffc6bd"]]),mr={class:"widget-list"},wr={class:"widget-list-body position_relative"},Cr=50,Er=i.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(n,{emit:e}){const t=n;function r(c,l=!0){if(t.selectedRows)if(!l)s(t.selectedRows.includes(c)?[]:[c]);else{const p=[...t.selectedRows],a=p.indexOf(c);a===-1?p.push(c):p==null||p.splice(a,1),s(p)}}function o(){var c;if(((c=t.selectedRows)==null?void 0:c.length)!==t.array.length)return s([...t.array]);s([])}function s(c){e("update:selectedRows",c)}function d(c){if(!c)return;const l=c.target;l.scrollTop+l.clientHeight+Cr>l.scrollHeight&&e("scrollEnd")}return(c,l)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[i.createElementVNode("table",mr,[i.createElementVNode("thead",null,[i.createVNode(yr,{onSelect:l[0]||(l[0]=p=>o()),"onUpdate:order":l[1]||(l[1]=p=>e("update:order",p)),"onUpdate:config":l[2]||(l[2]=p=>e("update:config",p)),config:c.config,order:c.order},null,8,["config","order"])]),i.createElementVNode("tbody",wr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(p,a)=>{var f;return i.openBlock(),i.createBlock(lr,{key:a,class:"widget-list-row",values:p,config:c.config,selected:(f=c.selectedRows)==null?void 0:f.includes(p),onSelect:u=>r(p,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function vr(n){function e(...r){return t.wait?Promise.reject("The process has already started."):(t.wait=!0,Promise.resolve().then(()=>n(...r)).finally(()=>{t.wait=!1}))}const t=i.reactive({wait:!1,call:e});return t}function ve(n){return typeof n=="string"?xe(n):_r(n)?xe(n.message):xe(x.DEFAULT_ERROR_MESSAGE)}function _r(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function xe(n){return{message:n}}function ae(n="error"){return function(e){const{message:t}=ve(e);_e.add(n,t)}}function Me(n,e){return Oe().emit("entity:read",{...e,entity:n})}function Nt(n,e){return Oe().emit("entity:update",{...e,entity:n})}function Sr(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function Ot(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}function $t(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=$t(r)),e[o]=r,e},{})}function br(n,e){const t=new Map;return n.forEach(r=>{var s;const o=e(r);t.has(o)||t.set(o,[]),(s=t.get(o))==null||s.push(r)}),t}function Tr(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function kr(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return x.DEFAULT_ERROR_MESSAGE}})}function Ar(n,e={}){return O.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=O.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw new Error(x.DEFAULT_ERROR_MESSAGE)}).then(t=>kr(t).then(r=>{if(!t.ok)throw r;return r}))}function Nr(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const K=bt(Tt("use-socket"));function Oe(){return Or}const Or=function(){let n=1,e;const t=new Set,r=new Set;function o(){return{safeQueue:r,requestId:n,handlers:t}}function s(u){const h=[...t.values()];K("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const w=u.requestId;(g.requestId&&g.requestId===w||!g.requestId&&g.event===u.event)&&(K("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),K("Handler was removed by *once* params was passed. %o",g)))})}function d(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){K("Connection to server was stopped: %d %s",h.code,h.reason),setTimeout(()=>d(u))},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...r.values()].forEach(h=>{c(h),r.delete(h)})},e.onerror=function(h){console.warn(h)},e.onmessage=h=>{try{const g=JSON.parse(h.data);if(!It(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function c(u){e.send(u)}function l(u,h){t.add({event:u,callback:h})}function p(u,h){t.add({event:u,callback:h,once:!0})}function a(){return e&&(e==null?void 0:e.readyState)===1}function f(u,h,g){const w=++n,C=JSON.stringify({requestId:w,event:u,data:h,contextId:O.contextId,url:window.location.href});return a()?c(C):(r.add(C),K("Socket is not connected. Message was send to save-queue. %s")),new Promise((m,v)=>{t.add({event:u,requestId:w,once:!0,callback:(S,T)=>{if(K("Promise was resolve with next data:",S),$r(T))return void v(S);g&&g(S,T),m(S)}})})}return{get socket(){return e},on:l,once:p,emit:f,initialization:d,getDevInfo:o}}(),$r=n=>!!It(n)&&n.event==="request-error",It=n=>!!n&&typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function Ir(n,e){const t=i.reactive([]);let r=0;const o=i.ref(!1);function s(){if(o.value)return Promise.reject("The process has already started.");const u=a();return o.value=!0,typeof u.limit!="number"&&(u.limit=100),u.offset=r,Me(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function d(u,h){var w;const g=u.Version||((w=t.find(C=>C.Id===h))==null?void 0:w.Version);if(g===void 0)throw new Error("Object without version.");return g}function c(u,h){const g=t.findIndex(w=>w.Id===u);if(g===-1)throw new Error(`Can't found item with Id ${u}`);t.splice(g,1,h)}async function l(u,h){try{const g=a(),w=d(h,u);delete h.Version,await Nt(n,{id:u,values:h,version:w});const C=await Me(n,{fields:g.fields||"",id:u});c(u,C)}catch(g){ae()(g)}}async function p(){try{const u=await s();t.push(...u)}catch(u){ae()(u)}}function a(){return typeof e=="function"?e():e}async function f(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){ae()(u)}}return{array:t,updateById:l,next:p,reload:f,wait:o}}function Fr(){function n(){return{organizations:O.organizations,currentContextId:O.contextId,person:O.person,context:O.context,contextType:O.contextType,userId:O.userId}}const e=i.reactive(n());return O.onupdateContext(()=>{Object.assign(e,n())}),e}const _e=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Rr(r),s=new Lr(e,t,o.timeout,o.children,o.click);return this.store.push(s),r.timeout&&setTimeout(this.remove.bind(this,s.id),r.timeout*1e3),s}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}};function Rr(n){function e(r){return!!r&&typeof r=="object"}const t={timeout:10,click:()=>null,children:[]};return e(n)?{timeout:n.timeout||t.timeout,click:n.click||t.click,children:n.children||t.children}:t}const Ft=class Rt{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=Rt.cardId++}};Ft.cardId=1;let Lr=Ft;function Pr(){return Oe().emit("client:read",{})}var Lt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Dr=(n,e,t)=>(Lt(n,e,"read from private field"),t?t.call(n):e.get(n)),xr=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Br=(n,e,t,r)=>(Lt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ce;const $e=class Y extends ${constructor(){super(...arguments),this.type="front",this.organizations=[],xr(this,Ce,!1)}set language(e){localStorage.setItem(x.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(x.LOCALSTORAGE_LANGUAGE_KEY)||Y.DEFAULT_LANGUAGE}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Br(this,Ce,e),this.emit(Y.EVENT_READY_UPDATE,e)}get ready(){return Dr(this,Ce)}onReady(e){return this.on(Y.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(Y.EVENT_CONTEXT_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.warn("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(x.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(Y.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.userId=e.userId,this.restoreCurrentContext(),this.ready=!0}catch(e){ae()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(x.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(e)&&this.validateContextId(Number(e)))this.setCurrentContext(e);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Pr()}validateContextId(e){var t;try{return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};Ce=new WeakMap;$e.DEFAULT_LANGUAGE="en";$e.EVENT_CONTEXT_UPDATE="event:context-update";$e.EVENT_READY_UPDATE="event:ready-update";let Vr=$e;function Ur(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function I(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const o=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${o})`),e}if(Ur(r)){let o=function(s){var d;return((d=s.match(/([^Z]*)/))==null?void 0:d[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${o(r.start)}`),r.end&&e.push(`@${t} le ${o(r.end)}`),e}return typeof r=="number"?(e.push(`@${t} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${t} eq '${r}'`),e):(r===null&&e.push(I.is(t,r)),e)},[]).join(" and ")}function ce(n){return typeof n=="string"?`'${n}'`:`${n}`}I.includes=function(e,t){return`@${e} Contains ${ce(t)}`};I.beginWith=function(e,t){return`@${e} BeginWith ${ce(t)}`};I.notEq=function(e,t){return`@${e} nq ${ce(t)}`};I.eq=function(e,t){return Array.isArray(t)?I.in(e,t):`@${e} eq ${ce(t)}`};I.in=function(e,t){const r=t.map(ce).join(", ");return`@${e} in (${r})`};I.and=function(...e){return e.join(" and ")};I.is=function(e,t){return`@${e} is ${t}`};I.or=function(...e){return e.join(" or ")};const O=new Vr,Mr={clickOutside:be,staticLink:hn,Request:y},jr={usage:Ut,utils:Kt,config:Yt,types:Jt};exports.Communication=fn;exports.ComputedMetadata=Qt;exports.CoreError=L;exports.Filter=I;exports.Manager=O;exports.MetadataStore=te;exports.NotificationSystem=_e;exports.Request=y;exports.WidgetButton=Hn;exports.WidgetIcon=Ae;exports.WidgetImage=ar;exports.WidgetList=Er;exports.WidgetLoader=ir;exports.WidgetMultiButton=nr;exports.WidgetSpinner=Ne;exports.WidgetTable=zn;exports.actionService=dn;exports.asyncProcess=vr;exports.authService=b;exports.billingService=J;exports.catchUniversal=ae;exports.clickOutside=be;exports.clientService=ut;exports.communicationService=se;exports.configurationService=wn;exports.constants=x;exports.dataService=G;exports.debounce=gn;exports.default=jr;exports.documentsService=mn;exports.equipmentService=Nn;exports.fileService=cn;exports.getCellValue=St;exports.getNamesFromListConfig=Sr;exports.groupArrayByField=br;exports.historyService=Xt;exports.internationalizationService=tn;exports.invitationService=ln;exports.metadataService=vt;exports.openService=un;exports.parseError=ve;exports.prettifyValueByMetadata=en;exports.prettyDate=qe;exports.prettyDateWithTime=kt;exports.prettyMoney=Ot;exports.processWizardService=ge;exports.request=Ar;exports.ruleValidationService=We;exports.t=H;exports.testTypes=Ht;exports.universalEntityRead=Me;exports.universalEntityUpdate=Nt;exports.useCommunication=pn;exports.useFormRequest=yn;exports.useListActiveRow=Nr;exports.useListEntity=Ir;exports.useListSearch=Cn;exports.useListSelect=vn;exports.useLogger=wt;exports.useManagerState=Fr;exports.useSocket=Oe;exports.useWizard=Tn;exports.utils=Mr;exports.uuidv4=Tr;exports.valuesToUpperCase=$t;exports.viewService=an;
11
11
  //# sourceMappingURL=eservices-core.cjs.js.map