@topvisor/ui 1.1.0-apiClient.1 → 1.1.0-apiClient.7
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/api/index.amd.js +1 -1
- package/api/index.amd.js.map +1 -1
- package/api/index.js +58 -55
- package/api/index.js.map +1 -1
- package/assets/themes/dark-th.css +1 -1
- package/assets/themes/dark.css +1 -1
- package/assets/themes/light.css +1 -1
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/core/app.js +14 -12
- package/core/app.js.map +1 -1
- package/package.json +1 -1
- package/types/api/api/types/client/client.d.ts +8 -0
- package/types/api/api/types/client/request.d.ts +0 -2
package/api/index.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/field-Cvv0SRcJ.amd"],(function(R,u,P){"use strict";if(typeof $>"u")var $=window.Vue;const q=(
|
|
1
|
+
define(["require","exports","../.chunks/field-Cvv0SRcJ.amd"],(function(R,u,P){"use strict";if(typeof $>"u")var $=window.Vue;const q=(o={})=>{var t;return o={...o},o.loadingEl??=(t=globalThis.document)==null?void 0:t.body,o.loadingShowSpinner??=!0,o.method??="POST",o.accept??="application/json",o},S=(o,t,r)=>({result:o,errors:t,response:r}),B=o=>o.startsWith("/system_2/common/"),J=(o=!1,t=window.location.href)=>{const{protocol:r,hostname:e,port:n}=new URL(t),s=e.split("."),a=!o||s.length<=2||/^[\d.]+$/.test(e)||e==="localhost"?e:s.slice(-2).join(".");return`${r}//${a}${n?`:${n}`:""}`},H=(o,t,r)=>{const e={inLoading:!1,path:t,url:o.options.baseUrl+t,options:q(o.options.requestOptions),params:{},getInLoading:()=>e.inLoading,setParams:n=>(e.params={...n},e),changeParams:n=>(Object.assign(e.params,n),e),setOptions:n=>(Object.assign(e.options,n),e),call:async n=>e.exec(n),callFetch:async(n,s)=>e.exec(s,n),callInNewWindow:async n=>{var c,f;const s=e.genData(n),a=o.genMiddlewareCtx(e,s);(f=(c=o.options).onPrepareData)==null||f.call(c,s,a);const{postInWindow:p}=await new Promise((g,m)=>R(["../.chunks/lazy-Dr-Frbwe.amd"],g,m));p(e.url,s,"_blank")},callInSelfWindow:async n=>{var c,f;const s=e.genData(n),a=o.genMiddlewareCtx(e,s);(f=(c=o.options).onPrepareData)==null||f.call(c,s,a);const{postInWindow:p}=await new Promise((g,m)=>R(["../.chunks/lazy-Dr-Frbwe.amd"],g,m));p(e.url,s,"_self")},genData:(n,s)=>{const a={...e.params};if(delete a.fetch_style,n){let p=[...n];r&&(p=p.filter(c=>r.includes(c))),a.fields=p}else r&&(a.fields=r);return s&&(a.fetch_style=s),a},async exec(n,s){var I,C,U,T,A,D,F,L,z,O,v,W,j,M,k;const a=o.options.Request,p=o.options.fetch,c=e.genData(n,s),f=o.genMiddlewareCtx(e,c);(C=(I=o.options).onPrepareData)==null||C.call(I,c,f);let g=e.url,m;e.options.method!=="POST"?g+="?"+new URLSearchParams(c).toString():m=o.options.bodySerializer(c);let Q;if(this.options.checkFingerprint){const l=this.path+this.options.checkFingerprint,y=new AbortController;o.abortControllers[l]=y}const X={...o.options,method:e.options.method,body:m,signal:Q};let h=new a(g,X);h.headers.set("x-request-id",f.id),h.headers.set("content-type","application/json"),h.headers.set("accept",e.options.accept);const w={...f,request:h};e.inLoading=!0,(T=(U=e.options).onLoading)==null||T.call(U,e.inLoading,w);let d;const b=await o.middlewareOnRequest(h,w);if(b instanceof Response?d=b:b instanceof a&&(h=b),!d)try{d=await p(h)}catch(l){d=await o.middlewareOnError(l,w)}finally{e.inLoading=!1,(D=(A=e.options).onLoading)==null||D.call(A,e.inLoading,w)}d=await o.middlewareOnResponse(d,w);let i,x,E;try{const l=(F=d.headers.get("content-type"))==null?void 0:F.includes("application/json");x=await d.text(),(L=h.headers.get("Content-Type"))!=null&&L.includes("application/json")||l?i=JSON.parse(x):o.useExt?i=S(x,void 0,d):i=x}catch(l){if((l instanceof SyntaxError||l instanceof TypeError)&&(E=l,E.responseText=x),o.useExt&&E){let y=d.status,_=d.statusText;y===200&&(y=1e4,_="Error API response"),i=S(null,[{code:y,string:_}],d),o.options.useApiConsole&&console.error(l)}else throw l}return o.useExt&&(i.response=d,i&&((O=(z=e.options).onApiLoaded)==null||O.call(z,i,w)),i!=null&&i.errors&&(o.options.useApiConsole&&console.warn(new Error("API error"),{res:i}),(j=(W=e.options).onApiError)==null||j.call(W,i,{...w,formatError:E},(v=o.options.requestOptions)==null?void 0:v.onApiError)),i!=null&&i.messages&&((k=(M=e.options).onApiMessage)==null||k.call(M,i,w))),i}};return e};class N{options;useExt;middlewares=[];abortControllers={};constructor(t={},r){t.requestOptions=q(t.requestOptions),t.useApiConsole??=!0,t.fetch??=globalThis.fetch,t.Request??=globalThis.Request,t.querySerializer??=e=>new URLSearchParams(e).toString(),t.bodySerializer??=e=>typeof e=="string"?e:JSON.stringify(e),this.options=t,this.useExt=r}generateUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=Math.random()*16|0;return(t==="x"?r:r&3|8).toString(16)})}use(t){this.middlewares.push(t)}gen(t,r){return H(this,t,r)}genAny(t,r){return this.gen(t,r)}genMiddlewareCtx(t,r){const e=this.generateUUID(),n=Object.freeze({baseUrl:this.options.baseUrl,querySerializer:this.options.querySerializer,bodySerializer:this.options.bodySerializer,Request:this.options.Request,fetch:this.options.fetch});return{useExt:this.useExt,requestOptions:t.options,data:r,middlewareData:{},options:n,schemaPath:t.path,id:e}}async middlewareOnRequest(t,r){var e;for(const n of this.middlewares){const s=await((e=n.onRequest)==null?void 0:e.call(n,{...r,request:t}));if(s)if(s instanceof Request)t=s;else{if(s instanceof Response)return s;throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}return t}async middlewareOnError(t,r){var n;let e=t;for(const s of this.middlewares){const a=await((n=s.onError)==null?void 0:n.call(s,{...r,error:e}));if(a){if(a instanceof Response)return a;if(a instanceof Error){e=a;continue}throw new Error("onError: must return new Response() or instance of Error")}}throw e}async middlewareOnResponse(t,r){var e;for(const n of this.middlewares){const s=await((e=n.onResponse)==null?void 0:e.call(n,{...r,response:t}));if(s){if(!(s instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");t=s}}return t}}const V=async(...o)=>{const{postInWindow:t}=await new Promise((r,e)=>R(["../.chunks/lazy-Dr-Frbwe.amd"],r,e));return t(...o)},G=async(...o)=>{const{dataToForm:t}=await new Promise((r,e)=>R(["../.chunks/lazy-Dr-Frbwe.amd"],r,e));return t(...o)},K=(o={},t)=>new N(o,t);u.genFieldFilter=P.genFieldFilter,u.genFieldOrder=P.genFieldOrder,u.createClient=K,u.dataToForm=G,u.genExtRes=S,u.getBaseDomainUrl=J,u.isPublicAPI=B,u.postInWindow=V,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=index.amd.js.map
|
package/api/index.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.amd.js","sources":["../../src/api/api/client/request-options.ts","../../src/api/api/utils/common.ts","../../src/api/api/client/request.ts","../../src/api/api/client/client.ts","../../src/api/api/index.ts"],"sourcesContent":["export const createRequestOptions = (requestOptions: Partial<Api.ClientRequestOptions> = {}): Api.ClientRequestOptions => {\n\trequestOptions = { ...requestOptions };\n\trequestOptions.loadingEl ??= document.body;\n\trequestOptions.loadingShowSpinner ??= true;\n\trequestOptions.method ??= 'POST';\n\trequestOptions.accept ??= 'application/json';\n\n\treturn requestOptions as Api.ClientRequestOptions;\n};\n","/**\n * Сгенерировать объект ответа в формате расширения OpenAPI\n *\n * @see Api.Ext\n */\nexport const genExtRes = (\n\tresult: any,\n\terrors?: Api.Ext.Schemas['ResponseError']['errors'],\n\tresponse?: Response,\n): Api.Response<any> => {\n\treturn {\n\t\tresult,\n\t\terrors,\n\t\tresponse,\n\t};\n};\n\n/**\n * Это публичное API, к которому открыт доступ по прямой ссылке через GET\n *\n * Используется для кеширования и генерации файлов через API\n */\nexport const isPublicAPI = (path: Api.PathAbstract) => {\n\treturn path.startsWith('/system_2/common/');\n};\n\n/**\n * Сгенерировать baseUrl на основе текущего домена\n */\nexport const getBaseDomainUrl = (useMainDomain = false, input: string = window.location.href) => {\n\tconst { protocol, hostname, port } = new URL(input);\n\n\t/**\n\t * localhost / IP-адреса / одноуровневые домены оставляем как есть\n\t */\n\tconst parts = hostname.split('.');\n\tconst baseHostname = !useMainDomain || parts.length <= 2 || /^[\\d.]+$/.test(hostname) || hostname === 'localhost'\n\t\t? hostname\n\t\t: parts.slice(-2).join('.');\n\n\treturn `${protocol}//${baseHostname}${port ? `:${port}` : ''}`;\n};\n","import type { Client } from './client';\nimport { createRequestOptions } from './request-options';\nimport { genExtRes } from '../utils/common';\n\nexport const createRequest = <\n\tRequestContext extends Api.ClientRequestContext<any, any, any>,\n\tFieldsNarrow extends Api.ParamsFields<RequestContext>,\n>(\n\tclient: Client<RequestContext['Paths'], RequestContext['UseExt']>,\n\tpath: RequestContext['Path'],\n\tfieldsNarrow?: FieldsNarrow,\n): Api.ClientRequest<RequestContext, FieldsNarrow> => {\n\tconst clientRequest = {\n\t\tinLoading: false,\n\t\tpath: path as Api.PathAbstract,\n\t\turl: client.options.baseUrl + path,\n\t\toptions: createRequestOptions(client.options.requestOptions),\n\t\tparams: {} as any, // незаполненное свойство\n\t\tgetInLoading: () => clientRequest.inLoading,\n\n\t\tsetParams: (params) => {\n\t\t\tclientRequest.params = { ...params } as any;\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tchangeParams: (params) => {\n\t\t\tObject.assign(clientRequest.params, params);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tsetOptions: (options) => {\n\t\t\tObject.assign(clientRequest.options, options);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tcall: async (fields?) => {\n\t\t\treturn clientRequest.exec(fields);\n\t\t},\n\n\t\tcallFetch: async (fetchStyle, fields?) => {\n\t\t\treturn clientRequest.exec(fields, fetchStyle);\n\t\t},\n\n\t\tcallInNewWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_blank');\n\t\t},\n\n\t\tcallInSelfWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_self');\n\t\t},\n\n\t\tgenData: (fields?, fetchStyle?) => {\n\t\t\tconst post: any = { ...clientRequest.params };\n\n\t\t\t// в старом коде fields вставлялись в params, оставлено для совместимости\n\t\t\t// delete post.fields;\n\t\t\tdelete post.fetch_style;\n\n\t\t\t// поля, указанные при запуске запроса\n\t\t\tif (fields) {\n\t\t\t\tlet fieldsPrepared = [...fields as any[]];\n\n\t\t\t\t// поля, указанные при создании запроса\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tfieldsPrepared = fieldsPrepared.filter(field => fieldsNarrow.includes(field));\n\t\t\t\t}\n\n\t\t\t\tpost.fields = fieldsPrepared;\n\t\t\t} else {\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tpost.fields = fieldsNarrow;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (fetchStyle) {\n\t\t\t\tpost.fetch_style = fetchStyle;\n\t\t\t}\n\n\t\t\treturn post;\n\t\t},\n\n\t\t/**\n\t\t * Общая функция выполнения запросов\n\t\t */\n\t\tasync exec(fields?: FieldsNarrow, fetchStyle?: RequestContext['ParamsFetchStyle']): Promise<any> {\n\t\t\tconst Request = client.options.Request;\n\t\t\tconst fetch = client.options.fetch;\n\n\t\t\tconst data = clientRequest.genData(fields, fetchStyle);\n\n\t\t\tconst middlewareCtxWithoutRequest = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtxWithoutRequest);\n\n\t\t\tlet url = clientRequest.url;\n\n\t\t\tlet requestInitBody: string | undefined = undefined;\n\t\t\tif (clientRequest.options.method !== 'POST') {\n\t\t\t\turl += '?' + new URLSearchParams(data).toString();\n\t\t\t} else {\n\t\t\t\trequestInitBody = client.options.bodySerializer(data);\n\t\t\t}\n\n\t\t\t// checkFingerprint\n\t\t\tlet requestInitSignal: AbortController['signal'] | undefined;\n\n\t\t\tif (this.options.checkFingerprint) {\n\t\t\t\tconst fingerprint = this.path + this.options.checkFingerprint;\n\n\t\t\t\tconst controller = new AbortController();\n\t\t\t\tclient.abortControllers[fingerprint] = controller;\n\n\t\t\t}\n\n\t\t\tconst requestInit = {\n\t\t\t\t...client.options,\n\t\t\t\tmethod: clientRequest.options.method,\n\t\t\t\tbody: requestInitBody,\n\t\t\t\tsignal: requestInitSignal,\n\t\t\t};\n\n\t\t\tlet request = new Request(url, requestInit);\n\n\t\t\trequest.headers.set('x-request-id', middlewareCtxWithoutRequest.id);\n\t\t\trequest.headers.set('content-type', 'application/json');\n\t\t\trequest.headers.set('accept', clientRequest.options.accept);\n\n\t\t\tconst middlewareCtx: Api.MiddlewareCallbackParams = {\n\t\t\t\t...middlewareCtxWithoutRequest,\n\t\t\t\trequest,\n\t\t\t};\n\n\t\t\tclientRequest.inLoading = true;\n\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\n\t\t\tlet response: Response | undefined = undefined;\n\n\t\t\tconst requestOrResponse = await client.middlewareOnRequest(request, middlewareCtx);\n\n\t\t\tif (requestOrResponse instanceof Response) {\n\t\t\t\tresponse = requestOrResponse;\n\t\t\t} else if (requestOrResponse instanceof Request) {\n\t\t\t\trequest = requestOrResponse;\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(request);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tresponse = await client.middlewareOnError(e, middlewareCtx);\n\t\t\t\t} finally {\n\t\t\t\t\tclientRequest.inLoading = false;\n\t\t\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse = await client.middlewareOnResponse(response, middlewareCtx);\n\n\t\t\tlet res: any;\n\t\t\tlet responseText: string | undefined;\n\t\t\tlet formatError: undefined | Api.FormatError = undefined;\n\n\t\t\ttry {\n\t\t\t\t// json - стандартные формат, он может быть возвращен в запросах с другим responseType, если в них произошла ошибка\n\t\t\t\tconst isJSON = response.headers.get('content-type')?.includes('application/json');\n\n\t\t\t\tresponseText = await response.text();\n\n\t\t\t\tif (request.headers.get('Content-Type')?.includes('application/json') || isJSON) {\n\t\t\t\t\tres = JSON.parse(responseText);\n\t\t\t\t} else {\n\t\t\t\t\tif (client.useExt) {\n\t\t\t\t\t\tres = genExtRes(responseText, undefined, response);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tres = responseText;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SyntaxError || e instanceof TypeError) {\n\t\t\t\t\tformatError = e;\n\t\t\t\t\tformatError.responseText = responseText;\n\t\t\t\t}\n\n\t\t\t\t// если в результате не пришел json, сгенерировать объект результата и добавить информацию об ответе API\n\t\t\t\tif (client.useExt && formatError) {\n\t\t\t\t\tlet errorCode = response.status;\n\t\t\t\t\tlet errorMessage = response.statusText;\n\n\t\t\t\t\tif (errorCode === 200) {\n\t\t\t\t\t\terrorCode = 10000;\n\t\t\t\t\t\terrorMessage = 'Error API response';\n\t\t\t\t\t}\n\n\t\t\t\t\tres = genExtRes(null, [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: errorCode,\n\t\t\t\t\t\t\tstring: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t], response);\n\n\t\t\t\t\tif (client.options.useApiConsole) console.error(e);\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (client.useExt) {\n\t\t\t\tres.response = response;\n\n\t\t\t\tif (res) {\n\t\t\t\t\tclientRequest.options.onApiLoaded?.(res, middlewareCtx);\n\t\t\t\t}\n\n\t\t\t\tif (res?.errors) {\n\t\t\t\t\tif (client.options.useApiConsole) console.warn(new Error('API error'), { res });\n\n\t\t\t\t\tclientRequest.options.onApiError?.(res, { ...middlewareCtx, formatError }, client.options.requestOptions?.onApiError);\n\t\t\t\t}\n\n\t\t\t\tif (res?.messages) {\n\t\t\t\t\tclientRequest.options.onApiMessage?.(res, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t},\n\t};\n\n\treturn clientRequest;\n};\n","import { createRequestOptions } from './request-options';\nimport { createRequest } from './request';\n\nexport class Client<paths extends Api.PathsAbstract, UseExt extends Api.Ext.UseExt> {\n\n\treadonly options: Readonly<Api.ClientOptions>;\n\treadonly useExt: UseExt;\n\treadonly middlewares: Api.Middleware[] = [];\n\tabortControllers: Record<string, AbortController> = {};\n\n\tconstructor(clientOptions: Partial<Api.ClientOptions> = {}, useExt: UseExt) {\n\t\tclientOptions.requestOptions = createRequestOptions(clientOptions.requestOptions);\n\t\tclientOptions.useApiConsole ??= true;\n\n\t\tclientOptions.fetch ??= globalThis.fetch;\n\t\tclientOptions.Request ??= globalThis.Request;\n\t\tclientOptions.querySerializer ??= (params) => new URLSearchParams(params as any).toString();\n\t\tclientOptions.bodySerializer ??= (body) => typeof body === 'string' ? body : JSON.stringify(body);\n\n\t\tthis.options = clientOptions as Api.ClientOptions;\n\n\t\tthis.useExt = useExt;\n\t}\n\n\tprivate generateUUID() {\n\t\tif (crypto?.randomUUID) {\n\t\t\treturn crypto.randomUUID();\n\t\t}\n\n\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n\t\t\tconst r = Math.random() * 16 | 0;\n\t\t\tconst v = c === 'x' ? r : (r & 0x3 | 0x8);\n\t\t\treturn v.toString(16);\n\t\t});\n\t}\n\n\t/**\n\t * Зарегистрировать middleware\n\t */\n\tuse(middleware: Api.Middleware) {\n\t\tthis.middlewares.push(middleware);\n\t}\n\n\t/**\n\t * Создать объект запроса\n\t *\n\t * После создания объекта он заполняется необходимыми данными и выполняет запросы к API с помощью APIRequest2.call();\n\t *\n\t * Опционально generic указывать нельзя, поэтому необходимо дублировать определение fetchStyle, [см.](https://github.com/Microsoft/TypeScript/issues/26242)\n\t *\n\t * @param path Путь метода API\n\t * @param fieldsNarrow Список получаемых полей, для методов API с моделью. Если объект запроса переиспользуется, и список полей меняется, указывайте его непосредственно при вызове `api.call()`\n\t */\n\tgen<\n\t\tPath extends Api.Path<paths>,\n\t\tFieldsNarrow extends Api.ParamsFields<Api.ClientRequestContext<paths, Path, UseExt>>\n\t>(\n\t\tpath: Path,\n\t\tfieldsNarrow?: FieldsNarrow,\n\t): Api.ClientRequest<Api.ClientRequestContext<paths, Path, UseExt>, FieldsNarrow> {\n\t\ttype RequestContext = Api.ClientRequestContext<paths, Path, UseExt>;\n\n\t\treturn createRequest<RequestContext, FieldsNarrow>(this, path, fieldsNarrow);\n\t}\n\n\t/**\n\t * Создать объект запроса, не описанного в OpenAPI\n\t */\n\tgenAny<\n\t\tParams extends {},\n\t\tResult = {},\n\t\tFieldsNarrow extends Api.Ext.Schemas['Fields'] | undefined = undefined\n\t>(path: Api.PathAbstract, fieldsNarrow?: FieldsNarrow): Api.ClientRequestCustom<UseExt, Params, Result> {\n\t\treturn this.gen(path as any, fieldsNarrow as any) as unknown as Api.ClientRequestCustom<UseExt, Params, Result>;\n\t}\n\n\t/**\n\t * Создать контекст выполнения запроса\n\t */\n\tgenMiddlewareCtx(\n\t\tclientRequest: Api.ClientRequest<any, any, any>,\n\t\tdata: Record<string, any>,\n\t): Omit<Api.MiddlewareCallbackParams, 'request'> {\n\t\tconst id = this.generateUUID();\n\n\t\tconst options: Api.BaseOptions = Object.freeze({\n\t\t\tbaseUrl: this.options.baseUrl,\n\t\t\tquerySerializer: this.options.querySerializer,\n\t\t\tbodySerializer: this.options.bodySerializer,\n\t\t\tRequest: this.options.Request,\n\t\t\tfetch: this.options.fetch,\n\t\t});\n\n\t\treturn {\n\t\t\tuseExt: this.useExt,\n\t\t\trequestOptions: clientRequest.options,\n\t\t\tdata,\n\t\t\tmiddlewareData: {},\n\t\t\toptions,\n\t\t\tschemaPath: clientRequest.path,\n\t\t\tid,\n\t\t};\n\t};\n\n\t/**\n\t * Обработчик middleware.onRequest\n\t *\n\t * @param request Запрос для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Request` или `Response` при модификации запроса, или undefined\n\t */\n\tasync middlewareOnRequest(\n\t\trequest: Request,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Request | Response | undefined> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onRequest?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Request) {\n\t\t\t\t\trequest = result;\n\t\t\t\t} else if (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('onRequest: must return new Request() or Response() when modifying the request');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn request;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param `error` Ошибка, переданная для обработки\n\t * @param middlewareCtx\n\t * @return Новый экземпляр `Response` при успешной обработке или выбрасывает ошибку\n\t */\n\tasync middlewareOnError(\n\t\terror: Error | unknown,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response | never> {\n\t\tlet errorAfterMiddleware = error;\n\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onError?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\terror: errorAfterMiddleware,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (result instanceof Error) {\n\t\t\t\t\terrorAfterMiddleware = result;\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthrow new Error('onError: must return new Response() or instance of Error');\n\t\t\t}\n\t\t}\n\n\t\tthrow errorAfterMiddleware;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param response Ответ для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Response` при модификации ответа, или undefined\n\t */\n\tasync middlewareOnResponse(\n\t\tresponse: Response,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onResponse?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\tresponse,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (!(result instanceof Response)) {\n\t\t\t\t\tthrow new Error('onResponse: must return new Response() when modifying the response');\n\t\t\t\t}\n\n\t\t\t\tresponse = result;\n\t\t\t}\n\t\t}\n\n\t\treturn response;\n\t}\n\n}\n","import { Client } from './client/client';\n\nexport * from './utils/field';\nexport * from './utils/common';\n\nexport const postInWindow: typeof import('./utils/lazy').postInWindow = async (...args) => {\n\tconst { postInWindow } = await import('./utils/lazy');\n\n\treturn postInWindow(...args);\n};\n\nexport const dataToForm: typeof import('./utils/lazy').dataToForm = async (...args) => {\n\tconst { dataToForm } = await import('./utils/lazy');\n\n\treturn dataToForm(...args);\n};\n\n/**\n * Создать API клиент\n *\n * @see Api.Ext.UseExt\n */\nexport const createClient = <\n\tpaths extends Api.PathsAbstract,\n\tUseExt extends Api.Ext.UseExt\n>(\n\tclientOptions: Partial<Api.ClientOptions> = {},\n\tuseExt: UseExt,\n) => {\n\treturn new Client<paths, UseExt>(clientOptions, useExt);\n};\n"],"names":["createRequestOptions","requestOptions","genExtRes","result","errors","response","isPublicAPI","path","getBaseDomainUrl","useMainDomain","input","protocol","hostname","port","baseHostname","parts","clientRequest","params","options","fields","fetchStyle","fieldsPrepared","field","fieldsNarrow","post","Request","client","fetch","url","requestInitSignal","controller","fingerprint","request","middlewareCtxWithoutRequest","requestOrResponse","e","res","responseText","isJSON","_g","_h","formatError","errorCode","errorMessage","Client","clientOptions","useExt","body","c","middleware","data","id","middlewareCtx","_a","error","errorAfterMiddleware","postInWindow","args","postInWindow2","dataToForm","dataToForm2","createClient"],"mappings":"4HAAO,MAAAA,EAAA,CAAAC,EAAA,CAAA,KACNA,EAAA,CAAA,GAAAA,CAAA,EACAA,EAAA,YAAA,SAAA,KACAA,EAAA,qBAAA,GACAA,EAAA,SAAA,OACAA,EAAA,SAAA,mBAEAA,GCFMC,EAAA,CAAAC,EAAAC,EAAAC,KAKN,CAAO,OAAAF,EACN,OAAAC,eAWKE,EAAAC,GACNA,EAAA,WAAA,mBAAA,EAMMC,EAAA,CAAAC,EAAA,GAAAC,EAAA,OAAA,SAAA,OAAA,CACN,KAAA,CAAA,SAAAC,EAAA,SAAAC,EAAA,KAAAC,CAAA,EAAA,IAAA,IAAAH,CAAA,iBAMAI,EAAA,CAAAL,GAAAM,EAAA,QAAA,GAAA,WAAA,KAAAH,CAAA,GAAAA,IAAA,YAAAA,EAAAG,EAAA,MAAA,EAAA,EAAA,KAAA,GAAA,mCAKD,oCC5Ba,KAAAR,wEAIF,aAAA,IAAAS,EAAA,UACyB,UAAAC,IAGjCD,EAAA,OAAA,CAAA,GAAAC,CAAA,EAEAD,GACD,aAAAC,8BAKCD,GACD,WAAAE,+BAKCF,GACD,KAAA,MAAAG,GAGCH,EAAA,KAAAG,CAAA,EACD,UAAA,MAAAC,EAAAD,gBAIA,gB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,EAEA,MAAA,IAAA,MAAA,+EAAA,GAKH,OAAA6B,EACD,MAAA,kBAAAsB,EAAAF,EAAA,eAeC,UAAAH,KAAA,KAAA,YAAA,CACC,MAAA9C,EAAA,OAAAkD,EAAAJ,EAAA,UAAA,YAAAI,EAAA,KAAAJ,EAAA,CAA0C,GAAAG,EACtC,MAAAG,CACI,UAIP,GAAApD,aAAA,SACC,OAAAA,EAGD,GAAAA,aAAA,MAAA,cAMA,MAAA,IAAA,MAAA,0DAAA,GAIF,MAAAoD,EACD,MAAA,qBAAAlD,EAAA+C,EAAA,OAaC,UAAAH,KAAA,KAAA,YAAA,CACC,MAAA9C,EAAA,OAAAkD,EAAAJ,EAAA,aAAA,YAAAI,EAAA,KAAAJ,EAAA,CAA6C,GAAAG,YAE5C,UAIA,GAAA,EAAAjD,aAAA,UACC,MAAA,IAAA,MAAA,oEAAA,OAOH,OAAAE,EAGF,CCpMO,MAAAmD,EAAA,SAAAC,IAAA,yFAGN,OAAAC,EAAA,GAAAD,CAAA,CACD,EAEOE,EAAA,SAAAF,IAAA,uFAGN,OAAAG,EAAA,GAAAH,CAAA,CACD,EAOOI,EAAA,CAAAhB,EAAA,CAAA,EAAAC,IAON,IAAAF,EAAAC,EAAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.amd.js","sources":["../../src/api/api/client/request-options.ts","../../src/api/api/utils/common.ts","../../src/api/api/client/request.ts","../../src/api/api/client/client.ts","../../src/api/api/index.ts"],"sourcesContent":["export const createRequestOptions = (requestOptions: Partial<Api.ClientRequestOptions> = {}): Api.ClientRequestOptions => {\n\trequestOptions = { ...requestOptions };\n\trequestOptions.loadingEl ??= globalThis.document?.body;\n\trequestOptions.loadingShowSpinner ??= true;\n\trequestOptions.method ??= 'POST';\n\trequestOptions.accept ??= 'application/json';\n\n\treturn requestOptions as Api.ClientRequestOptions;\n};\n","/**\n * Сгенерировать объект ответа в формате расширения OpenAPI\n *\n * @see Api.Ext\n */\nexport const genExtRes = (\n\tresult: any,\n\terrors?: Api.Ext.Schemas['ResponseError']['errors'],\n\tresponse?: Response,\n): Api.Response<any> => {\n\treturn {\n\t\tresult,\n\t\terrors,\n\t\tresponse,\n\t};\n};\n\n/**\n * Это публичное API, к которому открыт доступ по прямой ссылке через GET\n *\n * Используется для кеширования и генерации файлов через API\n */\nexport const isPublicAPI = (path: Api.PathAbstract) => {\n\treturn path.startsWith('/system_2/common/');\n};\n\n/**\n * Сгенерировать baseUrl на основе текущего домена\n */\nexport const getBaseDomainUrl = (useMainDomain = false, input: string = window.location.href) => {\n\tconst { protocol, hostname, port } = new URL(input);\n\n\t/**\n\t * localhost / IP-адреса / одноуровневые домены оставляем как есть\n\t */\n\tconst parts = hostname.split('.');\n\tconst baseHostname = !useMainDomain || parts.length <= 2 || /^[\\d.]+$/.test(hostname) || hostname === 'localhost'\n\t\t? hostname\n\t\t: parts.slice(-2).join('.');\n\n\treturn `${protocol}//${baseHostname}${port ? `:${port}` : ''}`;\n};\n","import type { Client } from './client';\nimport { createRequestOptions } from './request-options';\nimport { genExtRes } from '../utils/common';\n\nexport const createRequest = <\n\tRequestContext extends Api.ClientRequestContext<any, any, any>,\n\tFieldsNarrow extends Api.ParamsFields<RequestContext>,\n>(\n\tclient: Client<RequestContext['Paths'], RequestContext['UseExt']>,\n\tpath: RequestContext['Path'],\n\tfieldsNarrow?: FieldsNarrow,\n): Api.ClientRequest<RequestContext, FieldsNarrow> => {\n\tconst clientRequest = {\n\t\tinLoading: false,\n\t\tpath: path as Api.PathAbstract,\n\t\turl: client.options.baseUrl + path,\n\t\toptions: createRequestOptions(client.options.requestOptions),\n\t\tparams: {} as any, // незаполненное свойство\n\t\tgetInLoading: () => clientRequest.inLoading,\n\n\t\tsetParams: (params) => {\n\t\t\tclientRequest.params = { ...params } as any;\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tchangeParams: (params) => {\n\t\t\tObject.assign(clientRequest.params, params);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tsetOptions: (options) => {\n\t\t\tObject.assign(clientRequest.options, options);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tcall: async (fields?) => {\n\t\t\treturn clientRequest.exec(fields);\n\t\t},\n\n\t\tcallFetch: async (fetchStyle, fields?) => {\n\t\t\treturn clientRequest.exec(fields, fetchStyle);\n\t\t},\n\n\t\tcallInNewWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_blank');\n\t\t},\n\n\t\tcallInSelfWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_self');\n\t\t},\n\n\t\tgenData: (fields?, fetchStyle?) => {\n\t\t\tconst post: any = { ...clientRequest.params };\n\n\t\t\t// в старом коде fields вставлялись в params, оставлено для совместимости\n\t\t\t// delete post.fields;\n\t\t\tdelete post.fetch_style;\n\n\t\t\t// поля, указанные при запуске запроса\n\t\t\tif (fields) {\n\t\t\t\tlet fieldsPrepared = [...fields as any[]];\n\n\t\t\t\t// поля, указанные при создании запроса\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tfieldsPrepared = fieldsPrepared.filter(field => fieldsNarrow.includes(field));\n\t\t\t\t}\n\n\t\t\t\tpost.fields = fieldsPrepared;\n\t\t\t} else {\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tpost.fields = fieldsNarrow;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (fetchStyle) {\n\t\t\t\tpost.fetch_style = fetchStyle;\n\t\t\t}\n\n\t\t\treturn post;\n\t\t},\n\n\t\t/**\n\t\t * Общая функция выполнения запросов\n\t\t */\n\t\tasync exec(fields?: FieldsNarrow, fetchStyle?: RequestContext['ParamsFetchStyle']): Promise<any> {\n\t\t\tconst Request = client.options.Request;\n\t\t\tconst fetch = client.options.fetch;\n\n\t\t\tconst data = clientRequest.genData(fields, fetchStyle);\n\n\t\t\tconst middlewareCtxWithoutRequest = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtxWithoutRequest);\n\n\t\t\tlet url = clientRequest.url;\n\n\t\t\tlet requestInitBody: string | undefined = undefined;\n\t\t\tif (clientRequest.options.method !== 'POST') {\n\t\t\t\turl += '?' + new URLSearchParams(data).toString();\n\t\t\t} else {\n\t\t\t\trequestInitBody = client.options.bodySerializer(data);\n\t\t\t}\n\n\t\t\t// checkFingerprint\n\t\t\tlet requestInitSignal: AbortController['signal'] | undefined;\n\n\t\t\tif (this.options.checkFingerprint) {\n\t\t\t\tconst fingerprint = this.path + this.options.checkFingerprint;\n\n\t\t\t\tconst controller = new AbortController();\n\t\t\t\tclient.abortControllers[fingerprint] = controller;\n\n\t\t\t}\n\n\t\t\tconst requestInit = {\n\t\t\t\t...client.options,\n\t\t\t\tmethod: clientRequest.options.method,\n\t\t\t\tbody: requestInitBody,\n\t\t\t\tsignal: requestInitSignal,\n\t\t\t};\n\n\t\t\tlet request = new Request(url, requestInit);\n\n\t\t\trequest.headers.set('x-request-id', middlewareCtxWithoutRequest.id);\n\t\t\trequest.headers.set('content-type', 'application/json');\n\t\t\trequest.headers.set('accept', clientRequest.options.accept);\n\n\t\t\tconst middlewareCtx: Api.MiddlewareCallbackParams = {\n\t\t\t\t...middlewareCtxWithoutRequest,\n\t\t\t\trequest,\n\t\t\t};\n\n\t\t\tclientRequest.inLoading = true;\n\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\n\t\t\tlet response: Response | undefined = undefined;\n\n\t\t\tconst requestOrResponse = await client.middlewareOnRequest(request, middlewareCtx);\n\n\t\t\tif (requestOrResponse instanceof Response) {\n\t\t\t\tresponse = requestOrResponse;\n\t\t\t} else if (requestOrResponse instanceof Request) {\n\t\t\t\trequest = requestOrResponse;\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(request);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tresponse = await client.middlewareOnError(e, middlewareCtx);\n\t\t\t\t} finally {\n\t\t\t\t\tclientRequest.inLoading = false;\n\t\t\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse = await client.middlewareOnResponse(response, middlewareCtx);\n\n\t\t\tlet res: any;\n\t\t\tlet responseText: string | undefined;\n\t\t\tlet formatError: undefined | Api.FormatError = undefined;\n\n\t\t\ttry {\n\t\t\t\t// json - стандартные формат, он может быть возвращен в запросах с другим responseType, если в них произошла ошибка\n\t\t\t\tconst isJSON = response.headers.get('content-type')?.includes('application/json');\n\n\t\t\t\tresponseText = await response.text();\n\n\t\t\t\tif (request.headers.get('Content-Type')?.includes('application/json') || isJSON) {\n\t\t\t\t\tres = JSON.parse(responseText);\n\t\t\t\t} else {\n\t\t\t\t\tif (client.useExt) {\n\t\t\t\t\t\tres = genExtRes(responseText, undefined, response);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tres = responseText;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SyntaxError || e instanceof TypeError) {\n\t\t\t\t\tformatError = e;\n\t\t\t\t\tformatError.responseText = responseText;\n\t\t\t\t}\n\n\t\t\t\t// если в результате не пришел json, сгенерировать объект результата и добавить информацию об ответе API\n\t\t\t\tif (client.useExt && formatError) {\n\t\t\t\t\tlet errorCode = response.status;\n\t\t\t\t\tlet errorMessage = response.statusText;\n\n\t\t\t\t\tif (errorCode === 200) {\n\t\t\t\t\t\terrorCode = 10000;\n\t\t\t\t\t\terrorMessage = 'Error API response';\n\t\t\t\t\t}\n\n\t\t\t\t\tres = genExtRes(null, [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: errorCode,\n\t\t\t\t\t\t\tstring: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t], response);\n\n\t\t\t\t\tif (client.options.useApiConsole) console.error(e);\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (client.useExt) {\n\t\t\t\tres.response = response;\n\n\t\t\t\tif (res) {\n\t\t\t\t\tclientRequest.options.onApiLoaded?.(res, middlewareCtx);\n\t\t\t\t}\n\n\t\t\t\tif (res?.errors) {\n\t\t\t\t\tif (client.options.useApiConsole) console.warn(new Error('API error'), { res });\n\n\t\t\t\t\tclientRequest.options.onApiError?.(res, { ...middlewareCtx, formatError }, client.options.requestOptions?.onApiError);\n\t\t\t\t}\n\n\t\t\t\tif (res?.messages) {\n\t\t\t\t\tclientRequest.options.onApiMessage?.(res, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t},\n\t};\n\n\treturn clientRequest;\n};\n","import { createRequestOptions } from './request-options';\nimport { createRequest } from './request';\n\nexport class Client<paths extends Api.PathsAbstract, UseExt extends Api.Ext.UseExt> {\n\n\treadonly options: Readonly<Api.ClientOptions>;\n\treadonly useExt: UseExt;\n\treadonly middlewares: Api.Middleware[] = [];\n\tabortControllers: Record<string, AbortController> = {};\n\n\tconstructor(clientOptions: Partial<Api.ClientOptions> = {}, useExt: UseExt) {\n\t\tclientOptions.requestOptions = createRequestOptions(clientOptions.requestOptions);\n\t\tclientOptions.useApiConsole ??= true;\n\n\t\tclientOptions.fetch ??= globalThis.fetch;\n\t\tclientOptions.Request ??= globalThis.Request;\n\t\tclientOptions.querySerializer ??= (params) => new URLSearchParams(params as any).toString();\n\t\tclientOptions.bodySerializer ??= (body) => typeof body === 'string' ? body : JSON.stringify(body);\n\n\t\tthis.options = clientOptions as Api.ClientOptions;\n\n\t\tthis.useExt = useExt;\n\t}\n\n\tprivate generateUUID() {\n\t\tif (crypto?.randomUUID) {\n\t\t\treturn crypto.randomUUID();\n\t\t}\n\n\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n\t\t\tconst r = Math.random() * 16 | 0;\n\t\t\tconst v = c === 'x' ? r : (r & 0x3 | 0x8);\n\t\t\treturn v.toString(16);\n\t\t});\n\t}\n\n\t/**\n\t * Зарегистрировать middleware\n\t */\n\tuse(middleware: Api.Middleware) {\n\t\tthis.middlewares.push(middleware);\n\t}\n\n\t/**\n\t * Создать объект запроса\n\t *\n\t * После создания объекта он заполняется необходимыми данными и выполняет запросы к API с помощью APIRequest2.call();\n\t *\n\t * Опционально generic указывать нельзя, поэтому необходимо дублировать определение fetchStyle, [см.](https://github.com/Microsoft/TypeScript/issues/26242)\n\t *\n\t * @param path Путь метода API\n\t * @param fieldsNarrow Список получаемых полей, для методов API с моделью. Если объект запроса переиспользуется, и список полей меняется, указывайте его непосредственно при вызове `api.call()`\n\t */\n\tgen<\n\t\tPath extends Api.Path<paths>,\n\t\tFieldsNarrow extends Api.ParamsFields<Api.ClientRequestContext<paths, Path, UseExt>>\n\t>(\n\t\tpath: Path,\n\t\tfieldsNarrow?: FieldsNarrow,\n\t): Api.ClientRequest<Api.ClientRequestContext<paths, Path, UseExt>, FieldsNarrow> {\n\t\ttype RequestContext = Api.ClientRequestContext<paths, Path, UseExt>;\n\n\t\treturn createRequest<RequestContext, FieldsNarrow>(this, path, fieldsNarrow);\n\t}\n\n\t/**\n\t * Создать объект запроса, не описанного в OpenAPI\n\t */\n\tgenAny<\n\t\tParams extends {},\n\t\tResult = {},\n\t\tFieldsNarrow extends Api.Ext.Schemas['Fields'] | undefined = undefined\n\t>(path: Api.PathAbstract, fieldsNarrow?: FieldsNarrow): Api.ClientRequestCustom<UseExt, Params, Result> {\n\t\treturn this.gen(path as any, fieldsNarrow as any) as unknown as Api.ClientRequestCustom<UseExt, Params, Result>;\n\t}\n\n\t/**\n\t * Создать контекст выполнения запроса\n\t */\n\tgenMiddlewareCtx(\n\t\tclientRequest: Api.ClientRequest<any, any, any>,\n\t\tdata: Record<string, any>,\n\t): Omit<Api.MiddlewareCallbackParams, 'request'> {\n\t\tconst id = this.generateUUID();\n\n\t\tconst options: Api.BaseOptions = Object.freeze({\n\t\t\tbaseUrl: this.options.baseUrl,\n\t\t\tquerySerializer: this.options.querySerializer,\n\t\t\tbodySerializer: this.options.bodySerializer,\n\t\t\tRequest: this.options.Request,\n\t\t\tfetch: this.options.fetch,\n\t\t});\n\n\t\treturn {\n\t\t\tuseExt: this.useExt,\n\t\t\trequestOptions: clientRequest.options,\n\t\t\tdata,\n\t\t\tmiddlewareData: {},\n\t\t\toptions,\n\t\t\tschemaPath: clientRequest.path,\n\t\t\tid,\n\t\t};\n\t};\n\n\t/**\n\t * Обработчик middleware.onRequest\n\t *\n\t * @param request Запрос для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Request` или `Response` при модификации запроса, или undefined\n\t */\n\tasync middlewareOnRequest(\n\t\trequest: Request,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Request | Response | undefined> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onRequest?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Request) {\n\t\t\t\t\trequest = result;\n\t\t\t\t} else if (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('onRequest: must return new Request() or Response() when modifying the request');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn request;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param `error` Ошибка, переданная для обработки\n\t * @param middlewareCtx\n\t * @return Новый экземпляр `Response` при успешной обработке или выбрасывает ошибку\n\t */\n\tasync middlewareOnError(\n\t\terror: Error | unknown,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response | never> {\n\t\tlet errorAfterMiddleware = error;\n\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onError?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\terror: errorAfterMiddleware,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (result instanceof Error) {\n\t\t\t\t\terrorAfterMiddleware = result;\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthrow new Error('onError: must return new Response() or instance of Error');\n\t\t\t}\n\t\t}\n\n\t\tthrow errorAfterMiddleware;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param response Ответ для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Response` при модификации ответа, или undefined\n\t */\n\tasync middlewareOnResponse(\n\t\tresponse: Response,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onResponse?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\tresponse,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (!(result instanceof Response)) {\n\t\t\t\t\tthrow new Error('onResponse: must return new Response() when modifying the response');\n\t\t\t\t}\n\n\t\t\t\tresponse = result;\n\t\t\t}\n\t\t}\n\n\t\treturn response;\n\t}\n\n}\n","import { Client } from './client/client';\n\nexport * from './utils/field';\nexport * from './utils/common';\n\nexport const postInWindow: typeof import('./utils/lazy').postInWindow = async (...args) => {\n\tconst { postInWindow } = await import('./utils/lazy');\n\n\treturn postInWindow(...args);\n};\n\nexport const dataToForm: typeof import('./utils/lazy').dataToForm = async (...args) => {\n\tconst { dataToForm } = await import('./utils/lazy');\n\n\treturn dataToForm(...args);\n};\n\n/**\n * Создать API клиент\n *\n * @see Api.Ext.UseExt\n */\nexport const createClient = <\n\tpaths extends Api.PathsAbstract,\n\tUseExt extends Api.Ext.UseExt\n>(\n\tclientOptions: Partial<Api.ClientOptions> = {},\n\tuseExt: UseExt,\n) => {\n\treturn new Client<paths, UseExt>(clientOptions, useExt);\n};\n"],"names":["createRequestOptions","requestOptions","genExtRes","result","errors","response","isPublicAPI","path","getBaseDomainUrl","useMainDomain","input","protocol","hostname","port","baseHostname","parts","clientRequest","params","options","fields","fetchStyle","fieldsPrepared","field","fieldsNarrow","post","Request","client","fetch","url","requestInitSignal","controller","fingerprint","request","middlewareCtxWithoutRequest","requestOrResponse","e","res","responseText","isJSON","_g","_h","formatError","errorCode","errorMessage","Client","clientOptions","useExt","body","c","middleware","data","id","middlewareCtx","_a","error","errorAfterMiddleware","postInWindow","args","postInWindow2","dataToForm","dataToForm2","createClient"],"mappings":"4HAAO,MAAAA,EAAA,CAAAC,EAAA,CAAA,IAAA,OACN,OAAAA,EAAA,CAAA,GAAAA,CAAA,4DAEAA,EAAA,qBAAA,GACAA,EAAA,SAAA,OACAA,EAAA,SAAA,mBAEAA,GCFMC,EAAA,CAAAC,EAAAC,EAAAC,KAKN,CAAO,OAAAF,EACN,OAAAC,eAWKE,EAAAC,GACNA,EAAA,WAAA,mBAAA,EAMMC,EAAA,CAAAC,EAAA,GAAAC,EAAA,OAAA,SAAA,OAAA,CACN,KAAA,CAAA,SAAAC,EAAA,SAAAC,EAAA,KAAAC,CAAA,EAAA,IAAA,IAAAH,CAAA,iBAMAI,EAAA,CAAAL,GAAAM,EAAA,QAAA,GAAA,WAAA,KAAAH,CAAA,GAAAA,IAAA,YAAAA,EAAAG,EAAA,MAAA,EAAA,EAAA,KAAA,GAAA,mCAKD,oCC5Ba,KAAAR,wEAIF,aAAA,IAAAS,EAAA,UACyB,UAAAC,IAGjCD,EAAA,OAAA,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C,MAAA9C,EAAA,OAAAkD,EAAAJ,EAAA,YAAA,YAAAI,EAAA,KAAAJ,EAAA,CAA4C,GAAAG,WAE3C,SAIA,GAAAjD,aAAA,gBACW,IAAAA,aAAA,SAEV,OAAAA,EAEA,MAAA,IAAA,MAAA,+EAAA,GAKH,OAAA6B,EACD,MAAA,kBAAAsB,EAAAF,EAAA,eAeC,UAAAH,KAAA,KAAA,YAAA,CACC,MAAA9C,EAAA,OAAAkD,EAAAJ,EAAA,UAAA,YAAAI,EAAA,KAAAJ,EAAA,CAA0C,GAAAG,EACtC,MAAAG,CACI,UAIP,GAAApD,aAAA,SACC,OAAAA,EAGD,GAAAA,aAAA,MAAA,cAMA,MAAA,IAAA,MAAA,0DAAA,GAIF,MAAAoD,EACD,MAAA,qBAAAlD,EAAA+C,EAAA,OAaC,UAAAH,KAAA,KAAA,YAAA,CACC,MAAA9C,EAAA,OAAAkD,EAAAJ,EAAA,aAAA,YAAAI,EAAA,KAAAJ,EAAA,CAA6C,GAAAG,YAE5C,UAIA,GAAA,EAAAjD,aAAA,UACC,MAAA,IAAA,MAAA,oEAAA,OAOH,OAAAE,EAGF,CCpMO,MAAAmD,EAAA,SAAAC,IAAA,yFAGN,OAAAC,EAAA,GAAAD,CAAA,CACD,EAEOE,EAAA,SAAAF,IAAA,uFAGN,OAAAG,EAAA,GAAAH,CAAA,CACD,EAOOI,EAAA,CAAAhB,EAAA,CAAA,EAAAC,IAON,IAAAF,EAAAC,EAAAC,CAAA"}
|
package/api/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { g as V, a as X } from "../.chunks/field-CyyFzM-Y.es.js";
|
|
2
|
-
const z = (
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const z = (o = {}) => {
|
|
3
|
+
var t;
|
|
4
|
+
return o = { ...o }, o.loadingEl ??= (t = globalThis.document) == null ? void 0 : t.body, o.loadingShowSpinner ??= !0, o.method ??= "POST", o.accept ??= "application/json", o;
|
|
5
|
+
}, v = (o, t, n) => ({
|
|
6
|
+
result: o,
|
|
7
|
+
errors: t,
|
|
5
8
|
response: n
|
|
6
|
-
}), J = (
|
|
7
|
-
const { protocol: n, hostname: e, port: s } = new URL(
|
|
9
|
+
}), J = (o) => o.startsWith("/system_2/common/"), B = (o = !1, t = window.location.href) => {
|
|
10
|
+
const { protocol: n, hostname: e, port: s } = new URL(t), r = e.split("."), a = !o || r.length <= 2 || /^[\d.]+$/.test(e) || e === "localhost" ? e : r.slice(-2).join(".");
|
|
8
11
|
return `${n}//${a}${s ? `:${s}` : ""}`;
|
|
9
|
-
}, $ = (
|
|
12
|
+
}, $ = (o, t, n) => {
|
|
10
13
|
const e = {
|
|
11
14
|
inLoading: !1,
|
|
12
|
-
path:
|
|
13
|
-
url:
|
|
14
|
-
options: z(
|
|
15
|
+
path: t,
|
|
16
|
+
url: o.options.baseUrl + t,
|
|
17
|
+
options: z(o.options.requestOptions),
|
|
15
18
|
params: {},
|
|
16
19
|
// незаполненное свойство
|
|
17
20
|
getInLoading: () => e.inLoading,
|
|
@@ -22,15 +25,15 @@ const z = (t = {}) => (t = { ...t }, t.loadingEl ??= document.body, t.loadingSho
|
|
|
22
25
|
callFetch: async (s, r) => e.exec(r, s),
|
|
23
26
|
callInNewWindow: async (s) => {
|
|
24
27
|
var p, u;
|
|
25
|
-
const r = e.genData(s), a =
|
|
26
|
-
(u = (p =
|
|
28
|
+
const r = e.genData(s), a = o.genMiddlewareCtx(e, r);
|
|
29
|
+
(u = (p = o.options).onPrepareData) == null || u.call(p, r, a);
|
|
27
30
|
const { postInWindow: l } = await import("../.chunks/lazy-Dy9IVVUy.es.js");
|
|
28
31
|
l(e.url, r, "_blank");
|
|
29
32
|
},
|
|
30
33
|
callInSelfWindow: async (s) => {
|
|
31
34
|
var p, u;
|
|
32
|
-
const r = e.genData(s), a =
|
|
33
|
-
(u = (p =
|
|
35
|
+
const r = e.genData(s), a = o.genMiddlewareCtx(e, r);
|
|
36
|
+
(u = (p = o.options).onPrepareData) == null || u.call(p, r, a);
|
|
34
37
|
const { postInWindow: l } = await import("../.chunks/lazy-Dy9IVVUy.es.js");
|
|
35
38
|
l(e.url, r, "_self");
|
|
36
39
|
},
|
|
@@ -48,17 +51,17 @@ const z = (t = {}) => (t = { ...t }, t.loadingEl ??= document.body, t.loadingSho
|
|
|
48
51
|
*/
|
|
49
52
|
async exec(s, r) {
|
|
50
53
|
var E, q, S, b, C, I, P, U, A, D, L, T, O, F, W;
|
|
51
|
-
const a =
|
|
52
|
-
(q = (E =
|
|
54
|
+
const a = o.options.Request, l = o.options.fetch, p = e.genData(s, r), u = o.genMiddlewareCtx(e, p);
|
|
55
|
+
(q = (E = o.options).onPrepareData) == null || q.call(E, p, u);
|
|
53
56
|
let y = e.url, R;
|
|
54
|
-
e.options.method !== "POST" ? y += "?" + new URLSearchParams(p).toString() : R =
|
|
57
|
+
e.options.method !== "POST" ? y += "?" + new URLSearchParams(p).toString() : R = o.options.bodySerializer(p);
|
|
55
58
|
let M;
|
|
56
59
|
if (this.options.checkFingerprint) {
|
|
57
60
|
const c = this.path + this.options.checkFingerprint, x = new AbortController();
|
|
58
|
-
|
|
61
|
+
o.abortControllers[c] = x;
|
|
59
62
|
}
|
|
60
63
|
const _ = {
|
|
61
|
-
...
|
|
64
|
+
...o.options,
|
|
62
65
|
method: e.options.method,
|
|
63
66
|
body: R,
|
|
64
67
|
signal: M
|
|
@@ -71,33 +74,33 @@ const z = (t = {}) => (t = { ...t }, t.loadingEl ??= document.body, t.loadingSho
|
|
|
71
74
|
};
|
|
72
75
|
e.inLoading = !0, (b = (S = e.options).onLoading) == null || b.call(S, e.inLoading, h);
|
|
73
76
|
let d;
|
|
74
|
-
const g = await
|
|
77
|
+
const g = await o.middlewareOnRequest(f, h);
|
|
75
78
|
if (g instanceof Response ? d = g : g instanceof a && (f = g), !d)
|
|
76
79
|
try {
|
|
77
80
|
d = await l(f);
|
|
78
81
|
} catch (c) {
|
|
79
|
-
d = await
|
|
82
|
+
d = await o.middlewareOnError(c, h);
|
|
80
83
|
} finally {
|
|
81
84
|
e.inLoading = !1, (I = (C = e.options).onLoading) == null || I.call(C, e.inLoading, h);
|
|
82
85
|
}
|
|
83
|
-
d = await
|
|
86
|
+
d = await o.middlewareOnResponse(d, h);
|
|
84
87
|
let i, w, m;
|
|
85
88
|
try {
|
|
86
89
|
const c = (P = d.headers.get("content-type")) == null ? void 0 : P.includes("application/json");
|
|
87
|
-
w = await d.text(), (U = f.headers.get("Content-Type")) != null && U.includes("application/json") || c ? i = JSON.parse(w) :
|
|
90
|
+
w = await d.text(), (U = f.headers.get("Content-Type")) != null && U.includes("application/json") || c ? i = JSON.parse(w) : o.useExt ? i = v(w, void 0, d) : i = w;
|
|
88
91
|
} catch (c) {
|
|
89
|
-
if ((c instanceof SyntaxError || c instanceof TypeError) && (m = c, m.responseText = w),
|
|
92
|
+
if ((c instanceof SyntaxError || c instanceof TypeError) && (m = c, m.responseText = w), o.useExt && m) {
|
|
90
93
|
let x = d.status, j = d.statusText;
|
|
91
94
|
x === 200 && (x = 1e4, j = "Error API response"), i = v(null, [
|
|
92
95
|
{
|
|
93
96
|
code: x,
|
|
94
97
|
string: j
|
|
95
98
|
}
|
|
96
|
-
], d),
|
|
99
|
+
], d), o.options.useApiConsole && console.error(c);
|
|
97
100
|
} else
|
|
98
101
|
throw c;
|
|
99
102
|
}
|
|
100
|
-
return
|
|
103
|
+
return o.useExt && (i.response = d, i && ((D = (A = e.options).onApiLoaded) == null || D.call(A, i, h)), i != null && i.errors && (o.options.useApiConsole && console.warn(new Error("API error"), { res: i }), (O = (T = e.options).onApiError) == null || O.call(T, i, { ...h, formatError: m }, (L = o.options.requestOptions) == null ? void 0 : L.onApiError)), i != null && i.messages && ((W = (F = e.options).onApiMessage) == null || W.call(F, i, h))), i;
|
|
101
104
|
}
|
|
102
105
|
};
|
|
103
106
|
return e;
|
|
@@ -107,20 +110,20 @@ class k {
|
|
|
107
110
|
useExt;
|
|
108
111
|
middlewares = [];
|
|
109
112
|
abortControllers = {};
|
|
110
|
-
constructor(
|
|
111
|
-
|
|
113
|
+
constructor(t = {}, n) {
|
|
114
|
+
t.requestOptions = z(t.requestOptions), t.useApiConsole ??= !0, t.fetch ??= globalThis.fetch, t.Request ??= globalThis.Request, t.querySerializer ??= (e) => new URLSearchParams(e).toString(), t.bodySerializer ??= (e) => typeof e == "string" ? e : JSON.stringify(e), this.options = t, this.useExt = n;
|
|
112
115
|
}
|
|
113
116
|
generateUUID() {
|
|
114
|
-
return crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
117
|
+
return crypto != null && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
115
118
|
const n = Math.random() * 16 | 0;
|
|
116
|
-
return (
|
|
119
|
+
return (t === "x" ? n : n & 3 | 8).toString(16);
|
|
117
120
|
});
|
|
118
121
|
}
|
|
119
122
|
/**
|
|
120
123
|
* Зарегистрировать middleware
|
|
121
124
|
*/
|
|
122
|
-
use(
|
|
123
|
-
this.middlewares.push(
|
|
125
|
+
use(t) {
|
|
126
|
+
this.middlewares.push(t);
|
|
124
127
|
}
|
|
125
128
|
/**
|
|
126
129
|
* Создать объект запроса
|
|
@@ -132,19 +135,19 @@ class k {
|
|
|
132
135
|
* @param path Путь метода API
|
|
133
136
|
* @param fieldsNarrow Список получаемых полей, для методов API с моделью. Если объект запроса переиспользуется, и список полей меняется, указывайте его непосредственно при вызове `api.call()`
|
|
134
137
|
*/
|
|
135
|
-
gen(
|
|
136
|
-
return $(this,
|
|
138
|
+
gen(t, n) {
|
|
139
|
+
return $(this, t, n);
|
|
137
140
|
}
|
|
138
141
|
/**
|
|
139
142
|
* Создать объект запроса, не описанного в OpenAPI
|
|
140
143
|
*/
|
|
141
|
-
genAny(
|
|
142
|
-
return this.gen(
|
|
144
|
+
genAny(t, n) {
|
|
145
|
+
return this.gen(t, n);
|
|
143
146
|
}
|
|
144
147
|
/**
|
|
145
148
|
* Создать контекст выполнения запроса
|
|
146
149
|
*/
|
|
147
|
-
genMiddlewareCtx(
|
|
150
|
+
genMiddlewareCtx(t, n) {
|
|
148
151
|
const e = this.generateUUID(), s = Object.freeze({
|
|
149
152
|
baseUrl: this.options.baseUrl,
|
|
150
153
|
querySerializer: this.options.querySerializer,
|
|
@@ -154,11 +157,11 @@ class k {
|
|
|
154
157
|
});
|
|
155
158
|
return {
|
|
156
159
|
useExt: this.useExt,
|
|
157
|
-
requestOptions:
|
|
160
|
+
requestOptions: t.options,
|
|
158
161
|
data: n,
|
|
159
162
|
middlewareData: {},
|
|
160
163
|
options: s,
|
|
161
|
-
schemaPath:
|
|
164
|
+
schemaPath: t.path,
|
|
162
165
|
id: e
|
|
163
166
|
};
|
|
164
167
|
}
|
|
@@ -169,23 +172,23 @@ class k {
|
|
|
169
172
|
* @param middlewareCtx Контекст выполнения запроса
|
|
170
173
|
* @return Новый экземпляр `Request` или `Response` при модификации запроса, или undefined
|
|
171
174
|
*/
|
|
172
|
-
async middlewareOnRequest(
|
|
175
|
+
async middlewareOnRequest(t, n) {
|
|
173
176
|
var e;
|
|
174
177
|
for (const s of this.middlewares) {
|
|
175
178
|
const r = await ((e = s.onRequest) == null ? void 0 : e.call(s, {
|
|
176
179
|
...n,
|
|
177
|
-
request:
|
|
180
|
+
request: t
|
|
178
181
|
}));
|
|
179
182
|
if (r)
|
|
180
183
|
if (r instanceof Request)
|
|
181
|
-
|
|
184
|
+
t = r;
|
|
182
185
|
else {
|
|
183
186
|
if (r instanceof Response)
|
|
184
187
|
return r;
|
|
185
188
|
throw new Error("onRequest: must return new Request() or Response() when modifying the request");
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
|
-
return
|
|
191
|
+
return t;
|
|
189
192
|
}
|
|
190
193
|
/**
|
|
191
194
|
* Обработчик middleware.onResponse
|
|
@@ -194,9 +197,9 @@ class k {
|
|
|
194
197
|
* @param middlewareCtx
|
|
195
198
|
* @return Новый экземпляр `Response` при успешной обработке или выбрасывает ошибку
|
|
196
199
|
*/
|
|
197
|
-
async middlewareOnError(
|
|
200
|
+
async middlewareOnError(t, n) {
|
|
198
201
|
var s;
|
|
199
|
-
let e =
|
|
202
|
+
let e = t;
|
|
200
203
|
for (const r of this.middlewares) {
|
|
201
204
|
const a = await ((s = r.onError) == null ? void 0 : s.call(r, {
|
|
202
205
|
...n,
|
|
@@ -221,29 +224,29 @@ class k {
|
|
|
221
224
|
* @param middlewareCtx Контекст выполнения запроса
|
|
222
225
|
* @return Новый экземпляр `Response` при модификации ответа, или undefined
|
|
223
226
|
*/
|
|
224
|
-
async middlewareOnResponse(
|
|
227
|
+
async middlewareOnResponse(t, n) {
|
|
225
228
|
var e;
|
|
226
229
|
for (const s of this.middlewares) {
|
|
227
230
|
const r = await ((e = s.onResponse) == null ? void 0 : e.call(s, {
|
|
228
231
|
...n,
|
|
229
|
-
response:
|
|
232
|
+
response: t
|
|
230
233
|
}));
|
|
231
234
|
if (r) {
|
|
232
235
|
if (!(r instanceof Response))
|
|
233
236
|
throw new Error("onResponse: must return new Response() when modifying the response");
|
|
234
|
-
|
|
237
|
+
t = r;
|
|
235
238
|
}
|
|
236
239
|
}
|
|
237
|
-
return
|
|
240
|
+
return t;
|
|
238
241
|
}
|
|
239
242
|
}
|
|
240
|
-
const H = async (...
|
|
241
|
-
const { postInWindow:
|
|
242
|
-
return
|
|
243
|
-
}, N = async (...
|
|
244
|
-
const { dataToForm:
|
|
245
|
-
return
|
|
246
|
-
}, G = (
|
|
243
|
+
const H = async (...o) => {
|
|
244
|
+
const { postInWindow: t } = await import("../.chunks/lazy-Dy9IVVUy.es.js");
|
|
245
|
+
return t(...o);
|
|
246
|
+
}, N = async (...o) => {
|
|
247
|
+
const { dataToForm: t } = await import("../.chunks/lazy-Dy9IVVUy.es.js");
|
|
248
|
+
return t(...o);
|
|
249
|
+
}, G = (o = {}, t) => new k(o, t);
|
|
247
250
|
export {
|
|
248
251
|
G as createClient,
|
|
249
252
|
N as dataToForm,
|
package/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/api/api/client/request-options.ts","../../src/api/api/utils/common.ts","../../src/api/api/client/request.ts","../../src/api/api/client/client.ts","../../src/api/api/index.ts"],"sourcesContent":["export const createRequestOptions = (requestOptions: Partial<Api.ClientRequestOptions> = {}): Api.ClientRequestOptions => {\n\trequestOptions = { ...requestOptions };\n\trequestOptions.loadingEl ??= document.body;\n\trequestOptions.loadingShowSpinner ??= true;\n\trequestOptions.method ??= 'POST';\n\trequestOptions.accept ??= 'application/json';\n\n\treturn requestOptions as Api.ClientRequestOptions;\n};\n","/**\n * Сгенерировать объект ответа в формате расширения OpenAPI\n *\n * @see Api.Ext\n */\nexport const genExtRes = (\n\tresult: any,\n\terrors?: Api.Ext.Schemas['ResponseError']['errors'],\n\tresponse?: Response,\n): Api.Response<any> => {\n\treturn {\n\t\tresult,\n\t\terrors,\n\t\tresponse,\n\t};\n};\n\n/**\n * Это публичное API, к которому открыт доступ по прямой ссылке через GET\n *\n * Используется для кеширования и генерации файлов через API\n */\nexport const isPublicAPI = (path: Api.PathAbstract) => {\n\treturn path.startsWith('/system_2/common/');\n};\n\n/**\n * Сгенерировать baseUrl на основе текущего домена\n */\nexport const getBaseDomainUrl = (useMainDomain = false, input: string = window.location.href) => {\n\tconst { protocol, hostname, port } = new URL(input);\n\n\t/**\n\t * localhost / IP-адреса / одноуровневые домены оставляем как есть\n\t */\n\tconst parts = hostname.split('.');\n\tconst baseHostname = !useMainDomain || parts.length <= 2 || /^[\\d.]+$/.test(hostname) || hostname === 'localhost'\n\t\t? hostname\n\t\t: parts.slice(-2).join('.');\n\n\treturn `${protocol}//${baseHostname}${port ? `:${port}` : ''}`;\n};\n","import type { Client } from './client';\nimport { createRequestOptions } from './request-options';\nimport { genExtRes } from '../utils/common';\n\nexport const createRequest = <\n\tRequestContext extends Api.ClientRequestContext<any, any, any>,\n\tFieldsNarrow extends Api.ParamsFields<RequestContext>,\n>(\n\tclient: Client<RequestContext['Paths'], RequestContext['UseExt']>,\n\tpath: RequestContext['Path'],\n\tfieldsNarrow?: FieldsNarrow,\n): Api.ClientRequest<RequestContext, FieldsNarrow> => {\n\tconst clientRequest = {\n\t\tinLoading: false,\n\t\tpath: path as Api.PathAbstract,\n\t\turl: client.options.baseUrl + path,\n\t\toptions: createRequestOptions(client.options.requestOptions),\n\t\tparams: {} as any, // незаполненное свойство\n\t\tgetInLoading: () => clientRequest.inLoading,\n\n\t\tsetParams: (params) => {\n\t\t\tclientRequest.params = { ...params } as any;\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tchangeParams: (params) => {\n\t\t\tObject.assign(clientRequest.params, params);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tsetOptions: (options) => {\n\t\t\tObject.assign(clientRequest.options, options);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tcall: async (fields?) => {\n\t\t\treturn clientRequest.exec(fields);\n\t\t},\n\n\t\tcallFetch: async (fetchStyle, fields?) => {\n\t\t\treturn clientRequest.exec(fields, fetchStyle);\n\t\t},\n\n\t\tcallInNewWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_blank');\n\t\t},\n\n\t\tcallInSelfWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_self');\n\t\t},\n\n\t\tgenData: (fields?, fetchStyle?) => {\n\t\t\tconst post: any = { ...clientRequest.params };\n\n\t\t\t// в старом коде fields вставлялись в params, оставлено для совместимости\n\t\t\t// delete post.fields;\n\t\t\tdelete post.fetch_style;\n\n\t\t\t// поля, указанные при запуске запроса\n\t\t\tif (fields) {\n\t\t\t\tlet fieldsPrepared = [...fields as any[]];\n\n\t\t\t\t// поля, указанные при создании запроса\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tfieldsPrepared = fieldsPrepared.filter(field => fieldsNarrow.includes(field));\n\t\t\t\t}\n\n\t\t\t\tpost.fields = fieldsPrepared;\n\t\t\t} else {\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tpost.fields = fieldsNarrow;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (fetchStyle) {\n\t\t\t\tpost.fetch_style = fetchStyle;\n\t\t\t}\n\n\t\t\treturn post;\n\t\t},\n\n\t\t/**\n\t\t * Общая функция выполнения запросов\n\t\t */\n\t\tasync exec(fields?: FieldsNarrow, fetchStyle?: RequestContext['ParamsFetchStyle']): Promise<any> {\n\t\t\tconst Request = client.options.Request;\n\t\t\tconst fetch = client.options.fetch;\n\n\t\t\tconst data = clientRequest.genData(fields, fetchStyle);\n\n\t\t\tconst middlewareCtxWithoutRequest = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtxWithoutRequest);\n\n\t\t\tlet url = clientRequest.url;\n\n\t\t\tlet requestInitBody: string | undefined = undefined;\n\t\t\tif (clientRequest.options.method !== 'POST') {\n\t\t\t\turl += '?' + new URLSearchParams(data).toString();\n\t\t\t} else {\n\t\t\t\trequestInitBody = client.options.bodySerializer(data);\n\t\t\t}\n\n\t\t\t// checkFingerprint\n\t\t\tlet requestInitSignal: AbortController['signal'] | undefined;\n\n\t\t\tif (this.options.checkFingerprint) {\n\t\t\t\tconst fingerprint = this.path + this.options.checkFingerprint;\n\n\t\t\t\tconst controller = new AbortController();\n\t\t\t\tclient.abortControllers[fingerprint] = controller;\n\n\t\t\t}\n\n\t\t\tconst requestInit = {\n\t\t\t\t...client.options,\n\t\t\t\tmethod: clientRequest.options.method,\n\t\t\t\tbody: requestInitBody,\n\t\t\t\tsignal: requestInitSignal,\n\t\t\t};\n\n\t\t\tlet request = new Request(url, requestInit);\n\n\t\t\trequest.headers.set('x-request-id', middlewareCtxWithoutRequest.id);\n\t\t\trequest.headers.set('content-type', 'application/json');\n\t\t\trequest.headers.set('accept', clientRequest.options.accept);\n\n\t\t\tconst middlewareCtx: Api.MiddlewareCallbackParams = {\n\t\t\t\t...middlewareCtxWithoutRequest,\n\t\t\t\trequest,\n\t\t\t};\n\n\t\t\tclientRequest.inLoading = true;\n\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\n\t\t\tlet response: Response | undefined = undefined;\n\n\t\t\tconst requestOrResponse = await client.middlewareOnRequest(request, middlewareCtx);\n\n\t\t\tif (requestOrResponse instanceof Response) {\n\t\t\t\tresponse = requestOrResponse;\n\t\t\t} else if (requestOrResponse instanceof Request) {\n\t\t\t\trequest = requestOrResponse;\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(request);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tresponse = await client.middlewareOnError(e, middlewareCtx);\n\t\t\t\t} finally {\n\t\t\t\t\tclientRequest.inLoading = false;\n\t\t\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse = await client.middlewareOnResponse(response, middlewareCtx);\n\n\t\t\tlet res: any;\n\t\t\tlet responseText: string | undefined;\n\t\t\tlet formatError: undefined | Api.FormatError = undefined;\n\n\t\t\ttry {\n\t\t\t\t// json - стандартные формат, он может быть возвращен в запросах с другим responseType, если в них произошла ошибка\n\t\t\t\tconst isJSON = response.headers.get('content-type')?.includes('application/json');\n\n\t\t\t\tresponseText = await response.text();\n\n\t\t\t\tif (request.headers.get('Content-Type')?.includes('application/json') || isJSON) {\n\t\t\t\t\tres = JSON.parse(responseText);\n\t\t\t\t} else {\n\t\t\t\t\tif (client.useExt) {\n\t\t\t\t\t\tres = genExtRes(responseText, undefined, response);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tres = responseText;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SyntaxError || e instanceof TypeError) {\n\t\t\t\t\tformatError = e;\n\t\t\t\t\tformatError.responseText = responseText;\n\t\t\t\t}\n\n\t\t\t\t// если в результате не пришел json, сгенерировать объект результата и добавить информацию об ответе API\n\t\t\t\tif (client.useExt && formatError) {\n\t\t\t\t\tlet errorCode = response.status;\n\t\t\t\t\tlet errorMessage = response.statusText;\n\n\t\t\t\t\tif (errorCode === 200) {\n\t\t\t\t\t\terrorCode = 10000;\n\t\t\t\t\t\terrorMessage = 'Error API response';\n\t\t\t\t\t}\n\n\t\t\t\t\tres = genExtRes(null, [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: errorCode,\n\t\t\t\t\t\t\tstring: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t], response);\n\n\t\t\t\t\tif (client.options.useApiConsole) console.error(e);\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (client.useExt) {\n\t\t\t\tres.response = response;\n\n\t\t\t\tif (res) {\n\t\t\t\t\tclientRequest.options.onApiLoaded?.(res, middlewareCtx);\n\t\t\t\t}\n\n\t\t\t\tif (res?.errors) {\n\t\t\t\t\tif (client.options.useApiConsole) console.warn(new Error('API error'), { res });\n\n\t\t\t\t\tclientRequest.options.onApiError?.(res, { ...middlewareCtx, formatError }, client.options.requestOptions?.onApiError);\n\t\t\t\t}\n\n\t\t\t\tif (res?.messages) {\n\t\t\t\t\tclientRequest.options.onApiMessage?.(res, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t},\n\t};\n\n\treturn clientRequest;\n};\n","import { createRequestOptions } from './request-options';\nimport { createRequest } from './request';\n\nexport class Client<paths extends Api.PathsAbstract, UseExt extends Api.Ext.UseExt> {\n\n\treadonly options: Readonly<Api.ClientOptions>;\n\treadonly useExt: UseExt;\n\treadonly middlewares: Api.Middleware[] = [];\n\tabortControllers: Record<string, AbortController> = {};\n\n\tconstructor(clientOptions: Partial<Api.ClientOptions> = {}, useExt: UseExt) {\n\t\tclientOptions.requestOptions = createRequestOptions(clientOptions.requestOptions);\n\t\tclientOptions.useApiConsole ??= true;\n\n\t\tclientOptions.fetch ??= globalThis.fetch;\n\t\tclientOptions.Request ??= globalThis.Request;\n\t\tclientOptions.querySerializer ??= (params) => new URLSearchParams(params as any).toString();\n\t\tclientOptions.bodySerializer ??= (body) => typeof body === 'string' ? body : JSON.stringify(body);\n\n\t\tthis.options = clientOptions as Api.ClientOptions;\n\n\t\tthis.useExt = useExt;\n\t}\n\n\tprivate generateUUID() {\n\t\tif (crypto?.randomUUID) {\n\t\t\treturn crypto.randomUUID();\n\t\t}\n\n\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n\t\t\tconst r = Math.random() * 16 | 0;\n\t\t\tconst v = c === 'x' ? r : (r & 0x3 | 0x8);\n\t\t\treturn v.toString(16);\n\t\t});\n\t}\n\n\t/**\n\t * Зарегистрировать middleware\n\t */\n\tuse(middleware: Api.Middleware) {\n\t\tthis.middlewares.push(middleware);\n\t}\n\n\t/**\n\t * Создать объект запроса\n\t *\n\t * После создания объекта он заполняется необходимыми данными и выполняет запросы к API с помощью APIRequest2.call();\n\t *\n\t * Опционально generic указывать нельзя, поэтому необходимо дублировать определение fetchStyle, [см.](https://github.com/Microsoft/TypeScript/issues/26242)\n\t *\n\t * @param path Путь метода API\n\t * @param fieldsNarrow Список получаемых полей, для методов API с моделью. Если объект запроса переиспользуется, и список полей меняется, указывайте его непосредственно при вызове `api.call()`\n\t */\n\tgen<\n\t\tPath extends Api.Path<paths>,\n\t\tFieldsNarrow extends Api.ParamsFields<Api.ClientRequestContext<paths, Path, UseExt>>\n\t>(\n\t\tpath: Path,\n\t\tfieldsNarrow?: FieldsNarrow,\n\t): Api.ClientRequest<Api.ClientRequestContext<paths, Path, UseExt>, FieldsNarrow> {\n\t\ttype RequestContext = Api.ClientRequestContext<paths, Path, UseExt>;\n\n\t\treturn createRequest<RequestContext, FieldsNarrow>(this, path, fieldsNarrow);\n\t}\n\n\t/**\n\t * Создать объект запроса, не описанного в OpenAPI\n\t */\n\tgenAny<\n\t\tParams extends {},\n\t\tResult = {},\n\t\tFieldsNarrow extends Api.Ext.Schemas['Fields'] | undefined = undefined\n\t>(path: Api.PathAbstract, fieldsNarrow?: FieldsNarrow): Api.ClientRequestCustom<UseExt, Params, Result> {\n\t\treturn this.gen(path as any, fieldsNarrow as any) as unknown as Api.ClientRequestCustom<UseExt, Params, Result>;\n\t}\n\n\t/**\n\t * Создать контекст выполнения запроса\n\t */\n\tgenMiddlewareCtx(\n\t\tclientRequest: Api.ClientRequest<any, any, any>,\n\t\tdata: Record<string, any>,\n\t): Omit<Api.MiddlewareCallbackParams, 'request'> {\n\t\tconst id = this.generateUUID();\n\n\t\tconst options: Api.BaseOptions = Object.freeze({\n\t\t\tbaseUrl: this.options.baseUrl,\n\t\t\tquerySerializer: this.options.querySerializer,\n\t\t\tbodySerializer: this.options.bodySerializer,\n\t\t\tRequest: this.options.Request,\n\t\t\tfetch: this.options.fetch,\n\t\t});\n\n\t\treturn {\n\t\t\tuseExt: this.useExt,\n\t\t\trequestOptions: clientRequest.options,\n\t\t\tdata,\n\t\t\tmiddlewareData: {},\n\t\t\toptions,\n\t\t\tschemaPath: clientRequest.path,\n\t\t\tid,\n\t\t};\n\t};\n\n\t/**\n\t * Обработчик middleware.onRequest\n\t *\n\t * @param request Запрос для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Request` или `Response` при модификации запроса, или undefined\n\t */\n\tasync middlewareOnRequest(\n\t\trequest: Request,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Request | Response | undefined> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onRequest?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Request) {\n\t\t\t\t\trequest = result;\n\t\t\t\t} else if (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('onRequest: must return new Request() or Response() when modifying the request');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn request;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param `error` Ошибка, переданная для обработки\n\t * @param middlewareCtx\n\t * @return Новый экземпляр `Response` при успешной обработке или выбрасывает ошибку\n\t */\n\tasync middlewareOnError(\n\t\terror: Error | unknown,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response | never> {\n\t\tlet errorAfterMiddleware = error;\n\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onError?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\terror: errorAfterMiddleware,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (result instanceof Error) {\n\t\t\t\t\terrorAfterMiddleware = result;\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthrow new Error('onError: must return new Response() or instance of Error');\n\t\t\t}\n\t\t}\n\n\t\tthrow errorAfterMiddleware;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param response Ответ для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Response` при модификации ответа, или undefined\n\t */\n\tasync middlewareOnResponse(\n\t\tresponse: Response,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onResponse?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\tresponse,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (!(result instanceof Response)) {\n\t\t\t\t\tthrow new Error('onResponse: must return new Response() when modifying the response');\n\t\t\t\t}\n\n\t\t\t\tresponse = result;\n\t\t\t}\n\t\t}\n\n\t\treturn response;\n\t}\n\n}\n","import { Client } from './client/client';\n\nexport * from './utils/field';\nexport * from './utils/common';\n\nexport const postInWindow: typeof import('./utils/lazy').postInWindow = async (...args) => {\n\tconst { postInWindow } = await import('./utils/lazy');\n\n\treturn postInWindow(...args);\n};\n\nexport const dataToForm: typeof import('./utils/lazy').dataToForm = async (...args) => {\n\tconst { dataToForm } = await import('./utils/lazy');\n\n\treturn dataToForm(...args);\n};\n\n/**\n * Создать API клиент\n *\n * @see Api.Ext.UseExt\n */\nexport const createClient = <\n\tpaths extends Api.PathsAbstract,\n\tUseExt extends Api.Ext.UseExt\n>(\n\tclientOptions: Partial<Api.ClientOptions> = {},\n\tuseExt: UseExt,\n) => {\n\treturn new Client<paths, UseExt>(clientOptions, useExt);\n};\n"],"names":["createRequestOptions","requestOptions","genExtRes","result","errors","response","isPublicAPI","path","getBaseDomainUrl","useMainDomain","input","protocol","hostname","port","parts","baseHostname","createRequest","client","fieldsNarrow","clientRequest","params","options","fields","fetchStyle","data","middlewareCtx","_b","_a","postInWindow","post","fieldsPrepared","field","Request","fetch","middlewareCtxWithoutRequest","url","requestInitBody","requestInitSignal","fingerprint","controller","requestInit","request","_d","_c","requestOrResponse","e","_f","_e","res","responseText","formatError","isJSON","_g","_h","errorCode","errorMessage","_j","_i","_m","_l","_k","_o","_n","Client","clientOptions","useExt","body","c","r","middleware","id","error","errorAfterMiddleware","args","dataToForm","createClient"],"mappings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,aAAa;AAC1C,YAAMlE,IAAS,QAAMwB,IAAA0C,EAAW,YAAX,gBAAA1C,EAAA,KAAA0C,GAAqB;AAAA,QACzC,GAAG5C;AAAA,QACH,OAAO+C;AAAA,MAAA;AAGR,UAAIrE,GAAQ;AACX,YAAIA,aAAkB;AACrB,iBAAOA;AAGR,YAAIA,aAAkB,OAAO;AAC5B,UAAAqE,IAAuBrE;AAEvB;AAAA,QACD;AAEA,cAAM,IAAI,MAAM,0DAA0D;AAAA,MAC3E;AAAA,IACD;AAEA,UAAMqE;AAAA,EACP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,qBACLnE,GACAoB,GACoB;;AACpB,eAAW4C,KAAc,KAAK,aAAa;AAC1C,YAAMlE,IAAS,QAAMwB,IAAA0C,EAAW,eAAX,gBAAA1C,EAAA,KAAA0C,GAAwB;AAAA,QAC5C,GAAG5C;AAAA,QACH,UAAApB;AAAA,MAAA;AAGD,UAAIF,GAAQ;AACX,YAAI,EAAEA,aAAkB;AACvB,gBAAM,IAAI,MAAM,oEAAoE;AAGrF,QAAAE,IAAWF;AAAA,MACZ;AAAA,IACD;AAEA,WAAOE;AAAA,EACR;AAED;ACpMO,MAAMuB,IAA2D,UAAU6C,MAAS;AAC1F,QAAM,EAAE,cAAA7C,MAAiB,MAAM,OAAO,gCAAc;AAEpD,SAAOA,EAAa,GAAG6C,CAAI;AAC5B,GAEaC,IAAuD,UAAUD,MAAS;AACtF,QAAM,EAAE,YAAAC,MAAe,MAAM,OAAO,gCAAc;AAElD,SAAOA,EAAW,GAAGD,CAAI;AAC1B,GAOaE,IAAe,CAI3BX,IAA4C,CAAA,GAC5CC,MAEO,IAAIF,EAAsBC,GAAeC,CAAM;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/api/api/client/request-options.ts","../../src/api/api/utils/common.ts","../../src/api/api/client/request.ts","../../src/api/api/client/client.ts","../../src/api/api/index.ts"],"sourcesContent":["export const createRequestOptions = (requestOptions: Partial<Api.ClientRequestOptions> = {}): Api.ClientRequestOptions => {\n\trequestOptions = { ...requestOptions };\n\trequestOptions.loadingEl ??= globalThis.document?.body;\n\trequestOptions.loadingShowSpinner ??= true;\n\trequestOptions.method ??= 'POST';\n\trequestOptions.accept ??= 'application/json';\n\n\treturn requestOptions as Api.ClientRequestOptions;\n};\n","/**\n * Сгенерировать объект ответа в формате расширения OpenAPI\n *\n * @see Api.Ext\n */\nexport const genExtRes = (\n\tresult: any,\n\terrors?: Api.Ext.Schemas['ResponseError']['errors'],\n\tresponse?: Response,\n): Api.Response<any> => {\n\treturn {\n\t\tresult,\n\t\terrors,\n\t\tresponse,\n\t};\n};\n\n/**\n * Это публичное API, к которому открыт доступ по прямой ссылке через GET\n *\n * Используется для кеширования и генерации файлов через API\n */\nexport const isPublicAPI = (path: Api.PathAbstract) => {\n\treturn path.startsWith('/system_2/common/');\n};\n\n/**\n * Сгенерировать baseUrl на основе текущего домена\n */\nexport const getBaseDomainUrl = (useMainDomain = false, input: string = window.location.href) => {\n\tconst { protocol, hostname, port } = new URL(input);\n\n\t/**\n\t * localhost / IP-адреса / одноуровневые домены оставляем как есть\n\t */\n\tconst parts = hostname.split('.');\n\tconst baseHostname = !useMainDomain || parts.length <= 2 || /^[\\d.]+$/.test(hostname) || hostname === 'localhost'\n\t\t? hostname\n\t\t: parts.slice(-2).join('.');\n\n\treturn `${protocol}//${baseHostname}${port ? `:${port}` : ''}`;\n};\n","import type { Client } from './client';\nimport { createRequestOptions } from './request-options';\nimport { genExtRes } from '../utils/common';\n\nexport const createRequest = <\n\tRequestContext extends Api.ClientRequestContext<any, any, any>,\n\tFieldsNarrow extends Api.ParamsFields<RequestContext>,\n>(\n\tclient: Client<RequestContext['Paths'], RequestContext['UseExt']>,\n\tpath: RequestContext['Path'],\n\tfieldsNarrow?: FieldsNarrow,\n): Api.ClientRequest<RequestContext, FieldsNarrow> => {\n\tconst clientRequest = {\n\t\tinLoading: false,\n\t\tpath: path as Api.PathAbstract,\n\t\turl: client.options.baseUrl + path,\n\t\toptions: createRequestOptions(client.options.requestOptions),\n\t\tparams: {} as any, // незаполненное свойство\n\t\tgetInLoading: () => clientRequest.inLoading,\n\n\t\tsetParams: (params) => {\n\t\t\tclientRequest.params = { ...params } as any;\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tchangeParams: (params) => {\n\t\t\tObject.assign(clientRequest.params, params);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tsetOptions: (options) => {\n\t\t\tObject.assign(clientRequest.options, options);\n\n\t\t\treturn clientRequest;\n\t\t},\n\n\t\tcall: async (fields?) => {\n\t\t\treturn clientRequest.exec(fields);\n\t\t},\n\n\t\tcallFetch: async (fetchStyle, fields?) => {\n\t\t\treturn clientRequest.exec(fields, fetchStyle);\n\t\t},\n\n\t\tcallInNewWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_blank');\n\t\t},\n\n\t\tcallInSelfWindow: async (fields?) => {\n\t\t\tconst data = clientRequest.genData(fields);\n\n\t\t\tconst middlewareCtx = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtx);\n\n\t\t\tconst { postInWindow } = await import('../utils/lazy');\n\t\t\tvoid postInWindow(clientRequest.url, data, '_self');\n\t\t},\n\n\t\tgenData: (fields?, fetchStyle?) => {\n\t\t\tconst post: any = { ...clientRequest.params };\n\n\t\t\t// в старом коде fields вставлялись в params, оставлено для совместимости\n\t\t\t// delete post.fields;\n\t\t\tdelete post.fetch_style;\n\n\t\t\t// поля, указанные при запуске запроса\n\t\t\tif (fields) {\n\t\t\t\tlet fieldsPrepared = [...fields as any[]];\n\n\t\t\t\t// поля, указанные при создании запроса\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tfieldsPrepared = fieldsPrepared.filter(field => fieldsNarrow.includes(field));\n\t\t\t\t}\n\n\t\t\t\tpost.fields = fieldsPrepared;\n\t\t\t} else {\n\t\t\t\tif (fieldsNarrow) {\n\t\t\t\t\tpost.fields = fieldsNarrow;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (fetchStyle) {\n\t\t\t\tpost.fetch_style = fetchStyle;\n\t\t\t}\n\n\t\t\treturn post;\n\t\t},\n\n\t\t/**\n\t\t * Общая функция выполнения запросов\n\t\t */\n\t\tasync exec(fields?: FieldsNarrow, fetchStyle?: RequestContext['ParamsFetchStyle']): Promise<any> {\n\t\t\tconst Request = client.options.Request;\n\t\t\tconst fetch = client.options.fetch;\n\n\t\t\tconst data = clientRequest.genData(fields, fetchStyle);\n\n\t\t\tconst middlewareCtxWithoutRequest = client.genMiddlewareCtx(clientRequest, data);\n\n\t\t\tclient.options.onPrepareData?.(data, middlewareCtxWithoutRequest);\n\n\t\t\tlet url = clientRequest.url;\n\n\t\t\tlet requestInitBody: string | undefined = undefined;\n\t\t\tif (clientRequest.options.method !== 'POST') {\n\t\t\t\turl += '?' + new URLSearchParams(data).toString();\n\t\t\t} else {\n\t\t\t\trequestInitBody = client.options.bodySerializer(data);\n\t\t\t}\n\n\t\t\t// checkFingerprint\n\t\t\tlet requestInitSignal: AbortController['signal'] | undefined;\n\n\t\t\tif (this.options.checkFingerprint) {\n\t\t\t\tconst fingerprint = this.path + this.options.checkFingerprint;\n\n\t\t\t\tconst controller = new AbortController();\n\t\t\t\tclient.abortControllers[fingerprint] = controller;\n\n\t\t\t}\n\n\t\t\tconst requestInit = {\n\t\t\t\t...client.options,\n\t\t\t\tmethod: clientRequest.options.method,\n\t\t\t\tbody: requestInitBody,\n\t\t\t\tsignal: requestInitSignal,\n\t\t\t};\n\n\t\t\tlet request = new Request(url, requestInit);\n\n\t\t\trequest.headers.set('x-request-id', middlewareCtxWithoutRequest.id);\n\t\t\trequest.headers.set('content-type', 'application/json');\n\t\t\trequest.headers.set('accept', clientRequest.options.accept);\n\n\t\t\tconst middlewareCtx: Api.MiddlewareCallbackParams = {\n\t\t\t\t...middlewareCtxWithoutRequest,\n\t\t\t\trequest,\n\t\t\t};\n\n\t\t\tclientRequest.inLoading = true;\n\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\n\t\t\tlet response: Response | undefined = undefined;\n\n\t\t\tconst requestOrResponse = await client.middlewareOnRequest(request, middlewareCtx);\n\n\t\t\tif (requestOrResponse instanceof Response) {\n\t\t\t\tresponse = requestOrResponse;\n\t\t\t} else if (requestOrResponse instanceof Request) {\n\t\t\t\trequest = requestOrResponse;\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await fetch(request);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tresponse = await client.middlewareOnError(e, middlewareCtx);\n\t\t\t\t} finally {\n\t\t\t\t\tclientRequest.inLoading = false;\n\t\t\t\t\tclientRequest.options.onLoading?.(clientRequest.inLoading, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse = await client.middlewareOnResponse(response, middlewareCtx);\n\n\t\t\tlet res: any;\n\t\t\tlet responseText: string | undefined;\n\t\t\tlet formatError: undefined | Api.FormatError = undefined;\n\n\t\t\ttry {\n\t\t\t\t// json - стандартные формат, он может быть возвращен в запросах с другим responseType, если в них произошла ошибка\n\t\t\t\tconst isJSON = response.headers.get('content-type')?.includes('application/json');\n\n\t\t\t\tresponseText = await response.text();\n\n\t\t\t\tif (request.headers.get('Content-Type')?.includes('application/json') || isJSON) {\n\t\t\t\t\tres = JSON.parse(responseText);\n\t\t\t\t} else {\n\t\t\t\t\tif (client.useExt) {\n\t\t\t\t\t\tres = genExtRes(responseText, undefined, response);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tres = responseText;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SyntaxError || e instanceof TypeError) {\n\t\t\t\t\tformatError = e;\n\t\t\t\t\tformatError.responseText = responseText;\n\t\t\t\t}\n\n\t\t\t\t// если в результате не пришел json, сгенерировать объект результата и добавить информацию об ответе API\n\t\t\t\tif (client.useExt && formatError) {\n\t\t\t\t\tlet errorCode = response.status;\n\t\t\t\t\tlet errorMessage = response.statusText;\n\n\t\t\t\t\tif (errorCode === 200) {\n\t\t\t\t\t\terrorCode = 10000;\n\t\t\t\t\t\terrorMessage = 'Error API response';\n\t\t\t\t\t}\n\n\t\t\t\t\tres = genExtRes(null, [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: errorCode,\n\t\t\t\t\t\t\tstring: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t], response);\n\n\t\t\t\t\tif (client.options.useApiConsole) console.error(e);\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (client.useExt) {\n\t\t\t\tres.response = response;\n\n\t\t\t\tif (res) {\n\t\t\t\t\tclientRequest.options.onApiLoaded?.(res, middlewareCtx);\n\t\t\t\t}\n\n\t\t\t\tif (res?.errors) {\n\t\t\t\t\tif (client.options.useApiConsole) console.warn(new Error('API error'), { res });\n\n\t\t\t\t\tclientRequest.options.onApiError?.(res, { ...middlewareCtx, formatError }, client.options.requestOptions?.onApiError);\n\t\t\t\t}\n\n\t\t\t\tif (res?.messages) {\n\t\t\t\t\tclientRequest.options.onApiMessage?.(res, middlewareCtx);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t},\n\t};\n\n\treturn clientRequest;\n};\n","import { createRequestOptions } from './request-options';\nimport { createRequest } from './request';\n\nexport class Client<paths extends Api.PathsAbstract, UseExt extends Api.Ext.UseExt> {\n\n\treadonly options: Readonly<Api.ClientOptions>;\n\treadonly useExt: UseExt;\n\treadonly middlewares: Api.Middleware[] = [];\n\tabortControllers: Record<string, AbortController> = {};\n\n\tconstructor(clientOptions: Partial<Api.ClientOptions> = {}, useExt: UseExt) {\n\t\tclientOptions.requestOptions = createRequestOptions(clientOptions.requestOptions);\n\t\tclientOptions.useApiConsole ??= true;\n\n\t\tclientOptions.fetch ??= globalThis.fetch;\n\t\tclientOptions.Request ??= globalThis.Request;\n\t\tclientOptions.querySerializer ??= (params) => new URLSearchParams(params as any).toString();\n\t\tclientOptions.bodySerializer ??= (body) => typeof body === 'string' ? body : JSON.stringify(body);\n\n\t\tthis.options = clientOptions as Api.ClientOptions;\n\n\t\tthis.useExt = useExt;\n\t}\n\n\tprivate generateUUID() {\n\t\tif (crypto?.randomUUID) {\n\t\t\treturn crypto.randomUUID();\n\t\t}\n\n\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n\t\t\tconst r = Math.random() * 16 | 0;\n\t\t\tconst v = c === 'x' ? r : (r & 0x3 | 0x8);\n\t\t\treturn v.toString(16);\n\t\t});\n\t}\n\n\t/**\n\t * Зарегистрировать middleware\n\t */\n\tuse(middleware: Api.Middleware) {\n\t\tthis.middlewares.push(middleware);\n\t}\n\n\t/**\n\t * Создать объект запроса\n\t *\n\t * После создания объекта он заполняется необходимыми данными и выполняет запросы к API с помощью APIRequest2.call();\n\t *\n\t * Опционально generic указывать нельзя, поэтому необходимо дублировать определение fetchStyle, [см.](https://github.com/Microsoft/TypeScript/issues/26242)\n\t *\n\t * @param path Путь метода API\n\t * @param fieldsNarrow Список получаемых полей, для методов API с моделью. Если объект запроса переиспользуется, и список полей меняется, указывайте его непосредственно при вызове `api.call()`\n\t */\n\tgen<\n\t\tPath extends Api.Path<paths>,\n\t\tFieldsNarrow extends Api.ParamsFields<Api.ClientRequestContext<paths, Path, UseExt>>\n\t>(\n\t\tpath: Path,\n\t\tfieldsNarrow?: FieldsNarrow,\n\t): Api.ClientRequest<Api.ClientRequestContext<paths, Path, UseExt>, FieldsNarrow> {\n\t\ttype RequestContext = Api.ClientRequestContext<paths, Path, UseExt>;\n\n\t\treturn createRequest<RequestContext, FieldsNarrow>(this, path, fieldsNarrow);\n\t}\n\n\t/**\n\t * Создать объект запроса, не описанного в OpenAPI\n\t */\n\tgenAny<\n\t\tParams extends {},\n\t\tResult = {},\n\t\tFieldsNarrow extends Api.Ext.Schemas['Fields'] | undefined = undefined\n\t>(path: Api.PathAbstract, fieldsNarrow?: FieldsNarrow): Api.ClientRequestCustom<UseExt, Params, Result> {\n\t\treturn this.gen(path as any, fieldsNarrow as any) as unknown as Api.ClientRequestCustom<UseExt, Params, Result>;\n\t}\n\n\t/**\n\t * Создать контекст выполнения запроса\n\t */\n\tgenMiddlewareCtx(\n\t\tclientRequest: Api.ClientRequest<any, any, any>,\n\t\tdata: Record<string, any>,\n\t): Omit<Api.MiddlewareCallbackParams, 'request'> {\n\t\tconst id = this.generateUUID();\n\n\t\tconst options: Api.BaseOptions = Object.freeze({\n\t\t\tbaseUrl: this.options.baseUrl,\n\t\t\tquerySerializer: this.options.querySerializer,\n\t\t\tbodySerializer: this.options.bodySerializer,\n\t\t\tRequest: this.options.Request,\n\t\t\tfetch: this.options.fetch,\n\t\t});\n\n\t\treturn {\n\t\t\tuseExt: this.useExt,\n\t\t\trequestOptions: clientRequest.options,\n\t\t\tdata,\n\t\t\tmiddlewareData: {},\n\t\t\toptions,\n\t\t\tschemaPath: clientRequest.path,\n\t\t\tid,\n\t\t};\n\t};\n\n\t/**\n\t * Обработчик middleware.onRequest\n\t *\n\t * @param request Запрос для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Request` или `Response` при модификации запроса, или undefined\n\t */\n\tasync middlewareOnRequest(\n\t\trequest: Request,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Request | Response | undefined> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onRequest?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Request) {\n\t\t\t\t\trequest = result;\n\t\t\t\t} else if (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('onRequest: must return new Request() or Response() when modifying the request');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn request;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param `error` Ошибка, переданная для обработки\n\t * @param middlewareCtx\n\t * @return Новый экземпляр `Response` при успешной обработке или выбрасывает ошибку\n\t */\n\tasync middlewareOnError(\n\t\terror: Error | unknown,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response | never> {\n\t\tlet errorAfterMiddleware = error;\n\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onError?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\terror: errorAfterMiddleware,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (result instanceof Error) {\n\t\t\t\t\terrorAfterMiddleware = result;\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthrow new Error('onError: must return new Response() or instance of Error');\n\t\t\t}\n\t\t}\n\n\t\tthrow errorAfterMiddleware;\n\t}\n\n\t/**\n\t * Обработчик middleware.onResponse\n\t *\n\t * @param response Ответ для обработки\n\t * @param middlewareCtx Контекст выполнения запроса\n\t * @return Новый экземпляр `Response` при модификации ответа, или undefined\n\t */\n\tasync middlewareOnResponse(\n\t\tresponse: Response,\n\t\tmiddlewareCtx: Api.MiddlewareCallbackParams,\n\t): Promise<Response> {\n\t\tfor (const middleware of this.middlewares) {\n\t\t\tconst result = await middleware.onResponse?.({\n\t\t\t\t...middlewareCtx,\n\t\t\t\tresponse,\n\t\t\t});\n\n\t\t\tif (result) {\n\t\t\t\tif (!(result instanceof Response)) {\n\t\t\t\t\tthrow new Error('onResponse: must return new Response() when modifying the response');\n\t\t\t\t}\n\n\t\t\t\tresponse = result;\n\t\t\t}\n\t\t}\n\n\t\treturn response;\n\t}\n\n}\n","import { Client } from './client/client';\n\nexport * from './utils/field';\nexport * from './utils/common';\n\nexport const postInWindow: typeof import('./utils/lazy').postInWindow = async (...args) => {\n\tconst { postInWindow } = await import('./utils/lazy');\n\n\treturn postInWindow(...args);\n};\n\nexport const dataToForm: typeof import('./utils/lazy').dataToForm = async (...args) => {\n\tconst { dataToForm } = await import('./utils/lazy');\n\n\treturn dataToForm(...args);\n};\n\n/**\n * Создать API клиент\n *\n * @see Api.Ext.UseExt\n */\nexport const createClient = <\n\tpaths extends Api.PathsAbstract,\n\tUseExt extends Api.Ext.UseExt\n>(\n\tclientOptions: Partial<Api.ClientOptions> = {},\n\tuseExt: UseExt,\n) => {\n\treturn new Client<paths, UseExt>(clientOptions, useExt);\n};\n"],"names":["createRequestOptions","requestOptions","_a","genExtRes","result","errors","response","isPublicAPI","path","getBaseDomainUrl","useMainDomain","input","protocol","hostname","port","parts","baseHostname","createRequest","client","fieldsNarrow","clientRequest","params","options","fields","fetchStyle","data","middlewareCtx","_b","postInWindow","post","fieldsPrepared","field","Request","fetch","middlewareCtxWithoutRequest","url","requestInitBody","requestInitSignal","fingerprint","controller","requestInit","request","_d","_c","requestOrResponse","e","_f","_e","res","responseText","formatError","isJSON","_g","_h","errorCode","errorMessage","_j","_i","_m","_l","_k","_o","_n","Client","clientOptions","useExt","body","c","r","middleware","id","error","errorAfterMiddleware","args","dataToForm","createClient"],"mappings":";AAAO,MAAMA,IAAuB,CAACC,IAAoD,OAAiC;;AACzH,SAAAA,IAAiB,EAAE,GAAGA,EAAA,GACtBA,EAAe,eAAcC,IAAA,WAAW,aAAX,gBAAAA,EAAqB,MAClDD,EAAe,uBAAuB,IACtCA,EAAe,WAAW,QAC1BA,EAAe,WAAW,oBAEnBA;AACR,GCHaE,IAAY,CACxBC,GACAC,GACAC,OAEO;AAAA,E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A,aAAkB,OAAO;AAC5B,UAAAoE,IAAuBpE;AAEvB;AAAA,QACD;AAEA,cAAM,IAAI,MAAM,0DAA0D;AAAA,MAC3E;AAAA,IACD;AAEA,UAAMoE;AAAA,EACP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,qBACLlE,GACAoB,GACoB;;AACpB,eAAW2C,KAAc,KAAK,aAAa;AAC1C,YAAMjE,IAAS,QAAMF,IAAAmE,EAAW,eAAX,gBAAAnE,EAAA,KAAAmE,GAAwB;AAAA,QAC5C,GAAG3C;AAAA,QACH,UAAApB;AAAA,MAAA;AAGD,UAAIF,GAAQ;AACX,YAAI,EAAEA,aAAkB;AACvB,gBAAM,IAAI,MAAM,oEAAoE;AAGrF,QAAAE,IAAWF;AAAA,MACZ;AAAA,IACD;AAEA,WAAOE;AAAA,EACR;AAED;ACpMO,MAAMsB,IAA2D,UAAU6C,MAAS;AAC1F,QAAM,EAAE,cAAA7C,MAAiB,MAAM,OAAO,gCAAc;AAEpD,SAAOA,EAAa,GAAG6C,CAAI;AAC5B,GAEaC,IAAuD,UAAUD,MAAS;AACtF,QAAM,EAAE,YAAAC,MAAe,MAAM,OAAO,gCAAc;AAElD,SAAOA,EAAW,GAAGD,CAAI;AAC1B,GAOaE,IAAe,CAI3BX,IAA4C,CAAA,GAC5CC,MAEO,IAAIF,EAAsBC,GAAeC,CAAM;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{color-scheme:dark;--color-theme-0: #000000;--color-theme-50: #0E0E11;--color-theme-75: #101013;--color-theme-100: #131316;--color-theme-125: #17171C;--color-theme-150: #1C1C21;--color-theme-175: #212126;--color-theme-200: #26262C;--color-theme-225: #2A2A32;--color-theme-250: #2F2F37;--color-theme-260: #34343D;--color-theme-275: #393942;--color-theme-300: #3D3D47;--color-theme-325: #42424D;--color-theme-350: #464653;--color-theme-360: #4B4B58;--color-theme-375: #50505E;--color-theme-400: #555563;--color-theme-410: #595969;--color-theme-420: #5E5E6E;--color-theme-430: #626274;--color-theme-440: #676779;--color-theme-450: #6C6C7E;--color-theme-460: #717184;--color-theme-465: #75758A;--color-theme-470: #7B7B8E;--color-theme-475: #818193;--color-theme-480: #868698;--color-theme-485: #8B8B9D;--color-theme-500: #9191A1;--color-theme-550: #9696A6;--color-theme-575: #9C9CAA;--color-theme-600: #A1A1AF;--color-theme-625: #A7A7B4;--color-theme-650: #ACACB9;--color-theme-675: #B2B2BD;--color-theme-700: #B8B8C2;--color-theme-710: #BDBDC6;--color-theme-725: #C2C2CB;--color-theme-750: #C8C8D0;--color-theme-800: #CDCDD5;--color-theme-850: #D3D3D9;--color-theme-900: #D9D9DE;--color-theme-925: #DEDEE3;--color-theme-950: #E3E3E8;--color-theme-955: #E9E9EC;--color-theme-960: #EEEEF1;--color-theme-965: #F4F4F5;--color-theme-970: #FAFAFA;--color-theme-1000: #FFFFFF;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #1F232E;--color-primary-50: #1C2736;--color-primary-100: #18293E;--color-primary-125: #142B48;--color-primary-150: #16355A;--color-primary-200: #183E6D;--color-primary-225: #184781;--color-primary-250: #185095;--color-primary-275: #175AAB;--color-primary-300: #1563C1;--color-primary-350: #136BD8;--color-primary-400: #0F74F0;--color-primary-450: #1E7FF6;--color-primary-500: #2D8AFB;--color-primary-550: #3D94FF;--color-primary-600: #52A0FF;--color-primary-650: #66ABFF;--color-primary-700: #7AB6FF;--color-primary-720: #8FC1FF;--color-primary-740: #A3CDFF;--color-primary-760: #B8D8FF;--color-primary-780: #C2DDFF;--color-primary-800: #CCE3FF;--color-primary-825: #D6E9FF;--color-primary-850: #E0EEFF;--color-primary-900: #EBF4FF;--color-primary-950: #F5F9FF;--color-positive-25: #232424;--color-positive-50: #282A29;--color-positive-100: #25312C;--color-positive-125: #223A30;--color-positive-150: #274939;--color-positive-200: #2C5940;--color-positive-225: #2F6A46;--color-positive-250: #327B49;--color-positive-275: #348D4A;--color-positive-300: #36A150;--color-positive-350: #36B556;--color-positive-400: #36C95B;--color-positive-450: #41D265;--color-positive-500: #4DDB71;--color-positive-550: #5AE27C;--color-positive-600: #6CE58A;--color-positive-650: #87E89F;--color-positive-700: #8EEBA5;--color-positive-720: #A0EEB3;--color-positive-740: #B1F1C1;--color-positive-760: #BAF3C8;--color-positive-780: #C2F4CF;--color-positive-800: #CBF6D6;--color-positive-825: #D4F7DD;--color-positive-850: #DCF9E3;--color-positive-900: #E5FAEA;--color-positive-950: #EEFCF1;--color-warning-25: #322020;--color-warning-50: #39221D;--color-warning-100: #42211A;--color-warning-125: #4C1E15;--color-warning-150: #5E2817;--color-warning-200: #713319;--color-warning-225: #854119;--color-warning-250: #9A5119;--color-warning-275: #AF6418;--color-warning-300: #C56E16;--color-warning-350: #DD7813;--color-warning-400: #F08214;--color-warning-450: #F68C23;--color-warning-500: #FB9632;--color-warning-550: #FFA042;--color-warning-600: #FFAB57;--color-warning-650: #FFB56B;--color-warning-700: #FFBF80;--color-warning-720: #FFC994;--color-warning-740: #FFD3A8;--color-warning-760: #FFDEBD;--color-warning-780: #FFE3C7;--color-warning-800: #FFE8D1;--color-warning-825: #FFEDDB;--color-warning-850: #FFF3E6;--color-warning-900: #FFF7F0;--color-warning-950: #FFFDFA;--color-negative-25: #2F2229;--color-negative-50: #371F2D;--color-negative-100: #401C30;--color-negative-125: #4A1733;--color-negative-150: #5B1A3A;--color-negative-200: #6E1C3E;--color-negative-225: #821C40;--color-negative-250: #961D3F;--color-negative-275: #AB1C31;--color-negative-300: #C11A33;--color-negative-350: #D81834;--color-negative-400: #EB1938;--color-negative-450: #F12745;--color-negative-500: #F73652;--color-negative-550: #FF425E;--color-negative-600: #FF576F;--color-negative-650: #FF6B81;--color-negative-700: #FF8092;--color-negative-720: #FF94A4;--color-negative-740: #FFA8B5;--color-negative-760: #FFBDC6;--color-negative-780: #FFC7CF;--color-negative-800: #FFD1D8;--color-negative-825: #FFDBE1;--color-negative-850: #FFE5E9;--color-negative-900: #FFF0F2;--color-negative-950: #FFFAFA;--color-info-25: #1E1D2B;--color-info-50: #1C1A32;--color-info-100: #1A173B;--color-info-125: #181344;--color-info-150: #201556;--color-info-200: #2A1769;--color-info-225: #36187C;--color-info-250: #441891;--color-info-275: #5517A6;--color-info-300: #5E15BC;--color-info-350: #6612D3;--color-info-400: #6F0FEB;--color-info-450: #7919F5;--color-info-500: #8428FB;--color-info-550: #8F38FF;--color-info-600: #9A4DFF;--color-info-650: #A561FF;--color-info-700: #B175FF;--color-info-720: #BC8AFF;--color-info-740: #C89EFF;--color-info-760: #D4B2FF;--color-info-780: #D9BDFF;--color-info-800: #DFC7FF;--color-info-825: #E5D1FF;--color-info-850: #EBDBFF;--color-info-900: #F1E5FF;--color-info-950: #F6F0FF;--color-layer-1: rgba(140, 140, 166, .08);--color-layer-2: rgba(140, 140, 166, .14);--color-layer-3: rgba(140, 140, 166, .18);--color-layer-4: rgba(140, 140, 166, .24);--color-layer-primary-1: rgba(45, 110, 251, .14);--color-layer-primary-2: rgba(45, 110, 251, .2);--color-layer-primary-3: rgba(45, 110, 251, .3);--color-layer-primary-4: rgba(45, 110, 251, .4);--color-layer-positive-1: rgba(54, 181, 86, .14);--color-layer-positive-2: rgba(54, 181, 86, .2);--color-layer-positive-3: rgba(54, 181, 86, .3);--color-layer-positive-4: rgba(54, 181, 86, .4);--color-layer-warning-1: rgba(255, 160, 66, .14);--color-layer-warning-2: rgba(255, 160, 66, .2);--color-layer-warning-3: rgba(255, 160, 66, .3);--color-layer-warning-4: rgba(255, 160, 66, .4);--color-layer-negative-1: rgba(247, 54, 82, .14);--color-layer-negative-2: rgba(247, 54, 82, .2);--color-layer-negative-3: rgba(247, 54, 82, .3);--color-layer-negative-4: rgba(247, 54, 82, .4);--color-layer-info-1: rgba(165, 97, 255, .14);--color-layer-info-2: rgba(165, 97, 255, .2);--color-layer-info-3: rgba(165, 97, 255, .3);--color-layer-info-4: rgba(165, 97, 255, .4);--top-shadow-xs: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .08);--top-shadow-s: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .17);--top-shadow: 0px 0px 4px rgba(0, 0, 0, .14), 0px 4px 32px rgba(0, 0, 0, .2);--top-shadow-m: 0px 0px 4px 0px rgba(0, 0, 0, .14), 0px 4px 32px 0px rgba(0, 0, 0, .2);--top-shadow-b: 0px 0px 4px rgba(0, 0, 0, .15), 0px 18px 32px rgba(0, 0, 0, .34);--top-shadow-darken: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .12);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .1);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: #FFE500;--color-brand-2: #FFD400;--color-brand-3: #F5BC00;--color-bg-shading-1: var(--color-theme-150);--color-bg-shading-2: var(--color-theme-125);--color-bg-shading-3: var(--color-theme-100);--color-bg-shading-4: var(--color-theme-75);--color-bg-shading-5: var(--color-theme-50);--color-bg-shading-6: var(--color-theme-0);--color-bg-lightning-1: var(--color-theme-260);--color-bg-inverted-1: var(--color-theme-970);--color-bg-inverted-2: var(--color-theme-955);--color-bg-inverted-3: var(--color-theme-900);--color-bg-inverted-4: var(--color-theme-850);--color-bg-inverted-5: var(--color-theme-800);--color-bg-inverted-6: var(--color-theme-750);--color-bg-inverted-7: var(--color-theme-725);--color-bg-inverted-8: var(--color-theme-710);--color-bg-inverted-9: var(--color-theme-700);--color-bg-inverted-10: var(--color-theme-675);--color-bg-primary-1: var(--color-primary-550);--color-bg-primary-2: var(--color-primary-650);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-400);--color-bg-positive-2: var(--color-positive-600);--color-bg-positive-3: var(--color-positive-740);--color-bg-warning-1: var(--color-warning-450);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-700);--color-bg-negative-1: var(--color-negative-550);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-650);--color-bg-info-2: var(--color-info-720);--color-bg-info-3: var(--color-info-780);--top-panel-background-color: rgba(24, 24, 27, .8);--color-text-1: var(--color-theme-970);--color-text-2: var(--color-theme-750);--color-text-3: var(--color-theme-500);--color-text-4: var(--color-theme-450);--color-text-1-inverse: var(--color-theme-100);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-650);--color-text-positive: var(--color-positive-450);--color-text-positive-alt: var(--color-positive-700);--color-text-warning: var(--color-warning-450);--color-text-warning-alt: var(--color-warning-650);--color-text-negative: var(--color-negative-600);--color-text-negative-alt: var(--color-negative-720);--color-text-info: var(--color-info-650);--color-text-info-alt: var(--color-info-740);--color-line-1: var(--color-theme-350);--color-line-2: var(--color-theme-400);--color-line-3: var(--color-theme-485);--color-line-4: var(--color-theme-650);--color-line-1-opacity: rgba(193, 203, 215, .1);--color-line-2-opacity: rgba(193, 203, 215, .15);--color-line-3-opacity: rgba(193, 203, 215, .27);--color-line-primary-1: var(--color-primary-700);--color-line-primary-2: var(--color-primary-760);--color-line-primary-3: var(--color-primary-850);--color-line-primary-1-opacity: rgba(122, 164, 255, .14);--color-line-primary-2-opacity: rgba(122, 164, 255, .28);--color-line-primary-3-opacity: rgba(122, 164, 255, .38);--color-line-positive-1: var(--color-positive-450);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-740);--color-line-positive-1-opacity: rgba(164, 233, 171, .14);--color-line-positive-2-opacity: rgba(164, 233, 171, .28);--color-line-positive-3-opacity: rgba(164, 233, 171, .38);--color-line-warning-1: var(--color-warning-500);--color-line-warning-2: var(--color-warning-650);--color-line-warning-3: var(--color-warning-740);--color-line-warning-1-opacity: rgba(255, 191, 128, .14);--color-line-warning-2-opacity: rgba(255, 191, 128, .28);--color-line-warning-3-opacity: rgba(255, 191, 128, .38);--color-line-negative-1: var(--color-negative-600);--color-line-negative-2: var(--color-negative-650);--color-line-negative-3: var(--color-negative-740);--color-line-negative-1-opacity: rgba(239, 135, 148, .14);--color-line-negative-2-opacity: rgba(239, 135, 148, .28);--color-line-negative-3-opacity: rgba(239, 135, 148, .38);--color-line-info-1: var(--color-info-650);--color-line-info-2: var(--color-info-720);--color-line-info-3: var(--color-info-780);--color-line-info-1-opacity: rgba(168, 120, 247, .14);--color-line-info-2-opacity: rgba(168, 120, 247, .28);--color-line-info-3-opacity: rgba(168, 120, 247, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-250);--scroll-thumb-color-hover: var(--color-theme-300);--scroll-thumb-color-active: var(--color-theme-400);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-500);--top-forms-option-color-hover: var(--color-primary-600)}:root{--color-layout-back: var(--color-theme-50);--color-layout-header: var(--color-theme-175);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-175);--color-layout-front-2: var(--color-theme-200);--color-layout-front-3: var(--color-theme-225);--color-layout-front-4: var(--color-theme-250);--color-layout-front-5: var(--color-theme-260);--color-layout-front-6: var(--color-theme-275);--color-layout-front-primary-1: #232F41;--color-layout-front-primary-2: #232F41;--color-layout-front-primary-3: #243149;--color-layout-front-primary-4: #243450;--color-layout-front-primary-5: #253758;--color-layout-front-primary-6: #253960;--color-layout-front-positive-1: #25333B;--color-layout-front-positive-2: #25333B;--color-layout-front-positive-3: #263A3D;--color-layout-front-positive-4: #284140;--color-layout-front-positive-5: #2A4842;--color-layout-front-positive-6: #2B4F44;--color-layout-front-warning-1: #2B3038;--color-layout-front-warning-2: #2B3038;--color-layout-front-warning-3: #343437;--color-layout-front-warning-4: #3C3836;--color-layout-front-warning-5: #453B35;--color-layout-front-warning-6: #4D3F35;--color-layout-front-negative-1: #2B2C3A;--color-layout-front-negative-2: #2B2C3A;--color-layout-front-negative-3: #342D3B;--color-layout-front-negative-4: #3C2D3C;--color-layout-front-negative-5: #452E3D;--color-layout-front-negative-6: #4D2E3E;--color-layout-front-info-1: #272C41;--color-layout-front-info-2: #272C41;--color-layout-front-info-3: #2B2C49;--color-layout-front-info-4: #2F2C50;--color-layout-front-info-5: #332B58;--color-layout-front-info-6: #362B60}:root{--color-summary-top-3: #5BA8DC;--color-summary-top-10: #1AAD7B;--color-summary-top-30: #4BD2B8;--color-summary-top-50: #68CA63;--color-summary-top-100: #9DAAAA;--color-summary-top-10000: #CAA549;--color-table-top-1: #425C8F;--color-table-top-2: #384E7A;--color-table-top-3: #394660;--color-table-top-4: #357550;--color-table-top-5: #336F4E;--color-table-top-6: #326B4D;--color-table-top-7: #31684C;--color-table-top-8: #30624A;--color-table-top-9: #2F5D48;--color-table-top-10: #2D5747;--color-table-move-up-10: #0E6A44;--color-table-move-up-9: #116542;--color-table-move-up-8: #145F40;--color-table-move-up-7: #165A3E;--color-table-move-up-6: #19543C;--color-table-move-up-5: #1B4F3A;--color-table-move-up-4: #1E4938;--color-table-move-up-3: #204335;--color-table-move-up-2: #233E33;--color-table-move-up-1: #263832;--color-table-move-0: #313135;--color-table-move-down-1: #46303F;--color-table-move-down-2: #4F3040;--color-table-move-down-3: #583142;--color-table-move-down-4: #633244;--color-table-move-down-5: #6C3345;--color-table-move-down-6: #723446;--color-table-move-down-7: #793547;--color-table-move-down-8: #823649;--color-table-move-down-9: #8A364A;--color-table-move-down-10: #93374C;--color-table-down: #46303F;--color-table-down-10: #4F3040;--color-table-up: #365344;--color-table-up-10: #2C5145;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #878742;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #FFF6C6;--color-snapshot-panel-gradient-1: rgba(35, 44, 77, .5);--color-snapshot-panel-gradient-2: rgba(35, 44, 77, .8);--color-snippet-title: #A2C2FA;--color-snippet-title-visited: #BC8CF2;--color-snippet-url: #007700}
|
|
1
|
+
:root{color-scheme:dark;--color-theme-0: #000000;--color-theme-50: #0E0E11;--color-theme-75: #101013;--color-theme-100: #131316;--color-theme-125: #17171C;--color-theme-150: #1C1C21;--color-theme-175: #212126;--color-theme-200: #26262C;--color-theme-225: #2A2A32;--color-theme-250: #2F2F37;--color-theme-260: #34343D;--color-theme-275: #393942;--color-theme-300: #3D3D47;--color-theme-325: #42424D;--color-theme-350: #464653;--color-theme-360: #4B4B58;--color-theme-375: #50505E;--color-theme-400: #555563;--color-theme-410: #595969;--color-theme-420: #5E5E6E;--color-theme-430: #626274;--color-theme-440: #676779;--color-theme-450: #6C6C7E;--color-theme-460: #717184;--color-theme-465: #75758A;--color-theme-470: #7B7B8E;--color-theme-475: #818193;--color-theme-480: #868698;--color-theme-485: #8B8B9D;--color-theme-500: #9191A1;--color-theme-550: #9696A6;--color-theme-575: #9C9CAA;--color-theme-600: #A1A1AF;--color-theme-625: #A7A7B4;--color-theme-650: #ACACB9;--color-theme-675: #B2B2BD;--color-theme-700: #B8B8C2;--color-theme-710: #BDBDC6;--color-theme-725: #C2C2CB;--color-theme-750: #C8C8D0;--color-theme-800: #CDCDD5;--color-theme-850: #D3D3D9;--color-theme-900: #D9D9DE;--color-theme-925: #DEDEE3;--color-theme-950: #E3E3E8;--color-theme-955: #E9E9EC;--color-theme-960: #EEEEF1;--color-theme-965: #F4F4F5;--color-theme-970: #FAFAFA;--color-theme-1000: #FFFFFF;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #1F232E;--color-primary-50: #1C2736;--color-primary-100: #18293E;--color-primary-125: #142B48;--color-primary-150: #16355A;--color-primary-200: #183E6D;--color-primary-225: #184781;--color-primary-250: #185095;--color-primary-275: #175AAB;--color-primary-300: #1563C1;--color-primary-350: #136BD8;--color-primary-400: #0F74F0;--color-primary-450: #1E7FF6;--color-primary-500: #2D8AFB;--color-primary-550: #3D94FF;--color-primary-600: #52A0FF;--color-primary-650: #66ABFF;--color-primary-700: #7AB6FF;--color-primary-720: #8FC1FF;--color-primary-740: #A3CDFF;--color-primary-760: #B8D8FF;--color-primary-780: #C2DDFF;--color-primary-800: #CCE3FF;--color-primary-825: #D6E9FF;--color-primary-850: #E0EEFF;--color-primary-900: #EBF4FF;--color-primary-950: #F5F9FF;--color-positive-25: #232424;--color-positive-50: #282A29;--color-positive-100: #25312C;--color-positive-125: #223A30;--color-positive-150: #274939;--color-positive-200: #2C5940;--color-positive-225: #2F6A46;--color-positive-250: #327B49;--color-positive-275: #348D4A;--color-positive-300: #36A150;--color-positive-350: #36B556;--color-positive-400: #36C95B;--color-positive-450: #41D265;--color-positive-500: #4DDB71;--color-positive-550: #5AE27C;--color-positive-600: #6CE58A;--color-positive-650: #87E89F;--color-positive-700: #8EEBA5;--color-positive-720: #A0EEB3;--color-positive-740: #B1F1C1;--color-positive-760: #BAF3C8;--color-positive-780: #C2F4CF;--color-positive-800: #CBF6D6;--color-positive-825: #D4F7DD;--color-positive-850: #DCF9E3;--color-positive-900: #E5FAEA;--color-positive-950: #EEFCF1;--color-warning-25: #322020;--color-warning-50: #39221D;--color-warning-100: #42211A;--color-warning-125: #4C1E15;--color-warning-150: #5E2817;--color-warning-200: #713319;--color-warning-225: #854119;--color-warning-250: #9A5119;--color-warning-275: #AF6418;--color-warning-300: #C56E16;--color-warning-350: #DD7813;--color-warning-400: #F08214;--color-warning-450: #F68C23;--color-warning-500: #FB9632;--color-warning-550: #FFA042;--color-warning-600: #FFAB57;--color-warning-650: #FFB56B;--color-warning-700: #FFBF80;--color-warning-720: #FFC994;--color-warning-740: #FFD3A8;--color-warning-760: #FFDEBD;--color-warning-780: #FFE3C7;--color-warning-800: #FFE8D1;--color-warning-825: #FFEDDB;--color-warning-850: #FFF3E6;--color-warning-900: #FFF7F0;--color-warning-950: #FFFDFA;--color-negative-25: #2F2229;--color-negative-50: #371F2D;--color-negative-100: #401C30;--color-negative-125: #4A1733;--color-negative-150: #5B1A3A;--color-negative-200: #6E1C3E;--color-negative-225: #821C40;--color-negative-250: #961D3F;--color-negative-275: #AB1C31;--color-negative-300: #C11A33;--color-negative-350: #D81834;--color-negative-400: #EB1938;--color-negative-450: #F12745;--color-negative-500: #F73652;--color-negative-550: #FF425E;--color-negative-600: #FF576F;--color-negative-650: #FF6B81;--color-negative-700: #FF8092;--color-negative-720: #FF94A4;--color-negative-740: #FFA8B5;--color-negative-760: #FFBDC6;--color-negative-780: #FFC7CF;--color-negative-800: #FFD1D8;--color-negative-825: #FFDBE1;--color-negative-850: #FFE5E9;--color-negative-900: #FFF0F2;--color-negative-950: #FFFAFA;--color-info-25: #1E1D2B;--color-info-50: #1C1A32;--color-info-100: #1A173B;--color-info-125: #181344;--color-info-150: #201556;--color-info-200: #2A1769;--color-info-225: #36187C;--color-info-250: #441891;--color-info-275: #5517A6;--color-info-300: #5E15BC;--color-info-350: #6612D3;--color-info-400: #6F0FEB;--color-info-450: #7919F5;--color-info-500: #8428FB;--color-info-550: #8F38FF;--color-info-600: #9A4DFF;--color-info-650: #A561FF;--color-info-700: #B175FF;--color-info-720: #BC8AFF;--color-info-740: #C89EFF;--color-info-760: #D4B2FF;--color-info-780: #D9BDFF;--color-info-800: #DFC7FF;--color-info-825: #E5D1FF;--color-info-850: #EBDBFF;--color-info-900: #F1E5FF;--color-info-950: #F6F0FF;--color-layer-1: rgba(140, 140, 166, .08);--color-layer-2: rgba(140, 140, 166, .14);--color-layer-3: rgba(140, 140, 166, .18);--color-layer-4: rgba(140, 140, 166, .24);--color-layer-primary-1: rgba(45, 110, 251, .14);--color-layer-primary-2: rgba(45, 110, 251, .2);--color-layer-primary-3: rgba(45, 110, 251, .3);--color-layer-primary-4: rgba(45, 110, 251, .4);--color-layer-positive-1: rgba(54, 181, 86, .14);--color-layer-positive-2: rgba(54, 181, 86, .2);--color-layer-positive-3: rgba(54, 181, 86, .3);--color-layer-positive-4: rgba(54, 181, 86, .4);--color-layer-warning-1: rgba(255, 160, 66, .14);--color-layer-warning-2: rgba(255, 160, 66, .2);--color-layer-warning-3: rgba(255, 160, 66, .3);--color-layer-warning-4: rgba(255, 160, 66, .4);--color-layer-negative-1: rgba(247, 54, 82, .14);--color-layer-negative-2: rgba(247, 54, 82, .2);--color-layer-negative-3: rgba(247, 54, 82, .3);--color-layer-negative-4: rgba(247, 54, 82, .4);--color-layer-info-1: rgba(165, 97, 255, .14);--color-layer-info-2: rgba(165, 97, 255, .2);--color-layer-info-3: rgba(165, 97, 255, .3);--color-layer-info-4: rgba(165, 97, 255, .4);--top-shadow-xs: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .08);--top-shadow-s: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .17);--top-shadow: 0px 0px 4px rgba(0, 0, 0, .14), 0px 4px 32px rgba(0, 0, 0, .2);--top-shadow-m: 0px 0px 4px 0px rgba(0, 0, 0, .14), 0px 4px 32px 0px rgba(0, 0, 0, .2);--top-shadow-b: 0px 0px 4px rgba(0, 0, 0, .15), 0px 18px 32px rgba(0, 0, 0, .34);--top-shadow-darken: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .12);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .1);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: #FFE500;--color-brand-2: #FFD400;--color-brand-3: #F5BC00;--color-bg-shading-1: var(--color-theme-150);--color-bg-shading-2: var(--color-theme-125);--color-bg-shading-3: var(--color-theme-100);--color-bg-shading-4: var(--color-theme-75);--color-bg-shading-5: var(--color-theme-50);--color-bg-shading-6: var(--color-theme-0);--color-bg-lightning-1: var(--color-theme-260);--color-bg-primary-1: var(--color-primary-550);--color-bg-primary-2: var(--color-primary-650);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-400);--color-bg-positive-2: var(--color-positive-600);--color-bg-positive-3: var(--color-positive-740);--color-bg-warning-1: var(--color-warning-450);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-700);--color-bg-negative-1: var(--color-negative-550);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-650);--color-bg-info-2: var(--color-info-720);--color-bg-info-3: var(--color-info-780);--top-panel-background-color: rgba(24, 24, 27, .8);--color-text-1: var(--color-theme-970);--color-text-2: var(--color-theme-750);--color-text-3: var(--color-theme-500);--color-text-4: var(--color-theme-450);--color-text-1-inverse: var(--color-theme-100);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-650);--color-text-positive: var(--color-positive-450);--color-text-positive-alt: var(--color-positive-700);--color-text-warning: var(--color-warning-450);--color-text-warning-alt: var(--color-warning-650);--color-text-negative: var(--color-negative-600);--color-text-negative-alt: var(--color-negative-720);--color-text-info: var(--color-info-650);--color-text-info-alt: var(--color-info-740);--color-line-1: var(--color-theme-350);--color-line-2: var(--color-theme-400);--color-line-3: var(--color-theme-485);--color-line-4: var(--color-theme-650);--color-line-1-opacity: rgba(193, 203, 215, .1);--color-line-2-opacity: rgba(193, 203, 215, .15);--color-line-3-opacity: rgba(193, 203, 215, .27);--color-line-primary-1: var(--color-primary-700);--color-line-primary-2: var(--color-primary-760);--color-line-primary-3: var(--color-primary-850);--color-line-primary-1-opacity: rgba(122, 164, 255, .14);--color-line-primary-2-opacity: rgba(122, 164, 255, .28);--color-line-primary-3-opacity: rgba(122, 164, 255, .38);--color-line-positive-1: var(--color-positive-450);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-740);--color-line-positive-1-opacity: rgba(164, 233, 171, .14);--color-line-positive-2-opacity: rgba(164, 233, 171, .28);--color-line-positive-3-opacity: rgba(164, 233, 171, .38);--color-line-warning-1: var(--color-warning-500);--color-line-warning-2: var(--color-warning-650);--color-line-warning-3: var(--color-warning-740);--color-line-warning-1-opacity: rgba(255, 191, 128, .14);--color-line-warning-2-opacity: rgba(255, 191, 128, .28);--color-line-warning-3-opacity: rgba(255, 191, 128, .38);--color-line-negative-1: var(--color-negative-600);--color-line-negative-2: var(--color-negative-650);--color-line-negative-3: var(--color-negative-740);--color-line-negative-1-opacity: rgba(239, 135, 148, .14);--color-line-negative-2-opacity: rgba(239, 135, 148, .28);--color-line-negative-3-opacity: rgba(239, 135, 148, .38);--color-line-info-1: var(--color-info-650);--color-line-info-2: var(--color-info-720);--color-line-info-3: var(--color-info-780);--color-line-info-1-opacity: rgba(168, 120, 247, .14);--color-line-info-2-opacity: rgba(168, 120, 247, .28);--color-line-info-3-opacity: rgba(168, 120, 247, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-250);--scroll-thumb-color-hover: var(--color-theme-300);--scroll-thumb-color-active: var(--color-theme-400);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-500);--top-forms-option-color-hover: var(--color-primary-600)}:root{--color-layout-back: var(--color-theme-50);--color-layout-header: var(--color-theme-175);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-175);--color-layout-front-2: var(--color-theme-200);--color-layout-front-3: var(--color-theme-225);--color-layout-front-4: var(--color-theme-250);--color-layout-front-5: var(--color-theme-260);--color-layout-front-6: var(--color-theme-275);--color-layout-front-primary-1: #232F41;--color-layout-front-primary-2: #232F41;--color-layout-front-primary-3: #243149;--color-layout-front-primary-4: #243450;--color-layout-front-primary-5: #253758;--color-layout-front-primary-6: #253960;--color-layout-front-positive-1: #25333B;--color-layout-front-positive-2: #25333B;--color-layout-front-positive-3: #263A3D;--color-layout-front-positive-4: #284140;--color-layout-front-positive-5: #2A4842;--color-layout-front-positive-6: #2B4F44;--color-layout-front-warning-1: #2B3038;--color-layout-front-warning-2: #2B3038;--color-layout-front-warning-3: #343437;--color-layout-front-warning-4: #3C3836;--color-layout-front-warning-5: #453B35;--color-layout-front-warning-6: #4D3F35;--color-layout-front-negative-1: #2B2C3A;--color-layout-front-negative-2: #2B2C3A;--color-layout-front-negative-3: #342D3B;--color-layout-front-negative-4: #3C2D3C;--color-layout-front-negative-5: #452E3D;--color-layout-front-negative-6: #4D2E3E;--color-layout-front-info-1: #272C41;--color-layout-front-info-2: #272C41;--color-layout-front-info-3: #2B2C49;--color-layout-front-info-4: #2F2C50;--color-layout-front-info-5: #332B58;--color-layout-front-info-6: #362B60}:root{--color-summary-top-3: #5BA8DC;--color-summary-top-10: #1AAD7B;--color-summary-top-30: #4BD2B8;--color-summary-top-50: #68CA63;--color-summary-top-100: #9DAAAA;--color-summary-top-10000: #CAA549;--color-table-top-1: #425C8F;--color-table-top-2: #384E7A;--color-table-top-3: #394660;--color-table-top-4: #357550;--color-table-top-5: #336F4E;--color-table-top-6: #326B4D;--color-table-top-7: #31684C;--color-table-top-8: #30624A;--color-table-top-9: #2F5D48;--color-table-top-10: #2D5747;--color-table-move-up-10: #0E6A44;--color-table-move-up-9: #116542;--color-table-move-up-8: #145F40;--color-table-move-up-7: #165A3E;--color-table-move-up-6: #19543C;--color-table-move-up-5: #1B4F3A;--color-table-move-up-4: #1E4938;--color-table-move-up-3: #204335;--color-table-move-up-2: #233E33;--color-table-move-up-1: #263832;--color-table-move-0: #313135;--color-table-move-down-1: #46303F;--color-table-move-down-2: #4F3040;--color-table-move-down-3: #583142;--color-table-move-down-4: #633244;--color-table-move-down-5: #6C3345;--color-table-move-down-6: #723446;--color-table-move-down-7: #793547;--color-table-move-down-8: #823649;--color-table-move-down-9: #8A364A;--color-table-move-down-10: #93374C;--color-table-down: #46303F;--color-table-down-10: #4F3040;--color-table-up: #365344;--color-table-up-10: #2C5145;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #878742;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #FFF6C6;--color-snapshot-panel-gradient-1: rgba(35, 44, 77, .5);--color-snapshot-panel-gradient-2: rgba(35, 44, 77, .8);--color-snippet-title: #A2C2FA;--color-snippet-title-visited: #BC8CF2;--color-snippet-url: #007700}
|
package/assets/themes/dark.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{color-scheme:dark;--color-theme-0: #000000;--color-theme-50: #050815;--color-theme-75: #090A18;--color-theme-100: #0E121B;--color-theme-125: #111722;--color-theme-150: #141C29;--color-theme-175: #172130;--color-theme-200: #1B2637;--color-theme-225: #1E2B3E;--color-theme-250: #223044;--color-theme-260: #25344C;--color-theme-275: #293852;--color-theme-300: #2C3E58;--color-theme-325: #2F4360;--color-theme-350: #324867;--color-theme-360: #364D6D;--color-theme-375: #395175;--color-theme-400: #3D557B;--color-theme-410: #405A82;--color-theme-420: #435F89;--color-theme-430: #47648F;--color-theme-440: #4A6996;--color-theme-450: #4D6E9D;--color-theme-460: #5173A4;--color-theme-465: #5476AB;--color-theme-470: #5B7DAE;--color-theme-475: #6281B2;--color-theme-480: #6987B5;--color-theme-485: #708DB8;--color-theme-500: #7692BC;--color-theme-550: #7D97BF;--color-theme-575: #849DC2;--color-theme-600: #8AA2C6;--color-theme-625: #92A7C9;--color-theme-650: #98AECD;--color-theme-675: #9FB3D0;--color-theme-700: #A7B9D3;--color-theme-710: #ADBED6;--color-theme-725: #B3C3DA;--color-theme-750: #BBC9DD;--color-theme-800: #C1CEE1;--color-theme-850: #C8D3E4;--color-theme-900: #CFD9E8;--color-theme-925: #D6DEEB;--color-theme-950: #DDE3EE;--color-theme-955: #E4EAF1;--color-theme-960: #EAEFF5;--color-theme-965: #F1F4F8;--color-theme-970: #F9FAFB;--color-theme-1000: #FFFFFF;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #1F252E;--color-primary-50: #1C2736;--color-primary-100: #18293E;--color-primary-125: #142B48;--color-primary-150: #16355A;--color-primary-200: #183E6D;--color-primary-225: #184781;--color-primary-250: #185095;--color-primary-275: #175AAB;--color-primary-300: #1563C1;--color-primary-350: #136BD8;--color-primary-400: #0F74F0;--color-primary-450: #1E7FF6;--color-primary-500: #2D8AFB;--color-primary-550: #3D94FF;--color-primary-600: #52A0FF;--color-primary-650: #66ABFF;--color-primary-700: #7AB6FF;--color-primary-720: #8FC1FF;--color-primary-740: #A3CDFF;--color-primary-760: #B8D8FF;--color-primary-780: #C2DDFF;--color-primary-800: #CCE3FF;--color-primary-825: #D6E9FF;--color-primary-850: #E0EEFF;--color-primary-900: #EBF4FF;--color-primary-950: #F5F9FF;--color-positive-25: #111311;--color-positive-50: #131612;--color-positive-100: #141A14;--color-positive-125: #161E15;--color-positive-150: #1C2C1C;--color-positive-200: #223A23;--color-positive-225: #27492B;--color-positive-250: #2C5934;--color-positive-275: #2F6A3E;--color-positive-300: #327B44;--color-positive-350: #348D4B;--color-positive-400: #36A150;--color-positive-450: #36B556;--color-positive-500: #36C95B;--color-positive-550: #41D265;--color-positive-600: #4DDB73;--color-positive-650: #5AE27C;--color-positive-700: #6CE58A;--color-positive-720: #7DE898;--color-positive-740: #8EEBA5;--color-positive-760: #A0EEB3;--color-positive-780: #B1F1C1;--color-positive-800: #C2F4CF;--color-positive-825: #D8F8E0;--color-positive-850: #E5FAEA;--color-positive-900: #EEFCF1;--color-positive-950: #F6FDF8;--color-warning-25: #3C1F1F;--color-warning-50: #39221B;--color-warning-100: #421B1A;--color-warning-125: #4C2015;--color-warning-150: #5E2517;--color-warning-200: #71321E;--color-warning-225: #7F3D19;--color-warning-250: #9A511A;--color-warning-275: #AF6420;--color-warning-300: #C56D1C;--color-warning-350: #DD780C;--color-warning-400: #F08214;--color-warning-450: #F48B1B;--color-warning-500: #FB9632;--color-warning-550: #FFA042;--color-warning-600: #FFAB57;--color-warning-650: #FFB56B;--color-warning-700: #FFBF80;--color-warning-720: #FFCB94;--color-warning-740: #FFD7A8;--color-warning-760: #FFDEBF;--color-warning-780: #FFE3C7;--color-warning-800: #FFE8CF;--color-warning-825: #FFEDDB;--color-warning-850: #FFF3E6;--color-warning-900: #FFF7F0;--color-warning-950: #FFFDFA;--color-negative-25: #2E2229;--color-negative-50: #371F2B;--color-negative-100: #402030;--color-negative-125: #4A1733;--color-negative-150: #5B193A;--color-negative-200: #6E1C2F;--color-negative-225: #8A1C34;--color-negative-250: #9B1D32;--color-negative-275: #AB1A2F;--color-negative-300: #C31A30;--color-negative-350: #D81534;--color-negative-400: #EB1938;--color-negative-450: #F12745;--color-negative-500: #F73652;--color-negative-550: #FF4262;--color-negative-600: #FF576F;--color-negative-650: #FF6B7B;--color-negative-700: #FF8092;--color-negative-720: #FF949F;--color-negative-740: #FFA8B5;--color-negative-760: #FFBFC6;--color-negative-780: #FFC7CF;--color-negative-800: #FFD1D8;--color-negative-825: #FFDDE1;--color-negative-850: #FFE5E9;--color-negative-900: #FFF0F2;--color-negative-950: #FFFAFB;--color-info-25: #1E1D2B;--color-info-50: #1C1A32;--color-info-100: #1A173B;--color-info-125: #181344;--color-info-150: #201556;--color-info-200: #2A1769;--color-info-225: #36187C;--color-info-250: #441891;--color-info-275: #5517A6;--color-info-300: #5E15BC;--color-info-350: #6612D3;--color-info-400: #6F0FEB;--color-info-450: #7919F5;--color-info-500: #8428FB;--color-info-550: #8F38FF;--color-info-600: #9A4DFF;--color-info-650: #A561FF;--color-info-700: #B175FF;--color-info-720: #BC8AFF;--color-info-740: #C89EFF;--color-info-760: #D4B2FF;--color-info-780: #D9BDFF;--color-info-800: #DFC7FF;--color-info-825: #E5D1FF;--color-info-850: #EBDBFF;--color-info-900: #F1E5FF;--color-info-950: #F6F0FF;--color-layer-1: rgba(129, 148, 177, .08);--color-layer-2: rgba(129, 148, 177, .14);--color-layer-3: rgba(129, 148, 177, .18);--color-layer-4: rgba(129, 148, 177, .24);--color-layer-primary-1: rgba(45, 110, 251, .14);--color-layer-primary-2: rgba(45, 110, 251, .2);--color-layer-primary-3: rgba(45, 110, 251, .3);--color-layer-primary-4: rgba(45, 110, 251, .4);--color-layer-positive-1: rgba(54, 181, 86, .14);--color-layer-positive-2: rgba(54, 181, 86, .2);--color-layer-positive-3: rgba(54, 181, 86, .3);--color-layer-positive-4: rgba(54, 181, 86, .4);--color-layer-warning-1: rgba(255, 160, 66, .14);--color-layer-warning-2: rgba(255, 160, 66, .2);--color-layer-warning-3: rgba(255, 160, 66, .3);--color-layer-warning-4: rgba(255, 160, 66, .4);--color-layer-negative-1: rgba(247, 54, 82, .14);--color-layer-negative-2: rgba(247, 54, 82, .2);--color-layer-negative-3: rgba(247, 54, 82, .3);--color-layer-negative-4: rgba(247, 54, 82, .4);--color-layer-info-1: rgba(165, 97, 255, .14);--color-layer-info-2: rgba(165, 97, 255, .2);--color-layer-info-3: rgba(165, 97, 255, .3);--color-layer-info-4: rgba(165, 97, 255, .4);--top-shadow-xs: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .08);--top-shadow-s: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .17);--top-shadow: 0px 0px 4px rgba(0, 0, 0, .14), 0px 4px 32px rgba(0, 0, 0, .2);--top-shadow-m: 0px 0px 4px 0px rgba(0, 0, 0, .14), 0px 4px 32px 0px rgba(0, 0, 0, .2);--top-shadow-b: 0px 0px 4px rgba(0, 0, 0, .15), 0px 18px 32px rgba(0, 0, 0, .34);--top-shadow-darken-1: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .12);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .1);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: var(--color-primary-700);--color-brand-2: var(--color-primary-740);--color-brand-3: var(--color-primary-800);--color-bg-shading-1: var(--color-theme-200);--color-bg-shading-2: var(--color-theme-175);--color-bg-shading-3: var(--color-theme-150);--color-bg-shading-4: var(--color-theme-125);--color-bg-shading-5: var(--color-theme-100);--color-bg-shading-6: var(--color-theme-50);--color-bg-lightning-1: var(--color-theme-260);--color-bg-inverted-1: var(--color-theme-970);--color-bg-inverted-2: var(--color-theme-955);--color-bg-inverted-3: var(--color-theme-900);--color-bg-inverted-4: var(--color-theme-850);--color-bg-inverted-5: var(--color-theme-800);--color-bg-inverted-6: var(--color-theme-750);--color-bg-inverted-7: var(--color-theme-725);--color-bg-inverted-8: var(--color-theme-710);--color-bg-inverted-9: var(--color-theme-700);--color-bg-inverted-10: var(--color-theme-675);--color-bg-primary-1: var(--color-primary-550);--color-bg-primary-2: var(--color-primary-650);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-450);--color-bg-positive-2: var(--color-positive-600);--color-bg-positive-3: var(--color-positive-740);--color-bg-warning-1: var(--color-warning-450);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-700);--color-bg-negative-1: var(--color-negative-550);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-650);--color-bg-info-2: var(--color-info-720);--color-bg-info-3: var(--color-info-780);--top-panel-background-color: rgba(17, 23, 34, .8);--color-text-1: var(--color-theme-970);--color-text-2: var(--color-theme-750);--color-text-3: var(--color-theme-500);--color-text-4: var(--color-theme-450);--color-text-1-inverse: var(--color-theme-100);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-650);--color-text-positive: var(--color-positive-450);--color-text-positive-alt: var(--color-positive-600);--color-text-warning: var(--color-warning-450);--color-text-warning-alt: var(--color-warning-650);--color-text-negative: var(--color-negative-550);--color-text-negative-alt: var(--color-negative-650);--color-text-info: var(--color-info-650);--color-text-info-alt: var(--color-info-740);--color-line-1: var(--color-theme-350);--color-line-2: var(--color-theme-400);--color-line-3: var(--color-theme-485);--color-line-4: var(--color-theme-650);--color-line-1-opacity: rgba(193, 203, 215, .1);--color-line-2-opacity: rgba(193, 203, 215, .15);--color-line-3-opacity: rgba(193, 203, 215, .27);--color-line-primary-1: var(--color-primary-450);--color-line-primary-2: var(--color-primary-600);--color-line-primary-3: var(--color-primary-740);--color-line-primary-1-opacity: rgba(122, 164, 255, .14);--color-line-primary-2-opacity: rgba(122, 164, 255, .28);--color-line-primary-3-opacity: rgba(122, 164, 255, .38);--color-line-positive-1: var(--color-positive-450);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-740);--color-line-positive-1-opacity: rgba(164, 233, 171, .14);--color-line-positive-2-opacity: rgba(164, 233, 171, .28);--color-line-positive-3-opacity: rgba(164, 233, 171, .38);--color-line-warning-1: var(--color-warning-450);--color-line-warning-2: var(--color-warning-600);--color-line-warning-3: var(--color-warning-700);--color-line-warning-1-opacity: rgba(255, 191, 128, .14);--color-line-warning-2-opacity: rgba(255, 191, 128, .28);--color-line-warning-3-opacity: rgba(255, 191, 128, .38);--color-line-negative-1: var(--color-negative-550);--color-line-negative-2: var(--color-negative-650);--color-line-negative-3: var(--color-negative-720);--color-line-negative-1-opacity: rgba(239, 135, 148, .14);--color-line-negative-2-opacity: rgba(239, 135, 148, .28);--color-line-negative-3-opacity: rgba(239, 135, 148, .38);--color-line-info-1: var(--color-info-650);--color-line-info-2: var(--color-info-720);--color-line-info-3: var(--color-info-780);--color-line-info-1-opacity: rgba(168, 120, 247, .14);--color-line-info-2-opacity: rgba(168, 120, 247, .28);--color-line-info-3-opacity: rgba(168, 120, 247, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-300);--scroll-thumb-color-hover: var(--color-theme-450);--scroll-thumb-color-active: var(--color-theme-550);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-550);--top-forms-option-color-hover: var(--color-primary-650)}:root{--color-layout-back: var(--color-theme-100);--color-layout-header: var(--color-theme-225);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-225);--color-layout-front-2: #222F43;--color-layout-front-3: #253348;--color-layout-front-4: #29374D;--color-layout-front-5: #2C3B52;--color-layout-front-6: #2C3B52;--color-layout-front-primary-1: #202C3F;--color-layout-front-primary-2: #232f41;--color-layout-front-primary-3: #243149;--color-layout-front-primary-4: #243450;--color-layout-front-primary-5: #253758;--color-layout-front-primary-6: #253960;--color-layout-front-positive-1: #202D3D;--color-layout-front-positive-2: #25333b;--color-layout-front-positive-3: #263a3d;--color-layout-front-positive-4: #284140;--color-layout-front-positive-5: #2a4842;--color-layout-front-positive-6: #2b4f44;--color-layout-front-warning-1: #222D3C;--color-layout-front-warning-2: #2b3038;--color-layout-front-warning-3: #343437;--color-layout-front-warning-4: #3c3836;--color-layout-front-warning-5: #453b35;--color-layout-front-warning-6: #4d3f35;--color-layout-front-negative-1: #222B3D;--color-layout-front-negative-2: #2b2c3a;--color-layout-front-negative-3: #342d3b;--color-layout-front-negative-4: #3c2d3c;--color-layout-front-negative-5: #452e3d;--color-layout-front-negative-6: #4d2e3e;--color-layout-front-info-1: #212B3F;--color-layout-front-info-2: #272c41;--color-layout-front-info-3: #2b2c49;--color-layout-front-info-4: #2f2c50;--color-layout-front-info-5: #332b58;--color-layout-front-info-6: #362b60}:root{--color-summary-top-3: #5BA8DC;--color-summary-top-10: #1AAD7B;--color-summary-top-30: #4BD2B8;--color-summary-top-50: #68CA63;--color-summary-top-100: #9DAAAA;--color-summary-top-10000: #CAA549;--color-table-top-1: #435E93;--color-table-top-2: #3F5788;--color-table-top-3: #3B5381;--color-table-top-4: #357550;--color-table-top-5: #336F4E;--color-table-top-6: #326B4D;--color-table-top-7: #31684C;--color-table-top-8: #30624A;--color-table-top-9: #2F5D48;--color-table-top-10: #2D5747;--color-table-move-up-10: #0E6A44;--color-table-move-up-9: #116542;--color-table-move-up-8: #145F40;--color-table-move-up-7: #165A3E;--color-table-move-up-6: #19543C;--color-table-move-up-5: #1B4F3A;--color-table-move-up-4: #1E4938;--color-table-move-up-3: #204335;--color-table-move-up-2: #233E33;--color-table-move-up-1: #263832;--color-table-move-0: #313135;--color-table-move-down-1: #46303F;--color-table-move-down-2: #4F3040;--color-table-move-down-3: #583142;--color-table-move-down-4: #633244;--color-table-move-down-5: #6C3345;--color-table-move-down-6: #723446;--color-table-move-down-7: #793547;--color-table-move-down-8: #823649;--color-table-move-down-9: #8A364A;--color-table-move-down-10: #93374C;--color-table-down: #46303F;--color-table-down-10: #4F3040;--color-table-up: #365344;--color-table-up-10: #2C5145;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #7D7B45;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #313638;--color-snapshot-panel-gradient-1: rgba(35, 44, 77, .5);--color-snapshot-panel-gradient-2: rgba(35, 44, 77, .8);--color-snippet-title: #A2C2FA;--color-snippet-title-visited: #BC8CF2;--color-snippet-url: #007700}
|
|
1
|
+
:root{color-scheme:dark;--color-theme-0: #000000;--color-theme-50: #050815;--color-theme-75: #090A18;--color-theme-100: #0E121B;--color-theme-125: #111722;--color-theme-150: #141C29;--color-theme-175: #172130;--color-theme-200: #1B2637;--color-theme-225: #1E2B3E;--color-theme-250: #223044;--color-theme-260: #25344C;--color-theme-275: #293852;--color-theme-300: #2C3E58;--color-theme-325: #2F4360;--color-theme-350: #324867;--color-theme-360: #364D6D;--color-theme-375: #395175;--color-theme-400: #3D557B;--color-theme-410: #405A82;--color-theme-420: #435F89;--color-theme-430: #47648F;--color-theme-440: #4A6996;--color-theme-450: #4D6E9D;--color-theme-460: #5173A4;--color-theme-465: #5476AB;--color-theme-470: #5B7DAE;--color-theme-475: #6281B2;--color-theme-480: #6987B5;--color-theme-485: #708DB8;--color-theme-500: #7692BC;--color-theme-550: #7D97BF;--color-theme-575: #849DC2;--color-theme-600: #8AA2C6;--color-theme-625: #92A7C9;--color-theme-650: #98AECD;--color-theme-675: #9FB3D0;--color-theme-700: #A7B9D3;--color-theme-710: #ADBED6;--color-theme-725: #B3C3DA;--color-theme-750: #BBC9DD;--color-theme-800: #C1CEE1;--color-theme-850: #C8D3E4;--color-theme-900: #CFD9E8;--color-theme-925: #D6DEEB;--color-theme-950: #DDE3EE;--color-theme-955: #E4EAF1;--color-theme-960: #EAEFF5;--color-theme-965: #F1F4F8;--color-theme-970: #F9FAFB;--color-theme-1000: #FFFFFF;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #1F252E;--color-primary-50: #1C2736;--color-primary-100: #18293E;--color-primary-125: #142B48;--color-primary-150: #16355A;--color-primary-200: #183E6D;--color-primary-225: #184781;--color-primary-250: #185095;--color-primary-275: #175AAB;--color-primary-300: #1563C1;--color-primary-350: #136BD8;--color-primary-400: #0F74F0;--color-primary-450: #1E7FF6;--color-primary-500: #2D8AFB;--color-primary-550: #3D94FF;--color-primary-600: #52A0FF;--color-primary-650: #66ABFF;--color-primary-700: #7AB6FF;--color-primary-720: #8FC1FF;--color-primary-740: #A3CDFF;--color-primary-760: #B8D8FF;--color-primary-780: #C2DDFF;--color-primary-800: #CCE3FF;--color-primary-825: #D6E9FF;--color-primary-850: #E0EEFF;--color-primary-900: #EBF4FF;--color-primary-950: #F5F9FF;--color-positive-25: #111311;--color-positive-50: #131612;--color-positive-100: #141A14;--color-positive-125: #161E15;--color-positive-150: #1C2C1C;--color-positive-200: #223A23;--color-positive-225: #27492B;--color-positive-250: #2C5934;--color-positive-275: #2F6A3E;--color-positive-300: #327B44;--color-positive-350: #348D4B;--color-positive-400: #36A150;--color-positive-450: #36B556;--color-positive-500: #36C95B;--color-positive-550: #41D265;--color-positive-600: #4DDB73;--color-positive-650: #5AE27C;--color-positive-700: #6CE58A;--color-positive-720: #7DE898;--color-positive-740: #8EEBA5;--color-positive-760: #A0EEB3;--color-positive-780: #B1F1C1;--color-positive-800: #C2F4CF;--color-positive-825: #D8F8E0;--color-positive-850: #E5FAEA;--color-positive-900: #EEFCF1;--color-positive-950: #F6FDF8;--color-warning-25: #3C1F1F;--color-warning-50: #39221B;--color-warning-100: #421B1A;--color-warning-125: #4C2015;--color-warning-150: #5E2517;--color-warning-200: #71321E;--color-warning-225: #7F3D19;--color-warning-250: #9A511A;--color-warning-275: #AF6420;--color-warning-300: #C56D1C;--color-warning-350: #DD780C;--color-warning-400: #F08214;--color-warning-450: #F48B1B;--color-warning-500: #FB9632;--color-warning-550: #FFA042;--color-warning-600: #FFAB57;--color-warning-650: #FFB56B;--color-warning-700: #FFBF80;--color-warning-720: #FFCB94;--color-warning-740: #FFD7A8;--color-warning-760: #FFDEBF;--color-warning-780: #FFE3C7;--color-warning-800: #FFE8CF;--color-warning-825: #FFEDDB;--color-warning-850: #FFF3E6;--color-warning-900: #FFF7F0;--color-warning-950: #FFFDFA;--color-negative-25: #2E2229;--color-negative-50: #371F2B;--color-negative-100: #402030;--color-negative-125: #4A1733;--color-negative-150: #5B193A;--color-negative-200: #6E1C2F;--color-negative-225: #8A1C34;--color-negative-250: #9B1D32;--color-negative-275: #AB1A2F;--color-negative-300: #C31A30;--color-negative-350: #D81534;--color-negative-400: #EB1938;--color-negative-450: #F12745;--color-negative-500: #F73652;--color-negative-550: #FF4262;--color-negative-600: #FF576F;--color-negative-650: #FF6B7B;--color-negative-700: #FF8092;--color-negative-720: #FF949F;--color-negative-740: #FFA8B5;--color-negative-760: #FFBFC6;--color-negative-780: #FFC7CF;--color-negative-800: #FFD1D8;--color-negative-825: #FFDDE1;--color-negative-850: #FFE5E9;--color-negative-900: #FFF0F2;--color-negative-950: #FFFAFB;--color-info-25: #1E1D2B;--color-info-50: #1C1A32;--color-info-100: #1A173B;--color-info-125: #181344;--color-info-150: #201556;--color-info-200: #2A1769;--color-info-225: #36187C;--color-info-250: #441891;--color-info-275: #5517A6;--color-info-300: #5E15BC;--color-info-350: #6612D3;--color-info-400: #6F0FEB;--color-info-450: #7919F5;--color-info-500: #8428FB;--color-info-550: #8F38FF;--color-info-600: #9A4DFF;--color-info-650: #A561FF;--color-info-700: #B175FF;--color-info-720: #BC8AFF;--color-info-740: #C89EFF;--color-info-760: #D4B2FF;--color-info-780: #D9BDFF;--color-info-800: #DFC7FF;--color-info-825: #E5D1FF;--color-info-850: #EBDBFF;--color-info-900: #F1E5FF;--color-info-950: #F6F0FF;--color-layer-1: rgba(129, 148, 177, .08);--color-layer-2: rgba(129, 148, 177, .14);--color-layer-3: rgba(129, 148, 177, .18);--color-layer-4: rgba(129, 148, 177, .24);--color-layer-primary-1: rgba(45, 110, 251, .14);--color-layer-primary-2: rgba(45, 110, 251, .2);--color-layer-primary-3: rgba(45, 110, 251, .3);--color-layer-primary-4: rgba(45, 110, 251, .4);--color-layer-positive-1: rgba(54, 181, 86, .14);--color-layer-positive-2: rgba(54, 181, 86, .2);--color-layer-positive-3: rgba(54, 181, 86, .3);--color-layer-positive-4: rgba(54, 181, 86, .4);--color-layer-warning-1: rgba(255, 160, 66, .14);--color-layer-warning-2: rgba(255, 160, 66, .2);--color-layer-warning-3: rgba(255, 160, 66, .3);--color-layer-warning-4: rgba(255, 160, 66, .4);--color-layer-negative-1: rgba(247, 54, 82, .14);--color-layer-negative-2: rgba(247, 54, 82, .2);--color-layer-negative-3: rgba(247, 54, 82, .3);--color-layer-negative-4: rgba(247, 54, 82, .4);--color-layer-info-1: rgba(165, 97, 255, .14);--color-layer-info-2: rgba(165, 97, 255, .2);--color-layer-info-3: rgba(165, 97, 255, .3);--color-layer-info-4: rgba(165, 97, 255, .4);--top-shadow-xs: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .08);--top-shadow-s: 0px 0px 3px rgba(0, 0, 0, .11), 0px 5px 25px rgba(0, 0, 0, .17);--top-shadow: 0px 0px 4px rgba(0, 0, 0, .14), 0px 4px 32px rgba(0, 0, 0, .2);--top-shadow-m: 0px 0px 4px 0px rgba(0, 0, 0, .14), 0px 4px 32px 0px rgba(0, 0, 0, .2);--top-shadow-b: 0px 0px 4px rgba(0, 0, 0, .15), 0px 18px 32px rgba(0, 0, 0, .34);--top-shadow-darken-1: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .12);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .1);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: var(--color-primary-700);--color-brand-2: var(--color-primary-740);--color-brand-3: var(--color-primary-800);--color-bg-shading-1: var(--color-theme-200);--color-bg-shading-2: var(--color-theme-175);--color-bg-shading-3: var(--color-theme-150);--color-bg-shading-4: var(--color-theme-125);--color-bg-shading-5: var(--color-theme-100);--color-bg-shading-6: var(--color-theme-50);--color-bg-lightning-1: var(--color-theme-260);--color-bg-primary-1: var(--color-primary-550);--color-bg-primary-2: var(--color-primary-650);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-450);--color-bg-positive-2: var(--color-positive-600);--color-bg-positive-3: var(--color-positive-740);--color-bg-warning-1: var(--color-warning-450);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-700);--color-bg-negative-1: var(--color-negative-550);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-650);--color-bg-info-2: var(--color-info-720);--color-bg-info-3: var(--color-info-780);--top-panel-background-color: rgba(17, 23, 34, .8);--color-text-1: var(--color-theme-970);--color-text-2: var(--color-theme-750);--color-text-3: var(--color-theme-500);--color-text-4: var(--color-theme-450);--color-text-1-inverse: var(--color-theme-100);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-650);--color-text-positive: var(--color-positive-450);--color-text-positive-alt: var(--color-positive-600);--color-text-warning: var(--color-warning-450);--color-text-warning-alt: var(--color-warning-650);--color-text-negative: var(--color-negative-550);--color-text-negative-alt: var(--color-negative-650);--color-text-info: var(--color-info-650);--color-text-info-alt: var(--color-info-740);--color-line-1: var(--color-theme-350);--color-line-2: var(--color-theme-400);--color-line-3: var(--color-theme-485);--color-line-4: var(--color-theme-650);--color-line-1-opacity: rgba(193, 203, 215, .1);--color-line-2-opacity: rgba(193, 203, 215, .15);--color-line-3-opacity: rgba(193, 203, 215, .27);--color-line-primary-1: var(--color-primary-450);--color-line-primary-2: var(--color-primary-600);--color-line-primary-3: var(--color-primary-740);--color-line-primary-1-opacity: rgba(122, 164, 255, .14);--color-line-primary-2-opacity: rgba(122, 164, 255, .28);--color-line-primary-3-opacity: rgba(122, 164, 255, .38);--color-line-positive-1: var(--color-positive-450);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-740);--color-line-positive-1-opacity: rgba(164, 233, 171, .14);--color-line-positive-2-opacity: rgba(164, 233, 171, .28);--color-line-positive-3-opacity: rgba(164, 233, 171, .38);--color-line-warning-1: var(--color-warning-450);--color-line-warning-2: var(--color-warning-600);--color-line-warning-3: var(--color-warning-700);--color-line-warning-1-opacity: rgba(255, 191, 128, .14);--color-line-warning-2-opacity: rgba(255, 191, 128, .28);--color-line-warning-3-opacity: rgba(255, 191, 128, .38);--color-line-negative-1: var(--color-negative-550);--color-line-negative-2: var(--color-negative-650);--color-line-negative-3: var(--color-negative-720);--color-line-negative-1-opacity: rgba(239, 135, 148, .14);--color-line-negative-2-opacity: rgba(239, 135, 148, .28);--color-line-negative-3-opacity: rgba(239, 135, 148, .38);--color-line-info-1: var(--color-info-650);--color-line-info-2: var(--color-info-720);--color-line-info-3: var(--color-info-780);--color-line-info-1-opacity: rgba(168, 120, 247, .14);--color-line-info-2-opacity: rgba(168, 120, 247, .28);--color-line-info-3-opacity: rgba(168, 120, 247, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-300);--scroll-thumb-color-hover: var(--color-theme-450);--scroll-thumb-color-active: var(--color-theme-550);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-550);--top-forms-option-color-hover: var(--color-primary-650)}:root{--color-layout-back: var(--color-theme-100);--color-layout-header: var(--color-theme-225);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-225);--color-layout-front-2: #222F43;--color-layout-front-3: #253348;--color-layout-front-4: #29374D;--color-layout-front-5: #2C3B52;--color-layout-front-6: #2C3B52;--color-layout-front-primary-1: #202C3F;--color-layout-front-primary-2: #232f41;--color-layout-front-primary-3: #243149;--color-layout-front-primary-4: #243450;--color-layout-front-primary-5: #253758;--color-layout-front-primary-6: #253960;--color-layout-front-positive-1: #202D3D;--color-layout-front-positive-2: #25333b;--color-layout-front-positive-3: #263a3d;--color-layout-front-positive-4: #284140;--color-layout-front-positive-5: #2a4842;--color-layout-front-positive-6: #2b4f44;--color-layout-front-warning-1: #222D3C;--color-layout-front-warning-2: #2b3038;--color-layout-front-warning-3: #343437;--color-layout-front-warning-4: #3c3836;--color-layout-front-warning-5: #453b35;--color-layout-front-warning-6: #4d3f35;--color-layout-front-negative-1: #222B3D;--color-layout-front-negative-2: #2b2c3a;--color-layout-front-negative-3: #342d3b;--color-layout-front-negative-4: #3c2d3c;--color-layout-front-negative-5: #452e3d;--color-layout-front-negative-6: #4d2e3e;--color-layout-front-info-1: #212B3F;--color-layout-front-info-2: #272c41;--color-layout-front-info-3: #2b2c49;--color-layout-front-info-4: #2f2c50;--color-layout-front-info-5: #332b58;--color-layout-front-info-6: #362b60}:root{--color-summary-top-3: #5BA8DC;--color-summary-top-10: #1AAD7B;--color-summary-top-30: #4BD2B8;--color-summary-top-50: #68CA63;--color-summary-top-100: #9DAAAA;--color-summary-top-10000: #CAA549;--color-table-top-1: #435E93;--color-table-top-2: #3F5788;--color-table-top-3: #3B5381;--color-table-top-4: #357550;--color-table-top-5: #336F4E;--color-table-top-6: #326B4D;--color-table-top-7: #31684C;--color-table-top-8: #30624A;--color-table-top-9: #2F5D48;--color-table-top-10: #2D5747;--color-table-move-up-10: #0E6A44;--color-table-move-up-9: #116542;--color-table-move-up-8: #145F40;--color-table-move-up-7: #165A3E;--color-table-move-up-6: #19543C;--color-table-move-up-5: #1B4F3A;--color-table-move-up-4: #1E4938;--color-table-move-up-3: #204335;--color-table-move-up-2: #233E33;--color-table-move-up-1: #263832;--color-table-move-0: #313135;--color-table-move-down-1: #46303F;--color-table-move-down-2: #4F3040;--color-table-move-down-3: #583142;--color-table-move-down-4: #633244;--color-table-move-down-5: #6C3345;--color-table-move-down-6: #723446;--color-table-move-down-7: #793547;--color-table-move-down-8: #823649;--color-table-move-down-9: #8A364A;--color-table-move-down-10: #93374C;--color-table-down: #46303F;--color-table-down-10: #4F3040;--color-table-up: #365344;--color-table-up-10: #2C5145;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #7D7B45;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #313638;--color-snapshot-panel-gradient-1: rgba(35, 44, 77, .5);--color-snapshot-panel-gradient-2: rgba(35, 44, 77, .8);--color-snippet-title: #A2C2FA;--color-snippet-title-visited: #BC8CF2;--color-snippet-url: #007700}
|
package/assets/themes/light.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{color-scheme:light;--color-theme-0: #FFFFFF;--color-theme-50: #F9FAFB;--color-theme-75: #F6F7F9;--color-theme-100: #F3F4F6;--color-theme-125: #EDEFF2;--color-theme-150: #E7EAEE;--color-theme-175: #E2E5E9;--color-theme-200: #DCE0E5;--color-theme-225: #D6DBE1;--color-theme-250: #D0D5DC;--color-theme-260: #CAD0D8;--color-theme-275: #C4CBD4;--color-theme-300: #BEC5CF;--color-theme-325: #B8C0CB;--color-theme-350: #B3BBC7;--color-theme-360: #ADB5C2;--color-theme-375: #A7B0BE;--color-theme-400: #A1ABBA;--color-theme-410: #9BA6B5;--color-theme-420: #95A0B1;--color-theme-430: #8F9BAD;--color-theme-440: #8A96A8;--color-theme-450: #8491A4;--color-theme-460: #7E8BA0;--color-theme-465: #78869C;--color-theme-470: #728197;--color-theme-475: #6C7B93;--color-theme-480: #68778D;--color-theme-485: #637287;--color-theme-500: #5F6D81;--color-theme-550: #5B687B;--color-theme-575: #576375;--color-theme-600: #525E70;--color-theme-625: #4E596A;--color-theme-650: #4A5564;--color-theme-675: #454F5E;--color-theme-700: #414A58;--color-theme-710: #3D4552;--color-theme-725: #38404C;--color-theme-750: #343B47;--color-theme-800: #303641;--color-theme-850: #2B323B;--color-theme-900: #272D35;--color-theme-925: #23282F;--color-theme-950: #1E2329;--color-theme-955: #1A1E23;--color-theme-960: #16191D;--color-theme-965: #111318;--color-theme-970: #0D0F12;--color-theme-1000: #000000;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #F5F9FF;--color-primary-50: #EBF4FF;--color-primary-100: #D6E9FF;--color-primary-125: #CCE3FF;--color-primary-150: #C2DDFF;--color-primary-200: #B8D8FF;--color-primary-225: #A3CDFF;--color-primary-250: #8FC1FF;--color-primary-275: #7AB6FF;--color-primary-300: #66ABFF;--color-primary-350: #52A0FF;--color-primary-400: #3D94FF;--color-primary-450: #2D8AFB;--color-primary-500: #1E7FF6;--color-primary-550: #0F74F0;--color-primary-600: #136BD8;--color-primary-650: #1563C1;--color-primary-700: #175AAB;--color-primary-720: #185095;--color-primary-740: #184781;--color-primary-760: #183E6D;--color-primary-780: #16355A;--color-primary-800: #142B48;--color-primary-825: #18293E;--color-primary-850: #1C2736;--color-primary-900: #1C2736;--color-primary-950: #1F252E;--color-positive-25: #F6FDF8;--color-positive-50: #EEFCF1;--color-positive-100: #E5FAEA;--color-positive-125: #D8F8E0;--color-positive-150: #C2F4CF;--color-positive-200: #B1F1C1;--color-positive-225: #A0EEB3;--color-positive-250: #8EEBA5;--color-positive-275: #7DE898;--color-positive-300: #6CE58A;--color-positive-350: #5AE27C;--color-positive-400: #4DDB73;--color-positive-450: #41D265;--color-positive-500: #36C95B;--color-positive-550: #36B556;--color-positive-600: #36A150;--color-positive-650: #348D4B;--color-positive-700: #327B44;--color-positive-720: #2F6A3E;--color-positive-740: #2C5934;--color-positive-760: #27492B;--color-positive-780: #223A23;--color-positive-800: #1C2C1C;--color-positive-825: #161E15;--color-positive-850: #141A14;--color-positive-900: #131612;--color-positive-950: #111311;--color-warning-25: #FFFDFA;--color-warning-50: #FFF7F0;--color-warning-100: #FFF3E6;--color-warning-125: #FFEDDB;--color-warning-150: #FFE8CF;--color-warning-200: #FFE3C7;--color-warning-225: #FFDEBF;--color-warning-250: #FFD7A8;--color-warning-275: #FFCB94;--color-warning-300: #FFBF80;--color-warning-350: #FFB56B;--color-warning-400: #FFAB57;--color-warning-450: #FFA042;--color-warning-500: #FB9632;--color-warning-550: #F48B1B;--color-warning-600: #F08214;--color-warning-650: #DD780C;--color-warning-700: #C56D1C;--color-warning-720: #AF6420;--color-warning-740: #9A511A;--color-warning-760: #7F3D19;--color-warning-780: #71321E;--color-warning-800: #5E2517;--color-warning-825: #4C2015;--color-warning-850: #421B1A;--color-warning-900: #391F1E;--color-warning-950: #312121;--color-negative-25: #FFFAFA;--color-negative-50: #FFF1F0;--color-negative-100: #FFE6E5;--color-negative-125: #FFDCDB;--color-negative-150: #FFD3D1;--color-negative-200: #FFC9C7;--color-negative-225: #FFBFBD;--color-negative-250: #FFABA8;--color-negative-275: #FF9894;--color-negative-300: #FF8480;--color-negative-350: #FF706B;--color-negative-400: #FF5D57;--color-negative-450: #FF4842;--color-negative-500: #F73C36;--color-negative-550: #F12E27;--color-negative-600: #EB2019;--color-negative-650: #D81E18;--color-negative-700: #C1201A;--color-negative-720: #AB211C;--color-negative-740: #96211D;--color-negative-760: #821F1C;--color-negative-780: #6E1F1C;--color-negative-800: #5B1C1A;--color-negative-825: #4A1917;--color-negative-850: #401D1C;--color-negative-900: #37201F;--color-negative-950: #2F2222;--color-info-25: #FCFAFF;--color-info-50: #F9F5FF;--color-info-100: #F6F0FF;--color-info-125: #F1E5FF;--color-info-150: #EBDBFF;--color-info-200: #E5D1FF;--color-info-225: #DFC7FF;--color-info-250: #D9BDFF;--color-info-275: #D4B2FF;--color-info-300: #C89EFF;--color-info-350: #BC8AFF;--color-info-400: #B175FF;--color-info-450: #A561FF;--color-info-500: #9A4DFF;--color-info-550: #8F38FF;--color-info-600: #8428FB;--color-info-650: #7919F5;--color-info-700: #6F0FEB;--color-info-720: #6612D3;--color-info-740: #5E15BC;--color-info-760: #5517A6;--color-info-780: #441891;--color-info-800: #36187C;--color-info-825: #2A1769;--color-info-850: #201556;--color-info-900: #181344;--color-info-950: #1E1D2B;--color-layer-1: rgba(97, 121, 158, .1);--color-layer-2: rgba(97, 121, 158, .14);--color-layer-3: rgba(97, 121, 158, .18);--color-layer-4: rgba(97, 121, 158, .24);--color-layer-primary-1: rgba(45, 110, 251, .08);--color-layer-primary-2: rgba(45, 110, 251, .12);--color-layer-primary-3: rgba(45, 110, 251, .18);--color-layer-primary-4: rgba(45, 110, 251, .24);--color-layer-positive-1: rgba(54, 181, 86, .08);--color-layer-positive-2: rgba(54, 181, 86, .12);--color-layer-positive-3: rgba(54, 181, 86, .18);--color-layer-positive-4: rgba(54, 181, 86, .24);--color-layer-warning-1: rgba(240, 130, 20, .08);--color-layer-warning-2: rgba(240, 130, 20, .12);--color-layer-warning-3: rgba(240, 130, 20, .18);--color-layer-warning-4: rgba(240, 130, 20, .24);--color-layer-negative-1: rgba(241, 46, 39, .08);--color-layer-negative-2: rgba(241, 46, 39, .12);--color-layer-negative-3: rgba(241, 46, 39, .18);--color-layer-negative-4: rgba(241, 46, 39, .24);--color-layer-info-1: rgba(165, 97, 255, .08);--color-layer-info-2: rgba(165, 97, 255, .12);--color-layer-info-3: rgba(165, 97, 255, .18);--color-layer-info-4: rgba(165, 97, 255, .24);--top-shadow-xs: 0px 0px 3px rgba(112, 144, 176, .07), 0px 5px 25px rgba(112, 144, 176, .06);--top-shadow-s: 0px 0px 3px rgba(112, 144, 176, .07), 0px 5px 25px rgba(112, 144, 176, .12);--top-shadow: 0px 0px 4px rgba(4, 9, 84, .08), 0px 4px 32px rgba(4, 9, 84, .1);--top-shadow-m: 0px 0px 4px 0px rgba(4, 9, 84, .08), 0px 4px 32px 0px rgba(4, 9, 84, .1);--top-shadow-b: 0px 0px 4px rgba(4, 36, 84, .08), 0px 18px 32px rgba(4, 25, 84, .18);--top-shadow-darken-1: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .09);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .18);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: var(--color-primary-500);--color-brand-2: var(--color-primary-600);--color-brand-3: var(--color-primary-720);--color-bg-shading-1: var(--color-theme-50);--color-bg-shading-2: var(--color-theme-100);--color-bg-shading-3: var(--color-theme-125);--color-bg-shading-4: var(--color-theme-150);--color-bg-shading-5: var(--color-theme-175);--color-bg-shading-6: var(--color-theme-200);--color-bg-lightning-1: var(--color-theme-0);--color-bg-inverted-1: var(--color-theme-950);--color-bg-inverted-2: var(--color-theme-900);--color-bg-inverted-3: var(--color-theme-800);--color-bg-inverted-4: var(--color-theme-750);--color-bg-inverted-5: var(--color-theme-725);--color-bg-inverted-6: var(--color-theme-700);--color-bg-inverted-7: var(--color-theme-675);--color-bg-inverted-8: var(--color-theme-650);--color-bg-inverted-9: var(--color-theme-625);--color-bg-inverted-10: var(--color-theme-600);--color-bg-primary-1: var(--color-primary-500);--color-bg-primary-2: var(--color-primary-600);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-500);--color-bg-positive-2: var(--color-positive-700);--color-bg-positive-3: var(--color-positive-760);--color-bg-warning-1: var(--color-warning-500);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-720);--color-bg-negative-1: var(--color-negative-500);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-500);--color-bg-info-2: var(--color-info-650);--color-bg-info-3: var(--color-info-720);--top-panel-background-color: rgba(255, 255, 255, .8);--color-text-1: var(--color-theme-850);--color-text-2: var(--color-theme-600);--color-text-3: var(--color-theme-450);--color-text-4: var(--color-theme-300);--color-text-1-inverse: var(--color-theme-0);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-700);--color-text-positive: var(--color-positive-550);--color-text-positive-alt: var(--color-positive-700);--color-text-warning: var(--color-warning-550);--color-text-warning-alt: var(--color-warning-700);--color-text-negative: var(--color-negative-550);--color-text-negative-alt: var(--color-negative-700);--color-text-info: var(--color-info-550);--color-text-info-alt: var(--color-info-700);--color-line-1: var(--color-theme-200);--color-line-2: var(--color-theme-250);--color-line-3: var(--color-theme-375);--color-line-4: var(--color-theme-470);--color-line-1-opacity: rgba(14, 65, 142, .1);--color-line-2-opacity: rgba(14, 65, 142, .19);--color-line-3-opacity: rgba(14, 65, 142, .39);--color-line-primary-1: var(--color-primary-500);--color-line-primary-2: var(--color-primary-650);--color-line-primary-3: var(--color-primary-720);--color-line-primary-1-opacity: rgba(15, 86, 240, .14);--color-line-primary-2-opacity: rgba(15, 86, 240, .28);--color-line-primary-3-opacity: rgba(15, 86, 240, .38);--color-line-positive-1: var(--color-positive-550);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-720);--color-line-positive-1-opacity: rgba(54, 161, 80, .14);--color-line-positive-2-opacity: rgba(54, 161, 80, .28);--color-line-positive-3-opacity: rgba(54, 161, 80, .38);--color-line-warning-1: var(--color-warning-600);--color-line-warning-2: var(--color-warning-700);--color-line-warning-3: var(--color-warning-740);--color-line-warning-1-opacity: rgba(251, 150, 50, .14);--color-line-warning-2-opacity: rgba(251, 150, 50, .28);--color-line-warning-3-opacity: rgba(251, 150, 50, .38);--color-line-negative-1: var(--color-negative-550);--color-line-negative-2: var(--color-negative-700);--color-line-negative-3: var(--color-negative-740);--color-line-negative-1-opacity: rgba(247, 60, 54, .14);--color-line-negative-2-opacity: rgba(247, 60, 54, .28);--color-line-negative-3-opacity: rgba(247, 60, 54, .38);--color-line-info-1: var(--color-info-500);--color-line-info-2: var(--color-info-550);--color-line-info-3: var(--color-info-600);--color-line-info-1-opacity: rgba(122, 47, 242, .14);--color-line-info-2-opacity: rgba(122, 47, 242, .28);--color-line-info-3-opacity: rgba(122, 47, 242, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-300);--scroll-thumb-color-hover: var(--color-theme-450);--scroll-thumb-color-active: var(--color-theme-550);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-500);--top-forms-option-color-hover: var(--color-primary-600)}:root{--color-layout-back: var(--color-theme-200);--color-layout-header: var(--color-theme-0);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-0);--color-layout-front-2: #FCFCFD;--color-layout-front-3: #F6F6F8;--color-layout-front-4: #EBEDF1;--color-layout-front-5: #E2E5EA;--color-layout-front-6: #D8DCE2;--color-layout-front-primary-1: #FFFFFF;--color-layout-front-primary-2: #F7F9FF;--color-layout-front-primary-3: #EEF3FF;--color-layout-front-primary-4: #E6EEFF;--color-layout-front-primary-5: #DDE8FE;--color-layout-front-primary-6: #D5E2FE;--color-layout-front-positive-1: #FFFFFF;--color-layout-front-positive-2: #F8FEF9;--color-layout-front-positive-3: #F1FCF4;--color-layout-front-positive-4: #EAFBEF;--color-layout-front-positive-5: #E3F9E8;--color-layout-front-positive-6: #DBF8E3;--color-layout-front-warning-1: #FFFFFF;--color-layout-front-warning-2: #FFFBF7;--color-layout-front-warning-3: #FFF7F0;--color-layout-front-warning-4: #FFF4E8;--color-layout-front-warning-5: #FFF0E1;--color-layout-front-warning-6: #FFECDA;--color-layout-front-negative-1: #FFFFFF;--color-layout-front-negative-2: #FFF7F8;--color-layout-front-negative-3: #FEF0F1;--color-layout-front-negative-4: #FEE7E9;--color-layout-front-negative-5: #FEDFE3;--color-layout-front-negative-6: #FDD7DC;--color-layout-front-info-1: #FFFFFF;--color-layout-front-info-2: #FAF6FF;--color-layout-front-info-3: #F5EEFF;--color-layout-front-info-4: #F0E5FF;--color-layout-front-info-5: #EBDBFE;--color-layout-front-info-6: #E6D4FE}:root{--color-summary-top-3: #3198DD;--color-summary-top-10: #21936C;--color-summary-top-30: #1ABC9C;--color-summary-top-50: #94DA90;--color-summary-top-100: #BCC8C8;--color-summary-top-10000: #FCC53B;--color-table-top-1: #B3D2FF;--color-table-top-2: #CCE0FF;--color-table-top-3: #CCE0FF;--color-table-top-4: #8AF3B7;--color-table-top-5: #98F5C1;--color-table-top-6: #A2F7C8;--color-table-top-7: #ACF9CE;--color-table-top-8: #B6FBD5;--color-table-top-9: #BFFDDB;--color-table-top-10: #CCFFE4;--color-table-move-up-10: #8AF3B7;--color-table-move-up-9: #8AF3B7;--color-table-move-up-8: #A2F7C8;--color-table-move-up-7: #A2F7C8;--color-table-move-up-6: #B6FBD5;--color-table-move-up-5: #B6FBD5;--color-table-move-up-4: #BFFDDB;--color-table-move-up-3: #BFFDDB;--color-table-move-up-2: #CCFFE4;--color-table-move-up-1: #CCFFE4;--color-table-move-0: #FCFEFD;--color-table-move-down-1: #FFF1F0;--color-table-move-down-2: #FFF1F0;--color-table-move-down-3: #FFF1F0;--color-table-move-down-4: #FFF1F0;--color-table-move-down-5: #FFE7E6;--color-table-move-down-6: #FFE7E6;--color-table-move-down-7: #FFE7E6;--color-table-move-down-8: #FFD5D4;--color-table-move-down-9: #FFD5D4;--color-table-move-down-10: #FFD5D4;--color-table-down: #FFF1F0;--color-table-up: #CCFFE4;--color-table-down-10: #FFE7E6;--color-table-up-10: #BFFDDB;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #F6F2A0;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #FFF6C6;--color-snapshot-panel-gradient-1: rgba(255, 255, 255, .5);--color-snapshot-panel-gradient-2: rgba(255, 255, 255, .8);--color-snippet-title: #1A0DAB;--color-snippet-title-visited: #660099;--color-snippet-url: #007700}
|
|
1
|
+
:root{color-scheme:light;--color-theme-0: #FFFFFF;--color-theme-50: #F9FAFB;--color-theme-75: #F6F7F9;--color-theme-100: #F3F4F6;--color-theme-125: #EDEFF2;--color-theme-150: #E7EAEE;--color-theme-175: #E2E5E9;--color-theme-200: #DCE0E5;--color-theme-225: #D6DBE1;--color-theme-250: #D0D5DC;--color-theme-260: #CAD0D8;--color-theme-275: #C4CBD4;--color-theme-300: #BEC5CF;--color-theme-325: #B8C0CB;--color-theme-350: #B3BBC7;--color-theme-360: #ADB5C2;--color-theme-375: #A7B0BE;--color-theme-400: #A1ABBA;--color-theme-410: #9BA6B5;--color-theme-420: #95A0B1;--color-theme-430: #8F9BAD;--color-theme-440: #8A96A8;--color-theme-450: #8491A4;--color-theme-460: #7E8BA0;--color-theme-465: #78869C;--color-theme-470: #728197;--color-theme-475: #6C7B93;--color-theme-480: #68778D;--color-theme-485: #637287;--color-theme-500: #5F6D81;--color-theme-550: #5B687B;--color-theme-575: #576375;--color-theme-600: #525E70;--color-theme-625: #4E596A;--color-theme-650: #4A5564;--color-theme-675: #454F5E;--color-theme-700: #414A58;--color-theme-710: #3D4552;--color-theme-725: #38404C;--color-theme-750: #343B47;--color-theme-800: #303641;--color-theme-850: #2B323B;--color-theme-900: #272D35;--color-theme-925: #23282F;--color-theme-950: #1E2329;--color-theme-955: #1A1E23;--color-theme-960: #16191D;--color-theme-965: #111318;--color-theme-970: #0D0F12;--color-theme-1000: #000000;--color-white: rgba(255, 255, 255, 1);--color-black: rgba(0, 0, 0, 1);--color-primary-25: #F5F9FF;--color-primary-50: #EBF4FF;--color-primary-100: #D6E9FF;--color-primary-125: #CCE3FF;--color-primary-150: #C2DDFF;--color-primary-200: #B8D8FF;--color-primary-225: #A3CDFF;--color-primary-250: #8FC1FF;--color-primary-275: #7AB6FF;--color-primary-300: #66ABFF;--color-primary-350: #52A0FF;--color-primary-400: #3D94FF;--color-primary-450: #2D8AFB;--color-primary-500: #1E7FF6;--color-primary-550: #0F74F0;--color-primary-600: #136BD8;--color-primary-650: #1563C1;--color-primary-700: #175AAB;--color-primary-720: #185095;--color-primary-740: #184781;--color-primary-760: #183E6D;--color-primary-780: #16355A;--color-primary-800: #142B48;--color-primary-825: #18293E;--color-primary-850: #1C2736;--color-primary-900: #1C2736;--color-primary-950: #1F252E;--color-positive-25: #F6FDF8;--color-positive-50: #EEFCF1;--color-positive-100: #E5FAEA;--color-positive-125: #D8F8E0;--color-positive-150: #C2F4CF;--color-positive-200: #B1F1C1;--color-positive-225: #A0EEB3;--color-positive-250: #8EEBA5;--color-positive-275: #7DE898;--color-positive-300: #6CE58A;--color-positive-350: #5AE27C;--color-positive-400: #4DDB73;--color-positive-450: #41D265;--color-positive-500: #36C95B;--color-positive-550: #36B556;--color-positive-600: #36A150;--color-positive-650: #348D4B;--color-positive-700: #327B44;--color-positive-720: #2F6A3E;--color-positive-740: #2C5934;--color-positive-760: #27492B;--color-positive-780: #223A23;--color-positive-800: #1C2C1C;--color-positive-825: #161E15;--color-positive-850: #141A14;--color-positive-900: #131612;--color-positive-950: #111311;--color-warning-25: #FFFDFA;--color-warning-50: #FFF7F0;--color-warning-100: #FFF3E6;--color-warning-125: #FFEDDB;--color-warning-150: #FFE8CF;--color-warning-200: #FFE3C7;--color-warning-225: #FFDEBF;--color-warning-250: #FFD7A8;--color-warning-275: #FFCB94;--color-warning-300: #FFBF80;--color-warning-350: #FFB56B;--color-warning-400: #FFAB57;--color-warning-450: #FFA042;--color-warning-500: #FB9632;--color-warning-550: #F48B1B;--color-warning-600: #F08214;--color-warning-650: #DD780C;--color-warning-700: #C56D1C;--color-warning-720: #AF6420;--color-warning-740: #9A511A;--color-warning-760: #7F3D19;--color-warning-780: #71321E;--color-warning-800: #5E2517;--color-warning-825: #4C2015;--color-warning-850: #421B1A;--color-warning-900: #391F1E;--color-warning-950: #312121;--color-negative-25: #FFFAFA;--color-negative-50: #FFF1F0;--color-negative-100: #FFE6E5;--color-negative-125: #FFDCDB;--color-negative-150: #FFD3D1;--color-negative-200: #FFC9C7;--color-negative-225: #FFBFBD;--color-negative-250: #FFABA8;--color-negative-275: #FF9894;--color-negative-300: #FF8480;--color-negative-350: #FF706B;--color-negative-400: #FF5D57;--color-negative-450: #FF4842;--color-negative-500: #F73C36;--color-negative-550: #F12E27;--color-negative-600: #EB2019;--color-negative-650: #D81E18;--color-negative-700: #C1201A;--color-negative-720: #AB211C;--color-negative-740: #96211D;--color-negative-760: #821F1C;--color-negative-780: #6E1F1C;--color-negative-800: #5B1C1A;--color-negative-825: #4A1917;--color-negative-850: #401D1C;--color-negative-900: #37201F;--color-negative-950: #2F2222;--color-info-25: #FCFAFF;--color-info-50: #F9F5FF;--color-info-100: #F6F0FF;--color-info-125: #F1E5FF;--color-info-150: #EBDBFF;--color-info-200: #E5D1FF;--color-info-225: #DFC7FF;--color-info-250: #D9BDFF;--color-info-275: #D4B2FF;--color-info-300: #C89EFF;--color-info-350: #BC8AFF;--color-info-400: #B175FF;--color-info-450: #A561FF;--color-info-500: #9A4DFF;--color-info-550: #8F38FF;--color-info-600: #8428FB;--color-info-650: #7919F5;--color-info-700: #6F0FEB;--color-info-720: #6612D3;--color-info-740: #5E15BC;--color-info-760: #5517A6;--color-info-780: #441891;--color-info-800: #36187C;--color-info-825: #2A1769;--color-info-850: #201556;--color-info-900: #181344;--color-info-950: #1E1D2B;--color-layer-1: rgba(97, 121, 158, .1);--color-layer-2: rgba(97, 121, 158, .14);--color-layer-3: rgba(97, 121, 158, .18);--color-layer-4: rgba(97, 121, 158, .24);--color-layer-primary-1: rgba(45, 110, 251, .08);--color-layer-primary-2: rgba(45, 110, 251, .12);--color-layer-primary-3: rgba(45, 110, 251, .18);--color-layer-primary-4: rgba(45, 110, 251, .24);--color-layer-positive-1: rgba(54, 181, 86, .08);--color-layer-positive-2: rgba(54, 181, 86, .12);--color-layer-positive-3: rgba(54, 181, 86, .18);--color-layer-positive-4: rgba(54, 181, 86, .24);--color-layer-warning-1: rgba(240, 130, 20, .08);--color-layer-warning-2: rgba(240, 130, 20, .12);--color-layer-warning-3: rgba(240, 130, 20, .18);--color-layer-warning-4: rgba(240, 130, 20, .24);--color-layer-negative-1: rgba(241, 46, 39, .08);--color-layer-negative-2: rgba(241, 46, 39, .12);--color-layer-negative-3: rgba(241, 46, 39, .18);--color-layer-negative-4: rgba(241, 46, 39, .24);--color-layer-info-1: rgba(165, 97, 255, .08);--color-layer-info-2: rgba(165, 97, 255, .12);--color-layer-info-3: rgba(165, 97, 255, .18);--color-layer-info-4: rgba(165, 97, 255, .24);--top-shadow-xs: 0px 0px 3px rgba(112, 144, 176, .07), 0px 5px 25px rgba(112, 144, 176, .06);--top-shadow-s: 0px 0px 3px rgba(112, 144, 176, .07), 0px 5px 25px rgba(112, 144, 176, .12);--top-shadow: 0px 0px 4px rgba(4, 9, 84, .08), 0px 4px 32px rgba(4, 9, 84, .1);--top-shadow-m: 0px 0px 4px 0px rgba(4, 9, 84, .08), 0px 4px 32px 0px rgba(4, 9, 84, .1);--top-shadow-b: 0px 0px 4px rgba(4, 36, 84, .08), 0px 18px 32px rgba(4, 25, 84, .18);--top-shadow-darken-1: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .03);--top-shadow-darken-2: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .09);--top-shadow-darken-3: inset 1000px 1000px 1000px 1000px rgba(0, 0, 0, .18);--color-bg-preloader: rgba(255, 255, 255, .01)}:root{--color-brand-1: var(--color-primary-500);--color-brand-2: var(--color-primary-600);--color-brand-3: var(--color-primary-720);--color-bg-shading-1: var(--color-theme-50);--color-bg-shading-2: var(--color-theme-100);--color-bg-shading-3: var(--color-theme-125);--color-bg-shading-4: var(--color-theme-150);--color-bg-shading-5: var(--color-theme-175);--color-bg-shading-6: var(--color-theme-200);--color-bg-lightning-1: var(--color-theme-0);--color-bg-primary-1: var(--color-primary-500);--color-bg-primary-2: var(--color-primary-600);--color-bg-primary-3: var(--color-primary-720);--color-bg-positive-1: var(--color-positive-500);--color-bg-positive-2: var(--color-positive-700);--color-bg-positive-3: var(--color-positive-760);--color-bg-warning-1: var(--color-warning-500);--color-bg-warning-2: var(--color-warning-600);--color-bg-warning-3: var(--color-warning-720);--color-bg-negative-1: var(--color-negative-500);--color-bg-negative-2: var(--color-negative-650);--color-bg-negative-3: var(--color-negative-720);--color-bg-info-1: var(--color-info-500);--color-bg-info-2: var(--color-info-650);--color-bg-info-3: var(--color-info-720);--top-panel-background-color: rgba(255, 255, 255, .8);--color-text-1: var(--color-theme-850);--color-text-2: var(--color-theme-600);--color-text-3: var(--color-theme-450);--color-text-4: var(--color-theme-300);--color-text-1-inverse: var(--color-theme-0);--color-text-white: var(--color-white);--color-text-primary: var(--color-primary-550);--color-text-primary-alt: var(--color-primary-700);--color-text-positive: var(--color-positive-550);--color-text-positive-alt: var(--color-positive-700);--color-text-warning: var(--color-warning-550);--color-text-warning-alt: var(--color-warning-700);--color-text-negative: var(--color-negative-550);--color-text-negative-alt: var(--color-negative-700);--color-text-info: var(--color-info-550);--color-text-info-alt: var(--color-info-700);--color-line-1: var(--color-theme-200);--color-line-2: var(--color-theme-250);--color-line-3: var(--color-theme-375);--color-line-4: var(--color-theme-470);--color-line-1-opacity: rgba(14, 65, 142, .1);--color-line-2-opacity: rgba(14, 65, 142, .19);--color-line-3-opacity: rgba(14, 65, 142, .39);--color-line-primary-1: var(--color-primary-500);--color-line-primary-2: var(--color-primary-650);--color-line-primary-3: var(--color-primary-720);--color-line-primary-1-opacity: rgba(15, 86, 240, .14);--color-line-primary-2-opacity: rgba(15, 86, 240, .28);--color-line-primary-3-opacity: rgba(15, 86, 240, .38);--color-line-positive-1: var(--color-positive-550);--color-line-positive-2: var(--color-positive-600);--color-line-positive-3: var(--color-positive-720);--color-line-positive-1-opacity: rgba(54, 161, 80, .14);--color-line-positive-2-opacity: rgba(54, 161, 80, .28);--color-line-positive-3-opacity: rgba(54, 161, 80, .38);--color-line-warning-1: var(--color-warning-600);--color-line-warning-2: var(--color-warning-700);--color-line-warning-3: var(--color-warning-740);--color-line-warning-1-opacity: rgba(251, 150, 50, .14);--color-line-warning-2-opacity: rgba(251, 150, 50, .28);--color-line-warning-3-opacity: rgba(251, 150, 50, .38);--color-line-negative-1: var(--color-negative-550);--color-line-negative-2: var(--color-negative-700);--color-line-negative-3: var(--color-negative-740);--color-line-negative-1-opacity: rgba(247, 60, 54, .14);--color-line-negative-2-opacity: rgba(247, 60, 54, .28);--color-line-negative-3-opacity: rgba(247, 60, 54, .38);--color-line-info-1: var(--color-info-500);--color-line-info-2: var(--color-info-550);--color-line-info-3: var(--color-info-600);--color-line-info-1-opacity: rgba(122, 47, 242, .14);--color-line-info-2-opacity: rgba(122, 47, 242, .28);--color-line-info-3-opacity: rgba(122, 47, 242, .38);--scroll-track-color: var(--color-theme-225);--scroll-thumb-color: var(--color-theme-300);--scroll-thumb-color-hover: var(--color-theme-450);--scroll-thumb-color-active: var(--color-theme-550);--body-background-color: var(--color-layout-front-1);--content-background-color: var(--color-layout-front-1);--top-forms-option-color: var(--color-primary-500);--top-forms-option-color-hover: var(--color-primary-600)}:root{--color-layout-back: var(--color-theme-200);--color-layout-header: var(--color-theme-0);--color-layout-middle: var(--color-theme-125);--color-layout-front-1: var(--color-theme-0);--color-layout-front-2: #FCFCFD;--color-layout-front-3: #F6F6F8;--color-layout-front-4: #EBEDF1;--color-layout-front-5: #E2E5EA;--color-layout-front-6: #D8DCE2;--color-layout-front-primary-1: #FFFFFF;--color-layout-front-primary-2: #F7F9FF;--color-layout-front-primary-3: #EEF3FF;--color-layout-front-primary-4: #E6EEFF;--color-layout-front-primary-5: #DDE8FE;--color-layout-front-primary-6: #D5E2FE;--color-layout-front-positive-1: #FFFFFF;--color-layout-front-positive-2: #F8FEF9;--color-layout-front-positive-3: #F1FCF4;--color-layout-front-positive-4: #EAFBEF;--color-layout-front-positive-5: #E3F9E8;--color-layout-front-positive-6: #DBF8E3;--color-layout-front-warning-1: #FFFFFF;--color-layout-front-warning-2: #FFFBF7;--color-layout-front-warning-3: #FFF7F0;--color-layout-front-warning-4: #FFF4E8;--color-layout-front-warning-5: #FFF0E1;--color-layout-front-warning-6: #FFECDA;--color-layout-front-negative-1: #FFFFFF;--color-layout-front-negative-2: #FFF7F8;--color-layout-front-negative-3: #FEF0F1;--color-layout-front-negative-4: #FEE7E9;--color-layout-front-negative-5: #FEDFE3;--color-layout-front-negative-6: #FDD7DC;--color-layout-front-info-1: #FFFFFF;--color-layout-front-info-2: #FAF6FF;--color-layout-front-info-3: #F5EEFF;--color-layout-front-info-4: #F0E5FF;--color-layout-front-info-5: #EBDBFE;--color-layout-front-info-6: #E6D4FE}:root{--color-summary-top-3: #3198DD;--color-summary-top-10: #21936C;--color-summary-top-30: #1ABC9C;--color-summary-top-50: #94DA90;--color-summary-top-100: #BCC8C8;--color-summary-top-10000: #FCC53B;--color-table-top-1: #B3D2FF;--color-table-top-2: #CCE0FF;--color-table-top-3: #CCE0FF;--color-table-top-4: #8AF3B7;--color-table-top-5: #98F5C1;--color-table-top-6: #A2F7C8;--color-table-top-7: #ACF9CE;--color-table-top-8: #B6FBD5;--color-table-top-9: #BFFDDB;--color-table-top-10: #CCFFE4;--color-table-move-up-10: #8AF3B7;--color-table-move-up-9: #8AF3B7;--color-table-move-up-8: #A2F7C8;--color-table-move-up-7: #A2F7C8;--color-table-move-up-6: #B6FBD5;--color-table-move-up-5: #B6FBD5;--color-table-move-up-4: #BFFDDB;--color-table-move-up-3: #BFFDDB;--color-table-move-up-2: #CCFFE4;--color-table-move-up-1: #CCFFE4;--color-table-move-0: #FCFEFD;--color-table-move-down-1: #FFF1F0;--color-table-move-down-2: #FFF1F0;--color-table-move-down-3: #FFF1F0;--color-table-move-down-4: #FFF1F0;--color-table-move-down-5: #FFE7E6;--color-table-move-down-6: #FFE7E6;--color-table-move-down-7: #FFE7E6;--color-table-move-down-8: #FFD5D4;--color-table-move-down-9: #FFD5D4;--color-table-move-down-10: #FFD5D4;--color-table-down: #FFF1F0;--color-table-up: #CCFFE4;--color-table-down-10: #FFE7E6;--color-table-up-10: #BFFDDB;--color-table-base: var(--color-layout-front-1);--color-table-featured-snippet: #F6F2A0;--color-table-empty: var(--color-layout-front-3);--color-table-not_found: #FFF6C6;--color-snapshot-panel-gradient-1: rgba(255, 255, 255, .5);--color-snapshot-panel-gradient-2: rgba(255, 255, 255, .8);--color-snippet-title: #1A0DAB;--color-snippet-title-visited: #660099;--color-snippet-url: #007700}
|
package/core/app.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-DRhpgERJ.amd","../.chunks/core-DQ7J2vig.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-g7NSc8VW.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-CXghec6S.amd"],(function(y,n,c,
|
|
1
|
+
define(["require","exports","../.chunks/forms-DRhpgERJ.amd","../.chunks/core-DQ7J2vig.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-g7NSc8VW.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-CXghec6S.amd"],(function(y,n,c,f,d,m,S,g,p,k){"use strict";if(typeof d>"u")var d=window.Vue;class E{#s;#t;#e;#i;#c;#a=[];#o=[];#n=[];#r=[];constructor(s){var t;this.#t=s.store,this.#s=this.#t.$id,this.#e=s.options.Page,this.#i=s.options.user,this.#c=s.options.Api,this.#a=s.options.tpaNamesUrlHash||[],this.#o=s.options.tpaNamesStorage||[],this.#n=s.options.tpaNamesStorageLocal||[],this.#r=s.options.tpaNamesGuestLink||[],s.store.genGuestLink=(i,a)=>this.genGuestLink(i,a),(t=this.#i.guest_data)!=null&&t.data||(this.#u(),this.#u(!0),this.#f()),this.#S(),this.#k();const e=c.debounce(()=>{this.#m(),this.#g(),this.#g(!0)});s.store.$subscribe(e)}async genGuestLink(s,e){const t=this.#p();e=Object.assign(e,Object.fromEntries(t));const i=await this.#c.gen(s).setParams(e).call();if(i!=null&&i.errors)return;const a=i.result;await m.guestLinkToClipboard(a)}#p(){const s=new Map;return this.#r.forEach(e=>{const t=S.camelToSnakeCase(e);s.set(t,this.#t[e])}),s}#h(s){s.forEach((e,t)=>{const i=this.#t[t];if(e!=null&&i!==void 0&&e!=null&&e.constructor&&e.constructor===i.constructor){if(t.indexOf("date")===0&&!Array.isArray(e)){if(typeof e=="string"&&!/\d\d\d\d-\d\d-\d\d/.test(e))return}this.#t[t]=e}})}#l(s){const e=new Map;return s.forEach((t,i)=>{t!==null&&(t=JSON.stringify(t),e.set(i,t))}),e}#d(s){const e=new Map;return s.forEach((t,i)=>{if(!(t==null||t==="false")){try{if(typeof t=="string"&&!/^\d\d\d\d-\d\d-\d\d$/.test(t)&&(t=JSON.parse(t)),t==null||t==="false")return}catch{}e.set(i,t)}}),e}#f(){let s;try{s=JSON.parse(g.getHash(this.#s))}catch{}if(!s)return;const e=new Map;this.#a.forEach(t=>{const i=s[t];i&&e.set(t,i)}),this.#h(e)}#m(){const s=new Map;this.#a.forEach(i=>{const a=this.#t[i];s.set(i,a)});const e=Object.fromEntries(s),t=JSON.stringify(e);g.setHash(this.#s,t)}#u(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=localStorage.getItem(i+":"+o);e.set(o,r)});const a=this.#d(e);this.#h(a)}#g(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=this.#t[o];e.set(o,r)});const a=this.#l(e);t.forEach(o=>{const r=a.get(o);localStorage.setItem(i+":"+o,r)})}#S(){var a,o,r;const s=(o=(a=this.#i)==null?void 0:a.guest_data)==null?void 0:o.data;if(!s)return;this.#i.id===-1&&(this.#i.positionsReverseDates=s.positionsReverseDates);const e=new Map;this.#r.forEach(h=>{const u=s[h];e.set(h,u)});const t=this.#d(e);this.#h(t);const i=$(".mod_guest_title");if(((r=this.#t.competitorsIds)==null?void 0:r.length)===1&&this.#e.page.data.competitors){let h=this.#e.page.data.competitors.filter(u=>u.id===s.competitorsIds[0]);h.length&&($("a",i).attr("href","http://"+h[0].url),$("a",i).text(h[0].name))}}#k(){this.#t.regionsIndexes&&d.watch(this.#t.regionsIndexes,s=>{if(!s.length)return;s.forEach((i,a)=>s[a]=i);const e=TplProjectSelectorRegion.genSearchersMap(),t=[];e.forEach(i=>{i.regions.forEach(a=>{a.index!==-1&&t.push(a.index)})}),this.#t.regionsIndexes=s.filter(i=>t.includes(i))},{immediate:!0}),this.#t.competitorsIds&&d.watch(this.#t.competitorsIds,s=>{if(!s.length)return;s.forEach((t,i)=>s[i]=t);const e=[this.#e.page.data.project.id];this.#e.page.data.project.competitors.forEach(t=>{t.on>=0&&e.push(t.id)}),this.#t.competitorsIds=s.filter(t=>e.includes(t))},{immediate:!0})}}const w=l=>{var e,t,i,a;const s=l;!((e=s.options.tpaNamesUrlHash)!=null&&e.length)&&!((t=s.options.tpaNamesStorage)!=null&&t.length)&&!((i=s.options.tpaNamesStorageLocal)!=null&&i.length)&&!((a=s.options.tpaNamesGuestLink)!=null&&a.length)||new E(s)};n.Core=c.Core,n.i18nPlugin=c.i18n,n.useI18n=c.useI18n,n.useI18nLang=c.useI18nLang,n.corePlugin=f.core,n.useAsyncTopDialog=p.useAsyncTopDialog,n.useTopDialog=p.useTopDialog,n.TopDialogWorker=k.TopDialogWorker,n.piniaTPAPlugin=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=app.amd.js.map
|
package/core/app.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.amd.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","context","url","data","#loadFromStorage","save","forms","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","utils_clipboard","nameSnakeCase","utils_string","name","currentValue","value","dataFormatted","#loadFromHash","dataHash","utils_route","#setOptions","#saveInHash","dataJSON","isLocal","names","#namesStorage","storageNamespace","#namesStorageLocal","#loadFromGuestLink","guestData","$guestTitle","competitors","competitor","#prepareParams","regionsIndexes","regionIndex","index","mapSearchers","searcher","region","availableRegionsIndexes","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_a","_b","_c","_d"],"mappings":"yVAYA,MAAAA,CAAA,CAAeC,GAELC,GACAC,GAKAC,GAEAC,gDASR,KAAAH,GAAAI,EAAA,6PAaAA,EAAA,MAAA,aAAA,CAAAC,EAAAC,IAAA,KAAA,aAAAD,EAAAC,CAAA,mDAIC,KAAAC,GAAA,EAAA,iCAWD,MAAAC,EAAAC,EAAA,SAAA,IAAA,qBAGC,KAAAC,GAAA,EAAA,CAAwB,CAAA,EAGzBN,EAAA,MAAA,WAAAI,CAAA,EACD,MAAA,aAAAH,EAAAC,EAAA,CAQC,MAAAK,EAAA,KAAAC,GAAA,EACAN,EAAA,OAAA,OAAAA,EAAA,OAAA,YAAAK,CAAA,CAAA,wDAKAE,GAAA,MAAAA,EAAA,QAGA,MAAAC,EAAA,qBAAAD,EAAA,MAAA,EACDD,IAAA,CAMC,MAAAN,EAAA,IAAA,+BAIC,MAAAS,EAAAC,EAAA,iBAAAC,CAAA,EACAX,EAAA,IAAAS,EAAA,KAAAf,GAAAiB,CAAA,CAAA,CAAyC,CAAA,EAG1CX,yDAWCY,IAAA,QACAC,GAAA,MAAAA,EAAA,yFAUE,GAAA,OAAAA,GAAA,+CAMF,KAAAnB,GAAAiB,CAAA,EAAAE,EAAoB,CAAA,QAQrB,MAAAC,EAAA,IAAA,6BAGCD,IAAA,OAEAA,EAAA,KAAA,UAAAA,CAAA,EAEAC,EAAA,IAAAH,EAAAE,CAAA,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AAA,CAA2H,EAAA,CAAA,UAAA,EAAA,CAAA,EAK/H,CA+DA,MAAAE,EAAAC,GAAA,uBAIC,GAAAC,EAAA9C,EAAA,QAAA,kBAAA,MAAA8C,EAAA,SAAA,GAAAC,EAAA/C,EAAA,QAAA,kBAAA,MAAA+C,EAAA,SAAA,GAAAC,EAAAhD,EAAA,QAAA,uBAAA,MAAAgD,EAAA,SAAA,GAAAC,EAAAjD,EAAA,QAAA,oBAAA,MAAAiD,EAAA,SASA,IAAAvD,EAAAM,CAAA"}
|
|
1
|
+
{"version":3,"file":"app.amd.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport { getHash, setHash } from '@/core/utils/route';\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: Api.Client<Api.TV.Paths, true>;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends Api.TV.Path>(path: Path, params: Api.TV.Params<Path>) => this.genGuestLink(path, params);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в path, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends Api.TV.Path>(path: Path, params: Api.TV.Params<Path>) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tparams = Object.assign(params, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(path).setParams(params).call();\n\t\tif (res?.errors) return;\n\n\t\tconst link = res.result as string;\n\n\t\tawait guestLinkToClipboard(link);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: Api.Client<Api.TV.Paths, true>;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","context","path","params","#loadFromStorage","save","forms","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","link","utils_clipboard","data","nameSnakeCase","utils_string","name","currentValue","value","dataFormatted","#loadFromHash","dataHash","utils_route","#setOptions","#saveInHash","dataJSON","isLocal","names","#namesStorage","storageNamespace","#namesStorageLocal","#loadFromGuestLink","guestData","$guestTitle","competitors","competitor","#prepareParams","regionsIndexes","regionIndex","index","mapSearchers","searcher","region","availableRegionsIndexes","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_a","_b","_c","_d"],"mappings":"yVAOA,MAAAA,CAAA,CAAeC,GAELC,GACAC,GAKAC,GAEAC,gDASR,KAAAH,GAAAI,EAAA,6PAaAA,EAAA,MAAA,aAAA,CAAAC,EAAAC,IAAA,KAAA,aAAAD,EAAAC,CAAA,mDAIC,KAAAC,GAAA,EAAA,iCAWD,MAAAC,EAAAC,EAAA,SAAA,IA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ms-t2AEUjqg.es.js";
|
|
3
3
|
import { c as G } from "../.chunks/core-CUCQCH9e.es.js";
|
|
4
4
|
import { watch as p } from "vue";
|
|
5
5
|
import { guestLinkToClipboard as f } from "../utils/clipboard.js";
|
|
6
6
|
import { camelToSnakeCase as g } from "../utils/string.js";
|
|
7
|
-
import { getHash as
|
|
7
|
+
import { getHash as l, setHash as m } from "../utils/route.js";
|
|
8
8
|
import { u as A, a as D } from "../.chunks/utils-Ct2fnz3h.es.js";
|
|
9
9
|
import { T as j } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang-DjuN_1ox.es.js";
|
|
10
10
|
class u {
|
|
@@ -22,7 +22,7 @@ class u {
|
|
|
22
22
|
#n = [];
|
|
23
23
|
constructor(s) {
|
|
24
24
|
var t;
|
|
25
|
-
this.#t = s.store, this.#s = this.#t.$id, this.#e = s.options.Page, this.#a = s.options.user, this.#c = s.options.Api, this.#i = s.options.tpaNamesUrlHash || [], this.#o = s.options.tpaNamesStorage || [], this.#r = s.options.tpaNamesStorageLocal || [], this.#n = s.options.tpaNamesGuestLink || [], s.store.genGuestLink = (a, i) => this.genGuestLink(a, i), (t = this.#a.guest_data) != null && t.data || (this.#d(), this.#d(!0), this.#
|
|
25
|
+
this.#t = s.store, this.#s = this.#t.$id, this.#e = s.options.Page, this.#a = s.options.user, this.#c = s.options.Api, this.#i = s.options.tpaNamesUrlHash || [], this.#o = s.options.tpaNamesStorage || [], this.#r = s.options.tpaNamesStorageLocal || [], this.#n = s.options.tpaNamesGuestLink || [], s.store.genGuestLink = (a, i) => this.genGuestLink(a, i), (t = this.#a.guest_data) != null && t.data || (this.#d(), this.#d(!0), this.#m()), this.#S(), this.#E();
|
|
26
26
|
const e = d(() => {
|
|
27
27
|
this.#u(), this.#f(), this.#f(!0);
|
|
28
28
|
});
|
|
@@ -31,13 +31,15 @@ class u {
|
|
|
31
31
|
/**
|
|
32
32
|
* Сгенерировать гостевую ссылку
|
|
33
33
|
*
|
|
34
|
-
* Метод, путь к которому указан в
|
|
34
|
+
* Метод, путь к которому указан в path, должен возвращать сгенерированную ссылку
|
|
35
35
|
*/
|
|
36
36
|
async genGuestLink(s, e) {
|
|
37
37
|
const t = this.#g();
|
|
38
38
|
e = Object.assign(e, Object.fromEntries(t));
|
|
39
|
-
const a = await this.#c.gen(s
|
|
40
|
-
a != null && a.errors
|
|
39
|
+
const a = await this.#c.gen(s).setParams(e).call();
|
|
40
|
+
if (a != null && a.errors) return;
|
|
41
|
+
const i = a.result;
|
|
42
|
+
await f(i);
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Сгенерировать опции для гостевой ссылки
|
|
@@ -67,7 +69,7 @@ class u {
|
|
|
67
69
|
/**
|
|
68
70
|
* Сгенерировать Map объект с опциями со значениями в виде json строк
|
|
69
71
|
*/
|
|
70
|
-
#
|
|
72
|
+
#l(s) {
|
|
71
73
|
const e = /* @__PURE__ */ new Map();
|
|
72
74
|
return s.forEach((t, a) => {
|
|
73
75
|
t !== null && (t = JSON.stringify(t), e.set(a, t));
|
|
@@ -91,10 +93,10 @@ class u {
|
|
|
91
93
|
/**
|
|
92
94
|
* Установить опции из хеша адреса страницы
|
|
93
95
|
*/
|
|
94
|
-
#
|
|
96
|
+
#m() {
|
|
95
97
|
let s;
|
|
96
98
|
try {
|
|
97
|
-
s = JSON.parse(
|
|
99
|
+
s = JSON.parse(l(this.#s));
|
|
98
100
|
} catch {
|
|
99
101
|
}
|
|
100
102
|
if (!s) return;
|
|
@@ -114,7 +116,7 @@ class u {
|
|
|
114
116
|
s.set(a, i);
|
|
115
117
|
});
|
|
116
118
|
const e = Object.fromEntries(s), t = JSON.stringify(e);
|
|
117
|
-
|
|
119
|
+
m(this.#s, t);
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
120
122
|
* Установить опции из localStorage
|
|
@@ -141,7 +143,7 @@ class u {
|
|
|
141
143
|
const r = this.#t[o];
|
|
142
144
|
e.set(o, r);
|
|
143
145
|
});
|
|
144
|
-
const i = this.#
|
|
146
|
+
const i = this.#l(e);
|
|
145
147
|
t.forEach((o) => {
|
|
146
148
|
const r = i.get(o);
|
|
147
149
|
localStorage.setItem(a + ":" + o, r);
|
|
@@ -201,7 +203,7 @@ const w = (c) => {
|
|
|
201
203
|
!((e = s.options.tpaNamesUrlHash) != null && e.length) && !((t = s.options.tpaNamesStorage) != null && t.length) && !((a = s.options.tpaNamesStorageLocal) != null && a.length) && !((i = s.options.tpaNamesGuestLink) != null && i.length) || new u(s);
|
|
202
204
|
};
|
|
203
205
|
export {
|
|
204
|
-
|
|
206
|
+
I as Core,
|
|
205
207
|
j as TopDialogWorker,
|
|
206
208
|
G as corePlugin,
|
|
207
209
|
T as i18nPlugin,
|
package/core/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\nimport { getHash, setHash } from '@/core/utils/route';\n\ntype OpenAPIPath = keyof OpenAPIPaths;\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: any;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tif (res?.errors) return;\n\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\n\t\tawait guestLinkToClipboard(res.result);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: any;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","url","data","_a","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","guestLinkToClipboard","name","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","names","storageNamespace","guestData","_b","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;;;AAYA,MAAMA,EAAS;AAAA,EAELC;AAAA,EACAC;AAAA;AAAA;AAAA;AAAA,EAKAC;AAAA,EAEAC;AAAA,EACAC;AAAA,EAEAC,KAA0B,CAAA;AAAA,EAC1BC,KAA0B,CAAA;AAAA,EAC1BC,KAA+B,CAAA;AAAA,EAC/BC,KAA4B,CAAA;AAAA,EAErC,YAAYC,GAAkB;;AAC7B,SAAKR,KAASQ,EAAQ,OACtB,KAAKT,KAAW,KAAKC,GAAO,KAE5B,KAAKC,KAAQO,EAAQ,QAAQ,MAE7B,KAAKN,KAAQM,EAAQ,QAAQ,MAC7B,KAAKL,KAAOK,EAAQ,QAAQ,KAE5B,KAAKJ,KAAgBI,EAAQ,QAAQ,mBAAmB,CAAA,GACxD,KAAKH,KAAgBG,EAAQ,QAAQ,mBAAmB,CAAA,GACxD,KAAKF,KAAqBE,EAAQ,QAAQ,wBAAwB,CAAA,GAClE,KAAKD,KAAkBC,EAAQ,QAAQ,qBAAqB,CAAA,GAE5DA,EAAQ,MAAM,eAAe,CAA2BC,GAAWC,MAAc,KAAK,aAAaD,GAAKC,CAAI,IAEvGC,IAAA,KAAKT,GAAM,eAAX,QAAAS,EAAuB,SAC3B,KAAKC,GAAA,GACL,KAAKA,GAAiB,EAAI,GAG1B,KAAKC,GAAA,IAIN,KAAKC,GAAA,GAEL,KAAKC,GAAA;AAEL,UAAMC,IAAOC,EAAS,MAAM;AAC3B,WAAKC,GAAA,GACL,KAAKC,GAAA,GACL,KAAKA,GAAe,EAAI;AAAA,IACzB,CAAC;AAED,IAAAX,EAAQ,MAAM,WAAWQ,CAAI;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAuCP,GAAWC,GAAW;AAClE,UAAMU,IAAgB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gB,CAACuD,MAAmB;AACrD,UAAI,CAACA,EAAe,OAAQ;AAG5B,MAAAA,EAAe,QAAQ,CAACC,GAAsBN,MAAkBK,EAAeL,CAAK,IAAIM,CAAY;AAGpG,YAAMC,IAA0B,CAAC,KAAKxD,GAAM,KAAK,KAAK,QAAQ,EAAE;AAChE,WAAKA,GAAM,KAAK,KAAK,QAAQ,YAAY,QAAQ,CAAC6C,MAAoB;AACrE,QAAIA,EAAW,MAAM,KAAGW,EAAwB,KAAKX,EAAW,EAAE;AAAA,MACnE,CAAC,GAED,KAAK9C,GAAO,iBAAiBuD,EAAe,OAAO,CAACC,MAAyBC,EAAwB,SAASD,CAAY,CAAC;AAAA,IAC5H,GAAG,EAAE,WAAW,IAAM;AAAA,EAExB;AAED;AA+DA,MAAAE,IAAe,CAACC,MAAqC;;AACpD,QAAMnD,IAAUmD;AAGhB,EACC,GAAChD,IAAAH,EAAQ,QAAQ,oBAAhB,QAAAG,EAAiC,WAClC,GAAC+B,IAAAlC,EAAQ,QAAQ,oBAAhB,QAAAkC,EAAiC,WAClC,GAACE,IAAApC,EAAQ,QAAQ,yBAAhB,QAAAoC,EAAsC,WACvC,GAACgB,IAAApD,EAAQ,QAAQ,sBAAhB,QAAAoD,EAAmC,WAKrC,IAAI9D,EAASU,CAAO;AACrB;"}
|
|
1
|
+
{"version":3,"file":"app.js","sources":["../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { PiniaPluginContext, Store } from 'pinia';\nimport { watch } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport { guestLinkToClipboard } from '@/core/utils/clipboard';\nimport { camelToSnakeCase } from '@/core/utils/string.js';\nimport { getHash, setHash } from '@/core/utils/route';\n\nclass PiniaTPA {\n\n\treadonly #storeId: string;\n\treadonly #store: Store<string, any>;\n\n\t/**\n\t * @deprecated\n\t */\n\treadonly #Page: any;\n\n\treadonly #user: any;\n\treadonly #Api: Api.Client<Api.TV.Paths, true>;\n\n\treadonly #namesUrlHash: string[] = [];\n\treadonly #namesStorage: string[] = [];\n\treadonly #namesStorageLocal: string[] = [];\n\treadonly #namesGuestLink: string[] = [];\n\n\tconstructor(context: Context) {\n\t\tthis.#store = context.store;\n\t\tthis.#storeId = this.#store.$id;\n\n\t\tthis.#Page = context.options.Page;\n\n\t\tthis.#user = context.options.user;\n\t\tthis.#Api = context.options.Api;\n\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\n\n\t\tcontext.store.genGuestLink = <Path extends Api.TV.Path>(path: Path, params: Api.TV.Params<Path>) => this.genGuestLink(path, params);\n\n\t\tif (!this.#user.guest_data?.data) {\n\t\t\tthis.#loadFromStorage();\n\t\t\tthis.#loadFromStorage(true);\n\n\t\t\t// настройки URL hash имеют приоритет\n\t\t\tthis.#loadFromHash();\n\t\t}\n\n\t\t// настройки гостевой ссылки имеют приоритет\n\t\tthis.#loadFromGuestLink();\n\n\t\tthis.#prepareParams();\n\n\t\tconst save = debounce(() => {\n\t\t\tthis.#saveInHash();\n\t\t\tthis.#saveInStorage();\n\t\t\tthis.#saveInStorage(true);\n\t\t});\n\n\t\tcontext.store.$subscribe(save);\n\t}\n\n\t/**\n\t * Сгенерировать гостевую ссылку\n\t *\n\t * Метод, путь к которому указан в path, должен возвращать сгенерированную ссылку\n\t */\n\tasync genGuestLink<Path extends Api.TV.Path>(path: Path, params: Api.TV.Params<Path>) {\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\n\t\tparams = Object.assign(params, Object.fromEntries(dataGuestLink));\n\n\t\tconst res = await this.#Api.gen(path).setParams(params).call();\n\t\tif (res?.errors) return;\n\n\t\tconst link = res.result as string;\n\n\t\tawait guestLinkToClipboard(link);\n\t}\n\n\t/**\n\t * Сгенерировать опции для гостевой ссылки\n\t */\n\t#genOptionsForGuestLink() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesGuestLink.forEach(name => {\n\t\t\t// формат параметров API: snake_case\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из объекта без фиксации состояния\n\t */\n\t#setOptions(data: Map<string, any>) {\n\t\tdata.forEach((value, name) => {\n\t\t\tconst currentValue = this.#store[name];\n\n\t\t\tif (value === null || value === undefined) return;\n\t\t\tif (currentValue === undefined) return;\n\t\t\tif (!value?.constructor) return;\n\t\t\tif (value.constructor !== currentValue.constructor) return;\n\n\t\t\t// дополнительная проверка на формат даты\n\t\t\tif (name.indexOf('date') === 0) {\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t// value.forEach((valueI) => {\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\n\t\t\t\t\t// });\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof (value) === 'string') {\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#store[name] = value;\n\t\t});\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\n\t */\n\t#genDataFormat(data: Map<string, any>) {\n\t\tconst dataFormatted = new Map();\n\n\t\tdata.forEach((value, name) => {\n\t\t\tif (value === null) return;\n\n\t\t\tvalue = JSON.stringify(value);\n\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\treturn dataFormatted;\n\t}\n\n\t/**\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\n\t */\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tdataFormatted.forEach((value, name) => {\n\t\t\tif (value === null || value === undefined || value === 'false') return;\n\n\t\t\ttry {\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\n\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\n\t\t\t} catch (e) {\n\t\t\t\t// не json строка\n\t\t\t}\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * Установить опции из хеша адреса страницы\n\t */\n\t#loadFromHash() {\n\t\tlet dataHash: any;\n\t\ttry {\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\n\t\t} catch (e) {\n\n\t\t}\n\t\tif (!dataHash) return;\n\n\t\tconst data: Map<string, any> = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = dataHash[name];\n\t\t\tif (!value) return;\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в хеш адреса страницы\n\t */\n\t#saveInHash() {\n\t\tconst data = new Map();\n\n\t\tthis.#namesUrlHash.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataObject = Object.fromEntries(data);\n\t\tconst dataJSON = JSON.stringify(dataObject);\n\n\t\tsetHash(this.#storeId, dataJSON);\n\t};\n\n\t/**\n\t * Установить опции из localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#loadFromStorage(isLocal = false) {\n\t\tconst dataFormatted = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\t}\n\n\t/**\n\t * Сохранить опции в localStorage\n\t * @param isLocal - сохранить с учетом адреса страницы\n\t */\n\t#saveInStorage(isLocal = false) {\n\t\tconst data = new Map();\n\n\t\tlet names = this.#namesStorage;\n\t\tlet storageNamespace = 'state:' + this.#storeId;\n\n\t\tif (isLocal) {\n\t\t\tnames = this.#namesStorageLocal;\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\n\t\t}\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = this.#store[name];\n\n\t\t\tdata.set(name, value);\n\t\t});\n\n\t\tconst dataFormatted = this.#genDataFormat(data);\n\n\t\tnames.forEach((name) => {\n\t\t\tconst value = dataFormatted.get(name);\n\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\n\t\t});\n\t}\n\n\t/**\n\t * Установить опции из гостевой ссылки\n\t */\n\t#loadFromGuestLink() {\n\t\tconst guestData = this.#user?.guest_data?.data;\n\t\tif (!guestData) return;\n\n\t\t// общие правила для гостевых сессий\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\n\n\t\tconst dataFormatted = new Map();\n\n\t\tthis.#namesGuestLink.forEach((name) => {\n\t\t\tconst value = guestData[name];\n\t\t\tdataFormatted.set(name, value);\n\t\t});\n\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\n\n\t\tthis.#setOptions(data);\n\n\t\tconst $guestTitle = $('.mod_guest_title');\n\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\n\t\t\tif (competitors.length) {\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Подготовить входные параметры перед инициализацией основного функционала\n\t *\n\t * Входные параметры устанавливаются при открытии страницы\n\t *\n\t * Входные параметры могут меняться пользоваталем и устаревать\n\t */\n\t#prepareParams() {\n\t\t// контролль за вводом регионов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.regionsIndexes) {\n\t\t\twatch(this.#store.regionsIndexes, (regionsIndexes) => {\n\t\t\t\tif (!regionsIndexes.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\n\n\t\t\t\t// оставить только включенные регионы\n\t\t\t\t// @ts-ignore\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\n\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\n\t\t\t\t\t\tif (region.index === -1) return;\n\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\n\t\t\t}, { immediate: true });\n\t\t}\n\n\t\t// контролль за вводом конкурентов\n\t\t// TODO: вынести в опции плагина\n\t\tif (this.#store.competitorsIds) {\n\t\t\twatch(this.#store.competitorsIds, (competitorsIds) => {\n\t\t\t\tif (!competitorsIds.length) return;\n\n\t\t\t\t// приведение типа\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorsIds[index] = competitorId);\n\n\t\t\t\t// оставить только включенных конкурентов\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\n\t\t\t\t});\n\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\n\t\t\t}, { immediate: true });\n\t\t}\n\t}\n\n}\n\ntype Options = {\n\t/**\n\t * TODO: Убрать из плагина\n\t */\n\tPage: any,\n\n\t/**\n\t * Объект с настройками пользователя\n\t */\n\tuser: any,\n\n\t/**\n\t * Объект для работы с API\n\t *\n\t * См. на сайте: @/component/api/core/api.ts\n\t */\n\tApi: Api.Client<Api.TV.Paths, true>;\n\n\t/**\n\t * Имена свойств для сохранения в URL\n\t */\n\ttpaNamesUrlHash?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage\n\t */\n\ttpaNamesStorage?: string[],\n\n\t/**\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\n\t *\n\t * Каждый URL будет работать со своим состоянием\n\t */\n\ttpaNamesStorageLocal?: string[],\n\n\t/**\n\t * Имена свойств для работы с гостевой ссылкой\n\t *\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\n\t */\n\ttpaNamesGuestLink?: string[],\n};\n\ntype Context = PiniaPluginContext & {\n\toptions: Options\n};\n\n/**\n * Плагин tpa (Third-party access) для pinia\n *\n * Добавляет возможность сохранять и загружать данные в/из:\n * \t- URL hash в адресе страницы\n * \t- localStorage\n * \t- гостевая ссылка\n *\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\n * - tpaNamesUrlHash\n * - tpaNamesStorage\n * - tpaNamesStorageLocal\n * - tpaNamesGuestLink\n */\nexport default (contextPinia: PiniaPluginContext) => {\n\tconst context = contextPinia as Context;\n\n\t// плагин подключать не нужно\n\tif (\n\t\t!context.options.tpaNamesUrlHash?.length &&\n\t\t!context.options.tpaNamesStorage?.length &&\n\t\t!context.options.tpaNamesStorageLocal?.length &&\n\t\t!context.options.tpaNamesGuestLink?.length\n\t) {\n\t\treturn;\n\t}\n\n\tnew PiniaTPA(context);\n}\n"],"names":["PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","path","params","_a","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","link","guestLinkToClipboard","data","name","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","names","storageNamespace","guestData","_b","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;;;AAOA,MAAMA,EAAS;AAAA,EAELC;AAAA,EACAC;AAAA;AAAA;AAAA;AAAA,EAKAC;AAAA,EAEAC;AAAA,EACAC;AAAA,EAEAC,KAA0B,CAAA;AAAA,EAC1BC,KAA0B,CAAA;AAAA,EAC1BC,KAA+B,CAAA;AAAA,EAC/BC,KAA4B,CAAA;AAAA,EAErC,YAAYC,GAAkB;;AAC7B,SAAKR,KAASQ,EAAQ,OACtB,KAAKT,KAAW,KAAKC,GAAO,KAE5B,KAAKC,KAAQO,EAAQ,QAAQ,MAE7B,KAAKN,KAAQM,EAAQ,QAAQ,MAC7B,KAAKL,KAAOK,EAAQ,QAAQ,KAE5B,KAAKJ,KAAgBI,EAAQ,QAAQ,mBAAmB,CAAA,GACxD,KAAKH,KAAgBG,EAAQ,QAAQ,mBAAmB,CAAA,GACxD,KAAKF,KAAqBE,EAAQ,QAAQ,wBAAwB,CAAA,GAClE,KAAKD,KAAkBC,EAAQ,QAAQ,qBAAqB,CAAA,GAE5DA,EAAQ,MAAM,eAAe,CAA2BC,GAAYC,MAAgC,KAAK,aAAaD,GAAMC,CAAM,IAE7HC,IAAA,KAAKT,GAAM,eAAX,QAAAS,EAAuB,SAC3B,KAAKC,GAAA,GACL,KAAKA,GAAiB,EAAI,GAG1B,KAAKC,GAAA,IAIN,KAAKC,GAAA,GAEL,KAAKC,GAAA;AAEL,UAAMC,IAAOC,EAAS,MAAM;AAC3B,WAAKC,GAAA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AAA,QAC1C,CAAC;AAAA,MACF,CAAC,GAED,KAAKxD,GAAO,iBAAiBkD,EAAe,OAAO,CAACC,MAAwBG,EAAwB,SAASH,CAAW,CAAC;AAAA,IAC1H,GAAG,EAAE,WAAW,IAAM,GAKnB,KAAKnD,GAAO,kBACfiD,EAAM,KAAKjD,GAAO,gBAAgB,CAACyD,MAAmB;AACrD,UAAI,CAACA,EAAe,OAAQ;AAG5B,MAAAA,EAAe,QAAQ,CAACC,GAAsBN,MAAkBK,EAAeL,CAAK,IAAIM,CAAY;AAGpG,YAAMC,IAA0B,CAAC,KAAK1D,GAAM,KAAK,KAAK,QAAQ,EAAE;AAChE,WAAKA,GAAM,KAAK,KAAK,QAAQ,YAAY,QAAQ,CAAC+C,MAAoB;AACrE,QAAIA,EAAW,MAAM,KAAGW,EAAwB,KAAKX,EAAW,EAAE;AAAA,MACnE,CAAC,GAED,KAAKhD,GAAO,iBAAiByD,EAAe,OAAO,CAACC,MAAyBC,EAAwB,SAASD,CAAY,CAAC;AAAA,IAC5H,GAAG,EAAE,WAAW,IAAM;AAAA,EAExB;AAED;AA+DA,MAAAE,IAAe,CAACC,MAAqC;;AACpD,QAAMrD,IAAUqD;AAGhB,EACC,GAAClD,IAAAH,EAAQ,QAAQ,oBAAhB,QAAAG,EAAiC,WAClC,GAACiC,IAAApC,EAAQ,QAAQ,oBAAhB,QAAAoC,EAAiC,WAClC,GAACE,IAAAtC,EAAQ,QAAQ,yBAAhB,QAAAsC,EAAsC,WACvC,GAACgB,IAAAtD,EAAQ,QAAQ,sBAAhB,QAAAsD,EAAmC,WAKrC,IAAIhE,EAASU,CAAO;AACrB;"}
|
package/package.json
CHANGED
|
@@ -48,8 +48,6 @@ declare global {
|
|
|
48
48
|
setOptions(options: Partial<Api.ClientRequestOptions>): this;
|
|
49
49
|
/**
|
|
50
50
|
* Выполнить обращение к методу API
|
|
51
|
-
*
|
|
52
|
-
* @remarks Плагины Open Api зарезервировали имена `call()` / `post()` и т.п. Поэтому используется `exec()`
|
|
53
51
|
*/
|
|
54
52
|
call<Fields extends ParamsFieldsNarrowed & FieldsNarrow>(fields?: Fields): Promise<RequestContext['UseExt'] extends true ? Api.Response<RequestContext, Fields> : Api.ResponseOriginal<RequestContext>>;
|
|
55
53
|
/**
|