eservices-core 1.3.33 → 1.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eservices-core.cjs.js +4 -4
- package/dist/eservices-core.es.js +596 -628
- package/dist/eservices-core.umd.js +5 -5
- package/dist/frontend/core/classes/MetadataStore.d.ts +2 -2
- package/dist/frontend/core/hooks/use-form-metadata.d.ts +1 -53
- package/dist/frontend/core/index.d.ts +4 -11
- package/dist/frontend/src/classes/Metadata.d.ts +1 -1
- package/dist/frontend/src/index.d.ts +2 -1
- package/dist/frontend/src/methods/pretty-value-field-by-entity.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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.
|
|
3
|
+
* eservices-core v1.3.34
|
|
4
4
|
* (c) 2023 ESERVICES
|
|
5
|
-
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),O=require("jenesius-vue-form")
|
|
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.`)}};
|
|
5
|
+
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),O=require("jenesius-vue-form"),$t=require("vue-router"),It=require("date-and-time");function Ft(n,e){return!!n&&n===e||"password is not equal"}function ct(n){return Number(n.replace(/[^0-9.]/g,""))}function Rt(n,e=null){let r=String(ct(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 Lt=Object.freeze(Object.defineProperty({__proto__:null,numeric:ct,prettyNumeric:Rt,validPassword:Ft},Symbol.toStringTag,{value:"Module"})),Pt={inputs:Lt};function be(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?be(n[r],e.substr(t+1)):void 0}return n[e]}function Te(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 lt(n){return n.reduce((e,t)=>e.then(r=>t==null?void 0:t(r)),Promise.resolve())}const ut=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.`)}};ut.ID=0;let x=ut;const Dt="Please try again later or submit a feedback if problem doesn't go.";class dt{static getClientData(){return y("/close-api/client-content")}static getNavigation(){return y("/close-api/client/navigation")}}const xt=new class{constructor(){this.store=i.reactive([])}add(e,t,{children:r,timeout:o=10,click:s=()=>{}}={}){const p=new Bt(e,t,o,r||[],s);return this.store.push(p),o&&setTimeout(this.remove.bind(this,p.id),o*1e3),p}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.")}},ft=class pt{constructor(e,t,r,o,s){this.type=e,this.msg=t,this.timeout=r,this.children=o,this.click=s,this.id=pt.cardId++}};ft.cardId=1;let Bt=ft;/*!
|
|
7
7
|
* jenesius-event-emitter v1.0.2
|
|
8
8
|
* (c) 2022 Jenesius
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/const Ye=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},Je=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},He=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},Xe=function(){this.events={}};class ${constructor(){this.events={}}on(e,t){return Ye.call(this,e,t)}emit(e,t){return Je.call(this,e,t)}off(e,t){return He.call(this,e,t)}cleanEvents(){Xe.call(this)}static on(e,t){return Ye.call($,e,t)}static emit(e,t){return Je.call($,e,t)}static off(e,t){return He.call($,e,t)}static cleanEvents(){Xe.call($)}}$.events={};var pt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},fe=(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),te,pe,he;const K=class k extends ${constructor(){super(...arguments),Le(this,te,void 0),Le(this,pe,"front"),this.organizations=[],Le(this,he,!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){Pe(this,te,e)}get router(){if(!fe(this,te))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return fe(this,te)}set type(e){Pe(this,pe,e)}get type(){return fe(this,pe)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Pe(this,he,e),this.emit(k.EVENT_READY_UPDATE,e)}get ready(){return fe(this,he)}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{Vt.add("error",x.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))}};te=new WeakMap;pe=new WeakMap;he=new WeakMap;K.DEFAULT_LANGUAGE="en";K.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";K.EVENT_CONTEXT_UPDATE="event:context-update";K.EVENT_READY_UPDATE="event:ready-update";K.EVENT_DATA_UPDATE="event:data-update";K.CURRENT_CONTEXT_KEY="CurrentContext";let jt=K;const Ze=new jt;function Wt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return Mt}})}function m(n,e={}){return Ze.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Ze.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw x.ApiNotAvailable()}).then(t=>Wt(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 p in o)typeof o[p]=="boolean"?s+=` ${p} `:s+=` ${p} { ${r(o[p])} }`;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("."),p=o.substring(s+1),c=o.substring(0,s);c in r||(r[c]={}),t(r[c],p)}else r[o]=!0;return r}return e.reduce(t,{})}}class qt{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 qt;function gt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Ve(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=Ve(r)),e[o]=r,e},{})}function Gt(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 zt={Request:m,clickOutside:Ae,getPropFromObject:Te,runPromiseQueue:ct,GraphQL:ke,firstChapterToLowerCase:gt,valuesToUpperCase:Ve,prettyMoney:Gt},Kt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:ke,Journal:ht,Request:m,clickOutside:Ae,default:zt,firstChapterToLowerCase:gt,getPropFromObject:Te,runPromiseQueue:ct,valuesToUpperCase:Ve},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 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 p=s.changes.map(c=>({...c,oldValue:c.originalValue,name:c.fieldName}));return{...s,changes:p}});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 Et.get(e)}}const ne=new Zt;function Qt(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 en(n,e){try{return e.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(t){yt().error("prettify value by metadata",n,t)}}class tn{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return m(`/open-api/internationalization/language/${e}`)}}let G={};function X(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=O.utils.getPropFromObject((this==null?void 0:this.vocabulary)||G,n);if(typeof t=="string")return Qe(t,e);const r=O.utils.getPropFromObject(G==null?void 0:G.root,n);return typeof r=="string"?Qe(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function Qe(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}X.setGlobalVocabulary=function(n){G=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:O.utils.getPropFromObject(G,e.toLowerCase())})};X.setVocabulary=function(n){return typeof n=="string"&&(n=O.utils.getPropFromObject(G,n)),X.bind({vocabulary:n})};const nn=function(){let n=!1;const e=[];function t(){return n}function r(l,f){t()&&console[l](...f),e.push(f)}function o(...l){r("log",l)}function s(...l){r("warn",l)}function p(...l){r("error",l)}function c(l=!0){n=l}return{info:o,warn:s,history:e,display:c,error:p}}();function yt(){return nn}class b{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw x.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(b.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(b.parseError)}static parseProcessAnswer(e){if(e.statusCode>4)throw x.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 m(`${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 m(`${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 x.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 ve(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 ae{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 p=(Array.isArray(o)?[o]:Object.entries(o)).map(([c,l="desc"])=>`@${c} ${l}`).join(",");t("order",p)}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=ae.getSearchParamsForEntityListRead(t||{});return await m(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=ae.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 ve(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 ve(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 ae.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 Ct=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"}})}};Ct.url="/close-api/communications";let an=Ct;class cn{static async getDefaultView(e){return m("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function et(n){return{...n,createdEntities:n.createdEntites}}const wt=class ge{static async getStartConfig(e,t){return m([ge.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return m([ge.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(et)}static async runStep(e,t,r,o,s){return m([ge.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:o,values:s})}).then(et)}};wt.url="/close-api/views/process-wizard";let me=wt;class Et{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 ve(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 ln{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 un{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 Ue{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return m(Ue.url+e,{method:"POST",body:JSON.stringify(t)})}}class dn{static getConfiguration(){return m("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class fn{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 ve(o,r),m([this.url(),e,t].join("/")+`?${o.toString()}`,{method:"GET"})}}function pn(n,e="images"){return`/static-folder/${e}/${n}`}class hn{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 H{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${H.url()}/calculator/${e}`)}static calculate(e,t){return m(`/${H.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]):x.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(`/${H.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return m(`/${H.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class gn{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 vt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},P=(n,e,t)=>(vt(n,e,"read from private field"),t?t.call(n):e.get(n)),j=(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)},W=(n,e,t,r)=>(vt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ye,oe,Ce,we,ie,se,Be;const q="_______LIST_______ROW_______INDEX________NAME_______",Ne=class D extends ${constructor(e){super(),this.LIST_ROW_KEY=1,j(this,ye,void 0),this.array=[],j(this,oe,[]),j(this,Ce,[]),j(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)})),j(this,ie,!1),j(this,se,(...t)=>Promise),j(this,Be,()=>{}),W(this,ye,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&W(this,oe,e.config)}set config(e){W(this,oe,e.map(O.utils.copyObject)),this.emitUpdateConfig()}get config(){return P(this,oe)}emitUpdateConfig(){this.emit(D.EVENT_CONFIG_UPDATE,this.config)}get order(){return P(this,Ce)}set order(e){W(this,Ce,e),this.emit(D.EVENT_ORDER_UPDATE,this.order)}get filters(){return P(this,we)}set filters(e){yn(P(this,we),e)}set wait(e){W(this,ie,e),this.emit(O.Form.EVENT_WAIT,P(this,ie))}get wait(){return P(this,ie)}get primaryKeys(){return P(this,ye)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[q]===e)}indexByKey(e){return this.array.findIndex(t=>t[q]===e)}static getKey(e){return e[q]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,q)}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,[q]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,q)}set read(e){W(this,se,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=P(this,se).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){W(this,se,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>P(this,Be).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,[q]: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?Te(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:o}}};ye=new WeakMap;oe=new WeakMap;Ce=new WeakMap;we=new WeakMap;ie=new WeakMap;se=new WeakMap;Be=new WeakMap;Ne.EVENT_DATA="list-data: update";Ne.EVENT_CONFIG_UPDATE="list-config:update";Ne.EVENT_ORDER_UPDATE="list-order:update";Ne.EVENT_FILTERS_UPDATE="list-filters:update";function mn(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 yn(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function Cn(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(f=>f===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 p=i.computed(()=>{const c=i.unref(n);return e.length===c.length&&c.length!==0});return[e,s,p,r,o]}function wn(n){return n.statusName==="Completed"}function En(n){return n.statusName==="FinalStepWithConfirmation"}function vn(n){return n.statusName==="ValidationError"}function _n(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],p=null;const c=i.ref(null);function l(){c.value=s.find(y=>y.name===p)||null}function f(){var y;return p?((y=s.find(v=>v.name===p))==null?void 0:y.fields)||[]:[]}function a(y){if(l(),vn(y))return void t.onValidation(y.validationResults);if((y.statusName==="FinalStep"||y.statusName==="NextStep")&&(!f().length||Sn(f(),t.presets)))return w(t.presets||{});wn(y)&&t.onCompleted(y),En(y)&&t.onConfirmation(y)}async function d(){try{await u(),await C()}catch(y){const{message:v}=_e(y);be.add("error",v)}}function u(){return o.wait="Loading process information.",me.getStartConfig(e,n).then(y=>{s=y.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(y=>(o.wait=!1,y))}function h(y){return p=y.nextStepName,r=y.token,y}function g(y){const v=_e(y);be.add("error",v.message)}function C(){return o.wait="Starting process",me.startProcess(e,n).then(h).then(a).catch(g).finally(()=>{o.wait=null})}function w(y={}){return!r||!p?Promise.reject("Not step or token."):(o.wait="Expect the result",me.runStep(e,n,p,r,y).then(h).then(a).catch(g).finally(()=>{o.wait=!1}))}return{initialize:d,state:o,currentStepConfig:i.readonly(c),next:w}}function Sn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!O.utils.getPropFromObject(e,r.name))return!1}return!0}const bn="close-api/proxy/Equipment/Search";class Tn{static search(e,t,r,o,s){const p=new URLSearchParams;p.append("pattern",e||""),t&&p.append("categoryId",t),r&&p.append("useType",String(r)),o&&p.append("statusCode",o),s&&(p.append("limit",String(s.limit)),p.append("offset",String(s.offset)));const c=`/${bn}?${p.toString()}`;return m(c,{method:"GET",headers:{"Content-Type":"application/json"}})}}const An={class:"widget-table__head"},kn={class:"widget-table__head-label margin_0 text_overflow"},Nn=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",An,[(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",kn,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},On=U(Nn,[["__scopeId","data-v-25198f4a"]]);function In(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function _t(n,e){const t=In(n);let r=t?O.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function $n(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Me={exports:{}},De,tt;function Rn(){if(tt)return De;tt=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;De=function(a,d){d=d||{};var u=typeof a;if(u==="string"&&a.length>0)return p(a);if(u==="number"&&isFinite(a))return d.long?l(a):c(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function p(a){if(a=String(a),!(a.length>100)){var d=/^(-?(?:\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(d){var u=parseFloat(d[1]),h=(d[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 d=Math.abs(a);return d>=r?Math.round(a/r)+"d":d>=t?Math.round(a/t)+"h":d>=e?Math.round(a/e)+"m":d>=n?Math.round(a/n)+"s":a+"ms"}function l(a){var d=Math.abs(a);return d>=r?f(a,d,r,"day"):d>=t?f(a,d,t,"hour"):d>=e?f(a,d,e,"minute"):d>=n?f(a,d,n,"second"):a+" ms"}function f(a,d,u,h){var g=d>=u*1.5;return Math.round(a/u)+" "+h+(g?"s":"")}return De}function Fn(n){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=o,t.enabled=p,t.humanize=Rn(),t.destroy=f,Object.keys(n).forEach(a=>{t[a]=n[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let d=0;for(let u=0;u<a.length;u++)d=(d<<5)-d+a.charCodeAt(u),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(a){let d,u=null,h,g;function C(...w){if(!C.enabled)return;const y=C,v=Number(new Date),S=v-(d||v);y.diff=S,y.prev=d,y.curr=v,d=v,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let T=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(M,_)=>{if(M==="%%")return"%";T++;const Z=t.formatters[_];if(typeof Z=="function"){const ue=w[T];M=Z.call(y,ue),w.splice(T,1),T--}return M}),t.formatArgs.call(y,w),(y.log||t.log).apply(y,w)}return C.namespace=a,C.useColors=t.useColors(),C.color=t.selectColor(a),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(a)),g),set:w=>{u=w}}),typeof t.init=="function"&&t.init(C),C}function r(a,d){const u=t(this.namespace+(typeof d>"u"?":":d)+a);return u.log=this.log,u}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let d;const u=(typeof a=="string"?a:"").split(/[\s,]+/),h=u.length;for(d=0;d<h;d++)u[d]&&(a=u[d].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(d=>"-"+d)].join(",");return t.enable(""),a}function p(a){if(a[a.length-1]==="*")return!0;let d,u;for(d=0,u=t.skips.length;d<u;d++)if(t.skips[d].test(a))return!1;for(d=0,u=t.names.length;d<u;d++)if(t.names[d].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 f(){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 Ln=Fn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=p(),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 f="color: "+this.color;l.splice(1,0,f,"color: inherit");let a=0,d=0;l[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(a++,u==="%c"&&(d=a))}),l.splice(d,0,f)}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 p(){try{return localStorage}catch{}}n.exports=Ln(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(Me,Me.exports);var Pn=Me.exports;const St=$n(Pn);function bt(n){return["eservices-core",n].join(":")}function Tt(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 Lt.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const Dn={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=U(Dn,[["__scopeId","data-v-e287c8d9"]]),xn=St(bt("setup-list-row"));function Bn(n,e){const t=n.config.map(r=>Mn(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function Mn(n,e,t){const r=e.values;let o=_t(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function p(a){s.onClick.push(()=>a(r))}function c(a){Array.isArray(a)?s.class.push(...a):s.class.push(a)}const l=[],f=[];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=je(typeof o=="string"?o:null);break}case"dateTime":case"dateWithTime":{o=Tt(typeof o=="string"?o:null);break}case"money":{o=kt(o);break}case"multi-select":{f.push(i.h(O.FormField,{type:"single-checkbox",modelValue:e.selected})),p(nt.bind(null,t,!0));break}case"select":{f.push(i.h(O.FormField,{type:"single-radio",modelValue:e.selected})),p(nt.bind(null,t,!1));break}}if(n.onClick&&p(n.onClick),n.link)try{const a=n.link(r);if(a){const d=i.h(Ft.RouterLink,{to:a});f.push(d),c("widget-table-cell_link")}}catch(a){xn("Can't add router link",a)}return n.href&&(f.push(i.h("a",{href:n.href(r),target:"_blank"})),c("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&f.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&f.push(i.h(Oe,{name:n.icon})),n.class&&(typeof n.class=="function"?c(n.class(r)):c(n.class)),l.push(i.h("td",s,f)),l}function nt(n,e){n.emit("select",e)}function At(n,e){return()=>{try{return Bn(n,e)}catch(t){return console.warn(t),null}}}const Vn={props:{values:Object,config:Object,selected:Boolean},setup:At},Un=["colspan"],rt=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,Un)],512))}}),N={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",DELAY_SOCKET_RECONNECT:100,PROVIDE_NAME_METADATA:"provide-metadata-config"},jn={class:"widget-table"},ot="update:selectedRows",Wn=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(ot,t.selectedRows.includes(c)?[]:[c]);const f=[...t.selectedRows],a=f.indexOf(c);return a===-1?f.push(c):f.splice(a,1),e(ot,f)}function p(c){e("save",c),e("update:activeRow",null)}return(c,l)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",jn,[i.createVNode(On,{config:c.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(f,a)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:a},[i.createVNode(Vn,{config:c.config,values:f,selected:c.selectedRows.includes(f),onSelect:d=>s(f,d),class:i.normalizeClass(c.classCallback?c.classCallback(f):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&c.activeRow===f?(i.openBlock(),i.createBlock(rt,{key:0,component:o.value,"row-length":c.config.length,values:f,onClose:l[0]||(l[0]=d=>e("update:activeRow",null)),onSave:p,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),c.activeRow===i.unref(N).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(rt,{key:0,component:o.value,"row-length":c.config.length,onClose:l[1]||(l[1]=f=>e("update:activeRow",null)),onSave:p,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),qn=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 Ie=U(qn,[["__scopeId","data-v-0ef9ae88"]]),Gn={class:"widget-button"},zn=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",Gn,[e.wait?(i.openBlock(),i.createBlock(Ie,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const Kn=U(zn,[["__scopeId","data-v-450dc564"]]),Yn={class:"widget-multi-button-wrap position_relative cursor_pointer"},Jn={class:"widget-multi-button-body grid"},Hn=["onClick"],Xn={class:"widget-multi-button-side-wrap"},Zn=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(p=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(p){if(!(typeof p!="function"||t.wait))return t.wait=!0,Promise.resolve().then(p).finally(()=>{t.wait=!1})}function s(p=!t.active){t.active=p}return(p,c)=>(i.openBlock(),i.createElementBlock("div",Yn,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",Jn,[p.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(p.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.array,(l,f)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:f,onClick:a=>{o(l.callback),s(!1)}},i.toDisplayString(l.label),9,Hn))),128))]),i.createElementVNode("div",Xn,[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(Ie),{key:0,class:"widget-multi-button-side-spinner"})):p.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 Qn=U(Zn,[["__scopeId","data-v-a8d711d1"]]),er={class:"widget-loader flex flex-align_center gap_10 padding_15"},tr={class:"text_md"},nr=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",er,[i.createVNode(Ie,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",tr,i.toDisplayString(e.label),1)]))}}),rr=["alt","src"],or=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,rr))}}),ir={props:{config:Array,values:Object,selected:Boolean},setup:At};const sr=U(ir,[["__scopeId","data-v-344a8cc1"]]),ar=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),cr={class:"head-cell"},lr=ar(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),ur=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(O.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),lr])]))}});const dr=U(ur,[["__scopeId","data-v-4e1d87c8"]]),fr=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 C=-1;do C++,g-=h[C];while(g>0&&C<h.length);return C}function f(h,g){let C=0;for(;g>0&&g>h[C]&&C<h.length;)g-=h[C],C++;return console.log(g,C),C>0?C:0}function a(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function d(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 C(A){return A.screenX+v-F}const w=r.value,y=[...w.children].filter(A=>A.localName==="th"),v=((Ke=w.offsetParent)==null?void 0:Ke.scrollLeft)||0,S=y.map(A=>A.clientWidth),T=u(g.target),F=w.getBoundingClientRect().left,M=C(g),_=l(S,M),Z=S.slice(0,_).reduce((A,L)=>A+L,0),ue=M-Z,Re=w.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",S),console.log("max width",Re),console.log("Start Position",M),console.log("Position From",_),console.log("Start Position",_),console.log("Global offset (Отступ самой таблицы от края экрана)",F),console.log("Del",ue),console.groupEnd(),o.value.innerText=y[_].textContent||"",o.value.style.display="grid",o.value.style.width=Q+"px",o.value.style.cursor="grabbing",a(Z),d(Q),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 L=A.screenX+v-F;console.log("ENP Position",L);const de=f(S,L);if(console.log(_,"->",de),de!==_){const ee=t.config[_],Fe=t.config;Fe.splice(_,1),Fe.splice(de,0,ee),s(Fe)}else{const ee=t.config[_].name;p(ee)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function ze(A){if(T){const ee=C(A)-M+Q;d(ee);return}let L=A.screenX+v-F-ue;L<0&&(L=0),L+Q>Re&&(L=Re-Q),a(L)}})});function s(l){e("update:config",l)}function p(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 f=t.order.length===1||t.order[1]==="asc"?"asc":"desc";c([l,f==="asc"?"desc":"asc"])}function c(l){e("update:order",l)}return(l,f)=>(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,d)=>(i.openBlock(),i.createBlock(dr,i.mergeProps({key:a},a,{onOrder:u=>p(a.name),onSelect:f[0]||(f[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 pr=U(fr,[["__scopeId","data-v-ccffc6bd"]]),hr={class:"widget-list"},gr={class:"widget-list-body position_relative"},mr=50,yr=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 f=[...t.selectedRows],a=f.indexOf(c);a===-1?f.push(c):f==null||f.splice(a,1),s(f)}}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 p(c){if(!c)return;const l=c.target;l.scrollTop+l.clientHeight+mr>l.scrollHeight&&e("scrollEnd")}return(c,l)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:p},[i.createElementVNode("table",hr,[i.createElementVNode("thead",null,[i.createVNode(pr,{onSelect:l[0]||(l[0]=f=>o()),"onUpdate:order":l[1]||(l[1]=f=>e("update:order",f)),"onUpdate:config":l[2]||(l[2]=f=>e("update:config",f)),config:c.config,order:c.order},null,8,["config","order"])]),i.createElementVNode("tbody",gr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(f,a)=>{var d;return i.openBlock(),i.createBlock(sr,{key:a,class:"widget-list-row",values:f,config:c.config,selected:(d=c.selectedRows)==null?void 0:d.includes(f),onSelect:u=>r(f,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function Cr(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 _e(n){return typeof n=="string"?xe(n):wr(n)?xe(n.message):xe(N.DEFAULT_ERROR_MESSAGE)}function wr(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function xe(n){return{message:n}}function z(n="error"){return function(e){const{message:t}=_e(e);be.add(n,t)}}function Se(n,e){return B().emit("entity:read",{...e,entity:n})}function We(n,e){return B().emit("entity:update",{...e,entity:n})}function Er(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function kt(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 qe(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=qe(r)),e[o]=r,e},{})}function vr(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 _r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Sr(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return N.DEFAULT_ERROR_MESSAGE}})}function br(n,e={}){return I.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=I.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw new Error(N.DEFAULT_ERROR_MESSAGE)}).then(t=>Sr(t).then(r=>{if(!t.ok)throw r;return r}))}function Tr(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Nt(n,e){let t=!1;return(...r)=>{if(!t)return t=!0,setTimeout(()=>t=!1,e),n(...r)}}function Ar(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const Y=St(bt("use-socket"));function B(){return kr}const kr=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()];Y("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const C=u.requestId;(g.requestId&&g.requestId===C||!g.requestId&&g.event===u.event)&&(Y("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),Y("Handler was removed by *once* params was passed. %o",g)))})}function p(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){Y("Connection to server was stopped: %d %s",h.code,h.reason),Nt(()=>p(u),N.DELAY_SOCKET_RECONNECT)},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(!Ot(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 f(u,h){t.add({event:u,callback:h,once:!0})}function a(){return e&&(e==null?void 0:e.readyState)===1}function d(u,h,g){const C=++n,w=JSON.stringify({requestId:C,event:u,data:h,contextId:I.contextId,url:window.location.href});return a()?c(w):(r.add(w),Y("Socket is not connected. Message was send to save-queue. %s")),new Promise((y,v)=>{t.add({event:u,requestId:C,once:!0,callback:(S,T)=>{if(Y("Promise was resolve with next data:",S),Nr(T))return void v(S);g&&g(S,T),y(S)}})})}return{get socket(){return e},on:l,once:f,emit:d,initialization:p,getDevInfo:o}}(),Nr=n=>!!Ot(n)&&n.event==="request-error",Ot=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 Or(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,Se(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function p(u,h){var C;const g=u.Version||((C=t.find(w=>w.Id===h))==null?void 0:C.Version);if(g===void 0)throw new Error("Object without version.");return g}function c(u,h){const g=t.findIndex(C=>C.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(),C=p(h,u);delete h.Version,await We(n,{id:u,values:h,version:C});const w=await Se(n,{fields:g.fields||"",id:u});c(u,w)}catch(g){z()(g)}}async function f(){try{const u=await s();t.push(...u)}catch(u){z()(u)}}function a(){return typeof e=="function"?e():e}async function d(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){z()(u)}}return{array:t,updateById:l,next:f,reload:d,wait:o}}function Ir(){function n(){return{organizations:I.organizations,currentContextId:I.contextId,person:I.person,context:I.context,contextType:I.contextType,userId:I.userId}}const e=i.reactive(n());return I.onupdateContext(()=>{Object.assign(e,n())}),e}function $r(n,e,t){return B().emit("communication:create",{entityName:n,entityCatalogId:e,targetCode:t})}function Rr(n,e,t){return B().emit("communication:read",{entityName:n,entityCatalogId:e,targetCode:t})}function Fr(n,e){return B().emit("communication-message:create",{communicationId:n,text:e})}function Lr(n){return B().emit("communication-message:read",{communicationId:n})}function Pr(n){const e=O.Form.getParentForm(),t=i.reactive([]);return e&&e.subscribe(n),n.read=()=>Lr(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function Dr(n,e){n.read=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw x.EntityWithoutName(n);return Se(n.name,r)}).then(qe).then(o=>(o.hasOwnProperty("Version")&&(n.version=o.Version),n.setValues(o),o)).catch(z())},n.save=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw x.EntityWithoutName(n);return We(n.name,{id:r.id,values:n.changes,version:n.version})}).then(o=>{n.version=o.version}).catch(o=>{throw z()(o),o})};function t(){return typeof e=="function"?e():e}}function xr(n,e){return B().emit("metadata:read",{...e,entity:n})}class ce{constructor(){this.state=i.reactive({})}set(e,t,r){this.state[ce.getKey(e,t)]=r}get(e,t){return this.state[ce.getKey(e,t)]}getByKey(e){return this.state[e]}update(e,t){return xr(e,t).then(this.set.bind(this,e,t))}static getKey(e,t){const r={entity:e,entityId:t.id,masterEntities:Br(t.masterEntities)};return JSON.stringify(r)}}function Br(n){return!n||!Array.isArray(n)?[]:n.length===0?[]:Mr(n)?[n]:n}function Mr(n){return!!n&&Array.isArray(n)&&typeof n[0]=="string"&&typeof n[1]=="number"}function Vr(n,e){if(!n)return i.inject(N.PROVIDE_NAME_METADATA);const t=i.ref(null),r=i.computed(()=>t.value?st.getByKey(t.value):null);i.provide(N.PROVIDE_NAME_METADATA,r);function o(){if(!n)throw new Error("Entity is not provided for metadata.");t.value=ce.getKey(n,it(e||{}))}const s=function(){return o(),st.update(n,it(e||{}))};return o(),{state:r,update:s}}function it(n){return typeof n=="function"?n():n}const be=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Ur(r),s=new jr(e,t,o.timeout,o.children,o.click);return this.store.push(s),o.timeout&&setTimeout(this.remove.bind(this,s.id),o.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 Ur(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 It=class $t{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=$t.cardId++}};It.cardId=1;let jr=It;class Wr extends ${constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return Fr(this.id,e)}static checkAndGenerate(e,t,r){return Rr(e,t,r).then(o=>o.length===0?$r(e,t,r):o[0])}}function qr(){return B().emit("client:read",{})}var Rt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Gr=(n,e,t)=>(Rt(n,e,"read from private field"),t?t.call(n):e.get(n)),zr=(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)},Kr=(n,e,t,r)=>(Rt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const $e=class J extends ${constructor(){super(...arguments),this.type="front",this.organizations=[],zr(this,Ee,!1)}set language(e){localStorage.setItem(N.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(N.LOCALSTORAGE_LANGUAGE_KEY)||J.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){Kr(this,Ee,e),this.emit(J.EVENT_READY_UPDATE,e)}get ready(){return Gr(this,Ee)}onReady(e){return this.on(J.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(J.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(N.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(J.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){z()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(N.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 qr()}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;$e.DEFAULT_LANGUAGE="en";$e.EVENT_CONTEXT_UPDATE="event:context-update";$e.EVENT_READY_UPDATE="event:ready-update";let Yr=$e;function Jr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function R(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(Jr(r)){let o=function(s){var p;return((p=s.match(/([^Z]*)/))==null?void 0:p[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(R.is(t,r)),e)},[]).join(" and ")}function le(n){return typeof n=="string"?`'${n}'`:`${n}`}R.includes=function(e,t){return`@${e} Contains ${le(t)}`};R.beginWith=function(e,t){return`@${e} BeginWith ${le(t)}`};R.notEq=function(e,t){return`@${e} nq ${le(t)}`};R.eq=function(e,t){return Array.isArray(t)?R.in(e,t):`@${e} eq ${le(t)}`};R.in=function(e,t){const r=t.map(le).join(", ");return`@${e} in (${r})`};R.and=function(...e){return e.join(" and ")};R.is=function(e,t){return`@${e} is ${t}`};R.or=function(...e){return e.join(" or ")};const I=new Yr,st=new ce,Hr={clickOutside:Ae,staticLink:pn,Request:m},Xr={usage:Bt,utils:Kt,config:Yt,types:Jt};exports.Communication=Wr;exports.ComputedMetadata=Qt;exports.CoreError=x;exports.Filter=R;exports.Manager=I;exports.MetadataStore=ne;exports.NotificationSystem=be;exports.Request=m;exports.WidgetButton=Kn;exports.WidgetIcon=Oe;exports.WidgetImage=or;exports.WidgetList=yr;exports.WidgetLoader=nr;exports.WidgetMultiButton=Qn;exports.WidgetSpinner=Ie;exports.WidgetTable=Wn;exports.actionService=fn;exports.asyncProcess=Cr;exports.authService=b;exports.billingService=H;exports.catchUniversal=z;exports.clickOutside=Ae;exports.clientService=ut;exports.communicationService=an;exports.configurationService=gn;exports.constants=N;exports.dataService=ae;exports.debounce=Tr;exports.default=Xr;exports.documentsService=hn;exports.equipmentService=Tn;exports.fileService=ln;exports.getCellValue=_t;exports.getNamesFromListConfig=Er;exports.groupArrayByField=vr;exports.historyService=Xt;exports.internationalizationService=tn;exports.invitationService=un;exports.metadataService=Et;exports.openService=dn;exports.parseError=_e;exports.prettifyValueByMetadata=en;exports.prettyDate=je;exports.prettyDateWithTime=Tt;exports.prettyMoney=kt;exports.processWizardService=me;exports.request=br;exports.ruleValidationService=Ue;exports.t=X;exports.testTypes=Ht;exports.throttle=Nt;exports.universalEntityRead=Se;exports.universalEntityUpdate=We;exports.useCommunication=Pr;exports.useFormEntity=Dr;exports.useListActiveRow=Ar;exports.useListEntity=Or;exports.useListSearch=mn;exports.useListSelect=Cn;exports.useLogger=yt;exports.useManagerState=Ir;exports.useMetadata=Vr;exports.useSocket=B;exports.useWizard=_n;exports.utils=Hr;exports.uuidv4=_r;exports.valuesToUpperCase=qe;exports.viewService=cn;
|
|
10
|
+
*/const He=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},Xe=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},Ze=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},Qe=function(){this.events={}};class L{constructor(){this.events={}}on(e,t){return He.call(this,e,t)}emit(e,t){return Xe.call(this,e,t)}off(e,t){return Ze.call(this,e,t)}cleanEvents(){Qe.call(this)}static on(e,t){return He.call(L,e,t)}static emit(e,t){return Xe.call(L,e,t)}static off(e,t){return Ze.call(L,e,t)}static cleanEvents(){Qe.call(L)}}L.events={};var ht=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},de=(n,e,t)=>(ht(n,e,"read from private field"),t?t.call(n):e.get(n)),Re=(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)},Le=(n,e,t,r)=>(ht(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te,fe,pe;const K=class k extends L{constructor(){super(...arguments),Re(this,te,void 0),Re(this,fe,"front"),this.organizations=[],Re(this,pe,!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){Le(this,te,e)}get router(){if(!de(this,te))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return de(this,te)}set type(e){Le(this,fe,e)}get type(){return de(this,fe)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Le(this,pe,e),this.emit(k.EVENT_READY_UPDATE,e)}get ready(){return de(this,pe)}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{xt.add("error",x.ApiNotAvailable().message)}}loadCustomerData(){return dt.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;fe=new WeakMap;pe=new WeakMap;K.DEFAULT_LANGUAGE="en";K.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";K.EVENT_CONTEXT_UPDATE="event:context-update";K.EVENT_READY_UPDATE="event:ready-update";K.EVENT_DATA_UPDATE="event:data-update";K.CURRENT_CONTEXT_KEY="CurrentContext";let Mt=K;const et=new Mt;function Vt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return Dt}})}function y(n,e={}){return et.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=et.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw x.ApiNotAvailable()}).then(t=>Vt(t).then(r=>{if(!t.ok)throw r;return r}))}class Ae{constructor(){}static parseNamesFromListConfig(e){let t=Ae.parseFieldsToGraphQL(e.reduce((o,s)=>(s.name&&o.push(s.name),o),[]));function r(o){let s="";for(let p in o)typeof o[p]=="boolean"?s+=` ${p} `:s+=` ${p} { ${r(o[p])} }`;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("."),p=o.substring(s+1),c=o.substring(0,s);c in r||(r[c]={}),t(r[c],p)}else r[o]=!0;return r}return e.reduce(t,{})}}class Ut{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 gt=new Ut;function yt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Ve(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=Ve(r)),e[o]=r,e},{})}function jt(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 Wt={Request:y,clickOutside:Te,getPropFromObject:be,runPromiseQueue:lt,GraphQL:Ae,firstChapterToLowerCase:yt,valuesToUpperCase:Ve,prettyMoney:jt},qt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:Ae,Journal:gt,Request:y,clickOutside:Te,default:Wt,firstChapterToLowerCase:yt,getPropFromObject:be,runPromiseQueue:lt,valuesToUpperCase:Ve},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 Gt(n){for(let e in n)V[e]=n[e];n.styles&&mt(n.styles),gt.welcome(),console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white"),window._config=V}const zt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Kt{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 p=s.changes.map(c=>({...c,oldValue:c.originalValue,name:c.fieldName}));return{...s,changes:p}});return{...r,history:o}})}}class Yt{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return y(`/open-api/internationalization/language/${e}`)}}let G={};function X(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=O.utils.getPropFromObject((this==null?void 0:this.vocabulary)||G,n);if(typeof t=="string")return tt(t,e);const r=O.utils.getPropFromObject(G==null?void 0:G.root,n);return typeof r=="string"?tt(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function tt(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}X.setGlobalVocabulary=function(n){G=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:O.utils.getPropFromObject(G,e.toLowerCase())})};X.setVocabulary=function(n){return typeof n=="string"&&(n=O.utils.getPropFromObject(G,n)),X.bind({vocabulary:n})};const Jt=function(){let n=!1;const e=[];function t(){return n}function r(l,f){t()&&console[l](...f),e.push(f)}function o(...l){r("log",l)}function s(...l){r("warn",l)}function p(...l){r("error",l)}function c(l=!0){n=l}return{info:o,warn:s,history:e,display:c,error:p}}();function Ht(){return Jt}class b{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw x.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 x.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 x.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}}function Xt(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const Zt="masterId",Qt="masterEntity";function Ee(n,e){if(!Array.isArray(e))return;if(Xt(e))return t(e);e.forEach(t);function t(r){n.append(Qt,r[0]),n.append(Zt,r[1].toString())}}class se{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 p=(Array.isArray(o)?[o]:Object.entries(o)).map(([c,l="desc"])=>`@${c} ${l}`).join(",");t("order",p)}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=se.getSearchParamsForEntityListRead(t||{});return await y(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=se.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 se.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 en=Ct;class tn{static async getDefaultView(e){return y("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function nt(n){return{...n,createdEntities:n.createdEntites}}const wt=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(nt)}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(nt)}};wt.url="/close-api/views/process-wizard";let ge=wt;class nn{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 rn{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 on{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 Ue{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return y(Ue.url+e,{method:"POST",body:JSON.stringify(t)})}}class sn{static getConfiguration(){return y("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class an{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"})}}function cn(n,e="images"){return`/static-folder/${e}/${n}`}class ln{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 H{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${H.url()}/calculator/${e}`)}static calculate(e,t){return y(`/${H.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]):x.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(`/${H.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return y(`/${H.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class un{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 Et=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},P=(n,e,t)=>(Et(n,e,"read from private field"),t?t.call(n):e.get(n)),j=(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)},W=(n,e,t,r)=>(Et(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ye,re,me,Ce,oe,ie,xe;const q="_______LIST_______ROW_______INDEX________NAME_______",ke=class D extends L{constructor(e){super(),this.LIST_ROW_KEY=1,j(this,ye,void 0),this.array=[],j(this,re,[]),j(this,me,[]),j(this,Ce,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)})),j(this,oe,!1),j(this,ie,(...t)=>Promise),j(this,xe,()=>{}),W(this,ye,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&W(this,re,e.config)}set config(e){W(this,re,e.map(O.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){W(this,me,e),this.emit(D.EVENT_ORDER_UPDATE,this.order)}get filters(){return P(this,Ce)}set filters(e){fn(P(this,Ce),e)}set wait(e){W(this,oe,e),this.emit(O.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[q]===e)}indexByKey(e){return this.array.findIndex(t=>t[q]===e)}static getKey(e){return e[q]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,q)}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,[q]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,q)}set read(e){W(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){W(this,ie,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>P(this,xe).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,[q]: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?be(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;Ce=new WeakMap;oe=new WeakMap;ie=new WeakMap;xe=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 dn(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 fn(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function pn(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(f=>f===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 p=i.computed(()=>{const c=i.unref(n);return e.length===c.length&&c.length!==0});return[e,s,p,r,o]}function hn(n){return n.statusName==="Completed"}function gn(n){return n.statusName==="FinalStepWithConfirmation"}function yn(n){return n.statusName==="ValidationError"}function mn(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],p=null;const c=i.ref(null);function l(){c.value=s.find(m=>m.name===p)||null}function f(){var m;return p?((m=s.find(v=>v.name===p))==null?void 0:m.fields)||[]:[]}function a(m){if(l(),yn(m))return void t.onValidation(m.validationResults);if((m.statusName==="FinalStep"||m.statusName==="NextStep")&&(!f().length||Cn(f(),t.presets)))return w(t.presets||{});hn(m)&&t.onCompleted(m),gn(m)&&t.onConfirmation(m)}async function d(){try{await u(),await C()}catch(m){const{message:v}=ve(m);Se.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 p=m.nextStepName,r=m.token,m}function g(m){const v=ve(m);Se.add("error",v.message)}function C(){return o.wait="Starting process",ge.startProcess(e,n).then(h).then(a).catch(g).finally(()=>{o.wait=null})}function w(m={}){return!r||!p?Promise.reject("Not step or token."):(o.wait="Expect the result",ge.runStep(e,n,p,r,m).then(h).then(a).catch(g).finally(()=>{o.wait=!1}))}return{initialize:d,state:o,currentStepConfig:i.readonly(c),next:w}}function Cn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!O.utils.getPropFromObject(e,r.name))return!1}return!0}const wn="close-api/proxy/Equipment/Search";class En{static search(e,t,r,o,s){const p=new URLSearchParams;p.append("pattern",e||""),t&&p.append("categoryId",t),r&&p.append("useType",String(r)),o&&p.append("statusCode",o),s&&(p.append("limit",String(s.limit)),p.append("offset",String(s.offset)));const c=`/${wn}?${p.toString()}`;return y(c,{method:"GET",headers:{"Content-Type":"application/json"}})}}const vn={class:"widget-table__head"},_n={class:"widget-table__head-label margin_0 text_overflow"},Sn=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",vn,[(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},bn=U(Sn,[["__scopeId","data-v-25198f4a"]]);function Tn(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function vt(n,e){const t=Tn(n);let r=t?O.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function An(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Be={exports:{}},Pe,rt;function kn(){if(rt)return Pe;rt=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;Pe=function(a,d){d=d||{};var u=typeof a;if(u==="string"&&a.length>0)return p(a);if(u==="number"&&isFinite(a))return d.long?l(a):c(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function p(a){if(a=String(a),!(a.length>100)){var d=/^(-?(?:\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(d){var u=parseFloat(d[1]),h=(d[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 d=Math.abs(a);return d>=r?Math.round(a/r)+"d":d>=t?Math.round(a/t)+"h":d>=e?Math.round(a/e)+"m":d>=n?Math.round(a/n)+"s":a+"ms"}function l(a){var d=Math.abs(a);return d>=r?f(a,d,r,"day"):d>=t?f(a,d,t,"hour"):d>=e?f(a,d,e,"minute"):d>=n?f(a,d,n,"second"):a+" ms"}function f(a,d,u,h){var g=d>=u*1.5;return Math.round(a/u)+" "+h+(g?"s":"")}return Pe}function Nn(n){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=o,t.enabled=p,t.humanize=kn(),t.destroy=f,Object.keys(n).forEach(a=>{t[a]=n[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let d=0;for(let u=0;u<a.length;u++)d=(d<<5)-d+a.charCodeAt(u),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(a){let d,u=null,h,g;function C(...w){if(!C.enabled)return;const m=C,v=Number(new Date),S=v-(d||v);m.diff=S,m.prev=d,m.curr=v,d=v,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let T=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(M,_)=>{if(M==="%%")return"%";T++;const Z=t.formatters[_];if(typeof Z=="function"){const le=w[T];M=Z.call(m,le),w.splice(T,1),T--}return M}),t.formatArgs.call(m,w),(m.log||t.log).apply(m,w)}return C.namespace=a,C.useColors=t.useColors(),C.color=t.selectColor(a),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(a)),g),set:w=>{u=w}}),typeof t.init=="function"&&t.init(C),C}function r(a,d){const u=t(this.namespace+(typeof d>"u"?":":d)+a);return u.log=this.log,u}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let d;const u=(typeof a=="string"?a:"").split(/[\s,]+/),h=u.length;for(d=0;d<h;d++)u[d]&&(a=u[d].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(d=>"-"+d)].join(",");return t.enable(""),a}function p(a){if(a[a.length-1]==="*")return!0;let d,u;for(d=0,u=t.skips.length;d<u;d++)if(t.skips[d].test(a))return!1;for(d=0,u=t.names.length;d<u;d++)if(t.names[d].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 f(){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 On=Nn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=p(),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 f="color: "+this.color;l.splice(1,0,f,"color: inherit");let a=0,d=0;l[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(a++,u==="%c"&&(d=a))}),l.splice(d,0,f)}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 p(){try{return localStorage}catch{}}n.exports=On(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(Be,Be.exports);var $n=Be.exports;const je=An($n);function We(n){return["eservices-core",n].join(":")}function _t(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 It.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const In={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}`})}},Ne=U(In,[["__scopeId","data-v-e287c8d9"]]),Fn=je(We("setup-list-row"));function Rn(n,e){const t=n.config.map(r=>Ln(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function Ln(n,e,t){const r=e.values;let o=vt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function p(a){s.onClick.push(()=>a(r))}function c(a){Array.isArray(a)?s.class.push(...a):s.class.push(a)}const l=[],f=[];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=_t(typeof o=="string"?o:null);break}case"money":{o=bt(o);break}case"multi-select":{f.push(i.h(O.FormField,{type:"single-checkbox",modelValue:e.selected})),p(ot.bind(null,t,!0));break}case"select":{f.push(i.h(O.FormField,{type:"single-radio",modelValue:e.selected})),p(ot.bind(null,t,!1));break}}if(n.onClick&&p(n.onClick),n.link)try{const a=n.link(r);if(a){const d=i.h($t.RouterLink,{to:a});f.push(d),c("widget-table-cell_link")}}catch(a){Fn("Can't add router link",a)}return n.href&&(f.push(i.h("a",{href:n.href(r),target:"_blank"})),c("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&f.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&f.push(i.h(Ne,{name:n.icon})),n.class&&(typeof n.class=="function"?c(n.class(r)):c(n.class)),l.push(i.h("td",s,f)),l}function ot(n,e){n.emit("select",e)}function St(n,e){return()=>{try{return Rn(n,e)}catch(t){return console.warn(t),null}}}const Pn={props:{values:Object,config:Object,selected:Boolean},setup:St},Dn=["colspan"],it=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,Dn)],512))}}),N={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",DELAY_SOCKET_RECONNECT:100,PROVIDE_NAME_METADATA:"provide-metadata-config"},xn={class:"widget-table"},st="update:selectedRows",Bn=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(st,t.selectedRows.includes(c)?[]:[c]);const f=[...t.selectedRows],a=f.indexOf(c);return a===-1?f.push(c):f.splice(a,1),e(st,f)}function p(c){e("save",c),e("update:activeRow",null)}return(c,l)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",xn,[i.createVNode(bn,{config:c.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(f,a)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:a},[i.createVNode(Pn,{config:c.config,values:f,selected:c.selectedRows.includes(f),onSelect:d=>s(f,d),class:i.normalizeClass(c.classCallback?c.classCallback(f):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&c.activeRow===f?(i.openBlock(),i.createBlock(it,{key:0,component:o.value,"row-length":c.config.length,values:f,onClose:l[0]||(l[0]=d=>e("update:activeRow",null)),onSave:p,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),c.activeRow===i.unref(N).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(it,{key:0,component:o.value,"row-length":c.config.length,onClose:l[1]||(l[1]=f=>e("update:activeRow",null)),onSave:p,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),Mn=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 Oe=U(Mn,[["__scopeId","data-v-0ef9ae88"]]),Vn={class:"widget-button"},Un=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",Vn,[e.wait?(i.openBlock(),i.createBlock(Oe,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const jn=U(Un,[["__scopeId","data-v-450dc564"]]),Wn={class:"widget-multi-button-wrap position_relative cursor_pointer"},qn={class:"widget-multi-button-body grid"},Gn=["onClick"],zn={class:"widget-multi-button-side-wrap"},Kn=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(p=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(p){if(!(typeof p!="function"||t.wait))return t.wait=!0,Promise.resolve().then(p).finally(()=>{t.wait=!1})}function s(p=!t.active){t.active=p}return(p,c)=>(i.openBlock(),i.createElementBlock("div",Wn,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",qn,[p.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(p.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.array,(l,f)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:f,onClick:a=>{o(l.callback),s(!1)}},i.toDisplayString(l.label),9,Gn))),128))]),i.createElementVNode("div",zn,[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(Oe),{key:0,class:"widget-multi-button-side-spinner"})):p.array.length>1?(i.openBlock(),i.createBlock(i.unref(Ne),{key:1,class:"widget-multi-button-side-icon"},{default:i.withCtx(()=>[i.createTextVNode("angle-small-down")]),_:1})):i.createCommentVNode("",!0)],2)])],2)]))}});const Yn=U(Kn,[["__scopeId","data-v-a8d711d1"]]),Jn={class:"widget-loader flex flex-align_center gap_10 padding_15"},Hn={class:"text_md"},Xn=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",Jn,[i.createVNode(Oe,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",Hn,i.toDisplayString(e.label),1)]))}}),Zn=["alt","src"],Qn=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,Zn))}}),er={props:{config:Array,values:Object,selected:Boolean},setup:St};const tr=U(er,[["__scopeId","data-v-344a8cc1"]]),nr=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),rr={class:"head-cell"},or=nr(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),ir=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",rr,[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(O.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(Ne),{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),or])]))}});const sr=U(ir,[["__scopeId","data-v-4e1d87c8"]]),ar=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 C=-1;do C++,g-=h[C];while(g>0&&C<h.length);return C}function f(h,g){let C=0;for(;g>0&&g>h[C]&&C<h.length;)g-=h[C],C++;return console.log(g,C),C>0?C:0}function a(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function d(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 Je;function C(A){return A.screenX+v-F}const w=r.value,m=[...w.children].filter(A=>A.localName==="th"),v=((Je=w.offsetParent)==null?void 0:Je.scrollLeft)||0,S=m.map(A=>A.clientWidth),T=u(g.target),F=w.getBoundingClientRect().left,M=C(g),_=l(S,M),Z=S.slice(0,_).reduce((A,R)=>A+R,0),le=M-Z,Ie=w.offsetWidth,Q=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",M),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=Q+"px",o.value.style.cursor="grabbing",a(Z),d(Q),document.addEventListener("pointermove",Ye,{passive:!0}),document.addEventListener("pointerup",Ke);function Ke(A){if(console.group("END"),document.removeEventListener("pointermove",Ye),document.removeEventListener("pointerup",Ke),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=f(S,R);if(console.log(_,"->",ue),ue!==_){const ee=t.config[_],Fe=t.config;Fe.splice(_,1),Fe.splice(ue,0,ee),s(Fe)}else{const ee=t.config[_].name;p(ee)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Ye(A){if(T){const ee=C(A)-M+Q;d(ee);return}let R=A.screenX+v-F-le;R<0&&(R=0),R+Q>Ie&&(R=Ie-Q),a(R)}})});function s(l){e("update:config",l)}function p(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 f=t.order.length===1||t.order[1]==="asc"?"asc":"desc";c([l,f==="asc"?"desc":"asc"])}function c(l){e("update:order",l)}return(l,f)=>(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,d)=>(i.openBlock(),i.createBlock(sr,i.mergeProps({key:a},a,{onOrder:u=>p(a.name),onSelect:f[0]||(f[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 cr=U(ar,[["__scopeId","data-v-ccffc6bd"]]),lr={class:"widget-list"},ur={class:"widget-list-body position_relative"},dr=50,fr=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 f=[...t.selectedRows],a=f.indexOf(c);a===-1?f.push(c):f==null||f.splice(a,1),s(f)}}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 p(c){if(!c)return;const l=c.target;l.scrollTop+l.clientHeight+dr>l.scrollHeight&&e("scrollEnd")}return(c,l)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:p},[i.createElementVNode("table",lr,[i.createElementVNode("thead",null,[i.createVNode(cr,{onSelect:l[0]||(l[0]=f=>o()),"onUpdate:order":l[1]||(l[1]=f=>e("update:order",f)),"onUpdate:config":l[2]||(l[2]=f=>e("update:config",f)),config:c.config,order:c.order},null,8,["config","order"])]),i.createElementVNode("tbody",ur,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.array,(f,a)=>{var d;return i.openBlock(),i.createBlock(tr,{key:a,class:"widget-list-row",values:f,config:c.config,selected:(d=c.selectedRows)==null?void 0:d.includes(f),onSelect:u=>r(f,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function pr(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"?De(n):hr(n)?De(n.message):De(N.DEFAULT_ERROR_MESSAGE)}function hr(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function De(n){return{message:n}}function z(n="error"){return function(e){const{message:t}=ve(e);Se.add(n,t)}}function _e(n,e){return B().emit("entity:read",{...e,entity:n})}function Ge(n,e){return B().emit("entity:update",{...e,entity:n})}function gr(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function bt(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 ze(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=ze(r)),e[o]=r,e},{})}function yr(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 mr(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Cr(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return N.DEFAULT_ERROR_MESSAGE}})}function wr(n,e={}){return $.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=$.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw new Error(N.DEFAULT_ERROR_MESSAGE)}).then(t=>Cr(t).then(r=>{if(!t.ok)throw r;return r}))}function Er(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Tt(n,e){let t=!1;return(...r)=>{if(!t)return t=!0,setTimeout(()=>t=!1,e),n(...r)}}const vr=je(We("pretty-value-field-by-entity"));function _r(n,e,t){const r=Me.get(n);if(!r)throw new Error("For entity metadata is not loaded");const o=r.fieldsByName[e];if(!o)throw new Error(`For entity ${n} can't found fieldMetadata for field ${e}`);try{return o.dataType==="DateTime"&&typeof t=="string"?new Date(t).toLocaleString():t}catch{vr('Error by parse pretty value for entity "%s", field "%s" with value "%s"',n,e,t)}}function Sr(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const Y=je(We("use-socket"));function B(){return br}const br=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()];Y("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const C=u.requestId;(g.requestId&&g.requestId===C||!g.requestId&&g.event===u.event)&&(Y("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),Y("Handler was removed by *once* params was passed. %o",g)))})}function p(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){Y("Connection to server was stopped: %d %s",h.code,h.reason),Tt(()=>p(u),N.DELAY_SOCKET_RECONNECT)},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(!At(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 f(u,h){t.add({event:u,callback:h,once:!0})}function a(){return e&&(e==null?void 0:e.readyState)===1}function d(u,h,g){const C=++n,w=JSON.stringify({requestId:C,event:u,data:h,contextId:$.contextId,url:window.location.href});return a()?c(w):(r.add(w),Y("Socket is not connected. Message was send to save-queue. %s")),new Promise((m,v)=>{t.add({event:u,requestId:C,once:!0,callback:(S,T)=>{if(Y("Promise was resolve with next data:",S),Tr(T))return void v(S);g&&g(S,T),m(S)}})})}return{get socket(){return e},on:l,once:f,emit:d,initialization:p,getDevInfo:o}}(),Tr=n=>!!At(n)&&n.event==="request-error",At=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 Ar(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,_e(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function p(u,h){var C;const g=u.Version||((C=t.find(w=>w.Id===h))==null?void 0:C.Version);if(g===void 0)throw new Error("Object without version.");return g}function c(u,h){const g=t.findIndex(C=>C.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(),C=p(h,u);delete h.Version,await Ge(n,{id:u,values:h,version:C});const w=await _e(n,{fields:g.fields||"",id:u});c(u,w)}catch(g){z()(g)}}async function f(){try{const u=await s();t.push(...u)}catch(u){z()(u)}}function a(){return typeof e=="function"?e():e}async function d(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){z()(u)}}return{array:t,updateById:l,next:f,reload:d,wait:o}}function kr(){function n(){return{organizations:$.organizations,currentContextId:$.contextId,person:$.person,context:$.context,contextType:$.contextType,userId:$.userId}}const e=i.reactive(n());return $.onupdateContext(()=>{Object.assign(e,n())}),e}function Nr(n,e,t){return B().emit("communication:create",{entityName:n,entityCatalogId:e,targetCode:t})}function Or(n,e,t){return B().emit("communication:read",{entityName:n,entityCatalogId:e,targetCode:t})}function $r(n,e){return B().emit("communication-message:create",{communicationId:n,text:e})}function Ir(n){return B().emit("communication-message:read",{communicationId:n})}function Fr(n){const e=O.Form.getParentForm(),t=i.reactive([]);return e&&e.subscribe(n),n.read=()=>Ir(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function Rr(n,e){n.read=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw x.EntityWithoutName(n);return _e(n.name,r)}).then(ze).then(o=>(o.hasOwnProperty("Version")&&(n.version=o.Version),n.setValues(o),o)).catch(z())},n.save=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw x.EntityWithoutName(n);return Ge(n.name,{id:r.id,values:n.changes,version:n.version})}).then(o=>{n.version=o.version}).catch(o=>{throw z()(o),o})};function t(){return typeof e=="function"?e():e}}function Lr(n,e){return B().emit("metadata:read",{...e,entity:n})}class ae{constructor(){this.state=i.reactive({})}set(e,t,r){this.state[ae.getKey(e,t)]=r}get(e,t={}){return this.state[ae.getKey(e,t)]}getByKey(e){return this.state[e]}update(e,t){return Lr(e,t).then(this.set.bind(this,e,t))}static getKey(e,t){const r={entity:e,entityId:t.id,masterEntities:Pr(t.masterEntities)};return JSON.stringify(r)}}function Pr(n){return!n||!Array.isArray(n)?[]:n.length===0?[]:Dr(n)?[n]:n}function Dr(n){return!!n&&Array.isArray(n)&&typeof n[0]=="string"&&typeof n[1]=="number"}function xr(n,e={}){if(!n)return i.inject(N.PROVIDE_NAME_METADATA);const t=i.ref(null),r=i.computed(()=>t.value?Me.getByKey(t.value):null);i.provide(N.PROVIDE_NAME_METADATA,r);function o(){if(!n)throw new Error("Entity is not provided for metadata.");t.value=ae.getKey(n,at(e||{}))}const s=function(){return o(),Me.update(n,at(e||{}))};return o(),{state:r,update:s}}function at(n){return typeof n=="function"?n():n}const Se=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Br(r),s=new Mr(e,t,o.timeout,o.children,o.click);return this.store.push(s),o.timeout&&setTimeout(this.remove.bind(this,s.id),o.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 Br(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 kt=class Nt{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=Nt.cardId++}};kt.cardId=1;let Mr=kt;class Vr extends L{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return $r(this.id,e)}static checkAndGenerate(e,t,r){return Or(e,t,r).then(o=>o.length===0?Nr(e,t,r):o[0])}}function Ur(){return B().emit("client:read",{})}var Ot=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},jr=(n,e,t)=>(Ot(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)=>(Ot(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),we;const $e=class J extends L{constructor(){super(...arguments),this.type="front",this.organizations=[],Wr(this,we,!1)}set language(e){localStorage.setItem(N.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(N.LOCALSTORAGE_LANGUAGE_KEY)||J.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,we,e),this.emit(J.EVENT_READY_UPDATE,e)}get ready(){return jr(this,we)}onReady(e){return this.on(J.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(J.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(N.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(J.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){z()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(N.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}}};we=new WeakMap;$e.DEFAULT_LANGUAGE="en";$e.EVENT_CONTEXT_UPDATE="event:context-update";$e.EVENT_READY_UPDATE="event:ready-update";let Gr=$e;function zr(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(zr(r)){let o=function(s){var p;return((p=s.match(/([^Z]*)/))==null?void 0:p[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 $=new Gr,Me=new ae,Kr={clickOutside:Te,staticLink:cn,Request:y},Yr={usage:Pt,utils:qt,config:Gt,types:zt};exports.Communication=Vr;exports.CoreError=x;exports.Filter=I;exports.Manager=$;exports.NotificationSystem=Se;exports.Request=y;exports.WidgetButton=jn;exports.WidgetIcon=Ne;exports.WidgetImage=Qn;exports.WidgetList=fr;exports.WidgetLoader=Xn;exports.WidgetMultiButton=Yn;exports.WidgetSpinner=Oe;exports.WidgetTable=Bn;exports.actionService=an;exports.asyncProcess=pr;exports.authService=b;exports.billingService=H;exports.catchUniversal=z;exports.clickOutside=Te;exports.clientService=dt;exports.communicationService=en;exports.configurationService=un;exports.constants=N;exports.dataService=se;exports.debounce=Er;exports.default=Yr;exports.documentsService=ln;exports.equipmentService=En;exports.fileService=rn;exports.getCellValue=vt;exports.getNamesFromListConfig=gr;exports.groupArrayByField=yr;exports.historyService=Kt;exports.internationalizationService=Yt;exports.invitationService=on;exports.metadataService=nn;exports.openService=sn;exports.parseError=ve;exports.prettyDate=qe;exports.prettyDateWithTime=_t;exports.prettyMoney=bt;exports.prettyValueFieldByEntity=_r;exports.processWizardService=ge;exports.request=wr;exports.ruleValidationService=Ue;exports.t=X;exports.throttle=Tt;exports.universalEntityRead=_e;exports.universalEntityUpdate=Ge;exports.useCommunication=Fr;exports.useFormEntity=Rr;exports.useListActiveRow=Sr;exports.useListEntity=Ar;exports.useListSearch=dn;exports.useListSelect=pn;exports.useLogger=Ht;exports.useManagerState=kr;exports.useMetadata=xr;exports.useSocket=B;exports.useWizard=mn;exports.utils=Kr;exports.uuidv4=mr;exports.valuesToUpperCase=ze;exports.viewService=tn;
|
|
11
11
|
//# sourceMappingURL=eservices-core.cjs.js.map
|