@snabcentr/common-lib 3.7.0 → 3.7.2
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/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-common-lib.js +8 -3
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/catalog/providers/client-price-provider.d.ts +2 -1
- package/dist/src/catalog/providers/client-price-provider.d.ts.map +1 -1
- package/dist/src/orders/classes/order.d.ts +4 -0
- package/dist/src/orders/classes/order.d.ts.map +1 -1
- package/dist/src/orders/interfaces/i-order.d.ts +4 -0
- package/dist/src/orders/interfaces/i-order.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],I):(c=typeof globalThis<"u"?globalThis:c||self,I(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,I,u,Pe,E,f,l,Fr){"use strict";var Wi=Object.defineProperty;var Gi=(c,I,u)=>I in c?Wi(c,I,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[I]=u;var i=(c,I,u)=>Gi(c,typeof I!="symbol"?I+"":I,u);class ee{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=I.jwtDecode(r),t=new ee(Pe.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class cr extends ee{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");u.merge(this,e)}static getJwtPayload(e){const t=I.jwtDecode(e),s=new cr(Pe.objectToCamel(t));return s.resourceAccess=t.resource_access,s}}class Er{constructor(r){i(this,"phone");i(this,"tablet");i(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class et{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class rt{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class tt{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class it{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");i(this,"numberPrecision");var e,t,s,o;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new et(r==null?void 0:r.http),this.deviceTypeByResolution=new Er(r==null?void 0:r.deviceTypeByResolution),this.sentry=new rt({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new tt(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"},this.numberPrecision={priceCoefficient:((o=r==null?void 0:r.numberPrecision)==null?void 0:o.priceCoefficient)??7}}}const S=E.defineStore("common.config",()=>{const n=f.ref(new it);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=u.merge(n.value,t)}}});class Re{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||l.isAfter(l.parseISO(t.availableFor)||l.startOfToday(),new Date)){if(u.isNil(t.data)||u.isEmpty(t.data))throw new Error("Data is empty");return t.data}localStorage.removeItem(r)}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function st(n){try{const r=ee.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const le=E.defineStore("common.auth_state_private",()=>{const n=f.ref((()=>{var g;const o=Re.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const p=(g=S().config.devMode)==null?void 0:g.initAuthBearerToken;return p?Promise.resolve(p):void 0})()),r=f.ref(void 0),e=f.ref(void 0),t=f.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const p=ee.getJwtPayload(o);e.value=p.exp*1e3>Date.now()?u.mapValues(p.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),Ue=E.defineStore("common.auth_state",()=>{const n=f.computed(()=>{const o=le();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const p=o.jwtTokenUpdater();o.jwtToken=p,p.then(g=>{o.jwtToken=Promise.resolve(g),Re.saveActualDataToStorage("sc.token",g,st(g)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){le().jwtTokenUpdater=o}function e(o){const p=le();p.jwtToken=Promise.resolve(o),Re.saveActualDataToStorage("sc.token",o,st(o)),p.recalculateUserPermissions()}function t(){const o=le();o.jwtToken=void 0,o.userPermissions=void 0,Re.saveActualDataToStorage("sc.token",void 0)}function s(o){const p=le();!u.isNil(p.jwtToken)&&u.isNil(p.userPermissions)&&p.jwtToken.then(a=>{const D=ee.getJwtPayload(a);p.userPermissions=D.exp*1e3>Date.now()?u.mapValues(D.resourceAccess,R=>(R==null?void 0:R.roles)??[]):void 0}).catch(u.noop);const g=u.isArray(o)?o.join(" && "):o;if(p.userPermissionsComputedRefs.has(g))return p.userPermissionsComputedRefs.get(g);const m=f.computed(()=>{const a=D=>{var ve;const R=u.split(D,".");if(R.length<2)return!1;const[Ne,Me]=R,De=(ve=le().userPermissions)==null?void 0:ve[Ne];return u.isArray(De)&&De.includes(Me)};return u.isArray(o)?u.every(o,D=>a(D)):a(o)});return p.userPermissionsComputedRefs.set(g,m),m}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});var be=(n=>(n.Image="image",n.Video="video",n))(be||{});class Q{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":u.isNil(this.id)}}class He extends Q{constructor(e){super(e,"");i(this,"mediaType");i(this,"isCover");i(this,"isUnused");i(this,"url");i(this,"urlWebp");this.mediaType=(e==null?void 0:e.mediaType)??be.Image,this.isCover=(e==null?void 0:e.isCover)??!1,this.isUnused=(e==null?void 0:e.isUnused)??!1,this.url=(e==null?void 0:e.url)??"",this.urlWebp=e==null?void 0:e.urlWebp}isImage(){return this.mediaType===be.Image}isVideo(){return this.mediaType===be.Video}}var Te=(n=>(n.Draft="draft",n.Published="published",n.Scheduled="scheduled",n))(Te||{});class O{static parse(r){if(u.isNil(r))return;const e=u.isString(r)?l.parseISO(r):r;return l.isValid(e)?e:void 0}static toApiFormat(r){return u.isNil(r)||!l.isValid(r)?null:l.format(r,S().config.dateFormats.api)}static periodToApiFormat(r){return{from:O.toApiFormat(r.from),to:O.toApiFormat(r.to)}}}class Se extends Q{constructor(e,t){super(e,t);i(this,"createdAt");this.createdAt=O.parse(e==null?void 0:e.createdAt)??new Date}}class ue extends Se{constructor(e){super(e,-1);i(this,"slug");i(this,"title");i(this,"publishedAt");this.slug=(e==null?void 0:e.slug)??"",this.title=(e==null?void 0:e.title)??"",this.publishedAt=ue.parseDate(e==null?void 0:e.publishedAt)}static resolvePublicationStatus(e){return u.isNil(e)?Te.Draft:e.getTime()>Date.now()?Te.Scheduled:Te.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?"Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».":u.startsWith(e,"-")||u.endsWith(e,"-")?"Обозначение не может начинаться или заканчиваться дефисом.":u.includes(e,"--")?"Дефисы не могут идти подряд: разделяйте слова одним дефисом.":"":""}static parseDate(e){return u.isNil(e)?null:u.isString(e)?l.parseISO(e):e}getPublicationStatus(){return ue.resolvePublicationStatus(this.publishedAt)}}class Be extends ue{constructor(e){super(e);i(this,"content");i(this,"media");this.content=(e==null?void 0:e.content)??"",this.media=((e==null?void 0:e.media)??[]).map(t=>new He(t))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}}class re{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];u.isNil(t)||u.isString(t)&&t.trim().length===0||u.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class P{constructor(r){i(this,"from");i(this,"to");this.from=u.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class Qt extends re{constructor(e){super();i(this,"id");i(this,"title");i(this,"slug");i(this,"content");i(this,"publicationStatus");i(this,"publishedAt");i(this,"createdAt");this.id=e==null?void 0:e.id,this.title=e==null?void 0:e.title,this.slug=e==null?void 0:e.slug,this.content=e==null?void 0:e.content,this.publicationStatus=e==null?void 0:e.publicationStatus,this.publishedAt=new P(e==null?void 0:e.publishedAt),this.createdAt=new P(e==null?void 0:e.createdAt)}resetFilterValue(e){switch(e){case"id":case"title":case"slug":case"content":case"publicationStatus":this[e]=void 0;break;case"publishedAt":this.publishedAt.from=null,this.publishedAt.to=null;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break}return this}asClearRaw(){var t,s,o,p;const e=super.asClearRaw();return!((t=e==null?void 0:e.publishedAt)!=null&&t.from)&&!((s=e==null?void 0:e.publishedAt)!=null&&s.to)&&delete e.publishedAt,!((o=e==null?void 0:e.createdAt)!=null&&o.from)&&!((p=e==null?void 0:e.createdAt)!=null&&p.to)&&delete e.createdAt,e}}class L{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}static instanceListInitializer(r,e){if(!u.isArray(e))throw new TypeError(`Ожидался список данных для инициализации "${r.name}", получены данные типа "${typeof e}".`);return u.map(e,t=>L.instanceInitializer(r,t))}}const b=class b{constructor(){i(this,"httpClient");i(this,"baseUrl",`${S().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",u.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return u.isNil(Ue().jwtToken)||(e=await Ue().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>b.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=Pe.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=Pe.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Ue().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new Fr.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>b.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=Pe.objectToCamel(r.data)),r));this.errorResponseHandler=b.defaultErrorsResponseHandler,this.httpClient=Fr.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>b.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){b.defaultErrorsResponseHandler=r}static addRequestHook(r){b.requestHooks.includes(r)||b.requestHooks.push(r)}static removeRequestHook(r){const e=b.requestHooks.indexOf(r);e!==-1&&b.requestHooks.splice(e,1)}static addResponseHook(r){b.responseHooks.includes(r)||b.responseHooks.push(r)}static removeResponseHook(r){const e=b.responseHooks.indexOf(r);e!==-1&&b.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=L.simpleInstanceInitializer(r)),b.instances[r.name]}static toHttpResponseError(r){return u.isObject(r)&&"status"in r?r:{status:0,statusText:"Invalid response data",message:u.isError(r)?r.message:"Не удалось обработать данные ответа сервера.",headers:{},rawError:u.isError(r)?r:new Error(String(r))}}static convertHttpErrorResponse(r){var e,t;if(u.isNil(r)||!u.isNil(r.request)||!u.isNil(r.response)){const s=u.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(p=>e?e(p):p.data);return o.catch(p=>{(p==null?void 0:p.name)!=="CanceledError"&&this.errorResponseHandler(b.toHttpResponseError(p),t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getTypedList(r,e,t={},s=!1,o=void 0){return this.get(e,t,p=>L.instanceListInitializer(r,p.data),s,o)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(b,"instances",{}),i(b,"defaultErrorsResponseHandler",u.noop),i(b,"requestHooks",[]),i(b,"responseHooks",[]);let y=b;var We=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(We||{});class lr{constructor(r){i(this,"field");i(this,"op");i(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??We.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=S().config.dateFormats.api,e={field:this.field,op:this.op};if(u.isDate(this.value))e.value=l.format(this.value,r);else if(u.isPlainObject(this.value)){const t=this.value;e.value={from:t.from?l.format(t.from,r):null,to:t.to?l.format(t.to,r):null}}else e.value=this.value;return e}}class V{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new lr(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new V(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof lr&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof V?r.toPrimitive():r)}}}class _ extends y{getPaginated(r,e,t,s,o,p,g,m=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof V?e:new V(e)).toPrimitive())),u.isEmpty(t)||(a.sort=u.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,p,g,m)}getTypedPaginated(r,e,t,s,o,p,g,m=void 0){return this.getPaginated(e,t,s,o,p,a=>({...a.data,data:L.instanceListInitializer(r,a.data.data)}),g,m)}}class Ge extends _{static preparePostSaveData(r){const e={};if(u.isUndefined(r.title)||(e.title=r.title),u.isUndefined(r.slug)||(e.slug=r.slug),u.isUndefined(r.content)||(e.content=r.content),!u.isUndefined(r.publishedAt)){const t=S().config.dateFormats.api;e.publishedAt=u.isNil(r.publishedAt)?null:l.format(r.publishedAt,t)}return e}getPostList(r,e,t){return this.getPaginated("/internal/blog",r,e,t,{},s=>({...s.data,data:s.data.data.map(o=>new ue(o))}))}getPost(r){return this.get(`/internal/blog/${r}`,{},e=>new Be(e.data))}createPost(r,e={}){return this.post("/internal/blog",Ge.preparePostSaveData(r),t=>new Be(t.data),e)}updatePost(r,e,t={}){return this.patch(`/internal/blog/${r}`,Ge.preparePostSaveData(e),s=>new Be(s.data),t)}removePost(r){return this.delete(`/internal/blog/${r}`)}uploadMedia(r,e,t,s,o={}){return this.request({method:"POST",url:`/internal/blog/${r}/media`,data:{file:e,isCover:t??!1},onUploadProgress:p=>{s&&s(p.total?Math.round(p.loaded/p.total*100):0)}},p=>new He(p.data),o)}updateMedia(r,e,t,s={}){return this.patch(`/internal/blog/${r}/media/${e}`,{isCover:t},o=>new He(o.data),s)}removeMedia(r,e){return this.delete(`/internal/blog/${r}/media/${e}`)}}class $ extends Q{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}nameOrGuid(){return u.isEmpty(this.name)?this.guid:this.name}}class Ae extends ${constructor(e){super(e);i(this,"createdAt");i(this,"updatedAt");this.createdAt=O.parse(e==null?void 0:e.createdAt),this.updatedAt=O.parse(e==null?void 0:e.updatedAt)}}class Oe extends Ae{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=O.parse(e==null?void 0:e.deletedAt)}}class k extends ${constructor(e){super(e);i(this,"type");i(this,"isActive");this.type=e==null?void 0:e.type,this.isActive=(e==null?void 0:e.isActive)??!0}}class je extends Oe{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=O.parse(e==null?void 0:e.publishedAt),this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new k(e==null?void 0:e.owner)}}class te extends Ae{constructor(e){super(e);i(this,"description");i(this,"owner");this.description=(e==null?void 0:e.description)??"",this.owner=e!=null&&e.owner?new k(e.owner):void 0}}var ur=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(ur||{});class v extends ${constructor(e){super(e);i(this,"slug");i(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class x extends v{static getRetailPriceCoefficient(){const r=new x({id:-2,slug:ur.Retail,name:"Розн. цена",guid:""});return r.isNewRec=u.constant(!0),r}}class ze{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new x(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class pr{constructor(r){i(this,"lat");i(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class W extends v{}class pe extends v{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new W(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new pr(e==null?void 0:e.coordinates)}}class nt{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new pe(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class M extends ${constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class hr extends ${constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class he extends ${constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class gr extends he{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class ot extends gr{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class ct{constructor(r,e){i(this,"image");i(this,"preview");i(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class Ye extends gr{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class q extends ot{constructor(e){var s,o,p,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new hr(e.unit):new hr,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new M(e.currency):new M,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(m=>new nt(m)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(m=>m.isPrimary));t&&(this.category=new Ye({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(m=>new Ye(m))),this.images=((p=e==null?void 0:e.images)==null?void 0:p.map(m=>new ct(m,S().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(m=>new ze(m)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Qe=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Qe||{});class ie extends q{constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");i(this,"priceCoefficient");i(this,"increasePercent");i(this,"isPreviouslyOrdered");i(this,"isRequired");i(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Qe.Product,this.discount=e!=null&&e.discount?new je(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new te(e.priceTemplate):void 0,this.priceCoefficient=e!=null&&e.priceCoefficient?new x(e.priceCoefficient):void 0,this.increasePercent=e==null?void 0:e.increasePercent,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class se extends Ye{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[u.toUpper(t),s])):void 0}}class fr extends Q{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creator");i(this,"isRemoved");i(this,"ord");i(this,"onOrder");i(this,"originalId");i(this,"replacementId");this.product=new ie(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new se,this.currency=e.currency?new M(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new k(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let mr=class extends fr{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new M(e.currency)}};class ge{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new mr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Vt extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ge(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ge(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ge(s.data),t)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,t=>new ge(t.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new ge(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var lt=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(lt||{}),ut=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(ut||{}),yr=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(yr||{});class U extends se{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new U(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new q(o))}}class ar{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class N extends v{}class Ve extends Ae{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new N(e.salesDirection):new N,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new ar(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class xe extends v{}class Cr extends ${constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class de extends ${constructor(e){super(e);i(this,"abbr");this.abbr=(e==null?void 0:e.abbr)??""}}class G extends Ve{constructor(e){var t,s,o;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");i(this,"showAllCosts");i(this,"authAsOperator");i(this,"managerRegions");i(this,"managers");i(this,"lastLoginAt");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new Cr(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(p=>new xe(p)))??[],this.showAllCosts=e==null?void 0:e.showAllCosts,this.authAsOperator=e==null?void 0:e.authAsOperator,this.managerRegions=(s=e==null?void 0:e.managerRegions)==null?void 0:s.map(p=>new de(p)),this.managers=(o=e==null?void 0:e.managers)==null?void 0:o.map(p=>new G(p)),this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt}}class xt extends se{constructor(e){super(e);i(this,"isDisabled");i(this,"isRequired");i(this,"isFavorite");i(this,"hidingComment");i(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new G(e.manager):void 0}}class $e extends xt{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new $e(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new ie(o))}}class wr{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new x(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Dr extends wr{constructor(r){super(r)}}class Je extends Dr{constructor(e){super(e);i(this,"productCategory");this.productCategory=new se(e==null?void 0:e.productCategory)}}class Ke extends ${constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new ar(e.contacts),this.curatedDirection=new xe(e.curatedDirection)}}class ne extends v{}class J extends v{constructor(e){super(e);i(this,"country",new ne);e&&(this.country=new ne(e.country))}}class j extends v{constructor(e){super(e);i(this,"region",new J);e&&(this.region=new J(e.region))}}class vr extends Ae{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"lastLoginAt");i(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new N(e.salesDirection):void 0,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class K extends vr{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new N(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new j(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new Ve(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Ke(o)))??void 0}}class pt extends Se{constructor(e,t){super(e,t);i(this,"deletedAt");this.deletedAt=O.parse(e==null?void 0:e.deletedAt)}}class fe extends pt{constructor(e){super(e);i(this,"client");i(this,"priceTemplate");this.client=new K(e==null?void 0:e.client),this.priceTemplate=new te(e==null?void 0:e.priceTemplate)}}class Xe extends Dr{constructor(e){super(e);i(this,"product");this.product=new q(e==null?void 0:e.product)}}class Pr extends v{}class oe extends ${constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");i(this,"isFilterable");this.type=new Pr(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata,this.isFilterable=e==null?void 0:e.isFilterable}}class ce{constructor(r){i(this,"property");i(this,"value");this.property=new oe(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class Jt{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"ownerName");i(this,"createdAt",new P);i(this,"updatedAt",new P);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.ownerName=r==null?void 0:r.ownerName,this.createdAt=new P(r==null?void 0:r.createdAt),this.updatedAt=new P(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":case"ownerName":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,t,s,o;const r={};return Object.keys(this).forEach(p=>{const g=this[p];u.isNil(g)||u.isString(g)&&g.trim().length===0||u.isFunction(g.isNewRec)&&g.isNewRec()||(r[p]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class Rr extends wr{constructor(e){super(e);i(this,"executor");i(this,"createdAt");this.executor=e!=null&&e.executor?new k(e.executor):void 0,this.createdAt=O.parse(e==null?void 0:e.createdAt)}}class Ze extends Rr{constructor(e){super(e);i(this,"product");this.product=new q(e==null?void 0:e.product)}}class br extends Rr{constructor(e){super(e);i(this,"productCategory");this.productCategory=new se(e==null?void 0:e.productCategory)}}class me extends ${constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");i(this,"subRoles",[]);i(this,"parentRole");i(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Tr{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new me(r==null?void 0:r.role),this.category=new se(r==null?void 0:r.category),this.minCoefficient=new x(r==null?void 0:r.minCoefficient)}}class ht{constructor(r){i(this,"isFake");i(this,"isHidden");i(this,"isMultiple");i(this,"type");i(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class Sr{constructor(r){i(this,"category");i(this,"property");i(this,"settings");this.category=new se(r==null?void 0:r.category),this.property=new oe(r==null?void 0:r.property),this.settings=new ht(r==null?void 0:r.settings)}}class gt{constructor(r){i(this,"id");i(this,"label");this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??""}}class ft{constructor(r){i(this,"id");i(this,"label");i(this,"type");i(this,"ord");i(this,"isMultiple");i(this,"values");i(this,"min");i(this,"max");var e;this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??"",this.type=(r==null?void 0:r.type)??yr.Checkbox,this.ord=(r==null?void 0:r.ord)??0,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.values=((e=r==null?void 0:r.values)==null?void 0:e.map(t=>new gt(t)))??[],this.min=(r==null?void 0:r.min)??null,this.max=(r==null?void 0:r.max)??null}}class Kt extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let p=`${S().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(p+=`&category_id=${t}`),s&&(p+=`&client_id=${s}`),p}}class Xt extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}getCategoryPrices(r){return this.getTypedList(br,`/internal/clients/${r}/price/categories`)}getCategoryPrice(r,e){return this.get(`/internal/clients/${r}/price/categories/${e}`,{},t=>new br(t.data))}updateCategoryPrices(r,e,t,s=!1){var o;return this.request({method:"PATCH",url:`/internal/clients/${r}/price/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}})}removeCategoryPrices(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/clients/${r}/price/categories/${e}`,params:t?{recursively:!0}:{}})}removeCategoryProductsPrices(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/clients/${r}/price/categories/${e}/products`,params:t?{recursively:!0}:{}})}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:t})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:t})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}getProductPrices(r){return this.getTypedList(Ze,`/internal/clients/${r}/price/products`)}getProductPrice(r,e){return this.get(`/internal/clients/${r}/price/products/${e}`,{},t=>new Ze(t.data))}updateProductPrice(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new Ze(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`)}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,t=>new Blob([t.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,t=>new Blob([t.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Zt extends y{getTemplateList(r){return this.getTypedList(fe,`/internal/clients/${r}/price/templates`)}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new fe(e.data),!0)}attachTemplate(r,e,t){const s=S().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&l.format(t.startAt,s),endAt:t.endAt&&l.format(t.endAt,s)},o=>new fe(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=S().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},p=>new fe(p.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class Ft extends y{getRootCategoriesList(r=!1){return this.getTypedList(U,"/internal/catalog/categories",{showHidden:r})}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new U(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new U(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>u.map(s.data,o=>new q(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return u.forEach(t,s=>s.map(o=>new ze(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(p=>new U(p)))}).catch(o=>{s(o)})})}}class Et extends _{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new q(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new q(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,t=>new ze(t)))}getNewProducts(r,e,t=!0){const s=S().config.dateFormats.api;return this.getTypedPaginated(q,"/internal/catalog/products/new",void 0,void 0,e,{period:{from:l.format(r,s)},withPriceCoefficients:t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(p=>new q(p)))}).catch(o=>{s(o)})})}}class ei extends y{getRootCategoriesList(r,e=!1){return this.getTypedList($e,"/internal/catalog/categories",{clientId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new $e(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,p=>new ie(p)))}}class ri extends _{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new ie(s.data))}getNewProducts(r,e,t,s=!0){const o=S().config.dateFormats.api;return this.getTypedPaginated(ie,"/internal/catalog/products/new",void 0,void 0,t,{clientId:r,period:{from:l.format(e,o)},withPriceCoefficients:s})}}class ti extends _{getTemplateList(r,e,t){return this.getTypedPaginated(te,"/internal/price/templates",r,e,t)}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new te(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new te(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new te(s.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.getTypedList(Xe,`/internal/price/templates/${r}/products`)}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new Xe(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new Xe(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.getTypedList(Je,`/internal/price/templates/${r}/categories`)}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new Je(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},p=>new Je(p.data))}deleteCategoryTemplatePrice(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:t?{recursively:!0}:{}})}getTemplateClients(r){return this.getTypedList(fe,`/internal/price/templates/${r}/clients`)}}class ii extends y{getRoles(){return this.getTypedList(me,"/internal/price/roles")}createRole(r){return this.post("/internal/price/roles",r,e=>new me(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new me(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new me(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.getTypedList(Tr,`/internal/price/roles/rules/categories/${r}`)}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>L.instanceListInitializer(Tr,t.data))}}class si extends _{getProperties(r,e,t){return this.getTypedPaginated(oe,"/internal/catalog/properties",r,e,t)}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new oe(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new oe(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new oe(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.getTypedList(ce,`/internal/catalog/products/${r}/properties`)}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new ce(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new ce(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.getTypedList(ce,`/internal/catalog/categories/${r}/properties`)}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new ce(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new ce(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}getCategoryFilters(r,e=!1){return this.get(`/internal/catalog/categories/${r}/filters`,{recursively:e},t=>t.data.map(s=>new ft(s)))}getCategoryFilterSettings(r){return this.getTypedList(Sr,`/internal/catalog/categories/${r}/filter-settings`)}saveCategoryFilterSetting(r,e,t){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,t,s=>new Sr(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class ni extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(U,"/internal/catalog/categories",{priceTemplateId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new U(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,p=>new q(p)))}}function Ar(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const p=Ar(o.products,r,e);if(p)return t=p,!0}if(o.categories&&o.categories.length>0){const p=Ar(o.categories,r,e);if(p)return t=p,!0}return!1}),t}function Or(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...Or(t.products)),t.categories&&t.categories.length>0&&r.push(...Or(t.categories))}}),r}var mt=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(mt||{}),z=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(z||{});class Fe extends Q{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new M);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new M(e.currency))}}class Ee extends Oe{constructor(e){super(e);i(this,"phone");i(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class X extends Ee{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment}}class Z extends v{static generatePersonItem(){return new Z({id:1,guid:"",slug:z.Person,name:""})}}class F extends v{}class dr extends Oe{constructor(e){super(e);i(this,"opf",Z.generatePersonItem());i(this,"partnerGroup",new F);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"creator");i(this,"updater");if(e){if(this.opf=new Z(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.creator=e.creator?new k(e.creator):void 0,this.updater=e.updater?new k(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new F(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new X(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new Fe(s))}),this.bankAccounts=t}}}}class yt extends dr{constructor(r){super(r)}}class $r extends dr{constructor(e){super(e);i(this,"inn","");i(this,"okpo","");i(this,"directorName","");i(this,"directorPosition","");i(this,"directorActsOn","");i(this,"legalAddress","");i(this,"postalAddress","");i(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class kr extends $r{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class at extends kr{constructor(e){super(e);i(this,"registrationCountry",new ne);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new ne(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ke{static createInstance(r){switch(r.opf.slug){case z.Ic:return new $r(r);case z.UlR:return new kr(r);case z.UlNr:return new at(r);default:return new yt(r)}}}class ye extends Oe{constructor(e){var t;super(e);i(this,"address","");i(this,"coordinates");i(this,"contacts");i(this,"comment");i(this,"operatingHours");i(this,"isOneTime");i(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new pr(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new X(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class Ir extends v{}class Lr extends v{}class qr extends K{constructor(e){var t,s,o,p;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>ke.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new F(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new X(g)))??[],this.deliveryAddresses=((p=e==null?void 0:e.deliveryAddresses)==null?void 0:p.map(g=>new ye(g)))??[],this.channelPrimaryInterest=new Ir(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Lr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new W(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new pe(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class oi extends re{constructor(e){var t,s,o,p,g,m,a,D;super();i(this,"id");i(this,"guid");i(this,"name");i(this,"alternativeName");i(this,"searchTerm");i(this,"cities");i(this,"region");i(this,"country");i(this,"phone");i(this,"email");i(this,"isActive");i(this,"createdAt",new P);i(this,"lastLoginDate",new P);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new P);this.id=e==null?void 0:e.id,this.guid=e==null?void 0:e.guid,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(R=>new j(R)),this.region=new J(e==null?void 0:e.region),this.country=new ne(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new P(e==null?void 0:e.createdAt),this.lastLoginDate=new P(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(R=>new G(R)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(R=>new Ke(R)))??[],this.salesDirections=(p=e==null?void 0:e.salesDirections)==null?void 0:p.map(R=>new N(R)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new Z(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new W(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(R=>new F(R)),this.contact=new Ee(e==null?void 0:e.contact),this.lastOrder={createdAt:new P((m=e==null?void 0:e.lastOrder)==null?void 0:m.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(D=e==null?void 0:e.lastOrder)==null?void 0:D.isApproved},this.noOrdersPeriod=new P(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new J;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new Z;break;case"preferredDeliveryType":this.preferredDeliveryType=new W;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Ee;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,p,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((p=e==null?void 0:e.lastLoginDate)!=null&&p.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((m=e==null?void 0:e.noOrdersPeriod)!=null&&m.to)&&delete e.noOrdersPeriod,e}}class _r extends Se{constructor(e){super(e);i(this,"creator");this.creator=new k(e==null?void 0:e.creator)}}class Ct extends ${constructor(e){var t,s,o,p;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(g=>new X(g)))??void 0,this.lastOrder=e.lastOrder?new _r(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new F(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new W(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new N(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new Ve(g)))??void 0,this.curators=((p=e.curators)==null?void 0:p.map(g=>new Ke(g)))??void 0}}class er extends Q{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class wt extends X{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new er(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new er(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new er(t))))}}class H extends _{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var p,g,m,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case z.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(p=t.partnerGroup)==null?void 0:p.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case z.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case z.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new qr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getTypedPaginated(K,"/internal/clients",r,e,t,s,void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:We.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>L.instanceListInitializer(Ct,s.data))}getAllClientContacts(r){return this.getTypedList(wt,`/internal/clients/${r}/contacts/all`)}createClientCommonData(r,e={}){return this.post("/internal/clients",H.transformClientDataToRequest(r),t=>new qr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,H.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,H.transformContragentClientDataToRequest(e),s=>ke.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,H.transformContragentClientDataToRequest(e),s=>ke.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.getTypedList(ye,`/internal/clients/${r}/delivery-addresses`)}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,H.transformClientDeliveryAddressToRequest(e),s=>new ye(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,H.transformClientDeliveryAddressToRequest(e),s=>new ye(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,H.transformClientContragentBankAccountToRequest(t),o=>new Fe(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,H.transformClientContragentBankAccountToRequest(t),o=>new Fe(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new X(s.data),t)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var p,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(p=e.phone)!=null&&p.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,m=>new X(m.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class ci extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class li{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=u.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var Dt=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(Dt||{});class ui extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var p;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(p=r.properties)==null?void 0:p.configurator}/product`,{params:t,client_id:e},g=>new q(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class vt{constructor(r){i(this,"page",1);i(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class pi extends vt{constructor(e){super(e);i(this,"itemCount",0);i(this,"pageCount",1);i(this,"pageSlot",5);i(this,"pageSizes",[25,50,100]);i(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class hi{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class w{static decadeInterval(r){const[e,t]=w.shiftedDecadeBounds(r,0);return{from:e,to:t}}static shiftDecadeInterval(r,e){const[t,s]=w.shiftedDecadeBounds(r,e);return{from:t,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,t){const s=l.differenceInCalendarMonths(l.startOfMonth(t),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),p=Math.min(l.getDate(t),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,p))}}static weekTillSameWeekday(r,e){const t=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:t,to:l.endOfDay(l.addDays(t,s))}}static decadeTillSameDayNumber(r,e){const[t]=w.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,t)+1,[o,p]=w.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(p,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const t=l.getDate(r);let s=2;t<=10?s=0:t<=20&&(s=1);const o=s+e,p=Math.floor(o/3),g=(o%3+3)%3,m=l.startOfMonth(l.addMonths(r,p)),a=l.addDays(m,g*10),D=g===2?l.endOfMonth(m):l.endOfDay(l.addDays(a,9));return[a,D]}}function gi(n){return l.format(l.subDays(l.startOfToday(),n),"yyyy-MM-dd")}function Pt(n,r){const e=[2,0,1,1,1,2],t=Math.floor(Math.abs(n));return r[t%100>4&&t%100<20?2:e[Math.min(t%10,5)]]}function fi(n){const r=l.parseISO(n),e=l.differenceInCalendarDays(l.startOfToday(),r);switch(!0){case e===0:return"Сегодня";case e===1:return"Вчера";case e<0:return n;default:return`${e} ${Pt(e,["день","дня","дней"])} назад`}}class mi{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),t=new Date,s=l.startOfYear(r===void 0?t:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(t,{weekStartsOn:1}),to:l.endOfWeek(t,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(t),to:l.endOfMonth(t)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},t=l.startOfDay(r),s=l.endOfDay(r),o=w.decadeInterval(r),p=l.startOfMonth(r),g=l.startOfQuarter(r),m=w.startOfHalfYear(r),a=l.startOfYear(r),D=w.addHalfYears(r,-1),R=w.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:t,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...w.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...w.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:p,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:w.startOfHalfYear(D),to:w.endOfHalfYear(D)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:m,to:w.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:w.startOfHalfYear(R),to:w.endOfHalfYear(R)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:p,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:m,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:t,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:t,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:t,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:t,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:t,to:w.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:t,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...w.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...w.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(p,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(m,w.startOfHalfYear(D),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...w.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...w.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(p,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(m,w.startOfHalfYear(R),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:t,to:l.endOfDay(l.addDays(r,6))}}}}const yi=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],ai=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class rr extends ${constructor(e){super(e);i(this,"city");i(this,"isActive");this.city=e!=null&&e.city?new j(e.city):void 0,this.isActive=(e==null?void 0:e.isActive)??!1}}class Rt{constructor(r){i(this,"salesDirections");i(this,"partnerGroups");i(this,"managers");i(this,"additionalClients");i(this,"fixedClients");i(this,"regions");i(this,"cities");i(this,"lastLoginDate");i(this,"lastOrderDate");this.salesDirections=u.map((r==null?void 0:r.salesDirections)??[],e=>new N(e)),this.partnerGroups=u.map((r==null?void 0:r.partnerGroups)??[],e=>new F(e)),this.managers=u.map((r==null?void 0:r.managers)??[],e=>new k(e)),this.additionalClients=u.map((r==null?void 0:r.additionalClients)??[],e=>new rr(e)),this.fixedClients=u.map((r==null?void 0:r.fixedClients)??[],e=>new rr(e)),this.regions=u.map((r==null?void 0:r.regions)??[],e=>new J(e)),this.cities=u.map((r==null?void 0:r.cities)??[],e=>new j(e)),this.lastLoginDate=new P(r==null?void 0:r.lastLoginDate),this.lastOrderDate=new P(r==null?void 0:r.lastOrderDate)}hasClientConditions(){return u.some([this.salesDirections,this.partnerGroups,this.managers,this.additionalClients,this.fixedClients,this.regions,this.cities],r=>!u.isEmpty(r))||u.some([this.lastLoginDate,this.lastOrderDate],r=>!!r.from||!!r.to)}setPeriod(r,e){return this[r]=new P({from:e!=null&&e.from?l.startOfDay(e.from):null,to:e!=null&&e.to?l.endOfDay(e.to):null}),this}toSaveData(){return{salesDirections:u.map(this.salesDirections,"id"),partnerGroups:u.map(this.partnerGroups,"id"),managers:u.map(this.managers,"id"),additionalClients:u.map(this.additionalClients,"id"),regions:u.map(this.regions,"id"),cities:u.map(this.cities,"id"),lastLoginDate:new P(this.lastLoginDate),lastOrderDate:new P(this.lastOrderDate)}}}class bt{static percentToCostCoefficient(r){return u.round((100-r)/100,S().config.numberPrecision.priceCoefficient)}}var Ie=(n=>(n.Active="active",n.Scheduled="scheduled",n.Completed="completed",n))(Ie||{});class Tt{static resolve(r,e=new Date){return r.deletedAt&&r.deletedAt.getTime()<=e.getTime()?Ie.Completed:r.publishedAt&&r.publishedAt.getTime()>e.getTime()?Ie.Scheduled:Ie.Active}}class tr extends je{constructor(e){super(e);i(this,"conditions");i(this,"products");i(this,"productCategories");i(this,"countDiscountedPrices");i(this,"expectedCountDiscountedPrices");i(this,"countDiscountedProducts");i(this,"countDiscountedClients");this.conditions=new Rt(e==null?void 0:e.conditions),this.products=u.map((e==null?void 0:e.products)??[],t=>new q(t)),this.productCategories=u.map((e==null?void 0:e.productCategories)??[],t=>new U(t)),this.countDiscountedPrices=(e==null?void 0:e.countDiscountedPrices)??0,this.expectedCountDiscountedPrices=(e==null?void 0:e.expectedCountDiscountedPrices)??0,this.countDiscountedProducts=(e==null?void 0:e.countDiscountedProducts)??0,this.countDiscountedClients=(e==null?void 0:e.countDiscountedClients)??0}getState(e=new Date){return Tt.resolve(this,e)}assignCounters(e){this.countDiscountedPrices=e.countDiscountedPrices,this.expectedCountDiscountedPrices=e.expectedCountDiscountedPrices,this.countDiscountedProducts=e.countDiscountedProducts,this.countDiscountedClients=e.countDiscountedClients}isPricesUpdating(){return this.countDiscountedPrices!==this.expectedCountDiscountedPrices}toSaveData(){return{name:this.name,costCoefficient:bt.percentToCostCoefficient(this.percent),isLowPriceAllowed:this.isLowPriceAllowed,publishedAt:this.publishedAt??null,deletedAt:this.deletedAt??null,description:this.description??"",products:u.map(this.products,"id"),productCategories:u.map(this.productCategories,"id"),conditions:this.conditions.toSaveData()}}}class Nr{constructor(r){i(this,"client");i(this,"additionalClientsCondition");i(this,"fixedClientsCondition");i(this,"partnerGroupsCondition");i(this,"managersCondition");i(this,"citiesCondition");i(this,"regionsCondition");i(this,"salesDirectionsCondition");this.client=new rr(r==null?void 0:r.client),this.additionalClientsCondition=(r==null?void 0:r.additionalClientsCondition)??!1,this.fixedClientsCondition=(r==null?void 0:r.fixedClientsCondition)??!1,this.partnerGroupsCondition=(r==null?void 0:r.partnerGroupsCondition)??!1,this.managersCondition=(r==null?void 0:r.managersCondition)??!1,this.citiesCondition=(r==null?void 0:r.citiesCondition)??!1,this.regionsCondition=(r==null?void 0:r.regionsCondition)??!1,this.salesDirectionsCondition=(r==null?void 0:r.salesDirectionsCondition)??!1}isEligible(){return this.additionalClientsCondition||this.fixedClientsCondition||this.partnerGroupsCondition||this.managersCondition||this.citiesCondition||this.regionsCondition||this.salesDirectionsCondition}}class Ci extends re{constructor(e){super();i(this,"id");i(this,"name");i(this,"states");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.states=e==null?void 0:e.states}resetFilterValue(e){switch(e){case"id":case"name":case"states":this[e]=void 0;break}return this}}class ir extends _{static prepareSaveData(r,e){return{...r,publishedAt:O.toApiFormat(r.publishedAt),deletedAt:O.toApiFormat(r.deletedAt),conditions:{...r.conditions,lastLoginDate:O.periodToApiFormat(r.conditions.lastLoginDate),lastOrderDate:O.periodToApiFormat(r.conditions.lastOrderDate),updateFixedClients:e}}}getDiscountsList(r,e,t,s=void 0){return this.getTypedPaginated(je,"/internal/price/discounts",r,e,t,{},void 0,s)}getDiscount(r){return this.get(`/internal/price/discounts/${r}`,{},e=>new tr(e.data))}createDiscount(r,e,t={}){return this.post("/internal/price/discounts",ir.prepareSaveData(r,e),s=>new tr(s.data),t)}updateDiscount(r,e,t,s={}){return this.patch(`/internal/price/discounts/${r}`,ir.prepareSaveData(e,t),o=>new tr(o.data),s)}removeDiscount(r){return this.delete(`/internal/price/discounts/${r}`)}getEligibleClients(r){return this.getTypedList(Nr,`/internal/price/discounts/${r}/clients`)}checkClient(r,e){return this.get(`/internal/price/discounts/${r}/clients/${e}/check`,{},t=>new Nr(t.data))}}class Le extends ${constructor(r){super(r)}}class qe extends Q{constructor(e){super(e,-1);i(this,"question");i(this,"answer");i(this,"groups");this.question=(e==null?void 0:e.question)??"",this.answer=(e==null?void 0:e.answer)??"",this.groups=u.map((e==null?void 0:e.groups)??[],t=>new Le(t))}toSaveData(){return{question:this.question,answer:this.answer,groups:u.map(this.groups,"id")}}}class wi extends _{getFaqList(r,e){return this.getTypedPaginated(qe,"/internal/faq",void 0,void 0,e,u.isNil(r)?{}:{group:r})}getFaq(r){return this.get(`/internal/faq/${r}`,{},e=>new qe(e.data))}createFaq(r,e={}){return this.post("/internal/faq",r,t=>new qe(t.data),e)}updateFaq(r,e,t={}){return this.patch(`/internal/faq/${r}`,e,s=>new qe(s.data),t)}removeFaq(r){return this.delete(`/internal/faq/${r}`)}getGroupsList(){return this.getTypedList(Le,"/internal/faq/groups")}createGroup(r,e={}){return this.post("/internal/faq/groups",r,t=>new Le(t.data),e)}updateGroup(r,e,t={}){return this.patch(`/internal/faq/groups/${r}`,e,s=>new Le(s.data),t)}removeGroup(r){return this.delete(`/internal/faq/groups/${r}`)}}function Di(n){const r=u.round(n*100);return`${r>=0?"+":""}${r}%`}class Mr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)==null?void 0:t.minCount)!=null&&!Mr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return((e=r.properties)==null?void 0:e.lengthStep)!=null?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)==null?void 0:s.minCount)!=null?r.properties.minCount:.01}}const we=class we extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=S().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=we.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){we.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={},p=void 0){const g=t+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),m=s?we.getCachedResponse(g):void 0;return m?Promise.resolve(m):this.getTypedList(e,t,o,!1,p).then(a=>(s&&a&&this.cacheResponse(g,a),a))}};i(we,"responseDataCache",new Map);let ae=we;class vi{static generateUndefinedManagerInstance(){return new G({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Ur extends ae{async getManagers(){const r="/internal/managers",e=ae.getCachedResponse(r);if(e)return e;const t=await this.get(r),s=L.instanceListInitializer(G,t.data);return this.cacheResponse(r,s),s}getManager(r){return this.get(`/internal/managers/${r}`,{},e=>new G(e.data))}}var Ce=(n=>(n.Processing="processing",n.Completed="completed",n.Error="error",n.NeedsActualization="needs_actualization",n))(Ce||{});class St{constructor(r){i(this,"status");i(this,"actualizedAt");i(this,"expiresAt");i(this,"error");this.status=(r==null?void 0:r.status)??Ce.Processing,this.actualizedAt=O.parse(r==null?void 0:r.actualizedAt),this.expiresAt=O.parse(r==null?void 0:r.expiresAt),this.error=r==null?void 0:r.error}get isProcessing(){return this.status===Ce.Processing}get isOutdated(){return this.isOutdatedAt(new Date)}get isOrderAllowed(){return this.isOrderAllowedAt(new Date)}isOutdatedAt(r){return this.status!==Ce.Completed||u.isNil(this.actualizedAt)?!0:!u.isNil(this.expiresAt)&&this.expiresAt.getTime()<r.getTime()}isOrderAllowedAt(r){return this.status===Ce.Completed&&!this.isOutdatedAt(r)}}class Hr extends Se{constructor(e){super(e);i(this,"name");i(this,"client");i(this,"sum");i(this,"isProfstroy");i(this,"actualization");i(this,"file");this.name=e==null?void 0:e.name,this.client=new K(e==null?void 0:e.client),this.sum=e==null?void 0:e.sum,this.isProfstroy=e==null?void 0:e.isProfstroy,this.actualization=(e==null?void 0:e.actualization)&&new St(e.actualization),this.file=e==null?void 0:e.file}}class At extends mr{constructor(e){super(e);i(this,"groupName");i(this,"supplierSku");i(this,"isIgnored");i(this,"lineError");this.groupName=e.groupName,this.supplierSku=e.supplierSku??e.product.supplierSku,this.isIgnored=e.isIgnored,this.lineError=e.lineError}get isProductStub(){return u.isNil(this.product.id)}get isOrderable(){return!this.isProductStub&&!this.isIgnored&&u.isEmpty(this.lineError)}}class B extends Hr{constructor(e){super(e);i(this,"sum");i(this,"products");this.sum=e.sum??0,this.products=(e.products??[]).map(t=>e.isProfstroy?new At(t):new mr(t))}}class Pi extends re{constructor(e){super();i(this,"id");i(this,"clientSearchTerm");i(this,"name");i(this,"createdAt",new P);this.id=e==null?void 0:e.id,this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.name=e==null?void 0:e.name,this.createdAt=new P(e==null?void 0:e.createdAt)}resetFilterValue(e){return e==="createdAt"?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){var t,s;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,e}}class _e extends v{}class Br extends _r{constructor(e){var t,s,o,p,g,m,a,D;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"statusDetail");i(this,"salesDirection");i(this,"attachedAt");i(this,"isOnOrder");i(this,"isProfstroy");i(this,"isNotInStock");i(this,"sum");i(this,"isLargeOrder");this.client=new K(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((p=e==null?void 0:e.delivery)==null?void 0:p.type)??-1,date:u.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((m=e==null?void 0:e.delivery)==null?void 0:m.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new ye(e.delivery.address):void 0,warehouse:(D=e==null?void 0:e.delivery)!=null&&D.warehouse?new pe(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new k(e==null?void 0:e.attachedUser):void 0,this.status=new _e(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new v(e.statusDetail):void 0,this.salesDirection=new N(e==null?void 0:e.salesDirection),this.attachedAt=u.isString(e==null?void 0:e.attachedAt)?l.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isProfstroy=(e==null?void 0:e.isProfstroy)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class Ot extends fr{constructor(e,t){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");i(this,"changedFields",[]);i(this,"replacement");this.product=new ie(e.product),this.currency=new M(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,t&&(this.replacement=t,this.quantity!==t.quantity&&this.changedFields.push("quantity"),this.length!==t.length&&this.changedFields.push("length"))}}class d extends Br{constructor(e){var t;super(e);i(this,"products");i(this,"invoices");i(this,"comment");i(this,"image");i(this,"contragent");i(this,"barcode");i(this,"orderSource");i(this,"isAllowProcessingWithoutPayment");i(this,"nextStatuses");i(this,"actions");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"erpOrderUrl");this.products=(e.products??[]).map(s=>{var p;const o=s.replacementId?(p=e.products)==null?void 0:p.find(g=>g.id===s.replacementId):void 0;return new Ot(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ke.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new v(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(t=e.nextStatuses)==null?void 0:t.map(s=>new _e(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl}}class Ri extends _{getOffers(r,e,t,s=void 0){return this.getTypedPaginated(Hr,"/internal/orders/offers",r,e,t,{},void 0,s)}createOfferFromCart(r,e,t){return this.post(`/internal/orders/offers/${r}`,{name:e,items:t!=null&&t.length?t:void 0},s=>new B(s.data))}createProfstroyOffer(r,e,t,s={}){return this.post(`/internal/orders/offers/${r}/profstroy`,{file:e,name:t},o=>new B(o.data),s)}actualizeProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/actualize`,{},e=>new B(e.data))}reloadProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/reload`,{},e=>new B(e.data))}getOffer(r){return this.get(`/internal/orders/offers/${r}`,{},e=>new B(e.data))}updateOffer(r,e){return this.patch(`/internal/orders/offers/${r}`,{name:e},t=>new B(t.data))}deleteOffer(r){return this.delete(`/internal/orders/offers/${r}`)}createOrderFromDraft(r,e,t,s={}){const o=S().config.dateFormats.api;return this.post(`/internal/orders/offers/${r}/create-order`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,o):void 0,items:t!=null&&t.length?t:void 0},p=>L.instanceListInitializer(d,p.data),s)}addOfferProduct(r,e,t={}){return this.post(`/internal/orders/offers/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new B(s.data),t)}patchOfferProduct(r,e,t,s={}){return this.patch(`/internal/orders/offers/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new B(o.data),s)}deleteOfferProduct(r,e){return this.delete(`/internal/orders/offers/${r}/products/${e}`,t=>new B(t.data))}getOfferHtml(r,e){return this.get(`/internal/orders/offers/${r}/view`,e?{recipientText:e}:{},t=>new Blob([t.data],{type:"text/html"}))}getOfferPdf(r,e){return this.getBlob(`/internal/orders/offers/${r}/download`,e?{recipientText:e}:{},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOffer(r,e){return this.post(`/internal/orders/offers/${r}/send`,e)}}class bi{static isProfstroy(r){return!!(r!=null&&r.isProfstroy)}static isProfstroyOffer(r){return!u.isNil(r)&&r.isProfstroy===!0&&!u.isNil(r.actualization)}}var dt=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(dt||{});class Ti{constructor(r){i(this,"paymentType");i(this,"deliveryType");i(this,"contragentId");i(this,"deliveryDate");i(this,"addressId");i(this,"warehouseId");i(this,"image");i(this,"comment");i(this,"barcode");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"additionalEmails");i(this,"isAllowProcessingWithoutPayment");i(this,"isAdditionalSale");var e,t,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(t=r==null?void 0:r.delivery.address)==null?void 0:t.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}class Wr extends v{}class Gr extends v{}class Si extends re{constructor(e){var t,s,o,p;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new P);i(this,"creator");i(this,"deliveryDate",new P);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"attachedAt",new P);i(this,"salesDirections");i(this,"status");i(this,"statusDetail");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(g=>"isActive"in g?new G(g):new Wr(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new K(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new P(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new k(e.creator):void 0,this.deliveryDate=new P(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new j(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new P(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new N(g)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new W(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new Gr(e.paymentType):void 0,this.warehouses=(p=e==null?void 0:e.warehouses)==null?void 0:p.map(g=>new pe(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new W;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":case"salesDirections":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":case"warehouses":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,p,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((p=e==null?void 0:e.deliveryDate)!=null&&p.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.attachedAt)!=null&&g.from)&&!((m=e==null?void 0:e.attachedAt)!=null&&m.to)&&delete e.attachedAt,e}}class $t{constructor(r){i(this,"user");i(this,"status");i(this,"statusDetail");i(this,"createdAt");this.user=new k(r==null?void 0:r.user),this.status=new _e(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new v(r.statusDetail):void 0,this.createdAt=u.isString(r==null?void 0:r.createdAt)?l.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class Ai extends _{getOrders(r,e,t,s=void 0){return this.getTypedPaginated(Br,"/internal/orders",r,e,t,{},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof V?r:new V(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new d(e.data))}createClientOrder(r,e,t,s={}){const o=S().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders`,{...e,deliveryDate:l.format(e.deliveryDate,o),items:t!=null&&t.length?t:void 0},p=>L.instanceListInitializer(d,p.data),s)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new d(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new d(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},t=>new d(t.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new d(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,t={}){const s=S().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,s):void 0},o=>new d(o.data),t)}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new d(s.data),t)}changeOrderStatus(r,e,t,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:t},o=>new d(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},t=>new d(t.data))}getOrderStatusHistory(r){return this.getTypedList($t,`/internal/orders/${r}/history`)}getOrderPrintHtml(r,e){return this.get(`/internal/orders/${r}/print/view`,{...e},t=>new Blob([t.data],{type:"text/html"}))}getOrderPrintPdf(r,e){return this.getBlob(`/internal/orders/${r}/print/download`,{...e},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOrderPrint(r,e){return this.post(`/internal/orders/${r}/print/send`,e)}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},t=>new d(t.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new d(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,t=>new d(t.data))}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new d(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getDeliveryCost(r,e,t,s=void 0){const o=S().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:l.format(e,o),warehouse_id:t},p=>p.data,void 0,s)}}const Oi=Symbol("currentOrder");class sr{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new K(r==null?void 0:r.client),this.product=new q(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Qe.Product}}const jr=n=>{var r,e,t,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(p=>p.id),clients:(e=n.clients)==null?void 0:e.map(p=>p.id),managers:(t=n.managers)==null?void 0:t.map(p=>p.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(p=>p.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(p=>p.id),hideNotActive:n.hideNotActive},p=>u.isNil(p)||(u.isArray(p)||u.isObject(p))&&u.isEmpty(p)):{}},kt=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class di extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...kt(e),filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...kt(e),filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}}class It{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new he(r.product):void 0,this.client=r.client?new k(r.client):void 0,this.executor=r.executor?new k(r.executor):void 0,this.currency=r.currency?new M(r.currency):void 0}}class Lt extends he{constructor(e){super(e);i(this,"history");this.history=u.map(e.history,t=>new It(t))}}class $i extends y{getProductPriceHistory(r){var o,p,g,m,a;const e=S().config.dateFormats.api,t=u.omitBy(u.merge(r,{costDate:{from:u.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(p=r.costDate)==null?void 0:p.from,to:u.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(m=r.costDate)==null?void 0:m.to}}),D=>u.isNil(D)||(u.isArray(D)||u.isObject(D))&&u.isEmpty(D)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(D=>[new Lt(u.merge(D[0],{history:D}))])}}class zr{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new he(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new he(e)))}}class ki extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new zr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new zr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}var qt=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(qt||{}),_t=(n=>(n.CanceledBy1c="canceled_by1c",n.CanceledByClient="canceled_by_client",n.FinishedNotApproved="finished_not_approved",n.ProcessingByPurchasingDepartment="processing_by_purchasing_department",n.WillWaiting="will_waiting",n))(_t||{});class Nt extends v{}class Mt extends v{}class Yr extends v{constructor(e){var t;super(e);i(this,"userRegions");this.userRegions=((t=e==null?void 0:e.userRegions)==null?void 0:t.map(s=>new de(s)))??[]}}class Ut extends v{}class Ht extends v{}class Bt extends v{}class Wt extends v{}class Ii{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class Qr extends v{}const Y=class Y extends ae{static withoutUnknownLocation(r){return r.filter(e=>e.id!==Y.unknownLocationId)}getReference(r,e=!1){return this.getTypedDataArrayRequester(Nt,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ir,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Ut,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(xe,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(M,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(F,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(Z,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(Wr,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Ht,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(_e,"/internal/references/order-status",!0)}getOrderStatusDetails(){return this.getTypedDataArrayRequester(Bt,"/internal/references/order-status-detail",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Gr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Qr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(N,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Lr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(j,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(J,`/internal/references/region-with-country/search?term=${r}`)}getRegionsByCountry(r){return this.getTypedDataArrayRequester(J,"/internal/references/region",!1,{params:{countryId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesByRegion(r){return this.getTypedDataArrayRequester(Mt,"/internal/references/city",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesWithUserRegionByRegion(r){return this.getTypedDataArrayRequester(Yr,"/internal/references/city-with-user-region",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}searchCityWithRegion(r,e,t=void 0){return this.getTypedDataArrayRequester(j,"/internal/references/city-with-region/search",!1,{term:r,...e?{params:{countryId:e}}:{}},t).then(s=>Y.withoutUnknownLocation(s))}searchCityWithUserRegion(r,e=void 0){return this.getTypedDataArrayRequester(Yr,"/internal/references/city-with-user-region/search",!1,{term:r},e).then(t=>Y.withoutUnknownLocation(t))}searchCountry(r){return this.getTypedDataArrayRequester(ne,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(W,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(pe,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Pr,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(x,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Wt,"/public/references/product-file-type",!0)}};i(Y,"unknownLocationId",1);let T=Y;const A=E.defineStore("common.references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),t=f.ref(void 0),s=f.ref(void 0),o=f.ref(void 0),p=f.ref(void 0),g=f.ref(void 0),m=f.ref(void 0),a=f.ref(void 0),D=f.ref(void 0),R=f.ref(void 0),Ne=f.ref(void 0),Me=f.ref(void 0),De=f.ref(void 0),ve=f.ref(void 0),Kr=f.ref(void 0),Xr=f.ref(void 0),Zr=f.ref(void 0),h=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:p,operatorReference:g,orderPaymentStatusReference:m,orderStatusReference:a,orderStatusDetailReference:D,paymentTypeReference:R,partnerGroupReference:Ne,productFileTypeReference:Me,resourceTypesReference:De,salesDirectionsReference:ve,sourcePrimaryInterestReference:Kr,warehousesReference:Xr,propertyTypesReference:Zr,priceCoefficientsReference:h}}),Li=E.defineStore("common.references",()=>{const n=f.computed(()=>{const h=A();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(T).getChannelPrimaryInterest().then(C=>{h.channelPrimaryInterestReference=C}).catch(u.noop)),h.channelPrimaryInterestReference}),r=f.computed(()=>{const h=A();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(T).getContactPositions().then(C=>{h.contactPositionsReference=C}).catch(u.noop)),h.contactPositionsReference}),e=f.computed(()=>{const h=A();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(T).getCurrency().then(C=>{h.currencyReference=C}).catch(u.noop)),h.currencyReference}),t=f.computed(()=>{const h=A();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(T).getOpf().then(C=>{h.opfReference=C}).catch(u.noop)),h.opfReference}),s=f.computed(()=>{const h=A();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(T).getOperators().then(C=>{h.operatorReference=C}).catch(u.noop)),h.operatorReference}),o=f.computed(()=>{const h=A();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(T).getOrderPaymentStatuses().then(C=>{h.orderPaymentStatusReference=C}).catch(u.noop)),h.orderPaymentStatusReference}),p=f.computed(()=>{const h=A();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(T).getOrderStatuses().then(C=>{h.orderStatusReference=C}).catch(u.noop)),h.orderStatusReference}),g=f.computed(()=>{const h=A();return!h.orderStatusDetailReference&&!h.dataLoaderList.orderStatusDetailReference&&(h.dataLoaderList.orderStatusDetailReference=!0,y.getInstance(T).getOrderStatusDetails().then(C=>{h.orderStatusDetailReference=C}).catch(u.noop)),h.orderStatusDetailReference}),m=f.computed(()=>{const h=A();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(T).getPaymentTypes().then(C=>{h.paymentTypeReference=C}).catch(u.noop)),h.paymentTypeReference}),a=f.computed(()=>{const h=A();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(T).getPartnerGroup().then(C=>{h.partnerGroupReference=C}).catch(u.noop)),h.partnerGroupReference}),D=f.computed(()=>{const h=A();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(T).getProductFileType().then(C=>{h.productFileTypeReference=C}).catch(u.noop)),h.productFileTypeReference}),R=f.computed(()=>{const h=A();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(T).getResourceTypes().then(C=>{h.resourceTypesReference=C}).catch(u.noop)),h.resourceTypesReference}),Ne=f.computed(()=>{const h=A();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(T).getSalesDirections().then(C=>{h.salesDirectionsReference=C}).catch(u.noop)),h.salesDirectionsReference}),Me=f.computed(()=>{const h=A();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(T).getSourcePrimaryInterest().then(C=>{h.sourcePrimaryInterestReference=C}).catch(u.noop)),h.sourcePrimaryInterestReference}),De=f.computed(()=>{const h=A();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(T).getDeliveryTypes().then(C=>{h.deliveryTypeReference=C}).catch(u.noop)),h.deliveryTypeReference}),ve=f.computed(()=>{const h=A();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(Ur).getManagers().then(C=>{h.managersList=C}).catch(u.noop)),h.managersList}),Kr=f.computed(()=>{const h=A();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(T).getWarehouses().then(C=>{h.warehousesReference=C}).catch(u.noop)),h.warehousesReference}),Xr=f.computed(()=>{const h=A();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(T).getPropertyTypes().then(C=>{h.propertyTypesReference=C}).catch(u.noop)),h.propertyTypesReference}),Zr=f.computed(()=>{const h=A();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(T).getPriceCoefficients().then(C=>{h.priceCoefficientsReference=C}).catch(u.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:p,orderStatusDetailReference:g,paymentTypeReference:m,partnerGroupsReference:a,productFilesTypesReference:D,resourceTypesReference:R,salesDirectionsReference:Ne,sourcePrimaryInterestsReference:Me,deliveryTypeReference:De,managersList:ve,warehousesReference:Kr,propertyTypesReference:Xr,priceCoefficientsReference:Zr}});class Gt{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class Vr{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new Qr(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(t=>new Gt(t)))??[],this.tags=r==null?void 0:r.tags}}class qi extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new Vr(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new Vr(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class _i extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(t=>{const s=[...t];let o=1;return s.forEach(p=>{p.id=o++}),s})}}var xr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.ExternalSeo="external_seo",n.Guest="guest",n))(xr||{});class jt extends vr{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new Cr(e.pricingRole):void 0}}class Ni extends y{constructor(){super(),this.baseUrl=`${S().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class zt extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new jt(r.data),!0)}}const Jr=E.defineStore("common.user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0);return{dataLoaderList:n,currentUser:r,currentManager:e}});function Yt(n){const r=Jr();(n==null?void 0:n.type)!==xr.Manager||r.currentManager||r.dataLoaderList.currentManager||(r.dataLoaderList.currentManager=!0,y.getInstance(Ur).getManager(n.id).then(e=>{r.currentManager=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentManager=!1}))}const Mi=E.defineStore("common.user_state",()=>{const n=f.computed(()=>{const e=Jr();return!e.currentUser&&!e.dataLoaderList.currentUser&&(e.dataLoaderList.currentUser=!0,y.getInstance(zt).getCurrentUser().then(t=>{e.currentUser=t,Yt(t)}).catch(u.noop).finally(()=>{e.dataLoaderList.currentUser=!1})),e.currentUser}),r=f.computed(()=>(Yt(n.value),Jr().currentManager));return{currentUser:n,currentManager:r}});class nr{constructor(r){i(this,"user");i(this,"salesDirection");this.user=new k(r==null?void 0:r.user),this.salesDirection=new N(r==null?void 0:r.salesDirection)}}class or extends de{constructor(e){var t,s;super(e);i(this,"cities");i(this,"users");this.cities=((t=e==null?void 0:e.cities)==null?void 0:t.map(o=>new j(o)))??[],this.users=((s=e==null?void 0:e.users)==null?void 0:s.map(o=>new nr(o)))??[]}}class Ui extends re{constructor(e){super();i(this,"id");i(this,"name");i(this,"abbr");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.abbr=e==null?void 0:e.abbr}resetFilterValue(e){switch(e){case"id":case"name":case"abbr":this[e]=void 0;break}return this}}class Hi extends _{getRegionsList(r,e,t){return this.getTypedPaginated(de,"/internal/users/regions",r,e,t)}getRegion(r){return this.get(`/internal/users/regions/${r}`,{},e=>new or(e.data))}createRegion(r,e={}){return this.post("/internal/users/regions",r,t=>new or(t.data),e)}updateRegion(r,e,t={}){return this.patch(`/internal/users/regions/${r}`,e,s=>new or(s.data),t)}removeRegion(r){return this.delete(`/internal/users/regions/${r}`)}getRegionEmployees(r){return this.getTypedList(nr,`/internal/users/regions/${r}/users`)}attachRegionEmployee(r,e,t){return this.post(`/internal/users/regions/${r}/users/${e}`,{salesDirectionId:t},s=>new nr(s.data))}detachRegionEmployee(r,e,t){return this.request({method:"DELETE",url:`/internal/users/regions/${r}/users/${e}`,params:{sales_direction_id:t}})}}class Bi{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Nt,c.AppBaseConfig=it,c.BankAccount=Fe,c.BasePaginationProvider=_,c.BlogPost=Be,c.BlogPostMediaFile=He,c.BlogPostMediaTypeEnum=be,c.BlogPostPublicationStatusEnum=Te,c.BlogPostShortInfo=ue,c.BlogPostsListFilters=Qt,c.BlogProvider=Ge,c.CalculationTypeEnum=lt,c.CalendarHelper=w,c.Cart=ge,c.CartProvider=Vt,c.CatalogProvider=Kt,c.CatalogableItem=gr,c.Category=U,c.CategoryFilter=ft,c.CategoryFilterSetting=Sr,c.CategoryFilterValue=gt,c.CategoryPricingRule=Tr,c.ChannelPrimaryInterest=Ir,c.City=Mt,c.CityWithRegionAndCountry=j,c.CityWithUserRegion=Yr,c.Client=qr,c.ClientAdditionalData=Ct,c.ClientCategory=$e,c.ClientDataProvider=H,c.ClientPriceCatalogableItem=Rr,c.ClientPriceCategory=br,c.ClientPriceProduct=Ze,c.ClientPriceProvider=Xt,c.ClientPriceTemplateProvider=Zt,c.ClientProduct=ie,c.ClientProductCategoryDataProvider=ei,c.ClientProductDataProvider=ri,c.ClientShortInfo=K,c.ClientsAdditionalDataRequestTypeEnum=mt,c.ClientsListFilters=oi,c.CodedIdentity=he,c.ConfiguratorProvider=ui,c.ConfiguratorsEnum=Dt,c.Contact=Ee,c.ContactLinks=ar,c.ContactPerson=X,c.ContactPersonRelated=wt,c.ContactPosition=Ut,c.ContactRelation=er,c.ContragentBase=dr,c.ContragentFactory=ke,c.ContragentIc=$r,c.ContragentPerson=yt,c.ContragentUlNr=at,c.ContragentUlR=kr,c.CostSourceEnum=Qe,c.Country=ne,c.CreatableIdentity=Se,c.CuratedDirection=xe,c.Curator=Ke,c.Currency=M,c.DataSuggestionProvider=_i,c.DateHelper=O,c.DateTimeProvider=mi,c.DeletableIdentity=pt,c.DeletableNamedIdentity=Oe,c.DeliveryAddress=ye,c.DeliveryType=W,c.DetailedJwtPayload=cr,c.DeviceTypeResolutionConfig=Er,c.Discount=tr,c.DiscountClient=rr,c.DiscountClientEligibility=Nr,c.DiscountConditions=Rt,c.DiscountHelper=bt,c.DiscountProvider=ir,c.DiscountShortInfo=je,c.DiscountStateEnum=Ie,c.DiscountStateHelper=Tt,c.DiscountsListFilters=Ci,c.Faq=qe,c.FaqGroup=Le,c.FaqProvider=wi,c.FieldValidationResultData=Bi,c.FilterGroup=V,c.FilterItem=lr,c.FilterOpEnum=We,c.FilterSettings=ht,c.GeoCoordinates=pr,c.HiddenCatalogableItem=ot,c.HttpCachedRequester=ae,c.HttpParamsConfig=et,c.HttpRequester=y,c.Identity=Q,c.Image=ct,c.JwtPayload=ee,c.Manager=G,c.ManagerCommon=Ve,c.ManagerDataFactory=vi,c.ManagerDataProvider=Ur,c.MetaTagItem=Gt,c.NamedIdentity=$,c.Offer=B,c.OfferActualization=St,c.OfferActualizationStatus=Ce,c.OfferHelper=bi,c.OfferShortInfo=Hr,c.OffersDataProvider=Ri,c.OffersListFilters=Pi,c.Operator=Wr,c.Opf=Z,c.OpfEnum=z,c.Order=d,c.OrderAction=dt,c.OrderEditorData=Ti,c.OrderInfo=Br,c.OrderItem=Ot,c.OrderItemBase=fr,c.OrderPaymentStatus=Ht,c.OrderShortInfo=_r,c.OrderStatus=_e,c.OrderStatusDetail=Bt,c.OrderStatusDetailEnum=_t,c.OrderStatusEnum=qt,c.OrderStatusHistoryInfo=$t,c.OrdersDataProvider=Ai,c.OrdersListFilters=Si,c.PaginationFiltersBase=re,c.PartnerGroup=F,c.PaymentType=Gr,c.PreferencesStorageProvider=Re,c.PriceAnalyze=sr,c.PriceAnalyzeProvider=di,c.PriceCatalogableItem=wr,c.PriceCoefficient=x,c.PriceCoefficientEnum=ur,c.PriceHistoryDataProvider=$i,c.PriceHistoryItem=It,c.PriceTemplate=te,c.PriceTemplateCategory=Je,c.PriceTemplateClient=fe,c.PriceTemplateICatalogableItem=Dr,c.PriceTemplateProduct=Xe,c.PriceTemplateProvider=ti,c.PricingRole=me,c.PricingRoleProvider=ii,c.PrimaryCatalogableItem=Ye,c.Product=q,c.ProductCategoryDataProvider=Ft,c.ProductDataProvider=Et,c.ProductFileType=Wt,c.ProductFilterTypeEnum=yr,c.ProductPriceCoefficient=ze,c.ProductPriceHistory=Lt,c.ProductUnit=hr,c.ProfstroyOfferItem=At,c.PropertiesProvider=si,c.Property=oe,c.PropertyType=Pr,c.PropertyTypeEnum=ut,c.PropertyValue=ce,c.RecommendationsDataProvider=ki,c.RecommendationsList=zr,c.Reference=v,c.ReferenceDataFactory=Ii,c.ReferenceDataProvider=T,c.Region=J,c.ResourceType=Qr,c.STANDARD_PERIOD_GROUPS=yi,c.STANDARD_PERIOD_SECTIONS=ai,c.SalesDirection=N,c.SentryConfig=rt,c.Seo=Vr,c.SeoDataProvider=qi,c.SourcePrimaryInterest=Lr,c.StockCount=nt,c.TableDataPagination=pi,c.TableDataPaginationRequestParams=vt,c.TableDataSortRequestParams=hi,c.TemplateProductCategoryDataProvider=ni,c.TemplatesListFilters=Jt,c.TypedInstanceFactory=L,c.UnitsHelper=Mr,c.UnknownClientDataProvider=ci,c.UpdatableNamedIdentity=Ae,c.User=jt,c.UserAuthDataProvider=Ni,c.UserCommonInfo=vr,c.UserDataProvider=zt,c.UserPricingRole=Cr,c.UserRegion=or,c.UserRegionEmployee=nr,c.UserRegionProvider=Hi,c.UserRegionShortInfo=de,c.UserRegionsListFilters=Ui,c.UserShortInfo=k,c.UserTypeEnum=xr,c.VersionConfig=li,c.Warehouse=pe,c.WebSocketConfig=tt,c.currentOrderInjectionKey=Oi,c.daysAgoIso=gi,c.findCatalogItemByIdRecursive=Ar,c.flattenCatalogItems=Or,c.formatPercentChange=Di,c.formatRelativeDate=fi,c.pluralize=Pt,c.useAuthStateStore=Ue,c.useBaseConfigStateStore=S,c.useReferencesStore=Li,c.useUserStateStore=Mi,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],I):(c=typeof globalThis<"u"?globalThis:c||self,I(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,I,u,Pe,E,f,l,Fr){"use strict";var Wi=Object.defineProperty;var Gi=(c,I,u)=>I in c?Wi(c,I,{enumerable:!0,configurable:!0,writable:!0,value:u}):c[I]=u;var i=(c,I,u)=>Gi(c,typeof I!="symbol"?I+"":I,u);class ee{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");u.merge(this,r)}static getJwtPayload(r){const e=I.jwtDecode(r),t=new ee(Pe.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class cr extends ee{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");u.merge(this,e)}static getJwtPayload(e){const t=I.jwtDecode(e),s=new cr(Pe.objectToCamel(t));return s.resourceAccess=t.resource_access,s}}class Er{constructor(r){i(this,"phone");i(this,"tablet");i(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class et{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class rt{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class tt{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class it{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");i(this,"numberPrecision");var e,t,s,o;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new et(r==null?void 0:r.http),this.deviceTypeByResolution=new Er(r==null?void 0:r.deviceTypeByResolution),this.sentry=new rt({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new tt(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"},this.numberPrecision={priceCoefficient:((o=r==null?void 0:r.numberPrecision)==null?void 0:o.priceCoefficient)??7}}}const S=E.defineStore("common.config",()=>{const n=f.ref(new it);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=u.merge(n.value,t)}}});class be{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||l.isAfter(l.parseISO(t.availableFor)||l.startOfToday(),new Date)){if(u.isNil(t.data)||u.isEmpty(t.data))throw new Error("Data is empty");return t.data}localStorage.removeItem(r)}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(u.isNil(e)||u.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function st(n){try{const r=ee.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const le=E.defineStore("common.auth_state_private",()=>{const n=f.ref((()=>{var g;const o=be.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const p=(g=S().config.devMode)==null?void 0:g.initAuthBearerToken;return p?Promise.resolve(p):void 0})()),r=f.ref(void 0),e=f.ref(void 0),t=f.markRaw(new Map);function s(){e.value=void 0,u.isNil(n.value)||n.value.then(o=>{const p=ee.getJwtPayload(o);e.value=p.exp*1e3>Date.now()?u.mapValues(p.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(u.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),Ue=E.defineStore("common.auth_state",()=>{const n=f.computed(()=>{const o=le();if(u.isNil(o.jwtToken)&&!u.isNil(o.jwtTokenUpdater)){const p=o.jwtTokenUpdater();o.jwtToken=p,p.then(g=>{o.jwtToken=Promise.resolve(g),be.saveActualDataToStorage("sc.token",g,st(g)),o.recalculateUserPermissions()}).catch(u.noop)}return o.jwtToken});function r(o){le().jwtTokenUpdater=o}function e(o){const p=le();p.jwtToken=Promise.resolve(o),be.saveActualDataToStorage("sc.token",o,st(o)),p.recalculateUserPermissions()}function t(){const o=le();o.jwtToken=void 0,o.userPermissions=void 0,be.saveActualDataToStorage("sc.token",void 0)}function s(o){const p=le();!u.isNil(p.jwtToken)&&u.isNil(p.userPermissions)&&p.jwtToken.then(a=>{const D=ee.getJwtPayload(a);p.userPermissions=D.exp*1e3>Date.now()?u.mapValues(D.resourceAccess,b=>(b==null?void 0:b.roles)??[]):void 0}).catch(u.noop);const g=u.isArray(o)?o.join(" && "):o;if(p.userPermissionsComputedRefs.has(g))return p.userPermissionsComputedRefs.get(g);const m=f.computed(()=>{const a=D=>{var ve;const b=u.split(D,".");if(b.length<2)return!1;const[Ne,Me]=b,De=(ve=le().userPermissions)==null?void 0:ve[Ne];return u.isArray(De)&&De.includes(Me)};return u.isArray(o)?u.every(o,D=>a(D)):a(o)});return p.userPermissionsComputedRefs.set(g,m),m}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});var Re=(n=>(n.Image="image",n.Video="video",n))(Re||{});class Q{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,u.isNil(this.id)&&(u.isNil(e)?typeof(r==null?void 0:r.id)=="number"?this.id=-1:typeof(r==null?void 0:r.id)=="string"&&(this.id=""):this.id=e),this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return typeof this.id=="number"?this.id===-1:typeof this.id=="string"?this.id==="":u.isNil(this.id)}}class He extends Q{constructor(e){super(e,"");i(this,"mediaType");i(this,"isCover");i(this,"isUnused");i(this,"url");i(this,"urlWebp");this.mediaType=(e==null?void 0:e.mediaType)??Re.Image,this.isCover=(e==null?void 0:e.isCover)??!1,this.isUnused=(e==null?void 0:e.isUnused)??!1,this.url=(e==null?void 0:e.url)??"",this.urlWebp=e==null?void 0:e.urlWebp}isImage(){return this.mediaType===Re.Image}isVideo(){return this.mediaType===Re.Video}}var Te=(n=>(n.Draft="draft",n.Published="published",n.Scheduled="scheduled",n))(Te||{});class O{static parse(r){if(u.isNil(r))return;const e=u.isString(r)?l.parseISO(r):r;return l.isValid(e)?e:void 0}static toApiFormat(r){return u.isNil(r)||!l.isValid(r)?null:l.format(r,S().config.dateFormats.api)}static periodToApiFormat(r){return{from:O.toApiFormat(r.from),to:O.toApiFormat(r.to)}}}class Se extends Q{constructor(e,t){super(e,t);i(this,"createdAt");this.createdAt=O.parse(e==null?void 0:e.createdAt)??new Date}}class ue extends Se{constructor(e){super(e,-1);i(this,"slug");i(this,"title");i(this,"publishedAt");this.slug=(e==null?void 0:e.slug)??"",this.title=(e==null?void 0:e.title)??"",this.publishedAt=ue.parseDate(e==null?void 0:e.publishedAt)}static resolvePublicationStatus(e){return u.isNil(e)?Te.Draft:e.getTime()>Date.now()?Te.Scheduled:Te.Published}static getSlugError(e){return e?/[^a-z0-9-]/.test(e)?"Допустимы только строчные латинские буквы, цифры и дефис: пример «kak-vybrat-podokonnik».":u.startsWith(e,"-")||u.endsWith(e,"-")?"Обозначение не может начинаться или заканчиваться дефисом.":u.includes(e,"--")?"Дефисы не могут идти подряд: разделяйте слова одним дефисом.":"":""}static parseDate(e){return u.isNil(e)?null:u.isString(e)?l.parseISO(e):e}getPublicationStatus(){return ue.resolvePublicationStatus(this.publishedAt)}}class Be extends ue{constructor(e){super(e);i(this,"content");i(this,"media");this.content=(e==null?void 0:e.content)??"",this.media=((e==null?void 0:e.media)??[]).map(t=>new He(t))}toSaveData(e=!1){return{title:this.title,slug:this.slug.length>0?this.slug:void 0,content:e?this.content:void 0,publishedAt:this.publishedAt}}getCover(){return this.media.find(e=>e.isCover)}getUnusedMedia(){return this.media.filter(e=>e.isUnused)}}class re{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];u.isNil(t)||u.isString(t)&&t.trim().length===0||u.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class P{constructor(r){i(this,"from");i(this,"to");this.from=u.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=u.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class Qt extends re{constructor(e){super();i(this,"id");i(this,"title");i(this,"slug");i(this,"content");i(this,"publicationStatus");i(this,"publishedAt");i(this,"createdAt");this.id=e==null?void 0:e.id,this.title=e==null?void 0:e.title,this.slug=e==null?void 0:e.slug,this.content=e==null?void 0:e.content,this.publicationStatus=e==null?void 0:e.publicationStatus,this.publishedAt=new P(e==null?void 0:e.publishedAt),this.createdAt=new P(e==null?void 0:e.createdAt)}resetFilterValue(e){switch(e){case"id":case"title":case"slug":case"content":case"publicationStatus":this[e]=void 0;break;case"publishedAt":this.publishedAt.from=null,this.publishedAt.to=null;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break}return this}asClearRaw(){var t,s,o,p;const e=super.asClearRaw();return!((t=e==null?void 0:e.publishedAt)!=null&&t.from)&&!((s=e==null?void 0:e.publishedAt)!=null&&s.to)&&delete e.publishedAt,!((o=e==null?void 0:e.createdAt)!=null&&o.from)&&!((p=e==null?void 0:e.createdAt)!=null&&p.to)&&delete e.createdAt,e}}class L{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}static instanceListInitializer(r,e){if(!u.isArray(e))throw new TypeError(`Ожидался список данных для инициализации "${r.name}", получены данные типа "${typeof e}".`);return u.map(e,t=>L.instanceInitializer(r,t))}}const R=class R{constructor(){i(this,"httpClient");i(this,"baseUrl",`${S().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",u.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return u.isNil(Ue().jwtToken)||(e=await Ue().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>R.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=Pe.objectToSnake(r.params)),["put","patch","post"].includes(u.toLower(r.method))&&r.data&&(r.data=Pe.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(Ue().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new Fr.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>R.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=Pe.objectToCamel(r.data)),r));this.errorResponseHandler=R.defaultErrorsResponseHandler,this.httpClient=Fr.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>R.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){R.defaultErrorsResponseHandler=r}static addRequestHook(r){R.requestHooks.includes(r)||R.requestHooks.push(r)}static removeRequestHook(r){const e=R.requestHooks.indexOf(r);e!==-1&&R.requestHooks.splice(e,1)}static addResponseHook(r){R.responseHooks.includes(r)||R.responseHooks.push(r)}static removeResponseHook(r){const e=R.responseHooks.indexOf(r);e!==-1&&R.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(R.instances,r.name)||(R.instances[r.name]=L.simpleInstanceInitializer(r)),R.instances[r.name]}static toHttpResponseError(r){return u.isObject(r)&&"status"in r?r:{status:0,statusText:"Invalid response data",message:u.isError(r)?r.message:"Не удалось обработать данные ответа сервера.",headers:{},rawError:u.isError(r)?r:new Error(String(r))}}static convertHttpErrorResponse(r){var e,t;if(u.isNil(r)||!u.isNil(r.request)||!u.isNil(r.response)){const s=u.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(p=>e?e(p):p.data);return o.catch(p=>{(p==null?void 0:p.name)!=="CanceledError"&&this.errorResponseHandler(R.toHttpResponseError(p),t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getTypedList(r,e,t={},s=!1,o=void 0){return this.get(e,t,p=>L.instanceListInitializer(r,p.data),s,o)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(R,"instances",{}),i(R,"defaultErrorsResponseHandler",u.noop),i(R,"requestHooks",[]),i(R,"responseHooks",[]);let y=R;var We=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(We||{});class lr{constructor(r){i(this,"field");i(this,"op");i(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??We.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=S().config.dateFormats.api,e={field:this.field,op:this.op};if(u.isDate(this.value))e.value=l.format(this.value,r);else if(u.isPlainObject(this.value)){const t=this.value;e.value={from:t.from?l.format(t.from,r):null,to:t.to?l.format(t.to,r):null}}else e.value=this.value;return e}}class V{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new lr(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new V(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof lr&&u.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof V?r.toPrimitive():r)}}}class _ extends y{getPaginated(r,e,t,s,o,p,g,m=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof V?e:new V(e)).toPrimitive())),u.isEmpty(t)||(a.sort=u.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,p,g,m)}getTypedPaginated(r,e,t,s,o,p,g,m=void 0){return this.getPaginated(e,t,s,o,p,a=>({...a.data,data:L.instanceListInitializer(r,a.data.data)}),g,m)}}class Ge extends _{static preparePostSaveData(r){const e={};if(u.isUndefined(r.title)||(e.title=r.title),u.isUndefined(r.slug)||(e.slug=r.slug),u.isUndefined(r.content)||(e.content=r.content),!u.isUndefined(r.publishedAt)){const t=S().config.dateFormats.api;e.publishedAt=u.isNil(r.publishedAt)?null:l.format(r.publishedAt,t)}return e}getPostList(r,e,t){return this.getPaginated("/internal/blog",r,e,t,{},s=>({...s.data,data:s.data.data.map(o=>new ue(o))}))}getPost(r){return this.get(`/internal/blog/${r}`,{},e=>new Be(e.data))}createPost(r,e={}){return this.post("/internal/blog",Ge.preparePostSaveData(r),t=>new Be(t.data),e)}updatePost(r,e,t={}){return this.patch(`/internal/blog/${r}`,Ge.preparePostSaveData(e),s=>new Be(s.data),t)}removePost(r){return this.delete(`/internal/blog/${r}`)}uploadMedia(r,e,t,s,o={}){return this.request({method:"POST",url:`/internal/blog/${r}/media`,data:{file:e,isCover:t??!1},onUploadProgress:p=>{s&&s(p.total?Math.round(p.loaded/p.total*100):0)}},p=>new He(p.data),o)}updateMedia(r,e,t,s={}){return this.patch(`/internal/blog/${r}/media/${e}`,{isCover:t},o=>new He(o.data),s)}removeMedia(r,e){return this.delete(`/internal/blog/${r}/media/${e}`)}}class $ extends Q{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}nameOrGuid(){return u.isEmpty(this.name)?this.guid:this.name}}class Ae extends ${constructor(e){super(e);i(this,"createdAt");i(this,"updatedAt");this.createdAt=O.parse(e==null?void 0:e.createdAt),this.updatedAt=O.parse(e==null?void 0:e.updatedAt)}}class Oe extends Ae{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=O.parse(e==null?void 0:e.deletedAt)}}class k extends ${constructor(e){super(e);i(this,"type");i(this,"isActive");this.type=e==null?void 0:e.type,this.isActive=(e==null?void 0:e.isActive)??!0}}class je extends Oe{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=O.parse(e==null?void 0:e.publishedAt),this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new k(e==null?void 0:e.owner)}}class te extends Ae{constructor(e){super(e);i(this,"description");i(this,"owner");this.description=(e==null?void 0:e.description)??"",this.owner=e!=null&&e.owner?new k(e.owner):void 0}}var ur=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(ur||{});class v extends ${constructor(e){super(e);i(this,"slug");i(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class x extends v{static getRetailPriceCoefficient(){const r=new x({id:-2,slug:ur.Retail,name:"Розн. цена",guid:""});return r.isNewRec=u.constant(!0),r}}class ze{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new x(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class pr{constructor(r){i(this,"lat");i(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class W extends v{}class pe extends v{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new W(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new pr(e==null?void 0:e.coordinates)}}class nt{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new pe(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class M extends ${constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class hr extends ${constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class he extends ${constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class gr extends he{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class ot extends gr{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class ct{constructor(r,e){i(this,"image");i(this,"preview");i(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class Ye extends gr{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class q extends ot{constructor(e){var s,o,p,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new hr(e.unit):new hr,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new M(e.currency):new M,this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=u.isString(e==null?void 0:e.costDate)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(m=>new nt(m)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(m=>m.isPrimary));t&&(this.category=new Ye({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(m=>new Ye(m))),this.images=((p=e==null?void 0:e.images)==null?void 0:p.map(m=>new ct(m,S().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(m=>new ze(m)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Qe=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Qe||{});class ie extends q{constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");i(this,"priceCoefficient");i(this,"increasePercent");i(this,"isPreviouslyOrdered");i(this,"isRequired");i(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??Qe.Product,this.discount=e!=null&&e.discount?new je(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new te(e.priceTemplate):void 0,this.priceCoefficient=e!=null&&e.priceCoefficient?new x(e.priceCoefficient):void 0,this.increasePercent=e==null?void 0:e.increasePercent,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class se extends Ye{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[u.toUpper(t),s])):void 0}}class fr extends Q{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creator");i(this,"isRemoved");i(this,"ord");i(this,"onOrder");i(this,"originalId");i(this,"replacementId");this.product=new ie(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new se,this.currency=e.currency?new M(e.currency):void 0,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&u.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale,this.creator=e.creator&&new k(e.creator),this.isRemoved=e.isRemoved,this.ord=e.ord,this.onOrder=e.onOrder,this.originalId=e.originalId,this.replacementId=e.replacementId}}let mr=class extends fr{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new M(e.currency)}};class ge{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new mr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Vt extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ge(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ge(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new ge(s.data),t)}deleteCartItem(r,e){return this.delete(`internal/clients/${r.id}/cart/${e.id}`,t=>new ge(t.data))}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new ge(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var lt=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(lt||{}),ut=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(ut||{}),yr=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(yr||{});class U extends se{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new U(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new q(o))}}class ar{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class N extends v{}class Ve extends Ae{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new N(e.salesDirection):new N,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new ar(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class xe extends v{}class Cr extends ${constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class de extends ${constructor(e){super(e);i(this,"abbr");this.abbr=(e==null?void 0:e.abbr)??""}}class G extends Ve{constructor(e){var t,s,o;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");i(this,"showAllCosts");i(this,"authAsOperator");i(this,"managerRegions");i(this,"managers");i(this,"lastLoginAt");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.supervisorId=e==null?void 0:e.supervisorId,this.pricingRole=e!=null&&e.pricingRole?new Cr(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(p=>new xe(p)))??[],this.showAllCosts=e==null?void 0:e.showAllCosts,this.authAsOperator=e==null?void 0:e.authAsOperator,this.managerRegions=(s=e==null?void 0:e.managerRegions)==null?void 0:s.map(p=>new de(p)),this.managers=(o=e==null?void 0:e.managers)==null?void 0:o.map(p=>new G(p)),this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt}}class xt extends se{constructor(e){super(e);i(this,"isDisabled");i(this,"isRequired");i(this,"isFavorite");i(this,"hidingComment");i(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new G(e.manager):void 0}}class $e extends xt{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new $e(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new ie(o))}}class wr{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new x(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Dr extends wr{constructor(r){super(r)}}class Je extends Dr{constructor(e){super(e);i(this,"productCategory");this.productCategory=new se(e==null?void 0:e.productCategory)}}class Ke extends ${constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new ar(e.contacts),this.curatedDirection=new xe(e.curatedDirection)}}class ne extends v{}class J extends v{constructor(e){super(e);i(this,"country",new ne);e&&(this.country=new ne(e.country))}}class j extends v{constructor(e){super(e);i(this,"region",new J);e&&(this.region=new J(e.region))}}class vr extends Ae{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"lastLoginAt");i(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new N(e.salesDirection):void 0,this.lastLoginAt=u.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class K extends vr{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new N(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new j(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new Ve(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Ke(o)))??void 0}}class pt extends Se{constructor(e,t){super(e,t);i(this,"deletedAt");this.deletedAt=O.parse(e==null?void 0:e.deletedAt)}}class fe extends pt{constructor(e){super(e);i(this,"client");i(this,"priceTemplate");this.client=new K(e==null?void 0:e.client),this.priceTemplate=new te(e==null?void 0:e.priceTemplate)}}class Xe extends Dr{constructor(e){super(e);i(this,"product");this.product=new q(e==null?void 0:e.product)}}class Pr extends v{}class oe extends ${constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");i(this,"isFilterable");this.type=new Pr(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata,this.isFilterable=e==null?void 0:e.isFilterable}}class ce{constructor(r){i(this,"property");i(this,"value");this.property=new oe(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class Jt{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"ownerName");i(this,"createdAt",new P);i(this,"updatedAt",new P);this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.description=r==null?void 0:r.description,this.ownerName=r==null?void 0:r.ownerName,this.createdAt=new P(r==null?void 0:r.createdAt),this.updatedAt=new P(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":case"ownerName":this[r]=void 0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"updatedAt":this.updatedAt.from=null,this.updatedAt.to=null;break}return this}asClearRaw(){var e,t,s,o;const r={};return Object.keys(this).forEach(p=>{const g=this[p];u.isNil(g)||u.isString(g)&&g.trim().length===0||u.isFunction(g.isNewRec)&&g.isNewRec()||(r[p]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class br extends wr{constructor(e){super(e);i(this,"executor");i(this,"createdAt");this.executor=e!=null&&e.executor?new k(e.executor):void 0,this.createdAt=O.parse(e==null?void 0:e.createdAt)}}class Ze extends br{constructor(e){super(e);i(this,"product");this.product=new q(e==null?void 0:e.product)}}class Rr extends br{constructor(e){super(e);i(this,"productCategory");this.productCategory=new se(e==null?void 0:e.productCategory)}}class me extends ${constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");i(this,"subRoles",[]);i(this,"parentRole");i(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Tr{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new me(r==null?void 0:r.role),this.category=new se(r==null?void 0:r.category),this.minCoefficient=new x(r==null?void 0:r.minCoefficient)}}class ht{constructor(r){i(this,"isFake");i(this,"isHidden");i(this,"isMultiple");i(this,"type");i(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class Sr{constructor(r){i(this,"category");i(this,"property");i(this,"settings");this.category=new se(r==null?void 0:r.category),this.property=new oe(r==null?void 0:r.property),this.settings=new ht(r==null?void 0:r.settings)}}class gt{constructor(r){i(this,"id");i(this,"label");this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??""}}class ft{constructor(r){i(this,"id");i(this,"label");i(this,"type");i(this,"ord");i(this,"isMultiple");i(this,"values");i(this,"min");i(this,"max");var e;this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??"",this.type=(r==null?void 0:r.type)??yr.Checkbox,this.ord=(r==null?void 0:r.ord)??0,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.values=((e=r==null?void 0:r.values)==null?void 0:e.map(t=>new gt(t)))??[],this.min=(r==null?void 0:r.min)??null,this.max=(r==null?void 0:r.max)??null}}class Kt extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let p=`${S().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(p+=`&category_id=${t}`),s&&(p+=`&client_id=${s}`),p}}class Xt extends y{importPrices(r,e,t=!1){return this.post(`/internal/clients/${r}/price/import`,e,void 0,{},t)}getCategoryPrices(r){return this.getTypedList(Rr,`/internal/clients/${r}/price/categories`)}getCategoryPrice(r,e){return this.get(`/internal/clients/${r}/price/categories/${e}`,{},t=>new Rr(t.data))}updateCategoryPrices(r,e,t,s=!1){var o;return this.request({method:"PATCH",url:`/internal/clients/${r}/price/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}})}removeCategoryPrices(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/clients/${r}/price/categories/${e}`,params:t?{recursively:!0}:{}})}removeCategoryProductsPrices(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/clients/${r}/price/categories/${e}/products`,params:t?{recursively:!0}:{}})}markCategoryRequired(r,e){return this.post(`/internal/clients/${r}/price/categories/${e}/required`)}unmarkCategoryRequired(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/required`)}markCategoryDisabled(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:t})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,t){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:t})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}getProductPrices(r){return this.getTypedList(Ze,`/internal/clients/${r}/price/products`)}getProductPrice(r,e){return this.get(`/internal/clients/${r}/price/products/${e}`,{},t=>new Ze(t.data))}updateProductPrice(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new Ze(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`)}markProductRequired(r,e){return this.post(`/internal/clients/${r}/price/products/${e}/required`)}unmarkProductRequired(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}/required`)}getCommercialOfferHtml(r,e){return this.get(`/internal/clients/${r}/price/commercial-offer/view`,e,t=>new Blob([t.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,t=>new Blob([t.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Zt extends y{getTemplateList(r){return this.getTypedList(fe,`/internal/clients/${r}/price/templates`)}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new fe(e.data),!0)}attachTemplate(r,e,t){const s=S().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&l.format(t.startAt,s),endAt:t.endAt&&l.format(t.endAt,s)},o=>new fe(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=S().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},p=>new fe(p.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class Ft extends y{getRootCategoriesList(r=!1){return this.getTypedList(U,"/internal/catalog/categories",{showHidden:r})}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new U(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new U(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>u.map(s.data,o=>new q(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return u.forEach(t,s=>s.map(o=>new ze(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(p=>new U(p)))}).catch(o=>{s(o)})})}}class Et extends _{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new q(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new q(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>u.map(e.data,t=>new ze(t)))}getNewProducts(r,e,t=!0){const s=S().config.dateFormats.api;return this.getTypedPaginated(q,"/internal/catalog/products/new",void 0,void 0,e,{period:{from:l.format(r,s)},withPriceCoefficients:t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(p=>new q(p)))}).catch(o=>{s(o)})})}}class ei extends y{getRootCategoriesList(r,e=!1){return this.getTypedList($e,"/internal/catalog/categories",{clientId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new $e(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,p=>new ie(p)))}}class ri extends _{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new ie(s.data))}getNewProducts(r,e,t,s=!0){const o=S().config.dateFormats.api;return this.getTypedPaginated(ie,"/internal/catalog/products/new",void 0,void 0,t,{clientId:r,period:{from:l.format(e,o)},withPriceCoefficients:s})}}class ti extends _{getTemplateList(r,e,t){return this.getTypedPaginated(te,"/internal/price/templates",r,e,t)}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new te(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new te(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new te(s.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.getTypedList(Xe,`/internal/price/templates/${r}/products`)}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new Xe(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new Xe(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.getTypedList(Je,`/internal/price/templates/${r}/categories`)}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new Je(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},p=>new Je(p.data))}deleteCategoryTemplatePrice(r,e,t=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:t?{recursively:!0}:{}})}getTemplateClients(r){return this.getTypedList(fe,`/internal/price/templates/${r}/clients`)}}class ii extends y{getRoles(){return this.getTypedList(me,"/internal/price/roles")}createRole(r){return this.post("/internal/price/roles",r,e=>new me(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new me(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new me(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.getTypedList(Tr,`/internal/price/roles/rules/categories/${r}`)}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>L.instanceListInitializer(Tr,t.data))}}class si extends _{getProperties(r,e,t){return this.getTypedPaginated(oe,"/internal/catalog/properties",r,e,t)}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new oe(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new oe(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new oe(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.getTypedList(ce,`/internal/catalog/products/${r}/properties`)}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new ce(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new ce(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.getTypedList(ce,`/internal/catalog/categories/${r}/properties`)}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new ce(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new ce(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}getCategoryFilters(r,e=!1){return this.get(`/internal/catalog/categories/${r}/filters`,{recursively:e},t=>t.data.map(s=>new ft(s)))}getCategoryFilterSettings(r){return this.getTypedList(Sr,`/internal/catalog/categories/${r}/filter-settings`)}saveCategoryFilterSetting(r,e,t){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,t,s=>new Sr(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class ni extends y{getRootCategoriesList(r,e=!1){return this.getTypedList(U,"/internal/catalog/categories",{priceTemplateId:r,showHidden:e})}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new U(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>u.map(o.data,p=>new q(p)))}}function Ar(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const p=Ar(o.products,r,e);if(p)return t=p,!0}if(o.categories&&o.categories.length>0){const p=Ar(o.categories,r,e);if(p)return t=p,!0}return!1}),t}function Or(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...Or(t.products)),t.categories&&t.categories.length>0&&r.push(...Or(t.categories))}}),r}var mt=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(mt||{}),z=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(z||{});class Fe extends Q{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new M);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new M(e.currency))}}class Ee extends Oe{constructor(e){super(e);i(this,"phone");i(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class X extends Ee{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment}}class Z extends v{static generatePersonItem(){return new Z({id:1,guid:"",slug:z.Person,name:""})}}class F extends v{}class dr extends Oe{constructor(e){super(e);i(this,"opf",Z.generatePersonItem());i(this,"partnerGroup",new F);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"creator");i(this,"updater");if(e){if(this.opf=new Z(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.creator=e.creator?new k(e.creator):void 0,this.updater=e.updater?new k(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new F(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new X(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new Fe(s))}),this.bankAccounts=t}}}}class yt extends dr{constructor(r){super(r)}}class $r extends dr{constructor(e){super(e);i(this,"inn","");i(this,"okpo","");i(this,"directorName","");i(this,"directorPosition","");i(this,"directorActsOn","");i(this,"legalAddress","");i(this,"postalAddress","");i(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class kr extends $r{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class at extends kr{constructor(e){super(e);i(this,"registrationCountry",new ne);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new ne(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ke{static createInstance(r){switch(r.opf.slug){case z.Ic:return new $r(r);case z.UlR:return new kr(r);case z.UlNr:return new at(r);default:return new yt(r)}}}class ye extends Oe{constructor(e){var t;super(e);i(this,"address","");i(this,"coordinates");i(this,"contacts");i(this,"comment");i(this,"operatingHours");i(this,"isOneTime");i(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new pr(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new X(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class Ir extends v{}class Lr extends v{}class qr extends K{constructor(e){var t,s,o,p;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>ke.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new F(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new X(g)))??[],this.deliveryAddresses=((p=e==null?void 0:e.deliveryAddresses)==null?void 0:p.map(g=>new ye(g)))??[],this.channelPrimaryInterest=new Ir(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Lr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new W(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new pe(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class oi extends re{constructor(e){var t,s,o,p,g,m,a,D;super();i(this,"id");i(this,"guid");i(this,"name");i(this,"alternativeName");i(this,"searchTerm");i(this,"cities");i(this,"region");i(this,"country");i(this,"phone");i(this,"email");i(this,"isActive");i(this,"createdAt",new P);i(this,"lastLoginDate",new P);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new P);this.id=e==null?void 0:e.id,this.guid=e==null?void 0:e.guid,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(b=>new j(b)),this.region=new J(e==null?void 0:e.region),this.country=new ne(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new P(e==null?void 0:e.createdAt),this.lastLoginDate=new P(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(b=>new G(b)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(b=>new Ke(b)))??[],this.salesDirections=(p=e==null?void 0:e.salesDirections)==null?void 0:p.map(b=>new N(b)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new Z(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new W(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(b=>new F(b)),this.contact=new Ee(e==null?void 0:e.contact),this.lastOrder={createdAt:new P((m=e==null?void 0:e.lastOrder)==null?void 0:m.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(D=e==null?void 0:e.lastOrder)==null?void 0:D.isApproved},this.noOrdersPeriod=new P(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new J;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new Z;break;case"preferredDeliveryType":this.preferredDeliveryType=new W;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Ee;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,p,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((p=e==null?void 0:e.lastLoginDate)!=null&&p.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((m=e==null?void 0:e.noOrdersPeriod)!=null&&m.to)&&delete e.noOrdersPeriod,e}}class _r extends Se{constructor(e){super(e);i(this,"creator");this.creator=new k(e==null?void 0:e.creator)}}class Ct extends ${constructor(e){var t,s,o,p;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(g=>new X(g)))??void 0,this.lastOrder=e.lastOrder?new _r(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new F(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new W(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new N(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new Ve(g)))??void 0,this.curators=((p=e.curators)==null?void 0:p.map(g=>new Ke(g)))??void 0}}class er extends Q{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class wt extends X{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new er(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new er(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new er(t))))}}class H extends _{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var p,g,m,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case z.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(p=t.partnerGroup)==null?void 0:p.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case z.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case z.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new qr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getTypedPaginated(K,"/internal/clients",r,e,t,s,void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:We.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>L.instanceListInitializer(Ct,s.data))}getAllClientContacts(r){return this.getTypedList(wt,`/internal/clients/${r}/contacts/all`)}createClientCommonData(r,e={}){return this.post("/internal/clients",H.transformClientDataToRequest(r),t=>new qr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,H.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,H.transformContragentClientDataToRequest(e),s=>ke.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,H.transformContragentClientDataToRequest(e),s=>ke.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}getClientDeliveryAddresses(r){return this.getTypedList(ye,`/internal/clients/${r}/delivery-addresses`)}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,H.transformClientDeliveryAddressToRequest(e),s=>new ye(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,H.transformClientDeliveryAddressToRequest(e),s=>new ye(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,H.transformClientContragentBankAccountToRequest(t),o=>new Fe(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,H.transformClientContragentBankAccountToRequest(t),o=>new Fe(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new X(s.data),t)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var p,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(p=e.phone)!=null&&p.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,m=>new X(m.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class ci extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class li{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=u.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var Dt=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(Dt||{});class ui extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var p;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(p=r.properties)==null?void 0:p.configurator}/product`,{params:t,client_id:e},g=>new q(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class vt{constructor(r){i(this,"page",1);i(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class pi extends vt{constructor(e){super(e);i(this,"itemCount",0);i(this,"pageCount",1);i(this,"pageSlot",5);i(this,"pageSizes",[25,50,100]);i(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class hi{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class w{static decadeInterval(r){const[e,t]=w.shiftedDecadeBounds(r,0);return{from:e,to:t}}static shiftDecadeInterval(r,e){const[t,s]=w.shiftedDecadeBounds(r,e);return{from:t,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,t){const s=l.differenceInCalendarMonths(l.startOfMonth(t),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),p=Math.min(l.getDate(t),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,p))}}static weekTillSameWeekday(r,e){const t=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:t,to:l.endOfDay(l.addDays(t,s))}}static decadeTillSameDayNumber(r,e){const[t]=w.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,t)+1,[o,p]=w.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(p,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const t=l.getDate(r);let s=2;t<=10?s=0:t<=20&&(s=1);const o=s+e,p=Math.floor(o/3),g=(o%3+3)%3,m=l.startOfMonth(l.addMonths(r,p)),a=l.addDays(m,g*10),D=g===2?l.endOfMonth(m):l.endOfDay(l.addDays(a,9));return[a,D]}}function gi(n){return l.format(l.subDays(l.startOfToday(),n),"yyyy-MM-dd")}function Pt(n,r){const e=[2,0,1,1,1,2],t=Math.floor(Math.abs(n));return r[t%100>4&&t%100<20?2:e[Math.min(t%10,5)]]}function fi(n){const r=l.parseISO(n),e=l.differenceInCalendarDays(l.startOfToday(),r);switch(!0){case e===0:return"Сегодня";case e===1:return"Вчера";case e<0:return n;default:return`${e} ${Pt(e,["день","дня","дней"])} назад`}}class mi{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),t=new Date,s=l.startOfYear(r===void 0?t:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(t,{weekStartsOn:1}),to:l.endOfWeek(t,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(t),to:l.endOfMonth(t)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},t=l.startOfDay(r),s=l.endOfDay(r),o=w.decadeInterval(r),p=l.startOfMonth(r),g=l.startOfQuarter(r),m=w.startOfHalfYear(r),a=l.startOfYear(r),D=w.addHalfYears(r,-1),b=w.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:t,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...w.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...w.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:p,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:w.startOfHalfYear(D),to:w.endOfHalfYear(D)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:m,to:w.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:w.startOfHalfYear(b),to:w.endOfHalfYear(b)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:p,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:m,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:t,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:t,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:t,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:t,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:t,to:w.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:t,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...w.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...w.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(p,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(m,w.startOfHalfYear(D),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...w.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...w.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(p,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(m,w.startOfHalfYear(b),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:t,to:l.endOfDay(l.addDays(r,6))}}}}const yi=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],ai=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class rr extends ${constructor(e){super(e);i(this,"city");i(this,"isActive");this.city=e!=null&&e.city?new j(e.city):void 0,this.isActive=(e==null?void 0:e.isActive)??!1}}class bt{constructor(r){i(this,"salesDirections");i(this,"partnerGroups");i(this,"managers");i(this,"additionalClients");i(this,"fixedClients");i(this,"regions");i(this,"cities");i(this,"lastLoginDate");i(this,"lastOrderDate");this.salesDirections=u.map((r==null?void 0:r.salesDirections)??[],e=>new N(e)),this.partnerGroups=u.map((r==null?void 0:r.partnerGroups)??[],e=>new F(e)),this.managers=u.map((r==null?void 0:r.managers)??[],e=>new k(e)),this.additionalClients=u.map((r==null?void 0:r.additionalClients)??[],e=>new rr(e)),this.fixedClients=u.map((r==null?void 0:r.fixedClients)??[],e=>new rr(e)),this.regions=u.map((r==null?void 0:r.regions)??[],e=>new J(e)),this.cities=u.map((r==null?void 0:r.cities)??[],e=>new j(e)),this.lastLoginDate=new P(r==null?void 0:r.lastLoginDate),this.lastOrderDate=new P(r==null?void 0:r.lastOrderDate)}hasClientConditions(){return u.some([this.salesDirections,this.partnerGroups,this.managers,this.additionalClients,this.fixedClients,this.regions,this.cities],r=>!u.isEmpty(r))||u.some([this.lastLoginDate,this.lastOrderDate],r=>!!r.from||!!r.to)}setPeriod(r,e){return this[r]=new P({from:e!=null&&e.from?l.startOfDay(e.from):null,to:e!=null&&e.to?l.endOfDay(e.to):null}),this}toSaveData(){return{salesDirections:u.map(this.salesDirections,"id"),partnerGroups:u.map(this.partnerGroups,"id"),managers:u.map(this.managers,"id"),additionalClients:u.map(this.additionalClients,"id"),regions:u.map(this.regions,"id"),cities:u.map(this.cities,"id"),lastLoginDate:new P(this.lastLoginDate),lastOrderDate:new P(this.lastOrderDate)}}}class Rt{static percentToCostCoefficient(r){return u.round((100-r)/100,S().config.numberPrecision.priceCoefficient)}}var Ie=(n=>(n.Active="active",n.Scheduled="scheduled",n.Completed="completed",n))(Ie||{});class Tt{static resolve(r,e=new Date){return r.deletedAt&&r.deletedAt.getTime()<=e.getTime()?Ie.Completed:r.publishedAt&&r.publishedAt.getTime()>e.getTime()?Ie.Scheduled:Ie.Active}}class tr extends je{constructor(e){super(e);i(this,"conditions");i(this,"products");i(this,"productCategories");i(this,"countDiscountedPrices");i(this,"expectedCountDiscountedPrices");i(this,"countDiscountedProducts");i(this,"countDiscountedClients");this.conditions=new bt(e==null?void 0:e.conditions),this.products=u.map((e==null?void 0:e.products)??[],t=>new q(t)),this.productCategories=u.map((e==null?void 0:e.productCategories)??[],t=>new U(t)),this.countDiscountedPrices=(e==null?void 0:e.countDiscountedPrices)??0,this.expectedCountDiscountedPrices=(e==null?void 0:e.expectedCountDiscountedPrices)??0,this.countDiscountedProducts=(e==null?void 0:e.countDiscountedProducts)??0,this.countDiscountedClients=(e==null?void 0:e.countDiscountedClients)??0}getState(e=new Date){return Tt.resolve(this,e)}assignCounters(e){this.countDiscountedPrices=e.countDiscountedPrices,this.expectedCountDiscountedPrices=e.expectedCountDiscountedPrices,this.countDiscountedProducts=e.countDiscountedProducts,this.countDiscountedClients=e.countDiscountedClients}isPricesUpdating(){return this.countDiscountedPrices!==this.expectedCountDiscountedPrices}toSaveData(){return{name:this.name,costCoefficient:Rt.percentToCostCoefficient(this.percent),isLowPriceAllowed:this.isLowPriceAllowed,publishedAt:this.publishedAt??null,deletedAt:this.deletedAt??null,description:this.description??"",products:u.map(this.products,"id"),productCategories:u.map(this.productCategories,"id"),conditions:this.conditions.toSaveData()}}}class Nr{constructor(r){i(this,"client");i(this,"additionalClientsCondition");i(this,"fixedClientsCondition");i(this,"partnerGroupsCondition");i(this,"managersCondition");i(this,"citiesCondition");i(this,"regionsCondition");i(this,"salesDirectionsCondition");this.client=new rr(r==null?void 0:r.client),this.additionalClientsCondition=(r==null?void 0:r.additionalClientsCondition)??!1,this.fixedClientsCondition=(r==null?void 0:r.fixedClientsCondition)??!1,this.partnerGroupsCondition=(r==null?void 0:r.partnerGroupsCondition)??!1,this.managersCondition=(r==null?void 0:r.managersCondition)??!1,this.citiesCondition=(r==null?void 0:r.citiesCondition)??!1,this.regionsCondition=(r==null?void 0:r.regionsCondition)??!1,this.salesDirectionsCondition=(r==null?void 0:r.salesDirectionsCondition)??!1}isEligible(){return this.additionalClientsCondition||this.fixedClientsCondition||this.partnerGroupsCondition||this.managersCondition||this.citiesCondition||this.regionsCondition||this.salesDirectionsCondition}}class Ci extends re{constructor(e){super();i(this,"id");i(this,"name");i(this,"states");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.states=e==null?void 0:e.states}resetFilterValue(e){switch(e){case"id":case"name":case"states":this[e]=void 0;break}return this}}class ir extends _{static prepareSaveData(r,e){return{...r,publishedAt:O.toApiFormat(r.publishedAt),deletedAt:O.toApiFormat(r.deletedAt),conditions:{...r.conditions,lastLoginDate:O.periodToApiFormat(r.conditions.lastLoginDate),lastOrderDate:O.periodToApiFormat(r.conditions.lastOrderDate),updateFixedClients:e}}}getDiscountsList(r,e,t,s=void 0){return this.getTypedPaginated(je,"/internal/price/discounts",r,e,t,{},void 0,s)}getDiscount(r){return this.get(`/internal/price/discounts/${r}`,{},e=>new tr(e.data))}createDiscount(r,e,t={}){return this.post("/internal/price/discounts",ir.prepareSaveData(r,e),s=>new tr(s.data),t)}updateDiscount(r,e,t,s={}){return this.patch(`/internal/price/discounts/${r}`,ir.prepareSaveData(e,t),o=>new tr(o.data),s)}removeDiscount(r){return this.delete(`/internal/price/discounts/${r}`)}getEligibleClients(r){return this.getTypedList(Nr,`/internal/price/discounts/${r}/clients`)}checkClient(r,e){return this.get(`/internal/price/discounts/${r}/clients/${e}/check`,{},t=>new Nr(t.data))}}class Le extends ${constructor(r){super(r)}}class qe extends Q{constructor(e){super(e,-1);i(this,"question");i(this,"answer");i(this,"groups");this.question=(e==null?void 0:e.question)??"",this.answer=(e==null?void 0:e.answer)??"",this.groups=u.map((e==null?void 0:e.groups)??[],t=>new Le(t))}toSaveData(){return{question:this.question,answer:this.answer,groups:u.map(this.groups,"id")}}}class wi extends _{getFaqList(r,e){return this.getTypedPaginated(qe,"/internal/faq",void 0,void 0,e,u.isNil(r)?{}:{group:r})}getFaq(r){return this.get(`/internal/faq/${r}`,{},e=>new qe(e.data))}createFaq(r,e={}){return this.post("/internal/faq",r,t=>new qe(t.data),e)}updateFaq(r,e,t={}){return this.patch(`/internal/faq/${r}`,e,s=>new qe(s.data),t)}removeFaq(r){return this.delete(`/internal/faq/${r}`)}getGroupsList(){return this.getTypedList(Le,"/internal/faq/groups")}createGroup(r,e={}){return this.post("/internal/faq/groups",r,t=>new Le(t.data),e)}updateGroup(r,e,t={}){return this.patch(`/internal/faq/groups/${r}`,e,s=>new Le(s.data),t)}removeGroup(r){return this.delete(`/internal/faq/groups/${r}`)}}function Di(n){const r=u.round(n*100);return`${r>=0?"+":""}${r}%`}class Mr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)==null?void 0:t.minCount)!=null&&!Mr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return((e=r.properties)==null?void 0:e.lengthStep)!=null?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)==null?void 0:s.minCount)!=null?r.properties.minCount:.01}}const we=class we extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=S().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=we.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){we.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={},p=void 0){const g=t+(u.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),m=s?we.getCachedResponse(g):void 0;return m?Promise.resolve(m):this.getTypedList(e,t,o,!1,p).then(a=>(s&&a&&this.cacheResponse(g,a),a))}};i(we,"responseDataCache",new Map);let ae=we;class vi{static generateUndefinedManagerInstance(){return new G({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Ur extends ae{async getManagers(){const r="/internal/managers",e=ae.getCachedResponse(r);if(e)return e;const t=await this.get(r),s=L.instanceListInitializer(G,t.data);return this.cacheResponse(r,s),s}getManager(r){return this.get(`/internal/managers/${r}`,{},e=>new G(e.data))}}var Ce=(n=>(n.Processing="processing",n.Completed="completed",n.Error="error",n.NeedsActualization="needs_actualization",n))(Ce||{});class St{constructor(r){i(this,"status");i(this,"actualizedAt");i(this,"expiresAt");i(this,"error");this.status=(r==null?void 0:r.status)??Ce.Processing,this.actualizedAt=O.parse(r==null?void 0:r.actualizedAt),this.expiresAt=O.parse(r==null?void 0:r.expiresAt),this.error=r==null?void 0:r.error}get isProcessing(){return this.status===Ce.Processing}get isOutdated(){return this.isOutdatedAt(new Date)}get isOrderAllowed(){return this.isOrderAllowedAt(new Date)}isOutdatedAt(r){return this.status!==Ce.Completed||u.isNil(this.actualizedAt)?!0:!u.isNil(this.expiresAt)&&this.expiresAt.getTime()<r.getTime()}isOrderAllowedAt(r){return this.status===Ce.Completed&&!this.isOutdatedAt(r)}}class Hr extends Se{constructor(e){super(e);i(this,"name");i(this,"client");i(this,"sum");i(this,"isProfstroy");i(this,"actualization");i(this,"file");this.name=e==null?void 0:e.name,this.client=new K(e==null?void 0:e.client),this.sum=e==null?void 0:e.sum,this.isProfstroy=e==null?void 0:e.isProfstroy,this.actualization=(e==null?void 0:e.actualization)&&new St(e.actualization),this.file=e==null?void 0:e.file}}class At extends mr{constructor(e){super(e);i(this,"groupName");i(this,"supplierSku");i(this,"isIgnored");i(this,"lineError");this.groupName=e.groupName,this.supplierSku=e.supplierSku??e.product.supplierSku,this.isIgnored=e.isIgnored,this.lineError=e.lineError}get isProductStub(){return u.isNil(this.product.id)}get isOrderable(){return!this.isProductStub&&!this.isIgnored&&u.isEmpty(this.lineError)}}class B extends Hr{constructor(e){super(e);i(this,"sum");i(this,"products");this.sum=e.sum??0,this.products=(e.products??[]).map(t=>e.isProfstroy?new At(t):new mr(t))}}class Pi extends re{constructor(e){super();i(this,"id");i(this,"clientSearchTerm");i(this,"name");i(this,"createdAt",new P);this.id=e==null?void 0:e.id,this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.name=e==null?void 0:e.name,this.createdAt=new P(e==null?void 0:e.createdAt)}resetFilterValue(e){return e==="createdAt"?(this.createdAt.from=null,this.createdAt.to=null):this[e]=void 0,this}asClearRaw(){var t,s;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,e}}class _e extends v{}class Br extends _r{constructor(e){var t,s,o,p,g,m,a,D;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"statusDetail");i(this,"salesDirection");i(this,"attachedAt");i(this,"isOnOrder");i(this,"isProfstroy");i(this,"isNotInStock");i(this,"sum");i(this,"isLargeOrder");this.client=new K(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((p=e==null?void 0:e.delivery)==null?void 0:p.type)??-1,date:u.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((m=e==null?void 0:e.delivery)==null?void 0:m.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new ye(e.delivery.address):void 0,warehouse:(D=e==null?void 0:e.delivery)!=null&&D.warehouse?new pe(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new k(e==null?void 0:e.attachedUser):void 0,this.status=new _e(e==null?void 0:e.status),this.statusDetail=e!=null&&e.statusDetail?new v(e.statusDetail):void 0,this.salesDirection=new N(e==null?void 0:e.salesDirection),this.attachedAt=u.isString(e==null?void 0:e.attachedAt)?l.parseISO(e.attachedAt):e==null?void 0:e.attachedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isProfstroy=(e==null?void 0:e.isProfstroy)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class Ot extends fr{constructor(e,t){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");i(this,"changedFields",[]);i(this,"replacement");this.product=new ie(e.product),this.currency=new M(e.currency),this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=u.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,t&&(this.replacement=t,this.quantity!==t.quantity&&this.changedFields.push("quantity"),this.length!==t.length&&this.changedFields.push("length"))}}class d extends Br{constructor(e){var t;super(e);i(this,"products");i(this,"invoices");i(this,"comment");i(this,"image");i(this,"contragent");i(this,"barcode");i(this,"orderSource");i(this,"isAllowProcessingWithoutPayment");i(this,"nextStatuses");i(this,"actions");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"erpOrderUrl");i(this,"numberDoc");this.products=(e.products??[]).map(s=>{var p;const o=s.replacementId?(p=e.products)==null?void 0:p.find(g=>g.id===s.replacementId):void 0;return new Ot(s,o)}),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ke.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new v(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment,this.nextStatuses=(t=e.nextStatuses)==null?void 0:t.map(s=>new _e(s)),this.actions=e.actions,this.operatorsComment=e.operatorsComment,this.operatorsForWarehouseComment=e.operatorsForWarehouseComment,this.erpOrderUrl=e.erpOrderUrl,this.numberDoc=e.numberDoc}}class bi extends _{getOffers(r,e,t,s=void 0){return this.getTypedPaginated(Hr,"/internal/orders/offers",r,e,t,{},void 0,s)}createOfferFromCart(r,e,t){return this.post(`/internal/orders/offers/${r}`,{name:e,items:t!=null&&t.length?t:void 0},s=>new B(s.data))}createProfstroyOffer(r,e,t,s={}){return this.post(`/internal/orders/offers/${r}/profstroy`,{file:e,name:t},o=>new B(o.data),s)}actualizeProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/actualize`,{},e=>new B(e.data))}reloadProfstroyOffer(r){return this.post(`/internal/orders/offers/${r}/profstroy/reload`,{},e=>new B(e.data))}getOffer(r){return this.get(`/internal/orders/offers/${r}`,{},e=>new B(e.data))}updateOffer(r,e){return this.patch(`/internal/orders/offers/${r}`,{name:e},t=>new B(t.data))}deleteOffer(r){return this.delete(`/internal/orders/offers/${r}`)}createOrderFromDraft(r,e,t,s={}){const o=S().config.dateFormats.api;return this.post(`/internal/orders/offers/${r}/create-order`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,o):void 0,items:t!=null&&t.length?t:void 0},p=>L.instanceListInitializer(d,p.data),s)}addOfferProduct(r,e,t={}){return this.post(`/internal/orders/offers/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new B(s.data),t)}patchOfferProduct(r,e,t,s={}){return this.patch(`/internal/orders/offers/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new B(o.data),s)}deleteOfferProduct(r,e){return this.delete(`/internal/orders/offers/${r}/products/${e}`,t=>new B(t.data))}getOfferHtml(r,e){return this.get(`/internal/orders/offers/${r}/view`,e?{recipientText:e}:{},t=>new Blob([t.data],{type:"text/html"}))}getOfferPdf(r,e){return this.getBlob(`/internal/orders/offers/${r}/download`,e?{recipientText:e}:{},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOffer(r,e){return this.post(`/internal/orders/offers/${r}/send`,e)}}class Ri{static isProfstroy(r){return!!(r!=null&&r.isProfstroy)}static isProfstroyOffer(r){return!u.isNil(r)&&r.isProfstroy===!0&&!u.isNil(r.actualization)}}var dt=(n=>(n.View="view",n.Share="share",n.EditTags="edit_tags",n.SaveOrderIgnoredProducts="save_order_ignored_products",n.ChangeStatus="change_status",n.ChangeProducts="change_products",n.ChangeOrderParameters="change_order_parameters",n.Recalculate="recalculate",n.AttachOrder="attach_order",n.DetachOrder="detach_order",n.ChangeAttachedOperator="change_attached_operator",n.SendOnlinePaymentLink="send_online_payment_link",n.ConfirmOnlineFullPayment="confirm_online_full_payment",n.MergeOrders="merge_orders",n.GetHistory="get_history",n.CloneOrder="clone_order",n.DeleteAttachedFile="delete_attached_file",n))(dt||{});class Ti{constructor(r){i(this,"paymentType");i(this,"deliveryType");i(this,"contragentId");i(this,"deliveryDate");i(this,"addressId");i(this,"warehouseId");i(this,"image");i(this,"comment");i(this,"barcode");i(this,"operatorsComment");i(this,"operatorsForWarehouseComment");i(this,"additionalEmails");i(this,"isAllowProcessingWithoutPayment");i(this,"isAdditionalSale");var e,t,s;this.paymentType=r==null?void 0:r.payment.type,this.deliveryType=r==null?void 0:r.delivery.type,this.contragentId=(e=r==null?void 0:r.contragent)==null?void 0:e.id,this.deliveryDate=r!=null&&r.delivery.date?new Date(r.delivery.date):void 0,this.addressId=(t=r==null?void 0:r.delivery.address)==null?void 0:t.id,this.warehouseId=(s=r==null?void 0:r.delivery.warehouse)==null?void 0:s.id,this.comment=r==null?void 0:r.comment,this.barcode=r==null?void 0:r.barcode,this.operatorsComment=r==null?void 0:r.operatorsComment,this.operatorsForWarehouseComment=r==null?void 0:r.operatorsForWarehouseComment,this.isAllowProcessingWithoutPayment=r==null?void 0:r.isAllowProcessingWithoutPayment}}class Wr extends v{}class Gr extends v{}class Si extends re{constructor(e){var t,s,o,p;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new P);i(this,"creator");i(this,"deliveryDate",new P);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"attachedAt",new P);i(this,"salesDirections");i(this,"status");i(this,"statusDetail");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(g=>"isActive"in g?new G(g):new Wr(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new K(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new P(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new k(e.creator):void 0,this.deliveryDate=new P(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new j(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.attachedAt=new P(e==null?void 0:e.attachedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new N(g)),this.status=e==null?void 0:e.status,this.statusDetail=e==null?void 0:e.statusDetail,this.deliveryType=e!=null&&e.deliveryType?new W(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new Gr(e.paymentType):void 0,this.warehouses=(p=e==null?void 0:e.warehouses)==null?void 0:p.map(g=>new pe(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new W;break;case"clientCities":this.clientCities=[];break;case"attachedAt":this.attachedAt.from=null,this.attachedAt.to=null;break;case"salesDirection":case"salesDirections":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":case"warehouses":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,p,g,m;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((p=e==null?void 0:e.deliveryDate)!=null&&p.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.attachedAt)!=null&&g.from)&&!((m=e==null?void 0:e.attachedAt)!=null&&m.to)&&delete e.attachedAt,e}}class $t{constructor(r){i(this,"user");i(this,"status");i(this,"statusDetail");i(this,"createdAt");this.user=new k(r==null?void 0:r.user),this.status=new _e(r==null?void 0:r.status),this.statusDetail=r!=null&&r.statusDetail?new v(r.statusDetail):void 0,this.createdAt=u.isString(r==null?void 0:r.createdAt)?l.parseISO(r.createdAt):(r==null?void 0:r.createdAt)??new Date}}class Ai extends _{getOrders(r,e,t,s=void 0){return this.getTypedPaginated(Br,"/internal/orders",r,e,t,{},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof V?r:new V(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new d(e.data))}createClientOrder(r,e,t,s={}){const o=S().config.dateFormats.api;return this.post(`/internal/clients/${r}/orders`,{...e,deliveryDate:l.format(e.deliveryDate,o),items:t!=null&&t.length?t:void 0},p=>L.instanceListInitializer(d,p.data),s)}attachOrder(r){return this.patch(`/internal/orders/${r}/attach`,{},e=>new d(e.data))}detachOrder(r){return this.patch(`/internal/orders/${r}/detach`,{},e=>new d(e.data))}mergeOrders(r,e){return this.patch(`/internal/orders/${r}/merge`,{ids:e},t=>new d(t.data))}recalculateOrder(r){return this.patch(`/internal/orders/${r}/recalculate`,{},e=>new d(e.data))}cloneOrder(r){return this.get(`/internal/orders/${r}/clone`,{})}updateOrder(r,e,t={}){const s=S().config.dateFormats.api;return this.patch(`/internal/orders/${r}`,{...e,deliveryDate:e.deliveryDate?l.format(e.deliveryDate,s):void 0},o=>new d(o.data),t)}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new d(s.data),t)}changeOrderStatus(r,e,t,s={}){return this.patch(`/internal/orders/${r}/status`,{status:e,statusDetail:t},o=>new d(o.data),s)}changeOrderStatusDetail(r,e){return this.patch(`/internal/orders/${r}/status`,{statusDetail:e},t=>new d(t.data))}getOrderStatusHistory(r){return this.getTypedList($t,`/internal/orders/${r}/history`)}getOrderPrintHtml(r,e){return this.get(`/internal/orders/${r}/print/view`,{...e},t=>new Blob([t.data],{type:"text/html"}))}getOrderPrintPdf(r,e){return this.getBlob(`/internal/orders/${r}/print/download`,{...e},t=>new Blob([t.request.response],{type:"application/pdf"}))}sendOrderPrint(r,e){return this.post(`/internal/orders/${r}/print/send`,e)}changeAttachedOperator(r,e){return this.patch(`/internal/orders/${r}/change-attached-operator`,{operatorId:e},t=>new d(t.data))}deleteOrderAttachedFile(r){return this.delete(`/internal/orders/${r}/file/attached`,e=>new d(e.data))}deleteOrderProduct(r,e){return this.delete(`/internal/orders/${r}/products/${e}`,t=>new d(t.data))}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,is_additional_sale:t.isAdditionalSale,...t.configuratorParams},o=>new d(o.data),s)}getDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getSelfDeliveryNearestDates(r,e=void 0){return this.get(`/internal/orders/self-delivery/${r}/nearest-dates`,{},t=>t.data,void 0,e)}getDeliveryCost(r,e,t,s=void 0){const o=S().config.dateFormats.api;return this.get(`/internal/orders/delivery/${r}/cost`,{date:l.format(e,o),warehouse_id:t},p=>p.data,void 0,s)}}const Oi=Symbol("currentOrder");class sr{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new K(r==null?void 0:r.client),this.product=new q(r==null?void 0:r.product),this.cost=(r==null?void 0:r.cost)??0,this.costCoefficient=(r==null?void 0:r.costCoefficient)??0,this.source=(r==null?void 0:r.source)??Qe.Product}}const jr=n=>{var r,e,t,s,o;return n?u.omitBy({cities:(r=n.cities)==null?void 0:r.map(p=>p.id),clients:(e=n.clients)==null?void 0:e.map(p=>p.id),managers:(t=n.managers)==null?void 0:t.map(p=>p.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(p=>p.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(p=>p.id),hideNotActive:n.hideNotActive},p=>u.isNil(p)||(u.isArray(p)||u.isObject(p))&&u.isEmpty(p)):{}},kt=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class di extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...kt(e),filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...kt(e),filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:jr(t)},s=>L.instanceListInitializer(sr,s.data))}}class It{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=u.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new he(r.product):void 0,this.client=r.client?new k(r.client):void 0,this.executor=r.executor?new k(r.executor):void 0,this.currency=r.currency?new M(r.currency):void 0}}class Lt extends he{constructor(e){super(e);i(this,"history");this.history=u.map(e.history,t=>new It(t))}}class $i extends y{getProductPriceHistory(r){var o,p,g,m,a;const e=S().config.dateFormats.api,t=u.omitBy(u.merge(r,{costDate:{from:u.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(p=r.costDate)==null?void 0:p.from,to:u.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(m=r.costDate)==null?void 0:m.to}}),D=>u.isNil(D)||(u.isArray(D)||u.isObject(D))&&u.isEmpty(D)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(D=>[new Lt(u.merge(D[0],{history:D}))])}}class zr{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new he(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new he(e)))}}class ki extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new zr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new zr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}var qt=(n=>(n.New="new",n.Processing="processing",n.AwaitingSupplyProducts="awaiting_supply_products",n.InvoiceIssued="invoice_issued",n.ProcessingOnStock="processing_on_stock",n.Finished="finished",n.OrderUpdated="order_updated",n.Canceled="canceled",n.Error="error",n))(qt||{}),_t=(n=>(n.CanceledBy1c="canceled_by1c",n.CanceledByClient="canceled_by_client",n.FinishedNotApproved="finished_not_approved",n.ProcessingByPurchasingDepartment="processing_by_purchasing_department",n.WillWaiting="will_waiting",n))(_t||{});class Nt extends v{}class Mt extends v{}class Yr extends v{constructor(e){var t;super(e);i(this,"userRegions");this.userRegions=((t=e==null?void 0:e.userRegions)==null?void 0:t.map(s=>new de(s)))??[]}}class Ut extends v{}class Ht extends v{}class Bt extends v{}class Wt extends v{}class Ii{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class Qr extends v{}const Y=class Y extends ae{static withoutUnknownLocation(r){return r.filter(e=>e.id!==Y.unknownLocationId)}getReference(r,e=!1){return this.getTypedDataArrayRequester(Nt,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ir,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Ut,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(xe,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(M,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(F,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(Z,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(Wr,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Ht,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(_e,"/internal/references/order-status",!0)}getOrderStatusDetails(){return this.getTypedDataArrayRequester(Bt,"/internal/references/order-status-detail",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Gr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Qr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(N,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Lr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(j,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(J,`/internal/references/region-with-country/search?term=${r}`)}getRegionsByCountry(r){return this.getTypedDataArrayRequester(J,"/internal/references/region",!1,{params:{countryId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesByRegion(r){return this.getTypedDataArrayRequester(Mt,"/internal/references/city",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}getCitiesWithUserRegionByRegion(r){return this.getTypedDataArrayRequester(Yr,"/internal/references/city-with-user-region",!1,{params:{regionId:r}}).then(e=>Y.withoutUnknownLocation(e))}searchCityWithRegion(r,e,t=void 0){return this.getTypedDataArrayRequester(j,"/internal/references/city-with-region/search",!1,{term:r,...e?{params:{countryId:e}}:{}},t).then(s=>Y.withoutUnknownLocation(s))}searchCityWithUserRegion(r,e=void 0){return this.getTypedDataArrayRequester(Yr,"/internal/references/city-with-user-region/search",!1,{term:r},e).then(t=>Y.withoutUnknownLocation(t))}searchCountry(r){return this.getTypedDataArrayRequester(ne,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(W,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(pe,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Pr,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(x,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Wt,"/public/references/product-file-type",!0)}};i(Y,"unknownLocationId",1);let T=Y;const A=E.defineStore("common.references_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0),t=f.ref(void 0),s=f.ref(void 0),o=f.ref(void 0),p=f.ref(void 0),g=f.ref(void 0),m=f.ref(void 0),a=f.ref(void 0),D=f.ref(void 0),b=f.ref(void 0),Ne=f.ref(void 0),Me=f.ref(void 0),De=f.ref(void 0),ve=f.ref(void 0),Kr=f.ref(void 0),Xr=f.ref(void 0),Zr=f.ref(void 0),h=f.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:p,operatorReference:g,orderPaymentStatusReference:m,orderStatusReference:a,orderStatusDetailReference:D,paymentTypeReference:b,partnerGroupReference:Ne,productFileTypeReference:Me,resourceTypesReference:De,salesDirectionsReference:ve,sourcePrimaryInterestReference:Kr,warehousesReference:Xr,propertyTypesReference:Zr,priceCoefficientsReference:h}}),Li=E.defineStore("common.references",()=>{const n=f.computed(()=>{const h=A();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(T).getChannelPrimaryInterest().then(C=>{h.channelPrimaryInterestReference=C}).catch(u.noop)),h.channelPrimaryInterestReference}),r=f.computed(()=>{const h=A();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(T).getContactPositions().then(C=>{h.contactPositionsReference=C}).catch(u.noop)),h.contactPositionsReference}),e=f.computed(()=>{const h=A();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(T).getCurrency().then(C=>{h.currencyReference=C}).catch(u.noop)),h.currencyReference}),t=f.computed(()=>{const h=A();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(T).getOpf().then(C=>{h.opfReference=C}).catch(u.noop)),h.opfReference}),s=f.computed(()=>{const h=A();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(T).getOperators().then(C=>{h.operatorReference=C}).catch(u.noop)),h.operatorReference}),o=f.computed(()=>{const h=A();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(T).getOrderPaymentStatuses().then(C=>{h.orderPaymentStatusReference=C}).catch(u.noop)),h.orderPaymentStatusReference}),p=f.computed(()=>{const h=A();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(T).getOrderStatuses().then(C=>{h.orderStatusReference=C}).catch(u.noop)),h.orderStatusReference}),g=f.computed(()=>{const h=A();return!h.orderStatusDetailReference&&!h.dataLoaderList.orderStatusDetailReference&&(h.dataLoaderList.orderStatusDetailReference=!0,y.getInstance(T).getOrderStatusDetails().then(C=>{h.orderStatusDetailReference=C}).catch(u.noop)),h.orderStatusDetailReference}),m=f.computed(()=>{const h=A();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(T).getPaymentTypes().then(C=>{h.paymentTypeReference=C}).catch(u.noop)),h.paymentTypeReference}),a=f.computed(()=>{const h=A();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(T).getPartnerGroup().then(C=>{h.partnerGroupReference=C}).catch(u.noop)),h.partnerGroupReference}),D=f.computed(()=>{const h=A();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(T).getProductFileType().then(C=>{h.productFileTypeReference=C}).catch(u.noop)),h.productFileTypeReference}),b=f.computed(()=>{const h=A();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(T).getResourceTypes().then(C=>{h.resourceTypesReference=C}).catch(u.noop)),h.resourceTypesReference}),Ne=f.computed(()=>{const h=A();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(T).getSalesDirections().then(C=>{h.salesDirectionsReference=C}).catch(u.noop)),h.salesDirectionsReference}),Me=f.computed(()=>{const h=A();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(T).getSourcePrimaryInterest().then(C=>{h.sourcePrimaryInterestReference=C}).catch(u.noop)),h.sourcePrimaryInterestReference}),De=f.computed(()=>{const h=A();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(T).getDeliveryTypes().then(C=>{h.deliveryTypeReference=C}).catch(u.noop)),h.deliveryTypeReference}),ve=f.computed(()=>{const h=A();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(Ur).getManagers().then(C=>{h.managersList=C}).catch(u.noop)),h.managersList}),Kr=f.computed(()=>{const h=A();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(T).getWarehouses().then(C=>{h.warehousesReference=C}).catch(u.noop)),h.warehousesReference}),Xr=f.computed(()=>{const h=A();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(T).getPropertyTypes().then(C=>{h.propertyTypesReference=C}).catch(u.noop)),h.propertyTypesReference}),Zr=f.computed(()=>{const h=A();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(T).getPriceCoefficients().then(C=>{h.priceCoefficientsReference=C}).catch(u.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:p,orderStatusDetailReference:g,paymentTypeReference:m,partnerGroupsReference:a,productFilesTypesReference:D,resourceTypesReference:b,salesDirectionsReference:Ne,sourcePrimaryInterestsReference:Me,deliveryTypeReference:De,managersList:ve,warehousesReference:Kr,propertyTypesReference:Xr,priceCoefficientsReference:Zr}});class Gt{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class Vr{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new Qr(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(t=>new Gt(t)))??[],this.tags=r==null?void 0:r.tags}}class qi extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new Vr(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new Vr(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class _i extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(t=>{const s=[...t];let o=1;return s.forEach(p=>{p.id=o++}),s})}}var xr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.ExternalSeo="external_seo",n.Guest="guest",n))(xr||{});class jt extends vr{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new Cr(e.pricingRole):void 0}}class Ni extends y{constructor(){super(),this.baseUrl=`${S().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class zt extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new jt(r.data),!0)}}const Jr=E.defineStore("common.user_state_private",()=>{const n=f.ref({}),r=f.ref(void 0),e=f.ref(void 0);return{dataLoaderList:n,currentUser:r,currentManager:e}});function Yt(n){const r=Jr();(n==null?void 0:n.type)!==xr.Manager||r.currentManager||r.dataLoaderList.currentManager||(r.dataLoaderList.currentManager=!0,y.getInstance(Ur).getManager(n.id).then(e=>{r.currentManager=e}).catch(u.noop).finally(()=>{r.dataLoaderList.currentManager=!1}))}const Mi=E.defineStore("common.user_state",()=>{const n=f.computed(()=>{const e=Jr();return!e.currentUser&&!e.dataLoaderList.currentUser&&(e.dataLoaderList.currentUser=!0,y.getInstance(zt).getCurrentUser().then(t=>{e.currentUser=t,Yt(t)}).catch(u.noop).finally(()=>{e.dataLoaderList.currentUser=!1})),e.currentUser}),r=f.computed(()=>(Yt(n.value),Jr().currentManager));return{currentUser:n,currentManager:r}});class nr{constructor(r){i(this,"user");i(this,"salesDirection");this.user=new k(r==null?void 0:r.user),this.salesDirection=new N(r==null?void 0:r.salesDirection)}}class or extends de{constructor(e){var t,s;super(e);i(this,"cities");i(this,"users");this.cities=((t=e==null?void 0:e.cities)==null?void 0:t.map(o=>new j(o)))??[],this.users=((s=e==null?void 0:e.users)==null?void 0:s.map(o=>new nr(o)))??[]}}class Ui extends re{constructor(e){super();i(this,"id");i(this,"name");i(this,"abbr");this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.abbr=e==null?void 0:e.abbr}resetFilterValue(e){switch(e){case"id":case"name":case"abbr":this[e]=void 0;break}return this}}class Hi extends _{getRegionsList(r,e,t){return this.getTypedPaginated(de,"/internal/users/regions",r,e,t)}getRegion(r){return this.get(`/internal/users/regions/${r}`,{},e=>new or(e.data))}createRegion(r,e={}){return this.post("/internal/users/regions",r,t=>new or(t.data),e)}updateRegion(r,e,t={}){return this.patch(`/internal/users/regions/${r}`,e,s=>new or(s.data),t)}removeRegion(r){return this.delete(`/internal/users/regions/${r}`)}getRegionEmployees(r){return this.getTypedList(nr,`/internal/users/regions/${r}/users`)}attachRegionEmployee(r,e,t){return this.post(`/internal/users/regions/${r}/users/${e}`,{salesDirectionId:t},s=>new nr(s.data))}detachRegionEmployee(r,e,t){return this.request({method:"DELETE",url:`/internal/users/regions/${r}/users/${e}`,params:{sales_direction_id:t}})}}class Bi{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Nt,c.AppBaseConfig=it,c.BankAccount=Fe,c.BasePaginationProvider=_,c.BlogPost=Be,c.BlogPostMediaFile=He,c.BlogPostMediaTypeEnum=Re,c.BlogPostPublicationStatusEnum=Te,c.BlogPostShortInfo=ue,c.BlogPostsListFilters=Qt,c.BlogProvider=Ge,c.CalculationTypeEnum=lt,c.CalendarHelper=w,c.Cart=ge,c.CartProvider=Vt,c.CatalogProvider=Kt,c.CatalogableItem=gr,c.Category=U,c.CategoryFilter=ft,c.CategoryFilterSetting=Sr,c.CategoryFilterValue=gt,c.CategoryPricingRule=Tr,c.ChannelPrimaryInterest=Ir,c.City=Mt,c.CityWithRegionAndCountry=j,c.CityWithUserRegion=Yr,c.Client=qr,c.ClientAdditionalData=Ct,c.ClientCategory=$e,c.ClientDataProvider=H,c.ClientPriceCatalogableItem=br,c.ClientPriceCategory=Rr,c.ClientPriceProduct=Ze,c.ClientPriceProvider=Xt,c.ClientPriceTemplateProvider=Zt,c.ClientProduct=ie,c.ClientProductCategoryDataProvider=ei,c.ClientProductDataProvider=ri,c.ClientShortInfo=K,c.ClientsAdditionalDataRequestTypeEnum=mt,c.ClientsListFilters=oi,c.CodedIdentity=he,c.ConfiguratorProvider=ui,c.ConfiguratorsEnum=Dt,c.Contact=Ee,c.ContactLinks=ar,c.ContactPerson=X,c.ContactPersonRelated=wt,c.ContactPosition=Ut,c.ContactRelation=er,c.ContragentBase=dr,c.ContragentFactory=ke,c.ContragentIc=$r,c.ContragentPerson=yt,c.ContragentUlNr=at,c.ContragentUlR=kr,c.CostSourceEnum=Qe,c.Country=ne,c.CreatableIdentity=Se,c.CuratedDirection=xe,c.Curator=Ke,c.Currency=M,c.DataSuggestionProvider=_i,c.DateHelper=O,c.DateTimeProvider=mi,c.DeletableIdentity=pt,c.DeletableNamedIdentity=Oe,c.DeliveryAddress=ye,c.DeliveryType=W,c.DetailedJwtPayload=cr,c.DeviceTypeResolutionConfig=Er,c.Discount=tr,c.DiscountClient=rr,c.DiscountClientEligibility=Nr,c.DiscountConditions=bt,c.DiscountHelper=Rt,c.DiscountProvider=ir,c.DiscountShortInfo=je,c.DiscountStateEnum=Ie,c.DiscountStateHelper=Tt,c.DiscountsListFilters=Ci,c.Faq=qe,c.FaqGroup=Le,c.FaqProvider=wi,c.FieldValidationResultData=Bi,c.FilterGroup=V,c.FilterItem=lr,c.FilterOpEnum=We,c.FilterSettings=ht,c.GeoCoordinates=pr,c.HiddenCatalogableItem=ot,c.HttpCachedRequester=ae,c.HttpParamsConfig=et,c.HttpRequester=y,c.Identity=Q,c.Image=ct,c.JwtPayload=ee,c.Manager=G,c.ManagerCommon=Ve,c.ManagerDataFactory=vi,c.ManagerDataProvider=Ur,c.MetaTagItem=Gt,c.NamedIdentity=$,c.Offer=B,c.OfferActualization=St,c.OfferActualizationStatus=Ce,c.OfferHelper=Ri,c.OfferShortInfo=Hr,c.OffersDataProvider=bi,c.OffersListFilters=Pi,c.Operator=Wr,c.Opf=Z,c.OpfEnum=z,c.Order=d,c.OrderAction=dt,c.OrderEditorData=Ti,c.OrderInfo=Br,c.OrderItem=Ot,c.OrderItemBase=fr,c.OrderPaymentStatus=Ht,c.OrderShortInfo=_r,c.OrderStatus=_e,c.OrderStatusDetail=Bt,c.OrderStatusDetailEnum=_t,c.OrderStatusEnum=qt,c.OrderStatusHistoryInfo=$t,c.OrdersDataProvider=Ai,c.OrdersListFilters=Si,c.PaginationFiltersBase=re,c.PartnerGroup=F,c.PaymentType=Gr,c.PreferencesStorageProvider=be,c.PriceAnalyze=sr,c.PriceAnalyzeProvider=di,c.PriceCatalogableItem=wr,c.PriceCoefficient=x,c.PriceCoefficientEnum=ur,c.PriceHistoryDataProvider=$i,c.PriceHistoryItem=It,c.PriceTemplate=te,c.PriceTemplateCategory=Je,c.PriceTemplateClient=fe,c.PriceTemplateICatalogableItem=Dr,c.PriceTemplateProduct=Xe,c.PriceTemplateProvider=ti,c.PricingRole=me,c.PricingRoleProvider=ii,c.PrimaryCatalogableItem=Ye,c.Product=q,c.ProductCategoryDataProvider=Ft,c.ProductDataProvider=Et,c.ProductFileType=Wt,c.ProductFilterTypeEnum=yr,c.ProductPriceCoefficient=ze,c.ProductPriceHistory=Lt,c.ProductUnit=hr,c.ProfstroyOfferItem=At,c.PropertiesProvider=si,c.Property=oe,c.PropertyType=Pr,c.PropertyTypeEnum=ut,c.PropertyValue=ce,c.RecommendationsDataProvider=ki,c.RecommendationsList=zr,c.Reference=v,c.ReferenceDataFactory=Ii,c.ReferenceDataProvider=T,c.Region=J,c.ResourceType=Qr,c.STANDARD_PERIOD_GROUPS=yi,c.STANDARD_PERIOD_SECTIONS=ai,c.SalesDirection=N,c.SentryConfig=rt,c.Seo=Vr,c.SeoDataProvider=qi,c.SourcePrimaryInterest=Lr,c.StockCount=nt,c.TableDataPagination=pi,c.TableDataPaginationRequestParams=vt,c.TableDataSortRequestParams=hi,c.TemplateProductCategoryDataProvider=ni,c.TemplatesListFilters=Jt,c.TypedInstanceFactory=L,c.UnitsHelper=Mr,c.UnknownClientDataProvider=ci,c.UpdatableNamedIdentity=Ae,c.User=jt,c.UserAuthDataProvider=Ni,c.UserCommonInfo=vr,c.UserDataProvider=zt,c.UserPricingRole=Cr,c.UserRegion=or,c.UserRegionEmployee=nr,c.UserRegionProvider=Hi,c.UserRegionShortInfo=de,c.UserRegionsListFilters=Ui,c.UserShortInfo=k,c.UserTypeEnum=xr,c.VersionConfig=li,c.Warehouse=pe,c.WebSocketConfig=tt,c.currentOrderInjectionKey=Oi,c.daysAgoIso=gi,c.findCatalogItemByIdRecursive=Ar,c.flattenCatalogItems=Or,c.formatPercentChange=Di,c.formatRelativeDate=fi,c.pluralize=Pt,c.useAuthStateStore=Ue,c.useBaseConfigStateStore=S,c.useReferencesStore=Li,c.useUserStateStore=Mi,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|