@forbespro/lead-agent
Version:
Lead Chat Agent React Component
2 lines (1 loc) • 2.49 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index83.js"),p=require("./index84.js"),u=require("./index85.js"),d=require("./index86.js"),c=require("./index71.js"),a=["history","path","basename","stem","extname","dirname"];class l{constructor(t){let e;t?d.isUrl(t)?e={path:t}:typeof t=="string"||g(t)?e={value:t}:e=t:e={},this.cwd="cwd"in e?"":p.minproc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<a.length;){const h=a[r];h in e&&e[h]!==void 0&&e[h]!==null&&(this[h]=h==="history"?[...e[h]]:e[h])}let i;for(i in e)a.includes(i)||(this[i]=e[i])}get basename(){return typeof this.path=="string"?n.minpath.basename(this.path):void 0}set basename(t){m(t,"basename"),o(t,"basename"),this.path=n.minpath.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?n.minpath.dirname(this.path):void 0}set dirname(t){f(this.basename,"dirname"),this.path=n.minpath.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?n.minpath.extname(this.path):void 0}set extname(t){if(o(t,"extname"),f(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=n.minpath.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){d.isUrl(t)&&(t=u.urlToPath(t)),m(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?n.minpath.basename(this.path,this.extname):void 0}set stem(t){m(t,"stem"),o(t,"stem"),this.path=n.minpath.join(this.dirname||"",t+(this.extname||""))}fail(t,e,r){const i=this.message(t,e,r);throw i.fatal=!0,i}info(t,e,r){const i=this.message(t,e,r);return i.fatal=void 0,i}message(t,e,r){const i=new c.VFileMessage(t,e,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function o(s,t){if(s&&s.includes(n.minpath.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+n.minpath.sep+"`")}function m(s,t){if(!s)throw new Error("`"+t+"` cannot be empty")}function f(s,t){if(!s)throw new Error("Setting `"+t+"` requires `path` to be set too")}function g(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}exports.VFile=l;