File size: 59,083 Bytes
2ab515e |
1 2 3 4 5 6 7 8 9 10 11 |
import{b as ve,ah as Ve,ai as qe,f as D,i as m,u as h,k as I,l as d,n as q,e as E,c as T,t as re,d as v,j as R,h as ae,I as $e,m as ke,A as v4,ae as Ou,q as Ue,v as ru,w as H,r as Cu,y as du,F as Tu,B as le,z as D4,p as ue,x as se,H as w4,C as F4}from"../chunks/scheduler.5WtVptCO.js";import{S as Ce,i as De,a as w,g as Ie,f as Le,t as S,c as W,d as Y,m as Z,e as x,b as ne}from"../chunks/index.7IiDzEZn.js";import{S as A4,P as Vu,a as B4}from"../chunks/SearchResults.-e6N2daY.js";import{L as Pe,P as Me,H as xe,F as k4,b as S4,f as T4,T as qu,I as R4,S as y4,M as I4,U as Su,a as L4}from"../chunks/InvestigatorSettings.Y2o9I9Xj.js";import{e as Se}from"../chunks/each.C7pZUaX1.js";import{L as ju}from"../chunks/LogService.hUlSDADx.js";import{g as N4}from"../chunks/stores.Cb2RXlYi.js";import"../chunks/ProgressBar.svelte_svelte_type_style_lang.7yc35pDe.js";import{D as U4,S as Hu}from"../chunks/SearchUtils.dqpKCG0P.js";import{L as O4}from"../chunks/LlmSelector.Snki38ql.js";import{g as C4}from"../chunks/stores.XS_YoCyo.js";import{p as M4}from"../chunks/popup.dE7t2hhe.js";const P4=!1,Z0=Object.freeze(Object.defineProperty({__proto__:null,prerender:P4},Symbol.toStringTag,{value:"Module"}));function V4(l){let e,u,t,n,r,s,a;return{c(){e=Ve("svg"),u=Ve("circle"),t=Ve("animate"),n=Ve("circle"),r=Ve("animate"),s=Ve("circle"),a=Ve("animate"),this.h()},l(c){e=qe(c,"svg",{version:!0,id:!0,xmlns:!0,"xmlns:xlink":!0,x:!0,y:!0,viewBox:!0,"enable-background":!0,"xml:space":!0});var i=D(e);u=qe(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var o=D(u);t=qe(o,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(t).forEach(m),o.forEach(m),n=qe(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var f=D(n);r=qe(f,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(r).forEach(m),f.forEach(m),s=qe(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var p=D(s);a=qe(p,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(a).forEach(m),p.forEach(m),i.forEach(m),this.h()},h(){h(t,"attributeName","opacity"),h(t,"dur","1s"),h(t,"values","0;1;0"),h(t,"repeatCount","indefinite"),h(t,"begin","0.1"),h(u,"fill","#1976d2"),h(u,"stroke","none"),h(u,"cx","6"),h(u,"cy","50"),h(u,"r","6"),h(r,"attributeName","opacity"),h(r,"dur","1s"),h(r,"values","0;1;0"),h(r,"repeatCount","indefinite"),h(r,"begin","0.2"),h(n,"fill","#1976d2"),h(n,"stroke","none"),h(n,"cx","26"),h(n,"cy","50"),h(n,"r","6"),h(a,"attributeName","opacity"),h(a,"dur","1s"),h(a,"values","0;1;0"),h(a,"repeatCount","indefinite"),h(a,"begin","0.3"),h(s,"fill","#1976d2"),h(s,"stroke","none"),h(s,"cx","46"),h(s,"cy","50"),h(s,"r","6"),h(e,"version","1.1"),h(e,"id","L4"),h(e,"xmlns","http://www.w3.org/2000/svg"),h(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),h(e,"x","0px"),h(e,"y","0px"),h(e,"viewBox","0 0 100 100"),h(e,"enable-background","new 0 0 0 0"),h(e,"xml:space","preserve")},m(c,i){I(c,e,i),d(e,u),d(u,t),d(e,n),d(n,r),d(e,s),d(s,a)},p:q,i:q,o:q,d(c){c&&m(e)}}}function q4(l,e,u){let{size:t=20}=e;return l.$$set=n=>{"size"in n&&u(0,t=n.size)},[t]}class j4 extends Ce{constructor(e){super(),De(this,e,q4,V4,ve,{size:0})}}function H4(l){let e,u,t,n,r;return{c(){e=E("div"),u=Ve("svg"),t=Ve("circle"),n=T(),r=re(l[2]),this.h()},l(s){e=v(s,"DIV",{class:!0});var a=D(e);u=qe(a,"svg",{class:!0,viewBox:!0,xmlns:!0});var c=D(u);t=qe(c,"circle",{cx:!0,cy:!0,r:!0,fill:!0,style:!0}),D(t).forEach(m),c.forEach(m),n=R(a),r=ae(a,l[2]),a.forEach(m),this.h()},h(){h(t,"cx","10"),h(t,"cy","10"),h(t,"r","5"),h(t,"fill",l[0]),$e(t,"filter","drop-shadow(0 0 1px "+l[1]+")"),h(u,"class","dot svelte-1wcf73j"),h(u,"viewBox","0 0 20 20"),h(u,"xmlns","http://www.w3.org/2000/svg"),h(e,"class","llm-health-status w-40 inline-block svelte-1wcf73j")},m(s,a){I(s,e,a),d(e,u),d(u,t),d(e,n),d(e,r)},p(s,[a]){a&1&&h(t,"fill",s[0]),a&2&&$e(t,"filter","drop-shadow(0 0 1px "+s[1]+")"),a&4&&ke(r,s[2])},i:q,o:q,d(s){s&&m(e)}}}function z4(l,e,u){let{disableIntervalChecks:t=!1}=e,{llmName:n=""}=e,r="#af4f4c",s="#af4f4c",a="Сервис LLM недоступен",c=new AbortController;async function i(){const f=`${window.location.origin}/llm/health`;switch((await Pe.fetchHealthStatus(f,{llm:n},"Error fetching Llama health status",c))?.status){case"ok":u(0,r="#4CAF50"),u(1,s="rgba(0, 128, 0, 0.7)"),u(2,a="Сервис LLM работает");break;case"error":u(2,a="Сервис LLM не работает");break;case"loading model":u(0,r="yellow"),u(1,s="rgba(255, 255, 0, 0.7)"),u(2,a="Сервис LLM запускается...");break;case"unavailable":u(0,r="#af4f4c"),u(1,s="#af4f4c"),u(2,a="Сервис LLM не запущен");break;case"unknown":u(0,r="#af4f4c"),u(1,s="#af4f4c"),u(2,a="Сервис LLM недоступен");break}}let o;return v4(async()=>{i(),o=setInterval(async()=>{i()},3e4),t&&clearInterval(o)}),Ou(()=>{clearInterval(o),c.abort("user canceled"),c=new AbortController}),l.$$set=f=>{"disableIntervalChecks"in f&&u(3,t=f.disableIntervalChecks),"llmName"in f&&u(4,n=f.llmName)},[r,s,a,t,n]}class Q4 extends Ce{constructor(e){super(),De(this,e,z4,H4,ve,{disableIntervalChecks:3,llmName:4})}}function G4(l){let e,u,t,n,r;return{c(){e=E("div"),u=Ve("svg"),t=Ve("circle"),n=T(),r=re(l[2]),this.h()},l(s){e=v(s,"DIV",{class:!0});var a=D(e);u=qe(a,"svg",{class:!0,viewBox:!0,xmlns:!0});var c=D(u);t=qe(c,"circle",{cx:!0,cy:!0,r:!0,fill:!0,style:!0}),D(t).forEach(m),c.forEach(m),n=R(a),r=ae(a,l[2]),a.forEach(m),this.h()},h(){h(t,"cx","10"),h(t,"cy","10"),h(t,"r","5"),h(t,"fill",l[0]),$e(t,"filter","drop-shadow(0 0 1px "+l[1]+")"),h(u,"class","dot svelte-1wcf73j"),h(u,"viewBox","0 0 20 20"),h(u,"xmlns","http://www.w3.org/2000/svg"),h(e,"class","llm-health-status w-40 inline-block svelte-1wcf73j")},m(s,a){I(s,e,a),d(e,u),d(u,t),d(e,n),d(e,r)},p(s,[a]){a&1&&h(t,"fill",s[0]),a&2&&$e(t,"filter","drop-shadow(0 0 1px "+s[1]+")"),a&4&&ke(r,s[2])},i:q,o:q,d(s){s&&m(e)}}}function J4(l,e,u){let{disableIntervalChecks:t=!1}=e,n="#af4f4c",r="#af4f4c",s="Поиск недоступен",a=new AbortController;async function c(f,p){try{const A=await fetch(f,{method:"GET",headers:{"Content-Type":"application/json"},signal:a.signal});if(!A.ok)throw new Error(`${p}: ${A.statusText}`);return A.json()}catch(A){return console.error(p,A.message),null}}async function i(){const f=`${window.location.origin}/search/health`,p=await c(f,"Error fetching search health status");if(p)switch(p.status){case"ok":u(0,n="#4CAF50"),u(1,r="rgba(0, 128, 0, 0.7)"),u(2,s="Поиск работает");break;case"unavailable":u(0,n="#af4f4c"),u(1,r="#af4f4c"),u(2,s="Поиск не запущен");break;case"unknown":u(0,n="#af4f4c"),u(1,r="#af4f4c"),u(2,s="Поиск недоступен");break}}let o;return v4(async()=>{i(),o=setInterval(async()=>{i()},3e4),t&&clearInterval(o)}),Ou(()=>{clearInterval(o),a.abort("user canceled"),a=new AbortController}),l.$$set=f=>{"disableIntervalChecks"in f&&u(3,t=f.disableIntervalChecks)},[n,r,s,t]}class X4 extends Ce{constructor(e){super(),De(this,e,J4,G4,ve,{disableIntervalChecks:3})}}function K4(l){let e,u,t,n,r,s="Сохранить",a,c,i="Сбросить",o,f;return{c(){e=E("div"),u=E("div"),t=E("textarea"),n=T(),r=E("button"),r.textContent=s,a=T(),c=E("button"),c.textContent=i,this.h()},l(p){e=v(p,"DIV",{class:!0});var A=D(e);u=v(A,"DIV",{class:!0});var B=D(u);t=v(B,"TEXTAREA",{class:!0}),D(t).forEach(m),n=R(B),r=v(B,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(r)!=="svelte-g0hhac"&&(r.textContent=s),a=R(B),c=v(B,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(c)!=="svelte-16kemh0"&&(c.textContent=i),B.forEach(m),A.forEach(m),this.h()},h(){h(t,"class","svelte-sfudwy"),h(r,"class","svelte-sfudwy"),h(c,"class","svelte-sfudwy"),h(u,"class","popup svelte-sfudwy"),h(e,"class","modal svelte-sfudwy")},m(p,A){I(p,e,A),d(e,u),d(u,t),ru(t,l[0]),d(u,n),d(u,r),d(u,a),d(u,c),o||(f=[H(t,"input",l[6]),H(r,"click",l[1]),H(c,"click",l[2])],o=!0)},p(p,[A]){A&1&&ru(t,p[0])},i:q,o:q,d(p){p&&m(e),o=!1,Cu(f)}}}let W4='Ты бухгалтер. Ты отвечаешь на русском языке. Ты всегда следуешь моим инструкциям. Ты отвечаешь на вопросы клиентов. Чтобы ответить, ты обязательно используешь только "источники", которые я тебе предоставляю. Ты используешь только официально-деловой стиль и необходимую терминологию. Соблюдай этические нормы. При ответе на вопрос ты используешь только такой формат ответа: 1) Четкий и краткий ответ на поставленный вопрос. Ты можешь начать свой ответ так: "По Вашему вопросу сообщаем...". Используй по возможности слова: да, можно, нет, нельзя. 2) Обоснование (ты используешь для обоснования "источники". Ты используешь только "источники" для поиска необходимых "законов", "статей", "пунктов" и "подпунктов" для ответа на вопрос пользователя). 3) Аргументация (Ты используешь только "источники" для поиска необходимых "писем" и "судебных решений", чтобы аргументировать свой ответ)." 4) Заключение (ты подводишь итоги всего, что сказал выше. Избегай повторения и сложных конструкций). Если в источниках нельзя найти подходящую информацию для ответа, ты отвечаешь так: "Мы не можем ответить на данный вопрос. Обратитесь к специалисту." Вопрос: {{ВОПРОС}} Источники: {{ИСТОЧНИКИ}}';function Y4(l,e,u){let{onSave:t}=e,{onClose:n}=e,{text:r=""}=e,s=r;function a(){t(s),n()}function c(){u(0,s=W4)}function i(){s=this.value,u(0,s)}return l.$$set=o=>{"onSave"in o&&u(3,t=o.onSave),"onClose"in o&&u(4,n=o.onClose),"text"in o&&u(5,r=o.text)},[s,a,c,t,n,r,i]}class Z4 extends Ce{constructor(e){super(),De(this,e,Y4,K4,ve,{onSave:3,onClose:4,text:5})}}function zu(l,e,u){const t=l.slice();return t[6]=e[u],t}function Qu(l){let e,u=Se(l[3].split(`
`)),t=[];for(let n=0;n<u.length;n+=1)t[n]=Gu(zu(l,u,n));return{c(){e=E("div");for(let n=0;n<t.length;n+=1)t[n].c();this.h()},l(n){e=v(n,"DIV",{class:!0});var r=D(e);for(let s=0;s<t.length;s+=1)t[s].l(r);r.forEach(m),this.h()},h(){h(e,"class","annotation svelte-1uvb5ib")},m(n,r){I(n,e,r);for(let s=0;s<t.length;s+=1)t[s]&&t[s].m(e,null)},p(n,r){if(r&8){u=Se(n[3].split(`
`));let s;for(s=0;s<u.length;s+=1){const a=zu(n,u,s);t[s]?t[s].p(a,r):(t[s]=Gu(a),t[s].c(),t[s].m(e,null))}for(;s<t.length;s+=1)t[s].d(1);t.length=u.length}},d(n){n&&m(e),du(t,n)}}}function Gu(l){let e,u=l[6]+"",t;return{c(){e=E("p"),t=re(u),this.h()},l(n){e=v(n,"P",{class:!0});var r=D(e);t=ae(r,u),r.forEach(m),this.h()},h(){h(e,"class","mt-3 mb-3")},m(n,r){I(n,e,r),d(e,t)},p(n,r){r&8&&u!==(u=n[6]+"")&&ke(t,u)},d(n){n&&m(e)}}}function x4(l){let e,u,t,n,r,s,a,c=l[0][l[1]]&&Qu(l);return{c(){e=E("div"),u=E("div"),t=E("button"),n=re(l[2]),r=T(),c&&c.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);t=v(f,"BUTTON",{class:!0});var p=D(t);n=ae(p,l[2]),p.forEach(m),f.forEach(m),r=R(o),c&&c.l(o),o.forEach(m),this.h()},h(){h(t,"class","btn-link ml-3 text-left"),h(u,"class","font-bold"),h(e,"class","mb-5")},m(i,o){I(i,e,o),d(e,u),d(u,t),d(t,n),d(e,r),c&&c.m(e,null),s||(a=H(t,"click",l[5]),s=!0)},p(i,[o]){o&4&&ke(n,i[2]),i[0][i[1]]?c?c.p(i,o):(c=Qu(i),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:q,o:q,d(i){i&&m(e),c&&c.d(),s=!1,a()}}}function $4(l,e,u){let{showFullText:t=Array(10).fill(!1)}=e,{index:n}=e,{title:r}=e,{text:s}=e;function a(i){u(0,t[i]=!t[i],t)}const c=()=>a(n);return l.$$set=i=>{"showFullText"in i&&u(0,t=i.showFullText),"index"in i&&u(1,n=i.index),"title"in i&&u(2,r=i.title),"text"in i&&u(3,s=i.text)},[t,n,r,s,a,c]}class e0 extends Ce{constructor(e){super(),De(this,e,$4,x4,ve,{showFullText:0,index:1,title:2,text:3})}}function Ju(l,e,u){const t=l.slice();return t[3]=e[u].title,t[4]=e[u].text,t[6]=u,t}function Xu(l){let e,u;return e=new e0({props:{title:l[3],text:l[4],index:l[6],showFullText:l[1]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&1&&(r.title=t[3]),n&1&&(r.text=t[4]),n&2&&(r.showFullText=t[1]),e.$set(r)},i(t){u||(w(e.$$.fragment,t),u=!0)},o(t){S(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function u0(l){let e,u,t="Консультации",n,r,s=Se(l[0]),a=[];for(let i=0;i<s.length;i+=1)a[i]=Xu(Ju(l,s,i));const c=i=>S(a[i],1,1,()=>{a[i]=null});return{c(){e=E("div"),u=E("h2"),u.textContent=t,n=T();for(let i=0;i<a.length;i+=1)a[i].c();this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"H2",{class:!0,style:!0,"data-svelte-h":!0}),Ue(u)!=="svelte-bhrtd7"&&(u.textContent=t),n=R(o);for(let f=0;f<a.length;f+=1)a[f].l(o);o.forEach(m),this.h()},h(){h(u,"class","w-full p-5 space-y-2 mb-3 text-lg"),$e(u,"border-bottom","2px solid #ccc"),$e(u,"border-top","2px solid #ccc"),h(e,"class","flex-1 overflow-y-auto p-4")},m(i,o){I(i,e,o),d(e,u),d(e,n);for(let f=0;f<a.length;f+=1)a[f]&&a[f].m(e,null);r=!0},p(i,[o]){if(o&3){s=Se(i[0]);let f;for(f=0;f<s.length;f+=1){const p=Ju(i,s,f);a[f]?(a[f].p(p,o),w(a[f],1)):(a[f]=Xu(p),a[f].c(),w(a[f],1),a[f].m(e,null))}for(Ie(),f=s.length;f<a.length;f+=1)c(f);Le()}},i(i){if(!r){for(let o=0;o<s.length;o+=1)w(a[o]);r=!0}},o(i){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)S(a[o]);r=!1},d(i){i&&m(e),du(a,i)}}}function t0(l,e,u){let t=Array(10).fill(!1),{consultations:n=[]}=e,r=[];return l.$$set=s=>{"consultations"in s&&u(0,n=s.consultations)},l.$$.update=()=>{l.$$.dirty&5&&n!==r&&(u(1,t=Array(n.length).fill(!1)),u(2,r=n))},[n,t,r]}class l0 extends Ce{constructor(e){super(),De(this,e,t0,u0,ve,{consultations:0})}}function s0(l){let e,u,t,n;return{c(){e=E("div"),u=E("textarea"),this.h()},l(r){e=v(r,"DIV",{class:!0});var s=D(e);u=v(s,"TEXTAREA",{rows:!0,placeholder:!0,class:!0}),D(u).forEach(m),s.forEach(m),this.h()},h(){h(u,"rows","3"),h(u,"placeholder","Уточнение для LLM"),h(u,"class","svelte-3qvypm"),h(e,"class","w-full flex p-2 space-x-2")},m(r,s){I(r,e,s),d(e,u),ru(u,l[0]),t||(n=H(u,"input",l[1]),t=!0)},p(r,[s]){s&1&&ru(u,r[0])},i:q,o:q,d(r){r&&m(e),t=!1,n()}}}function n0(l,e,u){let{llmClarification:t=""}=e;function n(){t=this.value,u(0,t)}return l.$$set=r=>{"llmClarification"in r&&u(0,t=r.llmClarification)},[t,n]}class r0 extends Ce{constructor(e){super(),De(this,e,n0,s0,ve,{llmClarification:0})}}function a0(l){let e;return{c(){e=re(l[0])},l(u){e=ae(u,l[0])},m(u,t){I(u,e,t)},p(u,t){t&1&&ke(e,u[0])},d(u){u&&m(e)}}}function i0(l){let e,u,t;return{c(){e=E("a"),u=re(l[0]),this.h()},l(n){e=v(n,"A",{href:!0,target:!0,class:!0});var r=D(e);u=ae(r,l[0]),r.forEach(m),this.h()},h(){h(e,"href",t=l[2]+"file/download/name/"+encodeURIComponent(l[0])),h(e,"target","_blank"),h(e,"class","svelte-1ijmx03")},m(n,r){I(n,e,r),d(e,u)},p(n,r){r&1&&ke(u,n[0]),r&5&&t!==(t=n[2]+"file/download/name/"+encodeURIComponent(n[0]))&&h(e,"href",t)},d(n){n&&m(e)}}}function o0(l){let e,u,t,n,r;function s(i,o){return i[1]&&i[2]?i0:a0}let a=s(l),c=a(l);return{c(){e=E("div"),u=E("div"),c.c(),t=T(),n=E("div"),r=re(l[3]),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);c.l(f),f.forEach(m),t=R(o),n=v(o,"DIV",{});var p=D(n);r=ae(p,l[3]),p.forEach(m),o.forEach(m),this.h()},h(){h(u,"class","title svelte-1ijmx03"),h(e,"class","search-result svelte-1ijmx03")},m(i,o){I(i,e,o),d(e,u),c.m(u,null),d(e,t),d(e,n),d(n,r)},p(i,[o]){a===(a=s(i))&&c?c.p(i,o):(c.d(1),c=a(i),c&&(c.c(),c.m(u,null))),o&8&&ke(r,i[3])},i:q,o:q,d(i){i&&m(e),c.d()}}}function c0(l,e,u){let{title:t}=e,{enableDocumentDb:n=!1}=e,{documentDbUrl:r=""}=e,{source:s=""}=e;return l.$$set=a=>{"title"in a&&u(0,t=a.title),"enableDocumentDb"in a&&u(1,n=a.enableDocumentDb),"documentDbUrl"in a&&u(2,r=a.documentDbUrl),"source"in a&&u(3,s=a.source)},[t,n,r,s]}class f0 extends Ce{constructor(e){super(),De(this,e,c0,o0,ve,{title:0,enableDocumentDb:1,documentDbUrl:2,source:3})}}function Ku(l,e,u){const t=l.slice();return t[3]=e[u],t}function Wu(l){let e,u;return e=new f0({props:{title:l[3],enableDocumentDb:l[0],documentDbUrl:l[1],source:l[2][l[3]]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&4&&(r.title=t[3]),n&1&&(r.enableDocumentDb=t[0]),n&2&&(r.documentDbUrl=t[1]),n&4&&(r.source=t[2][t[3]]),e.$set(r)},i(t){u||(w(e.$$.fragment,t),u=!0)},o(t){S(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function h0(l){let e,u,t,n,r=Se(Object.keys(l[2])),s=[];for(let i=0;i<r.length;i+=1)s[i]=Wu(Ku(l,r,i));const a=i=>S(s[i],1,1,()=>{s[i]=null});let c=m0;return{c(){e=E("div");for(let i=0;i<s.length;i+=1)s[i].c();u=T(),t=Tu(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);for(let f=0;f<s.length;f+=1)s[f].l(o);o.forEach(m),u=R(i),t=Tu(),this.h()},h(){h(e,"class","search-results svelte-14obzoi")},m(i,o){I(i,e,o);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(e,null);I(i,u,o),I(i,t,o),n=!0},p(i,[o]){if(o&7){r=Se(Object.keys(i[2]));let f;for(f=0;f<r.length;f+=1){const p=Ku(i,r,f);s[f]?(s[f].p(p,o),w(s[f],1)):(s[f]=Wu(p),s[f].c(),w(s[f],1),s[f].m(e,null))}for(Ie(),f=r.length;f<s.length;f+=1)a(f);Le()}},i(i){if(!n){for(let o=0;o<r.length;o+=1)w(s[o]);w(c),n=!0}},o(i){s=s.filter(Boolean);for(let o=0;o<s.length;o+=1)S(s[o]);S(c),n=!1},d(i){i&&(m(e),m(u),m(t)),du(s,i)}}}let m0=!1;function d0(l,e,u){let{enableDocumentDb:t=!1}=e,{documentDbUrl:n=""}=e,{transactionMaps:r={}}=e;return l.$$set=s=>{"enableDocumentDb"in s&&u(0,t=s.enableDocumentDb),"documentDbUrl"in s&&u(1,n=s.documentDbUrl),"transactionMaps"in s&&u(2,r=s.transactionMaps)},[t,n,r]}class p0 extends Ce{constructor(e){super(),De(this,e,d0,h0,ve,{enableDocumentDb:0,documentDbUrl:1,transactionMaps:2})}}const{saveAs:_0}=T4;class g0{static createDocxFromObject(e){const u=[],t=c=>c.replace(/[^\r\n\u0020-\u007E\u00A0-\uFFFF]/g,"").replace(/<[^>]*>/g,""),n=c=>t(c).split(`
`).map(i=>new Me({children:[new qu({text:i,font:"Calibri"})],spacing:{line:276}})),r=c=>[{label:"Выбрать источники для LLM",value:c.enableSearchResultSelection},{label:"Использовать расширенный поиск",value:c.enableQueryExpansionSearch},{label:"Использовать многоступенчатый поиск",value:c.enableOlympicSearch},{label:"Карты проводок по вопросу",value:c.searchInTransactionLedgerByQuestion}].map(o=>new Me({children:[new qu({text:`${t(o.label)}: ${o.value?"да":"нет"}`,font:"Calibri"})],spacing:{line:276}}));u.push(new Me({text:"Вопрос:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...n(e.userRequest)),u.push(new Me({text:"Ответ системы:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...n(e.llmResponse)),e.searchResults.length>0&&(u.push(new Me({text:"Найденные источники:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.searchResults.forEach(c=>{u.push(new Me({text:t(c.title),heading:xe.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(c.text))})),e.consultations.length>0&&(u.push(new Me({text:"Найденные консультации:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.consultations.forEach(c=>{const i=JSON.parse(c);u.push(new Me({text:t(i.title),heading:xe.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(i.text))})),e.explanations.length>0&&(u.push(new Me({text:"Релевантные разъяснения:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.explanations.forEach(c=>{const i=JSON.parse(c);u.push(new Me({text:t(i.title),heading:xe.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(i.text))})),u.push(new Me({text:"Параметры запроса:",heading:xe.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...r(e.uiSettings));const s=new k4({sections:[{properties:{},children:u}]}),a=()=>{const c=new Date,i=c.toISOString().slice(0,10),o=c.toTimeString().slice(0,8).replace(/:/g,"-");return`Document_${i}_${o}.docx`};S4.toBlob(s).then(c=>{_0(c,a())})}}function Yu(l,e,u){const t=l.slice();return t[18]=e[u],t[20]=u,t}function Zu(l){let e,u,t,n,r;function s(){return l[10](l[20])}function a(){return l[11](l[20])}function c(){return l[12](l[20])}return{c(){e=E("button"),u=re(`★\r
`),this.h()},l(i){e=v(i,"BUTTON",{class:!0});var o=D(e);u=ae(o,`★\r
`),o.forEach(m),this.h()},h(){h(e,"class",t="star "+(l[1]>=l[20]+1||l[0]>=l[20]+1?"selected":"")+" svelte-zykxm3")},m(i,o){I(i,e,o),d(e,u),n||(r=[H(e,"click",s),H(e,"mouseover",a),H(e,"focus",c)],n=!0)},p(i,o){l=i,o&3&&t!==(t="star "+(l[1]>=l[20]+1||l[0]>=l[20]+1?"selected":"")+" svelte-zykxm3")&&h(e,"class",t)},d(i){i&&m(e),n=!1,Cu(r)}}}function b0(l){let e,u,t="Оцените ответ:",n,r,s,a,c,i,o,f,p,A,B,O=Se(Array(5)),U=[];for(let F=0;F<O.length;F+=1)U[F]=Zu(Yu(l,O,F));return{c(){e=E("div"),u=E("span"),u.textContent=t,n=T(),r=E("div");for(let F=0;F<U.length;F+=1)U[F].c();s=T(),a=E("textarea"),i=T(),o=E("button"),f=re(l[4]),this.h()},l(F){e=v(F,"DIV",{});var g=D(e);u=v(g,"SPAN",{"data-svelte-h":!0}),Ue(u)!=="svelte-9pssby"&&(u.textContent=t),n=R(g),r=v(g,"DIV",{class:!0,role:!0});var _=D(r);for(let k=0;k<U.length;k+=1)U[k].l(_);_.forEach(m),s=R(g),a=v(g,"TEXTAREA",{rows:!0,placeholder:!0,class:!0}),D(a).forEach(m),i=R(g),o=v(g,"BUTTON",{class:!0});var y=D(o);f=ae(y,l[4]),y.forEach(m),g.forEach(m),this.h()},h(){h(r,"class","star-rating svelte-zykxm3"),h(r,"role","none"),h(a,"rows","3"),h(a,"placeholder","Комментарий"),a.disabled=c=l[0]===0,h(a,"class","textarea bg-white p-1 svelte-zykxm3"),h(o,"class","btn variant-form-material svelte-zykxm3"),o.disabled=p=l[0]===0||l[3]},m(F,g){I(F,e,g),d(e,u),d(e,n),d(e,r);for(let _=0;_<U.length;_+=1)U[_]&&U[_].m(r,null);d(e,s),d(e,a),ru(a,l[2]),d(e,i),d(e,o),d(o,f),A||(B=[H(r,"mouseleave",l[7]),H(a,"input",l[13]),H(o,"click",l[8])],A=!0)},p(F,[g]){if(g&99){O=Se(Array(5));let _;for(_=0;_<O.length;_+=1){const y=Yu(F,O,_);U[_]?U[_].p(y,g):(U[_]=Zu(y),U[_].c(),U[_].m(r,null))}for(;_<U.length;_+=1)U[_].d(1);U.length=O.length}g&1&&c!==(c=F[0]===0)&&(a.disabled=c),g&4&&ru(a,F[2]),g&16&&ke(f,F[4]),g&9&&p!==(p=F[0]===0||F[3])&&(o.disabled=p)},i:q,o:q,d(F){F&&m(e),du(U,F),A=!1,Cu(B)}}}function E0(l,e,u){const t={message:"Спасибо за оценку!",timeout:5e3},n=N4();let r=0,{onSubmit:s=function(k){}}=e,a=0,c="",i=!1,o="Отправить";function f(k){u(0,r=k)}function p(k){u(1,a=k)}function A(){u(1,a=0)}async function B(){r>0&&(s&&(U(),await s({rating:r,comment:c})),O(),n.trigger(t))}function O(){u(0,r=0),u(2,c=""),u(3,i=!1),u(4,o="Отправить")}function U(){u(3,i=!0),u(4,o="Отправляем...")}const F=k=>f(k+1),g=k=>p(k+1),_=k=>p(k+1);function y(){c=this.value,u(2,c)}return l.$$set=k=>{"onSubmit"in k&&u(9,s=k.onSubmit)},[r,a,c,i,o,f,p,A,B,s,F,g,_,y]}class v0 extends Ce{constructor(e){super(),De(this,e,E0,b0,ve,{onSubmit:9})}}function C0(l){let e,u="Настроить поиск",t,n;return{c(){e=E("button"),e.textContent=u,this.h()},l(r){e=v(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(e)!=="svelte-1np4oyj"&&(e.textContent=u),this.h()},h(){h(e,"class","btn variant-outline-tertiary")},m(r,s){I(r,e,s),t||(n=H(e,"click",l[0]),t=!0)},p:q,i:q,o:q,d(r){r&&m(e),t=!1,n()}}}function D0(l,e,u){const t=C4();let{llmParams:n}=e;function r(){console.log("openModal",n);const s={type:"component",title:"Настройки поиска",component:"searchSettingsModal",meta:n,response:a=>{u(1,n=a)}};t.trigger(s)}return l.$$set=s=>{"llmParams"in s&&u(1,n=s.llmParams)},[r,n]}class w0 extends Ce{constructor(e){super(),De(this,e,D0,C0,ve,{llmParams:1})}}function xu(l,e,u){const t=l.slice();return t[6]=e[u],t}function $u(l){let e,u=Se(l[3].split(`
`)),t=[];for(let n=0;n<u.length;n+=1)t[n]=e4(xu(l,u,n));return{c(){e=E("div");for(let n=0;n<t.length;n+=1)t[n].c();this.h()},l(n){e=v(n,"DIV",{class:!0});var r=D(e);for(let s=0;s<t.length;s+=1)t[s].l(r);r.forEach(m),this.h()},h(){h(e,"class","annotation svelte-1uvb5ib")},m(n,r){I(n,e,r);for(let s=0;s<t.length;s+=1)t[s]&&t[s].m(e,null)},p(n,r){if(r&8){u=Se(n[3].split(`
`));let s;for(s=0;s<u.length;s+=1){const a=xu(n,u,s);t[s]?t[s].p(a,r):(t[s]=e4(a),t[s].c(),t[s].m(e,null))}for(;s<t.length;s+=1)t[s].d(1);t.length=u.length}},d(n){n&&m(e),du(t,n)}}}function e4(l){let e,u=l[6]+"",t;return{c(){e=E("p"),t=re(u),this.h()},l(n){e=v(n,"P",{class:!0});var r=D(e);t=ae(r,u),r.forEach(m),this.h()},h(){h(e,"class","mt-3 mb-3")},m(n,r){I(n,e,r),d(e,t)},p(n,r){r&8&&u!==(u=n[6]+"")&&ke(t,u)},d(n){n&&m(e)}}}function F0(l){let e,u,t,n,r,s,a,c=l[0][l[1]]&&$u(l);return{c(){e=E("div"),u=E("div"),t=E("button"),n=re(l[2]),r=T(),c&&c.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);t=v(f,"BUTTON",{class:!0});var p=D(t);n=ae(p,l[2]),p.forEach(m),f.forEach(m),r=R(o),c&&c.l(o),o.forEach(m),this.h()},h(){h(t,"class","btn-link ml-3 text-left"),h(u,"class","font-bold"),h(e,"class","mb-5")},m(i,o){I(i,e,o),d(e,u),d(u,t),d(t,n),d(e,r),c&&c.m(e,null),s||(a=H(t,"click",l[5]),s=!0)},p(i,[o]){o&4&&ke(n,i[2]),i[0][i[1]]?c?c.p(i,o):(c=$u(i),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:q,o:q,d(i){i&&m(e),c&&c.d(),s=!1,a()}}}function A0(l,e,u){let{showFullText:t=Array(10).fill(!1)}=e,{index:n}=e,{title:r}=e,{text:s}=e;function a(i){u(0,t[i]=!t[i],t)}const c=()=>a(n);return l.$$set=i=>{"showFullText"in i&&u(0,t=i.showFullText),"index"in i&&u(1,n=i.index),"title"in i&&u(2,r=i.title),"text"in i&&u(3,s=i.text)},[t,n,r,s,a,c]}class B0 extends Ce{constructor(e){super(),De(this,e,A0,F0,ve,{showFullText:0,index:1,title:2,text:3})}}function u4(l,e,u){const t=l.slice();return t[3]=e[u].title,t[4]=e[u].text,t[6]=u,t}function t4(l){let e,u;return e=new B0({props:{title:l[3],text:l[4],index:l[6],showFullText:l[1]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&1&&(r.title=t[3]),n&1&&(r.text=t[4]),n&2&&(r.showFullText=t[1]),e.$set(r)},i(t){u||(w(e.$$.fragment,t),u=!0)},o(t){S(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function k0(l){let e,u,t="Разъяснения",n,r,s=Se(l[0]),a=[];for(let i=0;i<s.length;i+=1)a[i]=t4(u4(l,s,i));const c=i=>S(a[i],1,1,()=>{a[i]=null});return{c(){e=E("div"),u=E("h2"),u.textContent=t,n=T();for(let i=0;i<a.length;i+=1)a[i].c();this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"H2",{class:!0,style:!0,"data-svelte-h":!0}),Ue(u)!=="svelte-81a5qt"&&(u.textContent=t),n=R(o);for(let f=0;f<a.length;f+=1)a[f].l(o);o.forEach(m),this.h()},h(){h(u,"class","w-full p-5 space-y-2 mb-3 text-lg"),$e(u,"border-bottom","2px solid #ccc"),$e(u,"border-top","2px solid #ccc"),h(e,"class","flex-1 overflow-y-auto p-4")},m(i,o){I(i,e,o),d(e,u),d(e,n);for(let f=0;f<a.length;f+=1)a[f]&&a[f].m(e,null);r=!0},p(i,[o]){if(o&3){s=Se(i[0]);let f;for(f=0;f<s.length;f+=1){const p=u4(i,s,f);a[f]?(a[f].p(p,o),w(a[f],1)):(a[f]=t4(p),a[f].c(),w(a[f],1),a[f].m(e,null))}for(Ie(),f=s.length;f<a.length;f+=1)c(f);Le()}},i(i){if(!r){for(let o=0;o<s.length;o+=1)w(a[o]);r=!0}},o(i){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)S(a[o]);r=!1},d(i){i&&m(e),du(a,i)}}}function S0(l,e,u){let t=Array(10).fill(!1),{explanations:n=[]}=e,r=[];return l.$$set=s=>{"explanations"in s&&u(0,n=s.explanations)},l.$$.update=()=>{l.$$.dirty&5&&n!==r&&(u(1,t=Array(n.length).fill(!1)),u(2,r=n))},[n,t,r]}class T0 extends Ce{constructor(e){super(),De(this,e,S0,k0,ve,{explanations:0})}}function l4(l,e,u){const t=l.slice();return t[8]=e[u][0],t[9]=e[u][1],t[10]=e,t[11]=u,t}function s4(l){let e,u,t,n,r=l[9]+"",s,a,c,i;function o(){l[6].call(u,l[8])}return{c(){e=E("label"),u=E("input"),t=T(),n=E("p"),s=re(r),a=T(),this.h()},l(f){e=v(f,"LABEL",{class:!0});var p=D(e);u=v(p,"INPUT",{class:!0,type:!0}),t=R(p),n=v(p,"P",{});var A=D(n);s=ae(A,r),A.forEach(m),a=R(p),p.forEach(m),this.h()},h(){h(u,"class","checkbox accent-white"),h(u,"type","checkbox"),u.disabled=l[1],h(e,"class","flex items-center space-x-2")},m(f,p){I(f,e,p),d(e,u),u.checked=l[0][l[8]],d(e,t),d(e,n),d(n,s),d(e,a),c||(i=H(u,"change",o),c=!0)},p(f,p){l=f,p&2&&(u.disabled=l[1]),p&17&&(u.checked=l[0][l[8]])},d(f){f&&m(e),c=!1,i()}}}function R0(l){let e,u,t,n,r,s,a,c,i,o=Se(Object.entries(l[4])),f=[];for(let p=0;p<o.length;p+=1)f[p]=s4(l4(l,o,p));return{c(){e=E("button"),u=re(l[3]),t=T(),n=E("i"),r=T(),s=E("div"),a=E("div");for(let p=0;p<f.length;p+=1)f[p].c();this.h()},l(p){e=v(p,"BUTTON",{class:!0});var A=D(e);u=ae(A,l[3]),t=R(A),n=v(A,"I",{class:!0}),D(n).forEach(m),A.forEach(m),r=R(p),s=v(p,"DIV",{class:!0,"data-popup":!0});var B=D(s);a=v(B,"DIV",{});var O=D(a);for(let U=0;U<f.length;U+=1)f[U].l(O);O.forEach(m),B.forEach(m),this.h()},h(){h(n,"class","fa-solid fa-angle-down ml-1"),h(e,"class","chip variant-soft-primary flex items-center min-w-64"),le(e,"variant-soft-error",l[2]),h(s,"class","card p-4 w-150 shadow-xl z-10"),h(s,"data-popup","popupFeatured")},m(p,A){I(p,e,A),d(e,u),d(e,t),d(e,n),I(p,r,A),I(p,s,A),d(s,a);for(let B=0;B<f.length;B+=1)f[B]&&f[B].m(a,null);c||(i=D4(M4.call(null,e,l[5])),c=!0)},p(p,[A]){if(A&8&&ke(u,p[3]),A&4&&le(e,"variant-soft-error",p[2]),A&19){o=Se(Object.entries(p[4]));let B;for(B=0;B<o.length;B+=1){const O=l4(p,o,B);f[B]?f[B].p(O,A):(f[B]=s4(O),f[B].c(),f[B].m(a,null))}for(;B<f.length;B+=1)f[B].d(1);f.length=o.length}},i:q,o:q,d(p){p&&(m(e),m(r),m(s)),du(f,p),c=!1,i()}}}function n4(l,e,u,t){const n=l%10,r=l%100;return r>=11&&r<=19?t:n===1?e:n>=2&&n<=4?u:t}function y0(l,e,u){let t,{disabled:n=!1}=e,{selected:r={НКРФ:!1,ГКРФ:!1,ТКРФ:!1,"Федеральный закон":!1,"Письмо Минфина":!1,"Письмо ФНС":!1,"Приказ ФНС":!1,"Постановление Правительства":!1,"Судебный документ":!1,ВНД:!1,"Бухгалтерский документ":!1}}=e;C4();let s={НКРФ:"НК РФ",ГКРФ:"ГК РФ",ТКРФ:"ТК РФ","Федеральный закон":"Федеральный Закон","Письмо Минфина":"Письмо Минфина","Письмо ФНС":"Письмо ФНС","Приказ ФНС":"Приказ ФНС","Постановление Правительства":"Постановление Правительства","Судебный документ":"Судебный документ",ВНД:"ВНД","Бухгалтерский документ":"ФСБУ"};const a={event:"click",target:"popupFeatured",placement:"bottom",middleware:{flip:{mainAxis:!1}}};let c="Выбрать типы источников для поиска";function i(o){r[o]=this.checked,u(0,r)}return l.$$set=o=>{"disabled"in o&&u(1,n=o.disabled),"selected"in o&&u(0,r=o.selected)},l.$$.update=()=>{l.$$.dirty&1&&u(2,t=Object.values(r).filter(o=>o===!0).length),l.$$.dirty&4&&u(3,c=t>0?`${n4(t,"Выбран","Выбрано","Выбрано")} ${t} ${n4(t,"тип","типа","типов")} источников`:"Выбрать типы источников для поиска")},[r,n,t,c,s,a,i]}class I0 extends Ce{constructor(e){super(),De(this,e,y0,R0,ve,{disabled:1,selected:0})}}function r4(l){let e,u,t;function n(s){l[51](s)}let r={};return l[20]!==void 0&&(r.llmParams=l[20]),e=new w0({props:r}),ue.push(()=>ne(e,"llmParams",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&1048576&&(u=!0,c.llmParams=s[20],se(()=>u=!1)),e.$set(c)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){S(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function a4(l){let e,u,t,n;function r(a){l[53](a)}let s={};return l[0].investigatorSettings!==void 0&&(s.settings=l[0].investigatorSettings),u=new R4({props:s}),ue.push(()=>ne(u,"settings",r)),{c(){e=E("div"),W(u.$$.fragment),this.h()},l(a){e=v(a,"DIV",{class:!0});var c=D(e);Y(u.$$.fragment,c),c.forEach(m),this.h()},h(){h(e,"class","inline-block"),le(e,"hidden",!l[0].useInvestigator)},m(a,c){I(a,e,c),Z(u,e,null),n=!0},p(a,c){const i={};!t&&c[0]&1&&(t=!0,i.settings=a[0].investigatorSettings,se(()=>t=!1)),u.$set(i),(!n||c[0]&1)&&le(e,"hidden",!a[0].useInvestigator)},i(a){n||(w(u.$$.fragment,a),n=!0)},o(a){S(u.$$.fragment,a),n=!1},d(a){a&&m(e),x(u)}}}function i4(l){let e,u,t,n;function r(c){l[55](c)}function s(c){l[56](c)}let a={};return l[0].useInvestigator!==void 0&&(a.use_olympic=l[0].useInvestigator),l[19]!==void 0&&(a.use_qe=l[19]),e=new y4({props:a}),ue.push(()=>ne(e,"use_olympic",r)),ue.push(()=>ne(e,"use_qe",s)),{c(){W(e.$$.fragment)},l(c){Y(e.$$.fragment,c)},m(c,i){Z(e,c,i),n=!0},p(c,i){const o={};!u&&i[0]&1&&(u=!0,o.use_olympic=c[0].useInvestigator,se(()=>u=!1)),!t&&i[0]&524288&&(t=!0,o.use_qe=c[19],se(()=>t=!1)),e.$set(o)},i(c){n||(w(e.$$.fragment,c),n=!0)},o(c){S(e.$$.fragment,c),n=!1},d(c){x(e,c)}}}function o4(l){let e,u='<i class="fa-solid fa-check"></i>';return{c(){e=E("span"),e.innerHTML=u},l(t){e=v(t,"SPAN",{"data-svelte-h":!0}),Ue(e)!=="svelte-104b754"&&(e.innerHTML=u)},m(t,n){I(t,e,n)},d(t){t&&m(e)}}}function c4(l){let e,u,t,n,r,s;return r=new j4({}),{c(){e=E("div"),u=re(l[14]),t=T(),n=E("div"),W(r.$$.fragment),this.h()},l(a){e=v(a,"DIV",{class:!0});var c=D(e);u=ae(c,l[14]),c.forEach(m),t=R(a),n=v(a,"DIV",{class:!0});var i=D(n);Y(r.$$.fragment,i),i.forEach(m),this.h()},h(){h(e,"class","loading-status svelte-fiifsz"),h(n,"class","loading-container svelte-fiifsz")},m(a,c){I(a,e,c),d(e,u),I(a,t,c),I(a,n,c),Z(r,n,null),s=!0},p(a,c){(!s||c[0]&16384)&&ke(u,a[14])},i(a){s||(w(r.$$.fragment,a),s=!0)},o(a){S(r.$$.fragment,a),s=!1},d(a){a&&(m(e),m(t),m(n)),x(r)}}}function f4(l){let e,u;return e=new Z4({props:{onSave:l[37],onClose:l[38],text:l[9]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n[0]&512&&(r.text=t[9]),e.$set(r)},i(t){u||(w(e.$$.fragment,t),u=!0)},o(t){S(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function h4(l){let e,u,t,n;function r(a){l[61](a)}let s={enableDocumentDb:l[32],documentDbUrl:l[31]};return l[13]!==void 0&&(s.transactionMaps=l[13]),u=new p0({props:s}),ue.push(()=>ne(u,"transactionMaps",r)),{c(){e=E("div"),W(u.$$.fragment),this.h()},l(a){e=v(a,"DIV",{class:!0});var c=D(e);Y(u.$$.fragment,c),c.forEach(m),this.h()},h(){h(e,"class","search-column svelte-fiifsz")},m(a,c){I(a,e,c),Z(u,e,null),n=!0},p(a,c){const i={};!t&&c[0]&8192&&(t=!0,i.transactionMaps=a[13],se(()=>t=!1)),u.$set(i)},i(a){n||(w(u.$$.fragment,a),n=!0)},o(a){S(u.$$.fragment,a),n=!1},d(a){a&&m(e),x(u)}}}function m4(l){let e,u='<div class="alert-message"><p>Не могу предоставить консультацию по вашему вопросу, т.к. поиск ничего не нашел.</p> <p>Пожалуйста, попробуйте переформулировать запрос.</p></div>';return{c(){e=E("aside"),e.innerHTML=u,this.h()},l(t){e=v(t,"ASIDE",{class:!0,style:!0,"data-svelte-h":!0}),Ue(e)!=="svelte-1jj0c90"&&(e.innerHTML=u),this.h()},h(){h(e,"class","alert variant-filled"),$e(e,"margin","1rem")},m(t,n){I(t,e,n)},d(t){t&&m(e)}}}function d4(l){let e,u,t,n,r,s,a,c,i;function o(g){l[63](g)}function f(g){l[64](g)}function p(g){l[65](g)}function A(g){l[66](g)}function B(g){l[67](g)}function O(g){l[68](g)}function U(g){l[69](g)}let F={enableDocumentDb:l[32],documentDbUrl:l[31]};return l[0].search.searchResults!==void 0&&(F.searchResults=l[0].search.searchResults),l[11]!==void 0&&(F.usedSearchResults=l[11]),l[15]!==void 0&&(F.showFullText=l[15]),l[16]!==void 0&&(F.useSearchResult=l[16]),l[17]!==void 0&&(F.enableSearchResultSelection=l[17]),l[18]!==void 0&&(F.searchInTransactionLedger=l[18]),l[28]!==void 0&&(F.showOnlyLlmUsed=l[28]),e=new B4({props:F}),l[62](e),ue.push(()=>ne(e,"searchResults",o)),ue.push(()=>ne(e,"usedSearchResults",f)),ue.push(()=>ne(e,"showFullText",p)),ue.push(()=>ne(e,"useSearchResult",A)),ue.push(()=>ne(e,"enableSearchResultSelection",B)),ue.push(()=>ne(e,"searchInTransactionLedger",O)),ue.push(()=>ne(e,"showOnlyLlmUsed",U)),{c(){W(e.$$.fragment)},l(g){Y(e.$$.fragment,g)},m(g,_){Z(e,g,_),i=!0},p(g,_){const y={};!u&&_[0]&1&&(u=!0,y.searchResults=g[0].search.searchResults,se(()=>u=!1)),!t&&_[0]&2048&&(t=!0,y.usedSearchResults=g[11],se(()=>t=!1)),!n&&_[0]&32768&&(n=!0,y.showFullText=g[15],se(()=>n=!1)),!r&&_[0]&65536&&(r=!0,y.useSearchResult=g[16],se(()=>r=!1)),!s&&_[0]&131072&&(s=!0,y.enableSearchResultSelection=g[17],se(()=>s=!1)),!a&&_[0]&262144&&(a=!0,y.searchInTransactionLedger=g[18],se(()=>a=!1)),!c&&_[0]&268435456&&(c=!0,y.showOnlyLlmUsed=g[28],se(()=>c=!1)),e.$set(y)},i(g){i||(w(e.$$.fragment,g),i=!0)},o(g){S(e.$$.fragment,g),i=!1},d(g){l[62](null),x(e,g)}}}function p4(l){let e,u,t;function n(s){l[70](s)}let r={};return l[0].search.explanations!==void 0&&(r.explanations=l[0].search.explanations),e=new T0({props:r}),ue.push(()=>ne(e,"explanations",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&1&&(u=!0,c.explanations=s[0].search.explanations,se(()=>u=!1)),e.$set(c)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){S(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function _4(l){let e,u,t;function n(s){l[71](s)}let r={};return l[12]!==void 0&&(r.consultations=l[12]),e=new l0({props:r}),ue.push(()=>ne(e,"consultations",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&4096&&(u=!0,c.consultations=s[12],se(()=>u=!1)),e.$set(c)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){S(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function L0(l){let e,u,t,n,r=l[0].search?.searchResults&&d4(l),s=l[0].search?.explanations&&p4(l),a=l[12]&&l[12].length>0&&_4(l);return{c(){e=E("div"),r&&r.c(),u=T(),s&&s.c(),t=T(),a&&a.c(),this.h()},l(c){e=v(c,"DIV",{class:!0});var i=D(e);r&&r.l(i),u=R(i),s&&s.l(i),t=R(i),a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class","search-column svelte-fiifsz")},m(c,i){I(c,e,i),r&&r.m(e,null),d(e,u),s&&s.m(e,null),d(e,t),a&&a.m(e,null),n=!0},p(c,i){c[0].search?.searchResults?r?(r.p(c,i),i[0]&1&&w(r,1)):(r=d4(c),r.c(),w(r,1),r.m(e,u)):r&&(Ie(),S(r,1,1,()=>{r=null}),Le()),c[0].search?.explanations?s?(s.p(c,i),i[0]&1&&w(s,1)):(s=p4(c),s.c(),w(s,1),s.m(e,t)):s&&(Ie(),S(s,1,1,()=>{s=null}),Le()),c[12]&&c[12].length>0?a?(a.p(c,i),i[0]&4096&&w(a,1)):(a=_4(c),a.c(),w(a,1),a.m(e,null)):a&&(Ie(),S(a,1,1,()=>{a=null}),Le())},i(c){n||(w(r),w(s),w(a),n=!0)},o(c){S(r),S(s),S(a),n=!1},d(c){c&&m(e),r&&r.d(),s&&s.d(),a&&a.d()}}}function g4(l){let e,u=l[0].llmFinalAnswer.replaceAll(`
`,"<br>")+"",t;return{c(){e=new w4(!1),t=Tu(),this.h()},l(n){e=F4(n,!1),t=Tu(),this.h()},h(){e.a=t},m(n,r){e.m(u,n,r),I(n,t,r)},p(n,r){r[0]&1&&u!==(u=n[0].llmFinalAnswer.replaceAll(`
`,"<br>")+"")&&e.p(u)},d(n){n&&(m(t),e.d())}}}function b4(l){let e,u;return e=new v0({props:{onSubmit:l[45]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p:q,i(t){u||(w(e.$$.fragment,t),u=!0)},o(t){S(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function N0(l){let e,u,t,n="Получить ответ",r,s,a="Уточнить ответ",c,i,o,f,p="Скачать ответ в Word",A,B,O,U,F=(l[23]&&l[3]||!l[23]&&!l[3]||l[23]&&l[0].llmFinalAnswer&&!l[21]||l[0].llmFinalAnswer&&l[21]&&l[22])&&g4(l),g=l[0].llmFinalAnswer&&l[24]&&l[33]&&b4(l);return{c(){e=E("div"),u=E("div"),t=E("button"),t.textContent=n,r=T(),s=E("button"),s.textContent=a,c=T(),i=E("div"),F&&F.c(),o=T(),f=E("button"),f.textContent=p,A=T(),g&&g.c(),this.h()},l(_){e=v(_,"DIV",{class:!0});var y=D(e);u=v(y,"DIV",{class:!0});var k=D(u);t=v(k,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(t)!=="svelte-1fu5ju8"&&(t.textContent=n),r=R(k),s=v(k,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(s)!=="svelte-1jv1usb"&&(s.textContent=a),c=R(k),i=v(k,"DIV",{class:!0});var K=D(i);F&&F.l(K),K.forEach(m),o=R(k),f=v(k,"BUTTON",{class:!0,"data-svelte-h":!0}),Ue(f)!=="svelte-1n8n71z"&&(f.textContent=p),A=R(k),g&&g.l(k),k.forEach(m),y.forEach(m),this.h()},h(){h(t,"class","btn variant-filled"),le(t,"hidden",!(l[17]&&(l[0].search?.searchResults||[]).length>0&&!l[26])),h(s,"class","btn variant-filled"),le(s,"hidden",!l[26]||!l[27]),h(i,"class","textarea svelte-fiifsz"),h(f,"class","btn variant-filled mb-4 mt-4"),le(f,"hidden",!l[0].llmFinalAnswer),h(u,"class","textarea svelte-fiifsz"),h(e,"class","textarea-column svelte-fiifsz")},m(_,y){I(_,e,y),d(e,u),d(u,t),d(u,r),d(u,s),d(u,c),d(u,i),F&&F.m(i,null),d(u,o),d(u,f),d(u,A),g&&g.m(u,null),B=!0,O||(U=[H(t,"click",l[44]),H(s,"click",l[42]),H(f,"click",l[46])],O=!0)},p(_,y){(!B||y[0]&67239937)&&le(t,"hidden",!(_[17]&&(_[0].search?.searchResults||[]).length>0&&!_[26])),(!B||y[0]&201326592)&&le(s,"hidden",!_[26]||!_[27]),_[23]&&_[3]||!_[23]&&!_[3]||_[23]&&_[0].llmFinalAnswer&&!_[21]||_[0].llmFinalAnswer&&_[21]&&_[22]?F?F.p(_,y):(F=g4(_),F.c(),F.m(i,null)):F&&(F.d(1),F=null),(!B||y[0]&1)&&le(f,"hidden",!_[0].llmFinalAnswer),_[0].llmFinalAnswer&&_[24]&&_[33]?g?(g.p(_,y),y[0]&16777217&&w(g,1)):(g=b4(_),g.c(),w(g,1),g.m(u,null)):g&&(Ie(),S(g,1,1,()=>{g=null}),Le())},i(_){B||(w(g),B=!0)},o(_){S(g),B=!1},d(_){_&&m(e),F&&F.d(),g&&g.d(),O=!1,Cu(U)}}}function U0(l){let e,u,t,n;return e=new Vu({props:{minSize:20,class:"search-column",size:49,$$slots:{default:[L0]},$$scope:{ctx:l}}}),t=new Vu({props:{size:49,$$slots:{default:[N0]},$$scope:{ctx:l}}}),{c(){W(e.$$.fragment),u=T(),W(t.$$.fragment)},l(r){Y(e.$$.fragment,r),u=R(r),Y(t.$$.fragment,r)},m(r,s){Z(e,r,s),I(r,u,s),Z(t,r,s),n=!0},p(r,s){const a={};s[0]&268933249|s[3]&1&&(a.$$scope={dirty:s,ctx:r}),e.$set(a);const c={};s[0]&232914953|s[3]&1&&(c.$$scope={dirty:s,ctx:r}),t.$set(c)},i(r){n||(w(e.$$.fragment,r),w(t.$$.fragment,r),n=!0)},o(r){S(e.$$.fragment,r),S(t.$$.fragment,r),n=!1},d(r){r&&m(u),x(e,r),x(t,r)}}}function O0(l){let e,u,t,n,r,s,a,c,i,o,f,p,A,B,O,U,F,g,_,y,k,K,Te,M,me,P,je,_e,ge,Re=l[27]?"Свернуть уточнение":"Уточнить",de,au,pu,iu,we,Fe,pe,Je="Искать карту проводок по вопросу",He,eu,ye,ou,cu,Xe,be,uu,Ke,ze,Oe,tu,Ne,Ae,lu,_u,gu,We,bu=l[13]&&Object.keys(l[13]).length>0,Eu,fu,Qe,ie,Ee,hu,Du;r=new Q4({props:{disableIntervalChecks:!!l[35]}}),a=new X4({props:{disableIntervalChecks:!!l[35]}});function Ru(C){l[50](C)}let wu={};l[30]!==void 0&&(wu.selectedLLM=l[30]),i=new O4({props:wu}),ue.push(()=>ne(i,"selectedLLM",Ru));let N=l[20]&&r4(l),z=l[0].investigatorSettings!==null&&a4(l),Q=!l[6]&&i4(l),oe=l[6]&&o4();function yu(C){l[58](C)}function Iu(C){l[59](C)}let vu={};l[18]!==void 0&&(vu.disabled=l[18]),l[10]!==void 0&&(vu.selected=l[10]),ye=new I0({props:vu}),ue.push(()=>ne(ye,"disabled",yu)),ue.push(()=>ne(ye,"selected",Iu));let G=(l[2]||l[3])&&c4(l);function Lu(C){l[60](C)}let Fu={};l[1]!==void 0&&(Fu.llmClarification=l[1]),Ae=new r0({props:Fu}),ue.push(()=>ne(Ae,"llmClarification",Lu));let J=l[8]&&f4(l),X=bu&&h4(l),ce=l[25]&&m4();return ie=new A4({props:{theme:"modern-theme",$$slots:{default:[U0]},$$scope:{ctx:l}}}),{c(){e=E("div"),u=E("div"),t=E("div"),n=E("div"),W(r.$$.fragment),s=T(),W(a.$$.fragment),c=T(),W(i.$$.fragment),f=T(),N&&N.c(),p=T(),A=E("label"),B=E("input"),O=re(" Использовать почемучки"),U=T(),z&&z.c(),F=T(),g=E("section"),_=E("div"),y=E("div"),k=E("textarea"),K=T(),Te=E("div"),M=E("div"),me=E("a"),P=E("i"),je=re(" Справка"),_e=T(),ge=E("button"),de=re(Re),pu=T(),Q&&Q.c(),iu=T(),we=E("button"),oe&&oe.c(),Fe=T(),pe=E("span"),pe.textContent=Je,eu=T(),W(ye.$$.fragment),Xe=T(),be=E("button"),uu=re(l[29]),ze=T(),Oe=E("div"),G&&G.c(),tu=T(),Ne=E("div"),W(Ae.$$.fragment),_u=T(),J&&J.c(),gu=T(),We=E("div"),X&&X.c(),Eu=T(),ce&&ce.c(),fu=T(),Qe=E("div"),W(ie.$$.fragment),this.h()},l(C){e=v(C,"DIV",{class:!0});var L=D(e);u=v(L,"DIV",{class:!0});var mu=D(u);t=v(mu,"DIV",{class:!0});var su=D(t);n=v(su,"DIV",{class:!0});var fe=D(n);Y(r.$$.fragment,fe),s=R(fe),Y(a.$$.fragment,fe),c=R(fe),Y(i.$$.fragment,fe),f=R(fe),N&&N.l(fe),p=R(fe),A=v(fe,"LABEL",{class:!0});var nu=D(A);B=v(nu,"INPUT",{type:!0}),O=ae(nu," Использовать почемучки"),nu.forEach(m),U=R(fe),z&&z.l(fe),fe.forEach(m),su.forEach(m),mu.forEach(m),L.forEach(m),F=R(C),g=v(C,"SECTION",{});var Au=D(g);_=v(Au,"DIV",{class:!0});var te=D(_);y=v(te,"DIV",{class:!0});var Bu=D(y);k=v(Bu,"TEXTAREA",{class:!0,rows:!0,placeholder:!0}),D(k).forEach(m),Bu.forEach(m),K=R(te),Te=v(te,"DIV",{class:!0});var ku=D(Te);M=v(ku,"DIV",{class:!0});var b=D(M);me=v(b,"A",{href:!0,target:!0,rel:!0,class:!0});var j=D(me);P=v(j,"I",{class:!0}),D(P).forEach(m),je=ae(j," Справка"),j.forEach(m),_e=R(b),ge=v(b,"BUTTON",{class:!0});var V=D(ge);de=ae(V,Re),V.forEach(m),pu=R(b),Q&&Q.l(b),iu=R(b),we=v(b,"BUTTON",{class:!0});var $=D(we);oe&&oe.l($),Fe=R($),pe=v($,"SPAN",{"data-svelte-h":!0}),Ue(pe)!=="svelte-1cu0b9t"&&(pe.textContent=Je),$.forEach(m),eu=R(b),Y(ye.$$.fragment,b),Xe=R(b),be=v(b,"BUTTON",{title:!0,class:!0});var he=D(be);uu=ae(he,l[29]),he.forEach(m),b.forEach(m),ku.forEach(m),ze=R(te),Oe=v(te,"DIV",{class:!0});var Be=D(Oe);G&&G.l(Be),Be.forEach(m),tu=R(te),Ne=v(te,"DIV",{class:!0});var ee=D(Ne);Y(Ae.$$.fragment,ee),ee.forEach(m),_u=R(te),J&&J.l(te),gu=R(te),We=v(te,"DIV",{class:!0});var Ye=D(We);X&&X.l(Ye),Ye.forEach(m),Eu=R(te),ce&&ce.l(te),fu=R(te),Qe=v(te,"DIV",{});var Ge=D(Qe);Y(ie.$$.fragment,Ge),Ge.forEach(m),te.forEach(m),Au.forEach(m),this.h()},h(){h(B,"type","checkbox"),h(A,"class","inline-block cursor-pointer"),h(n,"class","flex-wrap justify-between"),h(t,"class","status-components justify-between align-middle flex m-2"),h(u,"class","mx-auto flex items-center justify-between"),h(e,"class","absolute top-0 left-0 w-full bg-black text-white shadow-lg z-50 h-15"),le(e,"hidden",!l[34]),h(k,"class","auto-expand-textarea rounded-sm svelte-fiifsz"),h(k,"rows","1"),h(k,"placeholder","Введите ваш запрос (Ctrl+Enter для отправки)"),h(y,"class","grow-wrap w-full svelte-fiifsz"),h(P,"class","fa-regular fa-circle-question"),h(me,"href",`${l[31]}file/view/id/${l[36]}`),h(me,"target","_blank"),h(me,"rel","noopener noreferrer"),h(me,"class","btn variant-outline-tertiary reference-btn svelte-fiifsz"),h(ge,"class",au="chip "+(l[27]?"variant-filled-primary":"variant-soft-primary")),le(ge,"hidden",!l[4]),h(we,"class",He="chip "+(l[6]?"variant-filled-primary":"variant-soft-primary")),h(be,"title","Ctrl+Enter"),be.disabled=Ke=!l[5]&&!l[14],h(be,"class","btn variant-filled-primary w-40"),h(M,"class","flex justify-end flex-wrap gap-2 m-2 mr-0 ml-0"),h(Te,"class","search-second-bar w-full flex justify-end svelte-fiifsz"),h(Oe,"class","flex space-x-2 items-center justify-center w-full"),h(Ne,"class","w-full"),le(Ne,"hidden",!l[27]),h(We,"class","w-full my-2"),le(Qe,"hidden",!(((l[0].search?.searchResults||[]).length>0||l[12]&&l[12].length>0)&&!l[18])),h(_,"class","search-bar flex flex-wrap px-2 pt-2 svelte-fiifsz"),le(g,"mt-16",l[34])},m(C,L){I(C,e,L),d(e,u),d(u,t),d(t,n),Z(r,n,null),d(n,s),Z(a,n,null),d(n,c),Z(i,n,null),d(n,f),N&&N.m(n,null),d(n,p),d(n,A),d(A,B),B.checked=l[0].useInvestigator,d(A,O),d(n,U),z&&z.m(n,null),I(C,F,L),I(C,g,L),d(g,_),d(_,y),d(y,k),ru(k,l[5]),d(_,K),d(_,Te),d(Te,M),d(M,me),d(me,P),d(me,je),d(M,_e),d(M,ge),d(ge,de),d(M,pu),Q&&Q.m(M,null),d(M,iu),d(M,we),oe&&oe.m(we,null),d(we,Fe),d(we,pe),d(M,eu),Z(ye,M,null),d(M,Xe),d(M,be),d(be,uu),d(_,ze),d(_,Oe),G&&G.m(Oe,null),d(_,tu),d(_,Ne),Z(Ae,Ne,null),d(_,_u),J&&J.m(_,null),d(_,gu),d(_,We),X&&X.m(We,null),d(_,Eu),ce&&ce.m(_,null),d(_,fu),d(_,Qe),Z(ie,Qe,null),Ee=!0,hu||(Du=[H(B,"change",l[52]),H(k,"input",l[54]),H(k,"input",l[40]),H(k,"keydown",l[41]),H(ge,"click",l[39]),H(we,"click",l[57]),H(be,"click",l[43])],hu=!0)},p(C,L){const mu={};!o&&L[0]&1073741824&&(o=!0,mu.selectedLLM=C[30],se(()=>o=!1)),i.$set(mu),C[20]?N?(N.p(C,L),L[0]&1048576&&w(N,1)):(N=r4(C),N.c(),w(N,1),N.m(n,p)):N&&(Ie(),S(N,1,1,()=>{N=null}),Le()),L[0]&1&&(B.checked=C[0].useInvestigator),C[0].investigatorSettings!==null?z?(z.p(C,L),L[0]&1&&w(z,1)):(z=a4(C),z.c(),w(z,1),z.m(n,null)):z&&(Ie(),S(z,1,1,()=>{z=null}),Le()),L[0]&32&&ru(k,C[5]),(!Ee||L[0]&134217728)&&Re!==(Re=C[27]?"Свернуть уточнение":"Уточнить")&&ke(de,Re),(!Ee||L[0]&134217728&&au!==(au="chip "+(C[27]?"variant-filled-primary":"variant-soft-primary")))&&h(ge,"class",au),(!Ee||L[0]&134217744)&&le(ge,"hidden",!C[4]),C[6]?Q&&(Ie(),S(Q,1,1,()=>{Q=null}),Le()):Q?(Q.p(C,L),L[0]&64&&w(Q,1)):(Q=i4(C),Q.c(),w(Q,1),Q.m(M,iu)),C[6]?oe||(oe=o4(),oe.c(),oe.m(we,Fe)):oe&&(oe.d(1),oe=null),(!Ee||L[0]&64&&He!==(He="chip "+(C[6]?"variant-filled-primary":"variant-soft-primary")))&&h(we,"class",He);const su={};!ou&&L[0]&262144&&(ou=!0,su.disabled=C[18],se(()=>ou=!1)),!cu&&L[0]&1024&&(cu=!0,su.selected=C[10],se(()=>cu=!1)),ye.$set(su),(!Ee||L[0]&536870912)&&ke(uu,C[29]),(!Ee||L[0]&16416&&Ke!==(Ke=!C[5]&&!C[14]))&&(be.disabled=Ke),C[2]||C[3]?G?(G.p(C,L),L[0]&12&&w(G,1)):(G=c4(C),G.c(),w(G,1),G.m(Oe,null)):G&&(Ie(),S(G,1,1,()=>{G=null}),Le());const fe={};!lu&&L[0]&2&&(lu=!0,fe.llmClarification=C[1],se(()=>lu=!1)),Ae.$set(fe),(!Ee||L[0]&134217728)&&le(Ne,"hidden",!C[27]),C[8]?J?(J.p(C,L),L[0]&256&&w(J,1)):(J=f4(C),J.c(),w(J,1),J.m(_,gu)):J&&(Ie(),S(J,1,1,()=>{J=null}),Le()),L[0]&8192&&(bu=C[13]&&Object.keys(C[13]).length>0),bu?X?(X.p(C,L),L[0]&8192&&w(X,1)):(X=h4(C),X.c(),w(X,1),X.m(We,null)):X&&(Ie(),S(X,1,1,()=>{X=null}),Le()),C[25]?ce||(ce=m4(),ce.c(),ce.m(_,fu)):ce&&(ce.d(1),ce=null);const nu={};L[0]&501717129|L[3]&1&&(nu.$$scope={dirty:L,ctx:C}),ie.$set(nu),(!Ee||L[0]&266241)&&le(Qe,"hidden",!(((C[0].search?.searchResults||[]).length>0||C[12]&&C[12].length>0)&&!C[18]))},i(C){Ee||(w(r.$$.fragment,C),w(a.$$.fragment,C),w(i.$$.fragment,C),w(N),w(z),w(Q),w(ye.$$.fragment,C),w(G),w(Ae.$$.fragment,C),w(J),w(X),w(ie.$$.fragment,C),Ee=!0)},o(C){S(r.$$.fragment,C),S(a.$$.fragment,C),S(i.$$.fragment,C),S(N),S(z),S(Q),S(ye.$$.fragment,C),S(G),S(Ae.$$.fragment,C),S(J),S(X),S(ie.$$.fragment,C),Ee=!1},d(C){C&&(m(e),m(F),m(g)),x(r),x(a),x(i),N&&N.d(),z&&z.d(),Q&&Q.d(),oe&&oe.d(),x(ye),G&&G.d(),x(Ae),J&&J.d(),X&&X.d(),ce&&ce.d(),x(ie),hu=!1,Cu(Du)}}}let E4=!1,Uu=!1,M0="";function P0(l,e,u){let{data:t}=e;const{ENV_DOCUMENT_DB_URL:n,ENV_ENABLE_DOCUMENT_DB:r,ENV_ENABLE_DB_SUPPORT:s,ENV_ENABLE_DEV_FEATURES:a,ENV_DISABLE_HEALTH_CHECKS:c,ENV_FAQ_DOCUMENT_ID:i}=t;let o=t.Model,f,p="",A=!1,B=I4,O={НКРФ:!1,ГКРФ:!1,ТКРФ:!1,"Федеральный закон":!1,"Письмо Минфина":!1,"Письмо ФНС":!1,"Приказ ФНС":!1,"Постановление Правительства":!1,"Судебный документ":!1,ВНД:!1,"Бухгалтерский документ":!1};function U(b){u(9,B=b)}function F(){u(8,A=!1)}Ou(()=>{hu()});let g=[],_=[],y=null,k=!1,K=!1,Te=!1,M="",me=!0,P="",je="",_e="",ge=[];Array(_.length).fill(!1);let Re,de=!1,au=!0,pu=!0,iu=!1,we=!0,Fe=!1,pe=!1,Je=!1,He=U4.llm_params,eu=!1,ye=!1,ou=!1,cu=!1,Xe=!1,be=!1,uu=!1,Ke=!1,ze=!1,Oe,tu=null,Ne,Ae=-1,lu=-1,_u="Отправить";const gu=async b=>{u(27,Ke=!Ke)},We=b=>{u(5,P=b.target.value);const j=b.target.parentNode;j&&(j.dataset.replicatedValue=P)},bu=b=>{b.ctrlKey&&b.key==="Enter"&&(b.preventDefault(),Ee())};async function Eu(){if(!(p&&M)||(me=!1,!o.search?.searchResults))return;let b=o.search.searchResults,j=o.search.explanations;if(u(3,K=!0),u(14,_e="Преобразуем результаты поиска в запрос для ИИ"),de&&(b=o.search.searchResults.filter(($,he)=>Re[$.title]),!b)){u(0,o.llmFinalAnswer="Выберите хотя бы один документ из результатов поиска.",o);return}let V=Pe.convertSearchResultsToLlmSources(b,be?_:null,j);if(V){let $="",he="",Be=Su.Clarification,ee={...N,name:N.name.replace(" (изменено)","")};de?(he=N.predict_params?.user_selected_sources_clarification_system_prompt||"",$=N.predict_params?.user_selected_sources_clarification_prompt||"",Be=Su.UserSelectedSearchResults):(he=N.predict_params?.clarification_prompt||"",$=N.predict_params?.clarification_system_prompt||"");const Ye=$+he+(o.search.modifiedQuery||P),Ge=await Pe.sendTrimByTokens(ee.name,V,Ye,ie);V=Ge.result,Ae=Ge.originalTokenCount,lu=Ge.slicedTokenCount;const Ze=Pe.buildClarificationPrompt(o.search.modifiedQuery||P,V,M,p,he);u(0,o.llmFinalAnswer="",o),await Qe(Ze,Ne,ee,Be)}}const fu=async b=>{if(!o.search?.searchResults)return;let j=o.search.searchResults,V=o.search.explanations;if(u(3,K=!0),u(14,_e="Преобразуем результаты поиска в запрос для ИИ"),de&&(j=o.search.searchResults.filter((he,Be)=>Re[he.title]),!j)){u(0,o.llmFinalAnswer="Выберите хотя бы один документ из результатов поиска.",o);return}let $=Pe.convertSearchResultsToLlmSources(j,be?_:null,V);if($){let he="",Be="",ee=Su.Regular,Ye={...N,name:N.name.replace(" (изменено)","")};if(o.useInvestigator&&o.investigatorSettings){const Ge=he+Be+(o.search.modifiedQuery||P),Ze=await Pe.sendTrimByTokens(Ye.name,$,Ge,ie);$=Ze.result,Ae=Ze.originalTokenCount,lu=Ze.slicedTokenCount;const Nu={llm_params:He,query:""},Mu=new L4(o.investigatorSettings,Nu,5);o.investigatorSettings&&Mu.applySettings(o.investigatorSettings);const Pu=await Mu.getResponse(P,$,ie);u(0,o.llmFinalAnswer=Pe.postProcessLlmAnswer(Pu.result),o),u(14,_e=""),u(3,K=!1),console.log(Pu.generatedQA)}else{de?(Be=N.predict_params?.user_selected_sources_prompt||"",he=N.predict_params?.user_selected_sources_system_prompt||"",ee=Su.UserSelectedSearchResults):(Be=N.predict_params?.user_prompt||"",he=N.predict_params?.system_prompt||"");const Ge=he+Be+(o.search.modifiedQuery||P),Ze=await Pe.sendTrimByTokens(Ye.name,$,Ge,ie);$=Ze.result,Ae=Ze.originalTokenCount,lu=Ze.slicedTokenCount;const Nu=Pe.buildLlmResponsePrompt(o.search.modifiedQuery||P,$,Be);u(0,o.llmFinalAnswer="",o),await Qe(Nu,o.search.modifiedQuery,Ye,ee)}}},Qe=async(b,j,V,$)=>{u(3,K=!0),u(14,_e="Запрос поставлен в очередь на генерацию ответа"),u(49,je=P);const he=ee=>{u(14,_e=ee)};u(0,o.llmFinalAnswer=await Pe.doRequest(V.name,b,$,1,ie,he,null,V.predict_params,"Конец ответ"),o),u(0,o.llmFinalAnswer=Pe.postProcessLlmAnswer(o.llmFinalAnswer),o);const Be=await Hu.extractUsedSearchResults(o.llmFinalAnswer,o.search?.searchResults||[]);u(28,ze=!0),u(11,g=Be.searchResults),f.blinkButton(),eu||(u(14,_e=""),u(3,K=!1),u(24,cu=!0),u(4,M=o.llmFinalAnswer),tu=await ju.log({consultations:(_||[]).map(ee=>JSON.stringify(ee)),explanations:(o.search?.explanations||[]).map(ee=>JSON.stringify(ee)),llmPrompt:b,llmResponse:o.llmFinalAnswer,searchResults:o.search?.searchResults.map(ee=>JSON.stringify(ee)),selectedSearchResults:o.search?.searchResults.filter((ee,Ye)=>Re[ee.title]).map(ee=>JSON.stringify(ee)),userScore:void 0,userComment:M0,userRequest:P,modifiedUserRequest:j,searchMetrics:Oe,requestOriginalTokenCount:Ae,requestSlicedTokenCount:lu,uiSettings:{enableSearchResultSelection:de,enableLLMForTeasers:Uu,doMultistepSearch:Je,useAccountingDocs:au,useReranking:pu,useLLMForFiltering:iu,disableThresholds:we,searchInTransactionLedgerByOperation:E4,searchInTransactionLedgerByQuestion:pe,useShortestPrompt:eu,enableRealtimeLlmReponse:ou,sendConsultationToLlm:be}}))};let ie=new AbortController;const Ee=async b=>{if(K||k){await hu();return}if(!P)return;u(15,ge=Array(10).fill(!1)),Array(10).fill(!1),u(16,Re={}),u(0,o.llmFinalAnswer="",o),u(4,M=""),me=!0,u(22,ye=!1),u(24,cu=!1),u(2,k=!0),u(3,K=!1),u(48,Te=!0),u(25,Xe=!1),u(11,g=[]),u(28,ze=!1),Oe=void 0,u(14,_e="Ищем релевантные документы"),Ne=void 0,u(27,Ke=!1),u(1,p="");let j;try{const V=await Hu.doRequest({query:P,use_olympic:Uu,use_qe:Je,find_transaction_maps_by_question:pe,find_transaction_maps_by_operation:E4,categories:O,llm_params:He},ie);u(0,o.search=V,o),Ne=V.modifiedQuery,u(12,_=V.relevantConsultations),j=V.explanations||[],u(13,y=V.transactionMaps||null),Oe=V.metrics,u(25,Xe=Fe&&!y),u(14,_e=""),u(2,k=!1),u(48,Te=!1)}catch(V){if(u(25,Xe=!0),V instanceof Error&&V.name==="AbortError")alert("Сервис поиска не отвечает. Попробуйте изменить и повторить запрос"),console.error("Request was aborted due to timeout"),V.message&&console.error("Fetch error:",V.message);else throw console.error("Fetch error:",V),V}finally{u(14,_e=""),u(2,k=!1),u(25,Xe=!1),u(48,Te=!1)}Fe||(o.search?.searchResults||[]).length>0&&(de||await fu())},hu=()=>{ie.abort("user canceled"),ie=new AbortController,u(3,K=!1),u(14,_e=""),tu=null,u(48,Te=!1),me=!0,u(2,k=!1),u(11,g=[]),u(28,ze=!1)};async function Du(){u(0,o.llmFinalAnswer="",o),u(4,M=""),me=!0,await hu(),setTimeout(async()=>{console.log(me),await fu()},1e3)}async function Ru(b){console.log(`Оценка: ${b.rating} звезд, Комментарий: ${b.comment}`),tu!==null&&await ju.logUserScore(tu,b.rating,b.comment)}async function wu(){let b={consultations:(_||[]).map(j=>JSON.stringify(j)),explanations:(o.search?.explanations||[]).map(j=>JSON.stringify(j)),llmResponse:o.llmFinalAnswer,searchResults:o.search?.searchResults.map(j=>({title:j.title,text:j.text_for_llm||j.text})),userRequest:P,uiSettings:{enableSearchResultSelection:de,enableOlympicSearch:Uu,enableQueryExpansionSearch:Je}};g0.createDocxFromObject(b)}let N;function z(b){N=b,u(30,N)}function Q(b){He=b,u(20,He)}function oe(){o.useInvestigator=this.checked,u(0,o)}function yu(b){l.$$.not_equal(o.investigatorSettings,b)&&(o.investigatorSettings=b,u(0,o))}function Iu(){P=this.value,u(5,P)}function vu(b){l.$$.not_equal(o.useInvestigator,b)&&(o.useInvestigator=b,u(0,o))}function G(b){Je=b,u(19,Je)}const Lu=()=>{u(6,pe=!pe)};function Fu(b){Fe=b,u(18,Fe),u(6,pe),u(1,p),u(0,o),u(4,M),u(49,je),u(5,P),u(3,K)}function J(b){O=b,u(10,O)}function X(b){p=b,u(1,p)}function ce(b){y=b,u(13,y)}function C(b){ue[b?"unshift":"push"](()=>{f=b,u(7,f)})}function L(b){l.$$.not_equal(o.search.searchResults,b)&&(o.search.searchResults=b,u(0,o))}function mu(b){g=b,u(11,g)}function su(b){ge=b,u(15,ge)}function fe(b){Re=b,u(16,Re)}function nu(b){de=b,u(17,de),u(6,pe),u(1,p),u(0,o),u(4,M),u(49,je),u(5,P),u(3,K)}function Au(b){Fe=b,u(18,Fe),u(6,pe),u(1,p),u(0,o),u(4,M),u(49,je),u(5,P),u(3,K)}function te(b){ze=b,u(28,ze)}function Bu(b){l.$$.not_equal(o.search.explanations,b)&&(o.search.explanations=b,u(0,o))}function ku(b){_=b,u(12,_)}return l.$$set=b=>{"data"in b&&u(47,t=b.data)},l.$$.update=()=>{l.$$.dirty[0]&123|l.$$.dirty[1]&262144&&(pe?(u(18,Fe=!0),u(17,de=!1),au=!1,pu=!1,iu=!1,we=!1,u(21,eu=!1),u(23,ou=!1),be=!1):u(18,Fe=!1),p&&(o.search?.searchResults||[]).length>0&&M&&je==P&&!K?u(26,uu=!0):u(26,uu=!1)),l.$$.dirty[0]&12|l.$$.dirty[1]&131072&&u(29,_u=Te||K||k?"Стоп":"Отправить")},[o,p,k,K,M,P,pe,f,A,B,O,g,_,y,_e,ge,Re,de,Fe,Je,He,eu,ye,ou,cu,Xe,uu,Ke,ze,_u,N,n,r,s,a,c,i,U,F,gu,We,bu,Eu,Ee,Du,Ru,wu,t,Te,je,z,Q,oe,yu,Iu,vu,G,Lu,Fu,J,X,ce,C,L,mu,su,fe,nu,Au,te,Bu,ku]}class x0 extends Ce{constructor(e){super(),De(this,e,P0,O0,ve,{data:47},null,[-1,-1,-1,-1])}}export{x0 as component,Z0 as universal};
|