@snabcentr/common-lib 1.63.1 → 1.65.0

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.
Files changed (48) hide show
  1. package/dist/manifest.json +1 -1
  2. package/dist/release_notes.tmp +2 -2
  3. package/dist/sc-common-lib.js +1309 -1127
  4. package/dist/sc-common-lib.js.map +1 -1
  5. package/dist/sc-common-lib.umd.cjs +1 -1
  6. package/dist/sc-common-lib.umd.cjs.map +1 -1
  7. package/dist/src/auth/classes/detailed-jwt-payload.d.ts +46 -0
  8. package/dist/src/auth/classes/detailed-jwt-payload.d.ts.map +1 -0
  9. package/dist/src/auth/classes/index.d.ts +3 -0
  10. package/dist/src/auth/classes/index.d.ts.map +1 -0
  11. package/dist/src/auth/classes/jwt-payload.d.ts +109 -0
  12. package/dist/src/auth/classes/jwt-payload.d.ts.map +1 -0
  13. package/dist/src/auth/index.d.ts +3 -0
  14. package/dist/src/auth/index.d.ts.map +1 -0
  15. package/dist/src/auth/interfaces/i-base-resource-access.d.ts +24 -0
  16. package/dist/src/auth/interfaces/i-base-resource-access.d.ts.map +1 -0
  17. package/dist/src/auth/interfaces/i-detailed-jwt-payload.d.ts +33 -0
  18. package/dist/src/auth/interfaces/i-detailed-jwt-payload.d.ts.map +1 -0
  19. package/dist/src/auth/interfaces/i-jwt-payload.d.ts +118 -0
  20. package/dist/src/auth/interfaces/i-jwt-payload.d.ts.map +1 -0
  21. package/dist/src/auth/interfaces/i-realm-access.d.ts +12 -0
  22. package/dist/src/auth/interfaces/i-realm-access.d.ts.map +1 -0
  23. package/dist/src/auth/interfaces/i-resource-roles.d.ts +11 -0
  24. package/dist/src/auth/interfaces/i-resource-roles.d.ts.map +1 -0
  25. package/dist/src/auth/interfaces/i-user-address.d.ts +30 -0
  26. package/dist/src/auth/interfaces/i-user-address.d.ts.map +1 -0
  27. package/dist/src/auth/interfaces/index.d.ts +7 -0
  28. package/dist/src/auth/interfaces/index.d.ts.map +1 -0
  29. package/dist/src/config/classes/http-params-config.d.ts +4 -4
  30. package/dist/src/config/classes/http-params-config.d.ts.map +1 -1
  31. package/dist/src/config/interfaces/i-http-params-config.d.ts +2 -2
  32. package/dist/src/config/interfaces/i-http-params-config.d.ts.map +1 -1
  33. package/dist/src/http/classes/{http-base-cached-requester.d.ts → http-cached-requester.d.ts} +6 -8
  34. package/dist/src/http/classes/http-cached-requester.d.ts.map +1 -0
  35. package/dist/src/http/classes/http-requester.d.ts +144 -2
  36. package/dist/src/http/classes/http-requester.d.ts.map +1 -1
  37. package/dist/src/http/classes/index.d.ts +1 -2
  38. package/dist/src/http/classes/index.d.ts.map +1 -1
  39. package/dist/src/index.d.ts +1 -0
  40. package/dist/src/index.d.ts.map +1 -1
  41. package/dist/src/managers/providers/manager-data-provider.d.ts +2 -2
  42. package/dist/src/managers/providers/manager-data-provider.d.ts.map +1 -1
  43. package/dist/src/references/providers/reference-data-provider.d.ts +2 -2
  44. package/dist/src/references/providers/reference-data-provider.d.ts.map +1 -1
  45. package/package.json +20 -19
  46. package/dist/src/http/classes/http-base-cached-requester.d.ts.map +0 -1
  47. package/dist/src/http/classes/http-base-requester.d.ts +0 -113
  48. package/dist/src/http/classes/http-base-requester.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- (function(c,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("lodash-es"),require("date-fns"),require("axios"),require("ts-case-convert"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns","axios","ts-case-convert","pinia","vue"],p):(c=typeof globalThis<"u"?globalThis:c||self,p(c["SC Common Lib"]={},c["lodash-es"],c["date-fns"],c.axios,c["ts-case-convert"],c.pinia,c.vue))})(this,function(c,p,h,kr,be,he,y){"use strict";var ht=Object.defineProperty;var mt=(c,p,h)=>p in c?ht(c,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):c[p]=h;var i=(c,p,h)=>mt(c,typeof p!="symbol"?p+"":p,h);class d{constructor(r,e){i(this,"id");i(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(p.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==="":p.isNil(this.id)}}class D extends d{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Ie extends D{constructor(e){super(e);i(this,"slug");i(this,"code");i(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class me extends Ie{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class te extends me{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,n])=>[p.toUpper(t),n])):void 0}}var _e=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(_e||{});class P extends D{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 ie extends P{static getRetailPriceCoefficient(){return{id:-2,slug:_e.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class fe{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new ie(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 Le{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 H extends P{}class ne extends P{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(n=>new H(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Le(e==null?void 0:e.coordinates)}}class Ze{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new ne(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const E=class E{static init(r){E.config=r}static getConfig(){if(p.isUndefined(E.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return E.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(t=>t.ok?t.json():(console.error(new Error(`Ошибка загрузки ${r}: ${t.statusText}`)),new Promise(n=>{n({})})));return e.catch(t=>{console.error(t)}),e}};i(E,"config");let a=E;class xe extends Ie{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ee{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 $ extends xe{constructor(e){var n,o,l,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"quantityUnit");i(this,"currency");i(this,"currencySignature");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?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=p.isString(e==null?void 0:e.costDate)?h.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(m=>new Ze(m)))??[],this.currencySignature=(e==null?void 0:e.currencySignature)??"",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 me({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(m=>new me(m))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(m=>new Ee(m,a.getConfig().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 fe(m)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var t;const e=(t=a.getConfig().catalog)==null?void 0:t.products.units;return[...(e==null?void 0:e.linear)??["пог.м.","м."],...(e==null?void 0:e.square)??["м2"]].includes(this.unit)}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}class er extends d{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"height");i(this,"length");i(this,"width");i(this,"barcode");i(this,"marker");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");this.product=new $(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new te,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class rr extends er{constructor(e){super(e);i(this,"currency");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");this.currency=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=e.sawing}}class se{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new rr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class tr{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 ir{constructor(r){i(this,"apiUri");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.apiUri=(r==null?void 0:r.apiUri)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class nr{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,n,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|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:((n=r==null?void 0:r.replay)==null?void 0:n.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 sr{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=p.isString(r==null?void 0:r.date)?h.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"}}class Nr{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"urls");i(this,"version");i(this,"dateFormats");var e,t,n;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new ir(r==null?void 0:r.http),this.deviceTypeByResolution=new tr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new nr({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new sr(r==null?void 0:r.version),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:((n=r==null?void 0:r.dateFormats)==null?void 0:n.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class ye{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const b=class b{constructor(r){i(this,"httpClient");i(this,"defaultInstanceNotificationErrorResponseHandler",p.noop);const e=a.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=kr.create({baseURL:r,headers:{"APP-VERSION":`${e.name} (${e.version}, ${h.format(e.date,a.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json"}}),this.httpClient.interceptors.request.use(t=>(t.method&&(t.method==="get"&&t.params&&(t.params=be.objectToSnake(t.params)),["put","patch","post"].includes(p.toLower(t.method))&&t.data&&(t.data=be.objectToSnake(t.data))),t),t=>Promise.reject(t)),this.httpClient.interceptors.response.use(t=>(t.data&&(t.data=be.objectToCamel(t.data)),t),t=>b.convertHttpErrorResponse(t))}static setBaseDefaultNotificationErrorResponseHandler(r){b.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=ye.simpleInstanceInitializer(r)),b.instances[r.name]}static convertHttpErrorResponse(r){var t,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((t=e==null?void 0:e.data)==null?void 0:t.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,t={},n=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return n||o.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,t)}),o}get(r,e={},t=void 0,n=!1){return this.request({method:"GET",url:r,params:e},t,{},n)}getBlob(r,e={},t=void 0,n=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},n)}patch(r,e={},t=void 0,n={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,n,o)}post(r,e={},t=void 0,n={},o=!1){return this.request({method:"POST",url:r,data:e},t,n,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(b,"instances",{}),i(b,"baseDefaultNotificationErrorResponseHandler",p.noop);let Ce=b;const ee=class ee extends Ce{constructor(e){super(e);i(this,"responseDataCacheTimeout");const t=a.getConfig();this.responseDataCacheTimeout=t.http.responseDataCacheTimeout}static getCachedResponse(e){const t=ee.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){ee.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,n=!1,o={}){const l=t+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),g=n?ee.getCachedResponse(l):void 0;return g?Promise.resolve(g):this.get(t,o).then(m=>{const R=m.map(A=>ye.instanceInitializer(e,A));return n&&R&&this.cacheResponse(t,R),R})}};i(ee,"responseDataCache",new Map);let Pe=ee;class f extends Pe{constructor(){var e;const r=a.getConfig();super(`${r.http.apiUri}/api`),(e=r.devMode)!=null&&e.authBearerToken&&this.httpClient.interceptors.request.use(t=>{var n;return t.headers.set("Authorization",`Bearer ${(n=r.devMode)==null?void 0:n.authBearerToken}`),t},t=>Promise.reject(t))}}class dr extends f{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new se(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new se(n.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new se(n.data),t)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new se(e.data))}}var or=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(or||{}),we=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(we||{}),cr=(s=>(s.Unknown="unknown",s.Bool="bool",s.Integer="integer",s.Float="float",s.String="string",s.Range="range",s.Json="json",s.Object="object",s))(cr||{});class q extends te{constructor(e){var t,n;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new q(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new $(o))}}class Oe extends D{constructor(e){super(e);i(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class lr extends Oe{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class qr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const t=JSON.parse(e);if(h.isAfter(h.parseISO(t.availableFor)||h.startOfToday(),new Date))return t.data??{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,t){localStorage.setItem(r,JSON.stringify({availableFor:t,data:e}))}}class U extends D{constructor(e){super(e);i(this,"type");this.type=e==null?void 0:e.type}}class ur extends D{constructor(e){super(e);i(this,"costCoefficient");i(this,"isLowPriceAllowed");i(this,"publishedAt");i(this,"description");i(this,"percent");i(this,"owner");i(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=p.isString(e==null?void 0:e.publishedAt)?h.parseISO(e.publishedAt):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 U(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class B extends Oe{constructor(e){super(e);i(this,"description");i(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class z extends ${constructor(e){super(e);i(this,"costCoefficient");i(this,"costSource");i(this,"discount");i(this,"priceTemplate");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)??we.Product,this.discount=e!=null&&e.discount?new ur(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new B(e.priceTemplate):void 0,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 pr{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class T extends P{}class K extends D{constructor(e){super(e);i(this,"salesDirection",new T);i(this,"photo");i(this,"contacts");i(this,"isDefault");e&&(this.salesDirection=new T(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new pr(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class oe extends K{constructor(e){super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"createdAt");i(this,"supervisorId");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.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId}}class Ur extends te{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 oe(e.manager):void 0}}class ce extends Ur{constructor(e){var t,n;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new ce(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new z(o))}}class ke{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new ie(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class ve extends ke{constructor(e){super(e);i(this,"productCategory");this.productCategory=new te(e==null?void 0:e.productCategory)}}class W extends P{}class J extends P{constructor(e){super(e);i(this,"country",new W);e&&(this.country=new W(e.country))}}class Re extends P{constructor(e){super(e);i(this,"region",new J);e&&(this.region=new J(e.region))}}class Ne extends D{constructor(e){super(e);i(this,"phone");i(this,"email");i(this,"getNews");i(this,"salesDirection");i(this,"createdAt");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 T(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?h.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class Q extends Ne{constructor(e){var t;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");this.salesDirection=new T(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 Re(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(n=>new K(n)))??[]}}class Y extends d{constructor(e){super(e);i(this,"createdAt");i(this,"deletedAt");i(this,"client");i(this,"priceTemplate");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new Q(e==null?void 0:e.client),this.priceTemplate=new B(e==null?void 0:e.priceTemplate)}}class De extends ke{constructor(e){super(e);i(this,"product");this.product=new $(e==null?void 0:e.product)}}class de extends P{}class X extends D{constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");this.type=new de(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class j{constructor(r){i(this,"property");i(this,"value");this.property=new X(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class I{constructor(r){i(this,"from");i(this,"to");this.from=p.isString(r==null?void 0:r.from)?h.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?h.parseISO(r.to):(r==null?void 0:r.to)??null}}class Gr{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"createdAt",new I);i(this,"updatedAt",new I);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.createdAt=new I(r==null?void 0:r.createdAt),this.updatedAt=new I(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":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,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((n=r==null?void 0:r.updatedAt)!=null&&n.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class gr extends P{}class qe extends P{}class Mr extends P{}class hr extends P{}class le extends D{constructor(e){super(e);i(this,"signature","");i(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var S=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(S||{});class G extends P{static generatePersonItem(){return new G({id:1,guid:"",slug:S.Person,name:""})}}class mr extends P{}class fr extends P{}class F extends P{}class yr extends P{}class Cr extends P{}class Ue extends P{}class Ge extends P{}class w extends f{getReference(r,e=!1){return this.getTypedDataArrayRequester(gr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(qe,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(hr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(le,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(F,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(G,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(mr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(fr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(yr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Ue,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(T,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Ge,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(Re,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(J,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(W,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(ne,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(de,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(ie,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Cr,"/public/references/product-file-type",!0)}}var Pr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(Pr||{});class wr extends Ne{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");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}}class vr extends f{getCurrentUser(){return this.get("/internal/users/info",{},r=>new wr(r.data))}}class Rr{constructor(r){i(this,"cost");i(this,"costDate");i(this,"isLowCost");i(this,"isRetail");i(this,"discountName");i(this,"priceTemplateName");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost,this.costDate=p.isString(r.costDate)?h.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new U(r.client):void 0,this.executor=r.executor?new U(r.executor):void 0,this.currency=r.currency?new le(r.currency):void 0}}class Me{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new $(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new q(e)))}}class Z extends D{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 He{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new Z(r==null?void 0:r.role),this.category=new te(r==null?void 0:r.category),this.minCoefficient=new ie(r==null?void 0:r.minCoefficient)}}class Hr extends f{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,n=void 0){let l=`${a.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(l+=`&category_id=${t}`),n&&(l+=`&client_id=${n}`),l}}class Br extends f{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,t){var n;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(n=t.coefficient)==null?void 0:n.id,increase_percent:t.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}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`)}updateProductPrice(r,e,t){var n;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(n=t.coefficient)==null?void 0:n.id,increase_percent:t.value},o=>new z(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,t=>new z(t.data))}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 zr extends f{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(t=>new Y(t)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new Y(e.data))}attachTemplate(r,e,t){const n=a.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&h.format(t.startAt,n),endAt:t.endAt&&h.format(t.endAt,n)},o=>new Y(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,n){const o=a.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,n&&{startAt:n.startAt&&h.format(n.startAt,o),endAt:n.endAt&&h.format(n.endAt,o)},l=>new Y(l.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class Wr extends f{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(t=>new q(t)))}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},n=>new q(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new q(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},n=>p.map(n.data,o=>new $(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return p.forEach(t,n=>n.map(o=>new fe(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(l=>new q(l)))}).catch(o=>{n(o)})})}}class jr extends f{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new $(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new $(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,t=>new fe(t)))}getProductPriceHistory(r,e){const t={};return p.isNil(e)||(t.clientId=e),this.get(`/internal/price/products/${r}/history`,t,n=>p.map(n.data,o=>new Rr(o)))}publicSimpleSearch(r,e=10){return new Promise((t,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(l=>new $(l)))}).catch(o=>{n(o)})})}}class Fr extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},t=>t.data.map(n=>new ce(n)))}getCategoryData(r,e,t=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:n},o=>new ce(o.data))}getCategoryProductsList(r,e,t=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:t},o=>p.map(o.data,l=>new z(l)))}}class Vr extends f{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},n=>new z(n.data))}}var Ae=(s=>(s.BeginWith="bw",s.Contains="cn",s.Custom="custom",s.EndsWith="ew",s.Equals="eq",s.GreaterOrEqual="ge",s.GreaterThan="gt",s.InList="in",s.LessOrEqual="le",s.LessThan="lt",s.NotBeginWith="bn",s.NotContains="nc",s.NotEndsWith="en",s.NotEqual="ne",s.NotInList="ni",s.NotNull="nn",s.Null="nu",s))(Ae||{});class Be{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)??Ae.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=p.isDate(this.value)?h.format(this.value,a.getConfig().dateFormats.api):this.value,r}}class x{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(n=>new Be(n)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(n=>new x(n)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Be&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof x?r.toPrimitive():r)}}}class ue extends f{getPaginated(r,e,t,n,o,l,g){let m={page:(n==null?void 0:n.page)??1,perPage:(n==null?void 0:n.pageSize)??10};return e&&(m.filters=JSON.stringify((e instanceof x?e:new x(e)).toPrimitive())),p.isEmpty(t)||(m.sort=p.isArray(t)?t:[t]),o&&(m={...m,...o}),this.get(r,m,l,g)}}class Kr extends ue{getTemplateList(r,e,t){return this.getPaginated("/internal/price/templates",r,e,t,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new B(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new B(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new B(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,n=>new B(n.data),t)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(t=>new De(t)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new De(t.data))}saveProductTemplatePrice(r,e,t){var n;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(n=t.coefficient)==null?void 0:n.id,increase_percent:t.value},o=>new De(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(t=>new ve(t)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new ve(t.data))}saveCategoryTemplatePrice(r,e,t,n=!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:n?{recursively:!0}:{}},l=>new ve(l.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.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(t=>new Y(t)))}}class Jr extends f{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new Z(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new Z(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new Z(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new Z(t.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(t=>new He(t)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>t.data.map(n=>new He(n)))}}class Qr extends ue{getProperties(r,e,t){return this.getPaginated("/internal/catalog/properties",r,e,t,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new X(l)),o})}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},n=>new X(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new X(e.data))}updateProperty(r,e){const{typeId:t,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:t},o=>new X(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(t=>new j(t)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new j(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},n=>new j(n.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.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(t=>new j(t)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new j(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},n=>new j(n.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})}}class Yr extends f{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Me(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Me(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)})}}function ze(s,r,e){let t;return s.some(n=>{if(n.type===e&&n.id===r)return t=n,!0;if(n.type==="product")return!1;const o=n;if(o.products&&o.products.length>0){const l=ze(o.products,r,e);if(l)return t=l,!0}if(o.categories&&o.categories.length>0){const l=ze(o.categories,r,e);if(l)return t=l,!0}return!1}),t}var Dr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s.SalesDirection="sales_direction",s.Managers="managers",s))(Dr||{});class ae extends d{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new le);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new le(e.currency))}}class $e extends D{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 M extends $e{constructor(e){super(e);i(this,"isPrimary");i(this,"position");i(this,"notDisturb");i(this,"comment");i(this,"updatedAt");i(this,"deletedAt");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,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class We extends D{constructor(e){super(e);i(this,"manager",new K);i(this,"opf",G.generatePersonItem());i(this,"salesDirection",new T);i(this,"partnerGroup",new F);i(this,"contacts",[]);i(this,"bankAccounts",[]);i(this,"comment");i(this,"alternativeName");i(this,"createdAt");i(this,"creator");i(this,"updatedAt");i(this,"updater");if(e){if(this.opf=new G(e.opf),this.salesDirection=new T(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new U(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new U(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new F(e.partnerGroup)),e.manager&&(this.manager=new K(e.manager)),e.contacts){const t=[];e.contacts.forEach(n=>{t.push(new M(n))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(n=>{t.push(new ae(n))}),this.bankAccounts=t}}}}class Ar extends We{constructor(r){super(r)}}class je extends We{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 Fe extends je{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class ar extends Fe{constructor(e){super(e);i(this,"registrationCountry",new W);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new W(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class pe{static createInstance(r){switch(r.opf.slug){case S.Ic:return new je(r);case S.UlR:return new Fe(r);case S.UlNr:return new ar(r);default:return new Ar(r)}}}class Se extends d{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class $r extends M{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new Se(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new Se(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new Se(t))))}}class ge extends lr{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 Le(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(n=>new M(n)))??[],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 Ve extends Q{constructor(e){var t,n,o,l;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,"isExcludedFromMsCallsToClients");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>pe.createInstance(g)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(g=>new F(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new M(g)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(g=>new ge(g)))??[],this.channelPrimaryInterest=new qe(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Ge(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new ne(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class Xr{constructor(r){i(this,"id");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 I);i(this,"lastLoginDate",new I);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");var e,t,n,o,l,g;this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.alternativeName=r==null?void 0:r.alternativeName,this.searchTerm=r==null?void 0:r.searchTerm,this.cities=(e=r==null?void 0:r.cities)==null?void 0:e.map(m=>new Re(m)),this.region=new J(r==null?void 0:r.region),this.country=new W(r==null?void 0:r.country),this.phone=r==null?void 0:r.phone,this.email=r==null?void 0:r.email,this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt=new I(r==null?void 0:r.createdAt),this.lastLoginDate=new I(r==null?void 0:r.lastLoginDate),this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(m=>new oe(m)):[],this.salesDirections=(t=r==null?void 0:r.salesDirections)==null?void 0:t.map(m=>new T(m)),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new G(r==null?void 0:r.contragentType),this.preferredDeliveryType=new H(r==null?void 0:r.preferredDeliveryType),this.partnerGroups=(n=r==null?void 0:r.partnerGroups)==null?void 0:n.map(m=>new F(m)),this.contact=new $e(r==null?void 0:r.contact),this.lastOrder={createdAt:new I((o=r==null?void 0:r.lastOrder)==null?void 0:o.createdAt),creator:(l=r==null?void 0:r.lastOrder)==null?void 0:l.creator,isApproved:(g=r==null?void 0:r.lastOrder)==null?void 0:g.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"searchTerm":case"contragentInn":this[r]=void 0;break;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"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new G;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new $e;break}return this}asClearRaw(){var e,t,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((o=r==null?void 0:r.lastLoginDate)!=null&&o.to)&&delete r.lastLoginDate,r}}class Ke extends d{constructor(e){super(e);i(this,"createdAt");i(this,"creator");i(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new U(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Sr extends D{constructor(e){var t,n;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");(t=e.contacts)!=null&&t.length&&(this.contacts=e.contacts.map(o=>new M(o))),e.lastOrder&&(this.lastOrder=new Ke(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(o=>new F(o))),e.preferredDeliveryType&&(this.preferredDeliveryType=new H(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new T(e.salesDirection)),e.managers&&(this.managers=e.managers.map(o=>new K(o)))}}class Tr{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 Zr extends Tr{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 xr{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 Er extends ue{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Ve(e.data))}getClientsList(r,e,t,n){return this.getPaginated("/internal/clients",r,e,t,n,o=>{const l={...o.data};return l.data=l.data.map(g=>new Q(g)),l})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ae.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(n=>n.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},n=>{let o=[];return(n==null?void 0:n.data.length)>0&&(o=n.data.map(l=>new Sr(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let t=[];return(e==null?void 0:e.data.length)>0&&(t=e.data.map(n=>new $r(n))),t})}createClientCommonData(r,e={}){var t;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id},n=>new Ve(n.data),e)}updateClientCommonData(r,e={}){var t;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id},void 0,e)}changeClientPassword(r,e,t,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,n)}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(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(t)}createContragentClientData(r,e,t={}){var m,R,A,_,L,O,k,N;let n;const o=e,l=e,g=e;switch(e.opf.slug){case S.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,manager_id:(R=o.manager)==null?void 0:R.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case S.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(A=l.partnerGroup)==null?void 0:A.id,manager_id:(_=l.manager)==null?void 0:_.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case S.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,V=>pe.createInstance(V.data),t)}updateContragentClientData(r,e,t={}){var m,R,A,_,L,O,k,N;let n;const o=e,l=e,g=e;switch(e.opf.slug){case S.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,manager_id:(R=o.manager)==null?void 0:R.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case S.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:(A=l.partnerGroup)==null?void 0:A.id,manager_id:(_=l.manager)==null?void 0:_.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case S.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(L=g.partnerGroup)==null?void 0:L.id,manager_id:(O=g.manager)==null?void 0:O.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(N=e.manager)==null?void 0:N.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,V=>pe.createInstance(V.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,t={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,g=>new ge(g.data),t)}updateClientDeliveryAddress(r,e,t={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,g=>new ge(g.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:t.bankName,bic:t.bic,account_number:t.accountNumber,correspondent_account:t.correspondentAccount,currency_id:t.currency.id},o=>new ae(o.data),n)}updateContragentBankAccount(r,e,t,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,{bank_name:t.bankName,bic:t.bic,account_number:t.accountNumber,correspondent_account:t.correspondentAccount,currency_id:t.currency.id},o=>new ae(o.data),n)}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},n=>new M(n.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,n={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},n)}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,n={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},n)}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,n={}){var l,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,m=>new M(m.data),n)}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 et extends f{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(t)})}}class rt extends f{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,t={}){var o;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.editor}/product`,{params:e},l=>new $(l.data));return n.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,t)}),n}createTemplate(r,e,t={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},t)}removeTemplate(r,e){var t;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.editor}/template/${e}`)}}class tt{static defaultDateRanges(){const r=h.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:h.startOfDay(r),to:h.endOfDay(r)},today:{label:"Сегодня",from:h.startOfToday(),to:h.endOfToday()},yesterday:{label:"Вчера",from:h.startOfYesterday(),to:h.endOfYesterday()},tomorrow:{label:"Завтра",from:h.startOfTomorrow(),to:h.endOfTomorrow()}}}}const re=class re{static setLinearValues(r){re.linearValues=r}static productIsMeasurable(r){return re.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)!=null&&t.minCount)&&!re.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};i(re,"linearValues",["пог.м.","м.","м2"]);let Je=re;class it{static generateUndefinedManagerInstance(){return new oe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class br extends f{getManagers(){const r="/internal/managers",e=f.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(t=>{const n=t.data.map(o=>ye.instanceInitializer(oe,o));return n&&this.cacheResponse(r,n),n})}}class Qe extends Ke{constructor(e){var t,n,o,l,g,m,R,A;super(e);i(this,"client");i(this,"payment");i(this,"delivery");i(this,"attachedUser");i(this,"status");i(this,"salesDirection");i(this,"pendingAt");i(this,"processedAt");i(this,"isOnOrder");i(this,"isNotInStock");this.client=new Q(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?h.parseISO(e.delivery.date):((m=e==null?void 0:e.delivery)==null?void 0:m.date)??new Date,address:(R=e==null?void 0:e.delivery)!=null&&R.address?new ge(e.delivery.address):void 0,warehouse:(A=e==null?void 0:e.delivery)!=null&&A.warehouse?new ne(e.delivery.warehouse):void 0},this.attachedUser=new U(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new T(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?h.parseISO(e.processedAt):e==null?void 0:e.processedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class Ir extends d{constructor(e){super(e);i(this,"product");i(this,"quantity");i(this,"currency");i(this,"costOne");i(this,"costOneRub");i(this,"cost");i(this,"costRub");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"configurator");i(this,"configuratorParams");i(this,"sawing");this.product=new z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class _r extends Qe{constructor(e){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");this.products=(e.products??[]).map(t=>new Ir(t)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?pe.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class nt extends ue{getOrders(r,e,t){return this.getPaginated("/internal/orders",r,e?[e]:void 0,t,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new Qe(l)),o})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new _r(e.data))}}class Te{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new Q(r==null?void 0:r.client),this.product=new $(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)??we.Product}}const Ye=s=>{var r,e,t,n,o;return s?p.omitBy({cities:(r=s.cities)==null?void 0:r.map(l=>l.id),clients:(e=s.clients)==null?void 0:e.map(l=>l.id),managers:(t=s.managers)==null?void 0:t.map(l=>l.id),partnerGroups:(n=s.partnerGroups)==null?void 0:n.map(l=>l.id),salesDirections:(o=s.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:s.hideNotActive},l=>p.isNil(l)||(p.isArray(l)||p.isObject(l))&&p.isEmpty(l)):{}},Lr=s=>{const r={};return s.from&&(s.from.coefficient||s.from.value)&&(r.from={},s.from.coefficient&&(r.from.priceCoefficientId=s.from.coefficient.id),s.from.value&&(r.from.increasePercent=s.from.value)),s.to&&(s.to.coefficient||s.to.value)&&(r.to={},s.to.coefficient&&(r.to.priceCoefficientId=s.to.coefficient.id),s.to.value&&(r.to.increasePercent=s.to.value)),r};class st extends f{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...Lr(e),filters:Ye(t)},n=>n.data.map(o=>new Te(o)))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...Lr(e),filters:Ye(t)},n=>n.data.map(o=>new Te(o)))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:Ye(t)},n=>n.data.map(o=>new Te(o)))}}class Or{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class Xe{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");var e;this.resourceType=new Ue(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 Or(t)))??[]}}class ot extends f{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new Xe(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new Xe(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const v=he.defineStore("__references_private",()=>{const s=y.ref({}),r=y.ref(void 0),e=y.ref(void 0),t=y.ref(void 0),n=y.ref(void 0),o=y.ref(void 0),l=y.ref(void 0),g=y.ref(void 0),m=y.ref(void 0),R=y.ref(void 0),A=y.ref(void 0),_=y.ref(void 0),L=y.ref(void 0),O=y.ref(void 0),k=y.ref(void 0),N=y.ref(void 0),V=y.ref(void 0),u=y.ref(void 0);return{dataLoaderList:s,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:n,managersList:o,opfReference:l,orderPaymentStatusReference:g,orderStatusReference:m,paymentTypeReference:R,partnerGroupReference:A,productFileTypeReference:_,resourceTypesReference:L,salesDirectionsReference:O,sourcePrimaryInterestReference:k,warehousesReference:N,propertyTypesReference:V,priceCoefficientsReference:u}}),ct=he.defineStore("references",()=>{const s=y.computed(()=>{const u=v();return!u.channelPrimaryInterestReference&&!u.dataLoaderList.channelPrimaryInterestReference&&(u.dataLoaderList.channelPrimaryInterestReference=!0,f.getInstance(w).getChannelPrimaryInterest().then(C=>{u.channelPrimaryInterestReference=C}).catch(p.noop)),u.channelPrimaryInterestReference}),r=y.computed(()=>{const u=v();return!u.contactPositionsReference&&!u.dataLoaderList.contactPositionsReference&&(u.dataLoaderList.contactPositionsReference=!0,f.getInstance(w).getContactPositions().then(C=>{u.contactPositionsReference=C}).catch(p.noop)),u.contactPositionsReference}),e=y.computed(()=>{const u=v();return!u.currencyReference&&!u.dataLoaderList.currencyReference&&(u.dataLoaderList.currencyReference=!0,f.getInstance(w).getCurrency().then(C=>{u.currencyReference=C}).catch(p.noop)),u.currencyReference}),t=y.computed(()=>{const u=v();return!u.opfReference&&!u.dataLoaderList.opfReference&&(u.dataLoaderList.opfReference=!0,f.getInstance(w).getOpf().then(C=>{u.opfReference=C}).catch(p.noop)),u.opfReference}),n=y.computed(()=>{const u=v();return!u.orderPaymentStatusReference&&!u.dataLoaderList.orderPaymentStatusReference&&(u.dataLoaderList.orderPaymentStatusReference=!0,f.getInstance(w).getOrderPaymentStatuses().then(C=>{u.orderPaymentStatusReference=C}).catch(p.noop)),u.orderPaymentStatusReference}),o=y.computed(()=>{const u=v();return!u.orderStatusReference&&!u.dataLoaderList.orderStatusReference&&(u.dataLoaderList.orderStatusReference=!0,f.getInstance(w).getOrderStatuses().then(C=>{u.orderStatusReference=C}).catch(p.noop)),u.orderStatusReference}),l=y.computed(()=>{const u=v();return!u.paymentTypeReference&&!u.dataLoaderList.paymentTypeReference&&(u.dataLoaderList.paymentTypeReference=!0,f.getInstance(w).getPaymentTypes().then(C=>{u.paymentTypeReference=C}).catch(p.noop)),u.paymentTypeReference}),g=y.computed(()=>{const u=v();return!u.partnerGroupReference&&!u.dataLoaderList.partnerGroupReference&&(u.dataLoaderList.partnerGroupReference=!0,f.getInstance(w).getPartnerGroup().then(C=>{u.partnerGroupReference=C}).catch(p.noop)),u.partnerGroupReference}),m=y.computed(()=>{const u=v();return!u.productFileTypeReference&&!u.dataLoaderList.productFileTypeReference&&(u.dataLoaderList.productFileTypeReference=!0,f.getInstance(w).getProductFileType().then(C=>{u.productFileTypeReference=C}).catch(p.noop)),u.productFileTypeReference}),R=y.computed(()=>{const u=v();return!u.resourceTypesReference&&!u.dataLoaderList.resourceTypesReference&&(u.dataLoaderList.resourceTypesReference=!0,f.getInstance(w).getResourceTypes().then(C=>{u.resourceTypesReference=C}).catch(p.noop)),u.resourceTypesReference}),A=y.computed(()=>{const u=v();return!u.salesDirectionsReference&&!u.dataLoaderList.salesDirectionsReference&&(u.dataLoaderList.salesDirectionsReference=!0,f.getInstance(w).getSalesDirections().then(C=>{u.salesDirectionsReference=C}).catch(p.noop)),u.salesDirectionsReference}),_=y.computed(()=>{const u=v();return!u.sourcePrimaryInterestReference&&!u.dataLoaderList.sourcePrimaryInterestReference&&(u.dataLoaderList.sourcePrimaryInterestReference=!0,f.getInstance(w).getSourcePrimaryInterest().then(C=>{u.sourcePrimaryInterestReference=C}).catch(p.noop)),u.sourcePrimaryInterestReference}),L=y.computed(()=>{const u=v();return!u.deliveryTypeReference&&!u.dataLoaderList.deliveryTypeReference&&(u.dataLoaderList.deliveryTypeReference=!0,f.getInstance(w).getDeliveryTypes().then(C=>{u.deliveryTypeReference=C}).catch(p.noop)),u.deliveryTypeReference}),O=y.computed(()=>{const u=v();return!u.managersList&&!u.dataLoaderList.managersList&&(u.dataLoaderList.managersList=!0,f.getInstance(br).getManagers().then(C=>{u.managersList=C}).catch(p.noop)),u.managersList}),k=y.computed(()=>{const u=v();return!u.warehousesReference&&!u.dataLoaderList.warehousesReference&&(u.dataLoaderList.warehousesReference=!0,f.getInstance(w).getWarehouses().then(C=>{u.warehousesReference=C}).catch(p.noop)),u.warehousesReference}),N=y.computed(()=>{const u=v();return!u.propertyTypesReference&&!u.dataLoaderList.propertyTypesReference&&(u.dataLoaderList.propertyTypesReference=!0,f.getInstance(w).getPropertyTypes().then(C=>{u.propertyTypesReference=C}).catch(p.noop)),u.propertyTypesReference}),V=y.computed(()=>{const u=v();return!u.priceCoefficientsReference&&!u.dataLoaderList.priceCoefficientsReference&&(u.dataLoaderList.priceCoefficientsReference=!0,f.getInstance(w).getPriceCoefficients().then(C=>{u.priceCoefficientsReference=C}).catch(p.noop)),u.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:t,orderPaymentStatusReference:n,orderStatusReference:o,paymentTypeReference:l,partnerGroupsReference:g,productFilesTypesReference:m,resourceTypesReference:R,salesDirectionsReference:A,sourcePrimaryInterestsReference:_,deliveryTypeReference:L,managersList:O,warehousesReference:k,propertyTypesReference:N,priceCoefficientsReference:V}}),lt=he.defineStore("__user_state_private",()=>{const s=y.ref({}),r=y.ref(void 0);return{dataLoaderList:s,currentUser:r}}),ut=he.defineStore("user_state",()=>({currentUser:y.computed(()=>{const r=lt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,f.getInstance(vr).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(p.noop)),r.currentUser})}));class pt extends f{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 n=[...t];let o=1;return n.forEach(l=>{l.id=o++}),n})}}class gt{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=gr,c.AppBaseConfig=Nr,c.AppConfigProvider=a,c.BankAccount=ae,c.BasePaginationProvider=ue,c.CalculationTypeEnum=or,c.Cart=se,c.CartItem=rr,c.CartItemBase=er,c.CartProvider=dr,c.CatalogProvider=Hr,c.CatalogableItem=Ie,c.Category=q,c.CategoryPricingRule=He,c.ChannelPrimaryInterest=qe,c.City=Mr,c.CityWithRegionAndCountry=Re,c.Client=Ve,c.ClientAdditionalData=Sr,c.ClientCategory=ce,c.ClientDataProvider=Er,c.ClientPriceProvider=Br,c.ClientPriceTemplateProvider=zr,c.ClientProduct=z,c.ClientProductCategoryDataProvider=Fr,c.ClientProductDataProvider=Vr,c.ClientShortInfo=Q,c.ClientsAdditionalDataRequestTypeEnum=Dr,c.ClientsListFilters=Xr,c.ConfiguratorProvider=rt,c.Contact=$e,c.ContactLinks=pr,c.ContactPerson=M,c.ContactPersonRelated=$r,c.ContactPosition=hr,c.ContactRelation=Se,c.ContragentBase=We,c.ContragentFactory=pe,c.ContragentIc=je,c.ContragentPerson=Ar,c.ContragentUlNr=ar,c.ContragentUlR=Fe,c.CostSourceEnum=we,c.Country=W,c.Currency=le,c.DataSuggestionProvider=pt,c.DataTablePagination=Zr,c.DataTablePaginationRequestParams=Tr,c.DataTableSortRequestParams=xr,c.DateTimeProvider=tt,c.DeletableNamedIdentity=lr,c.DeliveryAddress=ge,c.DeliveryType=H,c.DeviceTypeResolutionConfig=tr,c.DiscountShortInfo=ur,c.FieldValidationResultData=gt,c.FilterGroup=x,c.FilterItem=Be,c.FilterOpEnum=Ae,c.GeoCoordinates=Le,c.HiddenCatalogableItem=xe,c.HttpBaseCachedRequester=Pe,c.HttpBaseRequester=Ce,c.HttpParamsConfig=ir,c.HttpRequester=f,c.Identity=d,c.Image=Ee,c.Manager=oe,c.ManagerCommon=K,c.ManagerDataFactory=it,c.ManagerDataProvider=br,c.MetaTagItem=Or,c.NamedIdentity=D,c.Opf=G,c.OpfEnum=S,c.Order=_r,c.OrderInfo=Qe,c.OrderPaymentStatus=mr,c.OrderProduct=Ir,c.OrderShortInfo=Ke,c.OrderStatus=fr,c.OrdersDataProvider=nt,c.PartnerGroup=F,c.PaymentType=yr,c.PreferencesStorageProvider=qr,c.PriceAnalyze=Te,c.PriceAnalyzeProvider=st,c.PriceCoefficient=ie,c.PriceCoefficientEnum=_e,c.PriceTemplate=B,c.PriceTemplateCategory=ve,c.PriceTemplateClient=Y,c.PriceTemplateICatalogableItem=ke,c.PriceTemplateProduct=De,c.PriceTemplateProvider=Kr,c.PricingRole=Z,c.PricingRoleProvider=Jr,c.PrimaryCatalogableItem=me,c.Product=$,c.ProductCategoryDataProvider=Wr,c.ProductDataProvider=jr,c.ProductFileType=Cr,c.ProductPriceCoefficient=fe,c.ProductPriceHistory=Rr,c.PropertiesProvider=Qr,c.Property=X,c.PropertyType=de,c.PropertyTypeEnum=cr,c.PropertyValue=j,c.RecommendationsDataProvider=Yr,c.RecommendationsList=Me,c.Reference=P,c.ReferenceDataProvider=w,c.Region=J,c.ResourceType=Ue,c.SalesDirection=T,c.SentryConfig=nr,c.Seo=Xe,c.SeoDataProvider=ot,c.SourcePrimaryInterest=Ge,c.StockCount=Ze,c.TemplatesListFilters=Gr,c.TypedInstanceFactory=ye,c.UnitsHelper=Je,c.UnknownClientDataProvider=et,c.UpdatableNamedIdentity=Oe,c.User=wr,c.UserCommonInfo=Ne,c.UserDataProvider=vr,c.UserShortInfo=U,c.UserTypeEnum=Pr,c.VersionConfig=sr,c.Warehouse=ne,c.findCatalogItemByIdRecursive=ze,c.useReferencesStore=ct,c.useUserStateStore=ut,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,R){typeof exports=="object"&&typeof module<"u"?R(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("date-fns"),require("axios"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","date-fns","axios","pinia","vue"],R):(c=typeof globalThis<"u"?globalThis:c||self,R(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c["date-fns"],c.axios,c.pinia,c.vue))})(this,function(c,R,p,ne,h,Nr,Ce,y){"use strict";var ft=Object.defineProperty;var yt=(c,R,p)=>R in c?ft(c,R,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[R]=p;var t=(c,R,p)=>yt(c,typeof R!="symbol"?R+"":R,p);class se{constructor(r){t(this,"exp",0);t(this,"iat",0);t(this,"authTime",0);t(this,"jti","");t(this,"iss","");t(this,"aud",[]);t(this,"sub","");t(this,"typ","Bearer");t(this,"azp","");t(this,"sid","");t(this,"acr","");t(this,"allowedOrigins",[]);t(this,"realmAccess",{roles:[]});t(this,"resourceAccess",{});t(this,"scope","");t(this,"emailVerified",!1);t(this,"name","");t(this,"guid","");t(this,"preferredUsername","");t(this,"givenName","");t(this,"email","");p.merge(this,r)}static getJwtPayload(r){return new se(ne.objectToCamel(R.jwtDecode(r)))}}class dr extends se{constructor(e){super(e);t(this,"familyName");t(this,"middleName");t(this,"locale");t(this,"phoneNumber");t(this,"phoneNumberVerified");t(this,"address");p.merge(this,e)}static getJwtPayload(e){return new se(ne.objectToCamel(R.jwtDecode(e)))}}class q{constructor(r,e){t(this,"id");t(this,"guid");this.id=r==null?void 0:r.id,p.isNil(this.id)&&(p.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==="":p.isNil(this.id)}}class D extends q{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class _e extends D{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class Pe extends _e{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class oe extends Pe{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");t(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(([i,n])=>[p.toUpper(i),n])):void 0}}var Le=(s=>(s.K0="k0",s.K1="k1",s.K2="k2",s.K3="k3",s.K4="k4",s.Retail="retail",s))(Le||{});class P extends D{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class ce extends P{static getRetailPriceCoefficient(){return{id:-2,slug:Le.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class we{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new ce(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 Oe{constructor(r){t(this,"lat");t(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class H extends P{}class le extends P{constructor(e){var i;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((i=e==null?void 0:e.deliveryTypes)==null?void 0:i.map(n=>new H(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Oe(e==null?void 0:e.coordinates)}}class xe{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new le(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const re=class re{static init(r){re.config=r}static getConfig(){if(p.isUndefined(re.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return re.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(i=>i.ok?i.json():(console.error(new Error(`Ошибка загрузки ${r}: ${i.statusText}`)),new Promise(n=>{n({})})));return e.catch(i=>{console.error(i)}),e}};t(re,"config");let A=re;class Ee extends _e{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class er{constructor(r,e){t(this,"image");t(this,"preview");t(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class S extends Ee{constructor(e){var n,o,l,g;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");t(this,"currencySignature");t(this,"cost");t(this,"costRub");t(this,"costDate");t(this,"onOrder");t(this,"stockCount");t(this,"category");t(this,"categories");t(this,"images");t(this,"properties");t(this,"retailCost");t(this,"retailCostRub");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=(e==null?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=p.isString(e==null?void 0:e.costDate)?h.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(m=>new xe(m)))??[],this.currencySignature=(e==null?void 0:e.currencySignature)??"",this.type="product";const i=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(m=>m.isPrimary));i&&(this.category=new Pe({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(m=>new Pe(m))),this.images=((l=e==null?void 0:e.images)==null?void 0:l.map(m=>new er(m,A.getConfig().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 we(m)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){var i;const e=(i=A.getConfig().catalog)==null?void 0:i.products.units;return[...(e==null?void 0:e.linear)??["пог.м.","м."],...(e==null?void 0:e.square)??["м2"]].includes(this.unit)}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}class rr extends q{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new S(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new oe,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&p.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class tr extends rr{constructor(e){super(e);t(this,"currency");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");this.currency=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=e.sawing}}class ue{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new tr(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class ir{constructor(r){t(this,"phone");t(this,"tablet");t(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 nr{constructor(r){t(this,"portalApiUrl");t(this,"mediaUrl");t(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 sr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,n,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|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((i=r==null?void 0:r.trace)==null?void 0:i.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((n=r==null?void 0:r.replay)==null?void 0:n.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 or{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=p.isString(r==null?void 0:r.date)?h.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"}}class qr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"urls");t(this,"version");t(this,"dateFormats");var e,i,n;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new nr(r==null?void 0:r.http),this.deviceTypeByResolution=new ir(r==null?void 0:r.deviceTypeByResolution),this.sentry=new sr({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new or(r==null?void 0:r.version),this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((i=r==null?void 0:r.dateFormats)==null?void 0:i.uiDate)??"dd.MM.yyyy",uiDateWithTime:((n=r==null?void 0:r.dateFormats)==null?void 0:n.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}class ae{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const I=class I{constructor(){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",p.noop);t(this,"getBaseUrl",()=>`${A.getConfig().http.portalApiUrl}/api`);t(this,"getAccessToken",()=>{var i,n;let r;const e=A.getConfig();return(i=e.devMode)!=null&&i.authBearerToken&&(r=(n=e.devMode)==null?void 0:n.authBearerToken),Promise.resolve(r)});t(this,"invalidateAccessToken",p.noop);t(this,"requestErrorHandler",p.noop);t(this,"authRequestInterceptor",async r=>{const e=await this.getAccessToken();return e&&r.headers.set("Authorization",`Bearer ${e}`),r});t(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=ne.objectToSnake(r.params)),["put","patch","post"].includes(p.toLower(r.method))&&r.data&&(r.data=ne.objectToSnake(r.data))),r));t(this,"authErrorsResponseInterceptors",r=>{var i;const e=r.rawError?(i=r.rawError)==null?void 0:i.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(this.invalidateAccessToken(),e.__isRetryRequest=!0,this.httpClient(e)):(this.requestErrorHandler(r),Promise.reject(r))});t(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=ne.objectToCamel(r.data)),r));const r=A.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=I.baseDefaultNotificationErrorResponseHandler,this.httpClient=Nr.create({baseURL:this.getBaseUrl(),headers:{"APP-VERSION":`${r.name} (${r.version}, ${h.format(r.date,A.getConfig().dateFormats.uiDate)})`,Accept:"application/json","Content-Type":"application/json"}}),this.httpClient.interceptors.request.use(this.authRequestInterceptor,e=>Promise.reject(e)),this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,e=>Promise.reject(e)),this.httpClient.interceptors.response.use(e=>e,this.authErrorsResponseInterceptors),this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,e=>I.convertHttpErrorResponse(e))}static setBaseDefaultNotificationErrorResponseHandler(r){I.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(I.instances,r.name)||(I.instances[r.name]=ae.simpleInstanceInitializer(r)),I.instances[r.name]}static convertHttpErrorResponse(r){var i,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((i=e==null?void 0:e.data)==null?void 0:i.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,i={},n=!1){const o=this.httpClient.request(r).then(l=>e?e(l):l.data);return n||o.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,i)}),o}get(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e},i,{},n)}getBlob(r,e={},i=void 0,n=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},n)}patch(r,e={},i=void 0,n={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,n,o)}post(r,e={},i=void 0,n={},o=!1){return this.request({method:"POST",url:r,data:e},i,n,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(I,"instances",{}),t(I,"baseDefaultNotificationErrorResponseHandler",p.noop);let f=I;class Ur extends f{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new ue(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new ue(n.data),i)}patchCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new ue(n.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new ue(e.data))}}var cr=(s=>(s.m2Cost="m2Cost",s.percent="percent",s.value="value",s))(cr||{}),ve=(s=>(s.Discount="discount",s.PriceTemplate="price_template",s.ClientPrice="client_price",s.Product="product",s))(ve||{}),lr=(s=>(s.Unknown="unknown",s.Bool="bool",s.Integer="integer",s.Float="float",s.String="string",s.Range="range",s.Json="json",s.Object="object",s))(lr||{});class U extends oe{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new U(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new S(o))}}class ke extends D{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class ur extends ke{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Gr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const i=JSON.parse(e);if(h.isAfter(h.parseISO(i.availableFor)||h.startOfToday(),new Date))return i.data??{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,i){localStorage.setItem(r,JSON.stringify({availableFor:i,data:e}))}}class G extends D{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class pr extends D{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=p.isString(e==null?void 0:e.publishedAt)?h.parseISO(e.publishedAt):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 G(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class j extends ke{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}class z extends S{constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??ve.Product,this.discount=e!=null&&e.discount?new pr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new j(e.priceTemplate):void 0,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 gr{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class b extends P{}class K extends D{constructor(e){super(e);t(this,"salesDirection",new b);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new b(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new gr(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class pe extends K{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");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.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId}}class Mr extends oe{constructor(e){super(e);t(this,"isDisabled");t(this,"isRequired");t(this,"isFavorite");t(this,"hidingComment");t(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 pe(e.manager):void 0}}class ge extends Mr{constructor(e){var i,n;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new ge(o)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(o=>new z(o))}}class Ne{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new ce(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Re extends Ne{constructor(e){super(e);t(this,"productCategory");this.productCategory=new oe(e==null?void 0:e.productCategory)}}class W extends P{}class Q extends P{constructor(e){super(e);t(this,"country",new W);e&&(this.country=new W(e.country))}}class De extends P{constructor(e){super(e);t(this,"region",new Q);e&&(this.region=new Q(e.region))}}class de extends D{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(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 b(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?h.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class Y extends de{constructor(e){var i;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");this.salesDirection=new b(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 De(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=((i=e==null?void 0:e.managers)==null?void 0:i.map(n=>new K(n)))??[]}}class X extends q{constructor(e){super(e);t(this,"createdAt");t(this,"deletedAt");t(this,"client");t(this,"priceTemplate");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new Y(e==null?void 0:e.client),this.priceTemplate=new j(e==null?void 0:e.priceTemplate)}}class Ae extends Ne{constructor(e){super(e);t(this,"product");this.product=new S(e==null?void 0:e.product)}}class qe extends P{}class Z extends D{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new qe(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class V{constructor(r){t(this,"property");t(this,"value");this.property=new Z(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class _{constructor(r){t(this,"from");t(this,"to");this.from=p.isString(r==null?void 0:r.from)?h.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?h.parseISO(r.to):(r==null?void 0:r.to)??null}}class Br{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new _);t(this,"updatedAt",new _);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.createdAt=new _(r==null?void 0:r.createdAt),this.updatedAt=new _(r==null?void 0:r.updatedAt)}resetFilterValue(r){switch(r){case"id":case"name":case"description":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,i,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.updatedAt)!=null&&n.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class hr extends P{}class Ue extends P{}class Hr extends P{}class mr extends P{}class he extends D{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var T=(s=>(s.Person="individual",s.Ic="entrepreneur",s.UlR="legal",s.UlNr="non_resident_legal",s))(T||{});class M extends P{static generatePersonItem(){return new M({id:1,guid:"",slug:T.Person,name:""})}}class fr extends P{}class yr extends P{}class F extends P{}class Cr extends P{}class Pr extends P{}class Ge extends P{}class Me extends P{}const te=class te extends f{constructor(){super();t(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=A.getConfig().http.responseDataCacheTimeout}static getCachedResponse(e){const i=te.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){te.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,n=!1,o={}){const l=i+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),g=n?te.getCachedResponse(l):void 0;return g?Promise.resolve(g):this.get(i,o).then(m=>{const v=m.map($=>ae.instanceInitializer(e,$));return n&&v&&this.cacheResponse(i,v),v})}};t(te,"responseDataCache",new Map);let x=te;class w extends x{getReference(r,e=!1){return this.getTypedDataArrayRequester(hr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ue,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(mr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(he,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(F,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(M,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(fr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(yr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(Cr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Ge,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(b,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(Me,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(De,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(Q,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(W,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(le,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(qe,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(ce,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Pr,"/public/references/product-file-type",!0)}}var wr=(s=>(s.Admin="admin",s.Manager="manager",s.Operator="operator",s.Client="client",s.Guest="guest",s))(wr||{});class ar extends de{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");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}}class vr extends f{getCurrentUser(){return this.get("/internal/users/info",{},r=>new ar(r.data))}}class Rr{constructor(r){t(this,"cost");t(this,"costDate");t(this,"isLowCost");t(this,"isRetail");t(this,"discountName");t(this,"priceTemplateName");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost,this.costDate=p.isString(r.costDate)?h.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new G(r.client):void 0,this.executor=r.executor?new G(r.executor):void 0,this.currency=r.currency?new he(r.currency):void 0}}class Be{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new S(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new U(e)))}}class E extends D{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(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 He{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new E(r==null?void 0:r.role),this.category=new oe(r==null?void 0:r.category),this.minCoefficient=new ce(r==null?void 0:r.minCoefficient)}}class jr extends f{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,n=void 0){let l=`${A.getConfig().http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(l+=`&category_id=${i}`),n&&(l+=`&client_id=${n}`),l}}class zr extends f{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var n;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value})}removeCategoryPrices(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}`)}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,i){return this.post(`/internal/clients/${r}/price/categories/${e}/disabled`,{comment:i})}unmarkCategoryDisabled(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/disabled`)}addCategoryManager(r,e,i){return this.post(`/internal/clients/${r}/price/categories/${e}/manager`,{manager_id:i})}removeCategoryManager(r,e){return this.delete(`/internal/clients/${r}/price/categories/${e}/manager`)}updateProductPrice(r,e,i){var n;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},o=>new z(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new z(i.data))}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,i=>new Blob([i.data],{type:"text/html"}))}getCommercialOfferPdf(r,e){return this.getBlob(`/internal/clients/${r}/price/commercial-offer/download`,e,i=>new Blob([i.request.response],{type:"application/pdf"}))}sendCommercialOffer(r,e){return this.post(`/internal/clients/${r}/price/commercial-offer/send`,e)}}class Wr extends f{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new X(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new X(e.data))}attachTemplate(r,e,i){const n=A.getConfig().dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&h.format(i.startAt,n),endAt:i.endAt&&h.format(i.endAt,n)},o=>new X(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,i,n){const o=A.getConfig().dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,n&&{startAt:n.startAt&&h.format(n.startAt,o),endAt:n.endAt&&h.format(n.endAt,o)},l=>new X(l.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class Vr extends f{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new U(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},n=>new U(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new U(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},n=>p.map(n.data,o=>new S(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return p.forEach(i,n=>n.map(o=>new we(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(l=>new U(l)))}).catch(o=>{n(o)})})}}class Fr extends f{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new S(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new S(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,i=>new we(i)))}getProductPriceHistory(r,e){const i={};return p.isNil(e)||(i.clientId=e),this.get(`/internal/price/products/${r}/history`,i,n=>p.map(n.data,o=>new Rr(o)))}publicSimpleSearch(r,e=10){return new Promise((i,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(l=>new S(l)))}).catch(o=>{n(o)})})}}class Jr extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(n=>new ge(n)))}getCategoryData(r,e,i=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:n},o=>new ge(o.data))}getCategoryProductsList(r,e,i=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:i},o=>p.map(o.data,l=>new z(l)))}}class Kr extends f{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},n=>new z(n.data))}}var $e=(s=>(s.BeginWith="bw",s.Contains="cn",s.Custom="custom",s.EndsWith="ew",s.Equals="eq",s.GreaterOrEqual="ge",s.GreaterThan="gt",s.InList="in",s.LessOrEqual="le",s.LessThan="lt",s.NotBeginWith="bn",s.NotContains="nc",s.NotEndsWith="en",s.NotEqual="ne",s.NotInList="ni",s.NotNull="nn",s.Null="nu",s))($e||{});class je{constructor(r){t(this,"field");t(this,"op");t(this,"value");this.field=(r==null?void 0:r.field)??"",this.op=(r==null?void 0:r.op)??$e.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r={field:this.field,op:this.op};return r.value=p.isDate(this.value)?h.format(this.value,A.getConfig().dateFormats.api):this.value,r}}class ee{constructor(r){t(this,"groupOp");t(this,"filters");t(this,"groups");var e,i;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(n=>new je(n)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(n=>new ee(n)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof je&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof ee?r.toPrimitive():r)}}}class me extends f{getPaginated(r,e,i,n,o,l,g){let m={page:(n==null?void 0:n.page)??1,perPage:(n==null?void 0:n.pageSize)??10};return e&&(m.filters=JSON.stringify((e instanceof ee?e:new ee(e)).toPrimitive())),p.isEmpty(i)||(m.sort=p.isArray(i)?i:[i]),o&&(m={...m,...o}),this.get(r,m,l,g)}}class Qr extends me{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new j(l)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new j(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new j(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,n=>new j(n.data),i)}removeTemplate(r){return this.delete(`/internal/price/templates/${r}`)}getProductTemplatePrices(r){return this.get(`/internal/price/templates/${r}/products`,{},e=>e.data.map(i=>new Ae(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new Ae(i.data))}saveProductTemplatePrice(r,e,i){var n;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(n=i.coefficient)==null?void 0:n.id,increase_percent:i.value},o=>new Ae(o.data))}deleteProductTemplatePrice(r,e){return this.delete(`/internal/price/templates/${r}/products/${e}`)}getCategoryTemplatePrices(r){return this.get(`/internal/price/templates/${r}/categories`,{},e=>e.data.map(i=>new Re(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new Re(i.data))}saveCategoryTemplatePrice(r,e,i,n=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=i.coefficient)==null?void 0:o.id,increase_percent:i.value},params:n?{recursively:!0}:{}},l=>new Re(l.data))}deleteCategoryTemplatePrice(r,e,i=!1){return this.request({method:"DELETE",url:`/internal/price/templates/${r}/categories/${e}`,params:i?{recursively:!0}:{}})}getTemplateClients(r){return this.get(`/internal/price/templates/${r}/clients`,{},e=>e.data.map(i=>new X(i)))}}class Yr extends f{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new E(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new E(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new E(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new E(i.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(i=>new He(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(n=>new He(n)))}}class Xr extends me{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new Z(l)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},n=>new Z(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new Z(e.data))}updateProperty(r,e){const{typeId:i,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:i},o=>new Z(o.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(i=>new V(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new V(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},n=>new V(n.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,i){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,i)}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.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(i=>new V(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new V(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},n=>new V(n.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,i){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,i)}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})}}class Zr extends f{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new Be(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new Be(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(i=>i.id),products:e.products.map(i=>i.id)})}}function ze(s,r,e){let i;return s.some(n=>{if(n.type===e&&n.id===r)return i=n,!0;if(n.type==="product")return!1;const o=n;if(o.products&&o.products.length>0){const l=ze(o.products,r,e);if(l)return i=l,!0}if(o.categories&&o.categories.length>0){const l=ze(o.categories,r,e);if(l)return i=l,!0}return!1}),i}var Dr=(s=>(s.LastOrder="last_order",s.Contacts="contacts",s.PartnerGroups="partner_groups",s.PreferredDeliveryType="preferred_delivery_type",s.SalesDirection="sales_direction",s.Managers="managers",s))(Dr||{});class Se extends q{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new he);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new he(e.currency))}}class Te extends D{constructor(e){super(e);t(this,"phone");t(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 B extends Te{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(this,"deletedAt");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,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?h.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class We extends D{constructor(e){super(e);t(this,"manager",new K);t(this,"opf",M.generatePersonItem());t(this,"salesDirection",new b);t(this,"partnerGroup",new F);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new M(e.opf),this.salesDirection=new b(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new G(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?h.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new G(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new F(e.partnerGroup)),e.manager&&(this.manager=new K(e.manager)),e.contacts){const i=[];e.contacts.forEach(n=>{i.push(new B(n))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(n=>{i.push(new Se(n))}),this.bankAccounts=i}}}}class Ar extends We{constructor(r){super(r)}}class Ve extends We{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(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 Fe extends Ve{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class $r extends Fe{constructor(e){super(e);t(this,"registrationCountry",new W);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new W(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class fe{static createInstance(r){switch(r.opf.slug){case T.Ic:return new Ve(r);case T.UlR:return new Fe(r);case T.UlNr:return new $r(r);default:return new Ar(r)}}}class be extends q{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class Sr extends B{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new be(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new be(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new be(i))))}}class ye extends ur{constructor(e){var i;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new Oe(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(n=>new B(n)))??[],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 Je extends Y{constructor(e){var i,n,o,l;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"isExcludedFromMsCallsToClients");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(g=>fe.createInstance(g)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(g=>new F(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new B(g)))??[],this.deliveryAddresses=((l=e==null?void 0:e.deliveryAddresses)==null?void 0:l.map(g=>new ye(g)))??[],this.channelPrimaryInterest=new Ue(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new Me(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new le(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class xr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"searchTerm");t(this,"cities");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",new _);t(this,"lastLoginDate",new _);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirections");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroups");t(this,"contact");t(this,"lastOrder");var e,i,n,o,l,g;this.id=r==null?void 0:r.id,this.name=r==null?void 0:r.name,this.alternativeName=r==null?void 0:r.alternativeName,this.searchTerm=r==null?void 0:r.searchTerm,this.cities=(e=r==null?void 0:r.cities)==null?void 0:e.map(m=>new De(m)),this.region=new Q(r==null?void 0:r.region),this.country=new W(r==null?void 0:r.country),this.phone=r==null?void 0:r.phone,this.email=r==null?void 0:r.email,this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt=new _(r==null?void 0:r.createdAt),this.lastLoginDate=new _(r==null?void 0:r.lastLoginDate),this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(m=>new pe(m)):[],this.salesDirections=(i=r==null?void 0:r.salesDirections)==null?void 0:i.map(m=>new b(m)),this.contragentInn=r==null?void 0:r.contragentInn,this.contragentType=new M(r==null?void 0:r.contragentType),this.preferredDeliveryType=new H(r==null?void 0:r.preferredDeliveryType),this.partnerGroups=(n=r==null?void 0:r.partnerGroups)==null?void 0:n.map(m=>new F(m)),this.contact=new Te(r==null?void 0:r.contact),this.lastOrder={createdAt:new _((o=r==null?void 0:r.lastOrder)==null?void 0:o.createdAt),creator:(l=r==null?void 0:r.lastOrder)==null?void 0:l.creator,isApproved:(g=r==null?void 0:r.lastOrder)==null?void 0:g.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"searchTerm":case"contragentInn":this[r]=void 0;break;case"cities":this.cities=[];break;case"region":this.region=new Q;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"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new M;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Te;break}return this}asClearRaw(){var e,i,n,o;const r={};return Object.keys(this).forEach(l=>{const g=this[l];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[l]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((o=r==null?void 0:r.lastLoginDate)!=null&&o.to)&&delete r.lastLoginDate,r}}class Ke extends q{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new G(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Tr extends D{constructor(e){var i,n;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");t(this,"salesDirection");t(this,"managers");(i=e.contacts)!=null&&i.length&&(this.contacts=e.contacts.map(o=>new B(o))),e.lastOrder&&(this.lastOrder=new Ke(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(o=>new F(o))),e.preferredDeliveryType&&(this.preferredDeliveryType=new H(e.preferredDeliveryType)),e.salesDirection&&(this.salesDirection=new b(e.salesDirection)),e.managers&&(this.managers=e.managers.map(o=>new K(o)))}}class br{constructor(r){t(this,"page",1);t(this,"pageSize",50);this.page=(r==null?void 0:r.page)??1,this.pageSize=(r==null?void 0:r.pageSize)??50}}class Er extends br{constructor(e){super(e);t(this,"itemCount",0);t(this,"pageCount",1);t(this,"pageSlot",5);t(this,"pageSizes",[25,50,100]);t(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 et{constructor(r){t(this,"field");t(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class rt extends me{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Je(e.data))}getClientsList(r,e,i,n){return this.getPaginated("/internal/clients",r,e,i,n,o=>{const l={...o.data};return l.data=l.data.map(g=>new Y(g)),l})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:$e.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(n=>n.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},n=>{let o=[];return(n==null?void 0:n.data.length)>0&&(o=n.data.map(l=>new Tr(l))),o})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let i=[];return(e==null?void 0:e.data.length)>0&&(i=e.data.map(n=>new Sr(n))),i})}createClientCommonData(r,e={}){var i;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id},n=>new Je(n.data),e)}updateClientCommonData(r,e={}){var i;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.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,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id},void 0,e)}changeClientPassword(r,e,i,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},void 0,n)}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 i=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(i)}createContragentClientData(r,e,i={}){var m,v,$,L,O,k,N,d;let n;const o=e,l=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,manager_id:(v=o.manager)==null?void 0:v.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case T.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:($=l.partnerGroup)==null?void 0:$.id,manager_id:(L=l.manager)==null?void 0:L.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(O=g.partnerGroup)==null?void 0:O.id,manager_id:(k=g.manager)==null?void 0:k.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(N=e.partnerGroup)==null?void 0:N.id,manager_id:(d=e.manager)==null?void 0:d.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,J=>fe.createInstance(J.data),i)}updateContragentClientData(r,e,i={}){var m,v,$,L,O,k,N,d;let n;const o=e,l=e,g=e;switch(e.opf.slug){case T.Ic:n={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(m=o.partnerGroup)==null?void 0:m.id,manager_id:(v=o.manager)==null?void 0:v.id,comment:o.comment,inn:o.inn,okpo:o.okpo,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};break;case T.UlR:n={opf:l.opf.slug,name:l.name,alternative_name:l.alternativeName,partner_group_id:($=l.partnerGroup)==null?void 0:$.id,manager_id:(L=l.manager)==null?void 0:L.id,comment:l.comment,inn:l.inn,kpp:l.kpp,okpo:l.okpo,director_name:l.directorName,director_position:l.directorPosition,director_acts_on:l.directorActsOn,legal_address:l.legalAddress,postal_address:l.postalAddress,actual_address:l.actualAddress};break;case T.UlNr:n={opf:g.opf.slug,name:g.name,alternative_name:g.alternativeName,partner_group_id:(O=g.partnerGroup)==null?void 0:O.id,manager_id:(k=g.manager)==null?void 0:k.id,comment:g.comment,director_name:g.directorName,director_position:g.directorPosition,director_acts_on:g.directorActsOn,legal_address:g.legalAddress,postal_address:g.postalAddress,actual_address:g.actualAddress,registration_country_id:g.registrationCountry.id,registration_number:g.registrationNumber,tax_number:g.taxNumber||void 0};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(N=e.partnerGroup)==null?void 0:N.id,manager_id:(d=e.manager)==null?void 0:d.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,J=>fe.createInstance(J.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,g=>new ye(g.data),i)}updateClientDeliveryAddress(r,e,i={}){var o,l;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(o=e.coordinates)==null?void 0:o.lat,long:(l=e.coordinates)==null?void 0:l.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,g=>new ye(g.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},o=>new Se(o.data),n)}updateContragentBankAccount(r,e,i,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,{bank_name:i.bankName,bic:i.bic,account_number:i.accountNumber,correspondent_account:i.correspondentAccount,currency_id:i.currency.id},o=>new Se(o.data),n)}deleteContragentBankAccount(r,e,i){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`)}createClientContact(r,e,i={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},i)}updateClientContact(r,e,i={}){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},n=>new B(n.data),i)}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,i,n={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}setPrimaryContragentContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachContragentContact(r,e,i){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${i.id}/detach`)}createDeliveryAddressContact(r,e,i,n={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},n)}setPrimaryDeliveryAddressContact(r,e,i){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/primary`,i.isPrimary??!1)}detachDeliveryAddressContact(r,e,i){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${i.id}/detach`)}createContact(r,e,i,n={}){var l,g;const o={name:e.name,position:e.position,comment:e.comment,...i};return(l=e.phone)!=null&&l.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,m=>new B(m.data),n)}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 tt extends f{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(i)})}}class it extends f{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,i={}){var o;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.editor}/product`,{params:e},l=>new S(l.data));return n.catch(l=>{this.defaultInstanceNotificationErrorResponseHandler(l,i)}),n}createTemplate(r,e,i={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},i)}removeTemplate(r,e){var i;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.editor}/template/${e}`)}}class nt{static defaultDateRanges(){const r=h.addBusinessDays(new Date,1);return{nextWorkingDay:{label:"Следующий рабочий день",from:h.startOfDay(r),to:h.endOfDay(r)},today:{label:"Сегодня",from:h.startOfToday(),to:h.endOfToday()},yesterday:{label:"Вчера",from:h.startOfYesterday(),to:h.endOfYesterday()},tomorrow:{label:"Завтра",from:h.startOfTomorrow(),to:h.endOfTomorrow()}}}}const ie=class ie{static setLinearValues(r){ie.linearValues=r}static productIsMeasurable(r){return ie.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!ie.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};t(ie,"linearValues",["пог.м.","м.","м2"]);let Qe=ie;class st{static generateUndefinedManagerInstance(){return new pe({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Ir extends x{async getManagers(){const r="/internal/managers",e=x.getCachedResponse(r);if(e)return e;const n=(await this.get(r)).data.map(o=>ae.instanceInitializer(pe,o));return this.cacheResponse(r,n),n}}class Ye extends Ke{constructor(e){var i,n,o,l,g,m,v,$;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new Y(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((l=e==null?void 0:e.delivery)==null?void 0:l.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?h.parseISO(e.delivery.date):((m=e==null?void 0:e.delivery)==null?void 0:m.date)??new Date,address:(v=e==null?void 0:e.delivery)!=null&&v.address?new ye(e.delivery.address):void 0,warehouse:($=e==null?void 0:e.delivery)!=null&&$.warehouse?new le(e.delivery.warehouse):void 0},this.attachedUser=new G(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new b(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?h.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?h.parseISO(e.processedAt):e==null?void 0:e.processedAt,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class _r extends q{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class Lr extends Ye{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(i=>new _r(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?fe.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new P(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class ot extends me{getOrders(r,e,i){return this.getPaginated("/internal/orders",r,e?[e]:void 0,i,{},n=>{const o={...n.data};return o.data=o.data.map(l=>new Ye(l)),o})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Lr(e.data))}}class Ie{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new Y(r==null?void 0:r.client),this.product=new S(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)??ve.Product}}const Xe=s=>{var r,e,i,n,o;return s?p.omitBy({cities:(r=s.cities)==null?void 0:r.map(l=>l.id),clients:(e=s.clients)==null?void 0:e.map(l=>l.id),managers:(i=s.managers)==null?void 0:i.map(l=>l.id),partnerGroups:(n=s.partnerGroups)==null?void 0:n.map(l=>l.id),salesDirections:(o=s.salesDirections)==null?void 0:o.map(l=>l.id),hideNotActive:s.hideNotActive},l=>p.isNil(l)||(p.isArray(l)||p.isObject(l))&&p.isEmpty(l)):{}},Or=s=>{const r={};return s.from&&(s.from.coefficient||s.from.value)&&(r.from={},s.from.coefficient&&(r.from.priceCoefficientId=s.from.coefficient.id),s.from.value&&(r.from.increasePercent=s.from.value)),s.to&&(s.to.coefficient||s.to.value)&&(r.to={},s.to.coefficient&&(r.to.priceCoefficientId=s.to.coefficient.id),s.to.value&&(r.to.increasePercent=s.to.value)),r};class ct extends f{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{...Or(e),filters:Xe(i)},n=>n.data.map(o=>new Ie(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{...Or(e),filters:Xe(i)},n=>n.data.map(o=>new Ie(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:Xe(i)},n=>n.data.map(o=>new Ie(o)))}}class kr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Ze{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new Ge(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(i=>new kr(i)))??[]}}class lt extends f{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new Ze(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new Ze(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const a=Ce.defineStore("__references_private",()=>{const s=y.ref({}),r=y.ref(void 0),e=y.ref(void 0),i=y.ref(void 0),n=y.ref(void 0),o=y.ref(void 0),l=y.ref(void 0),g=y.ref(void 0),m=y.ref(void 0),v=y.ref(void 0),$=y.ref(void 0),L=y.ref(void 0),O=y.ref(void 0),k=y.ref(void 0),N=y.ref(void 0),d=y.ref(void 0),J=y.ref(void 0),u=y.ref(void 0);return{dataLoaderList:s,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:n,managersList:o,opfReference:l,orderPaymentStatusReference:g,orderStatusReference:m,paymentTypeReference:v,partnerGroupReference:$,productFileTypeReference:L,resourceTypesReference:O,salesDirectionsReference:k,sourcePrimaryInterestReference:N,warehousesReference:d,propertyTypesReference:J,priceCoefficientsReference:u}}),ut=Ce.defineStore("references",()=>{const s=y.computed(()=>{const u=a();return!u.channelPrimaryInterestReference&&!u.dataLoaderList.channelPrimaryInterestReference&&(u.dataLoaderList.channelPrimaryInterestReference=!0,f.getInstance(w).getChannelPrimaryInterest().then(C=>{u.channelPrimaryInterestReference=C}).catch(p.noop)),u.channelPrimaryInterestReference}),r=y.computed(()=>{const u=a();return!u.contactPositionsReference&&!u.dataLoaderList.contactPositionsReference&&(u.dataLoaderList.contactPositionsReference=!0,f.getInstance(w).getContactPositions().then(C=>{u.contactPositionsReference=C}).catch(p.noop)),u.contactPositionsReference}),e=y.computed(()=>{const u=a();return!u.currencyReference&&!u.dataLoaderList.currencyReference&&(u.dataLoaderList.currencyReference=!0,f.getInstance(w).getCurrency().then(C=>{u.currencyReference=C}).catch(p.noop)),u.currencyReference}),i=y.computed(()=>{const u=a();return!u.opfReference&&!u.dataLoaderList.opfReference&&(u.dataLoaderList.opfReference=!0,f.getInstance(w).getOpf().then(C=>{u.opfReference=C}).catch(p.noop)),u.opfReference}),n=y.computed(()=>{const u=a();return!u.orderPaymentStatusReference&&!u.dataLoaderList.orderPaymentStatusReference&&(u.dataLoaderList.orderPaymentStatusReference=!0,f.getInstance(w).getOrderPaymentStatuses().then(C=>{u.orderPaymentStatusReference=C}).catch(p.noop)),u.orderPaymentStatusReference}),o=y.computed(()=>{const u=a();return!u.orderStatusReference&&!u.dataLoaderList.orderStatusReference&&(u.dataLoaderList.orderStatusReference=!0,f.getInstance(w).getOrderStatuses().then(C=>{u.orderStatusReference=C}).catch(p.noop)),u.orderStatusReference}),l=y.computed(()=>{const u=a();return!u.paymentTypeReference&&!u.dataLoaderList.paymentTypeReference&&(u.dataLoaderList.paymentTypeReference=!0,f.getInstance(w).getPaymentTypes().then(C=>{u.paymentTypeReference=C}).catch(p.noop)),u.paymentTypeReference}),g=y.computed(()=>{const u=a();return!u.partnerGroupReference&&!u.dataLoaderList.partnerGroupReference&&(u.dataLoaderList.partnerGroupReference=!0,f.getInstance(w).getPartnerGroup().then(C=>{u.partnerGroupReference=C}).catch(p.noop)),u.partnerGroupReference}),m=y.computed(()=>{const u=a();return!u.productFileTypeReference&&!u.dataLoaderList.productFileTypeReference&&(u.dataLoaderList.productFileTypeReference=!0,f.getInstance(w).getProductFileType().then(C=>{u.productFileTypeReference=C}).catch(p.noop)),u.productFileTypeReference}),v=y.computed(()=>{const u=a();return!u.resourceTypesReference&&!u.dataLoaderList.resourceTypesReference&&(u.dataLoaderList.resourceTypesReference=!0,f.getInstance(w).getResourceTypes().then(C=>{u.resourceTypesReference=C}).catch(p.noop)),u.resourceTypesReference}),$=y.computed(()=>{const u=a();return!u.salesDirectionsReference&&!u.dataLoaderList.salesDirectionsReference&&(u.dataLoaderList.salesDirectionsReference=!0,f.getInstance(w).getSalesDirections().then(C=>{u.salesDirectionsReference=C}).catch(p.noop)),u.salesDirectionsReference}),L=y.computed(()=>{const u=a();return!u.sourcePrimaryInterestReference&&!u.dataLoaderList.sourcePrimaryInterestReference&&(u.dataLoaderList.sourcePrimaryInterestReference=!0,f.getInstance(w).getSourcePrimaryInterest().then(C=>{u.sourcePrimaryInterestReference=C}).catch(p.noop)),u.sourcePrimaryInterestReference}),O=y.computed(()=>{const u=a();return!u.deliveryTypeReference&&!u.dataLoaderList.deliveryTypeReference&&(u.dataLoaderList.deliveryTypeReference=!0,f.getInstance(w).getDeliveryTypes().then(C=>{u.deliveryTypeReference=C}).catch(p.noop)),u.deliveryTypeReference}),k=y.computed(()=>{const u=a();return!u.managersList&&!u.dataLoaderList.managersList&&(u.dataLoaderList.managersList=!0,f.getInstance(Ir).getManagers().then(C=>{u.managersList=C}).catch(p.noop)),u.managersList}),N=y.computed(()=>{const u=a();return!u.warehousesReference&&!u.dataLoaderList.warehousesReference&&(u.dataLoaderList.warehousesReference=!0,f.getInstance(w).getWarehouses().then(C=>{u.warehousesReference=C}).catch(p.noop)),u.warehousesReference}),d=y.computed(()=>{const u=a();return!u.propertyTypesReference&&!u.dataLoaderList.propertyTypesReference&&(u.dataLoaderList.propertyTypesReference=!0,f.getInstance(w).getPropertyTypes().then(C=>{u.propertyTypesReference=C}).catch(p.noop)),u.propertyTypesReference}),J=y.computed(()=>{const u=a();return!u.priceCoefficientsReference&&!u.dataLoaderList.priceCoefficientsReference&&(u.dataLoaderList.priceCoefficientsReference=!0,f.getInstance(w).getPriceCoefficients().then(C=>{u.priceCoefficientsReference=C}).catch(p.noop)),u.priceCoefficientsReference});return{channelPrimaryInterestsReference:s,contactPositionsReference:r,currencyReference:e,opfReference:i,orderPaymentStatusReference:n,orderStatusReference:o,paymentTypeReference:l,partnerGroupsReference:g,productFilesTypesReference:m,resourceTypesReference:v,salesDirectionsReference:$,sourcePrimaryInterestsReference:L,deliveryTypeReference:O,managersList:k,warehousesReference:N,propertyTypesReference:d,priceCoefficientsReference:J}}),pt=Ce.defineStore("__user_state_private",()=>{const s=y.ref({}),r=y.ref(void 0);return{dataLoaderList:s,currentUser:r}}),gt=Ce.defineStore("user_state",()=>({currentUser:y.computed(()=>{const r=pt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,f.getInstance(vr).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(p.noop)),r.currentUser})}));class ht extends f{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(i=>{const n=[...i];let o=1;return n.forEach(l=>{l.id=o++}),n})}}class mt{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=hr,c.AppBaseConfig=qr,c.AppConfigProvider=A,c.BankAccount=Se,c.BasePaginationProvider=me,c.CalculationTypeEnum=cr,c.Cart=ue,c.CartItem=tr,c.CartItemBase=rr,c.CartProvider=Ur,c.CatalogProvider=jr,c.CatalogableItem=_e,c.Category=U,c.CategoryPricingRule=He,c.ChannelPrimaryInterest=Ue,c.City=Hr,c.CityWithRegionAndCountry=De,c.Client=Je,c.ClientAdditionalData=Tr,c.ClientCategory=ge,c.ClientDataProvider=rt,c.ClientPriceProvider=zr,c.ClientPriceTemplateProvider=Wr,c.ClientProduct=z,c.ClientProductCategoryDataProvider=Jr,c.ClientProductDataProvider=Kr,c.ClientShortInfo=Y,c.ClientsAdditionalDataRequestTypeEnum=Dr,c.ClientsListFilters=xr,c.ConfiguratorProvider=it,c.Contact=Te,c.ContactLinks=gr,c.ContactPerson=B,c.ContactPersonRelated=Sr,c.ContactPosition=mr,c.ContactRelation=be,c.ContragentBase=We,c.ContragentFactory=fe,c.ContragentIc=Ve,c.ContragentPerson=Ar,c.ContragentUlNr=$r,c.ContragentUlR=Fe,c.CostSourceEnum=ve,c.Country=W,c.Currency=he,c.DataSuggestionProvider=ht,c.DataTablePagination=Er,c.DataTablePaginationRequestParams=br,c.DataTableSortRequestParams=et,c.DateTimeProvider=nt,c.DeletableNamedIdentity=ur,c.DeliveryAddress=ye,c.DeliveryType=H,c.DetailedJwtPayload=dr,c.DeviceTypeResolutionConfig=ir,c.DiscountShortInfo=pr,c.FieldValidationResultData=mt,c.FilterGroup=ee,c.FilterItem=je,c.FilterOpEnum=$e,c.GeoCoordinates=Oe,c.HiddenCatalogableItem=Ee,c.HttpCachedRequester=x,c.HttpParamsConfig=nr,c.HttpRequester=f,c.Identity=q,c.Image=er,c.JwtPayload=se,c.Manager=pe,c.ManagerCommon=K,c.ManagerDataFactory=st,c.ManagerDataProvider=Ir,c.MetaTagItem=kr,c.NamedIdentity=D,c.Opf=M,c.OpfEnum=T,c.Order=Lr,c.OrderInfo=Ye,c.OrderPaymentStatus=fr,c.OrderProduct=_r,c.OrderShortInfo=Ke,c.OrderStatus=yr,c.OrdersDataProvider=ot,c.PartnerGroup=F,c.PaymentType=Cr,c.PreferencesStorageProvider=Gr,c.PriceAnalyze=Ie,c.PriceAnalyzeProvider=ct,c.PriceCoefficient=ce,c.PriceCoefficientEnum=Le,c.PriceTemplate=j,c.PriceTemplateCategory=Re,c.PriceTemplateClient=X,c.PriceTemplateICatalogableItem=Ne,c.PriceTemplateProduct=Ae,c.PriceTemplateProvider=Qr,c.PricingRole=E,c.PricingRoleProvider=Yr,c.PrimaryCatalogableItem=Pe,c.Product=S,c.ProductCategoryDataProvider=Vr,c.ProductDataProvider=Fr,c.ProductFileType=Pr,c.ProductPriceCoefficient=we,c.ProductPriceHistory=Rr,c.PropertiesProvider=Xr,c.Property=Z,c.PropertyType=qe,c.PropertyTypeEnum=lr,c.PropertyValue=V,c.RecommendationsDataProvider=Zr,c.RecommendationsList=Be,c.Reference=P,c.ReferenceDataProvider=w,c.Region=Q,c.ResourceType=Ge,c.SalesDirection=b,c.SentryConfig=sr,c.Seo=Ze,c.SeoDataProvider=lt,c.SourcePrimaryInterest=Me,c.StockCount=xe,c.TemplatesListFilters=Br,c.TypedInstanceFactory=ae,c.UnitsHelper=Qe,c.UnknownClientDataProvider=tt,c.UpdatableNamedIdentity=ke,c.User=ar,c.UserCommonInfo=de,c.UserDataProvider=vr,c.UserShortInfo=G,c.UserTypeEnum=wr,c.VersionConfig=or,c.Warehouse=le,c.findCatalogItemByIdRecursive=ze,c.useReferencesStore=ut,c.useUserStateStore=gt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=sc-common-lib.umd.cjs.map