@snabcentr/common-lib 1.93.0 → 1.94.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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +2 -2
- package/dist/sc-common-lib.js +1287 -1207
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/catalog/classes/category-filter-value.d.ts +21 -0
- package/dist/src/catalog/classes/category-filter-value.d.ts.map +1 -0
- package/dist/src/catalog/classes/category-filter.d.ts +50 -0
- package/dist/src/catalog/classes/category-filter.d.ts.map +1 -0
- package/dist/src/catalog/classes/index.d.ts +2 -0
- package/dist/src/catalog/classes/index.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-category-filter-value.d.ts +14 -0
- package/dist/src/catalog/interfaces/i-category-filter-value.d.ts.map +1 -0
- package/dist/src/catalog/interfaces/i-category-filter.d.ts +40 -0
- package/dist/src/catalog/interfaces/i-category-filter.d.ts.map +1 -0
- package/dist/src/catalog/interfaces/index.d.ts +2 -0
- package/dist/src/catalog/interfaces/index.d.ts.map +1 -1
- package/dist/src/catalog/providers/properties-provider.d.ts +13 -4
- package/dist/src/catalog/providers/properties-provider.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],O):(c=typeof globalThis<"u"?globalThis:c||self,O(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,O,p,le,W,m,l,yr){"use strict";var Yt=Object.defineProperty;var jt=(c,O,p)=>O in c?Yt(c,O,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[O]=p;var i=(c,O,p)=>jt(c,typeof O!="symbol"?O+"":O,p);class U{constructor(r){i(this,"exp",0);i(this,"iat",0);i(this,"authTime",0);i(this,"jti","");i(this,"iss","");i(this,"aud",[]);i(this,"sub","");i(this,"typ","Bearer");i(this,"azp","");i(this,"sid","");i(this,"acr","");i(this,"allowedOrigins",[]);i(this,"realmAccess",{roles:[]});i(this,"resourceAccess",{});i(this,"scope","");i(this,"emailVerified",!1);i(this,"name","");i(this,"guid","");i(this,"preferredUsername","");i(this,"givenName","");i(this,"email","");p.merge(this,r)}static getJwtPayload(r){const e=O.jwtDecode(r),t=new U(le.objectToCamel(e));return t.resourceAccess=e.resource_access,t}}class Fr extends U{constructor(e){super(e);i(this,"familyName");i(this,"middleName");i(this,"locale");i(this,"phoneNumber");i(this,"phoneNumberVerified");i(this,"address");p.merge(this,e)}static getJwtPayload(e){return new U(le.objectToCamel(O.jwtDecode(e)))}}class ar{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 Cr{constructor(r){i(this,"portalApiUrl");i(this,"mediaUrl");i(this,"responseDataCacheTimeout");this.portalApiUrl=(r==null?void 0:r.portalApiUrl)??"",this.mediaUrl=(r==null?void 0:r.mediaUrl)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class vr{constructor(r){i(this,"dsn");i(this,"environment");i(this,"ignoreErrors");i(this,"trace");i(this,"replay");i(this,"additionalParams");var e,t,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((t=r==null?void 0:r.trace)==null?void 0:t.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class wr{constructor(r){i(this,"broadcaster");i(this,"key");i(this,"wsHost");i(this,"wsPort");i(this,"wssPort");i(this,"forceTLS");i(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Dr{constructor(r){i(this,"environment");i(this,"devMode");i(this,"http");i(this,"deviceTypeByResolution");i(this,"sentry");i(this,"tableDefaultHeightCoefficient");i(this,"urls");i(this,"websocket");i(this,"dateFormats");var e,t,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new Cr(r==null?void 0:r.http),this.deviceTypeByResolution=new ar(r==null?void 0:r.deviceTypeByResolution),this.sentry=new vr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new wr(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((t=r==null?void 0:r.dateFormats)==null?void 0:t.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const k=W.defineStore("common.config",()=>{const n=m.ref(new Dr);return{config:n,getConfig:()=>n.value,setConfig:t=>{n.value=p.merge(n.value,t)}}});class ue{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const t=JSON.parse(e);if(!t.availableFor||l.isAfter(l.parseISO(t.availableFor)||l.startOfToday(),new Date)){if(p.isNil(t.data)||p.isEmpty(t.data))throw new Error("Data is empty");return t.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,t){if(this.isLocalStorageAvailable())try{if(p.isNil(e)||p.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:t,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t)try{const s=localStorage.getItem(t);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(t)}}catch{r.push(t)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Pr(n){try{const r=U.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const X=W.defineStore("common.auth_state_private",()=>{const n=m.ref((()=>{var g;const o=ue.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const u=(g=k().config.devMode)==null?void 0:g.initAuthBearerToken;return u?Promise.resolve(u):void 0})()),r=m.ref(void 0),e=m.ref(void 0),t=m.markRaw(new Map);function s(){e.value=void 0,p.isNil(n.value)||n.value.then(o=>{const u=U.getJwtPayload(o);e.value=u.exp*1e3>Date.now()?p.mapValues(u.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(p.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:t,recalculateUserPermissions:s}}),we=W.defineStore("common.auth_state",()=>{const n=m.computed(()=>{const o=X();if(p.isNil(o.jwtToken)&&!p.isNil(o.jwtTokenUpdater)){const u=o.jwtTokenUpdater();o.jwtToken=u,u.then(g=>{o.jwtToken=Promise.resolve(g),ue.saveActualDataToStorage("sc.token",g,Pr(g)),o.recalculateUserPermissions()}).catch(p.noop)}return o.jwtToken});function r(o){X().jwtTokenUpdater=o}function e(o){const u=X();u.jwtToken=Promise.resolve(o),ue.saveActualDataToStorage("sc.token",o,Pr(o)),u.recalculateUserPermissions()}function t(){const o=X();o.jwtToken=void 0,o.userPermissions=void 0,ue.saveActualDataToStorage("sc.token",void 0)}function s(o){const u=X();!p.isNil(u.jwtToken)&&p.isNil(u.userPermissions)&&u.jwtToken.then(a=>{const C=U.getJwtPayload(a);u.userPermissions=C.exp*1e3>Date.now()?p.mapValues(C.resourceAccess,P=>(P==null?void 0:P.roles)??[]):void 0}).catch(p.noop);const g=p.isArray(o)?o.join(" && "):o;if(u.userPermissionsComputedRefs.has(g))return u.userPermissionsComputedRefs.get(g);const f=m.computed(()=>{const a=C=>{var ce;const P=p.split(C,".");if(P.length<2)return!1;const[Ce,ve]=P,oe=(ce=X().userPermissions)==null?void 0:ce[Ce];return p.isArray(oe)&&oe.includes(ve)};return p.isArray(o)?p.every(o,C=>a(C)):a(o)});return u.userPermissionsComputedRefs.set(g,f),f}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:t,hasUserPermission:s}});class G{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 b extends G{constructor(e){super(e);i(this,"name","");this.name=(e==null?void 0:e.name)??""}}class $ extends b{constructor(e){super(e);i(this,"type");this.type=e==null?void 0:e.type}}class Rr extends b{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)?l.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 $(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class _e extends b{constructor(e){super(e);i(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class z extends _e{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)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}var Me=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(Me||{});class D extends b{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 pe extends D{static getRetailPriceCoefficient(){return{id:-2,slug:Me.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class De{constructor(r){i(this,"coefficient");i(this,"value");i(this,"cost");i(this,"percent");i(this,"readOnly");this.coefficient=new pe(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 Ue{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 q extends D{}class Z extends D{constructor(e){var t;super(e);i(this,"address");i(this,"isMain");i(this,"deliveryTypes");i(this,"regions");i(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((t=e==null?void 0:e.deliveryTypes)==null?void 0:t.map(s=>new q(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Ue(e==null?void 0:e.coordinates)}}class Sr{constructor(r){i(this,"warehouse");i(this,"count");this.warehouse=new Z(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class L extends b{constructor(e){super(e);i(this,"signature","");i(this,"code");i(this,"symbol","");i(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class He extends b{constructor(e){super(e);i(this,"slug","");i(this,"description");i(this,"isSquare",!1);i(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class E extends b{constructor(e){super(e);i(this,"code","");this.code=(e==null?void 0:e.code)??""}}class Be extends E{constructor(e){super(e);i(this,"slug");i(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class Tr extends Be{constructor(e){super(e);i(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ar{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 Pe extends Be{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class I extends Tr{constructor(e){var s,o,u,g;super(e);i(this,"supplierSku");i(this,"unit");i(this,"pack");i(this,"minCount");i(this,"currency");i(this,"cost");i(this,"costRub");i(this,"costDate");i(this,"onOrder");i(this,"stockCount");i(this,"category");i(this,"categories");i(this,"images");i(this,"properties");i(this,"retailCost");i(this,"retailCostRub");i(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=e!=null&&e.unit?new He(e.unit):new He,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new L(e.currency):new L,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)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(f=>new Sr(f)))??[],this.type="product";const t=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(f=>f.isPrimary));t&&(this.category=new Pe({...t,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(f=>new Pe(f))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(f=>new Ar(f,k().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(f=>new De(f)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Re=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Re||{});class H extends I{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)??Re.Product,this.discount=e!=null&&e.discount?new Rr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new z(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 F extends Pe{constructor(e){super(e);i(this,"isHidden");i(this,"parentCategoryId");i(this,"properties");i(this,"currencyRates");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category",this.currencyRates=e!=null&&e.currencyRates?Object.fromEntries(Object.entries(e.currencyRates).map(([t,s])=>[p.toUpper(t),s])):void 0}}class Ye extends G{constructor(e){super(e);i(this,"category");i(this,"product");i(this,"quantity");i(this,"currency");i(this,"marker");i(this,"height");i(this,"length");i(this,"width");i(this,"configurator");i(this,"configuratorParams");i(this,"isAdditionalSale");i(this,"creatorUser");this.product=new H(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new F,this.currency=e.currency?new L(e.currency):void 0,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,this.creatorUser=e.creatorUser&&new $(e.creatorUser)}}let et=class extends Ye{constructor(e){super(e);i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new L(e.currency)}};class he{constructor(r){i(this,"items");i(this,"resultSum");i(this,"directionsSum");this.items=r.items.map(e=>new et(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Se{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const R=class R{constructor(){i(this,"httpClient");i(this,"baseUrl",`${k().config.http.portalApiUrl}/api`);i(this,"errorResponseHandler",p.noop);i(this,"interceptorIds",{request:{},response:{}});i(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));i(this,"authRequestInterceptor",async r=>{let e;return p.isNil(we().jwtToken)||(e=await we().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});i(this,"userRequestHooksInterceptor",async r=>R.requestHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=le.objectToSnake(r.params)),["put","patch","post"].includes(p.toLower(r.method))&&r.data&&(r.data=le.objectToSnake(r.data))),r));i(this,"authErrorsResponseInterceptors",r=>{var t;const e=r.rawError?(t=r.rawError)==null?void 0:t.config:void 0;return r.status===401?!e||e.__isRetryRequest?Promise.reject(r):(we().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});i(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new yr.CanceledError("Request canceled");return Promise.reject(r)});i(this,"userResponseHooksInterceptor",async r=>R.responseHooks.reduce(async(e,t)=>t(await e),Promise.resolve(r)));i(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=le.objectToCamel(r.data)),r));this.errorResponseHandler=R.defaultErrorsResponseHandler,this.httpClient=yr.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>R.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){R.defaultErrorsResponseHandler=r}static addRequestHook(r){R.requestHooks.includes(r)||R.requestHooks.push(r)}static removeRequestHook(r){const e=R.requestHooks.indexOf(r);e!==-1&&R.requestHooks.splice(e,1)}static addResponseHook(r){R.responseHooks.includes(r)||R.responseHooks.push(r)}static removeResponseHook(r){const e=R.responseHooks.indexOf(r);e!==-1&&R.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(R.instances,r.name)||(R.instances[r.name]=Se.simpleInstanceInitializer(r)),R.instances[r.name]}static convertHttpErrorResponse(r){var e,t;if(p.isNil(r)||!p.isNil(r.request)||!p.isNil(r.response)){const s=p.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(t=s==null?void 0:s.data)==null?void 0:t.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,t={},s=!1){const o=this.httpClient.request(r).then(u=>e?e(u):u.data);return o.catch(u=>{(u==null?void 0:u.name)!=="CanceledError"&&this.errorResponseHandler(u,t,s)}),o}get(r,e={},t=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},t,{},s)}getBlob(r,e={},t=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},t,{},s)}patch(r,e={},t=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},t,s,o)}post(r,e={},t=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},t,s,o)}delete(r,e=void 0,t=!1){return this.request({method:"DELETE",url:r},e,{},t)}};i(R,"instances",{}),i(R,"defaultErrorsResponseHandler",p.noop),i(R,"requestHooks",[]),i(R,"responseHooks",[]);let y=R;class rt extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new he(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new he(s.data),t)}patchCartItem(r,e,t={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new he(s.data),t)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,t=>new he(t.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var br=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(br||{}),Or=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(Or||{}),kr=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(kr||{});class _ extends F{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new _(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new I(o))}}class je{constructor(r){i(this,"phone");i(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class d extends D{}class Te extends b{constructor(e){super(e);i(this,"salesDirection");i(this,"photo");i(this,"contacts");i(this,"isDefault");i(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new d(e.salesDirection):new d,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new je(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class Ae extends D{}class We extends b{constructor(e){super(e);i(this,"description");i(this,"canChangeLowCost");i(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class ee extends Te{constructor(e){var t;super(e);i(this,"isActive");i(this,"isSupervisor");i(this,"canDoReclamations");i(this,"createdAt");i(this,"supervisorId");i(this,"pricingRole");i(this,"curatedDirections");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,this.pricingRole=e!=null&&e.pricingRole?new We(e.pricingRole):void 0,this.curatedDirections=((t=e==null?void 0:e.curatedDirections)==null?void 0:t.map(s=>new Ae(s)))??[]}}class tt extends F{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 ee(e.manager):void 0}}class ge extends tt{constructor(e){var t,s;super(e);i(this,"categories");i(this,"products");this.categories=(t=e==null?void 0:e.categories)==null?void 0:t.map(o=>new ge(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new H(o))}}class Ge{constructor(r){i(this,"priceCoefficient");i(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new pe(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class be extends Ge{constructor(e){super(e);i(this,"productCategory");this.productCategory=new F(e==null?void 0:e.productCategory)}}class Oe extends b{constructor(e){super(e);i(this,"photo");i(this,"contacts");i(this,"curatedDirection");this.photo=e.photo,this.contacts=new je(e.contacts),this.curatedDirection=new Ae(e.curatedDirection)}}class Q extends D{}class re extends D{constructor(e){super(e);i(this,"country",new Q);e&&(this.country=new Q(e.country))}}class fe extends D{constructor(e){super(e);i(this,"region",new re);e&&(this.region=new re(e.region))}}class ze extends b{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 d(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class J extends ze{constructor(e){var t,s;super(e);i(this,"salesDirection");i(this,"debt");i(this,"alternativeName");i(this,"city");i(this,"comment");i(this,"isPhoneApproved");i(this,"isEmailApproved");i(this,"managers");i(this,"curators");this.salesDirection=new d(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 fe(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((t=e==null?void 0:e.managers)==null?void 0:t.map(o=>new Te(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Oe(o)))??void 0}}class te extends G{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)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new J(e==null?void 0:e.client),this.priceTemplate=new z(e==null?void 0:e.priceTemplate)}}class ke extends Ge{constructor(e){super(e);i(this,"product");this.product=new I(e==null?void 0:e.product)}}class Qe extends D{}class V extends b{constructor(e){super(e);i(this,"type");i(this,"description");i(this,"metadata");i(this,"isFilterable");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,this.isFilterable=e==null?void 0:e.isFilterable}}class x{constructor(r){i(this,"property");i(this,"value");this.property=new V(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class S{constructor(r){i(this,"from");i(this,"to");this.from=p.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class it{constructor(r){i(this,"id");i(this,"name");i(this,"description");i(this,"createdAt",new S);i(this,"updatedAt",new S);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 S(r==null?void 0:r.createdAt),this.updatedAt=new S(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,s,o;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((t=r==null?void 0:r.createdAt)!=null&&t.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class ie extends b{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 Je{constructor(r){i(this,"role");i(this,"category");i(this,"minCoefficient");this.role=new ie(r==null?void 0:r.role),this.category=new F(r==null?void 0:r.category),this.minCoefficient=new pe(r==null?void 0:r.minCoefficient)}}class Ir{constructor(r){i(this,"isFake");i(this,"isHidden");i(this,"isMultiple");i(this,"type");i(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class Ve{constructor(r){i(this,"category");i(this,"property");i(this,"settings");this.category=new F(r==null?void 0:r.category),this.property=new V(r==null?void 0:r.property),this.settings=new Ir(r==null?void 0:r.settings)}}class st extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,t=void 0,s=void 0){let u=`${k().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return t&&(u+=`&category_id=${t}`),s&&(u+=`&client_id=${s}`),u}}class nt extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,t){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.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 s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new H(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,t=>new H(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 ot extends y{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(t=>new te(t)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new te(e.data),!0)}attachTemplate(r,e,t){const s=k().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,t&&{startAt:t.startAt&&l.format(t.startAt,s),endAt:t.endAt&&l.format(t.endAt,s)},o=>new te(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,t,s){const o=k().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${t}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},u=>new te(u.data))}detachTemplate(r,e,t){return this.delete(`/internal/clients/${r}/price/templates/${e}/${t}`)}}class ct extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(t=>new _(t)))}getCategoryData(r,e=!1,t=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:t},s=>new _(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new _(e.data))}getCategoryProductsList(r,e=!0,t=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:t,withPriceCoefficients:e},s=>p.map(s.data,o=>new I(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:t}=e;return p.forEach(t,s=>s.map(o=>new De(o))),t})}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.categories.map(u=>new _(u)))}).catch(o=>{s(o)})})}}class lt extends y{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},t=>new I(t.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new I(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,t=>new De(t)))}publicSimpleSearch(r,e=10){return new Promise((t,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{t(o.products.map(u=>new I(u)))}).catch(o=>{s(o)})})}}class ut extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},t=>t.data.map(s=>new ge(s)))}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:t,withNestedCategories:s},o=>new ge(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new H(u)))}}class pt extends y{getProductData(r,e,t=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:t},s=>new H(s.data))}}var Ie=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(Ie||{});class xe{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)??Ie.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=k().config.dateFormats.api,e={field:this.field,op:this.op};return p.isDate(this.value)?e.value=l.format(this.value,r):p.isObject(this.value)?e.value={from:this.value.from?l.format(this.value.from,r):null,to:this.value.to?l.format(this.value.to,r):null}:e.value=this.value,e}}class B{constructor(r){i(this,"groupOp");i(this,"filters");i(this,"groups");var e,t;this.groupOp=(r==null?void 0:r.groupOp)??"and",this.filters=((e=r==null?void 0:r.filters)==null?void 0:e.map(s=>new xe(s)))??[],this.groups=((t=r==null?void 0:r.groups)==null?void 0:t.map(s=>new B(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof xe&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof B?r.toPrimitive():r)}}}class me extends y{getPaginated(r,e,t,s,o,u,g,f=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof B?e:new B(e)).toPrimitive())),p.isEmpty(t)||(a.sort=p.isArray(t)?t:[t]),o&&(a={...a,...o}),this.get(r,a,u,g,f)}}class ht extends me{getTemplateList(r,e,t){return this.getPaginated("/internal/price/templates",r,e,t,{},s=>{const o={...s.data};return o.data=o.data.map(u=>new z(u)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,t=>new z(t.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new z(e.data))}updateTemplate(r,e,t={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new z(s.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 ke(t)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},t=>new ke(t.data))}saveProductTemplatePrice(r,e,t){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=t.coefficient)==null?void 0:s.id,increase_percent:t.value},o=>new ke(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 be(t)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},t=>new be(t.data))}saveCategoryTemplatePrice(r,e,t,s=!1){var o;return this.request({method:"POST",url:`/internal/price/templates/${r}/categories/${e}`,data:{price_coefficient_id:(o=t.coefficient)==null?void 0:o.id,increase_percent:t.value},params:s?{recursively:!0}:{}},u=>new be(u.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 te(t)))}}class gt extends y{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new ie(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new ie(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ie(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,t=>new ie(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 Je(t)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,t=>t.data.map(s=>new Je(s)))}}class ft extends me{getProperties(r,e,t){return this.getPaginated("/internal/catalog/properties",r,e,t,{},s=>{const o={...s.data};return o.data=o.data.map(u=>new V(u)),o})}createProperty(r){const{typeId:e,...t}=r;return this.post("/internal/catalog/properties",{...t,type:e},s=>new V(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new V(e.data))}updateProperty(r,e){const{typeId:t,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:t},o=>new V(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 x(t)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},t=>new x(t.data))}updateProductProperty(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:t},s=>new x(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,t){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,t)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(t=>new x(t)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},t=>new x(t.data))}updateCategoryProperty(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:t},s=>new x(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,t){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,t)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,{image:e})}getCategoryFilterSettings(r){return this.get(`/internal/catalog/categories/${r}/filter-settings`,{},e=>e.data.map(t=>new Ve(t)))}saveCategoryFilterSetting(r,e,t){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,t,s=>new Ve(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class mt extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{priceTemplateId:r,showHidden:e},t=>t.data.map(s=>new _(s)))}getCategoryData(r,e,t=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:t,withNestedCategories:s},o=>new _(o.data))}getCategoryProductsList(r,e,t=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:t},o=>p.map(o.data,u=>new I(u)))}}function Ke(n,r,e){let t;return n.some(s=>{if(s.type===e&&s.id===r)return t=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const u=Ke(o.products,r,e);if(u)return t=u,!0}if(o.categories&&o.categories.length>0){const u=Ke(o.categories,r,e);if(u)return t=u,!0}return!1}),t}function Xe(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const t=e;t.products&&t.products.length>0&&r.push(...Xe(t.products)),t.categories&&t.categories.length>0&&r.push(...Xe(t.categories))}}),r}var $r=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))($r||{}),M=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(M||{});class $e extends G{constructor(e){super(e);i(this,"bankName","");i(this,"bic","");i(this,"accountNumber","");i(this,"correspondentAccount","");i(this,"currency",new L);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new L(e.currency))}}class Le extends b{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 Y extends Le{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)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class j extends D{static generatePersonItem(){return new j({id:1,guid:"",slug:M.Person,name:""})}}class K extends D{}class Ze extends b{constructor(e){super(e);i(this,"opf",j.generatePersonItem());i(this,"partnerGroup",new K);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 j(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new $(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new $(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new K(e.partnerGroup)),e.contacts){const t=[];e.contacts.forEach(s=>{t.push(new Y(s))}),this.contacts=t}if(e.bankAccounts){const t=[];e.bankAccounts.forEach(s=>{t.push(new $e(s))}),this.bankAccounts=t}}}}class Lr extends Ze{constructor(r){super(r)}}class Ee extends Ze{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 Ee{constructor(e){super(e);i(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class dr extends Fe{constructor(e){super(e);i(this,"registrationCountry",new Q);i(this,"registrationNumber","");i(this,"taxNumber","");e&&(this.registrationCountry=new Q(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ye{static createInstance(r){switch(r.opf.slug){case M.Ic:return new Ee(r);case M.UlR:return new Fe(r);case M.UlNr:return new dr(r);default:return new Lr(r)}}}class Nr extends _e{constructor(e){super(e);i(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class ae extends Nr{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 Ue(e==null?void 0:e.coordinates),this.contacts=((t=e==null?void 0:e.contacts)==null?void 0:t.map(s=>new Y(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class er extends D{}class rr extends D{}class tr extends J{constructor(e){var t,s,o,u;super(e);i(this,"contragents");i(this,"partnerGroups");i(this,"contacts");i(this,"deliveryAddresses");i(this,"channelPrimaryInterest");i(this,"sourcePrimaryInterest");i(this,"preferredDeliveryType");i(this,"primaryDemand");i(this,"preferredWarehouse");i(this,"extraData");this.contragents=((t=e==null?void 0:e.contragents)==null?void 0:t.map(g=>ye.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new K(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new Y(g)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(g=>new ae(g)))??[],this.channelPrimaryInterest=new er(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new rr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new q(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new Z(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class ir{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const t=this[e];p.isNil(t)||p.isString(t)&&t.trim().length===0||p.isFunction(t.isNewRec)&&t.isNewRec()||(r[e]=t)}),r}}class yt extends ir{constructor(e){var t,s,o,u,g,f,a,C;super();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 S);i(this,"lastLoginDate",new S);i(this,"lastLoginDateHasOrder");i(this,"managers");i(this,"includeSubordinateManagers");i(this,"curators");i(this,"isManagerRequired");i(this,"salesDirections");i(this,"contragentInn");i(this,"contragentType");i(this,"preferredDeliveryType");i(this,"partnerGroups");i(this,"contact");i(this,"lastOrder");i(this,"noOrdersPeriod",new S);this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(t=e==null?void 0:e.cities)==null?void 0:t.map(P=>new fe(P)),this.region=new re(e==null?void 0:e.region),this.country=new Q(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new S(e==null?void 0:e.createdAt),this.lastLoginDate=new S(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(P=>new ee(P)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(P=>new Oe(P)))??[],this.salesDirections=(u=e==null?void 0:e.salesDirections)==null?void 0:u.map(P=>new d(P)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new j(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new q(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(P=>new K(P)),this.contact=new Le(e==null?void 0:e.contact),this.lastOrder={createdAt:new S((f=e==null?void 0:e.lastOrder)==null?void 0:f.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(C=e==null?void 0:e.lastOrder)==null?void 0:C.isApproved},this.noOrdersPeriod=new S(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new re;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new j;break;case"preferredDeliveryType":this.preferredDeliveryType=new q;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Le;break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,f;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((u=e==null?void 0:e.lastLoginDate)!=null&&u.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((f=e==null?void 0:e.noOrdersPeriod)!=null&&f.to)&&delete e.noOrdersPeriod,e}}class sr extends G{constructor(e){super(e);i(this,"createdAt");i(this,"creator");i(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new $(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class qr extends b{constructor(e){var t,s,o,u;super(e);i(this,"contacts",[]);i(this,"preferredDeliveryType");i(this,"partnerGroups",[]);i(this,"lastOrder");i(this,"salesDirection");i(this,"managers");i(this,"curators");this.contacts=((t=e.contacts)==null?void 0:t.map(g=>new Y(g)))??void 0,this.lastOrder=e.lastOrder?new sr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new K(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new q(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new d(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new Te(g)))??void 0,this.curators=((u=e.curators)==null?void 0:u.map(g=>new Oe(g)))??void 0}}class de extends G{constructor(e){super(e);i(this,"isPrimary");this.isPrimary=e.isPrimary}}class _r extends Y{constructor(e){super(e);i(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(t=>new de(t))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(t=>new de(t))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(t=>new de(t))))}}class N extends me{static transformClientDataToRequest(r){var t;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(t=r.preferredWarehouse)==null?void 0:t.id}}static transformContragentClientDataToRequest(r){var u,g,f,a;let e;const t=r,s=r,o=r;switch(r.opf.slug){case M.Ic:e={opf:t.opf.slug,name:t.name,alternative_name:t.alternativeName,partner_group_id:(u=t.partnerGroup)==null?void 0:u.id,comment:t.comment,inn:t.inn,okpo:t.okpo,director_name:t.directorName,director_position:t.directorPosition,director_acts_on:t.directorActsOn,legal_address:t.legalAddress,postal_address:t.postalAddress,actual_address:t.actualAddress};break;case M.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case M.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(f=o.partnerGroup)==null?void 0:f.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var t,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(t=r.coordinates)==null?void 0:t.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new tr(e.data))}getClientsList(r,e,t,s,o=void 0){return this.getPaginated("/internal/clients",r,e,t,s,u=>{const g={...u.data};return g.data=g.data.map(f=>new J(f)),g},void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){const t=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:t,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(u=>new qr(u))),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(s=>new _r(s))),t})}createClientCommonData(r,e={}){return this.post("/internal/clients",N.transformClientDataToRequest(r),t=>new tr(t.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,N.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const t={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,t,void 0,e)}changeClientPassword(r,e,t,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:t},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(t)}async detachClientFromManagers(r,e){const t=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(t)}attachToCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:t.id})}detachFromCurator(r,e,t){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:t.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(t=>({curator_id:t.curatorId,curated_direction_id:t.curatedDirection.id}))})}createContragentClientData(r,e,t={}){return this.post(`/internal/clients/${r}/contragents`,N.transformContragentClientDataToRequest(e),s=>ye.createInstance(s.data),t)}updateContragentClientData(r,e,t={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,N.transformContragentClientDataToRequest(e),s=>ye.createInstance(s.data),t)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,t={}){return this.post(`/internal/clients/${r}/delivery-addresses`,N.transformClientDeliveryAddressToRequest(e),s=>new ae(s.data),t)}updateClientDeliveryAddress(r,e,t={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,N.transformClientDeliveryAddressToRequest(e),s=>new ae(s.data),t)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,t,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,N.transformClientContragentBankAccountToRequest(t),o=>new $e(o.data),s)}updateContragentBankAccount(r,e,t,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`,N.transformClientContragentBankAccountToRequest(t),o=>new $e(o.data),s)}deleteContragentBankAccount(r,e,t){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${t.id}`)}createClientContact(r,e,t={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},t)}updateClientContact(r,e,t={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},s=>new Y(s.data),t)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,t,s={}){return this.createContact(r,t,{contragents:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryContragentContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachContragentContact(r,e,t){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${t.id}/detach`)}createDeliveryAddressContact(r,e,t,s={}){return this.createContact(r,t,{addresses:[{id:e,is_primary:t.isPrimary??!1,not_disturb:t.notDisturb??!1}]},s)}setPrimaryDeliveryAddressContact(r,e,t){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/primary`,t.isPrimary??!1)}detachDeliveryAddressContact(r,e,t){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${t.id}/detach`)}createContact(r,e,t,s={}){var u,g;const o={name:e.name,position:e.position,comment:e.comment,...t};return(u=e.phone)!=null&&u.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,f=>new Y(f.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class at extends y{checkPhoneIsBusy(r){return new Promise((e,t)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(t)})}}class Ct{constructor(r){i(this,"date");i(this,"name");i(this,"version");this.date=p.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var Mr=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(Mr||{});class vt extends y{getConfiguratorSettings(r,e){var t;return this.get(`internal/catalog/categories/${r.id}/configurators/${(t=r.properties)==null?void 0:t.configurator}/settings?client_id=${e}`)}searchProduct(r,e,t,s={}){var u;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(u=r.properties)==null?void 0:u.configurator}/product`,{params:t,client_id:e},g=>new I(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,t,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...t},()=>{},s)}removeTemplate(r,e,t){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${t}?client_id=${e}`)}calculate(r,e,t){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...t})}}class Ur{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 wt extends Ur{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 Dt{constructor(r){i(this,"field");i(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class w{static decadeInterval(r){const[e,t]=w.shiftedDecadeBounds(r,0);return{from:e,to:t}}static shiftDecadeInterval(r,e){const[t,s]=w.shiftedDecadeBounds(r,e);return{from:t,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,t){const s=l.differenceInCalendarMonths(l.startOfMonth(t),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),u=Math.min(l.getDate(t),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,u))}}static weekTillSameWeekday(r,e){const t=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:t,to:l.endOfDay(l.addDays(t,s))}}static decadeTillSameDayNumber(r,e){const[t]=w.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,t)+1,[o,u]=w.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(u,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const t=l.getDate(r);let s=2;t<=10?s=0:t<=20&&(s=1);const o=s+e,u=Math.floor(o/3),g=(o%3+3)%3,f=l.startOfMonth(l.addMonths(r,u)),a=l.addDays(f,g*10),C=g===2?l.endOfMonth(f):l.endOfDay(l.addDays(a,9));return[a,C]}}class Pt{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),t=new Date,s=l.startOfYear(r===void 0?t:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(t,{weekStartsOn:1}),to:l.endOfWeek(t,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(t),to:l.endOfMonth(t)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},t=l.startOfDay(r),s=l.endOfDay(r),o=w.decadeInterval(r),u=l.startOfMonth(r),g=l.startOfQuarter(r),f=w.startOfHalfYear(r),a=l.startOfYear(r),C=w.addHalfYears(r,-1),P=w.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:t,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...w.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...w.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:u,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:w.startOfHalfYear(C),to:w.endOfHalfYear(C)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:f,to:w.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:w.startOfHalfYear(P),to:w.endOfHalfYear(P)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:u,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:f,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:t,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:t,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:t,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:t,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:t,to:w.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:t,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...w.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...w.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(u,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(f,w.startOfHalfYear(C),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...w.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...w.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(u,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(f,w.startOfHalfYear(P),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:t,to:l.endOfDay(l.addDays(r,6))}}}}const Rt=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],St=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class nr{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,t;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((t=r.properties)!=null&&t.minCount)&&!nr.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,t,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((t=r.properties)!=null&&t.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}}const ne=class ne extends y{constructor(){super();i(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=k().config.http.responseDataCacheTimeout}static getCachedResponse(e){const t=ne.responseDataCache.get(e);if(t&&t.validTo>new Date)return t.val}cacheResponse(e,t){ne.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:t})}getTypedDataArrayRequester(e,t,s=!1,o={}){const u=t+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),g=s?ne.getCachedResponse(u):void 0;return g?Promise.resolve(g):this.get(t,o).then(f=>{const a=f.map(C=>Se.instanceInitializer(e,C));return s&&a&&this.cacheResponse(t,a),a})}};i(ne,"responseDataCache",new Map);let se=ne;function Tt(n,r){const e=[2,0,1,1,1,2];return r[n%100>4&&n%100<20?2:e[Math.min(n%10,5)]]}class At{static generateUndefinedManagerInstance(){return new ee({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Hr extends se{async getManagers(){const r="/internal/managers",e=se.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>Se.instanceInitializer(ee,o));return this.cacheResponse(r,s),s}}class or extends sr{constructor(e){var t,s,o,u,g,f,a,C;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");i(this,"sum");i(this,"isLargeOrder");this.client=new J(e==null?void 0:e.client),this.payment={type:((t=e==null?void 0:e.payment)==null?void 0:t.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((f=e==null?void 0:e.delivery)==null?void 0:f.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new ae(e.delivery.address):void 0,warehouse:(C=e==null?void 0:e.delivery)!=null&&C.warehouse?new Z(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new $(e==null?void 0:e.attachedUser):void 0,this.status=(e==null?void 0:e.status)??0,this.salesDirection=new d(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?l.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?l.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,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class cr extends D{}class lr extends D{}class bt extends ir{constructor(e){var t,s,o,u;super();i(this,"attachedUsers");i(this,"clientSearchTerm");i(this,"client");i(this,"contragent");i(this,"createdAt",new S);i(this,"creator");i(this,"deliveryDate",new S);i(this,"deliveryAddressSearch");i(this,"clientCities");i(this,"id");i(this,"isApproved");i(this,"isApproved1c");i(this,"isNotInStock");i(this,"isOnOrder");i(this,"pendingAt",new S);i(this,"processedAt",new S);i(this,"salesDirections");i(this,"status");i(this,"deliveryType");i(this,"paymentType");i(this,"warehouses");i(this,"isLargeOrder");i(this,"isToProcess");i(this,"onlyMyRegions");this.attachedUsers=(t=e==null?void 0:e.attachedUsers)==null?void 0:t.map(g=>"isActive"in g?new ee(g):new cr(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new J(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new S(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new $(e.creator):void 0,this.deliveryDate=new S(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new fe(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isApproved1c=e==null?void 0:e.isApproved1c,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.pendingAt=new S(e==null?void 0:e.pendingAt),this.processedAt=new S(e==null?void 0:e.processedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new d(g)),this.status=e==null?void 0:e.status,this.deliveryType=e!=null&&e.deliveryType?new q(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new lr(e.paymentType):void 0,this.warehouses=(u=e==null?void 0:e.warehouses)==null?void 0:u.map(g=>new Z(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new q;break;case"clientCities":this.clientCities=[];break;case"pendingAt":this.pendingAt.from=null,this.pendingAt.to=null;break;case"processedAt":this.processedAt.from=null,this.processedAt.to=null;break;case"salesDirection":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var t,s,o,u,g,f,a,C;const e=super.asClearRaw();return!((t=e==null?void 0:e.createdAt)!=null&&t.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((u=e==null?void 0:e.deliveryDate)!=null&&u.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.pendingAt)!=null&&g.from)&&!((f=e==null?void 0:e.pendingAt)!=null&&f.to)&&delete e.pendingAt,!((a=e==null?void 0:e.processedAt)!=null&&a.from)&&!((C=e==null?void 0:e.processedAt)!=null&&C.to)&&delete e.processedAt,e}}class Br extends Ye{constructor(e){super(e);i(this,"product");i(this,"cost");i(this,"costOne");i(this,"costOneRub");i(this,"costRub");i(this,"logicGroupId");i(this,"salesDirection");i(this,"specificationImgUrl");i(this,"sawing");i(this,"currency");this.product=new H(e.product),this.currency=new L(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 Ne extends or{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 Br(t)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ye.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new D(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class Ot extends me{getOrders(r,e,t,s=void 0){return this.getPaginated("/internal/orders",r,e,t,{},o=>{const u={...o.data};return u.data=u.data.map(g=>new or(g)),u},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof B?r:new B(r)).toPrimitive())}:{},void 0,void 0,e).then(t=>t.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Ne(e.data))}addOrderProduct(r,e,t={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new Ne(s.data),t)}patchOrderProduct(r,e,t,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:t.product.id,product_category_id:t.configurator?t.category.id:void 0,quantity:t.quantity,height:t.height,length:t.length,width:t.width,configurator:t.configurator,marker:t.marker,...t.configuratorParams},o=>new Ne(o.data),s)}}class qe{constructor(r){i(this,"client");i(this,"product");i(this,"cost");i(this,"costCoefficient");i(this,"source");this.client=new J(r==null?void 0:r.client),this.product=new I(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)??Re.Product}}const ur=n=>{var r,e,t,s,o;return n?p.omitBy({cities:(r=n.cities)==null?void 0:r.map(u=>u.id),clients:(e=n.clients)==null?void 0:e.map(u=>u.id),managers:(t=n.managers)==null?void 0:t.map(u=>u.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(u=>u.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(u=>u.id),hideNotActive:n.hideNotActive},u=>p.isNil(u)||(p.isArray(u)||p.isObject(u))&&p.isEmpty(u)):{}},Yr=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class kt extends y{analyzeProductPrices(r,e,t){return this.get(`/internal/price/products/${r}/analyze`,{...Yr(e),filters:ur(t)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPrices(r,e,t){return this.get(`/internal/price/categories/${r}/analyze`,{...Yr(e),filters:ur(t)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPricesBySquare(r,e,t){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:ur(t)},s=>s.data.map(o=>new qe(o)))}}class jr{constructor(r){i(this,"cost");i(this,"isLowCost");i(this,"isRetail");i(this,"costDate");i(this,"discountName");i(this,"priceTemplateName");i(this,"product");i(this,"client");i(this,"executor");i(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=p.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new E(r.product):void 0,this.client=r.client?new $(r.client):void 0,this.executor=r.executor?new $(r.executor):void 0,this.currency=r.currency?new L(r.currency):void 0}}class Wr extends E{constructor(e){super(e);i(this,"history");this.history=p.map(e.history,t=>new jr(t))}}class It extends y{getProductPriceHistory(r){var o,u,g,f,a;const e=k().config.dateFormats.api,t=p.omitBy(p.merge(r,{costDate:{from:p.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(u=r.costDate)==null?void 0:u.from,to:p.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(f=r.costDate)==null?void 0:f.to}}),C=>p.isNil(C)||(p.isArray(C)||p.isObject(C))&&p.isEmpty(C)),s=((a=r.product)==null?void 0:a[0])??0;return delete t.product,this.get(`/internal/price/products/${s}/history`,t).then(C=>[new Wr(p.merge(C[0],{history:C}))])}}class pr{constructor(r){i(this,"products",[]);i(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new E(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new E(e)))}}class $t extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new pr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new pr(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(t=>t.id),products:e.products.map(t=>t.id)})}}var Gr=(n=>(n.New="new",n.WorkedOut="worked_out",n.Pending="pending",n.Completed="completed",n.Declined="declined",n.Deleted="deleted",n))(Gr||{});class zr extends D{}class Lt extends D{}class Qr extends D{}class Jr extends D{}class Vr extends D{}class xr extends D{}class dt{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class hr extends D{}class T extends se{getReference(r,e=!1){return this.getTypedDataArrayRequester(zr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(er,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Qr,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(Ae,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(L,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(K,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(j,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(cr,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(Jr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Vr,"/internal/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(lr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(hr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(d,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(rr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(fe,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(re,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(Q,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(q,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(Z,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Qe,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(pe,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(xr,"/public/references/product-file-type",!0)}}const A=W.defineStore("common.references_private",()=>{const n=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),t=m.ref(void 0),s=m.ref(void 0),o=m.ref(void 0),u=m.ref(void 0),g=m.ref(void 0),f=m.ref(void 0),a=m.ref(void 0),C=m.ref(void 0),P=m.ref(void 0),Ce=m.ref(void 0),ve=m.ref(void 0),oe=m.ref(void 0),ce=m.ref(void 0),fr=m.ref(void 0),mr=m.ref(void 0),h=m.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:t,deliveryTypeReference:s,managersList:o,opfReference:u,operatorReference:g,orderPaymentStatusReference:f,orderStatusReference:a,paymentTypeReference:C,partnerGroupReference:P,productFileTypeReference:Ce,resourceTypesReference:ve,salesDirectionsReference:oe,sourcePrimaryInterestReference:ce,warehousesReference:fr,propertyTypesReference:mr,priceCoefficientsReference:h}}),Nt=W.defineStore("common.references",()=>{const n=m.computed(()=>{const h=A();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(T).getChannelPrimaryInterest().then(v=>{h.channelPrimaryInterestReference=v}).catch(p.noop)),h.channelPrimaryInterestReference}),r=m.computed(()=>{const h=A();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(T).getContactPositions().then(v=>{h.contactPositionsReference=v}).catch(p.noop)),h.contactPositionsReference}),e=m.computed(()=>{const h=A();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(T).getCurrency().then(v=>{h.currencyReference=v}).catch(p.noop)),h.currencyReference}),t=m.computed(()=>{const h=A();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(T).getOpf().then(v=>{h.opfReference=v}).catch(p.noop)),h.opfReference}),s=m.computed(()=>{const h=A();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(T).getOperators().then(v=>{h.operatorReference=v}).catch(p.noop)),h.operatorReference}),o=m.computed(()=>{const h=A();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(T).getOrderPaymentStatuses().then(v=>{h.orderPaymentStatusReference=v}).catch(p.noop)),h.orderPaymentStatusReference}),u=m.computed(()=>{const h=A();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(T).getOrderStatuses().then(v=>{h.orderStatusReference=v}).catch(p.noop)),h.orderStatusReference}),g=m.computed(()=>{const h=A();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(T).getPaymentTypes().then(v=>{h.paymentTypeReference=v}).catch(p.noop)),h.paymentTypeReference}),f=m.computed(()=>{const h=A();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(T).getPartnerGroup().then(v=>{h.partnerGroupReference=v}).catch(p.noop)),h.partnerGroupReference}),a=m.computed(()=>{const h=A();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(T).getProductFileType().then(v=>{h.productFileTypeReference=v}).catch(p.noop)),h.productFileTypeReference}),C=m.computed(()=>{const h=A();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(T).getResourceTypes().then(v=>{h.resourceTypesReference=v}).catch(p.noop)),h.resourceTypesReference}),P=m.computed(()=>{const h=A();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(T).getSalesDirections().then(v=>{h.salesDirectionsReference=v}).catch(p.noop)),h.salesDirectionsReference}),Ce=m.computed(()=>{const h=A();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(T).getSourcePrimaryInterest().then(v=>{h.sourcePrimaryInterestReference=v}).catch(p.noop)),h.sourcePrimaryInterestReference}),ve=m.computed(()=>{const h=A();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(T).getDeliveryTypes().then(v=>{h.deliveryTypeReference=v}).catch(p.noop)),h.deliveryTypeReference}),oe=m.computed(()=>{const h=A();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(Hr).getManagers().then(v=>{h.managersList=v}).catch(p.noop)),h.managersList}),ce=m.computed(()=>{const h=A();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(T).getWarehouses().then(v=>{h.warehousesReference=v}).catch(p.noop)),h.warehousesReference}),fr=m.computed(()=>{const h=A();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(T).getPropertyTypes().then(v=>{h.propertyTypesReference=v}).catch(p.noop)),h.propertyTypesReference}),mr=m.computed(()=>{const h=A();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(T).getPriceCoefficients().then(v=>{h.priceCoefficientsReference=v}).catch(p.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:t,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:u,paymentTypeReference:g,partnerGroupsReference:f,productFilesTypesReference:a,resourceTypesReference:C,salesDirectionsReference:P,sourcePrimaryInterestsReference:Ce,deliveryTypeReference:ve,managersList:oe,warehousesReference:ce,propertyTypesReference:fr,priceCoefficientsReference:mr}});class Kr{constructor(r){i(this,"name");i(this,"content");this.name=r.name,this.content=r.content}}class gr{constructor(r){i(this,"resourceType");i(this,"resourceId");i(this,"h1");i(this,"title");i(this,"description");i(this,"keywords");i(this,"meta");i(this,"tags");var e;this.resourceType=new hr(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 Kr(t)))??[],this.tags=r==null?void 0:r.tags}}class qt extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},t=>new gr(t.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,t=>new gr(t.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class _t extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(t=>{const s=[...t];let o=1;return s.forEach(u=>{u.id=o++}),s})}}var Xr=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Xr||{});class Zr extends ze{constructor(e){super(e);i(this,"type");i(this,"canDoReclamations");i(this,"photo");i(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new We(e.pricingRole):void 0}}class Mt extends y{constructor(){super(),this.baseUrl=`${k().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class Er extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Zr(r.data),!0)}}const Ut=W.defineStore("common.user_state_private",()=>{const n=m.ref({}),r=m.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Ht=W.defineStore("common.user_state",()=>({currentUser:m.computed(()=>{const r=Ut();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(Er).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class Bt{constructor(r,e){i(this,"showFeedback",!1);i(this,"feedback","");i(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=zr,c.AppBaseConfig=Dr,c.BankAccount=$e,c.BasePaginationProvider=me,c.CalculationTypeEnum=br,c.CalendarHelper=w,c.Cart=he,c.CartProvider=rt,c.CatalogProvider=st,c.CatalogableItem=Be,c.Category=_,c.CategoryFilterSetting=Ve,c.CategoryPricingRule=Je,c.ChannelPrimaryInterest=er,c.City=Lt,c.CityWithRegionAndCountry=fe,c.Client=tr,c.ClientAdditionalData=qr,c.ClientCategory=ge,c.ClientDataProvider=N,c.ClientPriceProvider=nt,c.ClientPriceTemplateProvider=ot,c.ClientProduct=H,c.ClientProductCategoryDataProvider=ut,c.ClientProductDataProvider=pt,c.ClientShortInfo=J,c.ClientsAdditionalDataRequestTypeEnum=$r,c.ClientsListFilters=yt,c.CodedIdentity=E,c.ConfiguratorProvider=vt,c.ConfiguratorsEnum=Mr,c.Contact=Le,c.ContactLinks=je,c.ContactPerson=Y,c.ContactPersonRelated=_r,c.ContactPosition=Qr,c.ContactRelation=de,c.ContragentBase=Ze,c.ContragentFactory=ye,c.ContragentIc=Ee,c.ContragentPerson=Lr,c.ContragentUlNr=dr,c.ContragentUlR=Fe,c.CostSourceEnum=Re,c.Country=Q,c.CuratedDirection=Ae,c.Curator=Oe,c.Currency=L,c.DataSuggestionProvider=_t,c.DateTimeProvider=Pt,c.DeletableNamedIdentity=Nr,c.DeliveryAddress=ae,c.DeliveryType=q,c.DetailedJwtPayload=Fr,c.DeviceTypeResolutionConfig=ar,c.DiscountShortInfo=Rr,c.FieldValidationResultData=Bt,c.FilterGroup=B,c.FilterItem=xe,c.FilterOpEnum=Ie,c.FilterSettings=Ir,c.GeoCoordinates=Ue,c.HiddenCatalogableItem=Tr,c.HttpCachedRequester=se,c.HttpParamsConfig=Cr,c.HttpRequester=y,c.Identity=G,c.Image=Ar,c.JwtPayload=U,c.Manager=ee,c.ManagerCommon=Te,c.ManagerDataFactory=At,c.ManagerDataProvider=Hr,c.MetaTagItem=Kr,c.NamedIdentity=b,c.Operator=cr,c.Opf=j,c.OpfEnum=M,c.Order=Ne,c.OrderInfo=or,c.OrderItem=Br,c.OrderItemBase=Ye,c.OrderPaymentStatus=Jr,c.OrderShortInfo=sr,c.OrderStatus=Vr,c.OrderStatusEnum=Gr,c.OrdersDataProvider=Ot,c.OrdersListFilters=bt,c.PaginationFiltersBase=ir,c.PartnerGroup=K,c.PaymentType=lr,c.PreferencesStorageProvider=ue,c.PriceAnalyze=qe,c.PriceAnalyzeProvider=kt,c.PriceCoefficient=pe,c.PriceCoefficientEnum=Me,c.PriceHistoryDataProvider=It,c.PriceHistoryItem=jr,c.PriceTemplate=z,c.PriceTemplateCategory=be,c.PriceTemplateClient=te,c.PriceTemplateICatalogableItem=Ge,c.PriceTemplateProduct=ke,c.PriceTemplateProvider=ht,c.PricingRole=ie,c.PricingRoleProvider=gt,c.PrimaryCatalogableItem=Pe,c.Product=I,c.ProductCategoryDataProvider=ct,c.ProductDataProvider=lt,c.ProductFileType=xr,c.ProductFilterTypeEnum=kr,c.ProductPriceCoefficient=De,c.ProductPriceHistory=Wr,c.ProductUnit=He,c.PropertiesProvider=ft,c.Property=V,c.PropertyType=Qe,c.PropertyTypeEnum=Or,c.PropertyValue=x,c.RecommendationsDataProvider=$t,c.RecommendationsList=pr,c.Reference=D,c.ReferenceDataFactory=dt,c.ReferenceDataProvider=T,c.Region=re,c.ResourceType=hr,c.STANDARD_PERIOD_GROUPS=Rt,c.STANDARD_PERIOD_SECTIONS=St,c.SalesDirection=d,c.SentryConfig=vr,c.Seo=gr,c.SeoDataProvider=qt,c.SourcePrimaryInterest=rr,c.StockCount=Sr,c.TableDataPagination=wt,c.TableDataPaginationRequestParams=Ur,c.TableDataSortRequestParams=Dt,c.TemplateProductCategoryDataProvider=mt,c.TemplatesListFilters=it,c.TypedInstanceFactory=Se,c.UnitsHelper=nr,c.UnknownClientDataProvider=at,c.UpdatableNamedIdentity=_e,c.User=Zr,c.UserAuthDataProvider=Mt,c.UserCommonInfo=ze,c.UserDataProvider=Er,c.UserPricingRole=We,c.UserShortInfo=$,c.UserTypeEnum=Xr,c.VersionConfig=Ct,c.Warehouse=Z,c.WebSocketConfig=wr,c.findCatalogItemByIdRecursive=Ke,c.flattenCatalogItems=Xe,c.pluralize=Tt,c.useAuthStateStore=we,c.useBaseConfigStateStore=k,c.useReferencesStore=Nt,c.useUserStateStore=Ht,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("jwt-decode"),require("lodash-es"),require("ts-case-convert"),require("pinia"),require("vue"),require("date-fns"),require("axios")):typeof define=="function"&&define.amd?define(["exports","jwt-decode","lodash-es","ts-case-convert","pinia","vue","date-fns","axios"],O):(c=typeof globalThis<"u"?globalThis:c||self,O(c["SC Common Lib"]={},c["jwt-decode"],c["lodash-es"],c["ts-case-convert"],c.pinia,c.vue,c["date-fns"],c.axios))})(this,function(c,O,p,le,W,m,l,ar){"use strict";var Wt=Object.defineProperty;var Gt=(c,O,p)=>O in c?Wt(c,O,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[O]=p;var t=(c,O,p)=>Gt(c,typeof O!="symbol"?O+"":O,p);class U{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){const e=O.jwtDecode(r),i=new U(le.objectToCamel(e));return i.resourceAccess=e.resource_access,i}}class rt extends U{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 U(le.objectToCamel(O.jwtDecode(e)))}}class Cr{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 vr{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 wr{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,i,s,o;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|404|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((i=r==null?void 0:r.trace)==null?void 0:i.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((s=r==null?void 0:r.replay)==null?void 0:s.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((o=r==null?void 0:r.replay)==null?void 0:o.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Dr{constructor(r){t(this,"broadcaster");t(this,"key");t(this,"wsHost");t(this,"wsPort");t(this,"wssPort");t(this,"forceTLS");t(this,"enabledTransports");this.broadcaster=r.broadcaster??"reverb",this.key=r.key??"",this.wsHost=r.wsHost??"",this.wsPort=r.wsPort??8080,this.wssPort=r.wssPort??8080,this.forceTLS=r.forceTLS??!1,this.enabledTransports=r.enabledTransports??["wss"]}}class Pr{constructor(r){t(this,"environment");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"sentry");t(this,"tableDefaultHeightCoefficient");t(this,"urls");t(this,"websocket");t(this,"dateFormats");var e,i,s;this.environment=(r==null?void 0:r.environment)??"production",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new vr(r==null?void 0:r.http),this.deviceTypeByResolution=new Cr(r==null?void 0:r.deviceTypeByResolution),this.sentry=new wr({environment:this.environment,...r==null?void 0:r.sentry}),this.tableDefaultHeightCoefficient=(r==null?void 0:r.tableDefaultHeightCoefficient)??.7,this.urls=r==null?void 0:r.urls,this.websocket=r!=null&&r.websocket?new Dr(r.websocket):void 0,this.dateFormats={api:((e=r==null?void 0:r.dateFormats)==null?void 0:e.api)??"yyyy-MM-dd HH:mm:ss",uiDate:((i=r==null?void 0:r.dateFormats)==null?void 0:i.uiDate)??"dd.MM.yyyy",uiDateWithTime:((s=r==null?void 0:r.dateFormats)==null?void 0:s.uiDateWithTime)??"dd.MM.yyyy HH:mm"}}}const k=W.defineStore("common.config",()=>{const n=m.ref(new Pr);return{config:n,getConfig:()=>n.value,setConfig:i=>{n.value=p.merge(n.value,i)}}});class ue{static getActualDataFromStorage(r){if(!this.isLocalStorageAvailable())return;let e=null;try{e=localStorage.getItem(r)}catch{return}if(e)try{const i=JSON.parse(e);if(!i.availableFor||l.isAfter(l.parseISO(i.availableFor)||l.startOfToday(),new Date)){if(p.isNil(i.data)||p.isEmpty(i.data))throw new Error("Data is empty");return i.data}}catch{try{localStorage.removeItem(r)}catch{}}}static saveActualDataToStorage(r,e,i){if(this.isLocalStorageAvailable())try{if(p.isNil(e)||p.isEmpty(e))throw new Error("Data is empty");const s=JSON.stringify({availableFor:i,data:e});localStorage.setItem(r,s)}catch(s){if(s instanceof DOMException&&s.code===DOMException.QUOTA_EXCEEDED_ERR){this.clearOldData();try{const o=JSON.stringify({availableFor:i,data:e});localStorage.setItem(r,o)}catch{}}else try{localStorage.removeItem(r)}catch{}}}static isLocalStorageAvailable(){try{const r="__localStorage_test__";return localStorage.setItem(r,"test"),localStorage.removeItem(r),!0}catch{return!1}}static clearOldData(){try{const r=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);if(i)try{const s=localStorage.getItem(i);if(s){const o=JSON.parse(s);o.availableFor&&!l.isAfter(l.parseISO(o.availableFor)||l.startOfToday(),new Date)&&r.push(i)}}catch{r.push(i)}}r.forEach(e=>{try{localStorage.removeItem(e)}catch{}})}catch{}}}function Rr(n){try{const r=U.getJwtPayload(n);return new Date(r.exp*1e3)}catch{return}}const X=W.defineStore("common.auth_state_private",()=>{const n=m.ref((()=>{var g;const o=ue.getActualDataFromStorage("sc.token");if(o)return Promise.resolve(o);const u=(g=k().config.devMode)==null?void 0:g.initAuthBearerToken;return u?Promise.resolve(u):void 0})()),r=m.ref(void 0),e=m.ref(void 0),i=m.markRaw(new Map);function s(){e.value=void 0,p.isNil(n.value)||n.value.then(o=>{const u=U.getJwtPayload(o);e.value=u.exp*1e3>Date.now()?p.mapValues(u.resourceAccess,g=>(g==null?void 0:g.roles)??[]):void 0}).catch(p.noop)}return{jwtToken:n,jwtTokenUpdater:r,userPermissions:e,userPermissionsComputedRefs:i,recalculateUserPermissions:s}}),we=W.defineStore("common.auth_state",()=>{const n=m.computed(()=>{const o=X();if(p.isNil(o.jwtToken)&&!p.isNil(o.jwtTokenUpdater)){const u=o.jwtTokenUpdater();o.jwtToken=u,u.then(g=>{o.jwtToken=Promise.resolve(g),ue.saveActualDataToStorage("sc.token",g,Rr(g)),o.recalculateUserPermissions()}).catch(p.noop)}return o.jwtToken});function r(o){X().jwtTokenUpdater=o}function e(o){const u=X();u.jwtToken=Promise.resolve(o),ue.saveActualDataToStorage("sc.token",o,Rr(o)),u.recalculateUserPermissions()}function i(){const o=X();o.jwtToken=void 0,o.userPermissions=void 0,ue.saveActualDataToStorage("sc.token",void 0)}function s(o){const u=X();!p.isNil(u.jwtToken)&&p.isNil(u.userPermissions)&&u.jwtToken.then(a=>{const C=U.getJwtPayload(a);u.userPermissions=C.exp*1e3>Date.now()?p.mapValues(C.resourceAccess,P=>(P==null?void 0:P.roles)??[]):void 0}).catch(p.noop);const g=p.isArray(o)?o.join(" && "):o;if(u.userPermissionsComputedRefs.has(g))return u.userPermissionsComputedRefs.get(g);const f=m.computed(()=>{const a=C=>{var ce;const P=p.split(C,".");if(P.length<2)return!1;const[Ce,ve]=P,oe=(ce=X().userPermissions)==null?void 0:ce[Ce];return p.isArray(oe)&&oe.includes(ve)};return p.isArray(o)?p.every(o,C=>a(C)):a(o)});return u.userPermissionsComputedRefs.set(g,f),f}return{jwtToken:n,setJwtTokenUpdater:r,setJwtToken:e,invalidateJwtToken:i,hasUserPermission:s}});class G{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 A extends G{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class $ extends A{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class Sr extends A{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)?l.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 $(e==null?void 0:e.owner),this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class Me extends A{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e==null?void 0:e.updatedAt}}class z extends Me{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)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date}}var _e=(n=>(n.K0="k0",n.K1="k1",n.K2="k2",n.K3="k3",n.K4="k4",n.Retail="retail",n))(_e||{});class D extends A{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 pe extends D{static getRetailPriceCoefficient(){return{id:-2,slug:_e.Retail,name:"Розн. цена",guid:"",isNewRec:p.constant(!0)}}}class De{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new pe(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 Ue{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 q extends D{}class Z extends D{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(s=>new q(s)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new Ue(e==null?void 0:e.coordinates)}}class Tr{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new Z(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}class L extends A{constructor(e){super(e);t(this,"signature","");t(this,"code");t(this,"symbol","");t(this,"precision");e&&(this.signature=e.signature??"",this.code=e.code,this.symbol=e.symbol??"",this.precision=e.precision)}}class He extends A{constructor(e){super(e);t(this,"slug","");t(this,"description");t(this,"isSquare",!1);t(this,"isLinear",!1);e&&(this.slug=e.slug??"",this.description=e.description,this.isSquare=e.isSquare??!1,this.isLinear=e.isLinear??!1)}}class E extends A{constructor(e){super(e);t(this,"code","");this.code=(e==null?void 0:e.code)??""}}class Be extends E{constructor(e){super(e);t(this,"slug");t(this,"type");this.slug=(e==null?void 0:e.slug)??""}}class br extends Be{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class Ar{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 Pe extends Be{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class I extends br{constructor(e){var s,o,u,g;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"currency");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&&e.unit?new He(e.unit):new He,this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.currency=e!=null&&e.currency?new L(e.currency):new L,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)?l.parseISO(e.costDate):e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((s=e==null?void 0:e.stockCount)==null?void 0:s.map(f=>new Tr(f)))??[],this.type="product";const i=(e==null?void 0:e.category)??((o=e==null?void 0:e.categories)==null?void 0:o.find(f=>f.isPrimary));i&&(this.category=new Pe({...i,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(f=>new Pe(f))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(f=>new Ar(f,k().config.http.mediaUrl)))??[],this.properties=(e==null?void 0:e.properties)??{},this.retailCost=e==null?void 0:e.retailCost,this.retailCostRub=e==null?void 0:e.retailCostRub,this.priceCoefficients=((g=e==null?void 0:e.priceCoefficients)==null?void 0:g.map(f=>new De(f)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){return this.unit.isLinear||this.unit.isSquare}getRetailCost(){return this.retailCost??this.cost}getRetailCostRub(){return this.retailCostRub??this.costRub}}var Re=(n=>(n.Discount="discount",n.PriceTemplate="price_template",n.ClientPrice="client_price",n.Product="product",n))(Re||{});class H extends I{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)??Re.Product,this.discount=e!=null&&e.discount?new Sr(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new z(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 F 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,s])=>[p.toUpper(i),s])):void 0}}class Ye extends G{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"currency");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");t(this,"creatorUser");this.product=new H(e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new F,this.currency=e.currency?new L(e.currency):void 0,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,this.creatorUser=e.creatorUser&&new $(e.creatorUser)}}let tt=class extends Ye{constructor(e){super(e);t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");t(this,"currency");this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=p.isArray(e.sawing)?e.sawing:e.sawing?[e.sawing]:void 0,this.currency=new L(e.currency)}};class he{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new tt(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Se{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const R=class R{constructor(){t(this,"httpClient");t(this,"baseUrl",`${k().config.http.portalApiUrl}/api`);t(this,"errorResponseHandler",p.noop);t(this,"interceptorIds",{request:{},response:{}});t(this,"setBaseUrlRequestInterceptor",r=>(r.baseURL=this.baseUrl,r));t(this,"authRequestInterceptor",async r=>{let e;return p.isNil(we().jwtToken)||(e=await we().jwtToken),e&&r.headers.set("Authorization",`Bearer ${e}`),r});t(this,"userRequestHooksInterceptor",async r=>R.requestHooks.reduce(async(e,i)=>i(await e),Promise.resolve(r)));t(this,"dataConverterRequestInterceptor",r=>(r.method&&(r.method==="get"&&r.params&&(r.params=le.objectToSnake(r.params)),["put","patch","post"].includes(p.toLower(r.method))&&r.data&&(r.data=le.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):(we().invalidateJwtToken(),e.__isRetryRequest=!0,this.httpClient(e)):Promise.reject(r)});t(this,"canceledResponseInterceptor",r=>{const e=r.rawError??r;if(e.name==="CanceledError"||e.code==="ERR_CANCELED")throw new ar.CanceledError("Request canceled");return Promise.reject(r)});t(this,"userResponseHooksInterceptor",async r=>R.responseHooks.reduce(async(e,i)=>i(await e),Promise.resolve(r)));t(this,"dataConverterResponseInterceptor",r=>(r.data&&(r.data=le.objectToCamel(r.data)),r));this.errorResponseHandler=R.defaultErrorsResponseHandler,this.httpClient=ar.create({headers:{Accept:"application/json","Content-Type":"application/json"}}),this.interceptorIds.request.setBaseUrlRequestInterceptor=this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.userRequestHooksInterceptor=this.httpClient.interceptors.request.use(this.userRequestHooksInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.authRequestInterceptor=this.httpClient.interceptors.request.use(this.authRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.request.dataConverterRequestInterceptor=this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.convertHttpErrorResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,r=>R.convertHttpErrorResponse(r)),this.interceptorIds.response.canceledResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.canceledResponseInterceptor),this.interceptorIds.response.authErrorsResponseInterceptor=this.httpClient.interceptors.response.use(r=>r,this.authErrorsResponseInterceptors),this.interceptorIds.response.dataConverterResponseInterceptor=this.httpClient.interceptors.response.use(this.dataConverterResponseInterceptor,r=>Promise.reject(r)),this.interceptorIds.response.userResponseHooksInterceptor=this.httpClient.interceptors.response.use(this.userResponseHooksInterceptor,r=>Promise.reject(r))}static setDefaultErrorsResponseHandler(r){R.defaultErrorsResponseHandler=r}static addRequestHook(r){R.requestHooks.includes(r)||R.requestHooks.push(r)}static removeRequestHook(r){const e=R.requestHooks.indexOf(r);e!==-1&&R.requestHooks.splice(e,1)}static addResponseHook(r){R.responseHooks.includes(r)||R.responseHooks.push(r)}static removeResponseHook(r){const e=R.responseHooks.indexOf(r);e!==-1&&R.responseHooks.splice(e,1)}static getInstance(r){return Object.prototype.hasOwnProperty.call(R.instances,r.name)||(R.instances[r.name]=Se.simpleInstanceInitializer(r)),R.instances[r.name]}static convertHttpErrorResponse(r){var e,i;if(p.isNil(r)||!p.isNil(r.request)||!p.isNil(r.response)){const s=p.isNil(r)?{}:r==null?void 0:r.response;return Promise.reject({status:(s==null?void 0:s.status)??0,statusText:(s==null?void 0:s.statusText)??"Unknown",message:((e=s==null?void 0:s.data)==null?void 0:e.message)??"Unknown Error. Probably network error.",errors:(i=s==null?void 0:s.data)==null?void 0:i.errors,headers:(s==null?void 0:s.headers)??{},data:s==null?void 0:s.data,rawError:r})}return Promise.reject(r)}request(r,e=void 0,i={},s=!1){const o=this.httpClient.request(r).then(u=>e?e(u):u.data);return o.catch(u=>{(u==null?void 0:u.name)!=="CanceledError"&&this.errorResponseHandler(u,i,s)}),o}get(r,e={},i=void 0,s=!1,o=void 0){return this.request({method:"GET",url:r,params:e,signal:o},i,{},s)}getBlob(r,e={},i=void 0,s=!1){return this.request({method:"GET",url:r,params:e,responseType:"blob"},i,{},s)}patch(r,e={},i=void 0,s={},o=!1){return this.request({method:"PATCH",url:r,data:e},i,s,o)}post(r,e={},i=void 0,s={},o=!1){return this.request({method:"POST",url:r,data:e},i,s,o)}delete(r,e=void 0,i=!1){return this.request({method:"DELETE",url:r},e,{},i)}};t(R,"instances",{}),t(R,"defaultErrorsResponseHandler",p.noop),t(R,"requestHooks",[]),t(R,"responseHooks",[]);let y=R;class it extends y{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new he(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new he(s.data),i)}patchCartItem(r,e,i={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new he(s.data),i)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r,e){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,e,i=>new he(i.data))}getCartItemFromCSVExample(r){return this.get(`internal/clients/${r.id}/cart/add-products-from-csv/example`,{},e=>new Blob([e.data],{type:"text/csv"}))}}var Or=(n=>(n.m2Cost="m2Cost",n.percent="percent",n.value="value",n))(Or||{}),kr=(n=>(n.Unknown="unknown",n.Bool="bool",n.Integer="integer",n.Float="float",n.String="string",n.Range="range",n.Json="json",n.Object="object",n))(kr||{}),je=(n=>(n.Checkbox="checkbox",n.Range="range",n.Toggle="toggle",n))(je||{});class M extends F{constructor(e){var i,s;super(e);t(this,"categories");t(this,"products");this.categories=(i=e==null?void 0:e.categories)==null?void 0:i.map(o=>new M(o)),this.products=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new I(o))}}class We{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class d extends D{}class Te extends A{constructor(e){super(e);t(this,"salesDirection");t(this,"photo");t(this,"contacts");t(this,"isDefault");t(this,"isRegionalDirector");this.salesDirection=e!=null&&e.salesDirection?new d(e.salesDirection):new d,this.photo=e==null?void 0:e.photo,this.contacts=e!=null&&e.contacts?new We(e.contacts):void 0,this.isDefault=(e==null?void 0:e.isDefault)??!1,this.isRegionalDirector=(e==null?void 0:e.isRegionalDirector)??!1}}class be extends D{}class Ge extends A{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");this.description=e.description,this.canChangeLowCost=e.canChangeLowCost,this.parentRoleId=e.parentRoleId}}class ee extends Te{constructor(e){var i;super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");t(this,"pricingRole");t(this,"curatedDirections");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,this.pricingRole=e!=null&&e.pricingRole?new Ge(e.pricingRole):void 0,this.curatedDirections=((i=e==null?void 0:e.curatedDirections)==null?void 0:i.map(s=>new be(s)))??[]}}class st extends F{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 ee(e.manager):void 0}}class ge extends st{constructor(e){var i,s;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=(s=e==null?void 0:e.products)==null?void 0:s.map(o=>new H(o))}}class ze{constructor(r){t(this,"priceCoefficient");t(this,"increasePercent");this.priceCoefficient=(r==null?void 0:r.priceCoefficient)&&new pe(r.priceCoefficient),this.increasePercent=r==null?void 0:r.increasePercent}}class Ae extends ze{constructor(e){super(e);t(this,"productCategory");this.productCategory=new F(e==null?void 0:e.productCategory)}}class Oe extends A{constructor(e){super(e);t(this,"photo");t(this,"contacts");t(this,"curatedDirection");this.photo=e.photo,this.contacts=new We(e.contacts),this.curatedDirection=new be(e.curatedDirection)}}class Q extends D{}class re extends D{constructor(e){super(e);t(this,"country",new Q);e&&(this.country=new Q(e.country))}}class fe extends D{constructor(e){super(e);t(this,"region",new re);e&&(this.region=new re(e.region))}}class Qe extends A{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 d(e.salesDirection):void 0,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=p.isString(e==null?void 0:e.lastLoginAt)?l.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class J extends Qe{constructor(e){var i,s;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");t(this,"curators");this.salesDirection=new d(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 fe(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(o=>new Te(o)))??[],this.curators=((s=e==null?void 0:e.curators)==null?void 0:s.map(o=>new Oe(o)))??void 0}}class te extends G{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)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt,this.client=new J(e==null?void 0:e.client),this.priceTemplate=new z(e==null?void 0:e.priceTemplate)}}class ke extends ze{constructor(e){super(e);t(this,"product");this.product=new I(e==null?void 0:e.product)}}class Je extends D{}class V extends A{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");t(this,"isFilterable");this.type=new Je(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata,this.isFilterable=e==null?void 0:e.isFilterable}}class x{constructor(r){t(this,"property");t(this,"value");this.property=new V(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class S{constructor(r){t(this,"from");t(this,"to");this.from=p.isString(r==null?void 0:r.from)?l.parseISO(r.from):(r==null?void 0:r.from)??null,this.to=p.isString(r==null?void 0:r.to)?l.parseISO(r.to):(r==null?void 0:r.to)??null}}class nt{constructor(r){t(this,"id");t(this,"name");t(this,"description");t(this,"createdAt",new S);t(this,"updatedAt",new S);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 S(r==null?void 0:r.createdAt),this.updatedAt=new S(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,s,o;const r={};return Object.keys(this).forEach(u=>{const g=this[u];p.isNil(g)||p.isString(g)&&g.trim().length===0||p.isFunction(g.isNewRec)&&g.isNewRec()||(r[u]=g)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((i=r==null?void 0:r.createdAt)!=null&&i.to)&&delete r.createdAt,!((s=r==null?void 0:r.updatedAt)!=null&&s.from)&&!((o=r==null?void 0:r.updatedAt)!=null&&o.to)&&delete r.updatedAt,r}}class ie extends A{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 Ve{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new ie(r==null?void 0:r.role),this.category=new F(r==null?void 0:r.category),this.minCoefficient=new pe(r==null?void 0:r.minCoefficient)}}class Ir{constructor(r){t(this,"isFake");t(this,"isHidden");t(this,"isMultiple");t(this,"type");t(this,"ord");this.isFake=(r==null?void 0:r.isFake)??!1,this.isHidden=(r==null?void 0:r.isHidden)??!1,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.type=(r==null?void 0:r.type)??null,this.ord=(r==null?void 0:r.ord)??0}}class xe{constructor(r){t(this,"category");t(this,"property");t(this,"settings");this.category=new F(r==null?void 0:r.category),this.property=new V(r==null?void 0:r.property),this.settings=new Ir(r==null?void 0:r.settings)}}class $r{constructor(r){t(this,"id");t(this,"label");this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??""}}class Lr{constructor(r){t(this,"id");t(this,"label");t(this,"type");t(this,"ord");t(this,"isMultiple");t(this,"values");t(this,"min");t(this,"max");var e;this.id=(r==null?void 0:r.id)??"",this.label=(r==null?void 0:r.label)??"",this.type=(r==null?void 0:r.type)??je.Checkbox,this.ord=(r==null?void 0:r.ord)??0,this.isMultiple=(r==null?void 0:r.isMultiple)??null,this.values=((e=r==null?void 0:r.values)==null?void 0:e.map(i=>new $r(i)))??[],this.min=(r==null?void 0:r.min)??null,this.max=(r==null?void 0:r.max)??null}}class ot extends y{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,i=void 0,s=void 0){let u=`${k().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;return i&&(u+=`&category_id=${i}`),s&&(u+=`&client_id=${s}`),u}}class ct extends y{importPrices(r,e){return this.post(`/internal/clients/${r}/price/import`,e)}updateCategoryPrices(r,e,i){var s;return this.patch(`/internal/clients/${r}/price/categories/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.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 s;return this.patch(`/internal/clients/${r}/price/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new H(o.data))}removeProductPrice(r,e){return this.delete(`/internal/clients/${r}/price/products/${e}`,i=>new H(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 lt extends y{getTemplateList(r){return this.get(`/internal/clients/${r}/price/templates`,{},e=>e.data.map(i=>new te(i)))}getActiveTemplate(r){return this.get(`/internal/clients/${r}/price/templates/active`,{},e=>new te(e.data),!0)}attachTemplate(r,e,i){const s=k().config.dateFormats.api;return this.post(`/internal/clients/${r}/price/templates/${e}`,i&&{startAt:i.startAt&&l.format(i.startAt,s),endAt:i.endAt&&l.format(i.endAt,s)},o=>new te(o.data),{},!0)}applyTemplate(r,e){return this.post(`/internal/clients/${r}/price/templates/${e}/apply`,{},void 0,{},!0)}changeTemplate(r,e,i,s){const o=k().config.dateFormats.api;return this.patch(`/internal/clients/${r}/price/templates/${e}/${i}`,s&&{startAt:s.startAt&&l.format(s.startAt,o),endAt:s.endAt&&l.format(s.endAt,o)},u=>new te(u.data))}detachTemplate(r,e,i){return this.delete(`/internal/clients/${r}/price/templates/${e}/${i}`)}}class ut extends y{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(i=>new M(i)))}getCategoryData(r,e=!1,i=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:i},s=>new M(s.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new M(e.data))}getCategoryProductsList(r,e=!0,i=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:i,withPriceCoefficients:e},s=>p.map(s.data,o=>new I(o)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:i}=e;return p.forEach(i,s=>s.map(o=>new De(o))),i})}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.categories.map(u=>new M(u)))}).catch(o=>{s(o)})})}}class pt extends y{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},i=>new I(i.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new I(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>p.map(e.data,i=>new De(i)))}publicSimpleSearch(r,e=10){return new Promise((i,s)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(o=>{i(o.products.map(u=>new I(u)))}).catch(o=>{s(o)})})}}class ht extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},i=>i.data.map(s=>new ge(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:i,withNestedCategories:s},o=>new ge(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:s,withPriceCoefficients:i},o=>p.map(o.data,u=>new H(u)))}}class gt extends y{getProductData(r,e,i=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:i},s=>new H(s.data))}}var Ie=(n=>(n.BeginWith="bw",n.Contains="cn",n.Custom="custom",n.EndsWith="ew",n.Equals="eq",n.GreaterOrEqual="ge",n.GreaterThan="gt",n.InList="in",n.LessOrEqual="le",n.LessThan="lt",n.NotBeginWith="bn",n.NotContains="nc",n.NotEndsWith="en",n.NotEqual="ne",n.NotInList="ni",n.NotNull="nn",n.Null="nu",n))(Ie||{});class Ke{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)??Ie.Equals,this.value=(r==null?void 0:r.value)??""}toPrimitive(){const r=k().config.dateFormats.api,e={field:this.field,op:this.op};return p.isDate(this.value)?e.value=l.format(this.value,r):p.isObject(this.value)?e.value={from:this.value.from?l.format(this.value.from,r):null,to:this.value.to?l.format(this.value.to,r):null}:e.value=this.value,e}}class B{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(s=>new Ke(s)))??[],this.groups=((i=r==null?void 0:r.groups)==null?void 0:i.map(s=>new B(s)))??[]}toPrimitive(){return{groupOp:this.groupOp,filters:this.filters.map(r=>r instanceof Ke&&p.isFunction(r.toPrimitive)?r.toPrimitive():r),groups:this.groups.map(r=>r instanceof B?r.toPrimitive():r)}}}class me extends y{getPaginated(r,e,i,s,o,u,g,f=void 0){let a={page:(s==null?void 0:s.page)??1,perPage:(s==null?void 0:s.pageSize)??10};return e&&(a.filters=JSON.stringify((e instanceof B?e:new B(e)).toPrimitive())),p.isEmpty(i)||(a.sort=p.isArray(i)?i:[i]),o&&(a={...a,...o}),this.get(r,a,u,g,f)}}class ft extends me{getTemplateList(r,e,i){return this.getPaginated("/internal/price/templates",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(u=>new z(u)),o})}createTemplate(r,e={}){return this.post("/internal/price/templates",r,i=>new z(i.data),e)}getTemplate(r){return this.get(`/internal/price/templates/${r}`,{},e=>new z(e.data))}updateTemplate(r,e,i={}){return this.patch(`/internal/price/templates/${r}`,e,s=>new z(s.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 ke(i)))}getProductTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/products/${e}`,{},i=>new ke(i.data))}saveProductTemplatePrice(r,e,i){var s;return this.post(`/internal/price/templates/${r}/products/${e}`,{price_coefficient_id:(s=i.coefficient)==null?void 0:s.id,increase_percent:i.value},o=>new ke(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 Ae(i)))}getCategoryTemplatePrice(r,e){return this.get(`/internal/price/templates/${r}/categories/${e}`,{},i=>new Ae(i.data))}saveCategoryTemplatePrice(r,e,i,s=!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:s?{recursively:!0}:{}},u=>new Ae(u.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 te(i)))}}class mt extends y{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new ie(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new ie(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new ie(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,i=>new ie(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 Ve(i)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,i=>i.data.map(s=>new Ve(s)))}}class yt extends me{getProperties(r,e,i){return this.getPaginated("/internal/catalog/properties",r,e,i,{},s=>{const o={...s.data};return o.data=o.data.map(u=>new V(u)),o})}createProperty(r){const{typeId:e,...i}=r;return this.post("/internal/catalog/properties",{...i,type:e},s=>new V(s.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new V(e.data))}updateProperty(r,e){const{typeId:i,...s}=e;return this.patch(`/internal/catalog/properties/${r}`,{...s,type:i},o=>new V(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 x(i)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},i=>new x(i.data))}updateProductProperty(r,e,i){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:i},s=>new x(s.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,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 x(i)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},i=>new x(i.data))}updateCategoryProperty(r,e,i){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:i},s=>new x(s.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,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})}getCategoryFilters(r,e=!1){return this.get(`/internal/catalog/categories/${r}/filters`,{recursively:e},i=>i.data.map(s=>new Lr(s)))}getCategoryFilterSettings(r){return this.get(`/internal/catalog/categories/${r}/filter-settings`,{},e=>e.data.map(i=>new xe(i)))}saveCategoryFilterSetting(r,e,i){return this.patch(`/internal/catalog/categories/${r}/filter-settings/${e}`,i,s=>new xe(s.data))}deleteCategoryFilterSetting(r,e){return this.delete(`/internal/catalog/categories/${r}/filter-settings/${e}`)}}class at extends y{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{priceTemplateId:r,showHidden:e},i=>i.data.map(s=>new M(s)))}getCategoryData(r,e,i=!1,s=!1){return this.get(`/internal/catalog/categories/${e}`,{priceTemplateId:r,showHidden:i,withNestedCategories:s},o=>new M(o.data))}getCategoryProductsList(r,e,i=!0,s=!1){return this.get(`/internal/catalog/categories/${e}/products`,{priceTemplateId:r,showHidden:s,withPriceCoefficients:i},o=>p.map(o.data,u=>new I(u)))}}function Xe(n,r,e){let i;return n.some(s=>{if(s.type===e&&s.id===r)return i=s,!0;if(s.type==="product")return!1;const o=s;if(o.products&&o.products.length>0){const u=Xe(o.products,r,e);if(u)return i=u,!0}if(o.categories&&o.categories.length>0){const u=Xe(o.categories,r,e);if(u)return i=u,!0}return!1}),i}function Ze(n){const r=[];return n.forEach(e=>{if(r.push(e),e.type==="category"){const i=e;i.products&&i.products.length>0&&r.push(...Ze(i.products)),i.categories&&i.categories.length>0&&r.push(...Ze(i.categories))}}),r}var dr=(n=>(n.LastOrder="last_order",n.Contacts="contacts",n.PartnerGroups="partner_groups",n.PreferredDeliveryType="preferred_delivery_type",n.SalesDirection="sales_direction",n.Managers="managers",n.Curators="curators",n))(dr||{}),_=(n=>(n.Person="individual",n.Ic="entrepreneur",n.UlR="legal",n.UlNr="non_resident_legal",n))(_||{});class $e extends G{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new L);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new L(e.currency))}}class Le extends A{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 Y extends Le{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)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class j extends D{static generatePersonItem(){return new j({id:1,guid:"",slug:_.Person,name:""})}}class K extends D{}class Ee extends A{constructor(e){super(e);t(this,"opf",j.generatePersonItem());t(this,"partnerGroup",new K);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 j(e.opf),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):e.createdAt,this.creator=e.creator?new $(e.creator):void 0,this.updatedAt=p.isString(e==null?void 0:e.updatedAt)?l.parseISO(e.updatedAt):e.updatedAt,this.updater=e.updater?new $(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new K(e.partnerGroup)),e.contacts){const i=[];e.contacts.forEach(s=>{i.push(new Y(s))}),this.contacts=i}if(e.bankAccounts){const i=[];e.bankAccounts.forEach(s=>{i.push(new $e(s))}),this.bankAccounts=i}}}}class Nr extends Ee{constructor(r){super(r)}}class Fe extends Ee{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 er extends Fe{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class qr extends er{constructor(e){super(e);t(this,"registrationCountry",new Q);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new Q(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class ye{static createInstance(r){switch(r.opf.slug){case _.Ic:return new Fe(r);case _.UlR:return new er(r);case _.UlNr:return new qr(r);default:return new Nr(r)}}}class Mr extends Me{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=p.isString(e==null?void 0:e.deletedAt)?l.parseISO(e.deletedAt):e==null?void 0:e.deletedAt}}class ae extends Mr{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 Ue(e==null?void 0:e.coordinates),this.contacts=((i=e==null?void 0:e.contacts)==null?void 0:i.map(s=>new Y(s)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class rr extends D{}class tr extends D{}class ir extends J{constructor(e){var i,s,o,u;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,"preferredWarehouse");t(this,"extraData");this.contragents=((i=e==null?void 0:e.contragents)==null?void 0:i.map(g=>ye.createInstance(g)))??[],this.partnerGroups=((s=e==null?void 0:e.partnerGroups)==null?void 0:s.map(g=>new K(g)))??[],this.contacts=((o=e==null?void 0:e.contacts)==null?void 0:o.map(g=>new Y(g)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(g=>new ae(g)))??[],this.channelPrimaryInterest=new rr(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new tr(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new q(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new Z(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class sr{asClearRaw(){const r={};return Object.keys(this).forEach(e=>{const i=this[e];p.isNil(i)||p.isString(i)&&i.trim().length===0||p.isFunction(i.isNewRec)&&i.isNewRec()||(r[e]=i)}),r}}class Ct extends sr{constructor(e){var i,s,o,u,g,f,a,C;super();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 S);t(this,"lastLoginDate",new S);t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"includeSubordinateManagers");t(this,"curators");t(this,"isManagerRequired");t(this,"salesDirections");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"partnerGroups");t(this,"contact");t(this,"lastOrder");t(this,"noOrdersPeriod",new S);this.id=e==null?void 0:e.id,this.name=e==null?void 0:e.name,this.alternativeName=e==null?void 0:e.alternativeName,this.searchTerm=e==null?void 0:e.searchTerm,this.cities=(i=e==null?void 0:e.cities)==null?void 0:i.map(P=>new fe(P)),this.region=new re(e==null?void 0:e.region),this.country=new Q(e==null?void 0:e.country),this.phone=e==null?void 0:e.phone,this.email=e==null?void 0:e.email,this.isActive=e&&Object.prototype.hasOwnProperty.call(e,"isActive")?e==null?void 0:e.isActive:!0,this.createdAt=new S(e==null?void 0:e.createdAt),this.lastLoginDate=new S(e==null?void 0:e.lastLoginDate),this.lastLoginDateHasOrder=(e==null?void 0:e.lastLoginDateHasOrder)??void 0,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(P=>new ee(P)))??[],this.includeSubordinateManagers=(e==null?void 0:e.includeSubordinateManagers)??!0,this.curators=((o=e==null?void 0:e.curators)==null?void 0:o.map(P=>new Oe(P)))??[],this.salesDirections=(u=e==null?void 0:e.salesDirections)==null?void 0:u.map(P=>new d(P)),this.contragentInn=e==null?void 0:e.contragentInn,this.contragentType=new j(e==null?void 0:e.contragentType),this.preferredDeliveryType=e!=null&&e.preferredDeliveryType?new q(e==null?void 0:e.preferredDeliveryType):void 0,this.partnerGroups=(g=e==null?void 0:e.partnerGroups)==null?void 0:g.map(P=>new K(P)),this.contact=new Le(e==null?void 0:e.contact),this.lastOrder={createdAt:new S((f=e==null?void 0:e.lastOrder)==null?void 0:f.createdAt),creator:(a=e==null?void 0:e.lastOrder)==null?void 0:a.creator,isApproved:(C=e==null?void 0:e.lastOrder)==null?void 0:C.isApproved},this.noOrdersPeriod=new S(e==null?void 0:e.noOrdersPeriod)}resetFilterValue(e){switch(e){case"cities":this.cities=[];break;case"region":this.region=new re;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"noOrdersPeriod":this.noOrdersPeriod.from=null,this.noOrdersPeriod.to=null;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"curators":this.curators=[];break;case"salesDirections":this.salesDirections=[];break;case"contragentType":this.contragentType=new j;break;case"preferredDeliveryType":this.preferredDeliveryType=new q;break;case"partnerGroups":this.partnerGroups=[];break;case"contact":this.contact=new Le;break;default:this[e]=void 0;break}return this}asClearRaw(){var i,s,o,u,g,f;const e=super.asClearRaw();return!((i=e==null?void 0:e.createdAt)!=null&&i.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.lastLoginDate)!=null&&o.from)&&!((u=e==null?void 0:e.lastLoginDate)!=null&&u.to)&&delete e.lastLoginDate,!((g=e==null?void 0:e.noOrdersPeriod)!=null&&g.from)&&!((f=e==null?void 0:e.noOrdersPeriod)!=null&&f.to)&&delete e.noOrdersPeriod,e}}class nr extends G{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=p.isString(e==null?void 0:e.createdAt)?l.parseISO(e.createdAt):(e==null?void 0:e.createdAt)??new Date,this.creator=new $(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class _r extends A{constructor(e){var i,s,o,u;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");t(this,"salesDirection");t(this,"managers");t(this,"curators");this.contacts=((i=e.contacts)==null?void 0:i.map(g=>new Y(g)))??void 0,this.lastOrder=e.lastOrder?new nr(e.lastOrder):void 0,this.partnerGroups=((s=e.partnerGroups)==null?void 0:s.map(g=>new K(g)))??void 0,this.preferredDeliveryType=e.preferredDeliveryType?new q(e.preferredDeliveryType):void 0,this.salesDirection=e.salesDirection?new d(e.salesDirection):void 0,this.managers=((o=e.managers)==null?void 0:o.map(g=>new Te(g)))??void 0,this.curators=((u=e.curators)==null?void 0:u.map(g=>new Oe(g)))??void 0}}class de extends G{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class Ur extends Y{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(i=>new de(i))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(i=>new de(i))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(i=>new de(i))))}}class N extends me{static transformClientDataToRequest(r){var i;return{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(s=>s.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,preferred_warehouse_id:(i=r.preferredWarehouse)==null?void 0:i.id}}static transformContragentClientDataToRequest(r){var u,g,f,a;let e;const i=r,s=r,o=r;switch(r.opf.slug){case _.Ic:e={opf:i.opf.slug,name:i.name,alternative_name:i.alternativeName,partner_group_id:(u=i.partnerGroup)==null?void 0:u.id,comment:i.comment,inn:i.inn,okpo:i.okpo,director_name:i.directorName,director_position:i.directorPosition,director_acts_on:i.directorActsOn,legal_address:i.legalAddress,postal_address:i.postalAddress,actual_address:i.actualAddress};break;case _.UlR:e={opf:s.opf.slug,name:s.name,alternative_name:s.alternativeName,partner_group_id:(g=s.partnerGroup)==null?void 0:g.id,comment:s.comment,inn:s.inn,kpp:s.kpp,okpo:s.okpo,director_name:s.directorName,director_position:s.directorPosition,director_acts_on:s.directorActsOn,legal_address:s.legalAddress,postal_address:s.postalAddress,actual_address:s.actualAddress};break;case _.UlNr:e={opf:o.opf.slug,name:o.name,alternative_name:o.alternativeName,partner_group_id:(f=o.partnerGroup)==null?void 0:f.id,comment:o.comment,director_name:o.directorName,director_position:o.directorPosition,director_acts_on:o.directorActsOn,legal_address:o.legalAddress,postal_address:o.postalAddress,actual_address:o.actualAddress,registration_country_id:o.registrationCountry.id,registration_number:o.registrationNumber,tax_number:o.taxNumber||void 0};break;default:e={opf:r.opf.slug,name:r.name,alternative_name:r.alternativeName,partner_group_id:(a=r.partnerGroup)==null?void 0:a.id,comment:r.comment};break}return e}static transformClientDeliveryAddressToRequest(r){var i,s;const e={address:r.address,is_one_time:r.isOneTime??!1,is_transport_company_address:r.isTransportCompanyAddress??!1,comment:r.comment??""};return r.coordinates&&(e.coordinates={lat:(i=r.coordinates)==null?void 0:i.lat,long:(s=r.coordinates)==null?void 0:s.long}),r.operatingHours&&(e.operating_hours={from:r.operatingHours.from,to:r.operatingHours.to}),e}static transformClientContragentBankAccountToRequest(r){return{bank_name:r.bankName,bic:r.bic,account_number:r.accountNumber,correspondent_account:r.correspondentAccount,currency_id:r.currency.id}}getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new ir(e.data))}getClientsList(r,e,i,s,o=void 0){return this.getPaginated("/internal/clients",r,e,i,s,u=>{const g={...u.data};return g.data=g.data.map(f=>new J(f)),g},void 0,o)}searchClient(r){return this.getClientsList(void 0,void 0,void 0,{searchTerm:r}).then(e=>e.data)}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:Ie.Contains,value:r}]})}getAdditionalClientsData(r,e){const i=r.map(s=>s.id);return this.post("/internal/clients/additional-data",{clients:i,requested_data_types:e},s=>{let o=[];return(s==null?void 0:s.data.length)>0&&(o=s.data.map(u=>new _r(u))),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(s=>new Ur(s))),i})}createClientCommonData(r,e={}){return this.post("/internal/clients",N.transformClientDataToRequest(r),i=>new ir(i.data),e)}updateClientCommonData(r,e={}){return this.patch(`/internal/clients/${r.id}`,N.transformClientDataToRequest(r),void 0,e)}updateClientNotDistribCommonData(r,e={}){const i={get_news:r.getNews};return this.patch(`/internal/clients/${r.id}`,i,void 0,e)}changeClientPassword(r,e,i,s={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:i},void 0,s)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/attach`,{is_primary:s.isDefault}));await Promise.all(i)}async detachClientFromManagers(r,e){const i=e.map(s=>this.patch(`/internal/clients/${r}/managers/${s.id}/detach`));await Promise.all(i)}attachToCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/attach`,{curated_direction_id:i.id})}detachFromCurator(r,e,i){return this.patch(`/internal/clients/${r}/curators/${e}/detach`,{curated_direction_id:i.id})}setCurators(r,e){return this.patch(`/internal/clients/${r}/curators`,{curators:e.map(i=>({curator_id:i.curatorId,curated_direction_id:i.curatedDirection.id}))})}createContragentClientData(r,e,i={}){return this.post(`/internal/clients/${r}/contragents`,N.transformContragentClientDataToRequest(e),s=>ye.createInstance(s.data),i)}updateContragentClientData(r,e,i={}){return this.patch(`/internal/clients/${r}/contragents/${e.id}`,N.transformContragentClientDataToRequest(e),s=>ye.createInstance(s.data),i)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,i={}){return this.post(`/internal/clients/${r}/delivery-addresses`,N.transformClientDeliveryAddressToRequest(e),s=>new ae(s.data),i)}updateClientDeliveryAddress(r,e,i={}){return this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,N.transformClientDeliveryAddressToRequest(e),s=>new ae(s.data),i)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,i,s={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,N.transformClientContragentBankAccountToRequest(i),o=>new $e(o.data),s)}updateContragentBankAccount(r,e,i,s={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${i.id}`,N.transformClientContragentBankAccountToRequest(i),o=>new $e(o.data),s)}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},s=>new Y(s.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,s={}){return this.createContact(r,i,{contragents:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}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,s={}){return this.createContact(r,i,{addresses:[{id:e,is_primary:i.isPrimary??!1,not_disturb:i.notDisturb??!1}]},s)}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,s={}){var u,g;const o={name:e.name,position:e.position,comment:e.comment,...i};return(u=e.phone)!=null&&u.length&&(o.phone=e.phone),(g=e.email)!=null&&g.length&&(o.email=e.email),this.post(`/internal/clients/${r}/contacts`,o,f=>new Y(f.data),s)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class vt extends y{checkPhoneIsBusy(r){return new Promise((e,i)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(s=>{e(!!s.isBusy)}).catch(i)})}}class wt{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=p.isString(r==null?void 0:r.date)?l.parseISO(r.date):(r==null?void 0:r.date)??new Date,this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}var Hr=(n=>(n.Kozyrek="kozyrek",n.Mosquitto="mosquitto",n.Strip="strip",n.MetalForDoors="metal_for_doors",n.Sandwich="sandwich",n.SandwichM2="sandwich_m2",n))(Hr||{});class Dt extends y{getConfiguratorSettings(r,e){var i;return this.get(`internal/catalog/categories/${r.id}/configurators/${(i=r.properties)==null?void 0:i.configurator}/settings?client_id=${e}`)}searchProduct(r,e,i,s={}){var u;const o=this.get(`internal/catalog/categories/${r.id}/configurators/${(u=r.properties)==null?void 0:u.configurator}/product`,{params:i,client_id:e},g=>new I(g.data));return o.catch(g=>{this.errorResponseHandler(g,s)}),o}createTemplate(r,e,i,s={}){var o;return this.post(`internal/catalog/categories/${r.id}/configurators/${(o=r.properties)==null?void 0:o.configurator}/template?client_id=${e}`,{...i},()=>{},s)}removeTemplate(r,e,i){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/template/${i}?client_id=${e}`)}calculate(r,e,i){var s;return this.get(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.configurator}/calculate`,{client_id:e,...i})}}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 Pt 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 Rt{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 w{static decadeInterval(r){const[e,i]=w.shiftedDecadeBounds(r,0);return{from:e,to:i}}static shiftDecadeInterval(r,e){const[i,s]=w.shiftedDecadeBounds(r,e);return{from:i,to:s}}static startOfHalfYear(r){return new Date(r.getFullYear(),r.getMonth()<6?0:6,1)}static endOfHalfYear(r){return l.endOfMonth(new Date(r.getFullYear(),r.getMonth()<6?5:11,1))}static addHalfYears(r,e){return l.addMonths(r,e*6)}static intervalTillSameDate(r,e,i){const s=l.differenceInCalendarMonths(l.startOfMonth(i),l.startOfMonth(r)),o=l.startOfMonth(l.addMonths(e,s)),u=Math.min(l.getDate(i),l.getDaysInMonth(o));return{from:l.startOfDay(e),to:l.endOfDay(l.setDate(o,u))}}static weekTillSameWeekday(r,e){const i=l.startOfWeek(l.addWeeks(r,e),{weekStartsOn:1}),s=l.differenceInCalendarDays(r,l.startOfWeek(r,{weekStartsOn:1}));return{from:i,to:l.endOfDay(l.addDays(i,s))}}static decadeTillSameDayNumber(r,e){const[i]=w.shiftedDecadeBounds(r,0),s=l.differenceInCalendarDays(r,i)+1,[o,u]=w.shiftedDecadeBounds(r,e),g=l.differenceInCalendarDays(u,o)+1;return{from:o,to:l.endOfDay(l.addDays(o,Math.min(s,g)-1))}}static shiftedDecadeBounds(r,e){const i=l.getDate(r);let s=2;i<=10?s=0:i<=20&&(s=1);const o=s+e,u=Math.floor(o/3),g=(o%3+3)%3,f=l.startOfMonth(l.addMonths(r,u)),a=l.addDays(f,g*10),C=g===2?l.endOfMonth(f):l.endOfDay(l.addDays(a,9));return[a,C]}}class St{static defaultDateRanges(r){const e=l.addBusinessDays(new Date,1),i=new Date,s=l.startOfYear(r===void 0?i:new Date(r,0,1)),o=l.endOfYear(s);return{nextWorkingDay:{label:"Следующий рабочий день",from:l.startOfDay(e),to:l.endOfDay(e)},today:{label:"Сегодня",from:l.startOfToday(),to:l.endOfToday()},yesterday:{label:"Вчера",from:l.startOfYesterday(),to:l.endOfYesterday()},tomorrow:{label:"Завтра",from:l.startOfTomorrow(),to:l.endOfTomorrow()},currentWeek:{label:"Неделя",from:l.startOfWeek(i,{weekStartsOn:1}),to:l.endOfWeek(i,{weekStartsOn:1})},currentMonth:{label:"Месяц",from:l.startOfMonth(i),to:l.endOfMonth(i)},oneMonth:{label:"1 месяц",from:s,to:l.endOfMonth(s)},threeMonths:{label:"3 месяца",from:s,to:l.endOfMonth(l.addMonths(s,2))},nineMonths:{label:"9 месяцев",from:s,to:l.endOfMonth(l.addMonths(s,8))},firstQuarter:{label:"I квартал",from:s,to:l.endOfMonth(l.addMonths(s,2))},secondQuarter:{label:"II квартал",from:l.addMonths(s,3),to:l.endOfMonth(l.addMonths(s,5))},thirdQuarter:{label:"III квартал",from:l.addMonths(s,6),to:l.endOfMonth(l.addMonths(s,8))},fourthQuarter:{label:"IV квартал",from:l.addMonths(s,9),to:l.endOfMonth(l.addMonths(s,11))},firstHalfYear:{label:"I полугодие",from:s,to:l.endOfMonth(l.addMonths(s,5))},secondHalfYear:{label:"II полугодие",from:l.addMonths(s,6),to:o},currentYear:{label:"12 месяцев",from:s,to:o}}}static standardPeriods(r=new Date){const e={weekStartsOn:1},i=l.startOfDay(r),s=l.endOfDay(r),o=w.decadeInterval(r),u=l.startOfMonth(r),g=l.startOfQuarter(r),f=w.startOfHalfYear(r),a=l.startOfYear(r),C=w.addHalfYears(r,-1),P=w.addHalfYears(r,1);return{yesterday:{label:"Вчера",group:"day",from:l.startOfDay(l.subDays(r,1)),to:l.endOfDay(l.subDays(r,1))},today:{label:"Сегодня",group:"day",from:i,to:s},tomorrow:{label:"Завтра",group:"day",from:l.startOfDay(l.addDays(r,1)),to:l.endOfDay(l.addDays(r,1))},lastWeek:{label:"Прошлая неделя",group:"week",from:l.startOfWeek(l.subWeeks(r,1),e),to:l.endOfWeek(l.subWeeks(r,1),e)},thisWeek:{label:"Эта неделя",group:"week",from:l.startOfWeek(r,e),to:l.endOfWeek(r,e)},nextWeek:{label:"Следующая неделя",group:"week",from:l.startOfWeek(l.addWeeks(r,1),e),to:l.endOfWeek(l.addWeeks(r,1),e)},lastTenDays:{label:"Прошлая декада",group:"decade",...w.shiftDecadeInterval(r,-1)},thisTenDays:{label:"Эта декада",group:"decade",...o},nextTenDays:{label:"Следующая декада",group:"decade",...w.shiftDecadeInterval(r,1)},lastMonth:{label:"Прошлый месяц",group:"month",from:l.startOfMonth(l.subMonths(r,1)),to:l.endOfMonth(l.subMonths(r,1))},thisMonth:{label:"Этот месяц",group:"month",from:u,to:l.endOfMonth(r)},nextMonth:{label:"Следующий месяц",group:"month",from:l.startOfMonth(l.addMonths(r,1)),to:l.endOfMonth(l.addMonths(r,1))},lastQuarter:{label:"Прошлый квартал",group:"quarter",from:l.startOfQuarter(l.subQuarters(r,1)),to:l.endOfQuarter(l.subQuarters(r,1))},thisQuarter:{label:"Этот квартал",group:"quarter",from:g,to:l.endOfQuarter(r)},nextQuarter:{label:"Следующий квартал",group:"quarter",from:l.startOfQuarter(l.addQuarters(r,1)),to:l.endOfQuarter(l.addQuarters(r,1))},lastHalfYear:{label:"Прошлое полугодие",group:"halfYear",from:w.startOfHalfYear(C),to:w.endOfHalfYear(C)},thisHalfYear:{label:"Это полугодие",group:"halfYear",from:f,to:w.endOfHalfYear(r)},nextHalfYear:{label:"Следующее полугодие",group:"halfYear",from:w.startOfHalfYear(P),to:w.endOfHalfYear(P)},lastYear:{label:"Прошлый год",group:"year",from:l.startOfYear(l.subYears(r,1)),to:l.endOfYear(l.subYears(r,1))},thisYear:{label:"Этот год",group:"year",from:a,to:l.endOfYear(r)},nextYear:{label:"Следующий год",group:"year",from:l.startOfYear(l.addYears(r,1)),to:l.endOfYear(l.addYears(r,1))},fromBeginningOfThisWeek:{label:"С начала этой недели",group:"other",section:"fromBeginning",from:l.startOfWeek(r,e),to:s},fromBeginningOfThisTenDays:{label:"С начала этой декады",group:"other",section:"fromBeginning",from:o.from,to:s},fromBeginningOfThisMonth:{label:"С начала этого месяца",group:"other",section:"fromBeginning",from:u,to:s},fromBeginningOfThisQuarter:{label:"С начала этого квартала",group:"other",section:"fromBeginning",from:g,to:s},fromBeginningOfThisHalfYear:{label:"С начала этого полугодия",group:"other",section:"fromBeginning",from:f,to:s},fromBeginningOfThisYear:{label:"С начала этого года",group:"other",section:"fromBeginning",from:a,to:s},tillEndOfThisWeek:{label:"До конца этой недели",group:"other",section:"tillEnd",from:i,to:l.endOfWeek(r,e)},tillEndOfThisTenDays:{label:"До конца этой декады",group:"other",section:"tillEnd",from:i,to:o.to},tillEndOfThisMonth:{label:"До конца этого месяца",group:"other",section:"tillEnd",from:i,to:l.endOfMonth(r)},tillEndOfThisQuarter:{label:"До конца этого квартала",group:"other",section:"tillEnd",from:i,to:l.endOfQuarter(r)},tillEndOfThisHalfYear:{label:"До конца этого полугодия",group:"other",section:"tillEnd",from:i,to:w.endOfHalfYear(r)},tillEndOfThisYear:{label:"До конца этого года",group:"other",section:"tillEnd",from:i,to:l.endOfYear(r)},lastWeekTillSameWeekDay:{label:"Прошлая неделя, до такого же дня недели",group:"other",section:"lastTillSame",...w.weekTillSameWeekday(r,-1)},lastTenDaysTillSameDayNumber:{label:"Прошлая декада, до такого же номера дня",group:"other",section:"lastTillSame",...w.decadeTillSameDayNumber(r,-1)},lastMonthTillSameDate:{label:"Прошлый месяц, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(u,l.startOfMonth(l.subMonths(r,1)),r)},lastQuarterTillSameDate:{label:"Прошлый квартал, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.subQuarters(r,1)),r)},lastHalfYearTillSameDate:{label:"Прошлое полугодие, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(f,w.startOfHalfYear(C),r)},lastYearTillSameDate:{label:"Прошлый год, до такой же даты",group:"other",section:"lastTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.subYears(r,1)),r)},nextWeekTillSameWeekDay:{label:"Следующая неделя, до такого же дня недели",group:"other",section:"nextTillSame",...w.weekTillSameWeekday(r,1)},nextTenDaysTillSameDayNumber:{label:"Следующая декада, до такого же номера дня",group:"other",section:"nextTillSame",...w.decadeTillSameDayNumber(r,1)},nextMonthTillSameDate:{label:"Следующий месяц, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(u,l.startOfMonth(l.addMonths(r,1)),r)},nextQuarterTillSameDate:{label:"Следующий квартал, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(g,l.startOfQuarter(l.addQuarters(r,1)),r)},nextHalfYearTillSameDate:{label:"Следующее полугодие, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(f,w.startOfHalfYear(P),r)},nextYearTillSameDate:{label:"Следующий год, до такой же даты",group:"other",section:"nextTillSame",...w.intervalTillSameDate(a,l.startOfYear(l.addYears(r,1)),r)},last7Days:{label:"Последние 7 дней",group:"other",section:"rollingDays",from:l.startOfDay(l.subDays(r,6)),to:s},next7Days:{label:"Следующие 7 дней",group:"other",section:"rollingDays",from:i,to:l.endOfDay(l.addDays(r,6))}}}}const Tt=[{key:"day",label:"День"},{key:"week",label:"Неделя"},{key:"decade",label:"Декада"},{key:"month",label:"Месяц"},{key:"quarter",label:"Квартал"},{key:"halfYear",label:"Полугодие"},{key:"year",label:"Год"},{key:"other",label:"Прочее"}],bt=[{key:"fromBeginning",label:"С начала периода"},{key:"tillEnd",label:"До конца периода"},{key:"lastTillSame",label:"Прошлые, до такой же даты"},{key:"nextTillSame",label:"Следующие, до такой же даты"},{key:"rollingDays",label:"7 дней"}];class or{static productIsMeasurable(r){return r.unit.isLinear||r.unit.isSquare}static getProductMultiplicity(r){var e,i;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((i=r.properties)!=null&&i.minCount)&&!or.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,i,s;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((i=r.properties)!=null&&i.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)?r.properties.minCount:.01}}const ne=class ne extends y{constructor(){super();t(this,"responseDataCacheTimeout");this.responseDataCacheTimeout=k().config.http.responseDataCacheTimeout}static getCachedResponse(e){const i=ne.responseDataCache.get(e);if(i&&i.validTo>new Date)return i.val}cacheResponse(e,i){ne.responseDataCache.set(e,{validTo:l.addSeconds(new Date,this.responseDataCacheTimeout),val:i})}getTypedDataArrayRequester(e,i,s=!1,o={}){const u=i+(p.isEmpty(o)?"":` >>> ${JSON.stringify(o)}`),g=s?ne.getCachedResponse(u):void 0;return g?Promise.resolve(g):this.get(i,o).then(f=>{const a=f.map(C=>Se.instanceInitializer(e,C));return s&&a&&this.cacheResponse(i,a),a})}};t(ne,"responseDataCache",new Map);let se=ne;function At(n,r){const e=[2,0,1,1,1,2];return r[n%100>4&&n%100<20?2:e[Math.min(n%10,5)]]}class Ot{static generateUndefinedManagerInstance(){return new ee({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Yr extends se{async getManagers(){const r="/internal/managers",e=se.getCachedResponse(r);if(e)return e;const s=(await this.get(r)).data.map(o=>Se.instanceInitializer(ee,o));return this.cacheResponse(r,s),s}}class cr extends nr{constructor(e){var i,s,o,u,g,f,a,C;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");t(this,"sum");t(this,"isLargeOrder");this.client=new J(e==null?void 0:e.client),this.payment={type:((i=e==null?void 0:e.payment)==null?void 0:i.type)??-1,status:((s=e==null?void 0:e.payment)==null?void 0:s.status)??-1,onlinePaymentLink:(o=e==null?void 0:e.payment)==null?void 0:o.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:p.isString((g=e==null?void 0:e.delivery)==null?void 0:g.date)?l.parseISO(e.delivery.date):((f=e==null?void 0:e.delivery)==null?void 0:f.date)??new Date,address:(a=e==null?void 0:e.delivery)!=null&&a.address?new ae(e.delivery.address):void 0,warehouse:(C=e==null?void 0:e.delivery)!=null&&C.warehouse?new Z(e.delivery.warehouse):void 0},this.attachedUser=e!=null&&e.attachedUser?new $(e==null?void 0:e.attachedUser):void 0,this.status=(e==null?void 0:e.status)??0,this.salesDirection=new d(e==null?void 0:e.salesDirection),this.pendingAt=p.isString(e==null?void 0:e.pendingAt)?l.parseISO(e.pendingAt):e==null?void 0:e.pendingAt,this.processedAt=p.isString(e==null?void 0:e.processedAt)?l.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,this.sum=(e==null?void 0:e.sum)??0,this.isLargeOrder=(e==null?void 0:e.isLargeOrder)??!1}}class lr extends D{}class ur extends D{}class kt extends sr{constructor(e){var i,s,o,u;super();t(this,"attachedUsers");t(this,"clientSearchTerm");t(this,"client");t(this,"contragent");t(this,"createdAt",new S);t(this,"creator");t(this,"deliveryDate",new S);t(this,"deliveryAddressSearch");t(this,"clientCities");t(this,"id");t(this,"isApproved");t(this,"isApproved1c");t(this,"isNotInStock");t(this,"isOnOrder");t(this,"pendingAt",new S);t(this,"processedAt",new S);t(this,"salesDirections");t(this,"status");t(this,"deliveryType");t(this,"paymentType");t(this,"warehouses");t(this,"isLargeOrder");t(this,"isToProcess");t(this,"onlyMyRegions");this.attachedUsers=(i=e==null?void 0:e.attachedUsers)==null?void 0:i.map(g=>"isActive"in g?new ee(g):new lr(g)),this.clientSearchTerm=e==null?void 0:e.clientSearchTerm,this.client=e!=null&&e.client?new J(e.client):void 0,this.contragent=e==null?void 0:e.contragent,this.createdAt=new S(e==null?void 0:e.createdAt),this.creator=e!=null&&e.creator?new $(e.creator):void 0,this.deliveryDate=new S(e==null?void 0:e.deliveryDate),this.deliveryAddressSearch=e==null?void 0:e.deliveryAddressSearch,this.clientCities=(s=e==null?void 0:e.clientCities)==null?void 0:s.map(g=>new fe(g)),this.id=e==null?void 0:e.id,this.isApproved=e==null?void 0:e.isApproved,this.isApproved1c=e==null?void 0:e.isApproved1c,this.isNotInStock=e==null?void 0:e.isNotInStock,this.isOnOrder=e==null?void 0:e.isOnOrder,this.isLargeOrder=e==null?void 0:e.isLargeOrder,this.pendingAt=new S(e==null?void 0:e.pendingAt),this.processedAt=new S(e==null?void 0:e.processedAt),this.salesDirections=(o=e==null?void 0:e.salesDirections)==null?void 0:o.map(g=>new d(g)),this.status=e==null?void 0:e.status,this.deliveryType=e!=null&&e.deliveryType?new q(e.deliveryType):void 0,this.paymentType=e!=null&&e.paymentType?new ur(e.paymentType):void 0,this.warehouses=(u=e==null?void 0:e.warehouses)==null?void 0:u.map(g=>new Z(g)),this.isToProcess=e==null?void 0:e.isToProcess}resetFilterValue(e){switch(e){case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"creator":this.creator=void 0;break;case"deliveryDate":this.deliveryDate.from=null,this.deliveryDate.to=null;break;case"deliveryType":this.deliveryType=new q;break;case"clientCities":this.clientCities=[];break;case"pendingAt":this.pendingAt.from=null,this.pendingAt.to=null;break;case"processedAt":this.processedAt.from=null,this.processedAt.to=null;break;case"salesDirection":this.salesDirections=[];break;case"status":this.status=[];break;case"warehouse":this.warehouses=[];break;default:this[e]=void 0;break}return this}asClearRaw(){var i,s,o,u,g,f,a,C;const e=super.asClearRaw();return!((i=e==null?void 0:e.createdAt)!=null&&i.from)&&!((s=e==null?void 0:e.createdAt)!=null&&s.to)&&delete e.createdAt,!((o=e==null?void 0:e.deliveryDate)!=null&&o.from)&&!((u=e==null?void 0:e.deliveryDate)!=null&&u.to)&&delete e.deliveryDate,!((g=e==null?void 0:e.pendingAt)!=null&&g.from)&&!((f=e==null?void 0:e.pendingAt)!=null&&f.to)&&delete e.pendingAt,!((a=e==null?void 0:e.processedAt)!=null&&a.from)&&!((C=e==null?void 0:e.processedAt)!=null&&C.to)&&delete e.processedAt,e}}class jr extends Ye{constructor(e){super(e);t(this,"product");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");t(this,"currency");this.product=new H(e.product),this.currency=new L(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 Ne extends cr{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 jr(i)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?ye.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new D(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class It extends me{getOrders(r,e,i,s=void 0){return this.getPaginated("/internal/orders",r,e,i,{},o=>{const u={...o.data};return u.data=u.data.map(g=>new cr(g)),u},void 0,s)}getOrdersCount(r,e=void 0){return this.get("/internal/orders/count",r?{filters:JSON.stringify((r instanceof B?r:new B(r)).toPrimitive())}:{},void 0,void 0,e).then(i=>i.count)}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new Ne(e.data))}addOrderProduct(r,e,i={}){return this.post(`/internal/orders/${r}/products`,{product_id:e.product.id,product_category_id:e.configurator?e.category.id:void 0,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,is_additional_sale:e.isAdditionalSale,...e.configuratorParams},s=>new Ne(s.data),i)}patchOrderProduct(r,e,i,s={}){return this.patch(`/internal/orders/${r}/products/${e}`,{product_id:i.product.id,product_category_id:i.configurator?i.category.id:void 0,quantity:i.quantity,height:i.height,length:i.length,width:i.width,configurator:i.configurator,marker:i.marker,...i.configuratorParams},o=>new Ne(o.data),s)}}class qe{constructor(r){t(this,"client");t(this,"product");t(this,"cost");t(this,"costCoefficient");t(this,"source");this.client=new J(r==null?void 0:r.client),this.product=new I(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)??Re.Product}}const pr=n=>{var r,e,i,s,o;return n?p.omitBy({cities:(r=n.cities)==null?void 0:r.map(u=>u.id),clients:(e=n.clients)==null?void 0:e.map(u=>u.id),managers:(i=n.managers)==null?void 0:i.map(u=>u.id),partnerGroups:(s=n.partnerGroups)==null?void 0:s.map(u=>u.id),salesDirections:(o=n.salesDirections)==null?void 0:o.map(u=>u.id),hideNotActive:n.hideNotActive},u=>p.isNil(u)||(p.isArray(u)||p.isObject(u))&&p.isEmpty(u)):{}},Wr=n=>{const r={};return n.from&&(n.from.coefficient||n.from.value)&&(r.from={},n.from.coefficient&&(r.from.priceCoefficientId=n.from.coefficient.id),n.from.value&&(r.from.increasePercent=n.from.value)),n.to&&(n.to.coefficient||n.to.value)&&(r.to={},n.to.coefficient&&(r.to.priceCoefficientId=n.to.coefficient.id),n.to.value&&(r.to.increasePercent=n.to.value)),r};class $t extends y{analyzeProductPrices(r,e,i){return this.get(`/internal/price/products/${r}/analyze`,{...Wr(e),filters:pr(i)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPrices(r,e,i){return this.get(`/internal/price/categories/${r}/analyze`,{...Wr(e),filters:pr(i)},s=>s.data.map(o=>new qe(o)))}analyzeCategoryPricesBySquare(r,e,i){return this.get(`/internal/price/categories/${r}/analyze/square`,{...e,filters:pr(i)},s=>s.data.map(o=>new qe(o)))}}class Gr{constructor(r){t(this,"cost");t(this,"isLowCost");t(this,"isRetail");t(this,"costDate");t(this,"discountName");t(this,"priceTemplateName");t(this,"product");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost??0,this.isLowCost=r.isLowCost??!1,this.isRetail=r.isRetail??!1,this.costDate=p.isString(r.costDate)?l.parseISO(r.costDate):r.costDate??new Date,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.product=r.product?new E(r.product):void 0,this.client=r.client?new $(r.client):void 0,this.executor=r.executor?new $(r.executor):void 0,this.currency=r.currency?new L(r.currency):void 0}}class zr extends E{constructor(e){super(e);t(this,"history");this.history=p.map(e.history,i=>new Gr(i))}}class Lt extends y{getProductPriceHistory(r){var o,u,g,f,a;const e=k().config.dateFormats.api,i=p.omitBy(p.merge(r,{costDate:{from:p.isDate((o=r.costDate)==null?void 0:o.from)?l.format(r.costDate.from,e):(u=r.costDate)==null?void 0:u.from,to:p.isDate((g=r.costDate)==null?void 0:g.to)?l.format(r.costDate.to,e):(f=r.costDate)==null?void 0:f.to}}),C=>p.isNil(C)||(p.isArray(C)||p.isObject(C))&&p.isEmpty(C)),s=((a=r.product)==null?void 0:a[0])??0;return delete i.product,this.get(`/internal/price/products/${s}/history`,i).then(C=>[new zr(p.merge(C[0],{history:C}))])}}class hr{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new E(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new E(e)))}}class dt extends y{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new hr(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new hr(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)})}}var Qr=(n=>(n.New="new",n.WorkedOut="worked_out",n.Pending="pending",n.Completed="completed",n.Declined="declined",n.Deleted="deleted",n))(Qr||{});class Jr extends D{}class Nt extends D{}class Vr extends D{}class xr extends D{}class Kr extends D{}class Xr extends D{}class qt{static generateUndefinedInstance(r,e="- Не определён -"){return new r({id:0,name:e,slug:"-undefined-"})}static isUndefinedInstance(r){return r.id===0&&r.slug==="-undefined-"}}class gr extends D{}class T extends se{getReference(r,e=!1){return this.getTypedDataArrayRequester(Jr,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(rr,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(Vr,"/internal/references/contact-position",!0)}getCuratedDirection(){return this.getTypedDataArrayRequester(be,"/internal/references/curated-direction",!0)}getCurrency(){return this.getTypedDataArrayRequester(L,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(K,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(j,"/public/references/opf",!0)}getOperators(){return this.getTypedDataArrayRequester(lr,"/internal/references/operator",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(xr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(Kr,"/internal/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(ur,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(gr,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(d,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(tr,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(fe,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(re,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(Q,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(q,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(Z,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Je,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(pe,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(Xr,"/public/references/product-file-type",!0)}}const b=W.defineStore("common.references_private",()=>{const n=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),i=m.ref(void 0),s=m.ref(void 0),o=m.ref(void 0),u=m.ref(void 0),g=m.ref(void 0),f=m.ref(void 0),a=m.ref(void 0),C=m.ref(void 0),P=m.ref(void 0),Ce=m.ref(void 0),ve=m.ref(void 0),oe=m.ref(void 0),ce=m.ref(void 0),mr=m.ref(void 0),yr=m.ref(void 0),h=m.ref(void 0);return{dataLoaderList:n,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:i,deliveryTypeReference:s,managersList:o,opfReference:u,operatorReference:g,orderPaymentStatusReference:f,orderStatusReference:a,paymentTypeReference:C,partnerGroupReference:P,productFileTypeReference:Ce,resourceTypesReference:ve,salesDirectionsReference:oe,sourcePrimaryInterestReference:ce,warehousesReference:mr,propertyTypesReference:yr,priceCoefficientsReference:h}}),Mt=W.defineStore("common.references",()=>{const n=m.computed(()=>{const h=b();return!h.channelPrimaryInterestReference&&!h.dataLoaderList.channelPrimaryInterestReference&&(h.dataLoaderList.channelPrimaryInterestReference=!0,y.getInstance(T).getChannelPrimaryInterest().then(v=>{h.channelPrimaryInterestReference=v}).catch(p.noop)),h.channelPrimaryInterestReference}),r=m.computed(()=>{const h=b();return!h.contactPositionsReference&&!h.dataLoaderList.contactPositionsReference&&(h.dataLoaderList.contactPositionsReference=!0,y.getInstance(T).getContactPositions().then(v=>{h.contactPositionsReference=v}).catch(p.noop)),h.contactPositionsReference}),e=m.computed(()=>{const h=b();return!h.currencyReference&&!h.dataLoaderList.currencyReference&&(h.dataLoaderList.currencyReference=!0,y.getInstance(T).getCurrency().then(v=>{h.currencyReference=v}).catch(p.noop)),h.currencyReference}),i=m.computed(()=>{const h=b();return!h.opfReference&&!h.dataLoaderList.opfReference&&(h.dataLoaderList.opfReference=!0,y.getInstance(T).getOpf().then(v=>{h.opfReference=v}).catch(p.noop)),h.opfReference}),s=m.computed(()=>{const h=b();return!h.operatorReference&&!h.dataLoaderList.operatorReference&&(h.dataLoaderList.operatorReference=!0,y.getInstance(T).getOperators().then(v=>{h.operatorReference=v}).catch(p.noop)),h.operatorReference}),o=m.computed(()=>{const h=b();return!h.orderPaymentStatusReference&&!h.dataLoaderList.orderPaymentStatusReference&&(h.dataLoaderList.orderPaymentStatusReference=!0,y.getInstance(T).getOrderPaymentStatuses().then(v=>{h.orderPaymentStatusReference=v}).catch(p.noop)),h.orderPaymentStatusReference}),u=m.computed(()=>{const h=b();return!h.orderStatusReference&&!h.dataLoaderList.orderStatusReference&&(h.dataLoaderList.orderStatusReference=!0,y.getInstance(T).getOrderStatuses().then(v=>{h.orderStatusReference=v}).catch(p.noop)),h.orderStatusReference}),g=m.computed(()=>{const h=b();return!h.paymentTypeReference&&!h.dataLoaderList.paymentTypeReference&&(h.dataLoaderList.paymentTypeReference=!0,y.getInstance(T).getPaymentTypes().then(v=>{h.paymentTypeReference=v}).catch(p.noop)),h.paymentTypeReference}),f=m.computed(()=>{const h=b();return!h.partnerGroupReference&&!h.dataLoaderList.partnerGroupReference&&(h.dataLoaderList.partnerGroupReference=!0,y.getInstance(T).getPartnerGroup().then(v=>{h.partnerGroupReference=v}).catch(p.noop)),h.partnerGroupReference}),a=m.computed(()=>{const h=b();return!h.productFileTypeReference&&!h.dataLoaderList.productFileTypeReference&&(h.dataLoaderList.productFileTypeReference=!0,y.getInstance(T).getProductFileType().then(v=>{h.productFileTypeReference=v}).catch(p.noop)),h.productFileTypeReference}),C=m.computed(()=>{const h=b();return!h.resourceTypesReference&&!h.dataLoaderList.resourceTypesReference&&(h.dataLoaderList.resourceTypesReference=!0,y.getInstance(T).getResourceTypes().then(v=>{h.resourceTypesReference=v}).catch(p.noop)),h.resourceTypesReference}),P=m.computed(()=>{const h=b();return!h.salesDirectionsReference&&!h.dataLoaderList.salesDirectionsReference&&(h.dataLoaderList.salesDirectionsReference=!0,y.getInstance(T).getSalesDirections().then(v=>{h.salesDirectionsReference=v}).catch(p.noop)),h.salesDirectionsReference}),Ce=m.computed(()=>{const h=b();return!h.sourcePrimaryInterestReference&&!h.dataLoaderList.sourcePrimaryInterestReference&&(h.dataLoaderList.sourcePrimaryInterestReference=!0,y.getInstance(T).getSourcePrimaryInterest().then(v=>{h.sourcePrimaryInterestReference=v}).catch(p.noop)),h.sourcePrimaryInterestReference}),ve=m.computed(()=>{const h=b();return!h.deliveryTypeReference&&!h.dataLoaderList.deliveryTypeReference&&(h.dataLoaderList.deliveryTypeReference=!0,y.getInstance(T).getDeliveryTypes().then(v=>{h.deliveryTypeReference=v}).catch(p.noop)),h.deliveryTypeReference}),oe=m.computed(()=>{const h=b();return!h.managersList&&!h.dataLoaderList.managersList&&(h.dataLoaderList.managersList=!0,y.getInstance(Yr).getManagers().then(v=>{h.managersList=v}).catch(p.noop)),h.managersList}),ce=m.computed(()=>{const h=b();return!h.warehousesReference&&!h.dataLoaderList.warehousesReference&&(h.dataLoaderList.warehousesReference=!0,y.getInstance(T).getWarehouses().then(v=>{h.warehousesReference=v}).catch(p.noop)),h.warehousesReference}),mr=m.computed(()=>{const h=b();return!h.propertyTypesReference&&!h.dataLoaderList.propertyTypesReference&&(h.dataLoaderList.propertyTypesReference=!0,y.getInstance(T).getPropertyTypes().then(v=>{h.propertyTypesReference=v}).catch(p.noop)),h.propertyTypesReference}),yr=m.computed(()=>{const h=b();return!h.priceCoefficientsReference&&!h.dataLoaderList.priceCoefficientsReference&&(h.dataLoaderList.priceCoefficientsReference=!0,y.getInstance(T).getPriceCoefficients().then(v=>{h.priceCoefficientsReference=v}).catch(p.noop)),h.priceCoefficientsReference});return{channelPrimaryInterestsReference:n,contactPositionsReference:r,currencyReference:e,opfReference:i,operatorReference:s,orderPaymentStatusReference:o,orderStatusReference:u,paymentTypeReference:g,partnerGroupsReference:f,productFilesTypesReference:a,resourceTypesReference:C,salesDirectionsReference:P,sourcePrimaryInterestsReference:Ce,deliveryTypeReference:ve,managersList:oe,warehousesReference:ce,propertyTypesReference:mr,priceCoefficientsReference:yr}});class Zr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class fr{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");t(this,"tags");var e;this.resourceType=new gr(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 Zr(i)))??[],this.tags=r==null?void 0:r.tags}}class _t extends y{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},i=>new fr(i.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,i=>new fr(i.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}class Ut extends y{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(i=>{const s=[...i];let o=1;return s.forEach(u=>{u.id=o++}),s})}}var Er=(n=>(n.Admin="admin",n.Manager="manager",n.Operator="operator",n.Client="client",n.Guest="guest",n))(Er||{});class Fr extends Qe{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");t(this,"pricingRole");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo,this.pricingRole=e!=null&&e.pricingRole?new Ge(e.pricingRole):void 0}}class Ht extends y{constructor(){super(),this.baseUrl=`${k().config.http.portalApiUrl}/api`,this.interceptorIds.request.authRequestInterceptor&&this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor)}getAccessToken(){return this.get("internal/users/current-tokens").then(r=>r.accessToken)}}class et extends y{getCurrentUser(){return this.get("/internal/users/info",{},r=>new Fr(r.data),!0)}}const Bt=W.defineStore("common.user_state_private",()=>{const n=m.ref({}),r=m.ref(void 0);return{dataLoaderList:n,currentUser:r}}),Yt=W.defineStore("common.user_state",()=>({currentUser:m.computed(()=>{const r=Bt();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,y.getInstance(et).getCurrentUser().then(e=>{r.currentUser=e}).catch(p.noop).finally(()=>{r.dataLoaderList.currentUser=!1})),r.currentUser})}));class jt{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}c.AnyReference=Jr,c.AppBaseConfig=Pr,c.BankAccount=$e,c.BasePaginationProvider=me,c.CalculationTypeEnum=Or,c.CalendarHelper=w,c.Cart=he,c.CartProvider=it,c.CatalogProvider=ot,c.CatalogableItem=Be,c.Category=M,c.CategoryFilter=Lr,c.CategoryFilterSetting=xe,c.CategoryFilterValue=$r,c.CategoryPricingRule=Ve,c.ChannelPrimaryInterest=rr,c.City=Nt,c.CityWithRegionAndCountry=fe,c.Client=ir,c.ClientAdditionalData=_r,c.ClientCategory=ge,c.ClientDataProvider=N,c.ClientPriceProvider=ct,c.ClientPriceTemplateProvider=lt,c.ClientProduct=H,c.ClientProductCategoryDataProvider=ht,c.ClientProductDataProvider=gt,c.ClientShortInfo=J,c.ClientsAdditionalDataRequestTypeEnum=dr,c.ClientsListFilters=Ct,c.CodedIdentity=E,c.ConfiguratorProvider=Dt,c.ConfiguratorsEnum=Hr,c.Contact=Le,c.ContactLinks=We,c.ContactPerson=Y,c.ContactPersonRelated=Ur,c.ContactPosition=Vr,c.ContactRelation=de,c.ContragentBase=Ee,c.ContragentFactory=ye,c.ContragentIc=Fe,c.ContragentPerson=Nr,c.ContragentUlNr=qr,c.ContragentUlR=er,c.CostSourceEnum=Re,c.Country=Q,c.CuratedDirection=be,c.Curator=Oe,c.Currency=L,c.DataSuggestionProvider=Ut,c.DateTimeProvider=St,c.DeletableNamedIdentity=Mr,c.DeliveryAddress=ae,c.DeliveryType=q,c.DetailedJwtPayload=rt,c.DeviceTypeResolutionConfig=Cr,c.DiscountShortInfo=Sr,c.FieldValidationResultData=jt,c.FilterGroup=B,c.FilterItem=Ke,c.FilterOpEnum=Ie,c.FilterSettings=Ir,c.GeoCoordinates=Ue,c.HiddenCatalogableItem=br,c.HttpCachedRequester=se,c.HttpParamsConfig=vr,c.HttpRequester=y,c.Identity=G,c.Image=Ar,c.JwtPayload=U,c.Manager=ee,c.ManagerCommon=Te,c.ManagerDataFactory=Ot,c.ManagerDataProvider=Yr,c.MetaTagItem=Zr,c.NamedIdentity=A,c.Operator=lr,c.Opf=j,c.OpfEnum=_,c.Order=Ne,c.OrderInfo=cr,c.OrderItem=jr,c.OrderItemBase=Ye,c.OrderPaymentStatus=xr,c.OrderShortInfo=nr,c.OrderStatus=Kr,c.OrderStatusEnum=Qr,c.OrdersDataProvider=It,c.OrdersListFilters=kt,c.PaginationFiltersBase=sr,c.PartnerGroup=K,c.PaymentType=ur,c.PreferencesStorageProvider=ue,c.PriceAnalyze=qe,c.PriceAnalyzeProvider=$t,c.PriceCoefficient=pe,c.PriceCoefficientEnum=_e,c.PriceHistoryDataProvider=Lt,c.PriceHistoryItem=Gr,c.PriceTemplate=z,c.PriceTemplateCategory=Ae,c.PriceTemplateClient=te,c.PriceTemplateICatalogableItem=ze,c.PriceTemplateProduct=ke,c.PriceTemplateProvider=ft,c.PricingRole=ie,c.PricingRoleProvider=mt,c.PrimaryCatalogableItem=Pe,c.Product=I,c.ProductCategoryDataProvider=ut,c.ProductDataProvider=pt,c.ProductFileType=Xr,c.ProductFilterTypeEnum=je,c.ProductPriceCoefficient=De,c.ProductPriceHistory=zr,c.ProductUnit=He,c.PropertiesProvider=yt,c.Property=V,c.PropertyType=Je,c.PropertyTypeEnum=kr,c.PropertyValue=x,c.RecommendationsDataProvider=dt,c.RecommendationsList=hr,c.Reference=D,c.ReferenceDataFactory=qt,c.ReferenceDataProvider=T,c.Region=re,c.ResourceType=gr,c.STANDARD_PERIOD_GROUPS=Tt,c.STANDARD_PERIOD_SECTIONS=bt,c.SalesDirection=d,c.SentryConfig=wr,c.Seo=fr,c.SeoDataProvider=_t,c.SourcePrimaryInterest=tr,c.StockCount=Tr,c.TableDataPagination=Pt,c.TableDataPaginationRequestParams=Br,c.TableDataSortRequestParams=Rt,c.TemplateProductCategoryDataProvider=at,c.TemplatesListFilters=nt,c.TypedInstanceFactory=Se,c.UnitsHelper=or,c.UnknownClientDataProvider=vt,c.UpdatableNamedIdentity=Me,c.User=Fr,c.UserAuthDataProvider=Ht,c.UserCommonInfo=Qe,c.UserDataProvider=et,c.UserPricingRole=Ge,c.UserShortInfo=$,c.UserTypeEnum=Er,c.VersionConfig=wt,c.Warehouse=Z,c.WebSocketConfig=Dr,c.findCatalogItemByIdRecursive=Xe,c.flattenCatalogItems=Ze,c.pluralize=At,c.useAuthStateStore=we,c.useBaseConfigStateStore=k,c.useReferencesStore=Mt,c.useUserStateStore=Yt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|