eservices-core 1.3.128 → 1.3.129
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/backend/src/types/action-type.d.ts +2 -0
- package/dist/eservices-core.cjs.js +3 -3
- package/dist/eservices-core.es.js +3 -2
- package/dist/eservices-core.umd.js +2 -2
- package/dist/frontend/src/hooks/use-actions.d.ts +2 -0
- package/dist/frontend/src/methods/wrap-tool-response.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export interface IToolResponse {
|
|
|
10
10
|
showOnToolPanel: boolean;
|
|
11
11
|
title: string;
|
|
12
12
|
url: string;
|
|
13
|
+
usageContext?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface IAction {
|
|
15
16
|
entity: string;
|
|
@@ -34,4 +35,5 @@ export interface IAction {
|
|
|
34
35
|
export interface IToolExecuteParams {
|
|
35
36
|
name: string;
|
|
36
37
|
values: unknown;
|
|
38
|
+
usageContext?: string;
|
|
37
39
|
}
|
|
@@ -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}.widget-list-head-cell[data-v-bf495d6a]{padding:0 0 0 10px;display:flex}.widget-list-head-cell[data-v-bf495d6a]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-bf495d6a]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-bf495d6a]{position:absolute;inset-inline-end:22px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-bf495d6a]{transform:rotate(180deg)}.head-cell-resize[data-v-bf495d6a]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-bf495d6a]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-bf495d6a]:after{content:"";margin:auto;width:1px;height:100%;display:block;background-color:#d2d2d2}.widget-list-head[data-v-ccffc6bd]{position:sticky;top:-1px;z-index:1}.test-block[data-v-ccffc6bd]{position:absolute;z-index:2;display:none;height:calc(100% + 1px);place-content:center;inset-block-start:-1px;padding-inline:10px;background-color:#e7f2ff;-webkit-user-select:none;user-select:none;white-space:nowrap}.widget-list-head th[data-v-ccffc6bd]{position:sticky;top:0;z-index:2;-webkit-user-select:none;user-select:none}')),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.129
|
|
4
4
|
* (c) 2024 ESERVICES
|
|
5
5
|
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("jenesius-vue-form"),o=require("vue"),Le=require("vue-router"),Ye=require("date-and-time"),ge=require("debug"),se=require("jenesius-vue-modal");let z={};function J(t,...e){if(typeof t!="string")return console.trace(`Label is not provided for translation: ${t}`),"undefined";let n=F.utils.getPropFromObject((this==null?void 0:this.vocabulary)||z,t);if(typeof n=="string")return be(n,e);const r=F.utils.getPropFromObject(z==null?void 0:z.root,t);return typeof r=="string"?be(r,e):(typeof n===void 0&&console.warn(`Translation for label "${t}" is not founded.`),t)}function be(t,e){return e.forEach((n,r)=>{t=t.replaceAll(new RegExp(`\\{${r}}`,"g"),n)}),t}J.setGlobalVocabulary=function(t){z=t};J.getScope=function(t){const e=typeof t=="string"?t:"root";return typeof t!="string"&&console.warn(`SCOPE ${t} for translate is not string.`),J.bind({vocabulary:F.utils.getPropFromObject(z,e.toLowerCase())})};J.setVocabulary=function(t){return typeof t=="string"&&(t=F.utils.getPropFromObject(z,t)),J.bind({vocabulary:t})};const $e=class y extends Error{constructor(e,n=null){super(),this.message=e,this.details=n,this.id=y.ID++}static ParentFormNotFound(){return new y("Can't found parent form.")}static UndefinedNameOfCompositeFormController(e){return new y("Composite object name is undefined",e)}static EntityWithoutName(e){return new y("'Entity doesn't have a name",e)}static NotResolvedNameEventEmitter(e){return new y(`'${e}' is not a valid Event emitter name`)}static FormIsNotValidated(e){return new y("Form is not validated",e)}static ListWorkerIsRunningOrEnd(e){return new y("List data request is running or already done",e)}static ObjectIdNotNumber(e){return new y(`${e} (id) is not a number`)}static UndefinedErrorId(e,n){return y.ApiNotAvailable()}static ApiError(e){return new y("Request error",e)}static ApiNotAvailable(){return new y(`Sorry, we experience difficulties here.
|
|
6
|
-
Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,n){return!e&&!n?y.ApiNotAvailable():new y(e||"Authorization Error",n)}static ApiResponseParseFailed(){return y.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new y("Object doesn't have id",e)}static ObjectWithIdNotFound(e,n){return new y(`Can't find object with id: ${e}`,n)}static ObjectWithoutConnectToPresentArray(e,n){return new y("Object is not found.",{object:e,array:n})}static EntityWithoutId(e){return new y("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,n){return new y(`Can't find the element with tableIndex ${e}`,n)}static UndefinedError(e,n=[]){return new y(e,n)}static TableArrayAlreadyIncludeProvidedIndexValue(e,n,r){return new y(`Array already includes the element with value ${e}`,{array:n,table:r})}static MetadataEntityIsNotAvailable(e){return new y(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new y("The request took too long to complete. Try again later.")}};$e.ID=0;let Y=$e;const Ke="Please try again later or submit a feedback if problem doesn't go.";function Xe(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return Ke}})}function M(t,e={}){return e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw Y.ApiNotAvailable()}).then(n=>Xe(n).then(r=>{if(!n.ok)throw r;return r}))}class Ze{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,n,r)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[n]=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")}}new Ze;class Qe{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return M(`/open-api/internationalization/language/${e}`)}}function Se(t){return{...t,createdEntities:t.createdEntites}}const Pe=class re{static async getStartConfig(e,n){return M([re.url,e,n].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,n){return M([re.url,e,n].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(Se)}static async runStep(e,n,r,i,a){return M([re.url,e,n].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:a})}).then(Se)}};Pe.url="/close-api/views/process-wizard";let oe=Pe;class et{static async upload(e,n){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${n}`;return await fetch(i,{method:"POST",body:r}).then(a=>a.json()).then(a=>(a.filename=e.name,a))}}class tt{static invite(e,n,r){return M("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:n,relatedRoleCode:r})})}static accept(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!0})})}static decline(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!1})})}}class nt{static getRequiredDocuments(e,n,r){const i=new URLSearchParams({entity:e,primaryKey:n,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(a=>a.json())}}class H{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${H.url()}/calculator/${e}`)}static calculate(e,n){return M(`/${H.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:n})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):Y.ApiNotAvailable()})}static parseMetadataField(e){function n(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:n(e)}}static createOnlinePayment(e,n){return M(`/${H.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:n})})}static applyOnlinePayment(e){return M(`/${H.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}function rt(t){return t.statusName==="Completed"}function ot(t){return t.statusName==="FinalStepWithConfirmation"}function it(t){return t.statusName==="ValidationError"}function st(t,e,n){let r=null;const i=o.reactive({wait:null});let a=[],u=null;const l=o.ref(null);function s(){l.value=a.find(c=>c.name===u)||null}function d(){var c;return u?((c=a.find(h=>h.name===u))==null?void 0:c.fields)||[]:[]}function f(c){if(s(),it(c))return void n.onValidation(c.validationResults);if((c.statusName==="FinalStep"||c.statusName==="NextStep")&&(!d().length||at(d(),n.presets)))return $(n.presets||{});rt(c)&&n.onCompleted(c),ot(c)&&n.onConfirmation(c)}async function b(){try{await R(),await v()}catch(c){const{message:h}=ae(c);Z.add("error",h)}}function R(){return i.wait="Loading process information.",oe.getStartConfig(e,t).then(c=>{a=c.steps.map(h=>({label:h.title,name:h.stepName,number:h.number,fields:h.frontendEntity.objectTypes.reduce((g,O)=>(O.properties.forEach(k=>{g.push({name:k.name,label:k.title,type:k.refEntityName||k.dataType})}),g),[])}))}).then(c=>(i.wait=!1,c))}function E(c){return u=c.nextStepName,r=c.token,c}function w(c){const h=ae(c);Z.add("error",h.message)}function v(){return i.wait="Starting process",oe.startProcess(e,t).then(E).then(f).catch(w).finally(()=>{i.wait=null})}function $(c={}){return!r||!u?Promise.reject("Not step or token."):(i.wait="Waiting for result...",oe.runStep(e,t,u,r,c).then(E).then(f).catch(w).finally(()=>{i.wait=!1}))}return{initialize:b,state:i,currentStepConfig:o.readonly(l),next:$}}function at(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!F.utils.getPropFromObject(e,r.name))return!1}return!0}const ct={class:"widget-table__head"},lt={class:"widget-table__head-label margin_0 text_overflow"},ut=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("tr",ct,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",lt,o.toDisplayString(r.label),1)]))),128))]))}});const q=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},dt=q(ut,[["__scopeId","data-v-25198f4a"]]);function Be(t){return typeof t.name=="string"?t.name:Array.isArray(t.name)?t.name[0]:null}function ft(t){const e=new RegExp(/\$\{([a-zA-Z0-9.]+)}/,"g"),n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}function pt(t,e){return ft(t).forEach(r=>{t=t.replace(new RegExp("\\$\\{"+r+"}","g"),F.utils.getPropFromObject(e,r))}),t}function he(t){return e=>typeof e=="string"||typeof e=="number"?`${e} ${t}`:""}function me(t,e){const n=Be(t);if(typeof t.value=="string")return pt(t.value,e);let r=n?F.utils.getPropFromObject(e,n):null;if(r===void 0&&(r=null),typeof t.value=="function")return t.value(r,e);if(t.value===null)return null;if(t.unitValue&&(r=he(t.unitValue)(r)),t.unit&&(r=he(t.unit)(r)),t.type)switch(t.type){case"number":{typeof r=="number"&&(r=new Intl.NumberFormat().format(r));break}case"date":{r=Ee(typeof r=="string"?r:null);break}case"dateTime":case"dateWithTime":{r=De(typeof r=="string"?r:null);break}case"money":{r=Ve(r);break}}return t.formatter&&(r=de(t.formatter).exec(r,e)),typeof r=="boolean"&&(r=r?"✓":"—"),r}const C={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:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",TIME_TO_LIVE_SOCKET_REQUEST:3e4,CORE_DEBUG_LABEL:"eservices-core"};function ye(t){return[C.CORE_DEBUG_LABEL,t].join(":")}const ht={props:{name:String},setup(t,e){let n="unknown";try{n=e.slots.default()[0].children}catch{n=t.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${n}`})}},X=q(ht,[["__scopeId","data-v-e287c8d9"]]),gt=ge(ye("setup-list-row"));function mt(t,e){const n=t.config.map(r=>yt(r,t,e));return o.h("tr",{class:"widget-table__row widget-table-row"},n)}function yt(t,e,n){const r=e.values;let i=me(t,r);const a={onClick:[],class:["widget-table__cell widget-table-cell"]};function u(f){a.onClick.push(()=>f(r))}function l(f){Array.isArray(f)?a.class.push(...f):a.class.push(f)}const s=[],d=[];if(t.hide&&t.hide(r))return[o.h("td")];if(t.type)switch(l(`widget-table-cell_${t.type}`),t.type){case"multi-select":{d.push(o.h(F.FormField,{type:"single-checkbox",modelValue:e.selected})),u(Te.bind(null,n,!0));break}case"select":{d.push(o.h(F.FormField,{type:"single-radio",modelValue:e.selected})),u(Te.bind(null,n,!1));break}}if(t.onClick&&u(t.onClick),t.link)try{const f=t.link(r);if(f){const b=o.h(Le.RouterLink,{to:f});d.push(b),l("widget-table-cell_link")}}catch(f){gt("Can't add router link",f)}if(t.href&&(d.push(o.h("a",{href:t.href(r),target:"_blank"})),l("widget-table-cell_link")),(typeof i=="string"||typeof i=="number")&&d.push(o.h("p",{class:"widget-list-cell-text"},i)),t.icon&&(typeof t.icon=="string"&&d.push(o.h(X,{name:t.icon})),typeof t.icon=="function")){const f=t.icon(r);f!==null&&d.push(o.h(X,{name:f}))}return t.class&&(typeof t.class=="function"?l(t.class(r)):l(t.class)),s.push(o.h("td",a,d)),s}function Te(t,e){t.emit("select",e)}function Fe(t,e){return()=>{try{return mt(t,e)}catch(n){return console.warn(n),null}}}const Et={props:{values:Object,config:Object,selected:Boolean},setup:Fe},vt=["colspan"],ke=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(t,{emit:e}){const n=o.ref();return o.onMounted(()=>{setTimeout(()=>{n.value&&n.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:n},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=a=>e("close")),onSave:i[1]||(i[1]=a=>e("save",a))}),null,16,["values","new"]))],8,vt)],512))}}),wt={class:"widget-table"},Ae="update:selectedRows",_t=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1}},emits:["update:activeRow","save"],setup(t,{emit:e}){const n=t,r=o.useSlots(),i=o.computed(()=>{var s;return(s=r==null?void 0:r.default)==null?void 0:s.call(r)[0]});function a(s,d=!0){if(!n.selectedRows)return;if(!d)return e(Ae,n.selectedRows.includes(s)?[]:[s]);const f=[...n.selectedRows],b=f.indexOf(s);return b===-1?f.push(s):f.splice(b,1),e(Ae,f)}function u(s){e("save",s),e("update:activeRow",null)}const l=o.computed(()=>n.shortcut?n.config.filter(s=>s.name?!!n.array.find(f=>![null,""].includes(me(s,f))):!0):n.config);return(s,d)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",wt,[o.createVNode(dt,{config:l.value},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.array,(f,b)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:b},[o.createVNode(Et,{config:l.value,values:f,selected:s.selectedRows.includes(f),onSelect:R=>a(f,R),class:o.normalizeClass(s.classCallback?s.classCallback(f):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&s.activeRow===f?(o.openBlock(),o.createBlock(ke,{key:0,component:i.value,"row-length":s.config.length,values:f,onClose:d[0]||(d[0]=R=>e("update:activeRow",null)),onSave:u,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),s.activeRow===o.unref(C).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(ke,{key:0,component:i.value,"row-length":l.value.length,onClose:d[1]||(d[1]=f=>e("update:activeRow",null)),onSave:u,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),Ct=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const ue=q(Ct,[["__scopeId","data-v-0ef9ae88"]]),bt={class:"widget-button"},St=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("button",bt,[e.wait?(o.openBlock(),o.createBlock(ue,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const Tt=q(St,[["__scopeId","data-v-450dc564"]]),kt={class:"widget-multi-button-wrap position_relative cursor_pointer"},At={class:"widget-multi-button-body grid"},Rt=["onClick"],Ot={class:"widget-multi-button-side-wrap"},Nt=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(t){const e=t;o.useCssVars(u=>({"7025434e":r.value}));const n=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(u){if(!(typeof u!="function"||n.wait))return n.wait=!0,Promise.resolve().then(u).finally(()=>{n.wait=!1})}function a(u=!n.active){n.active=u}return(u,l)=>(o.openBlock(),o.createElementBlock("div",kt,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[o.createElementVNode("div",At,[u.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:l[0]||(l[0]=s=>a())},o.toDisplayString(u.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.array,(s,d)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:d,onClick:f=>{i(s.callback),a(!1)}},o.toDisplayString(s.label),9,Rt))),128))]),o.createElementVNode("div",Ot,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:l[1]||(l[1]=s=>a())},[n.wait?(o.openBlock(),o.createBlock(o.unref(ue),{key:0,class:"widget-multi-button-side-spinner"})):u.array.length>1?(o.openBlock(),o.createBlock(o.unref(X),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}});const It=q(Nt,[["__scopeId","data-v-a8d711d1"]]),Lt={class:"widget-loader flex flex-align_center gap_10 padding_15"},$t={class:"text_md"},Pt=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",Lt,[o.createVNode(ue,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",$t,o.toDisplayString(e.label),1)]))}}),Bt=["alt","src"],Ft=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(t){const e=t,n=o.ref();return o.onMounted(()=>{n.value&&(n.value.src=e.src),n.value.onerror=function(){e.default&&(n.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:n,src:r.src||r.$props.default},null,8,Bt))}}),Dt={props:{config:Array,values:Object,selected:Boolean},setup:Fe};const Vt=q(Dt,[["__scopeId","data-v-344a8cc1"]]),xt=t=>(o.pushScopeId("data-v-bf495d6a"),t=t(),o.popScopeId(),t),Mt={class:"widget-list-head-cell"},jt=xt(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Ut=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(t,{emit:e}){const n=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",Mt,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(F.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(a=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=a=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(X),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),jt])]))}});const qt=q(Ut,[["__scopeId","data-v-bf495d6a"]]),Wt=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(t,{emit:e}){const n=t,r=o.ref(),i=o.ref();o.onMounted(()=>{function s(E,w){let v=-1;do v++,w-=E[v];while(w>0&&v<E.length);return v}function d(E,w){let v=0;for(;w>0&&w>E[v]&&v<E.length;)w-=E[v],v++;return console.log(w,v),v>0?v:0}function f(E){try{i.value.style.insetInlineStart=E+"px"}catch(w){console.log(w)}}function b(E){try{i.value.style.width=E+"px",i.value.style.minWidth=E+"px",i.value.style.maxWidth=E+"px"}catch(w){console.log(w)}}function R(E){return E===null?!1:E.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(w){var Ce;function v(I){return I.screenX+h-k}const $=r.value,c=[...$.children].filter(I=>I.localName==="th"),h=((Ce=$.offsetParent)==null?void 0:Ce.scrollLeft)||0,g=c.map(I=>I.clientWidth),O=R(w.target),k=$.getBoundingClientRect().left,j=v(w),p=s(g,j),m=g.slice(0,p).reduce((I,D)=>I+D,0),_=j-m,S=$.offsetWidth,N=c[p].clientWidth;if(n.config[p].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",w.screenX),console.log("Widths",g),console.log("max width",S),console.log("Start Position",j),console.log("Position From",p),console.log("Start Position",p),console.log("Global offset (Отступ самой таблицы от края экрана)",k),console.log("Del",_),console.groupEnd(),i.value.innerText=c[p].textContent||"",i.value.style.display="grid",i.value.style.width=N+"px",i.value.style.cursor="grabbing",f(m),b(N),document.addEventListener("pointermove",_e,{passive:!0}),document.addEventListener("pointerup",ee);function ee(I){if(console.group("END"),document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",ee),O&&(n.config[p].width=i.value.style.width,n.config[p].minWidth=i.value.style.width,n.config[p].maxWidth=i.value.style.width,a(n.config)),!O){const D=I.screenX+h-k;console.log("ENP Position",D);const te=d(g,D);if(console.log(p,"->",te),te!==p){const K=n.config[p],pe=n.config;pe.splice(p,1),pe.splice(te,0,K),a(pe)}else{const K=n.config[p].name;u(K)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function _e(I){if(O){const K=v(I)-j+N;b(K);return}let D=I.screenX+h-k-_;D<0&&(D=0),D+N>S&&(D=S-N),f(D)}})});function a(s){e("update:config",s)}function u(s){if(!s)return;if(Array.isArray(s)){if(s.length<1)return;s=s[0]}if(n.order.length===0||n.order[0]!==s)return void l([s]);const d=n.order.length===1||n.order[1]==="asc"?"asc":"desc";l([s,d==="asc"?"desc":"asc"])}function l(s){e("update:order",s)}return(s,d)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.config,(f,b)=>(o.openBlock(),o.createBlock(qt,o.mergeProps({key:f},f,{onOrder:R=>u(f.name),onSelect:d[0]||(d[0]=R=>e("select")),order:s.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}});const zt=q(Wt,[["__scopeId","data-v-ccffc6bd"]]),Gt={class:"widget-list"},Ht={class:"widget-list-body position_relative"},Jt=50,Yt=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(t,{emit:e}){const n=t;function r(l,s=!0){if(n.selectedRows)if(!s)a(n.selectedRows.includes(l)?[]:[l]);else{const d=[...n.selectedRows],f=d.indexOf(l);f===-1?d.push(l):d==null||d.splice(f,1),a(d)}}function i(){var l;if(((l=n.selectedRows)==null?void 0:l.length)!==n.array.length)return a([...n.array]);a([])}function a(l){e("update:selectedRows",l)}function u(l){if(!l)return;const s=l.target;s.scrollTop+s.clientHeight+Jt>s.scrollHeight&&e("scrollEnd")}return(l,s)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:u},[o.createElementVNode("table",Gt,[o.createElementVNode("thead",null,[o.createVNode(zt,{onSelect:s[0]||(s[0]=d=>i()),"onUpdate:order":s[1]||(s[1]=d=>e("update:order",d)),"onUpdate:config":s[2]||(s[2]=d=>e("update:config",d)),config:l.config,order:l.order},null,8,["config","order"])]),o.createElementVNode("tbody",Ht,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.array,(d,f)=>{var b;return o.openBlock(),o.createBlock(Vt,{key:f,class:"widget-list-row",values:d,config:l.config,selected:(b=l.selectedRows)==null?void 0:b.includes(d),onSelect:R=>r(d,R)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),V={};function Kt(t){for(let e in t)V[e]=t[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function De(t){return Ee(t,"YYYY/MM/DD HH:mm:ss")}function Ee(t,e="YYYY/MM/DD"){if(!t)return"";try{const n=new Date(t);return Ye.format(n,e)}catch(n){return console.log(n),"Invalid date"}}function Xt(t){function e(...r){return n.wait?Promise.reject("The process has already started."):(n.wait=!0,Promise.resolve().then(()=>t(...r)).finally(()=>{n.wait=!1}))}const n=o.reactive({wait:!1,call:e});return n}function ae(t){return typeof t=="string"?ne(t):Zt(t)?ne(t.message,t.children||t.details||[]):Qt(t)?ne(t.title,[t.detail||""]):ne(C.DEFAULT_ERROR_MESSAGE)}function Zt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"message"))}function Qt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"title"))}function ne(t,e=[]){return{message:t,children:e}}function B(t="error"){return function(e){const{message:n,children:r}=ae(e);Z.add(t,n,{children:r})}}function ce(t,e={}){return T().emit("entity:read",{...e,entity:t})}function ve(t,e){return T().emit("entity:update",{...e,entity:t})}function en(t){return t.reduce((e,n)=>(n.name&&(typeof n.name=="string"?e.push(n.name):e.push(...n.name)),e),[])}function Ve(t,e=2){if(!(typeof t=="string"||typeof t=="number"))return"";let r=String(t).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 tn(t,e){const n=new Map;return t.forEach(r=>{var a;const i=e(r);n.has(i)||n.set(i,[]),(a=n.get(i))==null||a.push(r)}),n}function nn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function rn(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return C.DEFAULT_ERROR_MESSAGE}})}function L(t,e={}){return P.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=P.contextId),e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw new Error(C.DEFAULT_ERROR_MESSAGE)}).then(n=>rn(n).then(r=>{if(!n.ok)throw r;return r}))}function on(t,e=1e3){let n=0;return(...r)=>{clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function sn(t,e){let n=!1;return(...r)=>{if(!n)return n=!0,setTimeout(()=>n=!1,e),t(...r)}}const an=ge(ye("pretty-value-field-by-entity"));function cn(t,e,n){try{const r=le.get(t);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${t} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(r){return an('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,t,e,n),n}}const ln=1,un=5e3,dn="static-folder",xe="request-error",fn="Distinguisher",W=ge(ye("use-socket"));function T(){return hn}function pn(t){return typeof t=="object"&&Object.prototype.toString.call(t)==="[object Blob]"}const hn=function(){let t=1,e,n;const r=new Set;let i=0;const a=new Set;function u(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},un*2);const c=new Uint8Array(1);c[0]=ln,e.send(c)}setInterval(()=>{Array.from(r).forEach(c=>{$(c)&&(W("Handler for event %s requestId %d was expired",c.event,c.requestId),c.requestId?s({requestId:c.requestId,event:xe,data:{message:Y.RequestTookToLong().message}}):r.delete(c))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&d()},C.DELAY_SOCKET_RECONNECT);function l(){return{safeQueue:a,requestId:t,handlers:r,socketInstance:e}}function s(c){const h=[...r.values()];W("Handlers array length is %d. Response event: %s. Request id: %d",r.size,c.event,c.requestId),h.forEach(g=>{const O=c.requestId;(g.requestId&&g.requestId===O||!g.requestId&&g.event===c.event)&&(W("Find appropriated handler: %d, event: %s",t,g.event),g.callback(c.data,c),g.once&&(r.delete(g),W("Handler was removed by *once* params was passed. %o",g)))})}function d(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),e=new WebSocket(n),e.onclose=function(c){W("Connection to server was stopped: %d %s",c.code,c.reason),Array.from(r).forEach(h=>{h.guaranteedAnswer&&h.serializeString&&a.add(h.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(c=>{f(c),a.delete(c)})},e.onerror=function(c){console.warn(c)},e.onmessage=c=>{var h;try{if(pn(c.data)){u();return}const g=JSON.parse(c.data);if(!Me(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}(h=g==null?void 0:g.data)!=null&&h.refresh&&location.reload(),s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function f(c){e.send(c)}function b(c,h){v({event:c,callback:h})}function R(c,h){v({event:c,callback:h,once:!0})}function E(){return e&&(e==null?void 0:e.readyState)===1}function w(c,h,g){const O=++t,k=JSON.stringify({requestId:O,event:c,data:h,contextId:P.contextId,url:window.location.href});return E()?f(k):(a.add(k),W("Socket is not connected. Message was send to save-queue")),new Promise((j,p)=>{v({event:c,requestId:O,once:!0,guaranteedAnswer:!0,serializeString:k,callback:(m,_)=>{if(W("Promise was resolve with next data:",m),gn(_))return void p(m);g&&g(m,_),j(m)},timeToLive:C.TIME_TO_LIVE_SOCKET_REQUEST})})}function v(c){const h={timeToLive:0,...c,created:new Date().getTime()};r.add(h)}function $(c){return c.timeToLive===0||typeof c.timeToLive!="number"?!1:new Date().getTime()-c.created>c.timeToLive}return{get socket(){return e},on:b,once:R,emit:w,initialization(c){n=c},getDevInfo:l}}(),gn=t=>!!Me(t)&&t.event===xe,Me=t=>typeof t=="object"&&t!==null&&"event"in t&&typeof t.event=="string"&&"requestId"in t&&typeof t.requestId=="number"&&"data"in t;function mn(t,e){return T().emit("list-setting:read",{entity:t,mark:e})}function yn(t,e){return T().emit("metadata-field:treat",{entity:t,fieldName:e})}function je(t,e){return T().emit("entity:create",{...e,entity:t})}function Ue(t,e){return T().emit("entity:delete",{...e,entity:t})}function En(t,e){return T().emit("usage-context:read",{...e,entity:t})}function qe(t={}){return T().emit("tool:read",t)}function vn(t,e={},n={}){const r=o.inject(C.PROVIDE_NAME_ACTIONS,null),i=typeof t=="string"?t:e,a=typeof e=="string"?n:e;return o.computed(()=>{var s;const l=((typeof t=="string"?(s=r==null?void 0:r.actions)==null?void 0:s.value:o.unref(t))||[]).find(d=>d.name===i);return l?{...l,...a}:null})}function wn(t){return T().emit("history:read",t)}function _n(t,e){return T().emit("entity:count",{...e,entity:t})}function Cn(t){return`/${dn}/${t}`}function de(t){return{exec(e,n){switch(t.name){case"replace-boolean":return de.replaceBoolean(e,t.values)}}}}de.replaceBoolean=bn;function bn(t,e){return t?e[1]:e[0]}function Sn(t={}){return T().emit("tool:execute",t)}function We(t,e){return{...e,label:e.title,callback(){var i;const n=typeof t.values=="function"?t.values(e,t):t.values,r=()=>Sn({name:e.name,values:n}).then(async a=>{var u,l;if(!Tn(a))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(t.handlers))for await(const s of t.handlers)await s(e,a,t);if(!a.success)throw t.handleValidationResult&&a.validationEffect&&((l=(u=a.validationEffect)==null?void 0:u.results)!=null&&l.length)&&t.handleValidationResult(e,a.validationEffect,t),new Error(a.message);return a.message&&Z.add("info",a.message),Array.isArray(a.affectedEntities)&&t.handleAffectedEntity&&a.affectedEntities.forEach(s=>{var d;return(d=t.handleAffectedEntity)==null?void 0:d.call(t,e,s,t)}),e.closeHostForm&&t.handleCloseForm&&t.handleCloseForm(e,t),a}).catch(B("error"));return(i=t.overrides)!=null&&i[e.name]?t.overrides[e.name](e,t):e.requireSave&&t.form&&t.form.changed?t.form.save().then(r):!e.confirmation||!t.handleConfirmation?r():t.handleConfirmation(e,r)}}}function Tn(t){return!!(t&&typeof t=="object"&&"affectedEntities"in t&&"success"in t)}function kn(){const t=o.ref(null);function e(n){t.value=n}return{activeRow:t,activateRow:e}}function An(t,e){return typeof t!="object"||t===null?!1:Object.values(t).join().toLowerCase().includes(e)}async function ze(t,e){t()?(await e(),await ze(t,e)):console.log("async while was stopped.")}function Rn(t,e,n={}){let r=!1;const i=o.ref(""),a=o.computed(()=>u.filter(p=>d(p,i.value))),u=o.reactive([]);let l=0;const s=o.ref(!1);let d=(n==null?void 0:n.filterSearchFn)||((p,m)=>An(p,m));function f(){return n.masterEntities?typeof n.masterEntities=="function"?n.masterEntities():n.masterEntities:[]}function b(){const p=O();return typeof p.limit!="number"&&(p.limit=100),p.offset=l,(n.request||ce)(t,p).then(_=>(l+=_.length,_))}function R(p,m){var S;return typeof p.Version=="number"?p.Version:(S=u.find(N=>N.Id===m))==null?void 0:S.Version}function E(p,m){const _=u.findIndex(S=>S.Id===p);if(_===-1)throw new Error(`Can't found item with Id ${p}`);u.splice(_,1,m)}function w(p){const m=u.findIndex(_=>_.Id===p);if(m===-1)throw new Error(`Can't found item with Id ${p}`);u.splice(m,1)}async function v(p,m){try{const _=O(),S=R(m,p);delete m.Version,await ve(t,{id:p,values:m,version:S,masterEntities:f()});const N=await ce(t,{fields:_.fields||"",id:p});E(p,N)}catch(_){B()(_)}}async function $(p,m={}){try{const _=O(),S=R(m,p);delete m.Version,await Ue(t,{id:p,version:S,masterEntities:f()}),w(p)}catch(_){B()(_)}}async function c(p){try{await je(t,{values:p,masterEntities:f()}),await k()}catch(m){B()(m)}}let h;async function g(){console.log("next"),s.value=!0;try{h!=null&&h.signal&&!h.signal.aborted&&h.abort();let p=h=new AbortController,m=0;const S=O().limit||0;if(i.value&&!S){console.warn("Using textSearch assumes the use of limit.");return}await ze(()=>(S>0?m<S:!0)&&!r&&!p.signal.aborted,async()=>{console.log("Step read data. Count for filter %d",m);const N=await b();if(p.signal.aborted){console.log("Signal is aborted");return}console.log("Rows (count %d) was added.",N.length),u.push(...N),m+=N.filter(ee=>d(ee,i.value)).length,(N.length<S||S===0)&&(r=!0)})}catch(p){B()(p)}s.value=!1}function O(){return typeof e=="function"?e():e}async function k(){try{l=0,r=!1,u.splice(0,u.length),await g()}catch(p){B()(p)}}function j(){if(h)return h.abort();s.value=!1}return{array:u,updateById:v,next:g,reload:k,wait:s,create:c,deleteById:$,textSearch:i,filteredArray:a,abort:j}}function On(){function t(){return{organizations:P.organizations,currentContextId:P.contextId,person:P.person,context:P.context,contextType:P.contextType,userId:P.userId}}const e=o.reactive(t());return P.onupdateContext(()=>{Object.assign(e,t())}),e}function Nn(t,e,n){return T().emit("communication:create",{entityName:t,entityCatalogId:e,targetCode:n})}function In(t,e,n){return T().emit("communication:read",{entityName:t,entityCatalogId:e,targetCode:n})}function Ln(t,e){return T().emit("communication-message:create",{communicationId:t,text:e})}function $n(t){return T().emit("communication-message:read",{communicationId:t})}function Pn(t){const e=F.Form.getParentForm(),n=o.reactive([]);return e&&e.subscribe(t),t.read=()=>$n(t.id).then(r=>(n.splice(0,n.length,...r),r)),{array:n}}function Bn(t,e){t.read=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw Y.EntityWithoutName(t);return ce(t.name,r)}).then(we).then(i=>(i.hasOwnProperty("Version")&&(t.version=i.Version),t.setValues(i),i)).catch(B())},t.save=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw Y.EntityWithoutName(t);return ve(t.name,{id:r.id,values:t.changes,version:t.version})}).then(i=>{t.version=i.version}).catch(i=>{throw B()(i),i})};function n(){return typeof e=="function"?e():e}}function Fn(t){if(!t)return o.inject(C.PROVIDE_NAME_METADATA);le.initEntity(t);const e=o.computed(()=>le.state[t]);return o.provide(C.PROVIDE_NAME_METADATA,e),e}function Dn(t,e={}){if(!t)return o.inject(C.PROVIDE_NAME_USAGE_CONTEXT);const n=o.ref(null);return o.provide(C.PROVIDE_NAME_USAGE_CONTEXT,n),{state:n,update:async function(){n.value=await En(t,Vn(e||{}))}}}function Vn(t){return typeof t=="function"?t():t}function xn(t){if(!t)return o.inject(C.PROVIDE_NAME_ACTIONS);const e=o.reactive([]),n=o.computed(()=>e.map(a=>We(t,a))),r={actions:n,update:i};o.provide(C.PROVIDE_NAME_ACTIONS,r),t.router=Le.useRouter(),t.handleConfirmation||(t.handleConfirmation=jn),t.handleAffectedEntity||(t.handleAffectedEntity=qn),t.handleCloseForm||(t.handleCloseForm=Wn),t.handleValidationResult||(t.handleValidationResult=Un);function i(a={}){return e.splice(0,e.length),qe(a).then(u=>e.splice(0,0,...u)).catch(B("error"))}return{actions:n,update:i}}function Mn(t){const e="Are you sure?";return t===!0||typeof t=="string"&&t.toLowerCase()==="true"||t==="1"?e:typeof t=="string"?t:e}async function jn(t,e){const n=Mn(t.confirmation);if(!se.getComponentFromStore(C.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await se.promptModal(C.MODAL_CONFIRM,{message:n}))return e()}function Un(t,e){const n=C.MODAL_VALIDATION_EFFECT;if(!se.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{se.pushModal(n,e)})}function qn(t,e,n){var u;const{router:r,form:i}=n,a=(u=e.primaryKey)==null?void 0:u.Id;if(r&&e&&e.name===t.redirectEntity)return r.push({name:e.name,params:{id:a}});i&&e.name===i.name&&e.updated&&a===i.id&&i.read()}function Wn(t,e){const{router:n}=e;n&&t.closeHostForm&&n.back()}function zn(t){function e(n){n.key==="Enter"&&t()}o.onMounted(()=>{document.addEventListener("keypress",e)}),o.onUnmounted(()=>{document.removeEventListener("keypress",e)})}function Gn(t,e={}){const n=o.reactive([]),r=s=>{const d=o.unref(t);if(s===void 0){n.length===0?d.forEach(a):d.forEach(u);return}i(s)?u(s):a(s)},i=s=>n.includes(s),a=s=>{e.handleSelect&&!e.handleSelect(s)||i(s)||n.push(s)},u=s=>{const d=n.findIndex(f=>f===s);d!==-1&&n.splice(d,1)},l=o.computed(()=>{const s=o.unref(t);return n.length===s.length&&s.length!==0});return[n,r,l,a,u]}function Hn(t){const e=o.ref(""),n=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(t).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:n}}const Z=new class{constructor(){this.store=o.reactive([])}add(e,n,r={}){const i=Jn(r),a=new Yn(e,n,i.timeout,i.children,i.click);return this.store.push(a),i.timeout&&setTimeout(this.remove.bind(this,a.id),i.timeout*1e3),a}remove(e){const n=this.store.findIndex(r=>r.id===e);if(n===-1)return!1;this.store.splice(n,1)}};function Jn(t){function e(r){return!!r&&typeof r=="object"}const n={timeout:10,click:()=>null,children:[]};return e(t)?{timeout:t.timeout||n.timeout,click:t.click||n.click,children:t.children||n.children}:n}const Ge=class He{constructor(e,n,r,i,a){this.type=e,this.message=n,this.timeout=r,this.children=i,this.click=a,this.id=He.cardId++}};Ge.cardId=1;let Yn=Ge;/*!
|
|
6
|
+
Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,n){return!e&&!n?y.ApiNotAvailable():new y(e||"Authorization Error",n)}static ApiResponseParseFailed(){return y.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new y("Object doesn't have id",e)}static ObjectWithIdNotFound(e,n){return new y(`Can't find object with id: ${e}`,n)}static ObjectWithoutConnectToPresentArray(e,n){return new y("Object is not found.",{object:e,array:n})}static EntityWithoutId(e){return new y("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,n){return new y(`Can't find the element with tableIndex ${e}`,n)}static UndefinedError(e,n=[]){return new y(e,n)}static TableArrayAlreadyIncludeProvidedIndexValue(e,n,r){return new y(`Array already includes the element with value ${e}`,{array:n,table:r})}static MetadataEntityIsNotAvailable(e){return new y(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new y("The request took too long to complete. Try again later.")}};$e.ID=0;let Y=$e;const Ke="Please try again later or submit a feedback if problem doesn't go.";function Xe(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return Ke}})}function M(t,e={}){return e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw Y.ApiNotAvailable()}).then(n=>Xe(n).then(r=>{if(!n.ok)throw r;return r}))}class Ze{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,n,r)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[n]=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")}}new Ze;class Qe{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return M(`/open-api/internationalization/language/${e}`)}}function Se(t){return{...t,createdEntities:t.createdEntites}}const Pe=class re{static async getStartConfig(e,n){return M([re.url,e,n].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,n){return M([re.url,e,n].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(Se)}static async runStep(e,n,r,i,a){return M([re.url,e,n].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:a})}).then(Se)}};Pe.url="/close-api/views/process-wizard";let oe=Pe;class et{static async upload(e,n){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${n}`;return await fetch(i,{method:"POST",body:r}).then(a=>a.json()).then(a=>(a.filename=e.name,a))}}class tt{static invite(e,n,r){return M("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:n,relatedRoleCode:r})})}static accept(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!0})})}static decline(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!1})})}}class nt{static getRequiredDocuments(e,n,r){const i=new URLSearchParams({entity:e,primaryKey:n,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(a=>a.json())}}class H{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${H.url()}/calculator/${e}`)}static calculate(e,n){return M(`/${H.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:n})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):Y.ApiNotAvailable()})}static parseMetadataField(e){function n(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:n(e)}}static createOnlinePayment(e,n){return M(`/${H.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:n})})}static applyOnlinePayment(e){return M(`/${H.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}function rt(t){return t.statusName==="Completed"}function ot(t){return t.statusName==="FinalStepWithConfirmation"}function it(t){return t.statusName==="ValidationError"}function st(t,e,n){let r=null;const i=o.reactive({wait:null});let a=[],u=null;const l=o.ref(null);function s(){l.value=a.find(c=>c.name===u)||null}function d(){var c;return u?((c=a.find(h=>h.name===u))==null?void 0:c.fields)||[]:[]}function f(c){if(s(),it(c))return void n.onValidation(c.validationResults);if((c.statusName==="FinalStep"||c.statusName==="NextStep")&&(!d().length||at(d(),n.presets)))return $(n.presets||{});rt(c)&&n.onCompleted(c),ot(c)&&n.onConfirmation(c)}async function b(){try{await R(),await v()}catch(c){const{message:h}=ae(c);Z.add("error",h)}}function R(){return i.wait="Loading process information.",oe.getStartConfig(e,t).then(c=>{a=c.steps.map(h=>({label:h.title,name:h.stepName,number:h.number,fields:h.frontendEntity.objectTypes.reduce((g,O)=>(O.properties.forEach(k=>{g.push({name:k.name,label:k.title,type:k.refEntityName||k.dataType})}),g),[])}))}).then(c=>(i.wait=!1,c))}function E(c){return u=c.nextStepName,r=c.token,c}function w(c){const h=ae(c);Z.add("error",h.message)}function v(){return i.wait="Starting process",oe.startProcess(e,t).then(E).then(f).catch(w).finally(()=>{i.wait=null})}function $(c={}){return!r||!u?Promise.reject("Not step or token."):(i.wait="Waiting for result...",oe.runStep(e,t,u,r,c).then(E).then(f).catch(w).finally(()=>{i.wait=!1}))}return{initialize:b,state:i,currentStepConfig:o.readonly(l),next:$}}function at(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!F.utils.getPropFromObject(e,r.name))return!1}return!0}const ct={class:"widget-table__head"},lt={class:"widget-table__head-label margin_0 text_overflow"},ut=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("tr",ct,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",lt,o.toDisplayString(r.label),1)]))),128))]))}});const q=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},dt=q(ut,[["__scopeId","data-v-25198f4a"]]);function Be(t){return typeof t.name=="string"?t.name:Array.isArray(t.name)?t.name[0]:null}function ft(t){const e=new RegExp(/\$\{([a-zA-Z0-9.]+)}/,"g"),n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}function pt(t,e){return ft(t).forEach(r=>{t=t.replace(new RegExp("\\$\\{"+r+"}","g"),F.utils.getPropFromObject(e,r))}),t}function he(t){return e=>typeof e=="string"||typeof e=="number"?`${e} ${t}`:""}function me(t,e){const n=Be(t);if(typeof t.value=="string")return pt(t.value,e);let r=n?F.utils.getPropFromObject(e,n):null;if(r===void 0&&(r=null),typeof t.value=="function")return t.value(r,e);if(t.value===null)return null;if(t.unitValue&&(r=he(t.unitValue)(r)),t.unit&&(r=he(t.unit)(r)),t.type)switch(t.type){case"number":{typeof r=="number"&&(r=new Intl.NumberFormat().format(r));break}case"date":{r=Ee(typeof r=="string"?r:null);break}case"dateTime":case"dateWithTime":{r=De(typeof r=="string"?r:null);break}case"money":{r=xe(r);break}}return t.formatter&&(r=de(t.formatter).exec(r,e)),typeof r=="boolean"&&(r=r?"✓":"—"),r}const C={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:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",TIME_TO_LIVE_SOCKET_REQUEST:3e4,CORE_DEBUG_LABEL:"eservices-core"};function ye(t){return[C.CORE_DEBUG_LABEL,t].join(":")}const ht={props:{name:String},setup(t,e){let n="unknown";try{n=e.slots.default()[0].children}catch{n=t.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${n}`})}},X=q(ht,[["__scopeId","data-v-e287c8d9"]]),gt=ge(ye("setup-list-row"));function mt(t,e){const n=t.config.map(r=>yt(r,t,e));return o.h("tr",{class:"widget-table__row widget-table-row"},n)}function yt(t,e,n){const r=e.values;let i=me(t,r);const a={onClick:[],class:["widget-table__cell widget-table-cell"]};function u(f){a.onClick.push(()=>f(r))}function l(f){Array.isArray(f)?a.class.push(...f):a.class.push(f)}const s=[],d=[];if(t.hide&&t.hide(r))return[o.h("td")];if(t.type)switch(l(`widget-table-cell_${t.type}`),t.type){case"multi-select":{d.push(o.h(F.FormField,{type:"single-checkbox",modelValue:e.selected})),u(Te.bind(null,n,!0));break}case"select":{d.push(o.h(F.FormField,{type:"single-radio",modelValue:e.selected})),u(Te.bind(null,n,!1));break}}if(t.onClick&&u(t.onClick),t.link)try{const f=t.link(r);if(f){const b=o.h(Le.RouterLink,{to:f});d.push(b),l("widget-table-cell_link")}}catch(f){gt("Can't add router link",f)}if(t.href&&(d.push(o.h("a",{href:t.href(r),target:"_blank"})),l("widget-table-cell_link")),(typeof i=="string"||typeof i=="number")&&d.push(o.h("p",{class:"widget-list-cell-text"},i)),t.icon&&(typeof t.icon=="string"&&d.push(o.h(X,{name:t.icon})),typeof t.icon=="function")){const f=t.icon(r);f!==null&&d.push(o.h(X,{name:f}))}return t.class&&(typeof t.class=="function"?l(t.class(r)):l(t.class)),s.push(o.h("td",a,d)),s}function Te(t,e){t.emit("select",e)}function Fe(t,e){return()=>{try{return mt(t,e)}catch(n){return console.warn(n),null}}}const Et={props:{values:Object,config:Object,selected:Boolean},setup:Fe},vt=["colspan"],ke=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(t,{emit:e}){const n=o.ref();return o.onMounted(()=>{setTimeout(()=>{n.value&&n.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:n},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=a=>e("close")),onSave:i[1]||(i[1]=a=>e("save",a))}),null,16,["values","new"]))],8,vt)],512))}}),wt={class:"widget-table"},Ae="update:selectedRows",_t=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1}},emits:["update:activeRow","save"],setup(t,{emit:e}){const n=t,r=o.useSlots(),i=o.computed(()=>{var s;return(s=r==null?void 0:r.default)==null?void 0:s.call(r)[0]});function a(s,d=!0){if(!n.selectedRows)return;if(!d)return e(Ae,n.selectedRows.includes(s)?[]:[s]);const f=[...n.selectedRows],b=f.indexOf(s);return b===-1?f.push(s):f.splice(b,1),e(Ae,f)}function u(s){e("save",s),e("update:activeRow",null)}const l=o.computed(()=>n.shortcut?n.config.filter(s=>s.name?!!n.array.find(f=>![null,""].includes(me(s,f))):!0):n.config);return(s,d)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",wt,[o.createVNode(dt,{config:l.value},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.array,(f,b)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:b},[o.createVNode(Et,{config:l.value,values:f,selected:s.selectedRows.includes(f),onSelect:R=>a(f,R),class:o.normalizeClass(s.classCallback?s.classCallback(f):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&s.activeRow===f?(o.openBlock(),o.createBlock(ke,{key:0,component:i.value,"row-length":s.config.length,values:f,onClose:d[0]||(d[0]=R=>e("update:activeRow",null)),onSave:u,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),s.activeRow===o.unref(C).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(ke,{key:0,component:i.value,"row-length":l.value.length,onClose:d[1]||(d[1]=f=>e("update:activeRow",null)),onSave:u,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),Ct=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const ue=q(Ct,[["__scopeId","data-v-0ef9ae88"]]),bt={class:"widget-button"},St=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("button",bt,[e.wait?(o.openBlock(),o.createBlock(ue,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const Tt=q(St,[["__scopeId","data-v-450dc564"]]),kt={class:"widget-multi-button-wrap position_relative cursor_pointer"},At={class:"widget-multi-button-body grid"},Rt=["onClick"],Ot={class:"widget-multi-button-side-wrap"},Nt=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(t){const e=t;o.useCssVars(u=>({"7025434e":r.value}));const n=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(u){if(!(typeof u!="function"||n.wait))return n.wait=!0,Promise.resolve().then(u).finally(()=>{n.wait=!1})}function a(u=!n.active){n.active=u}return(u,l)=>(o.openBlock(),o.createElementBlock("div",kt,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[o.createElementVNode("div",At,[u.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:l[0]||(l[0]=s=>a())},o.toDisplayString(u.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.array,(s,d)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:d,onClick:f=>{i(s.callback),a(!1)}},o.toDisplayString(s.label),9,Rt))),128))]),o.createElementVNode("div",Ot,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:l[1]||(l[1]=s=>a())},[n.wait?(o.openBlock(),o.createBlock(o.unref(ue),{key:0,class:"widget-multi-button-side-spinner"})):u.array.length>1?(o.openBlock(),o.createBlock(o.unref(X),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}});const It=q(Nt,[["__scopeId","data-v-a8d711d1"]]),Lt={class:"widget-loader flex flex-align_center gap_10 padding_15"},$t={class:"text_md"},Pt=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",Lt,[o.createVNode(ue,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",$t,o.toDisplayString(e.label),1)]))}}),Bt=["alt","src"],Ft=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(t){const e=t,n=o.ref();return o.onMounted(()=>{n.value&&(n.value.src=e.src),n.value.onerror=function(){e.default&&(n.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:n,src:r.src||r.$props.default},null,8,Bt))}}),Dt={props:{config:Array,values:Object,selected:Boolean},setup:Fe};const xt=q(Dt,[["__scopeId","data-v-344a8cc1"]]),Vt=t=>(o.pushScopeId("data-v-bf495d6a"),t=t(),o.popScopeId(),t),Mt={class:"widget-list-head-cell"},jt=Vt(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Ut=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(t,{emit:e}){const n=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",Mt,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(F.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(a=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=a=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(X),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),jt])]))}});const qt=q(Ut,[["__scopeId","data-v-bf495d6a"]]),Wt=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(t,{emit:e}){const n=t,r=o.ref(),i=o.ref();o.onMounted(()=>{function s(E,w){let v=-1;do v++,w-=E[v];while(w>0&&v<E.length);return v}function d(E,w){let v=0;for(;w>0&&w>E[v]&&v<E.length;)w-=E[v],v++;return console.log(w,v),v>0?v:0}function f(E){try{i.value.style.insetInlineStart=E+"px"}catch(w){console.log(w)}}function b(E){try{i.value.style.width=E+"px",i.value.style.minWidth=E+"px",i.value.style.maxWidth=E+"px"}catch(w){console.log(w)}}function R(E){return E===null?!1:E.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(w){var Ce;function v(I){return I.screenX+h-k}const $=r.value,c=[...$.children].filter(I=>I.localName==="th"),h=((Ce=$.offsetParent)==null?void 0:Ce.scrollLeft)||0,g=c.map(I=>I.clientWidth),O=R(w.target),k=$.getBoundingClientRect().left,j=v(w),p=s(g,j),m=g.slice(0,p).reduce((I,D)=>I+D,0),_=j-m,S=$.offsetWidth,N=c[p].clientWidth;if(n.config[p].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",w.screenX),console.log("Widths",g),console.log("max width",S),console.log("Start Position",j),console.log("Position From",p),console.log("Start Position",p),console.log("Global offset (Отступ самой таблицы от края экрана)",k),console.log("Del",_),console.groupEnd(),i.value.innerText=c[p].textContent||"",i.value.style.display="grid",i.value.style.width=N+"px",i.value.style.cursor="grabbing",f(m),b(N),document.addEventListener("pointermove",_e,{passive:!0}),document.addEventListener("pointerup",ee);function ee(I){if(console.group("END"),document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",ee),O&&(n.config[p].width=i.value.style.width,n.config[p].minWidth=i.value.style.width,n.config[p].maxWidth=i.value.style.width,a(n.config)),!O){const D=I.screenX+h-k;console.log("ENP Position",D);const te=d(g,D);if(console.log(p,"->",te),te!==p){const K=n.config[p],pe=n.config;pe.splice(p,1),pe.splice(te,0,K),a(pe)}else{const K=n.config[p].name;u(K)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function _e(I){if(O){const K=v(I)-j+N;b(K);return}let D=I.screenX+h-k-_;D<0&&(D=0),D+N>S&&(D=S-N),f(D)}})});function a(s){e("update:config",s)}function u(s){if(!s)return;if(Array.isArray(s)){if(s.length<1)return;s=s[0]}if(n.order.length===0||n.order[0]!==s)return void l([s]);const d=n.order.length===1||n.order[1]==="asc"?"asc":"desc";l([s,d==="asc"?"desc":"asc"])}function l(s){e("update:order",s)}return(s,d)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.config,(f,b)=>(o.openBlock(),o.createBlock(qt,o.mergeProps({key:f},f,{onOrder:R=>u(f.name),onSelect:d[0]||(d[0]=R=>e("select")),order:s.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}});const zt=q(Wt,[["__scopeId","data-v-ccffc6bd"]]),Gt={class:"widget-list"},Ht={class:"widget-list-body position_relative"},Jt=50,Yt=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(t,{emit:e}){const n=t;function r(l,s=!0){if(n.selectedRows)if(!s)a(n.selectedRows.includes(l)?[]:[l]);else{const d=[...n.selectedRows],f=d.indexOf(l);f===-1?d.push(l):d==null||d.splice(f,1),a(d)}}function i(){var l;if(((l=n.selectedRows)==null?void 0:l.length)!==n.array.length)return a([...n.array]);a([])}function a(l){e("update:selectedRows",l)}function u(l){if(!l)return;const s=l.target;s.scrollTop+s.clientHeight+Jt>s.scrollHeight&&e("scrollEnd")}return(l,s)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:u},[o.createElementVNode("table",Gt,[o.createElementVNode("thead",null,[o.createVNode(zt,{onSelect:s[0]||(s[0]=d=>i()),"onUpdate:order":s[1]||(s[1]=d=>e("update:order",d)),"onUpdate:config":s[2]||(s[2]=d=>e("update:config",d)),config:l.config,order:l.order},null,8,["config","order"])]),o.createElementVNode("tbody",Ht,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.array,(d,f)=>{var b;return o.openBlock(),o.createBlock(xt,{key:f,class:"widget-list-row",values:d,config:l.config,selected:(b=l.selectedRows)==null?void 0:b.includes(d),onSelect:R=>r(d,R)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),x={};function Kt(t){for(let e in t)x[e]=t[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function De(t){return Ee(t,"YYYY/MM/DD HH:mm:ss")}function Ee(t,e="YYYY/MM/DD"){if(!t)return"";try{const n=new Date(t);return Ye.format(n,e)}catch(n){return console.log(n),"Invalid date"}}function Xt(t){function e(...r){return n.wait?Promise.reject("The process has already started."):(n.wait=!0,Promise.resolve().then(()=>t(...r)).finally(()=>{n.wait=!1}))}const n=o.reactive({wait:!1,call:e});return n}function ae(t){return typeof t=="string"?ne(t):Zt(t)?ne(t.message,t.children||t.details||[]):Qt(t)?ne(t.title,[t.detail||""]):ne(C.DEFAULT_ERROR_MESSAGE)}function Zt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"message"))}function Qt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"title"))}function ne(t,e=[]){return{message:t,children:e}}function B(t="error"){return function(e){const{message:n,children:r}=ae(e);Z.add(t,n,{children:r})}}function ce(t,e={}){return T().emit("entity:read",{...e,entity:t})}function ve(t,e){return T().emit("entity:update",{...e,entity:t})}function en(t){return t.reduce((e,n)=>(n.name&&(typeof n.name=="string"?e.push(n.name):e.push(...n.name)),e),[])}function xe(t,e=2){if(!(typeof t=="string"||typeof t=="number"))return"";let r=String(t).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 tn(t,e){const n=new Map;return t.forEach(r=>{var a;const i=e(r);n.has(i)||n.set(i,[]),(a=n.get(i))==null||a.push(r)}),n}function nn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function rn(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return C.DEFAULT_ERROR_MESSAGE}})}function L(t,e={}){return P.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=P.contextId),e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw new Error(C.DEFAULT_ERROR_MESSAGE)}).then(n=>rn(n).then(r=>{if(!n.ok)throw r;return r}))}function on(t,e=1e3){let n=0;return(...r)=>{clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function sn(t,e){let n=!1;return(...r)=>{if(!n)return n=!0,setTimeout(()=>n=!1,e),t(...r)}}const an=ge(ye("pretty-value-field-by-entity"));function cn(t,e,n){try{const r=le.get(t);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${t} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(r){return an('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,t,e,n),n}}const ln=1,un=5e3,dn="static-folder",Ve="request-error",fn="Distinguisher",W=ge(ye("use-socket"));function T(){return hn}function pn(t){return typeof t=="object"&&Object.prototype.toString.call(t)==="[object Blob]"}const hn=function(){let t=1,e,n;const r=new Set;let i=0;const a=new Set;function u(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},un*2);const c=new Uint8Array(1);c[0]=ln,e.send(c)}setInterval(()=>{Array.from(r).forEach(c=>{$(c)&&(W("Handler for event %s requestId %d was expired",c.event,c.requestId),c.requestId?s({requestId:c.requestId,event:Ve,data:{message:Y.RequestTookToLong().message}}):r.delete(c))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&d()},C.DELAY_SOCKET_RECONNECT);function l(){return{safeQueue:a,requestId:t,handlers:r,socketInstance:e}}function s(c){const h=[...r.values()];W("Handlers array length is %d. Response event: %s. Request id: %d",r.size,c.event,c.requestId),h.forEach(g=>{const O=c.requestId;(g.requestId&&g.requestId===O||!g.requestId&&g.event===c.event)&&(W("Find appropriated handler: %d, event: %s",t,g.event),g.callback(c.data,c),g.once&&(r.delete(g),W("Handler was removed by *once* params was passed. %o",g)))})}function d(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),e=new WebSocket(n),e.onclose=function(c){W("Connection to server was stopped: %d %s",c.code,c.reason),Array.from(r).forEach(h=>{h.guaranteedAnswer&&h.serializeString&&a.add(h.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(c=>{f(c),a.delete(c)})},e.onerror=function(c){console.warn(c)},e.onmessage=c=>{var h;try{if(pn(c.data)){u();return}const g=JSON.parse(c.data);if(!Me(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}(h=g==null?void 0:g.data)!=null&&h.refresh&&location.reload(),s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function f(c){e.send(c)}function b(c,h){v({event:c,callback:h})}function R(c,h){v({event:c,callback:h,once:!0})}function E(){return e&&(e==null?void 0:e.readyState)===1}function w(c,h,g){const O=++t,k=JSON.stringify({requestId:O,event:c,data:h,contextId:P.contextId,url:window.location.href});return E()?f(k):(a.add(k),W("Socket is not connected. Message was send to save-queue")),new Promise((j,p)=>{v({event:c,requestId:O,once:!0,guaranteedAnswer:!0,serializeString:k,callback:(m,_)=>{if(W("Promise was resolve with next data:",m),gn(_))return void p(m);g&&g(m,_),j(m)},timeToLive:C.TIME_TO_LIVE_SOCKET_REQUEST})})}function v(c){const h={timeToLive:0,...c,created:new Date().getTime()};r.add(h)}function $(c){return c.timeToLive===0||typeof c.timeToLive!="number"?!1:new Date().getTime()-c.created>c.timeToLive}return{get socket(){return e},on:b,once:R,emit:w,initialization(c){n=c},getDevInfo:l}}(),gn=t=>!!Me(t)&&t.event===Ve,Me=t=>typeof t=="object"&&t!==null&&"event"in t&&typeof t.event=="string"&&"requestId"in t&&typeof t.requestId=="number"&&"data"in t;function mn(t,e){return T().emit("list-setting:read",{entity:t,mark:e})}function yn(t,e){return T().emit("metadata-field:treat",{entity:t,fieldName:e})}function je(t,e){return T().emit("entity:create",{...e,entity:t})}function Ue(t,e){return T().emit("entity:delete",{...e,entity:t})}function En(t,e){return T().emit("usage-context:read",{...e,entity:t})}function qe(t={}){return T().emit("tool:read",t)}function vn(t,e={},n={}){const r=o.inject(C.PROVIDE_NAME_ACTIONS,null),i=typeof t=="string"?t:e,a=typeof e=="string"?n:e;return o.computed(()=>{var s;const l=((typeof t=="string"?(s=r==null?void 0:r.actions)==null?void 0:s.value:o.unref(t))||[]).find(d=>d.name===i);return l?{...l,...a}:null})}function wn(t){return T().emit("history:read",t)}function _n(t,e){return T().emit("entity:count",{...e,entity:t})}function Cn(t){return`/${dn}/${t}`}function de(t){return{exec(e,n){switch(t.name){case"replace-boolean":return de.replaceBoolean(e,t.values)}}}}de.replaceBoolean=bn;function bn(t,e){return t?e[1]:e[0]}function Sn(t={}){return T().emit("tool:execute",t)}function We(t,e){return{...e,label:e.title,callback(){var i;const n=typeof t.values=="function"?t.values(e,t):t.values,r=()=>Sn({name:e.name,values:n,usageContext:e.usageContext}).then(async a=>{var u,l;if(!Tn(a))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(t.handlers))for await(const s of t.handlers)await s(e,a,t);if(!a.success)throw t.handleValidationResult&&a.validationEffect&&((l=(u=a.validationEffect)==null?void 0:u.results)!=null&&l.length)&&t.handleValidationResult(e,a.validationEffect,t),new Error(a.message);return a.message&&Z.add("info",a.message),Array.isArray(a.affectedEntities)&&t.handleAffectedEntity&&a.affectedEntities.forEach(s=>{var d;return(d=t.handleAffectedEntity)==null?void 0:d.call(t,e,s,t)}),e.closeHostForm&&t.handleCloseForm&&t.handleCloseForm(e,t),a}).catch(B("error"));return(i=t.overrides)!=null&&i[e.name]?t.overrides[e.name](e,t):e.requireSave&&t.form&&t.form.changed?t.form.save().then(r):!e.confirmation||!t.handleConfirmation?r():t.handleConfirmation(e,r)}}}function Tn(t){return!!(t&&typeof t=="object"&&"affectedEntities"in t&&"success"in t)}function kn(){const t=o.ref(null);function e(n){t.value=n}return{activeRow:t,activateRow:e}}function An(t,e){return typeof t!="object"||t===null?!1:Object.values(t).join().toLowerCase().includes(e)}async function ze(t,e){t()?(await e(),await ze(t,e)):console.log("async while was stopped.")}function Rn(t,e,n={}){let r=!1;const i=o.ref(""),a=o.computed(()=>u.filter(p=>d(p,i.value))),u=o.reactive([]);let l=0;const s=o.ref(!1);let d=(n==null?void 0:n.filterSearchFn)||((p,m)=>An(p,m));function f(){return n.masterEntities?typeof n.masterEntities=="function"?n.masterEntities():n.masterEntities:[]}function b(){const p=O();return typeof p.limit!="number"&&(p.limit=100),p.offset=l,(n.request||ce)(t,p).then(_=>(l+=_.length,_))}function R(p,m){var S;return typeof p.Version=="number"?p.Version:(S=u.find(N=>N.Id===m))==null?void 0:S.Version}function E(p,m){const _=u.findIndex(S=>S.Id===p);if(_===-1)throw new Error(`Can't found item with Id ${p}`);u.splice(_,1,m)}function w(p){const m=u.findIndex(_=>_.Id===p);if(m===-1)throw new Error(`Can't found item with Id ${p}`);u.splice(m,1)}async function v(p,m){try{const _=O(),S=R(m,p);delete m.Version,await ve(t,{id:p,values:m,version:S,masterEntities:f()});const N=await ce(t,{fields:_.fields||"",id:p});E(p,N)}catch(_){B()(_)}}async function $(p,m={}){try{const _=O(),S=R(m,p);delete m.Version,await Ue(t,{id:p,version:S,masterEntities:f()}),w(p)}catch(_){B()(_)}}async function c(p){try{await je(t,{values:p,masterEntities:f()}),await k()}catch(m){B()(m)}}let h;async function g(){console.log("next"),s.value=!0;try{h!=null&&h.signal&&!h.signal.aborted&&h.abort();let p=h=new AbortController,m=0;const S=O().limit||0;if(i.value&&!S){console.warn("Using textSearch assumes the use of limit.");return}await ze(()=>(S>0?m<S:!0)&&!r&&!p.signal.aborted,async()=>{console.log("Step read data. Count for filter %d",m);const N=await b();if(p.signal.aborted){console.log("Signal is aborted");return}console.log("Rows (count %d) was added.",N.length),u.push(...N),m+=N.filter(ee=>d(ee,i.value)).length,(N.length<S||S===0)&&(r=!0)})}catch(p){B()(p)}s.value=!1}function O(){return typeof e=="function"?e():e}async function k(){try{l=0,r=!1,u.splice(0,u.length),await g()}catch(p){B()(p)}}function j(){if(h)return h.abort();s.value=!1}return{array:u,updateById:v,next:g,reload:k,wait:s,create:c,deleteById:$,textSearch:i,filteredArray:a,abort:j}}function On(){function t(){return{organizations:P.organizations,currentContextId:P.contextId,person:P.person,context:P.context,contextType:P.contextType,userId:P.userId}}const e=o.reactive(t());return P.onupdateContext(()=>{Object.assign(e,t())}),e}function Nn(t,e,n){return T().emit("communication:create",{entityName:t,entityCatalogId:e,targetCode:n})}function In(t,e,n){return T().emit("communication:read",{entityName:t,entityCatalogId:e,targetCode:n})}function Ln(t,e){return T().emit("communication-message:create",{communicationId:t,text:e})}function $n(t){return T().emit("communication-message:read",{communicationId:t})}function Pn(t){const e=F.Form.getParentForm(),n=o.reactive([]);return e&&e.subscribe(t),t.read=()=>$n(t.id).then(r=>(n.splice(0,n.length,...r),r)),{array:n}}function Bn(t,e){t.read=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw Y.EntityWithoutName(t);return ce(t.name,r)}).then(we).then(i=>(i.hasOwnProperty("Version")&&(t.version=i.Version),t.setValues(i),i)).catch(B())},t.save=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw Y.EntityWithoutName(t);return ve(t.name,{id:r.id,values:t.changes,version:t.version})}).then(i=>{t.version=i.version}).catch(i=>{throw B()(i),i})};function n(){return typeof e=="function"?e():e}}function Fn(t){if(!t)return o.inject(C.PROVIDE_NAME_METADATA);le.initEntity(t);const e=o.computed(()=>le.state[t]);return o.provide(C.PROVIDE_NAME_METADATA,e),e}function Dn(t,e={}){if(!t)return o.inject(C.PROVIDE_NAME_USAGE_CONTEXT);const n=o.ref(null);return o.provide(C.PROVIDE_NAME_USAGE_CONTEXT,n),{state:n,update:async function(){n.value=await En(t,xn(e||{}))}}}function xn(t){return typeof t=="function"?t():t}function Vn(t){if(!t)return o.inject(C.PROVIDE_NAME_ACTIONS);const e=o.reactive([]),n=o.computed(()=>e.map(a=>We(t,a))),r={actions:n,update:i};o.provide(C.PROVIDE_NAME_ACTIONS,r),t.router=Le.useRouter(),t.handleConfirmation||(t.handleConfirmation=jn),t.handleAffectedEntity||(t.handleAffectedEntity=qn),t.handleCloseForm||(t.handleCloseForm=Wn),t.handleValidationResult||(t.handleValidationResult=Un);function i(a={}){return e.splice(0,e.length),qe(a).then(u=>e.splice(0,0,...u)).catch(B("error"))}return{actions:n,update:i}}function Mn(t){const e="Are you sure?";return t===!0||typeof t=="string"&&t.toLowerCase()==="true"||t==="1"?e:typeof t=="string"?t:e}async function jn(t,e){const n=Mn(t.confirmation);if(!se.getComponentFromStore(C.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await se.promptModal(C.MODAL_CONFIRM,{message:n}))return e()}function Un(t,e){const n=C.MODAL_VALIDATION_EFFECT;if(!se.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{se.pushModal(n,e)})}function qn(t,e,n){var u;const{router:r,form:i}=n,a=(u=e.primaryKey)==null?void 0:u.Id;if(r&&e&&e.name===t.redirectEntity)return r.push({name:e.name,params:{id:a}});i&&e.name===i.name&&e.updated&&a===i.id&&i.read()}function Wn(t,e){const{router:n}=e;n&&t.closeHostForm&&n.back()}function zn(t){function e(n){n.key==="Enter"&&t()}o.onMounted(()=>{document.addEventListener("keypress",e)}),o.onUnmounted(()=>{document.removeEventListener("keypress",e)})}function Gn(t,e={}){const n=o.reactive([]),r=s=>{const d=o.unref(t);if(s===void 0){n.length===0?d.forEach(a):d.forEach(u);return}i(s)?u(s):a(s)},i=s=>n.includes(s),a=s=>{e.handleSelect&&!e.handleSelect(s)||i(s)||n.push(s)},u=s=>{const d=n.findIndex(f=>f===s);d!==-1&&n.splice(d,1)},l=o.computed(()=>{const s=o.unref(t);return n.length===s.length&&s.length!==0});return[n,r,l,a,u]}function Hn(t){const e=o.ref(""),n=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(t).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:n}}const Z=new class{constructor(){this.store=o.reactive([])}add(e,n,r={}){const i=Jn(r),a=new Yn(e,n,i.timeout,i.children,i.click);return this.store.push(a),i.timeout&&setTimeout(this.remove.bind(this,a.id),i.timeout*1e3),a}remove(e){const n=this.store.findIndex(r=>r.id===e);if(n===-1)return!1;this.store.splice(n,1)}};function Jn(t){function e(r){return!!r&&typeof r=="object"}const n={timeout:10,click:()=>null,children:[]};return e(t)?{timeout:t.timeout||n.timeout,click:t.click||n.click,children:t.children||n.children}:n}const Ge=class He{constructor(e,n,r,i,a){this.type=e,this.message=n,this.timeout=r,this.children=i,this.click=a,this.id=He.cardId++}};Ge.cardId=1;let Yn=Ge;/*!
|
|
7
7
|
* jenesius-event-emitter v1.0.2
|
|
8
8
|
* (c) 2022 Jenesius
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/const Re=function(t,e){return t in this.events||(this.events[t]=[]),this.events[t].push(e),this.off.bind(this,t,e)},Oe=function(t,e){t in this.events&&this.events[t].forEach(n=>n(e))},Ne=function(t,e){const n=this.events[t];if(!n)return;const r=n.indexOf(e);r!==-1&&n.splice(r,1)},Ie=function(){this.events={}};class U{constructor(){this.events={}}on(e,n){return Re.call(this,e,n)}emit(e,n){return Oe.call(this,e,n)}off(e,n){return Ne.call(this,e,n)}cleanEvents(){Ie.call(this)}static on(e,n){return Re.call(U,e,n)}static emit(e,n){return Oe.call(U,e,n)}static off(e,n){return Ne.call(U,e,n)}static cleanEvents(){Ie.call(U)}}U.events={};class Kn extends U{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return Ln(this.id,e)}static checkAndGenerate(e,n,r){return In(e,n,r).then(i=>i.length===0?Nn(e,n,r):i[0])}}function Xn(){return T().emit("client:read",{})}var Je=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Zn=(t,e,n)=>(Je(t,e,"read from private field"),n?n.call(t):e.get(t)),Qn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},er=(t,e,n,r)=>(Je(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ie;const fe=class G extends U{constructor(){super(...arguments),this.type="front",this.organizations=[],Qn(this,ie,!1)}set language(e){localStorage.setItem(C.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(C.LOCALSTORAGE_LANGUAGE_KEY)||G.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){er(this,ie,e),this.emit(G.EVENT_READY_UPDATE,e)}get ready(){return Zn(this,ie)}onReady(e){return this.on(G.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(G.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(C.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(G.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(n=>n.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){B()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(C.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 Xn()}validateContextId(e){var n;try{return((n=this.person)==null?void 0:n.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};ie=new WeakMap;fe.DEFAULT_LANGUAGE="en";fe.EVENT_CONTEXT_UPDATE="event:context-update";fe.EVENT_READY_UPDATE="event:ready-update";let tr=fe;function nr(t){return T().emit("metadata:read",{entity:t})}const le=function(){const e=o.reactive({}),n=new Map;function r(l){return e[l]}async function i(l){if(n.has(l)&&await n.get(l),e[l])return;const s=await a(l);u(l,s)}function a(l){const s=nr(l).finally(()=>{n.delete(l)});return n.set(l,s),s}function u(l,s){e[l]=s}return{state:e,initEntity:i,get:r}}();class x{static login(e){return L(V.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:V.applicationName})})}static parseProcessAnswer(e){if(e.statusCode>4)throw new Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return x.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return x.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return x.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return x.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,n){return L(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(e){return x.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return x.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return x.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,n){return L(`${V.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(x.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startPasswordReset(e,n){return L(`${V.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:e})})}static confirmPhoneNumberByAccessRecovery(e,n,r,i){return L(`${V.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Prefix:r,Code:i})})}static confirmEmailByAccessRecovery(e,n,r,i){return L(`${V.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Prefix:r,Code:i})})}static finishAccessRecovery(e,n,r){return L(`${V.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Password:r,ConfirmedPassword:r})})}}class rr{static readHistoryById(e,n){return L(`/close-api/audits/history/${e}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class or{static readLicences(e){const n=`/close-api/proxy/Dashboard/Licenses?organizationId=${e.toString()}`;return L(n).then(r=>{const i={};return r.byOrganization.licenses.forEach(a=>{const u=a.licenseTypeCode;i[u]||(i[u]={licenseTypeCode:u}),i[u][a.statisticName]=a.value}),Object.values(i)})}}class ir{static getConfiguration(){return L("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(e){return await L(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}function sr(t){return typeof t!="object"||t===null?!1:!!(t.hasOwnProperty("start")||t.hasOwnProperty("end"))}function A(t){return Object.keys(t).reduce((e,n)=>{const r=t[n];if(Array.isArray(r)){const i=r.map(a=>typeof a=="string"?`'${a}'`:a).join(", ");return r.length&&e.push(`@${n} in (${i})`),e}if(sr(r)){let i=function(a){var u;return((u=a.match(/([^Z]*)/))==null?void 0:u[0])+"0000Z"};return r.start&&e.push(`@${n} ge ${i(r.start)}`),r.end&&e.push(`@${n} le ${i(r.end)}`),e}return typeof r=="number"?(e.push(`@${n} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${n} eq '${r}'`),e):(r===null&&e.push(A.is(n,r)),e)},[]).join(" and ")}function Q(t){return typeof t=="string"?`'${t}'`:`${t}`}A.includes=function(e,n){return`@${e} Contains ${Q(n)}`};A.beginWith=function(e,n){return`@${e} BeginWith ${Q(n)}`};A.notEq=function(e,n){return`@${e} nq ${Q(n)}`};A.eq=function(e,n){return Array.isArray(n)?A.in(e,n):`@${e} eq ${Q(n)}`};A.in=function(e,n){const r=n.map(Q).join(", ");return`@${e} in (${r})`};A.notIn=function(e,n){return!Array.isArray(n)||n.length===0?"":A.and(...n.map(r=>A.notEq(e,r)))};A.and=function(...e){return e.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(A.wrap).join(" and ")};A.wrap=function(e){return`(${e})`};A.is=function(e,n){return`@${e} is ${n}`};A.or=function(...e){return e.join(" or ")};function we(t){return Object.keys(t).reduce((e,n)=>{let r=t[n];const i=n.charAt(0).toUpperCase()+n.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=we(r)),e[i]=r,e},{})}const P=new tr;exports.Communication=Kn;exports.CoreError=Y;exports.Filter=A;exports.Manager=P;exports.MetadataStore=le;exports.NotificationSystem=Z;exports.OBJECT_TYPE_NAME_FIELD=fn;exports.WidgetButton=Tt;exports.WidgetIcon=X;exports.WidgetImage=Ft;exports.WidgetList=Yt;exports.WidgetLoader=Pt;exports.WidgetMultiButton=It;exports.WidgetSpinner=ue;exports.WidgetTable=_t;exports.asyncProcess=Xt;exports.authService=x;exports.billingService=H;exports.catchUniversal=B;exports.config=Kt;exports.configuration=V;exports.constants=C;exports.dashboardService=or;exports.debounce=on;exports.documentsService=nt;exports.fileService=et;exports.formatter=de;exports.getCellName=Be;exports.getCellValue=me;exports.getNamesFromListConfig=en;exports.getUnitValue=he;exports.groupArrayByField=tn;exports.historyService=rr;exports.injectAction=vn;exports.internationalizationService=Qe;exports.invitationService=tt;exports.openService=ir;exports.parseError=ae;exports.prettyDate=Ee;exports.prettyDateWithTime=De;exports.prettyMoney=Ve;exports.prettyValueFieldByEntity=cn;exports.processWizardService=oe;exports.request=L;exports.staticLink=Cn;exports.t=J;exports.throttle=sn;exports.universalEntityCount=_n;exports.universalEntityCreate=je;exports.universalEntityDelete=Ue;exports.universalEntityRead=ce;exports.universalEntityUpdate=ve;exports.universalHistoryRead=wn;exports.universalListSettingRead=mn;exports.universalMetadataFieldTreat=yn;exports.universalToolRead=qe;exports.useActions=xn;exports.useCommunication=Pn;exports.useEnter=zn;exports.useFormEntity=Bn;exports.useListActiveRow=kn;exports.useListEntity=Rn;exports.useListSearch=Hn;exports.useListSelect=Gn;exports.useManagerState=On;exports.useMetadata=Fn;exports.useSocket=T;exports.useUsageContext=Dn;exports.useWizard=st;exports.uuidv4=nn;exports.valuesToUpperCase=we;exports.wrapToolResponse=We;
|
|
10
|
+
*/const Re=function(t,e){return t in this.events||(this.events[t]=[]),this.events[t].push(e),this.off.bind(this,t,e)},Oe=function(t,e){t in this.events&&this.events[t].forEach(n=>n(e))},Ne=function(t,e){const n=this.events[t];if(!n)return;const r=n.indexOf(e);r!==-1&&n.splice(r,1)},Ie=function(){this.events={}};class U{constructor(){this.events={}}on(e,n){return Re.call(this,e,n)}emit(e,n){return Oe.call(this,e,n)}off(e,n){return Ne.call(this,e,n)}cleanEvents(){Ie.call(this)}static on(e,n){return Re.call(U,e,n)}static emit(e,n){return Oe.call(U,e,n)}static off(e,n){return Ne.call(U,e,n)}static cleanEvents(){Ie.call(U)}}U.events={};class Kn extends U{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return Ln(this.id,e)}static checkAndGenerate(e,n,r){return In(e,n,r).then(i=>i.length===0?Nn(e,n,r):i[0])}}function Xn(){return T().emit("client:read",{})}var Je=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Zn=(t,e,n)=>(Je(t,e,"read from private field"),n?n.call(t):e.get(t)),Qn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},er=(t,e,n,r)=>(Je(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ie;const fe=class G extends U{constructor(){super(...arguments),this.type="front",this.organizations=[],Qn(this,ie,!1)}set language(e){localStorage.setItem(C.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(C.LOCALSTORAGE_LANGUAGE_KEY)||G.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){er(this,ie,e),this.emit(G.EVENT_READY_UPDATE,e)}get ready(){return Zn(this,ie)}onReady(e){return this.on(G.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(G.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(C.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(G.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(n=>n.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){B()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(C.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 Xn()}validateContextId(e){var n;try{return((n=this.person)==null?void 0:n.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};ie=new WeakMap;fe.DEFAULT_LANGUAGE="en";fe.EVENT_CONTEXT_UPDATE="event:context-update";fe.EVENT_READY_UPDATE="event:ready-update";let tr=fe;function nr(t){return T().emit("metadata:read",{entity:t})}const le=function(){const e=o.reactive({}),n=new Map;function r(l){return e[l]}async function i(l){if(n.has(l)&&await n.get(l),e[l])return;const s=await a(l);u(l,s)}function a(l){const s=nr(l).finally(()=>{n.delete(l)});return n.set(l,s),s}function u(l,s){e[l]=s}return{state:e,initEntity:i,get:r}}();class V{static login(e){return L(x.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:x.applicationName})})}static parseProcessAnswer(e){if(e.statusCode>4)throw new Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return V.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return V.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return V.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return V.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,n){return L(`${x.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)})}static startLoginProcess(e){return V.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return V.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return V.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,n){return L(`${x.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)}).then(V.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startPasswordReset(e,n){return L(`${x.identityServerURL}/api/Authenticate/StartAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:n,AppName:e})})}static confirmPhoneNumberByAccessRecovery(e,n,r,i){return L(`${x.identityServerURL}/api/Authenticate/ConfirmPhoneNumberByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Prefix:r,Code:i})})}static confirmEmailByAccessRecovery(e,n,r,i){return L(`${x.identityServerURL}/api/Authenticate/ConfirmEmailByAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Prefix:r,Code:i})})}static finishAccessRecovery(e,n,r){return L(`${x.identityServerURL}/api/Authenticate/FinishAccessRecovery`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({AppName:e,Token:n,Password:r,ConfirmedPassword:r})})}}class rr{static readHistoryById(e,n){return L(`/close-api/audits/history/${e}/${n}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}class or{static readLicences(e){const n=`/close-api/proxy/Dashboard/Licenses?organizationId=${e.toString()}`;return L(n).then(r=>{const i={};return r.byOrganization.licenses.forEach(a=>{const u=a.licenseTypeCode;i[u]||(i[u]={licenseTypeCode:u}),i[u][a.statisticName]=a.value}),Object.values(i)})}}class ir{static getConfiguration(){return L("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}static async getList(e){return await L(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}function sr(t){return typeof t!="object"||t===null?!1:!!(t.hasOwnProperty("start")||t.hasOwnProperty("end"))}function A(t){return Object.keys(t).reduce((e,n)=>{const r=t[n];if(Array.isArray(r)){const i=r.map(a=>typeof a=="string"?`'${a}'`:a).join(", ");return r.length&&e.push(`@${n} in (${i})`),e}if(sr(r)){let i=function(a){var u;return((u=a.match(/([^Z]*)/))==null?void 0:u[0])+"0000Z"};return r.start&&e.push(`@${n} ge ${i(r.start)}`),r.end&&e.push(`@${n} le ${i(r.end)}`),e}return typeof r=="number"?(e.push(`@${n} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${n} eq '${r}'`),e):(r===null&&e.push(A.is(n,r)),e)},[]).join(" and ")}function Q(t){return typeof t=="string"?`'${t}'`:`${t}`}A.includes=function(e,n){return`@${e} Contains ${Q(n)}`};A.beginWith=function(e,n){return`@${e} BeginWith ${Q(n)}`};A.notEq=function(e,n){return`@${e} nq ${Q(n)}`};A.eq=function(e,n){return Array.isArray(n)?A.in(e,n):`@${e} eq ${Q(n)}`};A.in=function(e,n){const r=n.map(Q).join(", ");return`@${e} in (${r})`};A.notIn=function(e,n){return!Array.isArray(n)||n.length===0?"":A.and(...n.map(r=>A.notEq(e,r)))};A.and=function(...e){return e.filter(n=>typeof n!="string"||n.trim().length===0?!1:n).map(A.wrap).join(" and ")};A.wrap=function(e){return`(${e})`};A.is=function(e,n){return`@${e} is ${n}`};A.or=function(...e){return e.join(" or ")};function we(t){return Object.keys(t).reduce((e,n)=>{let r=t[n];const i=n.charAt(0).toUpperCase()+n.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=we(r)),e[i]=r,e},{})}const P=new tr;exports.Communication=Kn;exports.CoreError=Y;exports.Filter=A;exports.Manager=P;exports.MetadataStore=le;exports.NotificationSystem=Z;exports.OBJECT_TYPE_NAME_FIELD=fn;exports.WidgetButton=Tt;exports.WidgetIcon=X;exports.WidgetImage=Ft;exports.WidgetList=Yt;exports.WidgetLoader=Pt;exports.WidgetMultiButton=It;exports.WidgetSpinner=ue;exports.WidgetTable=_t;exports.asyncProcess=Xt;exports.authService=V;exports.billingService=H;exports.catchUniversal=B;exports.config=Kt;exports.configuration=x;exports.constants=C;exports.dashboardService=or;exports.debounce=on;exports.documentsService=nt;exports.fileService=et;exports.formatter=de;exports.getCellName=Be;exports.getCellValue=me;exports.getNamesFromListConfig=en;exports.getUnitValue=he;exports.groupArrayByField=tn;exports.historyService=rr;exports.injectAction=vn;exports.internationalizationService=Qe;exports.invitationService=tt;exports.openService=ir;exports.parseError=ae;exports.prettyDate=Ee;exports.prettyDateWithTime=De;exports.prettyMoney=xe;exports.prettyValueFieldByEntity=cn;exports.processWizardService=oe;exports.request=L;exports.staticLink=Cn;exports.t=J;exports.throttle=sn;exports.universalEntityCount=_n;exports.universalEntityCreate=je;exports.universalEntityDelete=Ue;exports.universalEntityRead=ce;exports.universalEntityUpdate=ve;exports.universalHistoryRead=wn;exports.universalListSettingRead=mn;exports.universalMetadataFieldTreat=yn;exports.universalToolRead=qe;exports.useActions=Vn;exports.useCommunication=Pn;exports.useEnter=zn;exports.useFormEntity=Bn;exports.useListActiveRow=kn;exports.useListEntity=Rn;exports.useListSearch=Hn;exports.useListSelect=Gn;exports.useManagerState=On;exports.useMetadata=Fn;exports.useSocket=T;exports.useUsageContext=Dn;exports.useWizard=st;exports.uuidv4=nn;exports.valuesToUpperCase=we;exports.wrapToolResponse=We;
|
|
11
11
|
//# sourceMappingURL=eservices-core.cjs.js.map
|
|
@@ -6,7 +6,7 @@ import bt from "date-and-time";
|
|
|
6
6
|
import ke from "debug";
|
|
7
7
|
import { getComponentFromStore as Ke, promptModal as Ct, pushModal as Tt } from "jenesius-vue-modal";
|
|
8
8
|
/*!
|
|
9
|
-
* eservices-core v1.3.
|
|
9
|
+
* eservices-core v1.3.129
|
|
10
10
|
* (c) 2024 ESERVICES
|
|
11
11
|
*/
|
|
12
12
|
let Q = {};
|
|
@@ -1455,7 +1455,8 @@ function Pn(t, e) {
|
|
|
1455
1455
|
var o;
|
|
1456
1456
|
const n = typeof t.values == "function" ? t.values(e, t) : t.values, r = () => $n({
|
|
1457
1457
|
name: e.name,
|
|
1458
|
-
values: n
|
|
1458
|
+
values: n,
|
|
1459
|
+
usageContext: e.usageContext
|
|
1459
1460
|
}).then(async (s) => {
|
|
1460
1461
|
var u, c;
|
|
1461
1462
|
if (!xn(s))
|
|
@@ -1,9 +1,9 @@
|
|
|
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}.widget-list-head-cell[data-v-bf495d6a]{padding:0 0 0 10px;display:flex}.widget-list-head-cell[data-v-bf495d6a]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-bf495d6a]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-bf495d6a]{position:absolute;inset-inline-end:22px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-bf495d6a]{transform:rotate(180deg)}.head-cell-resize[data-v-bf495d6a]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-bf495d6a]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-bf495d6a]:after{content:"";margin:auto;width:1px;height:100%;display:block;background-color:#d2d2d2}.widget-list-head[data-v-ccffc6bd]{position:sticky;top:-1px;z-index:1}.test-block[data-v-ccffc6bd]{position:absolute;z-index:2;display:none;height:calc(100% + 1px);place-content:center;inset-block-start:-1px;padding-inline:10px;background-color:#e7f2ff;-webkit-user-select:none;user-select:none;white-space:nowrap}.widget-list-head th[data-v-ccffc6bd]{position:sticky;top:0;z-index:2;-webkit-user-select:none;user-select:none}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
(function(c,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("jenesius-vue-form"),require("vue"),require("vue-router"),require("date-and-time"),require("debug"),require("jenesius-vue-modal")):typeof define=="function"&&define.amd?define(["exports","jenesius-vue-form","vue","vue-router","date-and-time","debug","jenesius-vue-modal"],N):(c=typeof globalThis<"u"?globalThis:c||self,N(c["eservices-core"]={},c.JenesiusVueForm,c.Vue,c.VueRouter,c.DateAndTime,c.Debug,c.JenesiusVueModal))})(this,function(c,N,o,be,Ke,he,te){"use strict";/*!
|
|
3
|
-
* eservices-core v1.3.
|
|
3
|
+
* eservices-core v1.3.129
|
|
4
4
|
* (c) 2024 ESERVICES
|
|
5
5
|
*/const ar="";let G={};function H(t,...e){if(typeof t!="string")return console.trace(`Label is not provided for translation: ${t}`),"undefined";let n=N.utils.getPropFromObject((this==null?void 0:this.vocabulary)||G,t);if(typeof n=="string")return Se(n,e);const r=N.utils.getPropFromObject(G==null?void 0:G.root,t);return typeof r=="string"?Se(r,e):(typeof n===void 0&&console.warn(`Translation for label "${t}" is not founded.`),t)}function Se(t,e){return e.forEach((n,r)=>{t=t.replaceAll(new RegExp(`\\{${r}}`,"g"),n)}),t}H.setGlobalVocabulary=function(t){G=t},H.getScope=function(t){const e=typeof t=="string"?t:"root";return typeof t!="string"&&console.warn(`SCOPE ${t} for translate is not string.`),H.bind({vocabulary:N.utils.getPropFromObject(G,e.toLowerCase())})},H.setVocabulary=function(t){return typeof t=="string"&&(t=N.utils.getPropFromObject(G,t)),H.bind({vocabulary:t})};const Te=class E extends Error{constructor(e,n=null){super(),this.message=e,this.details=n,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,n){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,n){return!e&&!n?E.ApiNotAvailable():new E(e||"Authorization Error",n)}static ApiResponseParseFailed(){return E.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new E("Object doesn't have id",e)}static ObjectWithIdNotFound(e,n){return new E(`Can't find object with id: ${e}`,n)}static ObjectWithoutConnectToPresentArray(e,n){return new E("Object is not found.",{object:e,array:n})}static EntityWithoutId(e){return new E("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,n){return new E(`Can't find the element with tableIndex ${e}`,n)}static UndefinedError(e,n=[]){return new E(e,n)}static TableArrayAlreadyIncludeProvidedIndexValue(e,n,r){return new E(`Array already includes the element with value ${e}`,{array:n,table:r})}static MetadataEntityIsNotAvailable(e){return new E(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new E("The request took too long to complete. Try again later.")}};Te.ID=0;let J=Te;const Xe="Please try again later or submit a feedback if problem doesn't go.";function Ze(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return Xe}})}function M(t,e={}){return e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw J.ApiNotAvailable()}).then(n=>Ze(n).then(r=>{if(!n.ok)throw r;return r}))}class Qe{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,n,r)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[n]=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")}}new Qe;class et{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return M(`/open-api/internationalization/language/${e}`)}}function ke(t){return{...t,createdEntities:t.createdEntites}}const Ae=class pe{static async getStartConfig(e,n){return M([pe.url,e,n].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,n){return M([pe.url,e,n].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(ke)}static async runStep(e,n,r,i,a){return M([pe.url,e,n].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:a})}).then(ke)}};Ae.url="/close-api/views/process-wizard";let ne=Ae;class tt{static async upload(e,n){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${n}`;return await fetch(i,{method:"POST",body:r}).then(a=>a.json()).then(a=>(a.filename=e.name,a))}}class nt{static invite(e,n,r){return M("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:n,relatedRoleCode:r})})}static accept(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!0})})}static decline(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!1})})}}class rt{static getRequiredDocuments(e,n,r){const i=new URLSearchParams({entity:e,primaryKey:n,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(a=>a.json())}}class Y{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${Y.url()}/calculator/${e}`)}static calculate(e,n){return M(`/${Y.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:n})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):J.ApiNotAvailable()})}static parseMetadataField(e){function n(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:n(e)}}static createOnlinePayment(e,n){return M(`/${Y.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:n})})}static applyOnlinePayment(e){return M(`/${Y.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}function ot(t){return t.statusName==="Completed"}function it(t){return t.statusName==="FinalStepWithConfirmation"}function st(t){return t.statusName==="ValidationError"}function at(t,e,n){let r=null;const i=o.reactive({wait:null});let a=[],d=null;const u=o.ref(null);function s(){u.value=a.find(l=>l.name===d)||null}function f(){var l;return d?((l=a.find(g=>g.name===d))==null?void 0:l.fields)||[]:[]}function p(l){if(s(),st(l))return void n.onValidation(l.validationResults);if((l.statusName==="FinalStep"||l.statusName==="NextStep")&&(!f().length||ct(f(),n.presets)))return F(n.presets||{});ot(l)&&n.onCompleted(l),it(l)&&n.onConfirmation(l)}async function T(){try{await I(),await _()}catch(l){const{message:g}=oe(l);Z.add("error",g)}}function I(){return i.wait="Loading process information.",ne.getStartConfig(e,t).then(l=>{a=l.steps.map(g=>({label:g.title,name:g.stepName,number:g.number,fields:g.frontendEntity.objectTypes.reduce((m,v)=>(v.properties.forEach(O=>{m.push({name:O.name,label:O.title,type:O.refEntityName||O.dataType})}),m),[])}))}).then(l=>(i.wait=!1,l))}function w(l){return d=l.nextStepName,r=l.token,l}function b(l){const g=oe(l);Z.add("error",g.message)}function _(){return i.wait="Starting process",ne.startProcess(e,t).then(w).then(p).catch(b).finally(()=>{i.wait=null})}function F(l={}){return!r||!d?Promise.reject("Not step or token."):(i.wait="Waiting for result...",ne.runStep(e,t,d,r,l).then(w).then(p).catch(b).finally(()=>{i.wait=!1}))}return{initialize:T,state:i,currentStepConfig:o.readonly(u),next:F}}function ct(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!N.utils.getPropFromObject(e,r.name))return!1}return!0}const lt={class:"widget-table__head"},ut={class:"widget-table__head-label margin_0 text_overflow"},dt=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("tr",lt,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",ut,o.toDisplayString(r.label),1)]))),128))]))}}),cr="",q=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},ft=q(dt,[["__scopeId","data-v-25198f4a"]]);function Re(t){return typeof t.name=="string"?t.name:Array.isArray(t.name)?t.name[0]:null}function pt(t){const e=new RegExp(/\$\{([a-zA-Z0-9.]+)}/,"g"),n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}function ht(t,e){return pt(t).forEach(r=>{t=t.replace(new RegExp("\\$\\{"+r+"}","g"),N.utils.getPropFromObject(e,r))}),t}function ge(t){return e=>typeof e=="string"||typeof e=="number"?`${e} ${t}`:""}function me(t,e){const n=Re(t);if(typeof t.value=="string")return ht(t.value,e);let r=n?N.utils.getPropFromObject(e,n):null;if(r===void 0&&(r=null),typeof t.value=="function")return t.value(r,e);if(t.value===null)return null;if(t.unitValue&&(r=ge(t.unitValue)(r)),t.unit&&(r=ge(t.unit)(r)),t.type)switch(t.type){case"number":{typeof r=="number"&&(r=new Intl.NumberFormat().format(r));break}case"date":{r=Ee(typeof r=="string"?r:null);break}case"dateTime":case"dateWithTime":{r=Le(typeof r=="string"?r:null);break}case"money":{r=$e(r);break}}return t.formatter&&(r=ae(t.formatter).exec(r,e)),typeof r=="boolean"&&(r=r?"✓":"—"),r}const C={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:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",TIME_TO_LIVE_SOCKET_REQUEST:3e4,CORE_DEBUG_LABEL:"eservices-core"};function ye(t){return[C.CORE_DEBUG_LABEL,t].join(":")}const lr="",X=q({props:{name:String},setup(t,e){let n="unknown";try{n=e.slots.default()[0].children}catch{n=t.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${n}`})}},[["__scopeId","data-v-e287c8d9"]]),gt=he(ye("setup-list-row"));function mt(t,e){const n=t.config.map(r=>yt(r,t,e));return o.h("tr",{class:"widget-table__row widget-table-row"},n)}function yt(t,e,n){const r=e.values;let i=me(t,r);const a={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(p){a.onClick.push(()=>p(r))}function u(p){Array.isArray(p)?a.class.push(...p):a.class.push(p)}const s=[],f=[];if(t.hide&&t.hide(r))return[o.h("td")];if(t.type)switch(u(`widget-table-cell_${t.type}`),t.type){case"multi-select":{f.push(o.h(N.FormField,{type:"single-checkbox",modelValue:e.selected})),d(Oe.bind(null,n,!0));break}case"select":{f.push(o.h(N.FormField,{type:"single-radio",modelValue:e.selected})),d(Oe.bind(null,n,!1));break}}if(t.onClick&&d(t.onClick),t.link)try{const p=t.link(r);if(p){const T=o.h(be.RouterLink,{to:p});f.push(T),u("widget-table-cell_link")}}catch(p){gt("Can't add router link",p)}if(t.href&&(f.push(o.h("a",{href:t.href(r),target:"_blank"})),u("widget-table-cell_link")),(typeof i=="string"||typeof i=="number")&&f.push(o.h("p",{class:"widget-list-cell-text"},i)),t.icon&&(typeof t.icon=="string"&&f.push(o.h(X,{name:t.icon})),typeof t.icon=="function")){const p=t.icon(r);p!==null&&f.push(o.h(X,{name:p}))}return t.class&&(typeof t.class=="function"?u(t.class(r)):u(t.class)),s.push(o.h("td",a,f)),s}function Oe(t,e){t.emit("select",e)}function Ne(t,e){return()=>{try{return mt(t,e)}catch(n){return console.warn(n),null}}}const Et={props:{values:Object,config:Object,selected:Boolean},setup:Ne},wt=["colspan"],Ie=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(t,{emit:e}){const n=o.ref();return o.onMounted(()=>{setTimeout(()=>{n.value&&n.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:n},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=a=>e("close")),onSave:i[1]||(i[1]=a=>e("save",a))}),null,16,["values","new"]))],8,wt)],512))}}),_t={class:"widget-table"},ve="update:selectedRows",Ct=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1}},emits:["update:activeRow","save"],setup(t,{emit:e}){const n=t,r=o.useSlots(),i=o.computed(()=>{var s;return(s=r==null?void 0:r.default)==null?void 0:s.call(r)[0]});function a(s,f=!0){if(!n.selectedRows)return;if(!f)return e(ve,n.selectedRows.includes(s)?[]:[s]);const p=[...n.selectedRows],T=p.indexOf(s);return T===-1?p.push(s):p.splice(T,1),e(ve,p)}function d(s){e("save",s),e("update:activeRow",null)}const u=o.computed(()=>n.shortcut?n.config.filter(s=>s.name?!!n.array.find(p=>![null,""].includes(me(s,p))):!0):n.config);return(s,f)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",_t,[o.createVNode(ft,{config:u.value},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.array,(p,T)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:T},[o.createVNode(Et,{config:u.value,values:p,selected:s.selectedRows.includes(p),onSelect:I=>a(p,I),class:o.normalizeClass(s.classCallback?s.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&s.activeRow===p?(o.openBlock(),o.createBlock(Ie,{key:0,component:i.value,"row-length":s.config.length,values:p,onClose:f[0]||(f[0]=I=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),s.activeRow===o.unref(C).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(Ie,{key:0,component:i.value,"row-length":u.value.length,onClose:f[1]||(f[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),bt=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}}),dr="",re=q(bt,[["__scopeId","data-v-0ef9ae88"]]),St={class:"widget-button"},Tt=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("button",St,[e.wait?(o.openBlock(),o.createBlock(re,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}}),fr="",kt=q(Tt,[["__scopeId","data-v-450dc564"]]),At={class:"widget-multi-button-wrap position_relative cursor_pointer"},Rt={class:"widget-multi-button-body grid"},Ot=["onClick"],Nt={class:"widget-multi-button-side-wrap"},It=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(t){const e=t;o.useCssVars(d=>({"7025434e":r.value}));const n=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(d){if(!(typeof d!="function"||n.wait))return n.wait=!0,Promise.resolve().then(d).finally(()=>{n.wait=!1})}function a(d=!n.active){n.active=d}return(d,u)=>(o.openBlock(),o.createElementBlock("div",At,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[o.createElementVNode("div",Rt,[d.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:u[0]||(u[0]=s=>a())},o.toDisplayString(d.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.array,(s,f)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:f,onClick:p=>{i(s.callback),a(!1)}},o.toDisplayString(s.label),9,Ot))),128))]),o.createElementVNode("div",Nt,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:u[1]||(u[1]=s=>a())},[n.wait?(o.openBlock(),o.createBlock(o.unref(re),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(o.openBlock(),o.createBlock(o.unref(X),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}}),pr="",vt=q(It,[["__scopeId","data-v-a8d711d1"]]),Lt={class:"widget-loader flex flex-align_center gap_10 padding_15"},$t={class:"text_md"},Pt=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",Lt,[o.createVNode(re,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",$t,o.toDisplayString(e.label),1)]))}}),Bt=["alt","src"],Dt=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(t){const e=t,n=o.ref();return o.onMounted(()=>{n.value&&(n.value.src=e.src),n.value.onerror=function(){e.default&&(n.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:n,src:r.src||r.$props.default},null,8,Bt))}}),Ft={props:{config:Array,values:Object,selected:Boolean},setup:Ne},hr="",Mt=q(Ft,[["__scopeId","data-v-344a8cc1"]]),Vt=t=>(o.pushScopeId("data-v-bf495d6a"),t=t(),o.popScopeId(),t),jt={class:"widget-list-head-cell"},Ut=Vt(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),qt=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(t,{emit:e}){const n=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",jt,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(N.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(a=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=a=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(X),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),Ut])]))}}),gr="",Wt=q(qt,[["__scopeId","data-v-bf495d6a"]]),zt=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(t,{emit:e}){const n=t,r=o.ref(),i=o.ref();o.onMounted(()=>{function s(w,b){let _=-1;do _++,b-=w[_];while(b>0&&_<w.length);return _}function f(w,b){let _=0;for(;b>0&&b>w[_]&&_<w.length;)b-=w[_],_++;return console.log(b,_),_>0?_:0}function p(w){try{i.value.style.insetInlineStart=w+"px"}catch(b){console.log(b)}}function T(w){try{i.value.style.width=w+"px",i.value.style.minWidth=w+"px",i.value.style.maxWidth=w+"px"}catch(b){console.log(b)}}function I(w){return w===null?!1:w.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(b){var Je;function _(P){return P.screenX+g-O}const F=r.value,l=[...F.children].filter(P=>P.localName==="th"),g=((Je=F.offsetParent)==null?void 0:Je.scrollLeft)||0,m=l.map(P=>P.clientWidth),v=I(b.target),O=F.getBoundingClientRect().left,z=_(b),h=s(m,z),y=m.slice(0,h).reduce((P,U)=>P+U,0),S=z-y,A=F.offsetWidth,L=l[h].clientWidth;if(n.config[h].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",b.screenX),console.log("Widths",m),console.log("max width",A),console.log("Start Position",z),console.log("Position From",h),console.log("Start Position",h),console.log("Global offset (Отступ самой таблицы от края экрана)",O),console.log("Del",S),console.groupEnd(),i.value.innerText=l[h].textContent||"",i.value.style.display="grid",i.value.style.width=L+"px",i.value.style.cursor="grabbing",p(y),T(L),document.addEventListener("pointermove",He,{passive:!0}),document.addEventListener("pointerup",de);function de(P){if(console.group("END"),document.removeEventListener("pointermove",He),document.removeEventListener("pointerup",de),v&&(n.config[h].width=i.value.style.width,n.config[h].minWidth=i.value.style.width,n.config[h].maxWidth=i.value.style.width,a(n.config)),!v){const U=P.screenX+g-O;console.log("ENP Position",U);const fe=f(m,U);if(console.log(h,"->",fe),fe!==h){const ee=n.config[h],Ce=n.config;Ce.splice(h,1),Ce.splice(fe,0,ee),a(Ce)}else{const ee=n.config[h].name;d(ee)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function He(P){if(v){const ee=_(P)-z+L;T(ee);return}let U=P.screenX+g-O-S;U<0&&(U=0),U+L>A&&(U=A-L),p(U)}})});function a(s){e("update:config",s)}function d(s){if(!s)return;if(Array.isArray(s)){if(s.length<1)return;s=s[0]}if(n.order.length===0||n.order[0]!==s)return void u([s]);const f=n.order.length===1||n.order[1]==="asc"?"asc":"desc";u([s,f==="asc"?"desc":"asc"])}function u(s){e("update:order",s)}return(s,f)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.config,(p,T)=>(o.openBlock(),o.createBlock(Wt,o.mergeProps({key:p},p,{onOrder:I=>d(p.name),onSelect:f[0]||(f[0]=I=>e("select")),order:s.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}}),mr="",Gt=q(zt,[["__scopeId","data-v-ccffc6bd"]]),xt={class:"widget-list"},Ht={class:"widget-list-body position_relative"},Jt=50,Yt=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(t,{emit:e}){const n=t;function r(u,s=!0){if(n.selectedRows)if(!s)a(n.selectedRows.includes(u)?[]:[u]);else{const f=[...n.selectedRows],p=f.indexOf(u);p===-1?f.push(u):f==null||f.splice(p,1),a(f)}}function i(){var u;if(((u=n.selectedRows)==null?void 0:u.length)!==n.array.length)return a([...n.array]);a([])}function a(u){e("update:selectedRows",u)}function d(u){if(!u)return;const s=u.target;s.scrollTop+s.clientHeight+Jt>s.scrollHeight&&e("scrollEnd")}return(u,s)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[o.createElementVNode("table",xt,[o.createElementVNode("thead",null,[o.createVNode(Gt,{onSelect:s[0]||(s[0]=f=>i()),"onUpdate:order":s[1]||(s[1]=f=>e("update:order",f)),"onUpdate:config":s[2]||(s[2]=f=>e("update:config",f)),config:u.config,order:u.order},null,8,["config","order"])]),o.createElementVNode("tbody",Ht,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.array,(f,p)=>{var T;return o.openBlock(),o.createBlock(Mt,{key:p,class:"widget-list-row",values:f,config:u.config,selected:(T=u.selectedRows)==null?void 0:T.includes(f),onSelect:I=>r(f,I)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),V={};function Kt(t){for(let e in t)V[e]=t[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function Le(t){return Ee(t,"YYYY/MM/DD HH:mm:ss")}function Ee(t,e="YYYY/MM/DD"){if(!t)return"";try{const n=new Date(t);return Ke.format(n,e)}catch(n){return console.log(n),"Invalid date"}}function Xt(t){function e(...r){return n.wait?Promise.reject("The process has already started."):(n.wait=!0,Promise.resolve().then(()=>t(...r)).finally(()=>{n.wait=!1}))}const n=o.reactive({wait:!1,call:e});return n}function oe(t){return typeof t=="string"?ie(t):Zt(t)?ie(t.message,t.children||t.details||[]):Qt(t)?ie(t.title,[t.detail||""]):ie(C.DEFAULT_ERROR_MESSAGE)}function Zt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"message"))}function Qt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"title"))}function ie(t,e=[]){return{message:t,children:e}}function B(t="error"){return function(e){const{message:n,children:r}=oe(e);Z.add(t,n,{children:r})}}function se(t,e={}){return k().emit("entity:read",{...e,entity:t})}function we(t,e){return k().emit("entity:update",{...e,entity:t})}function en(t){return t.reduce((e,n)=>(n.name&&(typeof n.name=="string"?e.push(n.name):e.push(...n.name)),e),[])}function $e(t,e=2){if(!(typeof t=="string"||typeof t=="number"))return"";let r=String(t).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 tn(t,e){const n=new Map;return t.forEach(r=>{var a;const i=e(r);n.has(i)||n.set(i,[]),(a=n.get(i))==null||a.push(r)}),n}function nn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function rn(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return C.DEFAULT_ERROR_MESSAGE}})}function $(t,e={}){return D.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=D.contextId),e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw new Error(C.DEFAULT_ERROR_MESSAGE)}).then(n=>rn(n).then(r=>{if(!n.ok)throw r;return r}))}function on(t,e=1e3){let n=0;return(...r)=>{clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function sn(t,e){let n=!1;return(...r)=>{if(!n)return n=!0,setTimeout(()=>n=!1,e),t(...r)}}const an=he(ye("pretty-value-field-by-entity"));function cn(t,e,n){try{const r=ue.get(t);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${t} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(r){return an('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,t,e,n),n}}const ln=1,un=5e3,dn="static-folder",Pe="request-error",fn="Distinguisher",x=he(ye("use-socket"));function k(){return hn}function pn(t){return typeof t=="object"&&Object.prototype.toString.call(t)==="[object Blob]"}const hn=function(){let t=1,e,n;const r=new Set;let i=0;const a=new Set;function d(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},un*2);const l=new Uint8Array(1);l[0]=ln,e.send(l)}setInterval(()=>{Array.from(r).forEach(l=>{F(l)&&(x("Handler for event %s requestId %d was expired",l.event,l.requestId),l.requestId?s({requestId:l.requestId,event:Pe,data:{message:J.RequestTookToLong().message}}):r.delete(l))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&f()},C.DELAY_SOCKET_RECONNECT);function u(){return{safeQueue:a,requestId:t,handlers:r,socketInstance:e}}function s(l){const g=[...r.values()];x("Handlers array length is %d. Response event: %s. Request id: %d",r.size,l.event,l.requestId),g.forEach(m=>{const v=l.requestId;(m.requestId&&m.requestId===v||!m.requestId&&m.event===l.event)&&(x("Find appropriated handler: %d, event: %s",t,m.event),m.callback(l.data,l),m.once&&(r.delete(m),x("Handler was removed by *once* params was passed. %o",m)))})}function f(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),e=new WebSocket(n),e.onclose=function(l){x("Connection to server was stopped: %d %s",l.code,l.reason),Array.from(r).forEach(g=>{g.guaranteedAnswer&&g.serializeString&&a.add(g.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(l=>{p(l),a.delete(l)})},e.onerror=function(l){console.warn(l)},e.onmessage=l=>{var g;try{if(pn(l.data)){d();return}const m=JSON.parse(l.data);if(!Be(m)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(m);return}(g=m==null?void 0:m.data)!=null&&g.refresh&&location.reload(),s(m)}catch(m){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(m)}}}function p(l){e.send(l)}function T(l,g){_({event:l,callback:g})}function I(l,g){_({event:l,callback:g,once:!0})}function w(){return e&&(e==null?void 0:e.readyState)===1}function b(l,g,m){const v=++t,O=JSON.stringify({requestId:v,event:l,data:g,contextId:D.contextId,url:window.location.href});return w()?p(O):(a.add(O),x("Socket is not connected. Message was send to save-queue")),new Promise((z,h)=>{_({event:l,requestId:v,once:!0,guaranteedAnswer:!0,serializeString:O,callback:(y,S)=>{if(x("Promise was resolve with next data:",y),gn(S))return void h(y);m&&m(y,S),z(y)},timeToLive:C.TIME_TO_LIVE_SOCKET_REQUEST})})}function _(l){const g={timeToLive:0,...l,created:new Date().getTime()};r.add(g)}function F(l){return l.timeToLive===0||typeof l.timeToLive!="number"?!1:new Date().getTime()-l.created>l.timeToLive}return{get socket(){return e},on:T,once:I,emit:b,initialization(l){n=l},getDevInfo:u}}(),gn=t=>!!Be(t)&&t.event===Pe,Be=t=>typeof t=="object"&&t!==null&&"event"in t&&typeof t.event=="string"&&"requestId"in t&&typeof t.requestId=="number"&&"data"in t;function mn(t,e){return k().emit("list-setting:read",{entity:t,mark:e})}function yn(t,e){return k().emit("metadata-field:treat",{entity:t,fieldName:e})}function De(t,e){return k().emit("entity:create",{...e,entity:t})}function Fe(t,e){return k().emit("entity:delete",{...e,entity:t})}function En(t,e){return k().emit("usage-context:read",{...e,entity:t})}function Me(t={}){return k().emit("tool:read",t)}function wn(t,e={},n={}){const r=o.inject(C.PROVIDE_NAME_ACTIONS,null),i=typeof t=="string"?t:e,a=typeof e=="string"?n:e;return o.computed(()=>{var s;const u=((typeof t=="string"?(s=r==null?void 0:r.actions)==null?void 0:s.value:o.unref(t))||[]).find(f=>f.name===i);return u?{...u,...a}:null})}function _n(t){return k().emit("history:read",t)}function Cn(t,e){return k().emit("entity:count",{...e,entity:t})}function bn(t){return`/${dn}/${t}`}function ae(t){return{exec(e,n){switch(t.name){case"replace-boolean":return ae.replaceBoolean(e,t.values)}}}}ae.replaceBoolean=Sn;function Sn(t,e){return t?e[1]:e[0]}function Tn(t={}){return k().emit("tool:execute",t)}function Ve(t,e){return{...e,label:e.title,callback(){var i;const n=typeof t.values=="function"?t.values(e,t):t.values,r=()=>Tn({name:e.name,values:n}).then(async a=>{var d,u;if(!kn(a))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(t.handlers))for await(const s of t.handlers)await s(e,a,t);if(!a.success)throw t.handleValidationResult&&a.validationEffect&&((u=(d=a.validationEffect)==null?void 0:d.results)!=null&&u.length)&&t.handleValidationResult(e,a.validationEffect,t),new Error(a.message);return a.message&&Z.add("info",a.message),Array.isArray(a.affectedEntities)&&t.handleAffectedEntity&&a.affectedEntities.forEach(s=>{var f;return(f=t.handleAffectedEntity)==null?void 0:f.call(t,e,s,t)}),e.closeHostForm&&t.handleCloseForm&&t.handleCloseForm(e,t),a}).catch(B("error"));return(i=t.overrides)!=null&&i[e.name]?t.overrides[e.name](e,t):e.requireSave&&t.form&&t.form.changed?t.form.save().then(r):!e.confirmation||!t.handleConfirmation?r():t.handleConfirmation(e,r)}}}function kn(t){return!!(t&&typeof t=="object"&&"affectedEntities"in t&&"success"in t)}function An(){const t=o.ref(null);function e(n){t.value=n}return{activeRow:t,activateRow:e}}function Rn(t,e){return typeof t!="object"||t===null?!1:Object.values(t).join().toLowerCase().includes(e)}async function je(t,e){t()?(await e(),await je(t,e)):console.log("async while was stopped.")}function On(t,e,n={}){let r=!1;const i=o.ref(""),a=o.computed(()=>d.filter(h=>f(h,i.value))),d=o.reactive([]);let u=0;const s=o.ref(!1);let f=(n==null?void 0:n.filterSearchFn)||((h,y)=>Rn(h,y));function p(){return n.masterEntities?typeof n.masterEntities=="function"?n.masterEntities():n.masterEntities:[]}function T(){const h=v();return typeof h.limit!="number"&&(h.limit=100),h.offset=u,(n.request||se)(t,h).then(S=>(u+=S.length,S))}function I(h,y){var A;return typeof h.Version=="number"?h.Version:(A=d.find(L=>L.Id===y))==null?void 0:A.Version}function w(h,y){const S=d.findIndex(A=>A.Id===h);if(S===-1)throw new Error(`Can't found item with Id ${h}`);d.splice(S,1,y)}function b(h){const y=d.findIndex(S=>S.Id===h);if(y===-1)throw new Error(`Can't found item with Id ${h}`);d.splice(y,1)}async function _(h,y){try{const S=v(),A=I(y,h);delete y.Version,await we(t,{id:h,values:y,version:A,masterEntities:p()});const L=await se(t,{fields:S.fields||"",id:h});w(h,L)}catch(S){B()(S)}}async function F(h,y={}){try{const S=v(),A=I(y,h);delete y.Version,await Fe(t,{id:h,version:A,masterEntities:p()}),b(h)}catch(S){B()(S)}}async function l(h){try{await De(t,{values:h,masterEntities:p()}),await O()}catch(y){B()(y)}}let g;async function m(){console.log("next"),s.value=!0;try{g!=null&&g.signal&&!g.signal.aborted&&g.abort();let h=g=new AbortController,y=0;const A=v().limit||0;if(i.value&&!A){console.warn("Using textSearch assumes the use of limit.");return}await je(()=>(A>0?y<A:!0)&&!r&&!h.signal.aborted,async()=>{console.log("Step read data. Count for filter %d",y);const L=await T();if(h.signal.aborted){console.log("Signal is aborted");return}console.log("Rows (count %d) was added.",L.length),d.push(...L),y+=L.filter(de=>f(de,i.value)).length,(L.length<A||A===0)&&(r=!0)})}catch(h){B()(h)}s.value=!1}function v(){return typeof e=="function"?e():e}async function O(){try{u=0,r=!1,d.splice(0,d.length),await m()}catch(h){B()(h)}}function z(){if(g)return g.abort();s.value=!1}return{array:d,updateById:_,next:m,reload:O,wait:s,create:l,deleteById:F,textSearch:i,filteredArray:a,abort:z}}function Nn(){function t(){return{organizations:D.organizations,currentContextId:D.contextId,person:D.person,context:D.context,contextType:D.contextType,userId:D.userId}}const e=o.reactive(t());return D.onupdateContext(()=>{Object.assign(e,t())}),e}function In(t,e,n){return k().emit("communication:create",{entityName:t,entityCatalogId:e,targetCode:n})}function vn(t,e,n){return k().emit("communication:read",{entityName:t,entityCatalogId:e,targetCode:n})}function Ln(t,e){return k().emit("communication-message:create",{communicationId:t,text:e})}function $n(t){return k().emit("communication-message:read",{communicationId:t})}function Pn(t){const e=N.Form.getParentForm(),n=o.reactive([]);return e&&e.subscribe(t),t.read=()=>$n(t.id).then(r=>(n.splice(0,n.length,...r),r)),{array:n}}function Bn(t,e){t.read=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw J.EntityWithoutName(t);return se(t.name,r)}).then(_e).then(i=>(i.hasOwnProperty("Version")&&(t.version=i.Version),t.setValues(i),i)).catch(B())},t.save=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw J.EntityWithoutName(t);return we(t.name,{id:r.id,values:t.changes,version:t.version})}).then(i=>{t.version=i.version}).catch(i=>{throw B()(i),i})};function n(){return typeof e=="function"?e():e}}function Dn(t){if(!t)return o.inject(C.PROVIDE_NAME_METADATA);ue.initEntity(t);const e=o.computed(()=>ue.state[t]);return o.provide(C.PROVIDE_NAME_METADATA,e),e}function Fn(t,e={}){if(!t)return o.inject(C.PROVIDE_NAME_USAGE_CONTEXT);const n=o.ref(null);return o.provide(C.PROVIDE_NAME_USAGE_CONTEXT,n),{state:n,update:async function(){n.value=await En(t,Mn(e||{}))}}}function Mn(t){return typeof t=="function"?t():t}function Vn(t){if(!t)return o.inject(C.PROVIDE_NAME_ACTIONS);const e=o.reactive([]),n=o.computed(()=>e.map(a=>Ve(t,a))),r={actions:n,update:i};o.provide(C.PROVIDE_NAME_ACTIONS,r),t.router=be.useRouter(),t.handleConfirmation||(t.handleConfirmation=Un),t.handleAffectedEntity||(t.handleAffectedEntity=Wn),t.handleCloseForm||(t.handleCloseForm=zn),t.handleValidationResult||(t.handleValidationResult=qn);function i(a={}){return e.splice(0,e.length),Me(a).then(d=>e.splice(0,0,...d)).catch(B("error"))}return{actions:n,update:i}}function jn(t){const e="Are you sure?";return t===!0||typeof t=="string"&&t.toLowerCase()==="true"||t==="1"?e:typeof t=="string"?t:e}async function Un(t,e){const n=jn(t.confirmation);if(!te.getComponentFromStore(C.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await te.promptModal(C.MODAL_CONFIRM,{message:n}))return e()}function qn(t,e){const n=C.MODAL_VALIDATION_EFFECT;if(!te.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{te.pushModal(n,e)})}function Wn(t,e,n){var d;const{router:r,form:i}=n,a=(d=e.primaryKey)==null?void 0:d.Id;if(r&&e&&e.name===t.redirectEntity)return r.push({name:e.name,params:{id:a}});i&&e.name===i.name&&e.updated&&a===i.id&&i.read()}function zn(t,e){const{router:n}=e;n&&t.closeHostForm&&n.back()}function Gn(t){function e(n){n.key==="Enter"&&t()}o.onMounted(()=>{document.addEventListener("keypress",e)}),o.onUnmounted(()=>{document.removeEventListener("keypress",e)})}function xn(t,e={}){const n=o.reactive([]),r=s=>{const f=o.unref(t);if(s===void 0){n.length===0?f.forEach(a):f.forEach(d);return}i(s)?d(s):a(s)},i=s=>n.includes(s),a=s=>{e.handleSelect&&!e.handleSelect(s)||i(s)||n.push(s)},d=s=>{const f=n.findIndex(p=>p===s);f!==-1&&n.splice(f,1)},u=o.computed(()=>{const s=o.unref(t);return n.length===s.length&&s.length!==0});return[n,r,u,a,d]}function Hn(t){const e=o.ref(""),n=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(t).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:n}}const Z=new class{constructor(){this.store=o.reactive([])}add(e,n,r={}){const i=Jn(r),a=new Yn(e,n,i.timeout,i.children,i.click);return this.store.push(a),i.timeout&&setTimeout(this.remove.bind(this,a.id),i.timeout*1e3),a}remove(e){const n=this.store.findIndex(r=>r.id===e);if(n===-1)return!1;this.store.splice(n,1)}};function Jn(t){function e(r){return!!r&&typeof r=="object"}const n={timeout:10,click:()=>null,children:[]};return e(t)?{timeout:t.timeout||n.timeout,click:t.click||n.click,children:t.children||n.children}:n}const Ue=class Ye{constructor(e,n,r,i,a){this.type=e,this.message=n,this.timeout=r,this.children=i,this.click=a,this.id=Ye.cardId++}};Ue.cardId=1;let Yn=Ue;/*!
|
|
6
|
+
Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,n){return!e&&!n?E.ApiNotAvailable():new E(e||"Authorization Error",n)}static ApiResponseParseFailed(){return E.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new E("Object doesn't have id",e)}static ObjectWithIdNotFound(e,n){return new E(`Can't find object with id: ${e}`,n)}static ObjectWithoutConnectToPresentArray(e,n){return new E("Object is not found.",{object:e,array:n})}static EntityWithoutId(e){return new E("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,n){return new E(`Can't find the element with tableIndex ${e}`,n)}static UndefinedError(e,n=[]){return new E(e,n)}static TableArrayAlreadyIncludeProvidedIndexValue(e,n,r){return new E(`Array already includes the element with value ${e}`,{array:n,table:r})}static MetadataEntityIsNotAvailable(e){return new E(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new E("The request took too long to complete. Try again later.")}};Te.ID=0;let J=Te;const Xe="Please try again later or submit a feedback if problem doesn't go.";function Ze(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return Xe}})}function M(t,e={}){return e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw J.ApiNotAvailable()}).then(n=>Ze(n).then(r=>{if(!n.ok)throw r;return r}))}class Qe{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,n,r)=>(n!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[n]=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")}}new Qe;class et{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return M(`/open-api/internationalization/language/${e}`)}}function ke(t){return{...t,createdEntities:t.createdEntites}}const Ae=class pe{static async getStartConfig(e,n){return M([pe.url,e,n].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,n){return M([pe.url,e,n].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(ke)}static async runStep(e,n,r,i,a){return M([pe.url,e,n].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:a})}).then(ke)}};Ae.url="/close-api/views/process-wizard";let ne=Ae;class tt{static async upload(e,n){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${n}`;return await fetch(i,{method:"POST",body:r}).then(a=>a.json()).then(a=>(a.filename=e.name,a))}}class nt{static invite(e,n,r){return M("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:n,relatedRoleCode:r})})}static accept(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!0})})}static decline(e,n){return M("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:n,mark:!1})})}}class rt{static getRequiredDocuments(e,n,r){const i=new URLSearchParams({entity:e,primaryKey:n,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(a=>a.json())}}class Y{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${Y.url()}/calculator/${e}`)}static calculate(e,n){return M(`/${Y.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:n})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):J.ApiNotAvailable()})}static parseMetadataField(e){function n(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:n(e)}}static createOnlinePayment(e,n){return M(`/${Y.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:n})})}static applyOnlinePayment(e){return M(`/${Y.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}function ot(t){return t.statusName==="Completed"}function it(t){return t.statusName==="FinalStepWithConfirmation"}function st(t){return t.statusName==="ValidationError"}function at(t,e,n){let r=null;const i=o.reactive({wait:null});let a=[],d=null;const u=o.ref(null);function s(){u.value=a.find(l=>l.name===d)||null}function f(){var l;return d?((l=a.find(g=>g.name===d))==null?void 0:l.fields)||[]:[]}function p(l){if(s(),st(l))return void n.onValidation(l.validationResults);if((l.statusName==="FinalStep"||l.statusName==="NextStep")&&(!f().length||ct(f(),n.presets)))return F(n.presets||{});ot(l)&&n.onCompleted(l),it(l)&&n.onConfirmation(l)}async function T(){try{await I(),await _()}catch(l){const{message:g}=oe(l);Z.add("error",g)}}function I(){return i.wait="Loading process information.",ne.getStartConfig(e,t).then(l=>{a=l.steps.map(g=>({label:g.title,name:g.stepName,number:g.number,fields:g.frontendEntity.objectTypes.reduce((m,v)=>(v.properties.forEach(O=>{m.push({name:O.name,label:O.title,type:O.refEntityName||O.dataType})}),m),[])}))}).then(l=>(i.wait=!1,l))}function w(l){return d=l.nextStepName,r=l.token,l}function b(l){const g=oe(l);Z.add("error",g.message)}function _(){return i.wait="Starting process",ne.startProcess(e,t).then(w).then(p).catch(b).finally(()=>{i.wait=null})}function F(l={}){return!r||!d?Promise.reject("Not step or token."):(i.wait="Waiting for result...",ne.runStep(e,t,d,r,l).then(w).then(p).catch(b).finally(()=>{i.wait=!1}))}return{initialize:T,state:i,currentStepConfig:o.readonly(u),next:F}}function ct(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(!N.utils.getPropFromObject(e,r.name))return!1}return!0}const lt={class:"widget-table__head"},ut={class:"widget-table__head-label margin_0 text_overflow"},dt=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("tr",lt,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",ut,o.toDisplayString(r.label),1)]))),128))]))}}),cr="",q=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},ft=q(dt,[["__scopeId","data-v-25198f4a"]]);function Re(t){return typeof t.name=="string"?t.name:Array.isArray(t.name)?t.name[0]:null}function pt(t){const e=new RegExp(/\$\{([a-zA-Z0-9.]+)}/,"g"),n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}function ht(t,e){return pt(t).forEach(r=>{t=t.replace(new RegExp("\\$\\{"+r+"}","g"),N.utils.getPropFromObject(e,r))}),t}function ge(t){return e=>typeof e=="string"||typeof e=="number"?`${e} ${t}`:""}function me(t,e){const n=Re(t);if(typeof t.value=="string")return ht(t.value,e);let r=n?N.utils.getPropFromObject(e,n):null;if(r===void 0&&(r=null),typeof t.value=="function")return t.value(r,e);if(t.value===null)return null;if(t.unitValue&&(r=ge(t.unitValue)(r)),t.unit&&(r=ge(t.unit)(r)),t.type)switch(t.type){case"number":{typeof r=="number"&&(r=new Intl.NumberFormat().format(r));break}case"date":{r=Ee(typeof r=="string"?r:null);break}case"dateTime":case"dateWithTime":{r=Le(typeof r=="string"?r:null);break}case"money":{r=$e(r);break}}return t.formatter&&(r=ae(t.formatter).exec(r,e)),typeof r=="boolean"&&(r=r?"✓":"—"),r}const C={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:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm",TIME_TO_LIVE_SOCKET_REQUEST:3e4,CORE_DEBUG_LABEL:"eservices-core"};function ye(t){return[C.CORE_DEBUG_LABEL,t].join(":")}const lr="",X=q({props:{name:String},setup(t,e){let n="unknown";try{n=e.slots.default()[0].children}catch{n=t.name}typeof n!="string"&&console.warn(`Name for Icon.vue is not string. ${n}`);try{n=n.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${n}`})}},[["__scopeId","data-v-e287c8d9"]]),gt=he(ye("setup-list-row"));function mt(t,e){const n=t.config.map(r=>yt(r,t,e));return o.h("tr",{class:"widget-table__row widget-table-row"},n)}function yt(t,e,n){const r=e.values;let i=me(t,r);const a={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(p){a.onClick.push(()=>p(r))}function u(p){Array.isArray(p)?a.class.push(...p):a.class.push(p)}const s=[],f=[];if(t.hide&&t.hide(r))return[o.h("td")];if(t.type)switch(u(`widget-table-cell_${t.type}`),t.type){case"multi-select":{f.push(o.h(N.FormField,{type:"single-checkbox",modelValue:e.selected})),d(Oe.bind(null,n,!0));break}case"select":{f.push(o.h(N.FormField,{type:"single-radio",modelValue:e.selected})),d(Oe.bind(null,n,!1));break}}if(t.onClick&&d(t.onClick),t.link)try{const p=t.link(r);if(p){const T=o.h(be.RouterLink,{to:p});f.push(T),u("widget-table-cell_link")}}catch(p){gt("Can't add router link",p)}if(t.href&&(f.push(o.h("a",{href:t.href(r),target:"_blank"})),u("widget-table-cell_link")),(typeof i=="string"||typeof i=="number")&&f.push(o.h("p",{class:"widget-list-cell-text"},i)),t.icon&&(typeof t.icon=="string"&&f.push(o.h(X,{name:t.icon})),typeof t.icon=="function")){const p=t.icon(r);p!==null&&f.push(o.h(X,{name:p}))}return t.class&&(typeof t.class=="function"?u(t.class(r)):u(t.class)),s.push(o.h("td",a,f)),s}function Oe(t,e){t.emit("select",e)}function Ne(t,e){return()=>{try{return mt(t,e)}catch(n){return console.warn(n),null}}}const Et={props:{values:Object,config:Object,selected:Boolean},setup:Ne},wt=["colspan"],Ie=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(t,{emit:e}){const n=o.ref();return o.onMounted(()=>{setTimeout(()=>{n.value&&n.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:n},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=a=>e("close")),onSave:i[1]||(i[1]=a=>e("save",a))}),null,16,["values","new"]))],8,wt)],512))}}),_t={class:"widget-table"},ve="update:selectedRows",Ct=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{},shortcut:{type:Boolean,default:!1}},emits:["update:activeRow","save"],setup(t,{emit:e}){const n=t,r=o.useSlots(),i=o.computed(()=>{var s;return(s=r==null?void 0:r.default)==null?void 0:s.call(r)[0]});function a(s,f=!0){if(!n.selectedRows)return;if(!f)return e(ve,n.selectedRows.includes(s)?[]:[s]);const p=[...n.selectedRows],T=p.indexOf(s);return T===-1?p.push(s):p.splice(T,1),e(ve,p)}function d(s){e("save",s),e("update:activeRow",null)}const u=o.computed(()=>n.shortcut?n.config.filter(s=>s.name?!!n.array.find(p=>![null,""].includes(me(s,p))):!0):n.config);return(s,f)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",_t,[o.createVNode(ft,{config:u.value},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.array,(p,T)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:T},[o.createVNode(Et,{config:u.value,values:p,selected:s.selectedRows.includes(p),onSelect:I=>a(p,I),class:o.normalizeClass(s.classCallback?s.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&s.activeRow===p?(o.openBlock(),o.createBlock(Ie,{key:0,component:i.value,"row-length":s.config.length,values:p,onClose:f[0]||(f[0]=I=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),s.activeRow===o.unref(C).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(Ie,{key:0,component:i.value,"row-length":u.value.length,onClose:f[1]||(f[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),bt=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}}),dr="",re=q(bt,[["__scopeId","data-v-0ef9ae88"]]),St={class:"widget-button"},Tt=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("button",St,[e.wait?(o.openBlock(),o.createBlock(re,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}}),fr="",kt=q(Tt,[["__scopeId","data-v-450dc564"]]),At={class:"widget-multi-button-wrap position_relative cursor_pointer"},Rt={class:"widget-multi-button-body grid"},Ot=["onClick"],Nt={class:"widget-multi-button-side-wrap"},It=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(t){const e=t;o.useCssVars(d=>({"7025434e":r.value}));const n=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(d){if(!(typeof d!="function"||n.wait))return n.wait=!0,Promise.resolve().then(d).finally(()=>{n.wait=!1})}function a(d=!n.active){n.active=d}return(d,u)=>(o.openBlock(),o.createElementBlock("div",At,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",n.active?"widget-multi-button_active":null])},[o.createElementVNode("div",Rt,[d.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:u[0]||(u[0]=s=>a())},o.toDisplayString(d.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.array,(s,f)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:f,onClick:p=>{i(s.callback),a(!1)}},o.toDisplayString(s.label),9,Ot))),128))]),o.createElementVNode("div",Nt,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",n.active?"widget-multi-button-side_active":null]),onClick:u[1]||(u[1]=s=>a())},[n.wait?(o.openBlock(),o.createBlock(o.unref(re),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(o.openBlock(),o.createBlock(o.unref(X),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}}),pr="",vt=q(It,[["__scopeId","data-v-a8d711d1"]]),Lt={class:"widget-loader flex flex-align_center gap_10 padding_15"},$t={class:"text_md"},Pt=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",Lt,[o.createVNode(re,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",$t,o.toDisplayString(e.label),1)]))}}),Bt=["alt","src"],Dt=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(t){const e=t,n=o.ref();return o.onMounted(()=>{n.value&&(n.value.src=e.src),n.value.onerror=function(){e.default&&(n.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:n,src:r.src||r.$props.default},null,8,Bt))}}),Ft={props:{config:Array,values:Object,selected:Boolean},setup:Ne},hr="",Mt=q(Ft,[["__scopeId","data-v-344a8cc1"]]),Vt=t=>(o.pushScopeId("data-v-bf495d6a"),t=t(),o.popScopeId(),t),jt={class:"widget-list-head-cell"},Ut=Vt(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),qt=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(t,{emit:e}){const n=t;return n.title&&console.warn(`For cell ${n.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",jt,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(N.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(a=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=a=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(X),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),Ut])]))}}),gr="",Wt=q(qt,[["__scopeId","data-v-bf495d6a"]]),zt=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(t,{emit:e}){const n=t,r=o.ref(),i=o.ref();o.onMounted(()=>{function s(w,b){let _=-1;do _++,b-=w[_];while(b>0&&_<w.length);return _}function f(w,b){let _=0;for(;b>0&&b>w[_]&&_<w.length;)b-=w[_],_++;return console.log(b,_),_>0?_:0}function p(w){try{i.value.style.insetInlineStart=w+"px"}catch(b){console.log(b)}}function T(w){try{i.value.style.width=w+"px",i.value.style.minWidth=w+"px",i.value.style.maxWidth=w+"px"}catch(b){console.log(b)}}function I(w){return w===null?!1:w.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(b){var Je;function _(P){return P.screenX+g-O}const F=r.value,l=[...F.children].filter(P=>P.localName==="th"),g=((Je=F.offsetParent)==null?void 0:Je.scrollLeft)||0,m=l.map(P=>P.clientWidth),v=I(b.target),O=F.getBoundingClientRect().left,z=_(b),h=s(m,z),y=m.slice(0,h).reduce((P,U)=>P+U,0),S=z-y,A=F.offsetWidth,L=l[h].clientWidth;if(n.config[h].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",b.screenX),console.log("Widths",m),console.log("max width",A),console.log("Start Position",z),console.log("Position From",h),console.log("Start Position",h),console.log("Global offset (Отступ самой таблицы от края экрана)",O),console.log("Del",S),console.groupEnd(),i.value.innerText=l[h].textContent||"",i.value.style.display="grid",i.value.style.width=L+"px",i.value.style.cursor="grabbing",p(y),T(L),document.addEventListener("pointermove",He,{passive:!0}),document.addEventListener("pointerup",de);function de(P){if(console.group("END"),document.removeEventListener("pointermove",He),document.removeEventListener("pointerup",de),v&&(n.config[h].width=i.value.style.width,n.config[h].minWidth=i.value.style.width,n.config[h].maxWidth=i.value.style.width,a(n.config)),!v){const U=P.screenX+g-O;console.log("ENP Position",U);const fe=f(m,U);if(console.log(h,"->",fe),fe!==h){const ee=n.config[h],Ce=n.config;Ce.splice(h,1),Ce.splice(fe,0,ee),a(Ce)}else{const ee=n.config[h].name;d(ee)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function He(P){if(v){const ee=_(P)-z+L;T(ee);return}let U=P.screenX+g-O-S;U<0&&(U=0),U+L>A&&(U=A-L),p(U)}})});function a(s){e("update:config",s)}function d(s){if(!s)return;if(Array.isArray(s)){if(s.length<1)return;s=s[0]}if(n.order.length===0||n.order[0]!==s)return void u([s]);const f=n.order.length===1||n.order[1]==="asc"?"asc":"desc";u([s,f==="asc"?"desc":"asc"])}function u(s){e("update:order",s)}return(s,f)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.config,(p,T)=>(o.openBlock(),o.createBlock(Wt,o.mergeProps({key:p},p,{onOrder:I=>d(p.name),onSelect:f[0]||(f[0]=I=>e("select")),order:s.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}}),mr="",Gt=q(zt,[["__scopeId","data-v-ccffc6bd"]]),xt={class:"widget-list"},Ht={class:"widget-list-body position_relative"},Jt=50,Yt=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(t,{emit:e}){const n=t;function r(u,s=!0){if(n.selectedRows)if(!s)a(n.selectedRows.includes(u)?[]:[u]);else{const f=[...n.selectedRows],p=f.indexOf(u);p===-1?f.push(u):f==null||f.splice(p,1),a(f)}}function i(){var u;if(((u=n.selectedRows)==null?void 0:u.length)!==n.array.length)return a([...n.array]);a([])}function a(u){e("update:selectedRows",u)}function d(u){if(!u)return;const s=u.target;s.scrollTop+s.clientHeight+Jt>s.scrollHeight&&e("scrollEnd")}return(u,s)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[o.createElementVNode("table",xt,[o.createElementVNode("thead",null,[o.createVNode(Gt,{onSelect:s[0]||(s[0]=f=>i()),"onUpdate:order":s[1]||(s[1]=f=>e("update:order",f)),"onUpdate:config":s[2]||(s[2]=f=>e("update:config",f)),config:u.config,order:u.order},null,8,["config","order"])]),o.createElementVNode("tbody",Ht,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.array,(f,p)=>{var T;return o.openBlock(),o.createBlock(Mt,{key:p,class:"widget-list-row",values:f,config:u.config,selected:(T=u.selectedRows)==null?void 0:T.includes(f),onSelect:I=>r(f,I)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),V={};function Kt(t){for(let e in t)V[e]=t[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function Le(t){return Ee(t,"YYYY/MM/DD HH:mm:ss")}function Ee(t,e="YYYY/MM/DD"){if(!t)return"";try{const n=new Date(t);return Ke.format(n,e)}catch(n){return console.log(n),"Invalid date"}}function Xt(t){function e(...r){return n.wait?Promise.reject("The process has already started."):(n.wait=!0,Promise.resolve().then(()=>t(...r)).finally(()=>{n.wait=!1}))}const n=o.reactive({wait:!1,call:e});return n}function oe(t){return typeof t=="string"?ie(t):Zt(t)?ie(t.message,t.children||t.details||[]):Qt(t)?ie(t.title,[t.detail||""]):ie(C.DEFAULT_ERROR_MESSAGE)}function Zt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"message"))}function Qt(t){return!!(typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,"title"))}function ie(t,e=[]){return{message:t,children:e}}function B(t="error"){return function(e){const{message:n,children:r}=oe(e);Z.add(t,n,{children:r})}}function se(t,e={}){return k().emit("entity:read",{...e,entity:t})}function we(t,e){return k().emit("entity:update",{...e,entity:t})}function en(t){return t.reduce((e,n)=>(n.name&&(typeof n.name=="string"?e.push(n.name):e.push(...n.name)),e),[])}function $e(t,e=2){if(!(typeof t=="string"||typeof t=="number"))return"";let r=String(t).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 tn(t,e){const n=new Map;return t.forEach(r=>{var a;const i=e(r);n.has(i)||n.set(i,[]),(a=n.get(i))==null||a.push(r)}),n}function nn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function rn(t){return t.text().then(e=>{try{return JSON.parse(e)}catch{return C.DEFAULT_ERROR_MESSAGE}})}function $(t,e={}){return D.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=D.contextId),e.redirect="manual",fetch(t,e).then(n=>n.type==="opaqueredirect"?void window.location.replace("/auth"):n).catch(()=>{throw new Error(C.DEFAULT_ERROR_MESSAGE)}).then(n=>rn(n).then(r=>{if(!n.ok)throw r;return r}))}function on(t,e=1e3){let n=0;return(...r)=>{clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function sn(t,e){let n=!1;return(...r)=>{if(!n)return n=!0,setTimeout(()=>n=!1,e),t(...r)}}const an=he(ye("pretty-value-field-by-entity"));function cn(t,e,n){try{const r=ue.get(t);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${t} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(r){return an('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,t,e,n),n}}const ln=1,un=5e3,dn="static-folder",Pe="request-error",fn="Distinguisher",x=he(ye("use-socket"));function k(){return hn}function pn(t){return typeof t=="object"&&Object.prototype.toString.call(t)==="[object Blob]"}const hn=function(){let t=1,e,n;const r=new Set;let i=0;const a=new Set;function d(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},un*2);const l=new Uint8Array(1);l[0]=ln,e.send(l)}setInterval(()=>{Array.from(r).forEach(l=>{F(l)&&(x("Handler for event %s requestId %d was expired",l.event,l.requestId),l.requestId?s({requestId:l.requestId,event:Pe,data:{message:J.RequestTookToLong().message}}):r.delete(l))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&f()},C.DELAY_SOCKET_RECONNECT);function u(){return{safeQueue:a,requestId:t,handlers:r,socketInstance:e}}function s(l){const g=[...r.values()];x("Handlers array length is %d. Response event: %s. Request id: %d",r.size,l.event,l.requestId),g.forEach(m=>{const v=l.requestId;(m.requestId&&m.requestId===v||!m.requestId&&m.event===l.event)&&(x("Find appropriated handler: %d, event: %s",t,m.event),m.callback(l.data,l),m.once&&(r.delete(m),x("Handler was removed by *once* params was passed. %o",m)))})}function f(){if(typeof n!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${n}`,"color: purple","color: black"),e=new WebSocket(n),e.onclose=function(l){x("Connection to server was stopped: %d %s",l.code,l.reason),Array.from(r).forEach(g=>{g.guaranteedAnswer&&g.serializeString&&a.add(g.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...a.values()].forEach(l=>{p(l),a.delete(l)})},e.onerror=function(l){console.warn(l)},e.onmessage=l=>{var g;try{if(pn(l.data)){d();return}const m=JSON.parse(l.data);if(!Be(m)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(m);return}(g=m==null?void 0:m.data)!=null&&g.refresh&&location.reload(),s(m)}catch(m){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(m)}}}function p(l){e.send(l)}function T(l,g){_({event:l,callback:g})}function I(l,g){_({event:l,callback:g,once:!0})}function w(){return e&&(e==null?void 0:e.readyState)===1}function b(l,g,m){const v=++t,O=JSON.stringify({requestId:v,event:l,data:g,contextId:D.contextId,url:window.location.href});return w()?p(O):(a.add(O),x("Socket is not connected. Message was send to save-queue")),new Promise((z,h)=>{_({event:l,requestId:v,once:!0,guaranteedAnswer:!0,serializeString:O,callback:(y,S)=>{if(x("Promise was resolve with next data:",y),gn(S))return void h(y);m&&m(y,S),z(y)},timeToLive:C.TIME_TO_LIVE_SOCKET_REQUEST})})}function _(l){const g={timeToLive:0,...l,created:new Date().getTime()};r.add(g)}function F(l){return l.timeToLive===0||typeof l.timeToLive!="number"?!1:new Date().getTime()-l.created>l.timeToLive}return{get socket(){return e},on:T,once:I,emit:b,initialization(l){n=l},getDevInfo:u}}(),gn=t=>!!Be(t)&&t.event===Pe,Be=t=>typeof t=="object"&&t!==null&&"event"in t&&typeof t.event=="string"&&"requestId"in t&&typeof t.requestId=="number"&&"data"in t;function mn(t,e){return k().emit("list-setting:read",{entity:t,mark:e})}function yn(t,e){return k().emit("metadata-field:treat",{entity:t,fieldName:e})}function De(t,e){return k().emit("entity:create",{...e,entity:t})}function Fe(t,e){return k().emit("entity:delete",{...e,entity:t})}function En(t,e){return k().emit("usage-context:read",{...e,entity:t})}function Me(t={}){return k().emit("tool:read",t)}function wn(t,e={},n={}){const r=o.inject(C.PROVIDE_NAME_ACTIONS,null),i=typeof t=="string"?t:e,a=typeof e=="string"?n:e;return o.computed(()=>{var s;const u=((typeof t=="string"?(s=r==null?void 0:r.actions)==null?void 0:s.value:o.unref(t))||[]).find(f=>f.name===i);return u?{...u,...a}:null})}function _n(t){return k().emit("history:read",t)}function Cn(t,e){return k().emit("entity:count",{...e,entity:t})}function bn(t){return`/${dn}/${t}`}function ae(t){return{exec(e,n){switch(t.name){case"replace-boolean":return ae.replaceBoolean(e,t.values)}}}}ae.replaceBoolean=Sn;function Sn(t,e){return t?e[1]:e[0]}function Tn(t={}){return k().emit("tool:execute",t)}function Ve(t,e){return{...e,label:e.title,callback(){var i;const n=typeof t.values=="function"?t.values(e,t):t.values,r=()=>Tn({name:e.name,values:n,usageContext:e.usageContext}).then(async a=>{var d,u;if(!kn(a))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(t.handlers))for await(const s of t.handlers)await s(e,a,t);if(!a.success)throw t.handleValidationResult&&a.validationEffect&&((u=(d=a.validationEffect)==null?void 0:d.results)!=null&&u.length)&&t.handleValidationResult(e,a.validationEffect,t),new Error(a.message);return a.message&&Z.add("info",a.message),Array.isArray(a.affectedEntities)&&t.handleAffectedEntity&&a.affectedEntities.forEach(s=>{var f;return(f=t.handleAffectedEntity)==null?void 0:f.call(t,e,s,t)}),e.closeHostForm&&t.handleCloseForm&&t.handleCloseForm(e,t),a}).catch(B("error"));return(i=t.overrides)!=null&&i[e.name]?t.overrides[e.name](e,t):e.requireSave&&t.form&&t.form.changed?t.form.save().then(r):!e.confirmation||!t.handleConfirmation?r():t.handleConfirmation(e,r)}}}function kn(t){return!!(t&&typeof t=="object"&&"affectedEntities"in t&&"success"in t)}function An(){const t=o.ref(null);function e(n){t.value=n}return{activeRow:t,activateRow:e}}function Rn(t,e){return typeof t!="object"||t===null?!1:Object.values(t).join().toLowerCase().includes(e)}async function je(t,e){t()?(await e(),await je(t,e)):console.log("async while was stopped.")}function On(t,e,n={}){let r=!1;const i=o.ref(""),a=o.computed(()=>d.filter(h=>f(h,i.value))),d=o.reactive([]);let u=0;const s=o.ref(!1);let f=(n==null?void 0:n.filterSearchFn)||((h,y)=>Rn(h,y));function p(){return n.masterEntities?typeof n.masterEntities=="function"?n.masterEntities():n.masterEntities:[]}function T(){const h=v();return typeof h.limit!="number"&&(h.limit=100),h.offset=u,(n.request||se)(t,h).then(S=>(u+=S.length,S))}function I(h,y){var A;return typeof h.Version=="number"?h.Version:(A=d.find(L=>L.Id===y))==null?void 0:A.Version}function w(h,y){const S=d.findIndex(A=>A.Id===h);if(S===-1)throw new Error(`Can't found item with Id ${h}`);d.splice(S,1,y)}function b(h){const y=d.findIndex(S=>S.Id===h);if(y===-1)throw new Error(`Can't found item with Id ${h}`);d.splice(y,1)}async function _(h,y){try{const S=v(),A=I(y,h);delete y.Version,await we(t,{id:h,values:y,version:A,masterEntities:p()});const L=await se(t,{fields:S.fields||"",id:h});w(h,L)}catch(S){B()(S)}}async function F(h,y={}){try{const S=v(),A=I(y,h);delete y.Version,await Fe(t,{id:h,version:A,masterEntities:p()}),b(h)}catch(S){B()(S)}}async function l(h){try{await De(t,{values:h,masterEntities:p()}),await O()}catch(y){B()(y)}}let g;async function m(){console.log("next"),s.value=!0;try{g!=null&&g.signal&&!g.signal.aborted&&g.abort();let h=g=new AbortController,y=0;const A=v().limit||0;if(i.value&&!A){console.warn("Using textSearch assumes the use of limit.");return}await je(()=>(A>0?y<A:!0)&&!r&&!h.signal.aborted,async()=>{console.log("Step read data. Count for filter %d",y);const L=await T();if(h.signal.aborted){console.log("Signal is aborted");return}console.log("Rows (count %d) was added.",L.length),d.push(...L),y+=L.filter(de=>f(de,i.value)).length,(L.length<A||A===0)&&(r=!0)})}catch(h){B()(h)}s.value=!1}function v(){return typeof e=="function"?e():e}async function O(){try{u=0,r=!1,d.splice(0,d.length),await m()}catch(h){B()(h)}}function z(){if(g)return g.abort();s.value=!1}return{array:d,updateById:_,next:m,reload:O,wait:s,create:l,deleteById:F,textSearch:i,filteredArray:a,abort:z}}function Nn(){function t(){return{organizations:D.organizations,currentContextId:D.contextId,person:D.person,context:D.context,contextType:D.contextType,userId:D.userId}}const e=o.reactive(t());return D.onupdateContext(()=>{Object.assign(e,t())}),e}function In(t,e,n){return k().emit("communication:create",{entityName:t,entityCatalogId:e,targetCode:n})}function vn(t,e,n){return k().emit("communication:read",{entityName:t,entityCatalogId:e,targetCode:n})}function Ln(t,e){return k().emit("communication-message:create",{communicationId:t,text:e})}function $n(t){return k().emit("communication-message:read",{communicationId:t})}function Pn(t){const e=N.Form.getParentForm(),n=o.reactive([]);return e&&e.subscribe(t),t.read=()=>$n(t.id).then(r=>(n.splice(0,n.length,...r),r)),{array:n}}function Bn(t,e){t.read=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw J.EntityWithoutName(t);return se(t.name,r)}).then(_e).then(i=>(i.hasOwnProperty("Version")&&(t.version=i.Version),t.setValues(i),i)).catch(B())},t.save=()=>{const r=n();return Promise.resolve().then(()=>{if(!t.name)throw J.EntityWithoutName(t);return we(t.name,{id:r.id,values:t.changes,version:t.version})}).then(i=>{t.version=i.version}).catch(i=>{throw B()(i),i})};function n(){return typeof e=="function"?e():e}}function Dn(t){if(!t)return o.inject(C.PROVIDE_NAME_METADATA);ue.initEntity(t);const e=o.computed(()=>ue.state[t]);return o.provide(C.PROVIDE_NAME_METADATA,e),e}function Fn(t,e={}){if(!t)return o.inject(C.PROVIDE_NAME_USAGE_CONTEXT);const n=o.ref(null);return o.provide(C.PROVIDE_NAME_USAGE_CONTEXT,n),{state:n,update:async function(){n.value=await En(t,Mn(e||{}))}}}function Mn(t){return typeof t=="function"?t():t}function Vn(t){if(!t)return o.inject(C.PROVIDE_NAME_ACTIONS);const e=o.reactive([]),n=o.computed(()=>e.map(a=>Ve(t,a))),r={actions:n,update:i};o.provide(C.PROVIDE_NAME_ACTIONS,r),t.router=be.useRouter(),t.handleConfirmation||(t.handleConfirmation=Un),t.handleAffectedEntity||(t.handleAffectedEntity=Wn),t.handleCloseForm||(t.handleCloseForm=zn),t.handleValidationResult||(t.handleValidationResult=qn);function i(a={}){return e.splice(0,e.length),Me(a).then(d=>e.splice(0,0,...d)).catch(B("error"))}return{actions:n,update:i}}function jn(t){const e="Are you sure?";return t===!0||typeof t=="string"&&t.toLowerCase()==="true"||t==="1"?e:typeof t=="string"?t:e}async function Un(t,e){const n=jn(t.confirmation);if(!te.getComponentFromStore(C.MODAL_CONFIRM))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");if(await te.promptModal(C.MODAL_CONFIRM,{message:n}))return e()}function qn(t,e){const n=C.MODAL_VALIDATION_EFFECT;if(!te.getComponentFromStore(n))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{te.pushModal(n,e)})}function Wn(t,e,n){var d;const{router:r,form:i}=n,a=(d=e.primaryKey)==null?void 0:d.Id;if(r&&e&&e.name===t.redirectEntity)return r.push({name:e.name,params:{id:a}});i&&e.name===i.name&&e.updated&&a===i.id&&i.read()}function zn(t,e){const{router:n}=e;n&&t.closeHostForm&&n.back()}function Gn(t){function e(n){n.key==="Enter"&&t()}o.onMounted(()=>{document.addEventListener("keypress",e)}),o.onUnmounted(()=>{document.removeEventListener("keypress",e)})}function xn(t,e={}){const n=o.reactive([]),r=s=>{const f=o.unref(t);if(s===void 0){n.length===0?f.forEach(a):f.forEach(d);return}i(s)?d(s):a(s)},i=s=>n.includes(s),a=s=>{e.handleSelect&&!e.handleSelect(s)||i(s)||n.push(s)},d=s=>{const f=n.findIndex(p=>p===s);f!==-1&&n.splice(f,1)},u=o.computed(()=>{const s=o.unref(t);return n.length===s.length&&s.length!==0});return[n,r,u,a,d]}function Hn(t){const e=o.ref(""),n=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(t).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:n}}const Z=new class{constructor(){this.store=o.reactive([])}add(e,n,r={}){const i=Jn(r),a=new Yn(e,n,i.timeout,i.children,i.click);return this.store.push(a),i.timeout&&setTimeout(this.remove.bind(this,a.id),i.timeout*1e3),a}remove(e){const n=this.store.findIndex(r=>r.id===e);if(n===-1)return!1;this.store.splice(n,1)}};function Jn(t){function e(r){return!!r&&typeof r=="object"}const n={timeout:10,click:()=>null,children:[]};return e(t)?{timeout:t.timeout||n.timeout,click:t.click||n.click,children:t.children||n.children}:n}const Ue=class Ye{constructor(e,n,r,i,a){this.type=e,this.message=n,this.timeout=r,this.children=i,this.click=a,this.id=Ye.cardId++}};Ue.cardId=1;let Yn=Ue;/*!
|
|
7
7
|
* jenesius-event-emitter v1.0.2
|
|
8
8
|
* (c) 2022 Jenesius
|
|
9
9
|
* @license MIT
|
|
@@ -17,6 +17,7 @@ export declare function useActions(options?: Partial<IActionOptions>): {
|
|
|
17
17
|
showOnToolPanel: boolean;
|
|
18
18
|
title: string;
|
|
19
19
|
url: string;
|
|
20
|
+
usageContext?: string | undefined;
|
|
20
21
|
}[]>;
|
|
21
22
|
update: (options?: Partial<IActionReadOptions>) => Promise<void | {
|
|
22
23
|
action: {
|
|
@@ -49,6 +50,7 @@ export declare function useActions(options?: Partial<IActionOptions>): {
|
|
|
49
50
|
showOnToolPanel: boolean;
|
|
50
51
|
title: string;
|
|
51
52
|
url: string;
|
|
53
|
+
usageContext?: string | undefined;
|
|
52
54
|
}[]>;
|
|
53
55
|
};
|
|
54
56
|
export declare function parseToolConfirmationMessage(msg: unknown): string;
|