@foris/ai-agent 0.9.1-beta.5 → 0.9.1-beta.6

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.
@@ -22254,12 +22254,7 @@ const wp = /* @__PURE__ */ h6(f6), g6 = "_aiSparklesIcon_1ixvw_1", b6 = "_aiSpar
22254
22254
  "Content-Type": "application/json",
22255
22255
  ...e
22256
22256
  } : {}, m = await new Bh(n, d).post(u);
22257
- if (m.ok) {
22258
- l(m);
22259
- const h = await m.json();
22260
- h && h.description && i(h.description), o(!1);
22261
- }
22262
- if (!m.ok) {
22257
+ if (m.ok && (await l(m), o(!1)), !m.ok) {
22263
22258
  o(!1);
22264
22259
  const h = await m.text().catch(() => "");
22265
22260
  throw new Error(`HTTP ${m.status} ${m.statusText} ${h}`);
@@ -310,7 +310,7 @@ XID_Start XIDS`.split(/\s/).map(n=>[So(n),n])),KM=new Map([["s",je(383)],[je(383
310
310
  Copyright (c) 2018 Jed Watson.
311
311
  Licensed under the MIT License (MIT), see
312
312
  http://jedwatson.github.io/classnames
313
- */(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var i=[],r=0;r<arguments.length;r++){var a=arguments[r];if(a){var s=typeof a;if(s==="string"||s==="number")i.push(a);else if(Array.isArray(a)){if(a.length){var o=t.apply(null,a);o&&i.push(o)}}else if(s==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){i.push(a.toString());continue}for(var l in a)e.call(a,l)&&a[l]&&i.push(l)}}}return i.join(" ")}n.exports?(t.default=t,n.exports=t):window.classNames=t})()})(sx);var AF=sx.exports;const Zp=SF(AF),on={aiSparklesIcon:"_aiSparklesIcon_1ixvw_1",aiSparklesIcon__animated:"_aiSparklesIcon__animated_1ixvw_5",aiSparklesIcon_aiMainPulse:"_aiSparklesIcon_aiMainPulse_1ixvw_14",aiMainPulse:"_aiMainPulse_1ixvw_1",aiSparklesIcon_aiSecondaryPulse:"_aiSparklesIcon_aiSecondaryPulse_1ixvw_17",aiSecondaryPulse:"_aiSecondaryPulse_1ixvw_1",aiSparklesIcon_aiStarPulse1:"_aiSparklesIcon_aiStarPulse1_1ixvw_20",aiStarPulse1:"_aiStarPulse1_1ixvw_1",aiSparklesIcon_aiStarPulse1Delay:"_aiSparklesIcon_aiStarPulse1Delay_1ixvw_23",aiSparklesIcon_aiStarPulse2:"_aiSparklesIcon_aiStarPulse2_1ixvw_26",aiStarPulse2:"_aiStarPulse2_1ixvw_1",aiSparklesIcon_aiStarPulse2Alt:"_aiSparklesIcon_aiStarPulse2Alt_1ixvw_29",aiSparklesIcon_aiStarPulse3:"_aiSparklesIcon_aiStarPulse3_1ixvw_32",aiStarPulse3:"_aiStarPulse3_1ixvw_1",aiSparklesIcon_aiStarPulse2Delay:"_aiSparklesIcon_aiStarPulse2Delay_1ixvw_35"},ti={p1710e940:"M8.58599 5.11211C8.94555 3.6293 11.0544 3.6293 11.414 5.11211L12.4034 9.19217C12.5317 9.72158 12.9451 10.1349 13.4745 10.2633L17.5546 11.2527C19.0374 11.6122 19.0374 13.7211 17.5546 14.0807L13.4745 15.07C12.9451 15.1984 12.5317 15.6118 12.4034 16.1412L11.414 20.2212C11.0544 21.704 8.94555 21.704 8.58599 20.2212L7.59664 16.1412C7.46826 15.6118 7.05491 15.1984 6.5255 15.07L2.44544 14.0807C0.96263 13.7211 0.962629 11.6122 2.44544 11.2527L6.5255 10.2633C7.05491 10.1349 7.46826 9.72158 7.59664 9.19217L8.58599 5.11211Z",p1dd12900:"M25.3333 5.24146L25.0072 6.58629C24.8769 7.12384 24.4572 7.54355 23.9196 7.6739L22.5748 8L23.9196 8.3261C24.4572 8.45645 24.8769 8.87616 25.0072 9.41371L25.3333 10.7585L25.6594 9.41371C25.7898 8.87616 26.2095 8.45645 26.747 8.3261L28.0919 8L26.747 7.6739C26.2095 7.54355 25.7898 7.12384 25.6594 6.58629L25.3333 5.24146ZM25.986 4.51328C25.82 3.82891 24.8467 3.82891 24.6807 4.51328L24.2241 6.39639C24.1648 6.64073 23.9741 6.83151 23.7297 6.89076L21.8466 7.34738C21.1622 7.51333 21.1622 8.48667 21.8466 8.65262L23.7297 9.10925C23.9741 9.1685 24.1648 9.35927 24.2241 9.60361L24.6807 11.4867C24.8467 12.1711 25.82 12.1711 25.986 11.4867L26.4426 9.60361C26.5018 9.35927 26.6926 9.1685 26.9369 9.10925L28.8201 8.65262C29.5044 8.48667 29.5044 7.51333 28.8201 7.34738L26.9369 6.89075C26.6926 6.83151 26.5018 6.64073 26.4426 6.39639L25.986 4.51328Z",p31b0a80:"M20.4632 19.351C20.6844 18.4385 21.9822 18.4385 22.2035 19.351L22.8123 21.8618C22.8913 22.1876 23.1457 22.442 23.4715 22.521L25.9823 23.1298C26.8948 23.3511 26.8948 24.6489 25.9823 24.8702L23.4715 25.479C23.1457 25.558 22.8913 25.8124 22.8123 26.1382L22.2035 28.649C21.9822 29.5615 20.6844 29.5615 20.4632 28.649L19.8543 26.1382C19.7753 25.8124 19.521 25.558 19.1952 25.479L16.6844 24.8702C15.7719 24.6489 15.7719 23.3511 16.6844 23.1298L19.1952 22.521C19.521 22.442 19.7753 22.1876 19.8543 21.8618L20.4632 19.351Z",p31cbf800:"M29.3333 18.6667C28.597 18.6667 28 18.0697 28 17.3333C28 16.597 28.597 16 29.3333 16C30.0697 16 30.6667 16.597 30.6667 17.3333C30.6667 18.0697 30.0697 18.6667 29.3333 18.6667Z",p32560f80:"M2.66667 25.3333C1.93029 25.3333 1.33333 24.7364 1.33333 24C1.33333 23.2636 1.93029 22.6667 2.66667 22.6667C3.40305 22.6667 4 23.2636 4 24C4 24.7364 3.40305 25.3333 2.66667 25.3333Z",p3fd05680:"M17.3333 4C16.597 4 16 3.40305 16 2.66667C16 1.93029 16.597 1.33333 17.3333 1.33333C18.0697 1.33333 18.6667 1.93029 18.6667 2.66667C18.6667 3.40305 18.0697 4 17.3333 4Z",p5724c80:"M9.33333 30.6667C8.59695 30.6667 8 30.0697 8 29.3333C8 28.597 8.59695 28 9.33333 28C10.0697 28 10.6667 28.597 10.6667 29.3333C10.6667 30.0697 10.0697 30.6667 9.33333 30.6667Z",pd049700:"M24.7623 4.94912C24.9075 4.35029 25.7592 4.35029 25.9044 4.94912L26.3039 6.59684C26.3558 6.81064 26.5227 6.97757 26.7365 7.02941L28.3842 7.42896C28.983 7.57416 28.983 8.42584 28.3842 8.57104L26.7365 8.97059C26.5227 9.02243 26.3558 9.18936 26.3039 9.40316L25.9044 11.0509C25.7592 11.6497 24.9075 11.6497 24.7623 11.0509L24.3627 9.40316C24.3109 9.18936 24.144 9.02243 23.9302 8.97059L22.2825 8.57104C21.6836 8.42584 21.6836 7.57416 22.2825 7.42896L23.9302 7.02941C24.144 6.97757 24.3109 6.81064 24.3627 6.59684L24.7623 4.94912Z"},ox=({isAnimated:n})=>y.jsxs("svg",{className:Zp(on.aiSparklesIcon,n&&on.aiSparklesIcon__animated),fill:"none",preserveAspectRatio:"none",viewBox:"0 0 32 32",children:[y.jsxs("g",{children:[y.jsx("path",{d:ti.p1710e940,fill:"url(#paint0_linear_ctx)",className:on.aiSparklesIcon_aiMainPulse}),y.jsx("path",{d:ti.p31b0a80,fill:"url(#paint1_linear_ctx)",className:on.aiSparklesIcon_aiSecondaryPulse}),y.jsx("path",{d:ti.pd049700,fill:"url(#paint2_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse1}),y.jsx("path",{clipRule:"evenodd",d:ti.p1dd12900,fill:"url(#paint3_linear_ctx)",fillRule:"evenodd",className:on.aiSparklesIcon_aiStarPulse1Delay}),y.jsx("path",{d:ti.p5724c80,fill:"url(#paint4_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2}),y.jsx("path",{d:ti.p32560f80,fill:"url(#paint5_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2Alt}),y.jsx("path",{d:ti.p3fd05680,fill:"url(#paint6_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse3}),y.jsx("path",{d:ti.p31cbf800,fill:"url(#paint7_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2Delay})]}),y.jsxs("defs",{children:[y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint0_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint1_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint2_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint3_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint4_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint5_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint6_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint7_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]})]})]}),EF={chatPanelMenu:"_chatPanelMenu_uxb4e_1"},TF=({handleClick:n})=>y.jsx("button",{type:"button",className:EF.chatPanelMenu,"aria-label":"open/close chat panel menu",onClick:()=>n(),children:y.jsx(ox,{})}),jF=(n,e)=>{const[t,i]=A.useState(""),[r,a]=A.useState([]),[s,o]=A.useState(!1),{splitChunks:l}=ax(a);return{onSubmit:async u=>{o(!0);try{a([]),i("");const d=e?{"Content-Type":"application/json",...e}:{},m=await new Kp(n,d).post(u);if(m.ok){l(m);const h=await m.json();h&&h.description&&i(h.description),o(!1)}if(!m.ok){o(!1);const h=await m.text().catch(()=>"");throw new Error(`HTTP ${m.status} ${m.statusText} ${h}`)}}catch(d){o(!1),console.error("Error onSubmit",d)}},loading:s,summary:t,messages:r}},Gt={summaryCard:"_summaryCard_19ngt_1",summaryCard_borderGlow:"_summaryCard_borderGlow_19ngt_16",borderGlow:"_borderGlow_19ngt_1",summaryCard_header:"_summaryCard_header_19ngt_33",summaryCard_chevron:"_summaryCard_chevron_19ngt_41",summaryCard_chevron__open:"_summaryCard_chevron__open_19ngt_45",summaryCard_titleWrapper:"_summaryCard_titleWrapper_19ngt_48",summaryCard_title:"_summaryCard_title_19ngt_48",summaryCard_title__loading:"_summaryCard_title__loading_19ngt_60",shimmer:"_shimmer_19ngt_1",blink:"_blink_19ngt_1",summaryCard_content:"_summaryCard_content_19ngt_77",summaryCard_contentInner:"_summaryCard_contentInner_19ngt_81",summaryCard_summaryText:"_summaryCard_summaryText_19ngt_89",fadeIn:"_fadeIn_19ngt_1"},PF=({api:n,headers:e,body:t,title:i="Resumen inteligente",loadingMessage:r="Analizando el comportamiento de la regla...",noDataMessage:a="No hay datos para mostrar."})=>{const[s,o]=A.useState(!1),[l,c]=A.useState(!1),[u,d]=A.useState(0),[p,m]=A.useState(!0),h=A.useRef(null),f=A.useRef(null),{loading:g,onSubmit:b,messages:w}=jF(n,e),k=l||g,x=$=>{const C=$.target,E=C.scrollHeight-C.scrollTop-C.clientHeight<10;m(E)};A.useEffect(()=>{if(!(f!=null&&f.current)||!s)return;const $=()=>{var j;if(!(f!=null&&f.current))return;const E=(j=f==null?void 0:f.current)==null?void 0:j.scrollHeight;d(E)};$();const C=new ResizeObserver($);return C.observe(f==null?void 0:f.current),()=>{C.disconnect()}},[w,g]),A.useEffect(()=>{var $;if(s&&(f!=null&&f.current)){const C=($=f==null?void 0:f.current)==null?void 0:$.scrollHeight;d(C)}else d(0)},[s]),A.useEffect(()=>{p&&f.current&&s&&w.length&&(f.current.scrollTop=f.current.scrollHeight)},[w]);const _=()=>{const $=!s;$&&!g&&!(w!=null&&w.length)&&n&&b(t),o($)};return y.jsxs("div",{className:Gt.summaryCard,children:[y.jsx("div",{className:Gt.summaryCard_borderGlow}),y.jsxs("div",{className:Gt.summaryCard_header,role:"button","aria-expanded":s,"aria-controls":"summary-content",onMouseEnter:()=>!l&&c(!0),onMouseLeave:()=>l&&c(!1),onClick:_,children:[y.jsxs("div",{className:Gt.summaryCard_titleWrapper,children:[y.jsx(ox,{isAnimated:k}),y.jsx("h3",{className:Zp(Gt.summaryCard_title,g&&Gt.summaryCard_title__loading),children:i})]}),y.jsx(Bc.Icon,{className:Zp(Gt.summaryCard_chevron,s&&Gt.summaryCard_chevron__open),name:"chevron-down",color:"primary-50"})]}),y.jsx("div",{id:"summary-content",ref:h,className:Gt.summaryCard_content,style:{maxHeight:`${u}px`},children:y.jsx("div",{ref:f,className:Gt.summaryCard_contentInner,onScroll:x,children:y.jsxs("div",{className:Gt.summaryCard_summaryText,children:[w.length>0&&w.map($=>y.jsx(uf,{children:$.content})),!g&&!w.length&&a,g&&!w.length&&r]})})})]})};function Yp(){return Yp=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Yp.apply(null,arguments)}function MF(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}let Jp=[],lx=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lx:Jp).push(t=t+n[e])})();function DF(n){if(n<768)return!1;for(let e=0,t=Jp.length;;){let i=e+t>>1;if(n<Jp[i])t=i;else if(n>=lx[i])e=i+1;else return!0;if(e==t)return!1}}function cx(n){return n>=127462&&n<=127487}const ux=8205;function OF(n,e,t=!0,i=!0){return(t?dx:NF)(n,e,i)}function dx(n,e,t){if(e==n.length)return e;e&&px(n.charCodeAt(e))&&mx(n.charCodeAt(e-1))&&e--;let i=Qp(n,e);for(e+=hx(i);e<n.length;){let r=Qp(n,e);if(i==ux||r==ux||t&&DF(r))e+=hx(r),i=r;else if(cx(r)){let a=0,s=e-2;for(;s>=0&&cx(Qp(n,s));)a++,s-=2;if(a%2==0)break;e+=2}else break}return e}function NF(n,e,t){for(;e>0;){let i=dx(n,e-2,t);if(i<e)return i;e--}return 0}function Qp(n,e){let t=n.charCodeAt(e);if(!mx(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return px(i)?(t-55296<<10)+(i-56320)+65536:t}function px(n){return n>=56320&&n<57344}function mx(n){return n>=55296&&n<56320}function hx(n){return n<65536?1:2}class oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Dr(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ln.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Dr(this,e,t);let i=[];return this.decompose(e,t,i,0),ln.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Wa(this),a=new Wa(e);for(let s=t,o=t;;){if(r.next(s),a.next(s),s=0,r.lineBreak!=a.lineBreak||r.done!=a.done||r.value!=a.value)return!1;if(o+=r.value.length,r.done||o>=i)return!0}}iter(e=1){return new Wa(this,e)}iterRange(e,t=this.length){return new gx(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bx(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?oe.empty:e.length<=32?new xe(e):ln.from(xe.split(e,[]))}}class xe extends oe{constructor(e,t=IF(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let a=0;;a++){let s=this.text[a],o=r+s.length;if((t?i:o)>=e)return new LF(r,o,i,s);r=o+1,i++}}decompose(e,t,i,r){let a=e<=0&&t>=this.length?this:new xe(fx(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),o=ml(a.text,s.text.slice(),0,a.length);if(o.length<=32)i.push(new xe(o,s.length+a.length));else{let l=o.length>>1;i.push(new xe(o.slice(0,l)),new xe(o.slice(l)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof xe))return super.replace(e,t,i);[e,t]=Dr(this,e,t);let r=ml(this.text,ml(i.text,fx(this.text,0,e)),t),a=this.length+i.length-(t-e);return r.length<=32?new xe(r,a):ln.from(xe.split(r,[]),a)}sliceString(e,t=this.length,i=`
313
+ */(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var i=[],r=0;r<arguments.length;r++){var a=arguments[r];if(a){var s=typeof a;if(s==="string"||s==="number")i.push(a);else if(Array.isArray(a)){if(a.length){var o=t.apply(null,a);o&&i.push(o)}}else if(s==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){i.push(a.toString());continue}for(var l in a)e.call(a,l)&&a[l]&&i.push(l)}}}return i.join(" ")}n.exports?(t.default=t,n.exports=t):window.classNames=t})()})(sx);var AF=sx.exports;const Zp=SF(AF),on={aiSparklesIcon:"_aiSparklesIcon_1ixvw_1",aiSparklesIcon__animated:"_aiSparklesIcon__animated_1ixvw_5",aiSparklesIcon_aiMainPulse:"_aiSparklesIcon_aiMainPulse_1ixvw_14",aiMainPulse:"_aiMainPulse_1ixvw_1",aiSparklesIcon_aiSecondaryPulse:"_aiSparklesIcon_aiSecondaryPulse_1ixvw_17",aiSecondaryPulse:"_aiSecondaryPulse_1ixvw_1",aiSparklesIcon_aiStarPulse1:"_aiSparklesIcon_aiStarPulse1_1ixvw_20",aiStarPulse1:"_aiStarPulse1_1ixvw_1",aiSparklesIcon_aiStarPulse1Delay:"_aiSparklesIcon_aiStarPulse1Delay_1ixvw_23",aiSparklesIcon_aiStarPulse2:"_aiSparklesIcon_aiStarPulse2_1ixvw_26",aiStarPulse2:"_aiStarPulse2_1ixvw_1",aiSparklesIcon_aiStarPulse2Alt:"_aiSparklesIcon_aiStarPulse2Alt_1ixvw_29",aiSparklesIcon_aiStarPulse3:"_aiSparklesIcon_aiStarPulse3_1ixvw_32",aiStarPulse3:"_aiStarPulse3_1ixvw_1",aiSparklesIcon_aiStarPulse2Delay:"_aiSparklesIcon_aiStarPulse2Delay_1ixvw_35"},ti={p1710e940:"M8.58599 5.11211C8.94555 3.6293 11.0544 3.6293 11.414 5.11211L12.4034 9.19217C12.5317 9.72158 12.9451 10.1349 13.4745 10.2633L17.5546 11.2527C19.0374 11.6122 19.0374 13.7211 17.5546 14.0807L13.4745 15.07C12.9451 15.1984 12.5317 15.6118 12.4034 16.1412L11.414 20.2212C11.0544 21.704 8.94555 21.704 8.58599 20.2212L7.59664 16.1412C7.46826 15.6118 7.05491 15.1984 6.5255 15.07L2.44544 14.0807C0.96263 13.7211 0.962629 11.6122 2.44544 11.2527L6.5255 10.2633C7.05491 10.1349 7.46826 9.72158 7.59664 9.19217L8.58599 5.11211Z",p1dd12900:"M25.3333 5.24146L25.0072 6.58629C24.8769 7.12384 24.4572 7.54355 23.9196 7.6739L22.5748 8L23.9196 8.3261C24.4572 8.45645 24.8769 8.87616 25.0072 9.41371L25.3333 10.7585L25.6594 9.41371C25.7898 8.87616 26.2095 8.45645 26.747 8.3261L28.0919 8L26.747 7.6739C26.2095 7.54355 25.7898 7.12384 25.6594 6.58629L25.3333 5.24146ZM25.986 4.51328C25.82 3.82891 24.8467 3.82891 24.6807 4.51328L24.2241 6.39639C24.1648 6.64073 23.9741 6.83151 23.7297 6.89076L21.8466 7.34738C21.1622 7.51333 21.1622 8.48667 21.8466 8.65262L23.7297 9.10925C23.9741 9.1685 24.1648 9.35927 24.2241 9.60361L24.6807 11.4867C24.8467 12.1711 25.82 12.1711 25.986 11.4867L26.4426 9.60361C26.5018 9.35927 26.6926 9.1685 26.9369 9.10925L28.8201 8.65262C29.5044 8.48667 29.5044 7.51333 28.8201 7.34738L26.9369 6.89075C26.6926 6.83151 26.5018 6.64073 26.4426 6.39639L25.986 4.51328Z",p31b0a80:"M20.4632 19.351C20.6844 18.4385 21.9822 18.4385 22.2035 19.351L22.8123 21.8618C22.8913 22.1876 23.1457 22.442 23.4715 22.521L25.9823 23.1298C26.8948 23.3511 26.8948 24.6489 25.9823 24.8702L23.4715 25.479C23.1457 25.558 22.8913 25.8124 22.8123 26.1382L22.2035 28.649C21.9822 29.5615 20.6844 29.5615 20.4632 28.649L19.8543 26.1382C19.7753 25.8124 19.521 25.558 19.1952 25.479L16.6844 24.8702C15.7719 24.6489 15.7719 23.3511 16.6844 23.1298L19.1952 22.521C19.521 22.442 19.7753 22.1876 19.8543 21.8618L20.4632 19.351Z",p31cbf800:"M29.3333 18.6667C28.597 18.6667 28 18.0697 28 17.3333C28 16.597 28.597 16 29.3333 16C30.0697 16 30.6667 16.597 30.6667 17.3333C30.6667 18.0697 30.0697 18.6667 29.3333 18.6667Z",p32560f80:"M2.66667 25.3333C1.93029 25.3333 1.33333 24.7364 1.33333 24C1.33333 23.2636 1.93029 22.6667 2.66667 22.6667C3.40305 22.6667 4 23.2636 4 24C4 24.7364 3.40305 25.3333 2.66667 25.3333Z",p3fd05680:"M17.3333 4C16.597 4 16 3.40305 16 2.66667C16 1.93029 16.597 1.33333 17.3333 1.33333C18.0697 1.33333 18.6667 1.93029 18.6667 2.66667C18.6667 3.40305 18.0697 4 17.3333 4Z",p5724c80:"M9.33333 30.6667C8.59695 30.6667 8 30.0697 8 29.3333C8 28.597 8.59695 28 9.33333 28C10.0697 28 10.6667 28.597 10.6667 29.3333C10.6667 30.0697 10.0697 30.6667 9.33333 30.6667Z",pd049700:"M24.7623 4.94912C24.9075 4.35029 25.7592 4.35029 25.9044 4.94912L26.3039 6.59684C26.3558 6.81064 26.5227 6.97757 26.7365 7.02941L28.3842 7.42896C28.983 7.57416 28.983 8.42584 28.3842 8.57104L26.7365 8.97059C26.5227 9.02243 26.3558 9.18936 26.3039 9.40316L25.9044 11.0509C25.7592 11.6497 24.9075 11.6497 24.7623 11.0509L24.3627 9.40316C24.3109 9.18936 24.144 9.02243 23.9302 8.97059L22.2825 8.57104C21.6836 8.42584 21.6836 7.57416 22.2825 7.42896L23.9302 7.02941C24.144 6.97757 24.3109 6.81064 24.3627 6.59684L24.7623 4.94912Z"},ox=({isAnimated:n})=>y.jsxs("svg",{className:Zp(on.aiSparklesIcon,n&&on.aiSparklesIcon__animated),fill:"none",preserveAspectRatio:"none",viewBox:"0 0 32 32",children:[y.jsxs("g",{children:[y.jsx("path",{d:ti.p1710e940,fill:"url(#paint0_linear_ctx)",className:on.aiSparklesIcon_aiMainPulse}),y.jsx("path",{d:ti.p31b0a80,fill:"url(#paint1_linear_ctx)",className:on.aiSparklesIcon_aiSecondaryPulse}),y.jsx("path",{d:ti.pd049700,fill:"url(#paint2_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse1}),y.jsx("path",{clipRule:"evenodd",d:ti.p1dd12900,fill:"url(#paint3_linear_ctx)",fillRule:"evenodd",className:on.aiSparklesIcon_aiStarPulse1Delay}),y.jsx("path",{d:ti.p5724c80,fill:"url(#paint4_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2}),y.jsx("path",{d:ti.p32560f80,fill:"url(#paint5_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2Alt}),y.jsx("path",{d:ti.p3fd05680,fill:"url(#paint6_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse3}),y.jsx("path",{d:ti.p31cbf800,fill:"url(#paint7_linear_ctx)",className:on.aiSparklesIcon_aiStarPulse2Delay})]}),y.jsxs("defs",{children:[y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint0_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint1_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint2_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint3_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint4_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint5_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint6_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]}),y.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"paint7_linear_ctx",x1:"16",x2:"16",y1:"1.33333",y2:"30.6667",children:[y.jsx("stop",{}),y.jsx("stop",{offset:"1"})]})]})]}),EF={chatPanelMenu:"_chatPanelMenu_uxb4e_1"},TF=({handleClick:n})=>y.jsx("button",{type:"button",className:EF.chatPanelMenu,"aria-label":"open/close chat panel menu",onClick:()=>n(),children:y.jsx(ox,{})}),jF=(n,e)=>{const[t,i]=A.useState(""),[r,a]=A.useState([]),[s,o]=A.useState(!1),{splitChunks:l}=ax(a);return{onSubmit:async u=>{o(!0);try{a([]),i("");const d=e?{"Content-Type":"application/json",...e}:{},m=await new Kp(n,d).post(u);if(m.ok&&(await l(m),o(!1)),!m.ok){o(!1);const h=await m.text().catch(()=>"");throw new Error(`HTTP ${m.status} ${m.statusText} ${h}`)}}catch(d){o(!1),console.error("Error onSubmit",d)}},loading:s,summary:t,messages:r}},Gt={summaryCard:"_summaryCard_19ngt_1",summaryCard_borderGlow:"_summaryCard_borderGlow_19ngt_16",borderGlow:"_borderGlow_19ngt_1",summaryCard_header:"_summaryCard_header_19ngt_33",summaryCard_chevron:"_summaryCard_chevron_19ngt_41",summaryCard_chevron__open:"_summaryCard_chevron__open_19ngt_45",summaryCard_titleWrapper:"_summaryCard_titleWrapper_19ngt_48",summaryCard_title:"_summaryCard_title_19ngt_48",summaryCard_title__loading:"_summaryCard_title__loading_19ngt_60",shimmer:"_shimmer_19ngt_1",blink:"_blink_19ngt_1",summaryCard_content:"_summaryCard_content_19ngt_77",summaryCard_contentInner:"_summaryCard_contentInner_19ngt_81",summaryCard_summaryText:"_summaryCard_summaryText_19ngt_89",fadeIn:"_fadeIn_19ngt_1"},PF=({api:n,headers:e,body:t,title:i="Resumen inteligente",loadingMessage:r="Analizando el comportamiento de la regla...",noDataMessage:a="No hay datos para mostrar."})=>{const[s,o]=A.useState(!1),[l,c]=A.useState(!1),[u,d]=A.useState(0),[p,m]=A.useState(!0),h=A.useRef(null),f=A.useRef(null),{loading:g,onSubmit:b,messages:w}=jF(n,e),k=l||g,x=$=>{const C=$.target,E=C.scrollHeight-C.scrollTop-C.clientHeight<10;m(E)};A.useEffect(()=>{if(!(f!=null&&f.current)||!s)return;const $=()=>{var j;if(!(f!=null&&f.current))return;const E=(j=f==null?void 0:f.current)==null?void 0:j.scrollHeight;d(E)};$();const C=new ResizeObserver($);return C.observe(f==null?void 0:f.current),()=>{C.disconnect()}},[w,g]),A.useEffect(()=>{var $;if(s&&(f!=null&&f.current)){const C=($=f==null?void 0:f.current)==null?void 0:$.scrollHeight;d(C)}else d(0)},[s]),A.useEffect(()=>{p&&f.current&&s&&w.length&&(f.current.scrollTop=f.current.scrollHeight)},[w]);const _=()=>{const $=!s;$&&!g&&!(w!=null&&w.length)&&n&&b(t),o($)};return y.jsxs("div",{className:Gt.summaryCard,children:[y.jsx("div",{className:Gt.summaryCard_borderGlow}),y.jsxs("div",{className:Gt.summaryCard_header,role:"button","aria-expanded":s,"aria-controls":"summary-content",onMouseEnter:()=>!l&&c(!0),onMouseLeave:()=>l&&c(!1),onClick:_,children:[y.jsxs("div",{className:Gt.summaryCard_titleWrapper,children:[y.jsx(ox,{isAnimated:k}),y.jsx("h3",{className:Zp(Gt.summaryCard_title,g&&Gt.summaryCard_title__loading),children:i})]}),y.jsx(Bc.Icon,{className:Zp(Gt.summaryCard_chevron,s&&Gt.summaryCard_chevron__open),name:"chevron-down",color:"primary-50"})]}),y.jsx("div",{id:"summary-content",ref:h,className:Gt.summaryCard_content,style:{maxHeight:`${u}px`},children:y.jsx("div",{ref:f,className:Gt.summaryCard_contentInner,onScroll:x,children:y.jsxs("div",{className:Gt.summaryCard_summaryText,children:[w.length>0&&w.map($=>y.jsx(uf,{children:$.content})),!g&&!w.length&&a,g&&!w.length&&r]})})})]})};function Yp(){return Yp=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Yp.apply(null,arguments)}function MF(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}let Jp=[],lx=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lx:Jp).push(t=t+n[e])})();function DF(n){if(n<768)return!1;for(let e=0,t=Jp.length;;){let i=e+t>>1;if(n<Jp[i])t=i;else if(n>=lx[i])e=i+1;else return!0;if(e==t)return!1}}function cx(n){return n>=127462&&n<=127487}const ux=8205;function OF(n,e,t=!0,i=!0){return(t?dx:NF)(n,e,i)}function dx(n,e,t){if(e==n.length)return e;e&&px(n.charCodeAt(e))&&mx(n.charCodeAt(e-1))&&e--;let i=Qp(n,e);for(e+=hx(i);e<n.length;){let r=Qp(n,e);if(i==ux||r==ux||t&&DF(r))e+=hx(r),i=r;else if(cx(r)){let a=0,s=e-2;for(;s>=0&&cx(Qp(n,s));)a++,s-=2;if(a%2==0)break;e+=2}else break}return e}function NF(n,e,t){for(;e>0;){let i=dx(n,e-2,t);if(i<e)return i;e--}return 0}function Qp(n,e){let t=n.charCodeAt(e);if(!mx(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return px(i)?(t-55296<<10)+(i-56320)+65536:t}function px(n){return n>=56320&&n<57344}function mx(n){return n>=55296&&n<56320}function hx(n){return n<65536?1:2}class oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Dr(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ln.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Dr(this,e,t);let i=[];return this.decompose(e,t,i,0),ln.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Wa(this),a=new Wa(e);for(let s=t,o=t;;){if(r.next(s),a.next(s),s=0,r.lineBreak!=a.lineBreak||r.done!=a.done||r.value!=a.value)return!1;if(o+=r.value.length,r.done||o>=i)return!0}}iter(e=1){return new Wa(this,e)}iterRange(e,t=this.length){return new gx(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bx(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?oe.empty:e.length<=32?new xe(e):ln.from(xe.split(e,[]))}}class xe extends oe{constructor(e,t=IF(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let a=0;;a++){let s=this.text[a],o=r+s.length;if((t?i:o)>=e)return new LF(r,o,i,s);r=o+1,i++}}decompose(e,t,i,r){let a=e<=0&&t>=this.length?this:new xe(fx(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),o=ml(a.text,s.text.slice(),0,a.length);if(o.length<=32)i.push(new xe(o,s.length+a.length));else{let l=o.length>>1;i.push(new xe(o.slice(0,l)),new xe(o.slice(l)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof xe))return super.replace(e,t,i);[e,t]=Dr(this,e,t);let r=ml(this.text,ml(i.text,fx(this.text,0,e)),t),a=this.length+i.length-(t-e);return r.length<=32?new xe(r,a):ln.from(xe.split(r,[]),a)}sliceString(e,t=this.length,i=`
314
314
  `){[e,t]=Dr(this,e,t);let r="";for(let a=0,s=0;a<=t&&s<this.text.length;s++){let o=this.text[s],l=a+o.length;a>e&&s&&(r+=i),e<l&&t>a&&(r+=o.slice(Math.max(0,e-a),t-a)),a=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let a of e)i.push(a),r+=a.length+1,i.length==32&&(t.push(new xe(i,r)),i=[],r=-1);return r>-1&&t.push(new xe(i,r)),t}}class ln extends oe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let a=0;;a++){let s=this.children[a],o=r+s.length,l=i+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,i,r);r=o+1,i=l+1}}decompose(e,t,i,r){for(let a=0,s=0;s<=t&&a<this.children.length;a++){let o=this.children[a],l=s+o.length;if(e<=l&&t>=s){let c=r&((s<=e?1:0)|(l>=t?2:0));s>=e&&l<=t&&!c?i.push(o):o.decompose(e-s,t-s,i,c)}s=l+1}}replace(e,t,i){if([e,t]=Dr(this,e,t),i.lines<this.lines)for(let r=0,a=0;r<this.children.length;r++){let s=this.children[r],o=a+s.length;if(e>=a&&t<=o){let l=s.replace(e-a,t-a,i),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[r]=l,new ln(u,this.length-(t-e)+i.length)}return super.replace(a,o,l)}a=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
315
315
  `){[e,t]=Dr(this,e,t);let r="";for(let a=0,s=0;a<this.children.length&&s<=t;a++){let o=this.children[a],l=s+o.length;s>e&&a&&(r+=i),e<l&&t>s&&(r+=o.sliceString(e-s,t-s,i)),s=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ln))return 0;let i=0,[r,a,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,a+=t){if(r==s||a==o)return i;let l=this.children[r],c=e.children[a];if(l!=c)return i+l.scanIdentical(c,t);i+=l.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let h of e)h.flatten(m);return new xe(m,t)}let r=Math.max(32,i>>5),a=r<<1,s=r>>1,o=[],l=0,c=-1,u=[];function d(m){let h;if(m.lines>a&&m instanceof ln)for(let f of m.children)d(f);else m.lines>s&&(l>s||!l)?(p(),o.push(m)):m instanceof xe&&l&&(h=u[u.length-1])instanceof xe&&m.lines+h.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new xe(h.text.concat(m.text),h.length+1+m.length)):(l+m.lines>r&&p(),l+=m.lines,c+=m.length+1,u.push(m))}function p(){l!=0&&(o.push(u.length==1?u[0]:ln.from(u,c)),c=-1,l=u.length=0)}for(let m of e)d(m);return p(),o.length==1?o[0]:new ln(o,t)}}oe.empty=new xe([""],0);function IF(n){let e=-1;for(let t of n)e+=t.length+1;return e}function ml(n,e,t=0,i=1e9){for(let r=0,a=0,s=!0;a<n.length&&r<=i;a++){let o=n[a],l=r+o.length;l>=t&&(l>i&&(o=o.slice(0,i-r)),r<t&&(o=o.slice(t-r)),s?(e[e.length-1]+=o,s=!1):e.push(o)),r=l+1}return e}function fx(n,e,t){return ml(n,[""],e,t)}class Wa{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof xe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],a=this.offsets[i],s=a>>1,o=r instanceof xe?r.text.length:r.children.length;if(s==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
316
316
  `,this;e--}else if(r instanceof xe){let l=r.text[s+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[s+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof xe?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class gx{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wa(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bx{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(oe.prototype[Symbol.iterator]=function(){return this.iter()},Wa.prototype[Symbol.iterator]=gx.prototype[Symbol.iterator]=bx.prototype[Symbol.iterator]=function(){return this});class LF{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Dr(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Me(n,e,t=!0,i=!0){return OF(n,e,t,i)}function BF(n){return n>=56320&&n<57344}function FF(n){return n>=55296&&n<56320}function ct(n,e){let t=n.charCodeAt(e);if(!FF(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return BF(i)?(t-55296<<10)+(i-56320)+65536:t}function em(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function cn(n){return n<65536?1:2}const tm=/\r\n?|\n/;var it=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(it||(it={}));class un{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let a=this.sections[t++],s=this.sections[t++];s<0?(e(i,r,a),r+=a):r+=s,i+=a}}iterChangedRanges(e,t=!1){nm(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new un(e)}composeDesc(e){return this.empty?e:e.empty?this:yx(this,e)}mapDesc(e,t=!1){return e.empty?this:im(this,e,t)}mapPos(e,t=-1,i=it.Simple){let r=0,a=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],l=this.sections[s++],c=r+o;if(l<0){if(c>e)return a+(e-r);a+=o}else{if(i!=it.Simple&&c>=e&&(i==it.TrackDel&&r<e&&c>e||i==it.TrackBefore&&r<e||i==it.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?a:a+l;a+=l}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return a}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let a=this.sections[i++],s=this.sections[i++],o=r+a;if(s>=0&&r<=t&&o>=e)return r<e&&o>t?"cover":!0;r=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new un(e)}static create(e){return new un(e)}}class De extends un{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return nm(this,(t,i,r,a,s)=>e=e.replace(r,r+(i-t),s),!1),e}mapDesc(e,t=!1){return im(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,a=0;r<t.length;r+=2){let s=t[r],o=t[r+1];if(o>=0){t[r]=o,t[r+1]=s;let l=r>>1;for(;i.length<l;)i.push(oe.empty);i.push(s?e.slice(a,a+s):oe.empty)}a+=s}return new De(t,i)}compose(e){return this.empty?e:e.empty?this:yx(this,e,!0)}map(e,t=!1){return e.empty?this:im(this,e,t,!0)}iterChanges(e,t=!1){nm(this,e,t)}get desc(){return un.create(this.sections)}filter(e){let t=[],i=[],r=[],a=new Ha(this);e:for(let s=0,o=0;;){let l=s==e.length?1e9:e[s++];for(;o<l||o==l&&a.len==0;){if(a.done)break e;let u=Math.min(a.len,l-o);Xe(r,u,-1);let d=a.ins==-1?-1:a.off==0?a.ins:0;Xe(t,u,d),d>0&&ni(i,t,a.text),a.forward(u),o+=u}let c=e[s++];for(;o<c;){if(a.done)break e;let u=Math.min(a.len,c-o);Xe(t,u,-1),Xe(r,u,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(u),o+=u}}return{changes:new De(t,i),filtered:un.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],a=[],s=0,o=null;function l(u=!1){if(!u&&!r.length)return;s<t&&Xe(r,t-s,-1);let d=new De(r,a);o=o?o.compose(d.map(o)):d,r=[],a=[],s=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof De){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),o=o?o.compose(u.map(o)):u}else{let{from:d,to:p=d,insert:m}=u;if(d>p||d<0||p>t)throw new RangeError(`Invalid change range ${d} to ${p} (in doc of length ${t})`);let h=m?typeof m=="string"?oe.of(m.split(i||tm)):m:oe.empty,f=h.length;if(d==p&&f==0)return;d<s&&l(),d>s&&Xe(r,d-s,-1),Xe(r,p-d,f),ni(a,r,h),s=p}}return c(e),l(!o),o}static empty(e){return new De(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let a=e[r];if(typeof a=="number")t.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((s,o)=>o&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)t.push(a[0],0);else{for(;i.length<r;)i.push(oe.empty);i[r]=oe.of(a.slice(1)),t.push(a[0],i[r].length)}}}return new De(t,i)}static createSet(e,t){return new De(e,t)}}function Xe(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function ni(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(oe.empty);n.push(t)}}function nm(n,e,t){let i=n.inserted;for(let r=0,a=0,s=0;s<n.sections.length;){let o=n.sections[s++],l=n.sections[s++];if(l<0)r+=o,a+=o;else{let c=r,u=a,d=oe.empty;for(;c+=o,u+=l,l&&i&&(d=d.append(i[s-2>>1])),!(t||s==n.sections.length||n.sections[s+1]<0);)o=n.sections[s++],l=n.sections[s++];e(r,c,a,u,d),r=c,a=u}}}function im(n,e,t,i=!1){let r=[],a=i?[]:null,s=new Ha(n),o=new Ha(e);for(let l=-1;;){if(s.done&&o.len||o.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&o.ins==-1){let c=Math.min(s.len,o.len);Xe(r,c,-1),s.forward(c),o.forward(c)}else if(o.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(o.len<s.len||o.len==s.len&&!t))){let c=o.len;for(Xe(r,o.ins,-1);c;){let u=Math.min(s.len,c);s.ins>=0&&l<s.i&&s.len<=u&&(Xe(r,0,s.ins),a&&ni(a,r,s.text),l=s.i),s.forward(u),c-=u}o.next()}else if(s.ins>=0){let c=0,u=s.len;for(;u;)if(o.ins==-1){let d=Math.min(u,o.len);c+=d,u-=d,o.forward(d)}else if(o.ins==0&&o.len<u)u-=o.len,o.next();else break;Xe(r,c,l<s.i?s.ins:0),a&&l<s.i&&ni(a,r,s.text),l=s.i,s.forward(s.len-u)}else{if(s.done&&o.done)return a?De.createSet(r,a):un.create(r);throw new Error("Mismatched change set lengths")}}}function yx(n,e,t=!1){let i=[],r=t?[]:null,a=new Ha(n),s=new Ha(e);for(let o=!1;;){if(a.done&&s.done)return r?De.createSet(i,r):un.create(i);if(a.ins==0)Xe(i,a.len,0,o),a.next();else if(s.len==0&&!s.done)Xe(i,0,s.ins,o),r&&ni(r,i,s.text),s.next();else{if(a.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(a.len2,s.len),c=i.length;if(a.ins==-1){let u=s.ins==-1?-1:s.off?0:s.ins;Xe(i,l,u,o),r&&u&&ni(r,i,s.text)}else s.ins==-1?(Xe(i,a.off?0:a.len,l,o),r&&ni(r,i,a.textBit(l))):(Xe(i,a.off?0:a.len,s.off?0:s.ins,o),r&&!s.off&&ni(r,i,s.text));o=(a.ins>l||s.ins>=0&&s.len>l)&&(o||i.length>c),a.forward2(l),s.forward(l)}}}}class Ha{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?oe.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?oe.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Li{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Li(i,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return N.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return N.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return N.range(e.anchor,e.head)}static create(e,t,i){return new Li(e,t,i)}}class N{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:N.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new N([this.main],0)}addRange(e,t=!0){return N.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,N.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new N(e.ranges.map(t=>Li.fromJSON(t)),e.main)}static single(e,t=e){return new N([N.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let a=e[r];if(a.empty?a.from<=i:a.from<i)return N.normalized(e.slice(),t);i=a.to}return new N(e,t)}static cursor(e,t=0,i,r){return Li.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,t,i,r){let a=(i??16777215)<<6|(r==null?7:Math.min(6,r));return t<e?Li.create(t,e,48|a):Li.create(e,t,(t>e?8:0)|a)}static normalized(e,t=0){let i=e[t];e.sort((r,a)=>r.from-a.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let a=e[r],s=e[r-1];if(a.empty?a.from<=s.to:a.from<s.to){let o=s.from,l=Math.max(a.to,s.to);r<=t&&t--,e.splice(--r,2,a.anchor>a.head?N.range(l,o):N.range(o,l))}}return new N(e,t)}}function wx(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let rm=0;class W{constructor(e,t,i,r,a){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=rm++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new W(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:am),!!e.static,e.enables)}of(e){return new hl([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new hl(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new hl(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function am(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class hl{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=rm++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,a=this.id,s=e[a]>>1,o=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((t=e[d.id])!==null&&t!==void 0?t:1)&1||u.push(e[d.id]);return{create(d){return d.values[s]=i(d),1},update(d,p){if(l&&p.docChanged||c&&(p.docChanged||p.selection)||sm(d,u)){let m=i(d);if(o?!kx(m,d.values[s],r):!r(m,d.values[s]))return d.values[s]=m,1}return 0},reconfigure:(d,p)=>{let m,h=p.config.address[a];if(h!=null){let f=yl(p,h);if(this.dependencies.every(g=>g instanceof W?p.facet(g)===d.facet(g):g instanceof Re?p.field(g,!1)==d.field(g,!1):!0)||(o?kx(m=i(d),f,r):r(m=i(d),f)))return d.values[s]=f,0}else m=i(d);return d.values[s]=m,1}}}}function kx(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function sm(n,e){let t=!1;for(let i of e)Ka(n,i)&1&&(t=!0);return t}function RF(n,e,t){let i=t.map(l=>n[l.id]),r=t.map(l=>l.type),a=i.filter(l=>!(l&1)),s=n[e.id]>>1;function o(l){let c=[];for(let u=0;u<i.length;u++){let d=yl(l,i[u]);if(r[u]==2)for(let p of d)c.push(p);else c.push(d)}return e.combine(c)}return{create(l){for(let c of i)Ka(l,c);return l.values[s]=o(l),1},update(l,c){if(!sm(l,a))return 0;let u=o(l);return e.compare(u,l.values[s])?0:(l.values[s]=u,1)},reconfigure(l,c){let u=sm(l,i),d=c.config.facets[e.id],p=c.facet(e);if(d&&!u&&am(t,d))return l.values[s]=p,0;let m=o(l);return e.compare(m,p)?(l.values[s]=p,0):(l.values[s]=m,1)}}}const fl=W.define({static:!0});class Re{constructor(e,t,i,r,a){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=a,this.provides=void 0}static define(e){let t=new Re(rm++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(fl).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let a=i.values[t],s=this.updateF(a,r);return this.compareF(a,s)?0:(i.values[t]=s,1)},reconfigure:(i,r)=>{let a=i.facet(fl),s=r.facet(fl),o;return(o=a.find(l=>l.field==this))&&o!=s.find(l=>l.field==this)?(i.values[t]=o.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,fl.of({field:this,create:e})]}get extension(){return this}}const Bi={lowest:4,low:3,default:2,high:1,highest:0};function Ua(n){return e=>new _x(e,n)}const Fi={highest:Ua(Bi.highest),high:Ua(Bi.high),default:Ua(Bi.default),low:Ua(Bi.low),lowest:Ua(Bi.lowest)};class _x{constructor(e,t){this.inner=e,this.prec=t}}class gl{of(e){return new om(this,e)}reconfigure(e){return gl.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class om{constructor(e,t){this.compartment=e,this.inner=t}}class bl{constructor(e,t,i,r,a,s){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=a,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],a=Object.create(null),s=new Map;for(let p of qF(e,t,s))p instanceof Re?r.push(p):(a[p.facet.id]||(a[p.facet.id]=[])).push(p);let o=Object.create(null),l=[],c=[];for(let p of r)o[p.id]=c.length<<1,c.push(m=>p.slot(m));let u=i==null?void 0:i.config.facets;for(let p in a){let m=a[p],h=m[0].facet,f=u&&u[p]||[];if(m.every(g=>g.type==0))if(o[h.id]=l.length<<1|1,am(f,m))l.push(i.facet(h));else{let g=h.combine(m.map(b=>b.value));l.push(i&&h.compare(g,i.facet(h))?i.facet(h):g)}else{for(let g of m)g.type==0?(o[g.id]=l.length<<1|1,l.push(g.value)):(o[g.id]=c.length<<1,c.push(b=>g.dynamicSlot(b)));o[h.id]=c.length<<1,c.push(g=>RF(g,h,m))}}let d=c.map(p=>p(o));return new bl(e,s,d,o,l,a)}}function qF(n,e,t){let i=[[],[],[],[],[]],r=new Map;function a(s,o){let l=r.get(s);if(l!=null){if(l<=o)return;let c=i[l].indexOf(s);c>-1&&i[l].splice(c,1),s instanceof om&&t.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let c of s)a(c,o);else if(s instanceof om){if(t.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;t.set(s.compartment,c),a(c,o)}else if(s instanceof _x)a(s.inner,s.prec);else if(s instanceof Re)i[o].push(s),s.provides&&a(s.provides,o);else if(s instanceof hl)i[o].push(s),s.facet.extensions&&a(s.facet.extensions,Bi.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(c,o)}}return a(n,Bi.default),i.reduce((s,o)=>s.concat(o))}function Ka(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function yl(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const xx=W.define(),lm=W.define({combine:n=>n.some(e=>e),static:!0}),vx=W.define({combine:n=>n.length?n[0]:void 0,static:!0}),Cx=W.define(),$x=W.define(),Sx=W.define(),Ax=W.define({combine:n=>n.length?n[0]:!1});class dn{constructor(e,t){this.type=e,this.value=t}static define(){return new zF}}class zF{of(e){return new dn(this,e)}}class GF{constructor(e){this.map=e}of(e){return new ne(this,e)}}class ne{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ne(this.type,t)}is(e){return this.type==e}static define(e={}){return new GF(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let a=r.map(t);a&&i.push(a)}return i}}ne.reconfigure=ne.define(),ne.appendConfig=ne.define();class Oe{constructor(e,t,i,r,a,s){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=a,this.scrollIntoView=s,this._doc=null,this._state=null,i&&wx(i,t.newLength),a.some(o=>o.type==Oe.time)||(this.annotations=a.concat(Oe.time.of(Date.now())))}static create(e,t,i,r,a,s){return new Oe(e,t,i,r,a,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Oe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Oe.time=dn.define(),Oe.userEvent=dn.define(),Oe.addToHistory=dn.define(),Oe.remote=dn.define();function VF(n,e){let t=[];for(let i=0,r=0;;){let a,s;if(i<n.length&&(r==e.length||e[r]>=n[i]))a=n[i++],s=n[i++];else if(r<e.length)a=e[r++],s=e[r++];else return t;!t.length||t[t.length-1]<a?t.push(a,s):t[t.length-1]<s&&(t[t.length-1]=s)}}function Ex(n,e,t){var i;let r,a,s;return t?(r=e.changes,a=De.empty(e.changes.length),s=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),a=n.changes.mapDesc(e.changes,!0),s=n.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(a):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:ne.mapEffects(n.effects,r).concat(ne.mapEffects(e.effects,a)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function cm(n,e,t){let i=e.selection,r=Or(e.annotations);return e.userEvent&&(r=r.concat(Oe.userEvent.of(e.userEvent))),{changes:e.changes instanceof De?e.changes:De.of(e.changes||[],t,n.facet(vx)),selection:i&&(i instanceof N?i:N.single(i.anchor,i.head)),effects:Or(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Tx(n,e,t){let i=cm(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(t=!1);let s=!!e[a].sequential;i=Ex(i,cm(n,e[a],s?i.changes.newLength:n.doc.length),s)}let r=Oe.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return HF(t?WF(r):r)}function WF(n){let e=n.startState,t=!0;for(let r of e.facet(Cx)){let a=r(n);if(a===!1){t=!1;break}Array.isArray(a)&&(t=t===!0?a:VF(t,a))}if(t!==!0){let r,a;if(t===!1)a=n.changes.invertedDesc,r=De.empty(e.doc.length);else{let s=n.changes.filter(t);r=s.changes,a=s.filtered.mapDesc(s.changes).invertedDesc}n=Oe.create(e,r,n.selection&&n.selection.map(a),ne.mapEffects(n.effects,a),n.annotations,n.scrollIntoView)}let i=e.facet($x);for(let r=i.length-1;r>=0;r--){let a=i[r](n);a instanceof Oe?n=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Oe?n=a[0]:n=Tx(e,Or(a),!1)}return n}function HF(n){let e=n.startState,t=e.facet(Sx),i=n;for(let r=t.length-1;r>=0;r--){let a=t[r](n);a&&Object.keys(a).length&&(i=Ex(i,cm(e,a,n.changes.newLength),!0))}return i==n?n:Oe.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const UF=[];function Or(n){return n==null?UF:Array.isArray(n)?n:[n]}var be=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(be||(be={}));const KF=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let um;try{um=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function XF(n){if(um)return um.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||KF.test(t)))return!0}return!1}function ZF(n){return e=>{if(!/\S/.test(e))return be.Space;if(XF(e))return be.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return be.Word;return be.Other}}class se{constructor(e,t,i,r,a,s){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=a,s&&(s._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Ka(this,o<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Ka(this,i),yl(this,i)}update(...e){return Tx(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let o of e.effects)o.is(gl.reconfigure)?(t&&(r=new Map,t.compartments.forEach((l,c)=>r.set(c,l)),t=null),r.set(o.value.compartment,o.value.extension)):o.is(ne.reconfigure)?(t=null,i=o.value):o.is(ne.appendConfig)&&(t=null,i=Or(i).concat(o.value));let a;t?a=e.startState.values.slice():(t=bl.resolve(i,r,this),a=new se(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let s=e.startState.facet(lm)?e.newSelection:e.newSelection.asSingle();new se(t,e.newDoc,s,a,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:N.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),a=[i.range],s=Or(i.effects);for(let o=1;o<t.ranges.length;o++){let l=e(t.ranges[o]),c=this.changes(l.changes),u=c.map(r);for(let p=0;p<o;p++)a[p]=a[p].map(u);let d=r.mapDesc(c,!0);a.push(l.range.map(d)),r=r.compose(u),s=ne.mapEffects(s,u).concat(ne.mapEffects(Or(l.effects),d))}return{changes:r,selection:N.create(a,t.mainIndex),effects:s}}changes(e=[]){return e instanceof De?e:De.of(e,this.doc.length,this.facet(se.lineSeparator))}toText(e){return oe.of(e.split(this.facet(se.lineSeparator)||tm))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ka(this,t),yl(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Re&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(e,a)){let s=i[a],o=e[a];r.push(s.init(l=>s.spec.fromJSON(o,l)))}}return se.create({doc:e.doc,selection:N.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=bl.resolve(e.extensions||[],new Map),i=e.doc instanceof oe?e.doc:oe.of((e.doc||"").split(t.staticFacet(se.lineSeparator)||tm)),r=e.selection?e.selection instanceof N?e.selection:N.single(e.selection.anchor,e.selection.head):N.single(0);return wx(r,i.length),t.staticFacet(lm)||(r=r.asSingle()),new se(t,i,r,t.dynamicSlots.map(()=>null),(a,s)=>s.create(a),null)}get tabSize(){return this.facet(se.tabSize)}get lineBreak(){return this.facet(se.lineSeparator)||`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foris/ai-agent",
3
- "version": "0.9.1-beta.5",
3
+ "version": "0.9.1-beta.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },