@forbespro/lead-agent
Version:
Lead Chat Agent React Component
4 lines (3 loc) • 3.34 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("./index146.js"),F=require("./index160.js"),W=require("./index184.js");function X(d,l,o){let n={_bufferIndex:-1,_index:0,line:o&&o.line||1,column:o&&o.column||1,offset:o&&o.offset||0};const f={},u=[];let i=[],x=[];const w={attempt:g(J),check:g(z),consume:D,enter:G,exit:H,interrupt:g(z,{interrupt:!0})},t={code:null,containerState:{},defineSkip:$,events:[],now:p,parser:d,previous:null,sliceSerialize:M,sliceStream:T,write:L};let O=l.tokenize.call(t,w);return l.resolveAll&&u.push(l),t;function L(e){return i=F.push(i,e),R(),i[i.length-1]!==null?[]:(P(l,0),t.events=W.resolveAll(u,t.events,t),t.events)}function M(e,r){return Z(T(e),r)}function T(e){return Y(i,e)}function p(){const{_bufferIndex:e,_index:r,line:c,column:a,offset:v}=n;return{_bufferIndex:e,_index:r,line:c,column:a,offset:v}}function $(e){f[e.line]=e.column,C()}function R(){let e;for(;n._index<i.length;){const r=i[n._index];if(typeof r=="string")for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;)j(r.charCodeAt(n._bufferIndex));else j(r)}}function j(e){O=O(e)}function D(e){V.markdownLineEnding(e)?(n.line++,n.column=1,n.offset+=e===-3?2:1,C()):e!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===i[n._index].length&&(n._bufferIndex=-1,n._index++)),t.previous=e}function G(e,r){const c=r||{};return c.type=e,c.start=p(),t.events.push(["enter",c,t]),x.push(c),c}function H(e){const r=x.pop();return r.end=p(),t.events.push(["exit",r,t]),r}function J(e,r){P(e,r.from)}function z(e,r){r.restore()}function g(e,r){return c;function c(a,v,_){let y,k,q,m;return Array.isArray(a)?A(a):"tokenize"in a?A([a]):N(a);function N(s){return S;function S(h){const b=h!==null&&s[h],I=h!==null&&s.null,U=[...Array.isArray(b)?b:b?[b]:[],...Array.isArray(I)?I:I?[I]:[]];return A(U)(h)}}function A(s){return y=s,k=0,s.length===0?_:B(s[k])}function B(s){return S;function S(h){return m=K(),q=s,s.partial||(t.currentConstruct=s),s.name&&t.parser.constructs.disable.null.includes(s.name)?E():s.tokenize.call(r?Object.assign(Object.create(t),r):t,w,Q,E)(h)}}function Q(s){return e(q,m),v}function E(s){return m.restore(),++k<y.length?B(y[k]):_}}}function P(e,r){e.resolveAll&&!u.includes(e)&&u.push(e),e.resolve&&F.splice(t.events,r,t.events.length-r,e.resolve(t.events.slice(r),t)),e.resolveTo&&(t.events=e.resolveTo(t.events,t))}function K(){const e=p(),r=t.previous,c=t.currentConstruct,a=t.events.length,v=Array.from(x);return{from:a,restore:_};function _(){n=e,t.previous=r,t.currentConstruct=c,t.events.length=a,x=v,C()}}function C(){n.line in f&&n.column<2&&(n.column=f[n.line],n.offset+=f[n.line]-1)}}function Y(d,l){const o=l.start._index,n=l.start._bufferIndex,f=l.end._index,u=l.end._bufferIndex;let i;if(o===f)i=[d[o].slice(n,u)];else{if(i=d.slice(o,f),n>-1){const x=i[0];typeof x=="string"?i[0]=x.slice(n):i.shift()}u>0&&i.push(d[f].slice(0,u))}return i}function Z(d,l){let o=-1;const n=[];let f;for(;++o<d.length;){const u=d[o];let i;if(typeof u=="string")i=u;else switch(u){case-5:{i="\r";break}case-4:{i=`
`;break}case-3:{i=`\r
`;break}case-2:{i=l?" ":" ";break}case-1:{if(!l&&f)continue;i=" ";break}default:i=String.fromCharCode(u)}f=u===-2,n.push(i)}return n.join("")}exports.createTokenizer=X;