@forbespro/lead-agent
Version:
Lead Chat Agent React Component
2 lines (1 loc) • 1.67 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p={resolveAll:x()},y=g("string"),b=g("text");function g(r){return{resolveAll:x(r==="text"?m:void 0),tokenize:a};function a(t){const i=this,e=this.parser.constructs[r],n=t.attempt(e,o,s);return o;function o(l){return u(l)?n(l):s(l)}function s(l){if(l===null){t.consume(l);return}return t.enter("data"),t.consume(l),f}function f(l){return u(l)?(t.exit("data"),n(l)):(t.consume(l),f)}function u(l){if(l===null)return!0;const c=e[l];let d=-1;if(c)for(;++d<c.length;){const h=c[d];if(!h.previous||h.previous.call(i,i.previous))return!0}return!1}}}function x(r){return a;function a(t,i){let e=-1,n;for(;++e<=t.length;)n===void 0?t[e]&&t[e][1].type==="data"&&(n=e,e++):(!t[e]||t[e][1].type!=="data")&&(e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),e=n+2),n=void 0);return r?r(t,i):t}}function m(r,a){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){const i=r[t-1][1],e=a.sliceStream(i);let n=e.length,o=-1,s=0,f;for(;n--;){const u=e[n];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)f=!0,s++;else if(u!==-1){n++;break}}if(a._contentTypeTextTrailing&&t===r.length&&(s=0),s){const u={type:t===r.length||f||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:n?o:i.start._bufferIndex+o,_index:i.start._index+n,line:i.end.line,column:i.end.column-s,offset:i.end.offset-s},end:{...i.end}};i.end={...u.start},i.start.offset===i.end.offset?Object.assign(i,u):(r.splice(t,0,["enter",u,a],["exit",u,a]),t+=2)}t++}return r}exports.resolver=p;exports.string=y;exports.text=b;