@limai.io/cli 0.4.5 → 0.4.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.
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
25
25
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>tu(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=pe.basename(e,pe.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,n,i,r;return t?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=Number($.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
26
|
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
|
|
27
27
|
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function hs(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function Mn(){if($.env.NO_COLOR||$.env.FORCE_COLOR==="0"||$.env.FORCE_COLOR==="false")return!1;if($.env.FORCE_COLOR||$.env.CLICOLOR_FORCE!==void 0)return!0}Un.Command=Ln;Un.useColor=Mn});var bs=P(X=>{"use strict";var{Argument:Cs}=It(),{Command:Wn}=Fs(),{CommanderError:ru,InvalidArgumentError:ys}=Xe(),{Help:ou}=On(),{Option:Es}=Pn();X.program=new Wn;X.createCommand=s=>new Wn(s);X.createOption=(s,e)=>new Es(s,e);X.createArgument=(s,e)=>new Cs(s,e);X.Command=Wn;X.Option=Es;X.Argument=Cs;X.Help=ou;X.CommanderError=ru;X.InvalidArgumentError=ys;X.InvalidOptionArgumentError=ys});var _r=P((Wp,tl)=>{tl.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Fi=P((Vp,Sr)=>{"use strict";var en=Object.assign({},_r()),vr=Object.keys(en);Object.defineProperty(en,"random",{get(){let s=Math.floor(Math.random()*vr.length),e=vr[s];return en[e]}});Sr.exports=en});var io=P((ED,no)=>{"use strict";var Bi=class{constructor(e,t,n){this.etaBufferLength=e||100,this.valueBuffer=[n],this.timeBuffer=[t],this.eta="0"}update(e,t,n){this.valueBuffer.push(t),this.timeBuffer.push(e),this.calculate(n-t)}getTime(){return this.eta}calculate(e){let t=this.valueBuffer.length,n=Math.min(this.etaBufferLength,t),i=this.valueBuffer[t-1]-this.valueBuffer[t-n],r=this.timeBuffer[t-1]-this.timeBuffer[t-n],o=i/r;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/o/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};no.exports=Bi});var Pi=P((bD,so)=>{"use strict";var _e=require("readline"),$i=class{constructor(e){this.stream=e,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(e){this.stream.isTTY&&(e?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(e=null,t=null){this.stream.isTTY&&_e.cursorTo(this.stream,e,t)}cursorRelative(e=null,t=null){this.stream.isTTY&&(this.dy=this.dy+t,_e.moveCursor(this.stream,e,t))}cursorRelativeReset(){this.stream.isTTY&&(_e.moveCursor(this.stream,0,-this.dy),_e.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&_e.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&_e.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&_e.clearScreenDown(this.stream)}newline(){this.stream.write(`
|
|
28
|
-
`),this.dy++}write(e,t=!1){this.linewrap===!0&&t===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};so.exports=$i});var oo=P((wD,ro)=>{"use strict";ro.exports=({onlyFirst:s=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}});var uo=P((ID,ao)=>{"use strict";var jl=oo();ao.exports=s=>typeof s=="string"?s.replace(jl(),""):s});var co=P((AD,Ni)=>{"use strict";var lo=s=>Number.isNaN(s)?!1:s>=4352&&(s<=4447||s===9001||s===9002||11904<=s&&s<=12871&&s!==12351||12880<=s&&s<=19903||19968<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65131||65281<=s&&s<=65376||65504<=s&&s<=65510||110592<=s&&s<=110593||127488<=s&&s<=127569||131072<=s&&s<=262141);Ni.exports=lo;Ni.exports.default=lo});var mo=P((_D,po)=>{"use strict";po.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var fo=P((vD,ji)=>{"use strict";var Ll=uo(),Ml=co(),Ul=mo(),Do=s=>{if(typeof s!="string"||s.length===0||(s=Ll(s),s.length===0))return 0;s=s.replace(Ul()," ");let e=0;for(let t=0;t<s.length;t++){let n=s.codePointAt(t);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&t++,e+=Ml(n)?2:1)}return e};ji.exports=Do;ji.exports.default=Do});var Li=P((SD,go)=>{"use strict";go.exports=function(e,t,n){if(t.autopadding!==!0)return e;function i(r,o){return(t.autopaddingChar+r).slice(-o)}return n==="percentage"?i(e,3):e}});var Mi=P((xD,ho)=>{"use strict";ho.exports=function(e,t){let n=Math.round(e*t.barsize),i=t.barsize-n;return t.barCompleteString.substr(0,n)+t.barGlue+t.barIncompleteString.substr(0,i)}});var Ui=P((TD,Fo)=>{"use strict";Fo.exports=function(e,t,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(t.autopaddingChar+o).slice(-2)}return e>3600?r(Math.floor(e/3600))+"h"+r(i(e%3600/60))+"m":e>60?r(Math.floor(e/60))+"m"+r(i(e%60))+"s":e>10?r(i(e))+"s":r(e)+"s"}});var Wi=P((RD,Co)=>{"use strict";var Wl=fo(),Vl=Li(),Hl=Mi(),Jl=Ui();Co.exports=function(e,t,n){let i=e.format,r=e.formatTime||Jl,o=e.formatValue||Vl,a=e.formatBar||Hl,u=Math.floor(t.progress*100)+"",l=t.stopTime||Date.now(),c=Math.round((l-t.startTime)/1e3),d=Object.assign({},n,{bar:a(t.progress,e),percentage:o(u,e,"percentage"),total:o(t.total,e,"total"),value:o(t.value,e,"value"),eta:o(t.eta,e,"eta"),eta_formatted:r(t.eta,e,5),duration:o(c,e,"duration"),duration_formatted:r(c,e,1)});i=i.replace(/\{(\w+)\}/g,function(F,A){return typeof d[A]<"u"?d[A]:F});let m=Math.max(0,t.maxWidth-Wl(i)-2),h=Math.floor(m/2);switch(e.align){case"right":i=m>0?" ".repeat(m)+i:i;break;case"center":i=h>0?" ".repeat(h)+i:i;break;default:break}return i}});var ln=P((OD,yo)=>{"use strict";function j(s,e){return typeof s>"u"||s===null?e:s}yo.exports={parse:function(e,t){let n={},i=Object.assign({},t,e);return n.throttleTime=1e3/j(i.fps,10),n.stream=j(i.stream,process.stderr),n.terminal=j(i.terminal,null),n.clearOnComplete=j(i.clearOnComplete,!1),n.stopOnComplete=j(i.stopOnComplete,!1),n.barsize=j(i.barsize,40),n.align=j(i.align,"left"),n.hideCursor=j(i.hideCursor,!1),n.linewrap=j(i.linewrap,!1),n.barGlue=j(i.barGlue,""),n.barCompleteChar=j(i.barCompleteChar,"="),n.barIncompleteChar=j(i.barIncompleteChar,"-"),n.format=j(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=j(i.formatTime,null),n.formatValue=j(i.formatValue,null),n.formatBar=j(i.formatBar,null),n.etaBufferLength=j(i.etaBuffer,10),n.etaAsynchronousUpdate=j(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=j(i.progressCalculationRelative,!1),n.synchronousUpdate=j(i.synchronousUpdate,!0),n.noTTYOutput=j(i.noTTYOutput,!1),n.notTTYSchedule=j(i.notTTYSchedule,2e3),n.emptyOnZero=j(i.emptyOnZero,!1),n.forceRedraw=j(i.forceRedraw,!1),n.autopadding=j(i.autopadding,!1),n.gracefulExit=j(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?j(e.autopaddingChar," "):"",e}}});var Vi=P((BD,bo)=>{"use strict";var Eo=io(),ql=Pi(),Gl=Wi(),Kl=ln(),Yl=require("events");bo.exports=class extends Yl{constructor(e){super(),this.options=Kl.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ql(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new Eo(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Gl}render(e=!1){let t={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,t,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,t,n){this.value=t||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=t||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Eo(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,t)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,t={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:t)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,t={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,t)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Io=P((PD,wo)=>{"use strict";var zl=Vi(),Xl=ln();wo.exports=class extends zl{constructor(e,t){super(Xl.parse(e,t)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,t){this.timer&&(super.update(e,t),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,t,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,t,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var _o=P((jD,Ao)=>{"use strict";var Ql=Pi(),Zl=Vi(),ec=ln(),tc=require("events");Ao.exports=class extends tc{constructor(e,t){super(),this.bars=[],this.options=ec.parse(e,t),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Ql(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,t,n,i={}){let r=new Zl(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(r),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,r.start(e,t,n),this.emit("start")),r}remove(e){let t=this.bars.indexOf(e);return t<0?!1:(this.bars.splice(t,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var So=P((LD,vo)=>{"use strict";vo.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var To=P((MD,xo)=>{"use strict";xo.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Oo=P((UD,Ro)=>{"use strict";Ro.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Bo=P((WD,ko)=>{"use strict";ko.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Po=P((VD,$o)=>{"use strict";var nc=So(),ic=To(),sc=Oo(),rc=Bo();$o.exports={legacy:nc,shades_classic:ic,shades_grey:sc,rect:rc}});var Lo=P((HD,jo)=>{"use strict";var No=Io(),oc=_o(),ac=Po(),uc=Wi(),lc=Li(),cc=Mi(),dc=Ui();jo.exports={Bar:No,SingleBar:No,MultiBar:oc,Presets:ac,Format:{Formatter:uc,BarFormat:cc,ValueFormat:lc,TimeFormat:dc}}});var ws=I(bs(),1),{program:Vc,createCommand:Hc,createArgument:Jc,createOption:qc,CommanderError:Gc,InvalidArgumentError:Q,InvalidOptionArgumentError:Kc,Command:Is,Argument:Yc,Option:zc,Help:Xc}=ws.default;var Ee=!1,As=!1;function _s(s){Ee=s}function p(){return Ee}function vs(s){As=s}function D(s){console.log(JSON.stringify(s,null,2))}function _(s){Ee?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&As&&console.error(JSON.stringify(s.details,null,2)))}function au(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function Ss(s){au(s)&&(_({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),_({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function E(s){Ee||console.log(`\x1B[32m${s}\x1B[0m`)}function B(s){Ee||console.log(`\x1B[36m${s}\x1B[0m`)}function Y(s){Ee||console.log(`\x1B[33m${s}\x1B[0m`)}function Qe(s){Ee||console.log(`\x1B[2m${s}\x1B[0m`)}var ei=I(require("readline"));var q=I(require("fs")),Be=I(require("path")),xs=I(require("os")),_t=require("child_process"),Vn=Be.join(xs.homedir(),".limai"),Ze=Be.join(Vn,"config.json"),uu=".limai.token",ke;function lu(s){if(!q.existsSync(s))return{};let e={};for(let t of q.readFileSync(s,"utf-8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);n&&(e[n[1]]=n[2].replace(/^(["'])(.*)\1$/,"$2"))}return e}function Ts(){if(ke!==void 0)return ke;try{let s=(0,_t.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!q.existsSync(Be.join(s,"packages","cli")))return ke=null,null;let e=(0,_t.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t="";if(e!==".git"){let i=(0,_t.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(i){let r=i.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");r&&(t=`${r}.`)}}let n=lu(Be.join(s,"tables",".env.local"));return ke={root:s,apiUrl:n.NEXT_PUBLIC_BASE_URL??`https://${t}tables.localhost`,sseUrl:n.NEXT_PUBLIC_SSE_URL??`https://${t}ws.localhost`},ke}catch{return ke=null,null}}function cu(){let s=Ts();if(!s)return;let e=Be.join(s.root,uu);if(q.existsSync(e))return q.readFileSync(e,"utf-8").trim()}function $e(){let s=process.env.LIMAI_API_TOKEN,e=process.env.LIMAI_API_URL,t=process.env.LIMAI_SSE_URL,n={};if(q.existsSync(Ze))try{let u=q.readFileSync(Ze,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=Ts(),r=s||cu()||n.token,o=e||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=t||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function be(s){let e={};if(q.existsSync(Ze))try{let n=q.readFileSync(Ze,"utf-8");e=JSON.parse(n)}catch{e={}}let t={...e,...s};q.existsSync(Vn)||q.mkdirSync(Vn,{recursive:!0,mode:448}),q.writeFileSync(Ze,JSON.stringify(t,null,2),{mode:384})}function f(){let s=$e();return s||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),s}function Rs(){return!!process.env.LIMAI_EXECUTION_ID}var $s=require("fs"),Ps=require("fs/promises"),Ns=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(e,t){super(e),this.name="LimaiError",this.code=t.code,this.statusCode=t.statusCode,this.exitCode=t.exitCode??1,this.details=t.details}},Hn=class extends R{constructor(e,t){super(e,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:t}),this.name="AuthError"}},Jn=class extends R{constructor(e,t){super(e,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:t}),this.name="ForbiddenError"}},et=class extends R{constructor(e,t){super(e,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:t}),this.name="NotFoundError"}},W=class extends R{constructor(e,t){super(e,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:t}),this.name="ValidationError"}},qn=class extends R{constructor(e,t){super(e,{code:"CONFLICT",statusCode:409,exitCode:4,details:t}),this.name="ConflictError"}},Gn=class extends R{retryAfterMs;constructor(e,t){super(e,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=t}},Kn=class extends R{constructor(e,t=500,n){super(e,{code:"SERVER_ERROR",statusCode:t,exitCode:6,details:n}),this.name="ServerError"}},Pe=class extends R{constructor(e){super(e,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},ge=class extends R{constructor(e,t){super(e,{code:"UPLOAD_ERROR",exitCode:8,details:t}),this.name="UploadError"}};function Os(s,e,t){switch(s){case 400:return new W(e,t);case 401:return new Hn(e,t);case 403:return new Jn(e,t);case 404:return new et(e,t);case 409:return new qn(e,t);case 429:return new Gn(e);default:return s>=500?new Kn(e,s,t):new R(e,{code:"HTTP_ERROR",statusCode:s,details:t})}}var du=3e4,Yn=3,ks=1e3,Bs=2;function pu(){return process.env.LIMAI_DEBUG==="1"}function tt(...s){pu()&&console.error("[limai:http]",...s)}var vt=class{baseUrl;token;constructor(e){this.baseUrl=e.apiUrl.replace(/\/$/,""),this.token=e.token}buildUrl(e,t){let n=new URL(`/api/v1${e}`,this.baseUrl);if(t)for(let[i,r]of Object.entries(t))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let e={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},t=process.env.VERCEL_BYPASS;return t&&(e["x-vercel-protection-bypass"]=t),e}async parseErrorBody(e){try{let t=await e.json();return{message:typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:`HTTP ${e.status}`,details:t.details}}catch{return{message:await e.text().catch(()=>"")||`HTTP ${e.status}`}}}shouldRetry(e){return e===429||e>=500}getRetryDelay(e,t){let n=e.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return ks*Math.pow(Bs,t)}async request(e,t,n={}){let i=this.buildUrl(t,n.params),r=n.timeoutMs??du;for(let o=0;o<=Yn;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{tt(`${e} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:e,headers:this.authHeaders(),body:n.body?JSON.stringify(n.body):void 0,signal:a.signal});if(clearTimeout(u),l.ok){let m=await l.text();return m?JSON.parse(m):{}}if(n.retry!==!1&&this.shouldRetry(l.status)&&o<Yn){let m=this.getRetryDelay(l,o);tt(`Retrying in ${m}ms (status ${l.status})`),await new Promise(h=>setTimeout(h,m));continue}let{message:c,details:d}=await this.parseErrorBody(l);throw Os(l.status,c,d)}catch(l){if(clearTimeout(u),l instanceof R)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(n.retry!==!1&&o<Yn){let c=ks*Math.pow(Bs,o);tt(`Timeout, retrying in ${c}ms`),await new Promise(d=>setTimeout(d,c));continue}throw new Pe(`Request timed out after ${r}ms: ${e} ${t}`)}throw new R(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(e,t,n){return this.request("GET",e,{params:t,timeoutMs:n})}async post(e,t,n,i){return this.request("POST",e,{body:t,timeoutMs:n,retry:i?.retry})}async patch(e,t,n){return this.request("PATCH",e,{body:t,retry:n?.retry})}async del(e,t){return this.request("DELETE",e,{body:t})}async putRaw(e,t,n,i){let r=t instanceof Blob?t.size:t.length;tt(`PUT ${e} (${r} bytes)`);let o=await fetch(e,{method:"PUT",headers:{"Content-Type":n},body:t});if(i&&i(r,r),!o.ok)throw new ge(`Upload failed: HTTP ${o.status}`)}async putFile(e,t,n,i){let r=(await(0,Ps.stat)(t)).size;tt(`PUT ${e} (${r} bytes, streamed from ${t})`);let o=(0,$s.createReadStream)(t),a=o;if(i){let l=0,c=new Ns.Transform({transform(d,m,h){l+=d.byteLength,i(l,r),h(null,d)}});a=o.pipe(c)}let u=await fetch(e,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new ge(`Upload failed: HTTP ${u.status}`);return r}};var St=class{constructor(e){this.http=e}http;async getUploadUrl(e,t,n){let i={filename:t,contentHash:n};return this.http.get(`/document/${e}/get-url`,i)}async processSync(e,t,n){return this.http.post(`/document/${e}/process-file/${t}`,n,18e4)}async processAsync(e,t,n){return this.http.post(`/document/${e}/process-file-async/${t}`,n)}async processFilesAsync(e,t,n){return this.http.post(`/document/${e}/process-files-async`,{fileIds:t,...n})}async getFileData(e,t,n){let i={fileId:e,extractionSchemaId:t,include:n?.length?n.join(","):void 0};return this.http.get("/document/get-file-data",i)}async getFilesData(e,t){return this.http.post("/document/get-files-data",{fileIds:e,...t?.length?{include:t}:{}})}async getDocumentData(e,t,n){let i={include:n?.length?n.join(","):void 0};return this.http.get(`/deployments/${e}/documents/${t}/data`,i)}async getDocumentsData(e,t,n){return this.http.post(`/deployments/${e}/documents/data`,{fileIds:t,...n?.length?{include:n}:{}})}async submitCorrections(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-corrections`,n)}};var xt=class{constructor(e){this.http=e}http;async list(){let e=await this.http.get("/projects");return Array.isArray(e)?e:e.data}async create(e){return this.http.post("/projects",e)}async delete(e){return this.http.del(`/projects/${e}`)}async getSharedColumnIds(e){return this.http.get(`/projects/${e}/shared-column-ids`)}async listDeployments(e){return this.http.get(`/projects/${e}/deployments`)}async listBenchmarks(e){return this.http.get(`/projects/${e}/benchmarks`)}async listNotificationRoutes(e){return this.http.get(`/projects/${e}/notifications`)}async createNotificationRoute(e,t){return this.http.post(`/projects/${e}/notifications`,t)}async updateNotificationRoute(e,t,n){return this.http.patch(`/projects/${e}/notifications/${t}`,n)}async deleteNotificationRoute(e,t){return this.http.del(`/projects/${e}/notifications/${t}`)}async listNotificationIntegrations(e,t){return this.http.get(`/projects/${e}/notifications/integrations`,{provider:t})}async listNotificationSlackChannels(e,t){return this.http.get(`/projects/${e}/notifications/integrations/slack/channels`,{connectionId:t})}async listNotificationTeamsTeams(e,t){return this.http.get(`/projects/${e}/notifications/integrations/teams/teams`,{connectionId:t})}async listNotificationTeamsChannels(e,t,n){return this.http.get(`/projects/${e}/notifications/integrations/teams/channels`,{connectionId:t,teamId:n})}};var Tt=class{constructor(e){this.http=e}http;async list(e,t){let n={status:t?.status,type:t?.type},i=await this.http.get(`/projects/${e}/deployments`,n);return Array.isArray(i)?i:i.data}async create(e,t){return this.http.post(`/projects/${e}/deployments`,t)}async getConfig(e){return this.http.get(`/deployments/${e}/configuration`)}async updateConfig(e,t){await this.http.patch(`/deployment/${e}/configuration`,t)}async listDocuments(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/deployments/${e}/documents`,n)}async getDocument(e,t){return this.http.get(`/deployments/${e}/documents/${t}`)}async deleteDocument(e,t){await this.http.del(`/deployments/${e}/documents/${t}`)}async bulkDelete(e,t){await this.http.del(`/deployments/${e}/documents/bulk-delete`,{fileIds:t})}};var Rt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/tables/${e}`)}async listColumns(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async listRows(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/tables/${e}/rows`,n)}async createRows(e,t){return this.http.post(`/tables/${e}/rows`,t,6e4)}async deleteRows(e,t){return this.http.del(`/tables/${e}/rows`,t)}async createTable(e,t){return this.http.post(`/deployments/${e}/tables`,t)}async update(e,t){return this.http.patch(`/tables/${e}`,t)}};var Ot=class{constructor(e){this.http=e}http;async list(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async get(e){return this.http.get(`/columns/${e}`)}async create(e,t){let n=await this.http.post(`/tables/${e}/columns`,t);return n&&typeof n=="object"&&"data"in n?n.data:[n]}async update(e,t){return this.http.patch(`/columns/${e}`,t)}};async function*js(s,e={}){let t=Math.min(e.pageSize??100,500),n=0,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(r,n),a=o.data;if(a.length===0||(yield a,i+=a.length,n+=a.length,n>=o.pagination.total)||e.maxItems&&i>=e.maxItems)break}}async function*Ls(s,e={}){let t=Math.min(e.pageSize??100,500),n=1,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(n,r),a=o.data;if(a.length===0||(yield a,i+=a.length,n++,n>o.pagination.totalPages)||e.maxItems&&i>=e.maxItems)break}}async function kt(s){let e=[];for await(let t of s)e.push(...t);return e}var Bt=class{constructor(e){this.http=e}http;async getRows(e,t){let n={page:t?.page?.toString(),limit:t?.limit?.toString(),order:t?.order,status:t?.status};return this.http.get(`/extractions/${e}`,n)}async*getAllRows(e,t){yield*Ls(async(n,i)=>this.http.get(`/extractions/${e}`,{page:n.toString(),limit:i.toString(),order:t?.order,status:t?.status}),t)}async collectAllRows(e,t){return kt(this.getAllRows(e,t))}};var $t=class{constructor(e){this.http=e}http;async getStatus(e){return this.http.get(`/queue/${e}/status`)}async cancel(e){await this.http.post("/queue/cancel",{jobId:e})}async updateStatus(e,t){return this.http.patch(`/queue/${e}/status`,t)}};var Pt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/classify",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/classify/${e}/get-url`,{filename:t})}async classify(e,t){return this.http.post(`/classify/${e}`,{fileId:t})}async classifyAsync(e,t){return this.http.post(`/classify/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/classify/${e}`,{classificationId:t})}async createClassifier(e){return this.http.post("/classify",e)}async createRoute(e,t){return this.http.post(`/classify/${e}/routes`,t)}};var Nt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/split",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/split/${e}/get-url`,{filename:t})}async split(e,t){return this.http.post(`/split/${e}`,{fileId:t})}async splitAsync(e,t){return this.http.post(`/split/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/split/${e}`,{splitId:t})}async listSplits(e){return this.http.get(`/split/${e}/splits`)}async createSplitter(e){return this.http.post("/split",e)}};var jt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/deployments/${e}/configuration`)}async update(e,t){return this.http.patch(`/deployments/${e}/configuration`,t)}async getAllData(e){return this.http.get(`/deployments/${e}/all-data`)}};var Lt=class{constructor(e){this.http=e}http;async list(e){return this.http.get(`/projects/${e}/buckets`)}async get(e){return this.http.get(`/buckets/${e}`)}async create(e,t,n){return this.http.post(`/projects/${e}/buckets`,{name:t,description:n})}async delete(e){await this.http.del(`/buckets/${e}`)}async getUploadUrl(e,t){return this.http.get(`/buckets/${e}/get-url`,{filename:t})}async confirmUpload(e,t,n){await this.http.patch(`/buckets/${e}/files/${t}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(e,t){let n={};return t&&t.length>0&&(n.labels=t.join(",")),this.http.get(`/buckets/${e}/files`,n)}async getDownloadUrl(e,t){return this.http.get(`/buckets/${e}/files/${t}/download`)}async updateLabels(e,t,n){return this.http.patch(`/buckets/${e}/files/${t}`,{labels:n})}async deleteFile(e,t){await this.http.del(`/buckets/${e}/files/${t}`)}async sendTo(e,t,n,i){return this.http.post(`/buckets/${e}/files/${t}/send-to`,{targetType:n,targetId:i})}};var Mt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.status&&(n.status=t.status),this.http.get(`/projects/${e}/agents`,n)}async get(e,t){return this.http.get(`/projects/${e}/agents/${t}`)}async create(e,t){return this.http.post(`/projects/${e}/agents`,t)}async update(e,t,n){return this.http.patch(`/projects/${e}/agents/${t}`,n)}async delete(e,t){await this.http.del(`/projects/${e}/agents/${t}`)}async getFileUploadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/get-url`,{filename:n})}async deleteFile(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/files/${n}`)}async updateFileMetadata(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/files/${n}`,i)}async getFileDownloadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/${n}/download`)}async listSkills(e,t){return this.http.get(`/projects/${e}/agents/${t}/skills`)}async createSkill(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/skills`,n)}async updateSkill(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/skills/${n}`,i)}async deleteSkill(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}`)}async linkFileToSkill(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(e,t,n,i){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}/files/${i}`)}async listRuns(e,t,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${e}/agents/${t}/runs`,i)}async getRun(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/runs/${n}`)}async getRunConversation(e,t,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/conversation`,r)}async getRunInferenceLogs(e,t,n,i){let r={};return i?.limit!==void 0&&(r.limit=String(i.limit)),i?.status&&(r.status=i.status),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/inference-logs`,r)}async createRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs`,n)}async createStep(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,i)}async createSteps(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,{steps:i})}async updateRun(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}`,i)}async updateStep(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,r)}async updateStepConditions(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/pause`,{})}async submitStepAction(e,t,n,i,r){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}/action`,r)}async sendEmail(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/send-email`,n)}async completeExecution(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/executions/complete`,n)}async getSharePointToken(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/sharepoint-token`,n)}async getArtifactUploadUrl(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/upload-artifact/get-url`,n)}};var Ut=class{constructor(e){this.http=e}http;async ask(e,t){return this.http.post(`/projects/${e}/vision/ask`,t,12e4)}};var Wt=class{constructor(e){this.http=e}http;async submit(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-validation`,n)}async listScripts(e){return(await this.http.get(`/deployments/${e}/validation-scripts`)).scripts}async getScript(e,t,n){return(await this.http.get(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(e,t){return this.http.post(`/deployments/${e}/validation-scripts`,t)}async updateScript(e,t,n){return(await this.http.patch(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n)).script}async deleteScript(e,t){return this.http.del(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`)}};var Vt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),this.http.get(`/projects/${e}/labels`,n)}async addRemove(e,t,n,i,r){return this.http.post(`/projects/${e}/labels`,{entityType:t,entityId:n,add:i,remove:r})}async search(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),t?.labels&&(n.labels=t.labels),t?.key&&(n.key=t.key),this.http.get(`/projects/${e}/labels/search`,n)}};var nt=["DOCUMENT_EXTRACTED","DOCUMENT_REVIEWED","DOCUMENT_EXTRACTION_FAILED","DOCUMENT_VALIDATED","DOCUMENT_VALIDATION_STARTED","DOCUMENT_VALIDATION_FAILED","DOCUMENT_CLASSIFIED","DOCUMENT_CLASSIFICATION_FAILED","DOCUMENT_SPLIT","DOCUMENT_SPLIT_FAILED","AGENT_RUN_STARTED","AGENT_RUN_COMPLETED","AGENT_RUN_FAILED","AGENT_RUN_WAITING_HUMAN"],zn=["success","failed","dead_lettered","retrying","pending"],Xn=["24h","7d","30d"],Qn=["hour","day"];var Ht=class{constructor(e){this.http=e}http;basePath(e){return`/projects/${e}/webhooks`}async list(e){return this.http.get(this.basePath(e))}async get(e,t){return this.http.get(`${this.basePath(e)}/${t}`)}async create(e,t){return this.http.post(this.basePath(e),t,void 0,{retry:!1})}async update(e,t,n){return this.http.patch(`${this.basePath(e)}/${t}`,n,{retry:!1})}async delete(e,t){await this.http.del(`${this.basePath(e)}/${t}`)}async pause(e,t){return this.http.post(`${this.basePath(e)}/${t}/pause`)}async resume(e,t){return this.http.post(`${this.basePath(e)}/${t}/resume`)}async verify(e,t){return this.http.post(`${this.basePath(e)}/${t}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(e,t){return this.http.post(`${this.basePath(e)}/${t}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(e,t,n){let i={};return n?.status&&(i.status=n.status),n?.eventType&&(i.eventType=n.eventType),n?.deploymentId&&(i.deploymentId=n.deploymentId),n?.agentId&&(i.agentId=n.agentId),n?.classifierId&&(i.classifierId=n.classifierId),n?.splitterId&&(i.splitterId=n.splitterId),n?.limit!==void 0&&(i.limit=String(n.limit)),n?.offset!==void 0&&(i.offset=String(n.offset)),this.http.get(`${this.basePath(e)}/${t}/deliveries`,i)}async metrics(e,t,n){let i={};return n?.window&&(i.window=n.window),n?.bucket&&(i.bucket=n.bucket),this.http.get(`${this.basePath(e)}/${t}/metrics`,i)}async retry(e,t,n){return this.http.post(`${this.basePath(e)}/${t}/retry`,{eventIds:n})}};var Jt=I(require("fs")),Ne=I(require("path"));var Ms=I(require("fs")),Us=I(require("crypto"));async function Ws(s){return new Promise((e,t)=>{let n=Us.createHash("sha256"),i=Ms.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>e(n.digest("hex"))),i.on("error",t)})}var mu={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Du(s){let e=Ne.extname(s).toLowerCase();return mu[e]||"application/octet-stream"}async function qt(s,e,t,n,i){let r=Ne.resolve(n),o=Ne.basename(r);if(!Jt.existsSync(r))throw new ge(`File not found: ${r}`);if(!Jt.statSync(r).isFile())throw new ge(`Not a file: ${r}`);let u=await Ws(r),l=await e.getUploadUrl(t,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=Du(r),d=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:d}}var je=I(require("fs")),Le=I(require("path"));var Hs=I(require("path"));var Vs=250,fu=5,Zn=class{constructor(e){this.max=e}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(e=>{this.queue.push(e)})}release(){this.current--;let e=this.queue.shift();e&&(this.current++,e())}};async function Js(s,e,t,n,i){let r=Math.min(i?.concurrency??fu,10),o=new Zn(r),a=n.map(m=>({path:m,filename:Hs.basename(m),status:"pending"})),u=a.map(async(m,h)=>{await o.acquire();try{m.status="uploading",i?.onFileStatus?.(m);let F=await qt(s,e,t,m.path);m.fileId=F.fileId,m.status="uploaded",i?.onFileStatus?.(m)}catch(F){m.status="failed",m.error=F instanceof Error?F.message:String(F),i?.onFileStatus?.(m)}finally{o.release()}});if(await Promise.all(u),i?.process){let h=a.filter(F=>F.status==="uploaded"&&F.fileId).map(F=>F.fileId);for(let F=0;F<h.length;F+=Vs){let A=h.slice(F,F+Vs);try{let k=await e.processFilesAsync(t,A,i.processOptions);for(let[b,C]of Object.entries(k.results)){let x=a.find(V=>V.fileId===b);x&&(C.status==="queued"?(x.status="queued",x.jobId=C.jobId):(x.status="failed",x.error=C.error),i?.onFileStatus?.(x))}}catch(k){for(let b of A){let C=a.find(x=>x.fileId===b);C&&(C.status="failed",C.error=k instanceof Error?k.message:String(k),i?.onFileStatus?.(C))}}}}let l=a.filter(m=>m.status==="uploaded"||m.status==="queued").length,c=a.filter(m=>m.status==="queued").length,d=a.filter(m=>m.status==="failed").length;return{total:n.length,uploaded:l,queued:c,failed:d,files:a}}var gu=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function qs(s,e){let t=[],n=je.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Le.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())t.push(...qs(r,e));else if(i.isFile()){let o=Le.extname(i.name).toLowerCase();if(!gu.has(o)||e&&!hu(i.name,e))continue;t.push(r)}}}return t.sort()}function hu(s,e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${t}$`,"i").test(s)}async function Gs(s,e,t,n,i){let r=Le.resolve(n);if(!je.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!je.statSync(r).isDirectory())throw new Error(`Not a directory: ${r}`);let a=qs(r,i?.globPattern);return a.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:Js(s,e,t,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var Fu=1e3,Cu=1e4,yu=1.5,Eu=3e5,bu=["COMPLETED","FAILED","STALLED"],Z=class{constructor(e){this.queue=e}queue;async*poll(e,t){let n=t?.intervalMs??Fu,i=t?.maxIntervalMs??Cu,r=t?.backoffMultiplier??yu,o=t?.timeoutMs??Eu,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new Pe(`Polling timed out after ${Math.round(o/1e3)}s for job ${e}`);let c=await this.queue.getStatus(e);if(c.status!==l&&(l=c.status,t?.onStatus?.(c),yield c),bu.includes(c.status))return;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*r,i)}}async waitForCompletion(e,t){let n;for await(let i of this.poll(e,t))n=i;if(!n)throw new Error(`No status received for job ${e}`);return n}};var g=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(e){this.http=new vt({apiUrl:e.apiUrl,token:e.token}),this.documents=new St(this.http),this.projects=new xt(this.http),this.deployments=new Tt(this.http),this.tables=new Rt(this.http),this.columns=new Ot(this.http),this.extractions=new Bt(this.http),this.queue=new $t(this.http),this.classify=new Pt(this.http),this.split=new Nt(this.http),this.schema=new jt(this.http),this.buckets=new Lt(this.http),this.agents=new Mt(this.http),this.vision=new Ut(this.http),this.validations=new Wt(this.http),this.labels=new Vt(this.http),this.webhooks=new Ht(this.http)}async uploadFile(e,t,n){return qt(this.http,this.documents,e,t,n)}async uploadFolder(e,t,n){return Gs(this.http,this.documents,e,t,n)}async processAndWait(e,t,n){let i=await this.documents.processAsync(e,t,n?.processOptions),r=new Z(this.queue),o;for await(let a of r.poll(i.jobId,n?.pollOptions))o=a;if(!o||o.status==="FAILED")throw new Error(`Extraction failed for file ${t}${o?`: ${o.status}`:""}`);return this.documents.getFileData(t,e)}async*downloadAll(e,t){yield*this.extractions.getAllRows(e,t)}};function v(s,e){if(p()){D(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let t=e||Object.keys(s[0]),n={};for(let r of t)n[r]=r.length;for(let r of s)for(let o of t){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=t.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(t.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=t.map(a=>{let u=String(r[a]??"");return u.length>60?u.slice(0,57)+"...":u.padEnd(n[a])}).join(" ");console.log(o)}}function w(s){if(p()){D(s);return}let e=Math.max(...Object.keys(s).map(t=>t.length));for(let[t,n]of Object.entries(s)){let i=`\x1B[1m${t.padEnd(e)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var zs=require("child_process"),Xs=require("crypto"),Qs=require("http"),Ks=9768,Ys=9780,wu=12e4;function Iu(){return(0,Xs.randomBytes)(32).toString("hex")}function Au(s){let e=process.platform,t=e==="darwin"?`open "${s}"`:e==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,zs.exec)(t),!0}catch{return!1}}function _u(){return`<!DOCTYPE html>
|
|
28
|
+
`),this.dy++}write(e,t=!1){this.linewrap===!0&&t===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};so.exports=$i});var oo=P((wD,ro)=>{"use strict";ro.exports=({onlyFirst:s=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}});var uo=P((ID,ao)=>{"use strict";var jl=oo();ao.exports=s=>typeof s=="string"?s.replace(jl(),""):s});var co=P((AD,Ni)=>{"use strict";var lo=s=>Number.isNaN(s)?!1:s>=4352&&(s<=4447||s===9001||s===9002||11904<=s&&s<=12871&&s!==12351||12880<=s&&s<=19903||19968<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65131||65281<=s&&s<=65376||65504<=s&&s<=65510||110592<=s&&s<=110593||127488<=s&&s<=127569||131072<=s&&s<=262141);Ni.exports=lo;Ni.exports.default=lo});var mo=P((_D,po)=>{"use strict";po.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var fo=P((vD,ji)=>{"use strict";var Ll=uo(),Ml=co(),Ul=mo(),Do=s=>{if(typeof s!="string"||s.length===0||(s=Ll(s),s.length===0))return 0;s=s.replace(Ul()," ");let e=0;for(let t=0;t<s.length;t++){let n=s.codePointAt(t);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&t++,e+=Ml(n)?2:1)}return e};ji.exports=Do;ji.exports.default=Do});var Li=P((SD,go)=>{"use strict";go.exports=function(e,t,n){if(t.autopadding!==!0)return e;function i(r,o){return(t.autopaddingChar+r).slice(-o)}return n==="percentage"?i(e,3):e}});var Mi=P((xD,ho)=>{"use strict";ho.exports=function(e,t){let n=Math.round(e*t.barsize),i=t.barsize-n;return t.barCompleteString.substr(0,n)+t.barGlue+t.barIncompleteString.substr(0,i)}});var Ui=P((TD,Fo)=>{"use strict";Fo.exports=function(e,t,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(t.autopaddingChar+o).slice(-2)}return e>3600?r(Math.floor(e/3600))+"h"+r(i(e%3600/60))+"m":e>60?r(Math.floor(e/60))+"m"+r(i(e%60))+"s":e>10?r(i(e))+"s":r(e)+"s"}});var Wi=P((RD,Co)=>{"use strict";var Wl=fo(),Vl=Li(),Hl=Mi(),Jl=Ui();Co.exports=function(e,t,n){let i=e.format,r=e.formatTime||Jl,o=e.formatValue||Vl,a=e.formatBar||Hl,u=Math.floor(t.progress*100)+"",l=t.stopTime||Date.now(),c=Math.round((l-t.startTime)/1e3),d=Object.assign({},n,{bar:a(t.progress,e),percentage:o(u,e,"percentage"),total:o(t.total,e,"total"),value:o(t.value,e,"value"),eta:o(t.eta,e,"eta"),eta_formatted:r(t.eta,e,5),duration:o(c,e,"duration"),duration_formatted:r(c,e,1)});i=i.replace(/\{(\w+)\}/g,function(F,A){return typeof d[A]<"u"?d[A]:F});let m=Math.max(0,t.maxWidth-Wl(i)-2),h=Math.floor(m/2);switch(e.align){case"right":i=m>0?" ".repeat(m)+i:i;break;case"center":i=h>0?" ".repeat(h)+i:i;break;default:break}return i}});var ln=P((OD,yo)=>{"use strict";function j(s,e){return typeof s>"u"||s===null?e:s}yo.exports={parse:function(e,t){let n={},i=Object.assign({},t,e);return n.throttleTime=1e3/j(i.fps,10),n.stream=j(i.stream,process.stderr),n.terminal=j(i.terminal,null),n.clearOnComplete=j(i.clearOnComplete,!1),n.stopOnComplete=j(i.stopOnComplete,!1),n.barsize=j(i.barsize,40),n.align=j(i.align,"left"),n.hideCursor=j(i.hideCursor,!1),n.linewrap=j(i.linewrap,!1),n.barGlue=j(i.barGlue,""),n.barCompleteChar=j(i.barCompleteChar,"="),n.barIncompleteChar=j(i.barIncompleteChar,"-"),n.format=j(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=j(i.formatTime,null),n.formatValue=j(i.formatValue,null),n.formatBar=j(i.formatBar,null),n.etaBufferLength=j(i.etaBuffer,10),n.etaAsynchronousUpdate=j(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=j(i.progressCalculationRelative,!1),n.synchronousUpdate=j(i.synchronousUpdate,!0),n.noTTYOutput=j(i.noTTYOutput,!1),n.notTTYSchedule=j(i.notTTYSchedule,2e3),n.emptyOnZero=j(i.emptyOnZero,!1),n.forceRedraw=j(i.forceRedraw,!1),n.autopadding=j(i.autopadding,!1),n.gracefulExit=j(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?j(e.autopaddingChar," "):"",e}}});var Vi=P((BD,bo)=>{"use strict";var Eo=io(),ql=Pi(),Gl=Wi(),Kl=ln(),Yl=require("events");bo.exports=class extends Yl{constructor(e){super(),this.options=Kl.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ql(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new Eo(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Gl}render(e=!1){let t={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,t,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,t,n){this.value=t||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=t||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Eo(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,t)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,t={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:t)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,t={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,t)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Io=P((PD,wo)=>{"use strict";var zl=Vi(),Xl=ln();wo.exports=class extends zl{constructor(e,t){super(Xl.parse(e,t)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,t){this.timer&&(super.update(e,t),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,t,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,t,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var _o=P((jD,Ao)=>{"use strict";var Ql=Pi(),Zl=Vi(),ec=ln(),tc=require("events");Ao.exports=class extends tc{constructor(e,t){super(),this.bars=[],this.options=ec.parse(e,t),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Ql(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,t,n,i={}){let r=new Zl(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(r),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,r.start(e,t,n),this.emit("start")),r}remove(e){let t=this.bars.indexOf(e);return t<0?!1:(this.bars.splice(t,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var So=P((LD,vo)=>{"use strict";vo.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var To=P((MD,xo)=>{"use strict";xo.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Oo=P((UD,Ro)=>{"use strict";Ro.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Bo=P((WD,ko)=>{"use strict";ko.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Po=P((VD,$o)=>{"use strict";var nc=So(),ic=To(),sc=Oo(),rc=Bo();$o.exports={legacy:nc,shades_classic:ic,shades_grey:sc,rect:rc}});var Lo=P((HD,jo)=>{"use strict";var No=Io(),oc=_o(),ac=Po(),uc=Wi(),lc=Li(),cc=Mi(),dc=Ui();jo.exports={Bar:No,SingleBar:No,MultiBar:oc,Presets:ac,Format:{Formatter:uc,BarFormat:cc,ValueFormat:lc,TimeFormat:dc}}});var ws=I(bs(),1),{program:Vc,createCommand:Hc,createArgument:Jc,createOption:qc,CommanderError:Gc,InvalidArgumentError:Q,InvalidOptionArgumentError:Kc,Command:Is,Argument:Yc,Option:zc,Help:Xc}=ws.default;var Ee=!1,As=!1;function _s(s){Ee=s}function p(){return Ee}function vs(s){As=s}function D(s){console.log(JSON.stringify(s,null,2))}function _(s){Ee?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&As&&console.error(JSON.stringify(s.details,null,2)))}function au(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function Ss(s){au(s)&&(_({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),_({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function E(s){Ee||console.log(`\x1B[32m${s}\x1B[0m`)}function B(s){Ee||console.log(`\x1B[36m${s}\x1B[0m`)}function Y(s){Ee||console.log(`\x1B[33m${s}\x1B[0m`)}function Qe(s){Ee||console.log(`\x1B[2m${s}\x1B[0m`)}var ei=I(require("readline"));var q=I(require("fs")),Be=I(require("path")),xs=I(require("os")),_t=require("child_process"),Vn=Be.join(xs.homedir(),".limai"),Ze=Be.join(Vn,"config.json"),uu=".limai.token",ke;function lu(s){if(!q.existsSync(s))return{};let e={};for(let t of q.readFileSync(s,"utf-8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);n&&(e[n[1]]=n[2].replace(/^(["'])(.*)\1$/,"$2"))}return e}function Ts(){if(ke!==void 0)return ke;try{let s=(0,_t.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!q.existsSync(Be.join(s,"packages","cli")))return ke=null,null;let e=(0,_t.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t="";if(e!==".git"){let i=(0,_t.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(i){let r=i.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");r&&(t=`${r}.`)}}let n=lu(Be.join(s,"tables",".env.local"));return ke={root:s,apiUrl:n.NEXT_PUBLIC_BASE_URL??`https://${t}tables.localhost`,sseUrl:n.NEXT_PUBLIC_SSE_URL??`https://${t}ws.localhost`},ke}catch{return ke=null,null}}function cu(){let s=Ts();if(!s)return;let e=Be.join(s.root,uu);if(q.existsSync(e))return q.readFileSync(e,"utf-8").trim()}function $e(){let s=process.env.LIMAI_API_TOKEN,e=process.env.LIMAI_API_URL,t=process.env.LIMAI_SSE_URL,n={};if(q.existsSync(Ze))try{let u=q.readFileSync(Ze,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=Ts(),r=s||cu()||n.token,o=e||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=t||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function be(s){let e={};if(q.existsSync(Ze))try{let n=q.readFileSync(Ze,"utf-8");e=JSON.parse(n)}catch{e={}}let t={...e,...s};q.existsSync(Vn)||q.mkdirSync(Vn,{recursive:!0,mode:448}),q.writeFileSync(Ze,JSON.stringify(t,null,2),{mode:384})}function f(){let s=$e();return s||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),s}function Rs(){return!!process.env.LIMAI_EXECUTION_ID}var $s=require("fs"),Ps=require("fs/promises"),Ns=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(e,t){super(e),this.name="LimaiError",this.code=t.code,this.statusCode=t.statusCode,this.exitCode=t.exitCode??1,this.details=t.details}},Hn=class extends R{constructor(e,t){super(e,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:t}),this.name="AuthError"}},Jn=class extends R{constructor(e,t){super(e,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:t}),this.name="ForbiddenError"}},et=class extends R{constructor(e,t){super(e,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:t}),this.name="NotFoundError"}},W=class extends R{constructor(e,t){super(e,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:t}),this.name="ValidationError"}},qn=class extends R{constructor(e,t){super(e,{code:"CONFLICT",statusCode:409,exitCode:4,details:t}),this.name="ConflictError"}},Gn=class extends R{retryAfterMs;constructor(e,t){super(e,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=t}},Kn=class extends R{constructor(e,t=500,n){super(e,{code:"SERVER_ERROR",statusCode:t,exitCode:6,details:n}),this.name="ServerError"}},Pe=class extends R{constructor(e){super(e,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},ge=class extends R{constructor(e,t){super(e,{code:"UPLOAD_ERROR",exitCode:8,details:t}),this.name="UploadError"}};function Os(s,e,t){switch(s){case 400:return new W(e,t);case 401:return new Hn(e,t);case 403:return new Jn(e,t);case 404:return new et(e,t);case 409:return new qn(e,t);case 429:return new Gn(e);default:return s>=500?new Kn(e,s,t):new R(e,{code:"HTTP_ERROR",statusCode:s,details:t})}}var du=3e4,Yn=3,ks=1e3,Bs=2;function pu(){return process.env.LIMAI_DEBUG==="1"}function tt(...s){pu()&&console.error("[limai:http]",...s)}var vt=class{baseUrl;token;constructor(e){this.baseUrl=e.apiUrl.replace(/\/$/,""),this.token=e.token}buildUrl(e,t){let n=new URL(`/api/v1${e}`,this.baseUrl);if(t)for(let[i,r]of Object.entries(t))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let e={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},t=process.env.VERCEL_BYPASS;return t&&(e["x-vercel-protection-bypass"]=t),e}async parseErrorBody(e){try{let t=await e.json();return{message:typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:`HTTP ${e.status}`,details:t.details}}catch{return{message:await e.text().catch(()=>"")||`HTTP ${e.status}`}}}shouldRetry(e){return e===429||e>=500}getRetryDelay(e,t){let n=e.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return ks*Math.pow(Bs,t)}async request(e,t,n={}){let i=this.buildUrl(t,n.params),r=n.timeoutMs??du;for(let o=0;o<=Yn;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{tt(`${e} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:e,headers:this.authHeaders(),body:n.body?JSON.stringify(n.body):void 0,signal:a.signal});if(clearTimeout(u),l.ok){let m=await l.text();return m?JSON.parse(m):{}}if(n.retry!==!1&&this.shouldRetry(l.status)&&o<Yn){let m=this.getRetryDelay(l,o);tt(`Retrying in ${m}ms (status ${l.status})`),await new Promise(h=>setTimeout(h,m));continue}let{message:c,details:d}=await this.parseErrorBody(l);throw Os(l.status,c,d)}catch(l){if(clearTimeout(u),l instanceof R)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(n.retry!==!1&&o<Yn){let c=ks*Math.pow(Bs,o);tt(`Timeout, retrying in ${c}ms`),await new Promise(d=>setTimeout(d,c));continue}throw new Pe(`Request timed out after ${r}ms: ${e} ${t}`)}throw new R(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(e,t,n){return this.request("GET",e,{params:t,timeoutMs:n})}async post(e,t,n,i){return this.request("POST",e,{body:t,timeoutMs:n,retry:i?.retry})}async patch(e,t,n){return this.request("PATCH",e,{body:t,retry:n?.retry})}async del(e,t){return this.request("DELETE",e,{body:t})}async putRaw(e,t,n,i){let r=t instanceof Blob?t.size:t.length;tt(`PUT ${e} (${r} bytes)`);let o=await fetch(e,{method:"PUT",headers:{"Content-Type":n},body:t});if(i&&i(r,r),!o.ok)throw new ge(`Upload failed: HTTP ${o.status}`)}async putFile(e,t,n,i){let r=(await(0,Ps.stat)(t)).size;tt(`PUT ${e} (${r} bytes, streamed from ${t})`);let o=(0,$s.createReadStream)(t),a=o;if(i){let l=0,c=new Ns.Transform({transform(d,m,h){l+=d.byteLength,i(l,r),h(null,d)}});a=o.pipe(c)}let u=await fetch(e,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new ge(`Upload failed: HTTP ${u.status}`);return r}};var St=class{constructor(e){this.http=e}http;async getUploadUrl(e,t,n){let i={filename:t,contentHash:n};return this.http.get(`/document/${e}/get-url`,i)}async processSync(e,t,n){return this.http.post(`/document/${e}/process-file/${t}`,n,18e4)}async processAsync(e,t,n){return this.http.post(`/document/${e}/process-file-async/${t}`,n)}async processFilesAsync(e,t,n){return this.http.post(`/document/${e}/process-files-async`,{fileIds:t,...n})}async getFileData(e,t,n,i){let r={fileId:e,extractionSchemaId:t,jobId:i,include:n?.length?n.join(","):void 0};return this.http.get("/document/get-file-data",r)}async getFilesData(e,t){return this.http.post("/document/get-files-data",{fileIds:e,...t?.length?{include:t}:{}})}async getDocumentData(e,t,n){let i={include:n?.length?n.join(","):void 0};return this.http.get(`/deployments/${e}/documents/${t}/data`,i)}async getDocumentsData(e,t,n){return this.http.post(`/deployments/${e}/documents/data`,{fileIds:t,...n?.length?{include:n}:{}})}async submitCorrections(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-corrections`,n)}};var xt=class{constructor(e){this.http=e}http;async list(){let e=await this.http.get("/projects");return Array.isArray(e)?e:e.data}async create(e){return this.http.post("/projects",e)}async delete(e){return this.http.del(`/projects/${e}`)}async getSharedColumnIds(e){return this.http.get(`/projects/${e}/shared-column-ids`)}async listDeployments(e){return this.http.get(`/projects/${e}/deployments`)}async listBenchmarks(e){return this.http.get(`/projects/${e}/benchmarks`)}async listNotificationRoutes(e){return this.http.get(`/projects/${e}/notifications`)}async createNotificationRoute(e,t){return this.http.post(`/projects/${e}/notifications`,t)}async updateNotificationRoute(e,t,n){return this.http.patch(`/projects/${e}/notifications/${t}`,n)}async deleteNotificationRoute(e,t){return this.http.del(`/projects/${e}/notifications/${t}`)}async listNotificationIntegrations(e,t){return this.http.get(`/projects/${e}/notifications/integrations`,{provider:t})}async listNotificationSlackChannels(e,t){return this.http.get(`/projects/${e}/notifications/integrations/slack/channels`,{connectionId:t})}async listNotificationTeamsTeams(e,t){return this.http.get(`/projects/${e}/notifications/integrations/teams/teams`,{connectionId:t})}async listNotificationTeamsChannels(e,t,n){return this.http.get(`/projects/${e}/notifications/integrations/teams/channels`,{connectionId:t,teamId:n})}};var Tt=class{constructor(e){this.http=e}http;async list(e,t){let n={status:t?.status,type:t?.type},i=await this.http.get(`/projects/${e}/deployments`,n);return Array.isArray(i)?i:i.data}async create(e,t){return this.http.post(`/projects/${e}/deployments`,t)}async getConfig(e){return this.http.get(`/deployments/${e}/configuration`)}async updateConfig(e,t){await this.http.patch(`/deployment/${e}/configuration`,t)}async listDocuments(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/deployments/${e}/documents`,n)}async getDocument(e,t){return this.http.get(`/deployments/${e}/documents/${t}`)}async deleteDocument(e,t){await this.http.del(`/deployments/${e}/documents/${t}`)}async bulkDelete(e,t){await this.http.del(`/deployments/${e}/documents/bulk-delete`,{fileIds:t})}};var Rt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/tables/${e}`)}async listColumns(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async listRows(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/tables/${e}/rows`,n)}async createRows(e,t){return this.http.post(`/tables/${e}/rows`,t,6e4)}async deleteRows(e,t){return this.http.del(`/tables/${e}/rows`,t)}async createTable(e,t){return this.http.post(`/deployments/${e}/tables`,t)}async update(e,t){return this.http.patch(`/tables/${e}`,t)}};var Ot=class{constructor(e){this.http=e}http;async list(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async get(e){return this.http.get(`/columns/${e}`)}async create(e,t){let n=await this.http.post(`/tables/${e}/columns`,t);return n&&typeof n=="object"&&"data"in n?n.data:[n]}async update(e,t){return this.http.patch(`/columns/${e}`,t)}};async function*js(s,e={}){let t=Math.min(e.pageSize??100,500),n=0,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(r,n),a=o.data;if(a.length===0||(yield a,i+=a.length,n+=a.length,n>=o.pagination.total)||e.maxItems&&i>=e.maxItems)break}}async function*Ls(s,e={}){let t=Math.min(e.pageSize??100,500),n=1,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(n,r),a=o.data;if(a.length===0||(yield a,i+=a.length,n++,n>o.pagination.totalPages)||e.maxItems&&i>=e.maxItems)break}}async function kt(s){let e=[];for await(let t of s)e.push(...t);return e}var Bt=class{constructor(e){this.http=e}http;async getRows(e,t){let n={page:t?.page?.toString(),limit:t?.limit?.toString(),order:t?.order,status:t?.status};return this.http.get(`/extractions/${e}`,n)}async*getAllRows(e,t){yield*Ls(async(n,i)=>this.http.get(`/extractions/${e}`,{page:n.toString(),limit:i.toString(),order:t?.order,status:t?.status}),t)}async collectAllRows(e,t){return kt(this.getAllRows(e,t))}};var $t=class{constructor(e){this.http=e}http;async getStatus(e){return this.http.get(`/queue/${e}/status`)}async cancel(e){await this.http.post("/queue/cancel",{jobId:e})}async updateStatus(e,t){return this.http.patch(`/queue/${e}/status`,t)}};var Pt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/classify",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/classify/${e}/get-url`,{filename:t})}async classify(e,t){return this.http.post(`/classify/${e}`,{fileId:t})}async classifyAsync(e,t){return this.http.post(`/classify/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/classify/${e}`,{classificationId:t})}async createClassifier(e){return this.http.post("/classify",e)}async createRoute(e,t){return this.http.post(`/classify/${e}/routes`,t)}};var Nt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/split",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/split/${e}/get-url`,{filename:t})}async split(e,t){return this.http.post(`/split/${e}`,{fileId:t})}async splitAsync(e,t){return this.http.post(`/split/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/split/${e}`,{splitId:t})}async listSplits(e){return this.http.get(`/split/${e}/splits`)}async createSplitter(e){return this.http.post("/split",e)}};var jt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/deployments/${e}/configuration`)}async update(e,t){return this.http.patch(`/deployments/${e}/configuration`,t)}async getAllData(e){return this.http.get(`/deployments/${e}/all-data`)}};var Lt=class{constructor(e){this.http=e}http;async list(e){return this.http.get(`/projects/${e}/buckets`)}async get(e){return this.http.get(`/buckets/${e}`)}async create(e,t,n){return this.http.post(`/projects/${e}/buckets`,{name:t,description:n})}async delete(e){await this.http.del(`/buckets/${e}`)}async getUploadUrl(e,t){return this.http.get(`/buckets/${e}/get-url`,{filename:t})}async confirmUpload(e,t,n){await this.http.patch(`/buckets/${e}/files/${t}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(e,t){let n={};return t&&t.length>0&&(n.labels=t.join(",")),this.http.get(`/buckets/${e}/files`,n)}async getDownloadUrl(e,t){return this.http.get(`/buckets/${e}/files/${t}/download`)}async updateLabels(e,t,n){return this.http.patch(`/buckets/${e}/files/${t}`,{labels:n})}async deleteFile(e,t){await this.http.del(`/buckets/${e}/files/${t}`)}async sendTo(e,t,n,i){return this.http.post(`/buckets/${e}/files/${t}/send-to`,{targetType:n,targetId:i})}};var Mt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.status&&(n.status=t.status),this.http.get(`/projects/${e}/agents`,n)}async get(e,t){return this.http.get(`/projects/${e}/agents/${t}`)}async create(e,t){return this.http.post(`/projects/${e}/agents`,t)}async update(e,t,n){return this.http.patch(`/projects/${e}/agents/${t}`,n)}async delete(e,t){await this.http.del(`/projects/${e}/agents/${t}`)}async getFileUploadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/get-url`,{filename:n})}async deleteFile(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/files/${n}`)}async updateFileMetadata(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/files/${n}`,i)}async getFileDownloadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/${n}/download`)}async listSkills(e,t){return this.http.get(`/projects/${e}/agents/${t}/skills`)}async createSkill(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/skills`,n)}async updateSkill(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/skills/${n}`,i)}async deleteSkill(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}`)}async linkFileToSkill(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(e,t,n,i){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}/files/${i}`)}async listRuns(e,t,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${e}/agents/${t}/runs`,i)}async getRun(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/runs/${n}`)}async getRunConversation(e,t,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/conversation`,r)}async getRunInferenceLogs(e,t,n,i){let r={};return i?.limit!==void 0&&(r.limit=String(i.limit)),i?.status&&(r.status=i.status),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/inference-logs`,r)}async createRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs`,n)}async createStep(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,i)}async createSteps(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,{steps:i})}async updateRun(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}`,i)}async updateStep(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,r)}async updateStepConditions(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/pause`,{})}async submitStepAction(e,t,n,i,r){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}/action`,r)}async sendEmail(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/send-email`,n)}async completeExecution(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/executions/complete`,n)}async getSharePointToken(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/sharepoint-token`,n)}async getArtifactUploadUrl(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/upload-artifact/get-url`,n)}};var Ut=class{constructor(e){this.http=e}http;async ask(e,t){return this.http.post(`/projects/${e}/vision/ask`,t,12e4)}};var Wt=class{constructor(e){this.http=e}http;async submit(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-validation`,n)}async listScripts(e){return(await this.http.get(`/deployments/${e}/validation-scripts`)).scripts}async getScript(e,t,n){return(await this.http.get(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(e,t){return this.http.post(`/deployments/${e}/validation-scripts`,t)}async updateScript(e,t,n){return(await this.http.patch(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n)).script}async deleteScript(e,t){return this.http.del(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`)}};var Vt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),this.http.get(`/projects/${e}/labels`,n)}async addRemove(e,t,n,i,r){return this.http.post(`/projects/${e}/labels`,{entityType:t,entityId:n,add:i,remove:r})}async search(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),t?.labels&&(n.labels=t.labels),t?.key&&(n.key=t.key),this.http.get(`/projects/${e}/labels/search`,n)}};var nt=["DOCUMENT_EXTRACTED","DOCUMENT_REVIEWED","DOCUMENT_EXTRACTION_FAILED","DOCUMENT_VALIDATED","DOCUMENT_VALIDATION_STARTED","DOCUMENT_VALIDATION_FAILED","DOCUMENT_CLASSIFIED","DOCUMENT_CLASSIFICATION_FAILED","DOCUMENT_SPLIT","DOCUMENT_SPLIT_FAILED","AGENT_RUN_STARTED","AGENT_RUN_COMPLETED","AGENT_RUN_FAILED","AGENT_RUN_WAITING_HUMAN"],zn=["success","failed","dead_lettered","retrying","pending"],Xn=["24h","7d","30d"],Qn=["hour","day"];var Ht=class{constructor(e){this.http=e}http;basePath(e){return`/projects/${e}/webhooks`}async list(e){return this.http.get(this.basePath(e))}async get(e,t){return this.http.get(`${this.basePath(e)}/${t}`)}async create(e,t){return this.http.post(this.basePath(e),t,void 0,{retry:!1})}async update(e,t,n){return this.http.patch(`${this.basePath(e)}/${t}`,n,{retry:!1})}async delete(e,t){await this.http.del(`${this.basePath(e)}/${t}`)}async pause(e,t){return this.http.post(`${this.basePath(e)}/${t}/pause`)}async resume(e,t){return this.http.post(`${this.basePath(e)}/${t}/resume`)}async verify(e,t){return this.http.post(`${this.basePath(e)}/${t}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(e,t){return this.http.post(`${this.basePath(e)}/${t}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(e,t,n){let i={};return n?.status&&(i.status=n.status),n?.eventType&&(i.eventType=n.eventType),n?.deploymentId&&(i.deploymentId=n.deploymentId),n?.agentId&&(i.agentId=n.agentId),n?.classifierId&&(i.classifierId=n.classifierId),n?.splitterId&&(i.splitterId=n.splitterId),n?.limit!==void 0&&(i.limit=String(n.limit)),n?.offset!==void 0&&(i.offset=String(n.offset)),this.http.get(`${this.basePath(e)}/${t}/deliveries`,i)}async metrics(e,t,n){let i={};return n?.window&&(i.window=n.window),n?.bucket&&(i.bucket=n.bucket),this.http.get(`${this.basePath(e)}/${t}/metrics`,i)}async retry(e,t,n){return this.http.post(`${this.basePath(e)}/${t}/retry`,{eventIds:n})}};var Jt=I(require("fs")),Ne=I(require("path"));var Ms=I(require("fs")),Us=I(require("crypto"));async function Ws(s){return new Promise((e,t)=>{let n=Us.createHash("sha256"),i=Ms.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>e(n.digest("hex"))),i.on("error",t)})}var mu={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Du(s){let e=Ne.extname(s).toLowerCase();return mu[e]||"application/octet-stream"}async function qt(s,e,t,n,i){let r=Ne.resolve(n),o=Ne.basename(r);if(!Jt.existsSync(r))throw new ge(`File not found: ${r}`);if(!Jt.statSync(r).isFile())throw new ge(`Not a file: ${r}`);let u=await Ws(r),l=await e.getUploadUrl(t,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=Du(r),d=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:d}}var je=I(require("fs")),Le=I(require("path"));var Hs=I(require("path"));var Vs=250,fu=5,Zn=class{constructor(e){this.max=e}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(e=>{this.queue.push(e)})}release(){this.current--;let e=this.queue.shift();e&&(this.current++,e())}};async function Js(s,e,t,n,i){let r=Math.min(i?.concurrency??fu,10),o=new Zn(r),a=n.map(m=>({path:m,filename:Hs.basename(m),status:"pending"})),u=a.map(async(m,h)=>{await o.acquire();try{m.status="uploading",i?.onFileStatus?.(m);let F=await qt(s,e,t,m.path);m.fileId=F.fileId,m.status="uploaded",i?.onFileStatus?.(m)}catch(F){m.status="failed",m.error=F instanceof Error?F.message:String(F),i?.onFileStatus?.(m)}finally{o.release()}});if(await Promise.all(u),i?.process){let h=a.filter(F=>F.status==="uploaded"&&F.fileId).map(F=>F.fileId);for(let F=0;F<h.length;F+=Vs){let A=h.slice(F,F+Vs);try{let k=await e.processFilesAsync(t,A,i.processOptions);for(let[b,C]of Object.entries(k.results)){let x=a.find(V=>V.fileId===b);x&&(C.status==="queued"?(x.status="queued",x.jobId=C.jobId):(x.status="failed",x.error=C.error),i?.onFileStatus?.(x))}}catch(k){for(let b of A){let C=a.find(x=>x.fileId===b);C&&(C.status="failed",C.error=k instanceof Error?k.message:String(k),i?.onFileStatus?.(C))}}}}let l=a.filter(m=>m.status==="uploaded"||m.status==="queued").length,c=a.filter(m=>m.status==="queued").length,d=a.filter(m=>m.status==="failed").length;return{total:n.length,uploaded:l,queued:c,failed:d,files:a}}var gu=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function qs(s,e){let t=[],n=je.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Le.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())t.push(...qs(r,e));else if(i.isFile()){let o=Le.extname(i.name).toLowerCase();if(!gu.has(o)||e&&!hu(i.name,e))continue;t.push(r)}}}return t.sort()}function hu(s,e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${t}$`,"i").test(s)}async function Gs(s,e,t,n,i){let r=Le.resolve(n);if(!je.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!je.statSync(r).isDirectory())throw new Error(`Not a directory: ${r}`);let a=qs(r,i?.globPattern);return a.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:Js(s,e,t,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var Fu=1e3,Cu=1e4,yu=1.5,Eu=3e5,bu=["COMPLETED","FAILED","STALLED"],Z=class{constructor(e){this.queue=e}queue;async*poll(e,t){let n=t?.intervalMs??Fu,i=t?.maxIntervalMs??Cu,r=t?.backoffMultiplier??yu,o=t?.timeoutMs??Eu,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new Pe(`Polling timed out after ${Math.round(o/1e3)}s for job ${e}`);let c=await this.queue.getStatus(e);if(c.status!==l&&(l=c.status,t?.onStatus?.(c),yield c),bu.includes(c.status))return;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*r,i)}}async waitForCompletion(e,t){let n;for await(let i of this.poll(e,t))n=i;if(!n)throw new Error(`No status received for job ${e}`);return n}};var g=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(e){this.http=new vt({apiUrl:e.apiUrl,token:e.token}),this.documents=new St(this.http),this.projects=new xt(this.http),this.deployments=new Tt(this.http),this.tables=new Rt(this.http),this.columns=new Ot(this.http),this.extractions=new Bt(this.http),this.queue=new $t(this.http),this.classify=new Pt(this.http),this.split=new Nt(this.http),this.schema=new jt(this.http),this.buckets=new Lt(this.http),this.agents=new Mt(this.http),this.vision=new Ut(this.http),this.validations=new Wt(this.http),this.labels=new Vt(this.http),this.webhooks=new Ht(this.http)}async uploadFile(e,t,n){return qt(this.http,this.documents,e,t,n)}async uploadFolder(e,t,n){return Gs(this.http,this.documents,e,t,n)}async processAndWait(e,t,n){let i=await this.documents.processAsync(e,t,n?.processOptions),r=new Z(this.queue),o;for await(let a of r.poll(i.jobId,n?.pollOptions))o=a;if(!o||o.status==="FAILED")throw new Error(`Extraction failed for file ${t}${o?`: ${o.status}`:""}`);return this.documents.getFileData(t,e,void 0,i.jobId)}async*downloadAll(e,t){yield*this.extractions.getAllRows(e,t)}};function v(s,e){if(p()){D(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let t=e||Object.keys(s[0]),n={};for(let r of t)n[r]=r.length;for(let r of s)for(let o of t){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=t.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(t.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=t.map(a=>{let u=String(r[a]??"");return u.length>60?u.slice(0,57)+"...":u.padEnd(n[a])}).join(" ");console.log(o)}}function w(s){if(p()){D(s);return}let e=Math.max(...Object.keys(s).map(t=>t.length));for(let[t,n]of Object.entries(s)){let i=`\x1B[1m${t.padEnd(e)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var zs=require("child_process"),Xs=require("crypto"),Qs=require("http"),Ks=9768,Ys=9780,wu=12e4;function Iu(){return(0,Xs.randomBytes)(32).toString("hex")}function Au(s){let e=process.platform,t=e==="darwin"?`open "${s}"`:e==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,zs.exec)(t),!0}catch{return!1}}function _u(){return`<!DOCTYPE html>
|
|
29
29
|
<html>
|
|
30
30
|
<head><title>LimAI CLI</title></head>
|
|
31
31
|
<body style="font-family: system-ui, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; background: #0a0a0a; color: #fafafa;">
|
|
@@ -48,7 +48,7 @@ Choice: `);if(a==="2"){await t(o);return}if(a==="3"){await n(o);return}B("Openin
|
|
|
48
48
|
${e}`,Yu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Xu=(s,e,t)=>{let n=t===""?"":`with ${t.trim()}() `,i=Ku.bind(null,n,e.toString());Object.defineProperty(i,"name",zu);let{writable:r,enumerable:o,configurable:a}=Yu;Object.defineProperty(s,"toString",{value:i,writable:r,enumerable:o,configurable:a})};function li(s,e,{ignoreNonConfigurable:t=!1}={}){let{name:n}=s;for(let i of Reflect.ownKeys(e))Ju(s,e,i,t);return Gu(s,e),Xu(s,e,n),s}var zt=new WeakMap,Er=(s,e={})=>{if(typeof s!="function")throw new TypeError("Expected a function");let t,n=0,i=s.displayName||s.name||"<anonymous>",r=function(...o){if(zt.set(r,++n),n===1)t=s.apply(this,o),s=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t};return li(r,s),zt.set(r,n),r};Er.callCount=s=>{if(!zt.has(s))throw new Error(`The given function \`${s.name}\` is not wrapped by the \`onetime\` package`);return zt.get(s)};var br=Er;var we=[];we.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&we.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&we.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Xt=s=>!!s&&typeof s=="object"&&typeof s.removeListener=="function"&&typeof s.emit=="function"&&typeof s.reallyExit=="function"&&typeof s.listeners=="function"&&typeof s.kill=="function"&&typeof s.pid=="number"&&typeof s.on=="function",ci=Symbol.for("signal-exit emitter"),di=globalThis,Qu=Object.defineProperty.bind(Object),pi=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(di[ci])return di[ci];Qu(di,ci,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],i=n.indexOf(t);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let r of this.listeners[e])i=r(t,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,n)||i),i}},Qt=class{},Zu=s=>({onExit(e,t){return s.onExit(e,t)},load(){return s.load()},unload(){return s.unload()}}),mi=class extends Qt{onExit(){return()=>{}}load(){}unload(){}},Di=class extends Qt{#o=fi.platform==="win32"?"SIGINT":"SIGHUP";#n=new pi;#e;#s;#p;#t={};#r=!1;constructor(e){super(),this.#e=e,this.#t={};for(let t of we)this.#t[t]=()=>{let n=this.#e.listeners(t),{count:i}=this.#n,r=e;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(i+=r.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#n.emit("exit",null,t),a=t==="SIGHUP"?this.#o:t;o||e.kill(e.pid,a)}};this.#p=e.reallyExit,this.#s=e.emit}onExit(e,t){if(!Xt(this.#e))return()=>{};this.#r===!1&&this.load();let n=t?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#n.count+=1;for(let e of we)try{let t=this.#t[e];t&&this.#e.on(e,t)}catch{}this.#e.emit=(e,...t)=>this.#m(e,...t),this.#e.reallyExit=e=>this.#i(e)}}unload(){this.#r&&(this.#r=!1,we.forEach(e=>{let t=this.#t[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#p,this.#n.count-=1)}#i(e){return Xt(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#m(e,...t){let n=this.#s;if(e==="exit"&&Xt(this.#e)){typeof t[0]=="number"&&(this.#e.exitCode=t[0]);let i=n.call(this.#e,e,...t);return this.#n.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...t)}},fi=globalThis.process,{onExit:wr,load:Bp,unload:$p}=Zu(Xt(fi)?new Di(fi):new mi);var Ir=rt.default.stderr.isTTY?rt.default.stderr:rt.default.stdout.isTTY?rt.default.stdout:void 0,el=Ir?br(()=>{wr(()=>{Ir.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Ar=el;var Zt=!1,We={};We.show=(s=gi.default.stderr)=>{s.isTTY&&(Zt=!1,s.write("\x1B[?25h"))};We.hide=(s=gi.default.stderr)=>{s.isTTY&&(Ar(),Zt=!0,s.write("\x1B[?25l"))};We.toggle=(s,e)=>{s!==void 0&&(Zt=s),Zt?We.show(e):We.hide(e)};var hi=We;var ct=I(Fi(),1);var te=I(require("process"),1);function Ci(){return te.default.platform!=="win32"?te.default.env.TERM!=="linux":!!te.default.env.CI||!!te.default.env.WT_SESSION||!!te.default.env.TERMINUS_SUBLIME||te.default.env.ConEmuTask==="{cmd::Cmder}"||te.default.env.TERM_PROGRAM==="Terminus-Sublime"||te.default.env.TERM_PROGRAM==="vscode"||te.default.env.TERM==="xterm-256color"||te.default.env.TERM==="alacritty"||te.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var nl={info:se.blue("\u2139"),success:se.green("\u2714"),warning:se.yellow("\u26A0"),error:se.red("\u2716")},il={info:se.blue("i"),success:se.green("\u221A"),warning:se.yellow("\u203C"),error:se.red("\xD7")},sl=Ci()?nl:il,ot=sl;function yi({onlyFirst:s=!1}={}){let i="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,s?void 0:"g")}var rl=yi();function at(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return!s.includes("\x1B")&&!s.includes("\x9B")?s:s.replace(rl,"")}var tn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],nn=[12288,12288,65281,65376,65504,65510],Ei=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],bi=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ut=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var sn=(s,e)=>{let t=0,n=Math.floor(s.length/2)-1;for(;t<=n;){let i=Math.floor((t+n)/2),r=i*2;if(e<s[r])n=i-1;else if(e>s[r+1])t=i+1;else return!0}return!1};var ol=tn[0],al=tn.at(-1),ul=nn[0],ll=nn.at(-1),tm=Ei[0],nm=Ei.at(-1),im=bi[0],sm=bi.at(-1),cl=ut[0],dl=ut.at(-1),xr=19968,[pl,ml]=Dl(ut);function Dl(s){let e=s[0],t=s[1];for(let n=0;n<s.length;n+=2){let i=s[n],r=s[n+1];if(xr>=i&&xr<=r)return[i,r];r-i>t-e&&(e=i,t=r)}return[e,t]}var Tr=s=>s<ol||s>al?!1:sn(tn,s),Rr=s=>s<ul||s>ll?!1:sn(nn,s);var Or=s=>s>=pl&&s<=ml?!0:s<cl||s>dl?!1:sn(ut,s);function fl(s){if(!Number.isSafeInteger(s))throw new TypeError(`Expected a code point, got \`${typeof s}\`.`)}function kr(s,{ambiguousAsWide:e=!1}={}){return fl(s),Rr(s)||Or(s)||e&&Tr(s)?2:1}var Br=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;var gl=new Intl.Segmenter,hl=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function wi(s,e={}){if(typeof s!="string"||s.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(s=at(s)),s.length===0)return 0;let i=0,r={ambiguousAsWide:!t};for(let{segment:o}of gl.segment(s)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!hl.test(o)){if(Br().test(o)){i+=2;continue}i+=kr(a,r)}}return i}function Ii({stream:s=process.stdout}={}){return!!(s&&s.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Ai=I(require("process"),1);function _i(){let{env:s}=Ai.default,{TERM:e,TERM_PROGRAM:t}=s;return Ai.default.platform!=="win32"?e!=="linux":!!s.WT_SESSION||!!s.TERMINUS_SUBLIME||s.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||s.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var re=I(require("process"),1),Fl=3,vi=class{#o=0;start(){this.#o++,this.#o===1&&this.#n()}stop(){if(this.#o<=0)throw new Error("`stop` called more times than `start`");this.#o--,this.#o===0&&this.#e()}#n(){re.default.platform==="win32"||!re.default.stdin.isTTY||(re.default.stdin.setRawMode(!0),re.default.stdin.on("data",this.#s),re.default.stdin.resume())}#e(){re.default.stdin.isTTY&&(re.default.stdin.off("data",this.#s),re.default.stdin.pause(),re.default.stdin.setRawMode(!1))}#s(e){e[0]===Fl&&re.default.emit("SIGINT")}},Cl=new vi,Si=Cl;var yl=I(Fi(),1),xi=class{#o=0;#n=!1;#e=0;#s=-1;#p=0;#t;#r;#i;#m;#f;#l;#c;#d;#g;#a;#u;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:lt.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#f=this.#t.interval,this.#i=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ii({stream:this.#i}),this.#c=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,lt.default.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(t){this.#o=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#D()}get interval(){return this.#f??this.#r.interval??100}get spinner(){return this.#r}set spinner(e){if(this.#s=-1,this.#f=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=e}else if(!_i())this.#r=ct.default.line;else if(e===void 0)this.#r=ct.default.dots;else if(e!=="default"&&ct.default[e])this.#r=ct.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(e=""){this.#g=e,this.#D()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#D()}get suffixText(){return this.#u}set suffixText(e=""){this.#u=e,this.#D()}get isSpinning(){return this.#m!==void 0}#h(e=this.#a,t=" "){return typeof e=="string"&&e!==""?e+t:typeof e=="function"?e()+t:""}#F(e=this.#u,t=" "){return typeof e=="string"&&e!==""?t+e:typeof e=="function"?t+e():""}#D(){let e=this.#i.columns??80,t=this.#h(this.#a,"-"),n=this.#F(this.#u,"-"),i=" ".repeat(this.#d)+t+"--"+this.#g+"--"+n;this.#e=0;for(let r of at(i).split(`
|
|
49
49
|
`))this.#e+=Math.max(1,Math.ceil(wi(r,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#l&&!this.#c}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=e}get isSilent(){return this.#c}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#c=e}frame(){let e=Date.now();(this.#s===-1||e-this.#p>=this.interval)&&(this.#s=++this.#s%this.#r.frames.length,this.#p=e);let{frames:t}=this.#r,n=t[this.#s];this.color&&(n=se[this.color](n));let i=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",r=typeof this.text=="string"?" "+this.text:"",o=typeof this.#u=="string"&&this.#u!==""?" "+this.#u:"";return i+n+r+o}clear(){if(!this.#l||!this.#i.isTTY)return this;this.#i.cursorTo(0);for(let e=0;e<this.#o;e++)e>0&&this.#i.moveCursor(0,-1),this.#i.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#i.cursorTo(this.#d),this.lastIndent=this.#d,this.#o=0,this}render(){return this.#c?this:(this.clear(),this.#i.write(this.frame()),this.#o=this.#e,this)}start(e){return e&&(this.text=e),this.#c?this:this.#l?this.isSpinning?this:(this.#t.hideCursor&&hi.hide(this.#i),this.#t.discardStdin&<.default.stdin.isTTY&&(this.#n=!0,Si.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#i.write(`- ${this.text}
|
|
50
50
|
`),this)}stop(){return this.#l?(clearInterval(this.#m),this.#m=void 0,this.#s=0,this.clear(),this.#t.hideCursor&&hi.show(this.#i),this.#t.discardStdin&<.default.stdin.isTTY&&this.#n&&(Si.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:ot.success,text:e})}fail(e){return this.stopAndPersist({symbol:ot.error,text:e})}warn(e){return this.stopAndPersist({symbol:ot.warning,text:e})}info(e){return this.stopAndPersist({symbol:ot.info,text:e})}stopAndPersist(e={}){if(this.#c)return this;let t=e.prefixText??this.#a,n=this.#h(t," "),i=e.symbol??" ",r=e.text??this.text,a=typeof r=="string"?(i?" ":"")+r:"",u=e.suffixText??this.#u,l=this.#F(u," "),c=n+i+a+l+`
|
|
51
|
-
`;return this.stop(),this.#i.write(c),this}};function Ti(s){return new xi(s)}var Ie={start(){return Ie},stop(){return Ie},succeed(){return Ie},fail(){return Ie},warn(){return Ie},info(){return Ie},text:"",isSpinning:!1};function y(s){return p()?Ie:Ti({text:s,color:"cyan"})}function $r(s){let e=s.command("documents").description("Document upload and processing");e.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(t,n)=>{let i=new g(f()),r=on.resolve(n);rn.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${on.basename(r)}...`);o.start();let a=await i.uploadFile(t,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),p()?D(a):w(a)}),e.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(t,n,i)=>{let r=new g(f());if(i.async||i.wait){let a=await r.documents.processAsync(t,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new Z(r.queue).waitForCompletion(a.jobId,{onStatus:d=>{u.text=`Extraction: ${d.status} (${d.extractionStageStatus})`}});if(c.status==="COMPLETED"){u.succeed("Extraction completed.");let d=await r.documents.getFileData(n,t);p()?D(d):w({fileId:n,status:"COMPLETED",tables:Object.keys(d.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else p()?D(a):(E("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(t,n);a.succeed("Processing complete."),p()?D(u):w(u)}}),e.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").action(async(t,n)=>{let r=await new g(f()).documents.getFileData(t,n.extractionSchemaId);p()?D(r):w(r)}),e.command("data <deploymentId> <fileIds...>").description("Get flat slug-keyed data for one or more documents").option("--include <options>","Comma-separated enrichments: confidence, boundingBoxes, grounding, validations").action(async(t,n,i)=>{let r=new g(f()),o=i.include?.split(",").map(u=>u.trim()).filter(Boolean),a=await r.documents.getDocumentsData(t,n,o);p()?D(a):w(a)}),e.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(t,n,i)=>{let r=new g(f()),o=rn.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(t,n,a),p()?D({success:!0}):E("Corrections submitted.")})}var Ri=I(require("fs"));function Pr(s){let e=s.command("tables").description("Table management");e.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(t,n)=>{let i=new g(f()),r=Ri.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(t,o);p()?D(a):(E("Table created."),w(a))}),e.command("update <tableId>").description("Update a table's instructions or name").option("--instructions <text>","New instructions text").option("--instructions-file <file>","Read new instructions from a file (overrides --instructions)").option("--name <name>","New table name").action(async(t,n)=>{let i=new g(f()),r={};if(n.instructionsFile?r.instructions=Ri.readFileSync(n.instructionsFile,"utf-8"):n.instructions!==void 0&&(r.instructions=n.instructions),n.name!==void 0&&(r.name=n.name),Object.keys(r).length===0)throw new Error("Provide at least one of --instructions, --instructions-file, or --name");let o=await i.tables.update(t,r);p()?D(o):(E("Table updated."),w(o))}),e.command("get <tableId>").description("Get table details").action(async t=>{let i=await new g(f()).tables.get(t);p()?D(i):w(i)}),e.command("rows <tableId>").description("List rows in a table").option("--limit <n>","Number of rows","50").option("--offset <n>","Offset","0").option("--all","Fetch all rows (auto-paginate)").action(async(t,n)=>{let i=new g(f());if(n.all){let r=await kt(js(async(o,a)=>i.tables.listRows(t,{limit:o,offset:a}),{pageSize:500}));p()?D(r):v(r)}else{let r=await i.tables.listRows(t,{limit:parseInt(n.limit),offset:parseInt(n.offset)});p()?D(r):v(r.data)}}),e.command("columns <tableId>").description("List columns in a table").action(async t=>{let i=await new g(f()).tables.listColumns(t);p()?D(i):v(i,["id","name","type"])})}var Hr=I(require("fs"));var Nr=["index","id","name","slug","type","isKey","units","autoGenerateUnits","defaultValue","defaultValueEnabled"],El="NUMBER_WITH_UNIT columns need --units a,b or --auto-generate-units on.";function jr(s){return{...s,units:(s.units??[]).map(e=>e.name).join(", ")}}function bl(s){if(s.type==="NUMBER_WITH_UNIT"&&!s.autoGenerateUnits&&!(s.units&&s.units.length>0))throw new Q(El)}function Ae(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function wl(s){let e=Number(s);if(!Number.isInteger(e)||e<40||e>2e3)throw new Q("Expected an integer between 40 and 2000.");return e}function Il(s){try{return JSON.parse(s)}catch{return s}}function Lr(s){return s.split(",").map(e=>e.trim()).filter(Boolean)}function Mr(s){return s.option("--name <name>","Column name").option("--slug <slug>","Column slug (snake_case)").option("--type <type>","Column type, e.g. TEXT, NUMBER, DATE, LABEL").option("--description <text>","Column description").option("--is-key <on|off>","Mark the column as a key column",Ae).option("--is-list <on|off>","Store multiple values per cell",Ae).option("--date-format <format>","Date format: EU, US or ISO").option("--measurement-type <type>","Benchmark measurement type").option("--excluded-from-extraction <on|off>","Keep the column out of extraction prompts",Ae).option("--pinned <on|off>","Pin the column in the grid",Ae).option("--size <px>","Column width in pixels (40-2000)",wl).option("--default-value <json>","Default value as JSON (falls back to a plain string)",Il).option("--clear-default-value","Clear the stored default value").option("--default-value-enabled <on|off>","Write the default value into empty cells during extraction",Ae).option("--auto-generate-labels <on|off>","Let extraction invent new labels",Ae).option("--auto-generate-units <on|off>","Let extraction invent new units",Ae).option("--labels <names>","Comma-separated label names",Lr).option("--units <names>","Comma-separated unit names",Lr)}function Ur(s){let e={};return s.name!==void 0&&(e.name=s.name),s.slug!==void 0&&(e.slug=s.slug),s.type!==void 0&&(e.type=s.type),s.description!==void 0&&(e.description=s.description),s.isKey!==void 0&&(e.isKey=s.isKey),s.isList!==void 0&&(e.isList=s.isList),s.dateFormat!==void 0&&(e.dateFormat=s.dateFormat),s.measurementType!==void 0&&(e.measurementType=s.measurementType),s.excludedFromExtraction!==void 0&&(e.excludedFromExtraction=s.excludedFromExtraction),s.pinned!==void 0&&(e.pinned=s.pinned),s.size!==void 0&&(e.size=s.size),s.clearDefaultValue?e.defaultValue=null:s.defaultValue!==void 0&&(e.defaultValue=s.defaultValue),s.defaultValueEnabled!==void 0&&(e.defaultValueEnabled=s.defaultValueEnabled),s.autoGenerateLabels!==void 0&&(e.autoGenerateLabels=s.autoGenerateLabels),s.autoGenerateUnits!==void 0&&(e.autoGenerateUnits=s.autoGenerateUnits),s.labels!==void 0&&(e.labels=s.labels.map(t=>({name:t}))),s.units!==void 0&&(e.units=s.units.map(t=>({name:t}))),e}function Wr(s){return JSON.parse(Hr.readFileSync(s,"utf-8"))}function Vr(s){if(p()){D(s);return}w(s)}function Jr(s){let e=s.command("columns").description("Column management");e.command("list <tableId>").description("List the columns of a table").action(async t=>{let i=await new g(f()).columns.list(t);p()?D(i):v(i.map(jr),Nr)}),e.command("get <columnId>").description("Get column details").action(async t=>{let i=await new g(f()).columns.get(t);Vr(i)}),Mr(e.command("create <tableId>").description("Create one or more columns in a table").option("--body <file>","JSON file with a column object or { columns: [...] }")).action(async(t,n)=>{let i=Ur(n),r=n.body?Wr(n.body):void 0,o=Al(r,i);for(let l of"columns"in o?o.columns:[o])bl(l);let u=await new g(f()).columns.create(t,o);if(p()){D(u);return}E(`Created ${u.length} column${u.length===1?"":"s"}.`),v(u.map(jr),Nr)}),Mr(e.command("update <columnId>").description("Update a column").option("--body <file>","JSON file with the fields to update").option("--confirm-slug-change","Confirm a slug change (breaks integrations that reference it)")).action(async(t,n)=>{let r={...n.body?Wr(n.body):{},...Ur(n)};if(n.confirmSlugChange&&(r.confirmSlugChange=!0),Object.keys(r).every(u=>u==="confirmSlugChange"))throw new Q("Provide --body or at least one field flag.");let a=await new g(f()).columns.update(t,r);if(p()){D(a);return}E("Column updated."),Vr(a)})}function Al(s,e){if(s&&typeof s=="object"&&"columns"in s){if(Object.keys(e).length>0)throw new Q("Field flags cannot be combined with a bulk --body file.");return s}let t={...s,...e};if(typeof t.name!="string"||t.name.length===0)throw new Q("A column name is required (--name).");return t}var qr=I(require("fs"));var Oi=["OFF","TEXT","FAST","BALANCED","PRO"],ki=["LOW","MEDIUM","HIGH"];function _l(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function vl(s){let e=s.toUpperCase();if(Oi.includes(e))return e;throw new Q(`Expected one of ${Oi.join(", ")}.`)}function Sl(s){let e=s.toUpperCase();if(ki.includes(e))return e;throw new Q(`Expected one of ${ki.join(", ")}.`)}function Gr(s){let e=s.command("schema").description("Extraction schema management");e.command("get <deploymentId>").description("Get extraction schema details").action(async t=>{let i=await new g(f()).schema.get(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update extraction schema settings (dynamic mapping, bbox tier, reasoning level, or any field via --body)").option("--body <file>","JSON file with schema settings to update").option("--dynamic-mapping <on|off>","Enable or disable dynamic mapping (turns big-table extraction off when enabled)",_l).option("--bbox-tier <tier>",`Bounding box tier: ${Oi.join(", ")}`,vl).option("--reasoning-level <level>",`Reasoning depth: ${ki.join(", ")}`,Sl).action(async(t,n)=>{let r={...n.body?JSON.parse(qr.readFileSync(n.body,"utf-8")):{},...n.dynamicMapping!==void 0?{useDynamicMapping:n.dynamicMapping}:{},...n.bboxTier!==void 0?{bboxTier:n.bboxTier}:{},...n.reasoningLevel!==void 0?{reasoningLevel:n.reasoningLevel}:{}};if(Object.keys(r).length===0)throw new Q("Provide --body, --dynamic-mapping, --bbox-tier or --reasoning-level.");let a=await new g(f()).schema.update(t,r);p()?D(a):(E("Extraction schema updated."),w(a))}),e.command("data <deploymentId>").description("Get all data for an extraction schema").action(async t=>{let i=await new g(f()).schema.getAllData(t);p()?D(i):w(i)})}var Kr=I(require("fs"));function Yr(s){let e=s.command("benchmarks").description("Benchmark management");e.command("run <extractionSchemaId>").description("Run a benchmark").requiredOption("--name <name>","Benchmark name").option("--description <desc>","Benchmark description").option("--file-ids <ids>","Comma-separated file IDs").option("--config-file <file>","JSON file with benchmark configuration").action(async(t,n)=>{let i=new g(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=Kr.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${t}/run-benchmark`,r);p()?D(o):(E("Benchmark started."),w(o))}),e.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async t=>{let i=await new g(f()).http.get(`/benchmark/${t}/list-files`),r=Array.isArray(i)?i:i.data||i;p()?D(i):v(r)}),e.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(t,n)=>{let r=await new g(f()).http.get(`/benchmark/${t}/get-results`,{executionId:n.executionId});p()?D(r):w(r)}),e.command("status <executionId>").description("Get benchmark execution status").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}`);p()?D(i):w(i)}),e.command("metrics <executionId>").description("Get benchmark execution metrics").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}/metrics`);p()?D(i):w(i)})}var me=I(require("fs")),pt=I(require("path")),un=require("stream"),Zr=require("stream/promises");var an=I(require("fs")),dt=I(require("path"));var xl=["JOB_CONTEXT.json",dt.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function zr(s){let e=s?[dt.resolve(s)]:xl.map(t=>dt.resolve(t));for(let t of e)if(an.existsSync(t)){let n=an.readFileSync(t,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new W(`Invalid JSON in ${t}`)}return Tl(i,t),i}throw new R("JOB_CONTEXT.json not found. Searched: "+e.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function Tl(s,e){let t=[];if(s.jobId||t.push("jobId"),s.fileId||t.push("fileId"),s.fileName||t.push("fileName"),s.sourceFileUrl||t.push("sourceFileUrl"),s.deploymentId||t.push("deploymentId"),s.extractionSchemaId||t.push("extractionSchemaId"),t.length>0)throw new W(`JOB_CONTEXT.json (${e}) missing required fields: ${t.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new W(`JOB_CONTEXT.json (${e}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new W("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new W(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function Xr(s,e){let t=[],n=[],i=[],r=0;if(!s||typeof s!="object")return{valid:!1,errors:["Submission must be a JSON object"],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};if(!s.tables||typeof s.tables!="object")return{valid:!1,errors:['Submission must have a "tables" object'],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};let o=new Map;for(let u of e.schema.tables)o.set(u.name,u);let a=Object.keys(s.tables);for(let u of a){let l=o.get(u);if(!l){t.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){t.push(`Table "${u}": rows must be an array`);continue}let d=!l.isPrimary,m=new Set(l.columns.map(F=>F.name)),h=new Map(l.columns.map(F=>[F.name,F]));for(let F=0;F<c.length;F++){let A=c[F];Rl(A,F,u,d,m,h,t,n)}i.push({name:u,rowCount:c.length,isChild:d}),r+=c.length}for(let u of e.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:t.length===0,errors:t,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function Rl(s,e,t,n,i,r,o,a){let u=`Table "${t}" row ${e}`;if(typeof s!="object"||s===null){o.push(`${u}: must be an object`);return}if(typeof s.index!="number"&&o.push(`${u}: missing or invalid "index" (must be a number)`),!s.cells||typeof s.cells!="object"){o.push(`${u}: missing or invalid "cells" object`);return}n&&(s.parentIndex===void 0||s.parentIndex===null)&&o.push(`${u}: child table rows must have "parentIndex"`),n&&s.parentIndex!==void 0&&typeof s.parentIndex!="number"&&o.push(`${u}: "parentIndex" must be a number`);let l=Object.keys(s.cells);if(l.length===0){o.push(`${u}: cells object is empty`);return}let c=0;for(let d of l)if(!i.has(d))a.push(`${u}: unknown column "${d}" (will be skipped by API)`);else{c++;let m=r.get(d);m&&Ol(s.cells[d],d,m.type,m.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function Ol(s,e,t,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${e}" is a LIST but value is not an array`);return}switch(t){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${e}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${e}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${e}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${e}" (LIST) should be an array`);break}}}var Qr=200;function eo(s){let e=s.command("jobs").description("Job queue management");e.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f());if(n.wait){let r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a;for await(let u of r.poll(t,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${t}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a?.status}`),p()?D(a):w(a)}else{let r=await i.queue.getStatus(t);p()?D(r):w(r)}}),e.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f()),r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a=await r.waitForCompletion(t,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${t}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a.status}`),p()?D(a):w(a)}),e.command("cancel <jobId>").description("Cancel a queued job").action(async t=>{await new g(f()).queue.cancel(t),p()?D({success:!0,jobId:t}):E(`Job ${t} cancelled.`)}),e.command("update <jobId>").description("Update job status").requiredOption("--status <status>","Status: PROCESSING, COMPLETED, or FAILED").option("--error-message <msg>","Error message (required for FAILED)").option("--pages <n>","Pages processed (for COMPLETED billing)").option("--rows <n>","Rows created (for COMPLETED billing)").action(async(t,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new W("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new W("--error-message is required when status is FAILED");let o=await new g(f()).queue.updateStatus(t,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});p()?D(o):E(`Job ${t} status updated to ${i}`)}),e.command("download <url>").description("Download a file from a URL and optionally mark a job as PROCESSING").option("--job-id <id>","Job ID to mark as PROCESSING (or $LIMAI_JOB_ID)").option("--output <path>","Output file path","./source").action(async(t,n)=>{let i=new g(f()),r=n.jobId||process.env.LIMAI_JOB_ID,o=y("Downloading...");o.start();try{r&&(o.text="Marking job as PROCESSING...",await i.queue.updateStatus(r,{status:"PROCESSING"})),o.text="Downloading file...";let a=await fetch(t);if(!a.ok)throw new R(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=pt.resolve(n.output),l=pt.dirname(u);if(me.existsSync(l)||me.mkdirSync(l,{recursive:!0}),!a.body)throw new R("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,d=new un.Transform({transform(h,F,A){c+=h.byteLength,A(null,h)}});await(0,Zr.pipeline)(un.Readable.fromWeb(a.body),d,me.createWriteStream(u)),o.succeed(`Downloaded (${Nl(c)})`);let m={file:u,bytes:c};r&&(m.jobId=r,m.status="PROCESSING"),p()&&D(m)}catch(a){throw o.fail("Download failed"),r&&await Pl(i,r,a),a}}),e.command("submit <file>").description("Validate and submit extraction data, then mark job complete").requiredOption("--context <path>","Path to JOB_CONTEXT.json").option("--job-id <id>","Job ID (or $LIMAI_JOB_ID)").option("--file-id <id>","File ID (or $LIMAI_FILE_ID)").option("--deployment-id <id>","Deployment ID (or $LIMAI_DEPLOYMENT_ID)").option("--batch-size <n>","Rows per API batch",String(Qr)).option("--dry-run","Validate and show plan without submitting").action(async(t,n)=>{let i=zr(n.context),r=n.jobId||process.env.LIMAI_JOB_ID||i.jobId,o=n.fileId||process.env.LIMAI_FILE_ID||i.fileId,a=n.deploymentId||process.env.LIMAI_DEPLOYMENT_ID||i.deploymentId,u=new g(f()),l=parseInt(n.batchSize)||Qr,c=y("Loading and validating submission...");c.start();try{let d=$l(t),m=Xr(d,i);if(!m.valid){c.fail("Validation failed");for(let S of m.errors)console.error(`\x1B[31m ${S}\x1B[0m`);p()&&D({error:{code:"VALIDATION_ERROR",errors:m.errors}}),process.exit(1)}if(m.warnings.length>0&&!p())for(let S of m.warnings)Y(` ${S}`);let h=new Map,F=[],A=[];for(let S of i.schema.tables)h.set(S.name,S.id),S.isPrimary?F.push(S.name):A.push(S.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let S={dryRun:!0,validation:m.summary,deleteOrder:[...A,...F].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T)})),createOrder:[...F,...A].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T),rows:d.tables[T].length,batches:Math.ceil(d.tables[T].length/l)}))};if(p())D(S);else{B("Delete order:");for(let T of S.deleteOrder)B(` ${T.table} (${T.tableId})`);B("Create order:");for(let T of S.createOrder)B(` ${T.table}: ${T.rows} rows in ${T.batches} batch(es)`)}return}let k=Object.keys(d.tables),b=[...A,...F].filter(S=>k.includes(S));for(let S of b){let T=h.get(S);c.text=`Deleting existing rows from "${S}"...`,await u.tables.deleteRows(T,{fileId:o,deploymentId:a})}let C=0,x=new Map;for(let S of F){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=new Map;x.set(S,ye);let fe=await kl(u,ze,o,a,T,l,c,S);for(let K=0;K<T.length;K++)fe[K]&&ye.set(T[K].index,fe[K]);C+=fe.length}for(let S of A){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=Bl(S,i),fe=ye?x.get(ye):void 0,K=T.map(Oe=>{let An;if(Oe.parentIndex!==void 0&&fe&&(An=fe.get(Oe.parentIndex),!An))throw new W(`Table "${S}" row ${Oe.index}: parentIndex ${Oe.parentIndex} does not match any parent row`);return{cells:Oe.cells,index:Oe.index,parentRowId:An}}),bt=await to(u,ze,o,a,K,l,c,S);C+=bt.length}c.text="Marking job as COMPLETED...",await u.queue.updateStatus(r,{status:"COMPLETED",pages:d.metadata?.pages,rows:C}),c.succeed(`Submitted ${C} rows across ${m.summary.tablesFound} table(s). Job COMPLETED.`);let V={status:"COMPLETED",jobId:r,tablesProcessed:m.summary.tablesFound,totalRowsCreated:C,tables:m.summary.tableDetails};p()&&D(V)}catch(d){c.fail("Submission failed");let m=d instanceof Error?d.message:String(d),h=d instanceof W?"VALIDATION_ERROR":"SUBMISSION_ERROR";p()?D({error:{code:h,message:m}}):console.error(`\x1B[31m ${m}\x1B[0m`),process.exit(1)}})}async function kl(s,e,t,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return to(s,e,t,n,u,r,o,a)}async function to(s,e,t,n,i,r,o,a){let u=Array.from({length:i.length}),l=Math.ceil(i.length/r),c=3,d=0,m=[];for(let h=0;h<i.length;h+=r)m.push({start:h,batchRows:i.slice(h,h+r)});for(let h=0;h<m.length;h+=c){let F=m.slice(h,h+c),A=await Promise.all(F.map(({batchRows:k})=>s.tables.createRows(e,{fileId:t,deploymentId:n,rows:k})));for(let k=0;k<F.length;k++){let{start:b}=F[k];A[k].rowIds.forEach((C,x)=>{u[b+x]=C})}d+=F.length,o.text=`"${a}" batch ${d}/${l} (${Math.min(d*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Bl(s,e){let t=e.schema.tables.find(i=>i.name===s);return!t||t.isPrimary?void 0:e.schema.tables.find(i=>i.isPrimary)?.name}function $l(s){let e=pt.resolve(s);if(!me.existsSync(e))throw new W(`File not found: ${e}`);let t=me.readFileSync(e,"utf-8");try{return JSON.parse(t)}catch{throw new W(`Invalid JSON in ${e}`)}}async function Pl(s,e,t){try{let n=t instanceof Error?t.message:String(t);await s.queue.updateStatus(e,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function Nl(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var ve=I(require("fs")),cn=I(require("path"));var Hi=I(Lo());var pc={update(){},increment(){},stop(){}};function Mo(s){if(p())return pc;let e=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",t=new Hi.default.SingleBar({format:e,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Hi.default.Presets.shades_classic);return t.start(s.total,0),{update(n,i){t.update(n,i)},increment(n=1,i){t.increment(n,i)},stop(){t.stop()}}}function Uo(s){s.command("upload <extractionSchemaId> <path>").description("Upload a file or folder for extraction").option("--concurrency <n>","Concurrent uploads","5").option("--process","Queue files for extraction after upload").option("--wait","Wait for all extractions to complete (implies --process)").option("--output <file>","Write results to JSON file").option("--glob <pattern>","Filter files by glob pattern").action(async(e,t,n)=>{let i=f(),r=new g(i),o=cn.resolve(t),a=n.process||n.wait;ve.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=ve.statSync(o);if(u.isFile()){let l=y(`Uploading ${cn.basename(o)}...`);l.start();let c=await r.uploadFile(e,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${mc(c.bytesUploaded)})`),a){let d=y("Queuing for extraction...");d.start();let m=await r.documents.processAsync(e,c.fileId);if(d.succeed(`Queued. Job ID: ${m.jobId}`),n.wait){let h=new Z(r.queue),F=y("Waiting for extraction...");F.start();let A=await h.waitForCompletion(m.jobId,{onStatus:k=>{F.text=`Extraction: ${k.status} (${k.extractionStageStatus})`}});if(A.status==="COMPLETED"){F.succeed("Extraction completed.");let k=await r.documents.getFileData(c.fileId,e);n.output?(ve.writeFileSync(n.output,JSON.stringify(k,null,2)),E(`Results written to ${n.output}`)):p()?D(k):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(k.data?.tables??{}).length})}else F.fail(`Extraction ${A.status}`),process.exit(1)}else p()&&D({fileId:c.fileId,fileName:c.filename,jobId:m.jobId})}else p()&&D(c)}else if(u.isDirectory()){B(`Scanning ${o} for files...`);let l=await r.uploadFolder(e,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){Y("No supported files found in directory.");return}if(E(`Upload complete: ${l.uploaded} uploaded, ${l.queued} queued, ${l.failed} failed (${l.total} total)`),l.failed>0){let c=l.files.filter(d=>d.status==="failed");for(let d of c)Y(` Failed: ${d.filename} - ${d.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(h=>h.status==="queued"&&h.jobId);B(`Waiting for ${c.length} extractions to complete...`);let d=Mo({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),m=0;await Promise.all(c.map(async h=>{await new Z(r.queue).waitForCompletion(h.jobId),m++,d.update(m)})),d.stop(),E("All extractions completed.")}n.output?(ve.writeFileSync(n.output,JSON.stringify(l,null,2)),E(`Results written to ${n.output}`)):p()&&D(l)}})}function mc(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Wo=I(require("fs"));function Vo(s){s.command("download <tableId>").description("Download extracted data from a table").option("--output <file>","Output file path (streams NDJSON to file)").option("--limit <n>","Max rows to download").option("--all","Download all rows (auto-paginate)").option("--page-size <n>","Rows per API call","100").option("--order <order>","Sort order (asc|desc)","desc").option("--status <status>","Filter by row status").action(async(e,t)=>{let n=new g(f()),i=y("Fetching extraction data...");i.start();let r=t.limit?parseInt(t.limit):t.all?void 0:100;if(t.output){let o=Wo.createWriteStream(t.output),a=0,u=0;for await(let l of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status})){for(let c of l)o.write(JSON.stringify(c)+`
|
|
51
|
+
`;return this.stop(),this.#i.write(c),this}};function Ti(s){return new xi(s)}var Ie={start(){return Ie},stop(){return Ie},succeed(){return Ie},fail(){return Ie},warn(){return Ie},info(){return Ie},text:"",isSpinning:!1};function y(s){return p()?Ie:Ti({text:s,color:"cyan"})}function $r(s){let e=s.command("documents").description("Document upload and processing");e.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(t,n)=>{let i=new g(f()),r=on.resolve(n);rn.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${on.basename(r)}...`);o.start();let a=await i.uploadFile(t,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),p()?D(a):w(a)}),e.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(t,n,i)=>{let r=new g(f());if(i.async||i.wait){let a=await r.documents.processAsync(t,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new Z(r.queue).waitForCompletion(a.jobId,{onStatus:d=>{u.text=`Extraction: ${d.status} (${d.extractionStageStatus})`}});if(c.status==="COMPLETED"){u.succeed("Extraction completed.");let d=await r.documents.getFileData(n,t,void 0,a.jobId);p()?D(d):w({fileId:n,status:"COMPLETED",tables:Object.keys(d.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else p()?D(a):(E("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(t,n);a.succeed("Processing complete."),p()?D(u):w(u)}}),e.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").option("--job-id <id>","Scope the read to a specific extraction job").action(async(t,n)=>{let r=await new g(f()).documents.getFileData(t,n.extractionSchemaId,void 0,n.jobId);p()?D(r):w(r)}),e.command("data <deploymentId> <fileIds...>").description("Get flat slug-keyed data for one or more documents").option("--include <options>","Comma-separated enrichments: confidence, boundingBoxes, grounding, validations").action(async(t,n,i)=>{let r=new g(f()),o=i.include?.split(",").map(u=>u.trim()).filter(Boolean),a=await r.documents.getDocumentsData(t,n,o);p()?D(a):w(a)}),e.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(t,n,i)=>{let r=new g(f()),o=rn.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(t,n,a),p()?D({success:!0}):E("Corrections submitted.")})}var Ri=I(require("fs"));function Pr(s){let e=s.command("tables").description("Table management");e.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(t,n)=>{let i=new g(f()),r=Ri.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(t,o);p()?D(a):(E("Table created."),w(a))}),e.command("update <tableId>").description("Update a table's instructions or name").option("--instructions <text>","New instructions text").option("--instructions-file <file>","Read new instructions from a file (overrides --instructions)").option("--name <name>","New table name").action(async(t,n)=>{let i=new g(f()),r={};if(n.instructionsFile?r.instructions=Ri.readFileSync(n.instructionsFile,"utf-8"):n.instructions!==void 0&&(r.instructions=n.instructions),n.name!==void 0&&(r.name=n.name),Object.keys(r).length===0)throw new Error("Provide at least one of --instructions, --instructions-file, or --name");let o=await i.tables.update(t,r);p()?D(o):(E("Table updated."),w(o))}),e.command("get <tableId>").description("Get table details").action(async t=>{let i=await new g(f()).tables.get(t);p()?D(i):w(i)}),e.command("rows <tableId>").description("List rows in a table").option("--limit <n>","Number of rows","50").option("--offset <n>","Offset","0").option("--all","Fetch all rows (auto-paginate)").action(async(t,n)=>{let i=new g(f());if(n.all){let r=await kt(js(async(o,a)=>i.tables.listRows(t,{limit:o,offset:a}),{pageSize:500}));p()?D(r):v(r)}else{let r=await i.tables.listRows(t,{limit:parseInt(n.limit),offset:parseInt(n.offset)});p()?D(r):v(r.data)}}),e.command("columns <tableId>").description("List columns in a table").action(async t=>{let i=await new g(f()).tables.listColumns(t);p()?D(i):v(i,["id","name","type"])})}var Hr=I(require("fs"));var Nr=["index","id","name","slug","type","isKey","units","autoGenerateUnits","defaultValue","defaultValueEnabled"],El="NUMBER_WITH_UNIT columns need --units a,b or --auto-generate-units on.";function jr(s){return{...s,units:(s.units??[]).map(e=>e.name).join(", ")}}function bl(s){if(s.type==="NUMBER_WITH_UNIT"&&!s.autoGenerateUnits&&!(s.units&&s.units.length>0))throw new Q(El)}function Ae(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function wl(s){let e=Number(s);if(!Number.isInteger(e)||e<40||e>2e3)throw new Q("Expected an integer between 40 and 2000.");return e}function Il(s){try{return JSON.parse(s)}catch{return s}}function Lr(s){return s.split(",").map(e=>e.trim()).filter(Boolean)}function Mr(s){return s.option("--name <name>","Column name").option("--slug <slug>","Column slug (snake_case)").option("--type <type>","Column type, e.g. TEXT, NUMBER, DATE, LABEL").option("--description <text>","Column description").option("--is-key <on|off>","Mark the column as a key column",Ae).option("--is-list <on|off>","Store multiple values per cell",Ae).option("--date-format <format>","Date format: EU, US or ISO").option("--measurement-type <type>","Benchmark measurement type").option("--excluded-from-extraction <on|off>","Keep the column out of extraction prompts",Ae).option("--pinned <on|off>","Pin the column in the grid",Ae).option("--size <px>","Column width in pixels (40-2000)",wl).option("--default-value <json>","Default value as JSON (falls back to a plain string)",Il).option("--clear-default-value","Clear the stored default value").option("--default-value-enabled <on|off>","Write the default value into empty cells during extraction",Ae).option("--auto-generate-labels <on|off>","Let extraction invent new labels",Ae).option("--auto-generate-units <on|off>","Let extraction invent new units",Ae).option("--labels <names>","Comma-separated label names",Lr).option("--units <names>","Comma-separated unit names",Lr)}function Ur(s){let e={};return s.name!==void 0&&(e.name=s.name),s.slug!==void 0&&(e.slug=s.slug),s.type!==void 0&&(e.type=s.type),s.description!==void 0&&(e.description=s.description),s.isKey!==void 0&&(e.isKey=s.isKey),s.isList!==void 0&&(e.isList=s.isList),s.dateFormat!==void 0&&(e.dateFormat=s.dateFormat),s.measurementType!==void 0&&(e.measurementType=s.measurementType),s.excludedFromExtraction!==void 0&&(e.excludedFromExtraction=s.excludedFromExtraction),s.pinned!==void 0&&(e.pinned=s.pinned),s.size!==void 0&&(e.size=s.size),s.clearDefaultValue?e.defaultValue=null:s.defaultValue!==void 0&&(e.defaultValue=s.defaultValue),s.defaultValueEnabled!==void 0&&(e.defaultValueEnabled=s.defaultValueEnabled),s.autoGenerateLabels!==void 0&&(e.autoGenerateLabels=s.autoGenerateLabels),s.autoGenerateUnits!==void 0&&(e.autoGenerateUnits=s.autoGenerateUnits),s.labels!==void 0&&(e.labels=s.labels.map(t=>({name:t}))),s.units!==void 0&&(e.units=s.units.map(t=>({name:t}))),e}function Wr(s){return JSON.parse(Hr.readFileSync(s,"utf-8"))}function Vr(s){if(p()){D(s);return}w(s)}function Jr(s){let e=s.command("columns").description("Column management");e.command("list <tableId>").description("List the columns of a table").action(async t=>{let i=await new g(f()).columns.list(t);p()?D(i):v(i.map(jr),Nr)}),e.command("get <columnId>").description("Get column details").action(async t=>{let i=await new g(f()).columns.get(t);Vr(i)}),Mr(e.command("create <tableId>").description("Create one or more columns in a table").option("--body <file>","JSON file with a column object or { columns: [...] }")).action(async(t,n)=>{let i=Ur(n),r=n.body?Wr(n.body):void 0,o=Al(r,i);for(let l of"columns"in o?o.columns:[o])bl(l);let u=await new g(f()).columns.create(t,o);if(p()){D(u);return}E(`Created ${u.length} column${u.length===1?"":"s"}.`),v(u.map(jr),Nr)}),Mr(e.command("update <columnId>").description("Update a column").option("--body <file>","JSON file with the fields to update").option("--confirm-slug-change","Confirm a slug change (breaks integrations that reference it)")).action(async(t,n)=>{let r={...n.body?Wr(n.body):{},...Ur(n)};if(n.confirmSlugChange&&(r.confirmSlugChange=!0),Object.keys(r).every(u=>u==="confirmSlugChange"))throw new Q("Provide --body or at least one field flag.");let a=await new g(f()).columns.update(t,r);if(p()){D(a);return}E("Column updated."),Vr(a)})}function Al(s,e){if(s&&typeof s=="object"&&"columns"in s){if(Object.keys(e).length>0)throw new Q("Field flags cannot be combined with a bulk --body file.");return s}let t={...s,...e};if(typeof t.name!="string"||t.name.length===0)throw new Q("A column name is required (--name).");return t}var qr=I(require("fs"));var Oi=["OFF","TEXT","FAST","BALANCED","PRO"],ki=["LOW","MEDIUM","HIGH"];function _l(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function vl(s){let e=s.toUpperCase();if(Oi.includes(e))return e;throw new Q(`Expected one of ${Oi.join(", ")}.`)}function Sl(s){let e=s.toUpperCase();if(ki.includes(e))return e;throw new Q(`Expected one of ${ki.join(", ")}.`)}function Gr(s){let e=s.command("schema").description("Extraction schema management");e.command("get <deploymentId>").description("Get extraction schema details").action(async t=>{let i=await new g(f()).schema.get(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update extraction schema settings (dynamic mapping, bbox tier, reasoning level, or any field via --body)").option("--body <file>","JSON file with schema settings to update").option("--dynamic-mapping <on|off>","Enable or disable dynamic mapping (turns big-table extraction off when enabled)",_l).option("--bbox-tier <tier>",`Bounding box tier: ${Oi.join(", ")}`,vl).option("--reasoning-level <level>",`Reasoning depth: ${ki.join(", ")}`,Sl).action(async(t,n)=>{let r={...n.body?JSON.parse(qr.readFileSync(n.body,"utf-8")):{},...n.dynamicMapping!==void 0?{useDynamicMapping:n.dynamicMapping}:{},...n.bboxTier!==void 0?{bboxTier:n.bboxTier}:{},...n.reasoningLevel!==void 0?{reasoningLevel:n.reasoningLevel}:{}};if(Object.keys(r).length===0)throw new Q("Provide --body, --dynamic-mapping, --bbox-tier or --reasoning-level.");let a=await new g(f()).schema.update(t,r);p()?D(a):(E("Extraction schema updated."),w(a))}),e.command("data <deploymentId>").description("Get all data for an extraction schema").action(async t=>{let i=await new g(f()).schema.getAllData(t);p()?D(i):w(i)})}var Kr=I(require("fs"));function Yr(s){let e=s.command("benchmarks").description("Benchmark management");e.command("run <extractionSchemaId>").description("Run a benchmark").requiredOption("--name <name>","Benchmark name").option("--description <desc>","Benchmark description").option("--file-ids <ids>","Comma-separated file IDs").option("--config-file <file>","JSON file with benchmark configuration").action(async(t,n)=>{let i=new g(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=Kr.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${t}/run-benchmark`,r);p()?D(o):(E("Benchmark started."),w(o))}),e.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async t=>{let i=await new g(f()).http.get(`/benchmark/${t}/list-files`),r=Array.isArray(i)?i:i.data||i;p()?D(i):v(r)}),e.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(t,n)=>{let r=await new g(f()).http.get(`/benchmark/${t}/get-results`,{executionId:n.executionId});p()?D(r):w(r)}),e.command("status <executionId>").description("Get benchmark execution status").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}`);p()?D(i):w(i)}),e.command("metrics <executionId>").description("Get benchmark execution metrics").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}/metrics`);p()?D(i):w(i)})}var me=I(require("fs")),pt=I(require("path")),un=require("stream"),Zr=require("stream/promises");var an=I(require("fs")),dt=I(require("path"));var xl=["JOB_CONTEXT.json",dt.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function zr(s){let e=s?[dt.resolve(s)]:xl.map(t=>dt.resolve(t));for(let t of e)if(an.existsSync(t)){let n=an.readFileSync(t,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new W(`Invalid JSON in ${t}`)}return Tl(i,t),i}throw new R("JOB_CONTEXT.json not found. Searched: "+e.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function Tl(s,e){let t=[];if(s.jobId||t.push("jobId"),s.fileId||t.push("fileId"),s.fileName||t.push("fileName"),s.sourceFileUrl||t.push("sourceFileUrl"),s.deploymentId||t.push("deploymentId"),s.extractionSchemaId||t.push("extractionSchemaId"),t.length>0)throw new W(`JOB_CONTEXT.json (${e}) missing required fields: ${t.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new W(`JOB_CONTEXT.json (${e}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new W("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new W(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function Xr(s,e){let t=[],n=[],i=[],r=0;if(!s||typeof s!="object")return{valid:!1,errors:["Submission must be a JSON object"],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};if(!s.tables||typeof s.tables!="object")return{valid:!1,errors:['Submission must have a "tables" object'],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};let o=new Map;for(let u of e.schema.tables)o.set(u.name,u);let a=Object.keys(s.tables);for(let u of a){let l=o.get(u);if(!l){t.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){t.push(`Table "${u}": rows must be an array`);continue}let d=!l.isPrimary,m=new Set(l.columns.map(F=>F.name)),h=new Map(l.columns.map(F=>[F.name,F]));for(let F=0;F<c.length;F++){let A=c[F];Rl(A,F,u,d,m,h,t,n)}i.push({name:u,rowCount:c.length,isChild:d}),r+=c.length}for(let u of e.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:t.length===0,errors:t,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function Rl(s,e,t,n,i,r,o,a){let u=`Table "${t}" row ${e}`;if(typeof s!="object"||s===null){o.push(`${u}: must be an object`);return}if(typeof s.index!="number"&&o.push(`${u}: missing or invalid "index" (must be a number)`),!s.cells||typeof s.cells!="object"){o.push(`${u}: missing or invalid "cells" object`);return}n&&(s.parentIndex===void 0||s.parentIndex===null)&&o.push(`${u}: child table rows must have "parentIndex"`),n&&s.parentIndex!==void 0&&typeof s.parentIndex!="number"&&o.push(`${u}: "parentIndex" must be a number`);let l=Object.keys(s.cells);if(l.length===0){o.push(`${u}: cells object is empty`);return}let c=0;for(let d of l)if(!i.has(d))a.push(`${u}: unknown column "${d}" (will be skipped by API)`);else{c++;let m=r.get(d);m&&Ol(s.cells[d],d,m.type,m.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function Ol(s,e,t,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${e}" is a LIST but value is not an array`);return}switch(t){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${e}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${e}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${e}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${e}" (LIST) should be an array`);break}}}var Qr=200;function eo(s){let e=s.command("jobs").description("Job queue management");e.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f());if(n.wait){let r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a;for await(let u of r.poll(t,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${t}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a?.status}`),p()?D(a):w(a)}else{let r=await i.queue.getStatus(t);p()?D(r):w(r)}}),e.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f()),r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a=await r.waitForCompletion(t,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${t}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a.status}`),p()?D(a):w(a)}),e.command("cancel <jobId>").description("Cancel a queued job").action(async t=>{await new g(f()).queue.cancel(t),p()?D({success:!0,jobId:t}):E(`Job ${t} cancelled.`)}),e.command("update <jobId>").description("Update job status").requiredOption("--status <status>","Status: PROCESSING, COMPLETED, or FAILED").option("--error-message <msg>","Error message (required for FAILED)").option("--pages <n>","Pages processed (for COMPLETED billing)").option("--rows <n>","Rows created (for COMPLETED billing)").action(async(t,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new W("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new W("--error-message is required when status is FAILED");let o=await new g(f()).queue.updateStatus(t,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});p()?D(o):E(`Job ${t} status updated to ${i}`)}),e.command("download <url>").description("Download a file from a URL and optionally mark a job as PROCESSING").option("--job-id <id>","Job ID to mark as PROCESSING (or $LIMAI_JOB_ID)").option("--output <path>","Output file path","./source").action(async(t,n)=>{let i=new g(f()),r=n.jobId||process.env.LIMAI_JOB_ID,o=y("Downloading...");o.start();try{r&&(o.text="Marking job as PROCESSING...",await i.queue.updateStatus(r,{status:"PROCESSING"})),o.text="Downloading file...";let a=await fetch(t);if(!a.ok)throw new R(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=pt.resolve(n.output),l=pt.dirname(u);if(me.existsSync(l)||me.mkdirSync(l,{recursive:!0}),!a.body)throw new R("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,d=new un.Transform({transform(h,F,A){c+=h.byteLength,A(null,h)}});await(0,Zr.pipeline)(un.Readable.fromWeb(a.body),d,me.createWriteStream(u)),o.succeed(`Downloaded (${Nl(c)})`);let m={file:u,bytes:c};r&&(m.jobId=r,m.status="PROCESSING"),p()&&D(m)}catch(a){throw o.fail("Download failed"),r&&await Pl(i,r,a),a}}),e.command("submit <file>").description("Validate and submit extraction data, then mark job complete").requiredOption("--context <path>","Path to JOB_CONTEXT.json").option("--job-id <id>","Job ID (or $LIMAI_JOB_ID)").option("--file-id <id>","File ID (or $LIMAI_FILE_ID)").option("--deployment-id <id>","Deployment ID (or $LIMAI_DEPLOYMENT_ID)").option("--batch-size <n>","Rows per API batch",String(Qr)).option("--dry-run","Validate and show plan without submitting").action(async(t,n)=>{let i=zr(n.context),r=n.jobId||process.env.LIMAI_JOB_ID||i.jobId,o=n.fileId||process.env.LIMAI_FILE_ID||i.fileId,a=n.deploymentId||process.env.LIMAI_DEPLOYMENT_ID||i.deploymentId,u=new g(f()),l=parseInt(n.batchSize)||Qr,c=y("Loading and validating submission...");c.start();try{let d=$l(t),m=Xr(d,i);if(!m.valid){c.fail("Validation failed");for(let S of m.errors)console.error(`\x1B[31m ${S}\x1B[0m`);p()&&D({error:{code:"VALIDATION_ERROR",errors:m.errors}}),process.exit(1)}if(m.warnings.length>0&&!p())for(let S of m.warnings)Y(` ${S}`);let h=new Map,F=[],A=[];for(let S of i.schema.tables)h.set(S.name,S.id),S.isPrimary?F.push(S.name):A.push(S.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let S={dryRun:!0,validation:m.summary,deleteOrder:[...A,...F].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T)})),createOrder:[...F,...A].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T),rows:d.tables[T].length,batches:Math.ceil(d.tables[T].length/l)}))};if(p())D(S);else{B("Delete order:");for(let T of S.deleteOrder)B(` ${T.table} (${T.tableId})`);B("Create order:");for(let T of S.createOrder)B(` ${T.table}: ${T.rows} rows in ${T.batches} batch(es)`)}return}let k=Object.keys(d.tables),b=[...A,...F].filter(S=>k.includes(S));for(let S of b){let T=h.get(S);c.text=`Deleting existing rows from "${S}"...`,await u.tables.deleteRows(T,{fileId:o,deploymentId:a})}let C=0,x=new Map;for(let S of F){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=new Map;x.set(S,ye);let fe=await kl(u,ze,o,a,T,l,c,S);for(let K=0;K<T.length;K++)fe[K]&&ye.set(T[K].index,fe[K]);C+=fe.length}for(let S of A){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=Bl(S,i),fe=ye?x.get(ye):void 0,K=T.map(Oe=>{let An;if(Oe.parentIndex!==void 0&&fe&&(An=fe.get(Oe.parentIndex),!An))throw new W(`Table "${S}" row ${Oe.index}: parentIndex ${Oe.parentIndex} does not match any parent row`);return{cells:Oe.cells,index:Oe.index,parentRowId:An}}),bt=await to(u,ze,o,a,K,l,c,S);C+=bt.length}c.text="Marking job as COMPLETED...",await u.queue.updateStatus(r,{status:"COMPLETED",pages:d.metadata?.pages,rows:C}),c.succeed(`Submitted ${C} rows across ${m.summary.tablesFound} table(s). Job COMPLETED.`);let V={status:"COMPLETED",jobId:r,tablesProcessed:m.summary.tablesFound,totalRowsCreated:C,tables:m.summary.tableDetails};p()&&D(V)}catch(d){c.fail("Submission failed");let m=d instanceof Error?d.message:String(d),h=d instanceof W?"VALIDATION_ERROR":"SUBMISSION_ERROR";p()?D({error:{code:h,message:m}}):console.error(`\x1B[31m ${m}\x1B[0m`),process.exit(1)}})}async function kl(s,e,t,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return to(s,e,t,n,u,r,o,a)}async function to(s,e,t,n,i,r,o,a){let u=Array.from({length:i.length}),l=Math.ceil(i.length/r),c=3,d=0,m=[];for(let h=0;h<i.length;h+=r)m.push({start:h,batchRows:i.slice(h,h+r)});for(let h=0;h<m.length;h+=c){let F=m.slice(h,h+c),A=await Promise.all(F.map(({batchRows:k})=>s.tables.createRows(e,{fileId:t,deploymentId:n,rows:k})));for(let k=0;k<F.length;k++){let{start:b}=F[k];A[k].rowIds.forEach((C,x)=>{u[b+x]=C})}d+=F.length,o.text=`"${a}" batch ${d}/${l} (${Math.min(d*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Bl(s,e){let t=e.schema.tables.find(i=>i.name===s);return!t||t.isPrimary?void 0:e.schema.tables.find(i=>i.isPrimary)?.name}function $l(s){let e=pt.resolve(s);if(!me.existsSync(e))throw new W(`File not found: ${e}`);let t=me.readFileSync(e,"utf-8");try{return JSON.parse(t)}catch{throw new W(`Invalid JSON in ${e}`)}}async function Pl(s,e,t){try{let n=t instanceof Error?t.message:String(t);await s.queue.updateStatus(e,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function Nl(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var ve=I(require("fs")),cn=I(require("path"));var Hi=I(Lo());var pc={update(){},increment(){},stop(){}};function Mo(s){if(p())return pc;let e=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",t=new Hi.default.SingleBar({format:e,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Hi.default.Presets.shades_classic);return t.start(s.total,0),{update(n,i){t.update(n,i)},increment(n=1,i){t.increment(n,i)},stop(){t.stop()}}}function Uo(s){s.command("upload <extractionSchemaId> <path>").description("Upload a file or folder for extraction").option("--concurrency <n>","Concurrent uploads","5").option("--process","Queue files for extraction after upload").option("--wait","Wait for all extractions to complete (implies --process)").option("--output <file>","Write results to JSON file").option("--glob <pattern>","Filter files by glob pattern").action(async(e,t,n)=>{let i=f(),r=new g(i),o=cn.resolve(t),a=n.process||n.wait;ve.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=ve.statSync(o);if(u.isFile()){let l=y(`Uploading ${cn.basename(o)}...`);l.start();let c=await r.uploadFile(e,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${mc(c.bytesUploaded)})`),a){let d=y("Queuing for extraction...");d.start();let m=await r.documents.processAsync(e,c.fileId);if(d.succeed(`Queued. Job ID: ${m.jobId}`),n.wait){let h=new Z(r.queue),F=y("Waiting for extraction...");F.start();let A=await h.waitForCompletion(m.jobId,{onStatus:k=>{F.text=`Extraction: ${k.status} (${k.extractionStageStatus})`}});if(A.status==="COMPLETED"){F.succeed("Extraction completed.");let k=await r.documents.getFileData(c.fileId,e,void 0,m.jobId);n.output?(ve.writeFileSync(n.output,JSON.stringify(k,null,2)),E(`Results written to ${n.output}`)):p()?D(k):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(k.data?.tables??{}).length})}else F.fail(`Extraction ${A.status}`),process.exit(1)}else p()&&D({fileId:c.fileId,fileName:c.filename,jobId:m.jobId})}else p()&&D(c)}else if(u.isDirectory()){B(`Scanning ${o} for files...`);let l=await r.uploadFolder(e,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){Y("No supported files found in directory.");return}if(E(`Upload complete: ${l.uploaded} uploaded, ${l.queued} queued, ${l.failed} failed (${l.total} total)`),l.failed>0){let c=l.files.filter(d=>d.status==="failed");for(let d of c)Y(` Failed: ${d.filename} - ${d.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(h=>h.status==="queued"&&h.jobId);B(`Waiting for ${c.length} extractions to complete...`);let d=Mo({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),m=0;await Promise.all(c.map(async h=>{await new Z(r.queue).waitForCompletion(h.jobId),m++,d.update(m)})),d.stop(),E("All extractions completed.")}n.output?(ve.writeFileSync(n.output,JSON.stringify(l,null,2)),E(`Results written to ${n.output}`)):p()&&D(l)}})}function mc(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Wo=I(require("fs"));function Vo(s){s.command("download <tableId>").description("Download extracted data from a table").option("--output <file>","Output file path (streams NDJSON to file)").option("--limit <n>","Max rows to download").option("--all","Download all rows (auto-paginate)").option("--page-size <n>","Rows per API call","100").option("--order <order>","Sort order (asc|desc)","desc").option("--status <status>","Filter by row status").action(async(e,t)=>{let n=new g(f()),i=y("Fetching extraction data...");i.start();let r=t.limit?parseInt(t.limit):t.all?void 0:100;if(t.output){let o=Wo.createWriteStream(t.output),a=0,u=0;for await(let l of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status})){for(let c of l)o.write(JSON.stringify(c)+`
|
|
52
52
|
`);a+=l.length,u++,i.text=`Streamed ${a} rows (${u} pages)...`}await new Promise((l,c)=>{o.end(()=>l()),o.on("error",c)}),i.succeed(`Downloaded ${a} rows.`),E(`Data written to ${t.output} (NDJSON format)`)}else{let o=[],a=0;for await(let u of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status}))o.push(...u),a++,i.text=`Fetched ${o.length} rows (${a} pages)...`;i.succeed(`Downloaded ${o.length} rows.`),D(o)}})}var dn=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Ho=10,Dc=13,Se=32;function Ji(s){}function Go(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ji,onError:t=Ji,onRetry:n=Ji,onComment:i}=s,r=[],o=!0,a,u="",l=0,c;function d(b){if(o&&(o=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),r.length===0){let V=m(b);V!==""&&r.push(V);return}if(b.indexOf(`
|
|
53
53
|
`)===-1&&b.indexOf("\r")===-1){r.push(b);return}r.push(b);let C=r.join("");r.length=0;let x=m(C);x!==""&&r.push(x)}function m(b){let C=0;if(b.indexOf("\r")===-1){let x=b.indexOf(`
|
|
54
54
|
`,C);for(;x!==-1;){if(C===x){l>0&&e({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0,C=x+1,x=b.indexOf(`
|
|
@@ -68,4 +68,4 @@ Conditions:`),v(m.conditions.map(h=>({id:h.id,type:h.type,entityId:h.entityId,la
|
|
|
68
68
|
Per route`),v(a.perRoute.map(u=>({family:u.routeFamily,id:u.routeId,name:u.routeName,total:u.totalEvents,success:u.successfulEvents,failed:u.failedEvents,pending:u.pendingEvents,successRate:u.successRate}))),B(`
|
|
69
69
|
Series`),v(a.series.map(u=>({bucket:u.bucket,successful:u.successful,failed:u.failed,pending:u.pending})))}),e.command("retry <projectId> <webhookId>").description("Re-enqueue failed deliveries for a webhook subscription").requiredOption("--event-id <id>",`Delivery event ID to retry (repeatable, max ${100})`,ue).action(async(t,n,i)=>{i.eventId.length>100&&de("VALIDATION_ERROR",`Too many event IDs (${i.eventId.length}). The API accepts at most ${100} per call.`);let r=new g(f()),o=y("Retrying deliveries...");o.start();let a=await r.webhooks.retry(t,n,i.eventId);if(o.succeed(a.message),p()){D(a);return}a.retried.length>0&&(B(`
|
|
70
70
|
Retried`),v(a.retried.map(u=>({eventId:u.eventId,url:u.url})))),a.skipped.length>0&&(B(`
|
|
71
|
-
Skipped`),v(a.skipped.map(u=>({eventId:u.eventId,url:u.url,reason:u.reason}))))})}var Pa=require("child_process"),Na=I(require("os")),ja=I(require("path"));var Et="@limai.io/cli",Rc=`https://registry.npmjs.org/${Et.replaceAll("/","%2f")}/latest`,In="0.4.
|
|
71
|
+
Skipped`),v(a.skipped.map(u=>({eventId:u.eventId,url:u.url,reason:u.reason}))))})}var Pa=require("child_process"),Na=I(require("os")),ja=I(require("path"));var Et="@limai.io/cli",Rc=`https://registry.npmjs.org/${Et.replaceAll("/","%2f")}/latest`,In="0.4.6";function Oc(){let s=ja.join(Na.homedir(),".limai","bin");return process.execPath.startsWith(s)}async function kc(){let s=await fetch(Rc);if(!s.ok)throw new Error(`npm registry responded with ${s.status}`);let e=await s.json();if(!e.version)throw new Error("npm registry response did not include a version");return e.version}function La(s){s.command("update").description("Update the LimAI CLI to the latest version").action(async()=>{if(Oc()&&(_({code:"UPDATE",message:"This copy of the CLI is the discontinued standalone binary and can no longer be updated."}),B("Remove it and reinstall with npm:"),B(" rm -rf ~/.limai/bin"),B(` npm install -g ${Et}`),process.exit(1)),In.endsWith("-dev")){B("Running from source \u2014 update with `git pull` in the monorepo instead.");return}let e;try{e=await kc()}catch(n){_({code:"UPDATE",message:n instanceof Error?`Could not check for updates: ${n.message}`:"Could not check for updates"}),process.exit(1)}if(e===In){E(`Already up to date (v${In}).`);return}B(`Updating ${Et} v${In} \u2192 v${e}...`);let t=(0,Pa.spawnSync)("npm",["install","-g",`${Et}@latest`],{stdio:"inherit",shell:process.platform==="win32"});(t.error||t.status!==0)&&(_({code:"UPDATE",message:t.error instanceof Error?t.error.message:`npm install exited with status ${t.status}`}),B(`Run it manually: npm install -g ${Et}@latest`),process.exit(1)),E(`Updated to v${e}.`)})}var N=new Is,Bc="0.4.6";N.name("limai").description("CLI for the LimAI data extraction platform").version(Bc).option("--json","Output raw JSON (pipe-friendly)").option("--verbose","Enable debug logging").option("--token <token>","Override stored API token").option("--api-url <url>","Override stored API URL").hook("preAction",s=>{let e=s.optsWithGlobals();e.json&&_s(!0),e.verbose&&vs(!0),e.token&&(process.env.LIMAI_API_TOKEN=e.token),e.apiUrl&&(process.env.LIMAI_API_URL=e.apiUrl)});nr(N);ra(N);ur(N);lr(N);$r(N);Pr(N);Jr(N);Gr(N);Yr(N);eo(N);Uo(N);Vo(N);Xo(N);Zo(N);ta(N);ua(N);ca(N);Da(N);ga(N);Ea(N);wa(N);Aa(N);_a(N);va(N);Sa(N);xa(N);$a(N);La(N);process.on("unhandledRejection",s=>{Ss(s)});N.parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -774,7 +774,7 @@ declare class DocumentsResource {
|
|
|
774
774
|
processSync(extractionSchemaId: string, fileId: string, opts?: ProcessOptions): Promise<FileData>;
|
|
775
775
|
processAsync(extractionSchemaId: string, fileId: string, opts?: ProcessOptions): Promise<ProcessFileAsyncResponse>;
|
|
776
776
|
processFilesAsync(extractionSchemaId: string, fileIds: string[], opts?: ProcessOptions): Promise<BulkProcessResponse>;
|
|
777
|
-
getFileData(fileId: string, extractionSchemaId?: string, include?: IncludeOption[]): Promise<FileData>;
|
|
777
|
+
getFileData(fileId: string, extractionSchemaId?: string, include?: IncludeOption[], jobId?: string): Promise<FileData>;
|
|
778
778
|
getFilesData(fileIds: string[], include?: IncludeOption[]): Promise<BulkGetFilesDataResponse>;
|
|
779
779
|
getDocumentData(deploymentId: string, fileId: string, include?: IncludeOption[]): Promise<FlatDocumentDataResponse>;
|
|
780
780
|
getDocumentsData(deploymentId: string, fileIds: string[], include?: IncludeOption[]): Promise<BulkFlatDocumentDataResponse>;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _e=Object.create;var ot=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var We=(n,t)=>{for(var e in t)ot(n,e,{get:t[e],enumerable:!0})},ne=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ne(t))!Fe.call(n,r)&&r!==e&&ot(n,r,{get:()=>t[r],enumerable:!(s=Le(t,r))||s.enumerable});return n};var P=(n,t,e)=>(e=n!=null?_e(Me(n)):{},ne(t||!n||!n.__esModule?ot(e,"default",{value:n,enumerable:!0}):e,n)),Be=n=>ne(ot({},"__esModule",{value:!0}),n);var us={};We(us,{AuthError:()=>at,ConflictError:()=>pt,ForbiddenError:()=>ct,HttpClient:()=>F,JobPoller:()=>G,LimaiClient:()=>Ot,LimaiError:()=>R,NotFoundError:()=>lt,RateLimitError:()=>ut,SSEClient:()=>Mt,ServerError:()=>dt,TimeoutError:()=>j,UploadError:()=>k,ValidationError:()=>x,collectAll:()=>Rt,getDeploymentId:()=>ke,getFileId:()=>Ae,getJobId:()=>xe,loadConfig:()=>Vt,loadJobContext:()=>it,mapHttpError:()=>Wt,paginateOffset:()=>le,paginatePage:()=>bt,requireConfig:()=>we,saveConfig:()=>Ce,validateSubmission:()=>De});module.exports=Be(us);var oe=require("fs"),ae=require("fs/promises"),ce=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(t,e){super(t),this.name="LimaiError",this.code=e.code,this.statusCode=e.statusCode,this.exitCode=e.exitCode??1,this.details=e.details}},at=class extends R{constructor(t,e){super(t,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:e}),this.name="AuthError"}},ct=class extends R{constructor(t,e){super(t,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:e}),this.name="ForbiddenError"}},lt=class extends R{constructor(t,e){super(t,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:e}),this.name="NotFoundError"}},x=class extends R{constructor(t,e){super(t,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:e}),this.name="ValidationError"}},pt=class extends R{constructor(t,e){super(t,{code:"CONFLICT",statusCode:409,exitCode:4,details:e}),this.name="ConflictError"}},ut=class extends R{retryAfterMs;constructor(t,e){super(t,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=e}},dt=class extends R{constructor(t,e=500,s){super(t,{code:"SERVER_ERROR",statusCode:e,exitCode:6,details:s}),this.name="ServerError"}},j=class extends R{constructor(t){super(t,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},k=class extends R{constructor(t,e){super(t,{code:"UPLOAD_ERROR",exitCode:8,details:e}),this.name="UploadError"}};function Wt(n,t,e){switch(n){case 400:return new x(t,e);case 401:return new at(t,e);case 403:return new ct(t,e);case 404:return new lt(t,e);case 409:return new pt(t,e);case 429:return new ut(t);default:return n>=500?new dt(t,n,e):new R(t,{code:"HTTP_ERROR",statusCode:n,details:e})}}var He=3e4,Bt=3,re=1e3,ie=2;function Ge(){return process.env.LIMAI_DEBUG==="1"}function Q(...n){Ge()&&console.error("[limai:http]",...n)}var F=class{baseUrl;token;constructor(t){this.baseUrl=t.apiUrl.replace(/\/$/,""),this.token=t.token}buildUrl(t,e){let s=new URL(`/api/v1${t}`,this.baseUrl);if(e)for(let[r,i]of Object.entries(e))i!=null&&s.searchParams.set(r,i);return s.toString()}authHeaders(){let t={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},e=process.env.VERCEL_BYPASS;return e&&(t["x-vercel-protection-bypass"]=e),t}async parseErrorBody(t){try{let e=await t.json();return{message:typeof e.error=="string"?e.error:typeof e.message=="string"?e.message:`HTTP ${t.status}`,details:e.details}}catch{return{message:await t.text().catch(()=>"")||`HTTP ${t.status}`}}}shouldRetry(t){return t===429||t>=500}getRetryDelay(t,e){let s=t.headers.get("Retry-After");if(s){let r=parseInt(s,10);if(!isNaN(r))return r*1e3}return re*Math.pow(ie,e)}async request(t,e,s={}){let r=this.buildUrl(e,s.params),i=s.timeoutMs??He;for(let a=0;a<=Bt;a++){let p=new AbortController,u=setTimeout(()=>p.abort(),i);s.signal&&s.signal.addEventListener("abort",()=>p.abort());try{Q(`${t} ${r}${a>0?` (retry ${a})`:""}`);let c=await fetch(r,{method:t,headers:this.authHeaders(),body:s.body?JSON.stringify(s.body):void 0,signal:p.signal});if(clearTimeout(u),c.ok){let m=await c.text();return m?JSON.parse(m):{}}if(s.retry!==!1&&this.shouldRetry(c.status)&&a<Bt){let m=this.getRetryDelay(c,a);Q(`Retrying in ${m}ms (status ${c.status})`),await new Promise(E=>setTimeout(E,m));continue}let{message:g,details:y}=await this.parseErrorBody(c);throw Wt(c.status,g,y)}catch(c){if(clearTimeout(u),c instanceof R)throw c;if(c instanceof DOMException&&c.name==="AbortError"){if(s.retry!==!1&&a<Bt){let g=re*Math.pow(ie,a);Q(`Timeout, retrying in ${g}ms`),await new Promise(y=>setTimeout(y,g));continue}throw new j(`Request timed out after ${i}ms: ${t} ${e}`)}throw new R(c instanceof Error?c.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(t,e,s){return this.request("GET",t,{params:e,timeoutMs:s})}async post(t,e,s,r){return this.request("POST",t,{body:e,timeoutMs:s,retry:r?.retry})}async patch(t,e,s){return this.request("PATCH",t,{body:e,retry:s?.retry})}async del(t,e){return this.request("DELETE",t,{body:e})}async putRaw(t,e,s,r){let i=e instanceof Blob?e.size:e.length;Q(`PUT ${t} (${i} bytes)`);let a=await fetch(t,{method:"PUT",headers:{"Content-Type":s},body:e});if(r&&r(i,i),!a.ok)throw new k(`Upload failed: HTTP ${a.status}`)}async putFile(t,e,s,r){let i=(await(0,ae.stat)(e)).size;Q(`PUT ${t} (${i} bytes, streamed from ${e})`);let a=(0,oe.createReadStream)(e),p=a;if(r){let c=0,g=new ce.Transform({transform(y,m,E){c+=y.byteLength,r(c,i),E(null,y)}});p=a.pipe(g)}let u=await fetch(t,{method:"PUT",headers:{"Content-Type":s,"Content-Length":String(i)},body:p,duplex:"half"});if(r&&r(i,i),!u.ok)throw new k(`Upload failed: HTTP ${u.status}`);return i}};var gt=class{constructor(t){this.http=t}http;async getUploadUrl(t,e,s){let r={filename:e,contentHash:s};return this.http.get(`/document/${t}/get-url`,r)}async processSync(t,e,s){return this.http.post(`/document/${t}/process-file/${e}`,s,18e4)}async processAsync(t,e,s){return this.http.post(`/document/${t}/process-file-async/${e}`,s)}async processFilesAsync(t,e,s){return this.http.post(`/document/${t}/process-files-async`,{fileIds:e,...s})}async getFileData(t,e,s){let r={fileId:t,extractionSchemaId:e,include:s?.length?s.join(","):void 0};return this.http.get("/document/get-file-data",r)}async getFilesData(t,e){return this.http.post("/document/get-files-data",{fileIds:t,...e?.length?{include:e}:{}})}async getDocumentData(t,e,s){let r={include:s?.length?s.join(","):void 0};return this.http.get(`/deployments/${t}/documents/${e}/data`,r)}async getDocumentsData(t,e,s){return this.http.post(`/deployments/${t}/documents/data`,{fileIds:e,...s?.length?{include:s}:{}})}async submitCorrections(t,e,s){return this.http.post(`/document/${t}/process-file/${e}/submit-corrections`,s)}};var mt=class{constructor(t){this.http=t}http;async list(){let t=await this.http.get("/projects");return Array.isArray(t)?t:t.data}async create(t){return this.http.post("/projects",t)}async delete(t){return this.http.del(`/projects/${t}`)}async getSharedColumnIds(t){return this.http.get(`/projects/${t}/shared-column-ids`)}async listDeployments(t){return this.http.get(`/projects/${t}/deployments`)}async listBenchmarks(t){return this.http.get(`/projects/${t}/benchmarks`)}async listNotificationRoutes(t){return this.http.get(`/projects/${t}/notifications`)}async createNotificationRoute(t,e){return this.http.post(`/projects/${t}/notifications`,e)}async updateNotificationRoute(t,e,s){return this.http.patch(`/projects/${t}/notifications/${e}`,s)}async deleteNotificationRoute(t,e){return this.http.del(`/projects/${t}/notifications/${e}`)}async listNotificationIntegrations(t,e){return this.http.get(`/projects/${t}/notifications/integrations`,{provider:e})}async listNotificationSlackChannels(t,e){return this.http.get(`/projects/${t}/notifications/integrations/slack/channels`,{connectionId:e})}async listNotificationTeamsTeams(t,e){return this.http.get(`/projects/${t}/notifications/integrations/teams/teams`,{connectionId:e})}async listNotificationTeamsChannels(t,e,s){return this.http.get(`/projects/${t}/notifications/integrations/teams/channels`,{connectionId:e,teamId:s})}};var ht=class{constructor(t){this.http=t}http;async list(t,e){let s={status:e?.status,type:e?.type},r=await this.http.get(`/projects/${t}/deployments`,s);return Array.isArray(r)?r:r.data}async create(t,e){return this.http.post(`/projects/${t}/deployments`,e)}async getConfig(t){return this.http.get(`/deployments/${t}/configuration`)}async updateConfig(t,e){await this.http.patch(`/deployment/${t}/configuration`,e)}async listDocuments(t,e){let s={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/deployments/${t}/documents`,s)}async getDocument(t,e){return this.http.get(`/deployments/${t}/documents/${e}`)}async deleteDocument(t,e){await this.http.del(`/deployments/${t}/documents/${e}`)}async bulkDelete(t,e){await this.http.del(`/deployments/${t}/documents/bulk-delete`,{fileIds:e})}};var ft=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/tables/${t}`)}async listColumns(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async listRows(t,e){let s={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/tables/${t}/rows`,s)}async createRows(t,e){return this.http.post(`/tables/${t}/rows`,e,6e4)}async deleteRows(t,e){return this.http.del(`/tables/${t}/rows`,e)}async createTable(t,e){return this.http.post(`/deployments/${t}/tables`,e)}async update(t,e){return this.http.patch(`/tables/${t}`,e)}};var yt=class{constructor(t){this.http=t}http;async list(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async get(t){return this.http.get(`/columns/${t}`)}async create(t,e){let s=await this.http.post(`/tables/${t}/columns`,e);return s&&typeof s=="object"&&"data"in s?s.data:[s]}async update(t,e){return this.http.patch(`/columns/${t}`,e)}};async function*le(n,t={}){let e=Math.min(t.pageSize??100,500),s=0,r=0;for(;;){let i=t.maxItems?Math.min(e,t.maxItems-r):e;if(i<=0)break;let a=await n(i,s),p=a.data;if(p.length===0||(yield p,r+=p.length,s+=p.length,s>=a.pagination.total)||t.maxItems&&r>=t.maxItems)break}}async function*bt(n,t={}){let e=Math.min(t.pageSize??100,500),s=1,r=0;for(;;){let i=t.maxItems?Math.min(e,t.maxItems-r):e;if(i<=0)break;let a=await n(s,i),p=a.data;if(p.length===0||(yield p,r+=p.length,s++,s>a.pagination.totalPages)||t.maxItems&&r>=t.maxItems)break}}async function Rt(n){let t=[];for await(let e of n)t.push(...e);return t}var Ct=class{constructor(t){this.http=t}http;async getRows(t,e){let s={page:e?.page?.toString(),limit:e?.limit?.toString(),order:e?.order,status:e?.status};return this.http.get(`/extractions/${t}`,s)}async*getAllRows(t,e){yield*bt(async(s,r)=>this.http.get(`/extractions/${t}`,{page:s.toString(),limit:r.toString(),order:e?.order,status:e?.status}),e)}async collectAllRows(t,e){return Rt(this.getAllRows(t,e))}};var wt=class{constructor(t){this.http=t}http;async getStatus(t){return this.http.get(`/queue/${t}/status`)}async cancel(t){await this.http.post("/queue/cancel",{jobId:t})}async updateStatus(t,e){return this.http.patch(`/queue/${t}/status`,e)}};var St=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/classify",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/classify/${t}/get-url`,{filename:e})}async classify(t,e){return this.http.post(`/classify/${t}`,{fileId:e})}async classifyAsync(t,e){return this.http.post(`/classify/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/classify/${t}`,{classificationId:e})}async createClassifier(t){return this.http.post("/classify",t)}async createRoute(t,e){return this.http.post(`/classify/${t}/routes`,e)}};var vt=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/split",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/split/${t}/get-url`,{filename:e})}async split(t,e){return this.http.post(`/split/${t}`,{fileId:e})}async splitAsync(t,e){return this.http.post(`/split/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/split/${t}`,{splitId:e})}async listSplits(t){return this.http.get(`/split/${t}/splits`)}async createSplitter(t){return this.http.post("/split",t)}};var Et=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/deployments/${t}/configuration`)}async update(t,e){return this.http.patch(`/deployments/${t}/configuration`,e)}async getAllData(t){return this.http.get(`/deployments/${t}/all-data`)}};var It=class{constructor(t){this.http=t}http;async list(t){return this.http.get(`/projects/${t}/buckets`)}async get(t){return this.http.get(`/buckets/${t}`)}async create(t,e,s){return this.http.post(`/projects/${t}/buckets`,{name:e,description:s})}async delete(t){await this.http.del(`/buckets/${t}`)}async getUploadUrl(t,e){return this.http.get(`/buckets/${t}/get-url`,{filename:e})}async confirmUpload(t,e,s){await this.http.patch(`/buckets/${t}/files/${e}/status`,{status:"UPLOADED",...s!==void 0&&{sizeBytes:s}})}async listFiles(t,e){let s={};return e&&e.length>0&&(s.labels=e.join(",")),this.http.get(`/buckets/${t}/files`,s)}async getDownloadUrl(t,e){return this.http.get(`/buckets/${t}/files/${e}/download`)}async updateLabels(t,e,s){return this.http.patch(`/buckets/${t}/files/${e}`,{labels:s})}async deleteFile(t,e){await this.http.del(`/buckets/${t}/files/${e}`)}async sendTo(t,e,s,r){return this.http.post(`/buckets/${t}/files/${e}/send-to`,{targetType:s,targetId:r})}};var Pt=class{constructor(t){this.http=t}http;async list(t,e){let s={};return e?.status&&(s.status=e.status),this.http.get(`/projects/${t}/agents`,s)}async get(t,e){return this.http.get(`/projects/${t}/agents/${e}`)}async create(t,e){return this.http.post(`/projects/${t}/agents`,e)}async update(t,e,s){return this.http.patch(`/projects/${t}/agents/${e}`,s)}async delete(t,e){await this.http.del(`/projects/${t}/agents/${e}`)}async getFileUploadUrl(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/files/get-url`,{filename:s})}async deleteFile(t,e,s){await this.http.del(`/projects/${t}/agents/${e}/files/${s}`)}async updateFileMetadata(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/files/${s}`,r)}async getFileDownloadUrl(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/files/${s}/download`)}async listSkills(t,e){return this.http.get(`/projects/${t}/agents/${e}/skills`)}async createSkill(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/skills`,s)}async updateSkill(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/skills/${s}`,r)}async deleteSkill(t,e,s){await this.http.del(`/projects/${t}/agents/${e}/skills/${s}`)}async linkFileToSkill(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/skills/${s}/files`,{fileId:r})}async unlinkFileFromSkill(t,e,s,r){await this.http.del(`/projects/${t}/agents/${e}/skills/${s}/files/${r}`)}async listRuns(t,e,s){let r={};return s?.limit&&(r.limit=String(s.limit)),s?.status&&(r.status=s.status),this.http.get(`/projects/${t}/agents/${e}/runs`,r)}async getRun(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/runs/${s}`)}async getRunConversation(t,e,s,r){let i={};return r?.stepId&&(i.stepId=r.stepId),this.http.get(`/projects/${t}/agents/${e}/runs/${s}/conversation`,i)}async getRunInferenceLogs(t,e,s,r){let i={};return r?.limit!==void 0&&(i.limit=String(r.limit)),r?.status&&(i.status=r.status),this.http.get(`/projects/${t}/agents/${e}/runs/${s}/inference-logs`,i)}async createRun(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/runs`,s)}async createStep(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps`,r)}async createSteps(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps`,{steps:r})}async updateRun(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}`,r)}async updateStep(t,e,s,r,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}`,i)}async updateStepConditions(t,e,s,r,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}`,{conditions:i})}async pauseRun(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/pause`,{})}async submitStepAction(t,e,s,r,i){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}/action`,i)}async sendEmail(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/send-email`,s)}async completeExecution(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/executions/complete`,s)}async getSharePointToken(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/sharepoint-token`,s)}async getArtifactUploadUrl(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/upload-artifact/get-url`,s)}};var Tt=class{constructor(t){this.http=t}http;async ask(t,e){return this.http.post(`/projects/${t}/vision/ask`,e,12e4)}};var $t=class{constructor(t){this.http=t}http;async submit(t,e,s){return this.http.post(`/document/${t}/process-file/${e}/submit-validation`,s)}async listScripts(t){return(await this.http.get(`/deployments/${t}/validation-scripts`)).scripts}async getScript(t,e,s){return(await this.http.get(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`,s?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(t,e){return this.http.post(`/deployments/${t}/validation-scripts`,e)}async updateScript(t,e,s){return(await this.http.patch(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`,s)).script}async deleteScript(t,e){return this.http.del(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`)}};var xt=class{constructor(t){this.http=t}http;async list(t,e){let s={};return e?.entityType&&(s.entityType=e.entityType),this.http.get(`/projects/${t}/labels`,s)}async addRemove(t,e,s,r,i){return this.http.post(`/projects/${t}/labels`,{entityType:e,entityId:s,add:r,remove:i})}async search(t,e){let s={};return e?.entityType&&(s.entityType=e.entityType),e?.labels&&(s.labels=e.labels),e?.key&&(s.key=e.key),this.http.get(`/projects/${t}/labels/search`,s)}};var At=class{constructor(t){this.http=t}http;basePath(t){return`/projects/${t}/webhooks`}async list(t){return this.http.get(this.basePath(t))}async get(t,e){return this.http.get(`${this.basePath(t)}/${e}`)}async create(t,e){return this.http.post(this.basePath(t),e,void 0,{retry:!1})}async update(t,e,s){return this.http.patch(`${this.basePath(t)}/${e}`,s,{retry:!1})}async delete(t,e){await this.http.del(`${this.basePath(t)}/${e}`)}async pause(t,e){return this.http.post(`${this.basePath(t)}/${e}/pause`)}async resume(t,e){return this.http.post(`${this.basePath(t)}/${e}/resume`)}async verify(t,e){return this.http.post(`${this.basePath(t)}/${e}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(t,e){return this.http.post(`${this.basePath(t)}/${e}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(t,e,s){let r={};return s?.status&&(r.status=s.status),s?.eventType&&(r.eventType=s.eventType),s?.deploymentId&&(r.deploymentId=s.deploymentId),s?.agentId&&(r.agentId=s.agentId),s?.classifierId&&(r.classifierId=s.classifierId),s?.splitterId&&(r.splitterId=s.splitterId),s?.limit!==void 0&&(r.limit=String(s.limit)),s?.offset!==void 0&&(r.offset=String(s.offset)),this.http.get(`${this.basePath(t)}/${e}/deliveries`,r)}async metrics(t,e,s){let r={};return s?.window&&(r.window=s.window),s?.bucket&&(r.bucket=s.bucket),this.http.get(`${this.basePath(t)}/${e}/metrics`,r)}async retry(t,e,s){return this.http.post(`${this.basePath(t)}/${e}/retry`,{eventIds:s})}};var kt=P(require("fs")),W=P(require("path"));var pe=P(require("fs")),ue=P(require("crypto"));async function de(n){return new Promise((t,e)=>{let s=ue.createHash("sha256"),r=pe.createReadStream(n);r.on("data",i=>s.update(i)),r.on("end",()=>t(s.digest("hex"))),r.on("error",e)})}var Ve={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Je(n){let t=W.extname(n).toLowerCase();return Ve[t]||"application/octet-stream"}async function Dt(n,t,e,s,r){let i=W.resolve(s),a=W.basename(i);if(!kt.existsSync(i))throw new k(`File not found: ${i}`);if(!kt.statSync(i).isFile())throw new k(`Not a file: ${i}`);let u=await de(i),c=await t.getUploadUrl(e,a,u);if(c.isDuplicate)return{fileId:c.fileId,filename:c.fileName??a,isDuplicate:!0,bytesUploaded:0};let g=Je(i),y=await n.putFile(c.url,i,g,r);return{fileId:c.fileId,filename:c.fileName??a,isDuplicate:!1,bytesUploaded:y}}var B=P(require("fs")),H=P(require("path"));var me=P(require("path"));var ge=250,qe=5,Ht=class{constructor(t){this.max=t}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(t=>{this.queue.push(t)})}release(){this.current--;let t=this.queue.shift();t&&(this.current++,t())}};async function he(n,t,e,s,r){let i=Math.min(r?.concurrency??qe,10),a=new Ht(i),p=s.map(m=>({path:m,filename:me.basename(m),status:"pending"})),u=p.map(async(m,E)=>{await a.acquire();try{m.status="uploading",r?.onFileStatus?.(m);let f=await Dt(n,t,e,m.path);m.fileId=f.fileId,m.status="uploaded",r?.onFileStatus?.(m)}catch(f){m.status="failed",m.error=f instanceof Error?f.message:String(f),r?.onFileStatus?.(m)}finally{a.release()}});if(await Promise.all(u),r?.process){let E=p.filter(f=>f.status==="uploaded"&&f.fileId).map(f=>f.fileId);for(let f=0;f<E.length;f+=ge){let A=E.slice(f,f+ge);try{let $=await t.processFilesAsync(e,A,r.processOptions);for(let[l,o]of Object.entries($.results)){let d=p.find(w=>w.fileId===l);d&&(o.status==="queued"?(d.status="queued",d.jobId=o.jobId):(d.status="failed",d.error=o.error),r?.onFileStatus?.(d))}}catch($){for(let l of A){let o=p.find(d=>d.fileId===l);o&&(o.status="failed",o.error=$ instanceof Error?$.message:String($),r?.onFileStatus?.(o))}}}}let c=p.filter(m=>m.status==="uploaded"||m.status==="queued").length,g=p.filter(m=>m.status==="queued").length,y=p.filter(m=>m.status==="failed").length;return{total:s.length,uploaded:c,queued:g,failed:y,files:p}}var Ke=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function fe(n,t){let e=[],s=B.readdirSync(n,{withFileTypes:!0});for(let r of s){let i=H.join(n,r.name);if(!r.name.startsWith(".")){if(r.isDirectory())e.push(...fe(i,t));else if(r.isFile()){let a=H.extname(r.name).toLowerCase();if(!Ke.has(a)||t&&!ze(r.name,t))continue;e.push(i)}}}return e.sort()}function ze(n,t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${e}$`,"i").test(n)}async function ye(n,t,e,s,r){let i=H.resolve(s);if(!B.existsSync(i))throw new Error(`Directory not found: ${i}`);if(!B.statSync(i).isDirectory())throw new Error(`Not a directory: ${i}`);let p=fe(i,r?.globPattern);return p.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:he(n,t,e,p,{concurrency:r?.concurrency,process:r?.process,processOptions:r?.processOptions,onFileStatus:r?.onFileStatus})}var Xe=1e3,Ye=1e4,Qe=1.5,Ze=3e5,ts=["COMPLETED","FAILED","STALLED"],G=class{constructor(t){this.queue=t}queue;async*poll(t,e){let s=e?.intervalMs??Xe,r=e?.maxIntervalMs??Ye,i=e?.backoffMultiplier??Qe,a=e?.timeoutMs??Ze,p=s,u=Date.now(),c;for(;;){if(Date.now()-u>a)throw new j(`Polling timed out after ${Math.round(a/1e3)}s for job ${t}`);let g=await this.queue.getStatus(t);if(g.status!==c&&(c=g.status,e?.onStatus?.(g),yield g),ts.includes(g.status))return;await new Promise(y=>setTimeout(y,p)),p=Math.min(p*i,r)}}async waitForCompletion(t,e){let s;for await(let r of this.poll(t,e))s=r;if(!s)throw new Error(`No status received for job ${t}`);return s}};var Ot=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(t){this.http=new F({apiUrl:t.apiUrl,token:t.token}),this.documents=new gt(this.http),this.projects=new mt(this.http),this.deployments=new ht(this.http),this.tables=new ft(this.http),this.columns=new yt(this.http),this.extractions=new Ct(this.http),this.queue=new wt(this.http),this.classify=new St(this.http),this.split=new vt(this.http),this.schema=new Et(this.http),this.buckets=new It(this.http),this.agents=new Pt(this.http),this.vision=new Tt(this.http),this.validations=new $t(this.http),this.labels=new xt(this.http),this.webhooks=new At(this.http)}async uploadFile(t,e,s){return Dt(this.http,this.documents,t,e,s)}async uploadFolder(t,e,s){return ye(this.http,this.documents,t,e,s)}async processAndWait(t,e,s){let r=await this.documents.processAsync(t,e,s?.processOptions),i=new G(this.queue),a;for await(let p of i.poll(r.jobId,s?.pollOptions))a=p;if(!a||a.status==="FAILED")throw new Error(`Extraction failed for file ${e}${a?`: ${a.status}`:""}`);return this.documents.getFileData(e,t)}async*downloadAll(t,e){yield*this.extractions.getAllRows(t,e)}};var v=P(require("fs")),J=P(require("path")),be=P(require("os")),Ut=require("child_process"),Gt=J.join(be.homedir(),".limai"),Z=J.join(Gt,"config.json"),es=".limai.token",V;function ss(n){if(!v.existsSync(n))return{};let t={};for(let e of v.readFileSync(n,"utf-8").split(/\r?\n/)){let s=e.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);s&&(t[s[1]]=s[2].replace(/^(["'])(.*)\1$/,"$2"))}return t}function Re(){if(V!==void 0)return V;try{let n=(0,Ut.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!v.existsSync(J.join(n,"packages","cli")))return V=null,null;let t=(0,Ut.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),e="";if(t!==".git"){let r=(0,Ut.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(r){let i=r.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");i&&(e=`${i}.`)}}let s=ss(J.join(n,"tables",".env.local"));return V={root:n,apiUrl:s.NEXT_PUBLIC_BASE_URL??`https://${e}tables.localhost`,sseUrl:s.NEXT_PUBLIC_SSE_URL??`https://${e}ws.localhost`},V}catch{return V=null,null}}function ns(){let n=Re();if(!n)return;let t=J.join(n.root,es);if(v.existsSync(t))return v.readFileSync(t,"utf-8").trim()}function Vt(){let n=process.env.LIMAI_API_TOKEN,t=process.env.LIMAI_API_URL,e=process.env.LIMAI_SSE_URL,s={};if(v.existsSync(Z))try{let u=v.readFileSync(Z,"utf-8"),c=JSON.parse(u);c&&typeof c=="object"&&!Array.isArray(c)&&(s=c)}catch{s={}}let r=Re(),i=n||ns()||s.token,a=t||s.apiUrl||r?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,p=e||s.sseUrl||r?.sseUrl||void 0;return!i||!a?null:{token:i,apiUrl:a,sseUrl:p,defaultProjectId:s.defaultProjectId,defaultDeploymentId:s.defaultDeploymentId}}function Ce(n){let t={};if(v.existsSync(Z))try{let s=v.readFileSync(Z,"utf-8");t=JSON.parse(s)}catch{t={}}let e={...t,...n};v.existsSync(Gt)||v.mkdirSync(Gt,{recursive:!0,mode:448}),v.writeFileSync(Z,JSON.stringify(e,null,2),{mode:384})}function we(){let n=Vt();return n||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),n}var jt=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}},Se=10,rs=13,_=32;function Jt(n){}function Ie(n){if(typeof n=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=Jt,onError:e=Jt,onRetry:s=Jt,onComment:r}=n,i=[],a=!0,p,u="",c=0,g;function y(l){if(a&&(a=!1,l.charCodeAt(0)===239&&l.charCodeAt(1)===187&&l.charCodeAt(2)===191&&(l=l.slice(3))),i.length===0){let w=m(l);w!==""&&i.push(w);return}if(l.indexOf(`
|
|
1
|
+
"use strict";var _e=Object.create;var ot=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var We=(n,t)=>{for(var e in t)ot(n,e,{get:t[e],enumerable:!0})},ne=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ne(t))!Fe.call(n,r)&&r!==e&&ot(n,r,{get:()=>t[r],enumerable:!(s=Le(t,r))||s.enumerable});return n};var P=(n,t,e)=>(e=n!=null?_e(Me(n)):{},ne(t||!n||!n.__esModule?ot(e,"default",{value:n,enumerable:!0}):e,n)),Be=n=>ne(ot({},"__esModule",{value:!0}),n);var us={};We(us,{AuthError:()=>at,ConflictError:()=>pt,ForbiddenError:()=>ct,HttpClient:()=>F,JobPoller:()=>G,LimaiClient:()=>Ot,LimaiError:()=>R,NotFoundError:()=>lt,RateLimitError:()=>ut,SSEClient:()=>Mt,ServerError:()=>dt,TimeoutError:()=>j,UploadError:()=>k,ValidationError:()=>x,collectAll:()=>Rt,getDeploymentId:()=>ke,getFileId:()=>Ae,getJobId:()=>xe,loadConfig:()=>Vt,loadJobContext:()=>it,mapHttpError:()=>Wt,paginateOffset:()=>le,paginatePage:()=>bt,requireConfig:()=>we,saveConfig:()=>Ce,validateSubmission:()=>De});module.exports=Be(us);var oe=require("fs"),ae=require("fs/promises"),ce=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(t,e){super(t),this.name="LimaiError",this.code=e.code,this.statusCode=e.statusCode,this.exitCode=e.exitCode??1,this.details=e.details}},at=class extends R{constructor(t,e){super(t,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:e}),this.name="AuthError"}},ct=class extends R{constructor(t,e){super(t,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:e}),this.name="ForbiddenError"}},lt=class extends R{constructor(t,e){super(t,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:e}),this.name="NotFoundError"}},x=class extends R{constructor(t,e){super(t,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:e}),this.name="ValidationError"}},pt=class extends R{constructor(t,e){super(t,{code:"CONFLICT",statusCode:409,exitCode:4,details:e}),this.name="ConflictError"}},ut=class extends R{retryAfterMs;constructor(t,e){super(t,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=e}},dt=class extends R{constructor(t,e=500,s){super(t,{code:"SERVER_ERROR",statusCode:e,exitCode:6,details:s}),this.name="ServerError"}},j=class extends R{constructor(t){super(t,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},k=class extends R{constructor(t,e){super(t,{code:"UPLOAD_ERROR",exitCode:8,details:e}),this.name="UploadError"}};function Wt(n,t,e){switch(n){case 400:return new x(t,e);case 401:return new at(t,e);case 403:return new ct(t,e);case 404:return new lt(t,e);case 409:return new pt(t,e);case 429:return new ut(t);default:return n>=500?new dt(t,n,e):new R(t,{code:"HTTP_ERROR",statusCode:n,details:e})}}var He=3e4,Bt=3,re=1e3,ie=2;function Ge(){return process.env.LIMAI_DEBUG==="1"}function Q(...n){Ge()&&console.error("[limai:http]",...n)}var F=class{baseUrl;token;constructor(t){this.baseUrl=t.apiUrl.replace(/\/$/,""),this.token=t.token}buildUrl(t,e){let s=new URL(`/api/v1${t}`,this.baseUrl);if(e)for(let[r,i]of Object.entries(e))i!=null&&s.searchParams.set(r,i);return s.toString()}authHeaders(){let t={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},e=process.env.VERCEL_BYPASS;return e&&(t["x-vercel-protection-bypass"]=e),t}async parseErrorBody(t){try{let e=await t.json();return{message:typeof e.error=="string"?e.error:typeof e.message=="string"?e.message:`HTTP ${t.status}`,details:e.details}}catch{return{message:await t.text().catch(()=>"")||`HTTP ${t.status}`}}}shouldRetry(t){return t===429||t>=500}getRetryDelay(t,e){let s=t.headers.get("Retry-After");if(s){let r=parseInt(s,10);if(!isNaN(r))return r*1e3}return re*Math.pow(ie,e)}async request(t,e,s={}){let r=this.buildUrl(e,s.params),i=s.timeoutMs??He;for(let a=0;a<=Bt;a++){let p=new AbortController,u=setTimeout(()=>p.abort(),i);s.signal&&s.signal.addEventListener("abort",()=>p.abort());try{Q(`${t} ${r}${a>0?` (retry ${a})`:""}`);let c=await fetch(r,{method:t,headers:this.authHeaders(),body:s.body?JSON.stringify(s.body):void 0,signal:p.signal});if(clearTimeout(u),c.ok){let m=await c.text();return m?JSON.parse(m):{}}if(s.retry!==!1&&this.shouldRetry(c.status)&&a<Bt){let m=this.getRetryDelay(c,a);Q(`Retrying in ${m}ms (status ${c.status})`),await new Promise(E=>setTimeout(E,m));continue}let{message:g,details:y}=await this.parseErrorBody(c);throw Wt(c.status,g,y)}catch(c){if(clearTimeout(u),c instanceof R)throw c;if(c instanceof DOMException&&c.name==="AbortError"){if(s.retry!==!1&&a<Bt){let g=re*Math.pow(ie,a);Q(`Timeout, retrying in ${g}ms`),await new Promise(y=>setTimeout(y,g));continue}throw new j(`Request timed out after ${i}ms: ${t} ${e}`)}throw new R(c instanceof Error?c.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(t,e,s){return this.request("GET",t,{params:e,timeoutMs:s})}async post(t,e,s,r){return this.request("POST",t,{body:e,timeoutMs:s,retry:r?.retry})}async patch(t,e,s){return this.request("PATCH",t,{body:e,retry:s?.retry})}async del(t,e){return this.request("DELETE",t,{body:e})}async putRaw(t,e,s,r){let i=e instanceof Blob?e.size:e.length;Q(`PUT ${t} (${i} bytes)`);let a=await fetch(t,{method:"PUT",headers:{"Content-Type":s},body:e});if(r&&r(i,i),!a.ok)throw new k(`Upload failed: HTTP ${a.status}`)}async putFile(t,e,s,r){let i=(await(0,ae.stat)(e)).size;Q(`PUT ${t} (${i} bytes, streamed from ${e})`);let a=(0,oe.createReadStream)(e),p=a;if(r){let c=0,g=new ce.Transform({transform(y,m,E){c+=y.byteLength,r(c,i),E(null,y)}});p=a.pipe(g)}let u=await fetch(t,{method:"PUT",headers:{"Content-Type":s,"Content-Length":String(i)},body:p,duplex:"half"});if(r&&r(i,i),!u.ok)throw new k(`Upload failed: HTTP ${u.status}`);return i}};var gt=class{constructor(t){this.http=t}http;async getUploadUrl(t,e,s){let r={filename:e,contentHash:s};return this.http.get(`/document/${t}/get-url`,r)}async processSync(t,e,s){return this.http.post(`/document/${t}/process-file/${e}`,s,18e4)}async processAsync(t,e,s){return this.http.post(`/document/${t}/process-file-async/${e}`,s)}async processFilesAsync(t,e,s){return this.http.post(`/document/${t}/process-files-async`,{fileIds:e,...s})}async getFileData(t,e,s,r){let i={fileId:t,extractionSchemaId:e,jobId:r,include:s?.length?s.join(","):void 0};return this.http.get("/document/get-file-data",i)}async getFilesData(t,e){return this.http.post("/document/get-files-data",{fileIds:t,...e?.length?{include:e}:{}})}async getDocumentData(t,e,s){let r={include:s?.length?s.join(","):void 0};return this.http.get(`/deployments/${t}/documents/${e}/data`,r)}async getDocumentsData(t,e,s){return this.http.post(`/deployments/${t}/documents/data`,{fileIds:e,...s?.length?{include:s}:{}})}async submitCorrections(t,e,s){return this.http.post(`/document/${t}/process-file/${e}/submit-corrections`,s)}};var mt=class{constructor(t){this.http=t}http;async list(){let t=await this.http.get("/projects");return Array.isArray(t)?t:t.data}async create(t){return this.http.post("/projects",t)}async delete(t){return this.http.del(`/projects/${t}`)}async getSharedColumnIds(t){return this.http.get(`/projects/${t}/shared-column-ids`)}async listDeployments(t){return this.http.get(`/projects/${t}/deployments`)}async listBenchmarks(t){return this.http.get(`/projects/${t}/benchmarks`)}async listNotificationRoutes(t){return this.http.get(`/projects/${t}/notifications`)}async createNotificationRoute(t,e){return this.http.post(`/projects/${t}/notifications`,e)}async updateNotificationRoute(t,e,s){return this.http.patch(`/projects/${t}/notifications/${e}`,s)}async deleteNotificationRoute(t,e){return this.http.del(`/projects/${t}/notifications/${e}`)}async listNotificationIntegrations(t,e){return this.http.get(`/projects/${t}/notifications/integrations`,{provider:e})}async listNotificationSlackChannels(t,e){return this.http.get(`/projects/${t}/notifications/integrations/slack/channels`,{connectionId:e})}async listNotificationTeamsTeams(t,e){return this.http.get(`/projects/${t}/notifications/integrations/teams/teams`,{connectionId:e})}async listNotificationTeamsChannels(t,e,s){return this.http.get(`/projects/${t}/notifications/integrations/teams/channels`,{connectionId:e,teamId:s})}};var ht=class{constructor(t){this.http=t}http;async list(t,e){let s={status:e?.status,type:e?.type},r=await this.http.get(`/projects/${t}/deployments`,s);return Array.isArray(r)?r:r.data}async create(t,e){return this.http.post(`/projects/${t}/deployments`,e)}async getConfig(t){return this.http.get(`/deployments/${t}/configuration`)}async updateConfig(t,e){await this.http.patch(`/deployment/${t}/configuration`,e)}async listDocuments(t,e){let s={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/deployments/${t}/documents`,s)}async getDocument(t,e){return this.http.get(`/deployments/${t}/documents/${e}`)}async deleteDocument(t,e){await this.http.del(`/deployments/${t}/documents/${e}`)}async bulkDelete(t,e){await this.http.del(`/deployments/${t}/documents/bulk-delete`,{fileIds:e})}};var ft=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/tables/${t}`)}async listColumns(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async listRows(t,e){let s={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/tables/${t}/rows`,s)}async createRows(t,e){return this.http.post(`/tables/${t}/rows`,e,6e4)}async deleteRows(t,e){return this.http.del(`/tables/${t}/rows`,e)}async createTable(t,e){return this.http.post(`/deployments/${t}/tables`,e)}async update(t,e){return this.http.patch(`/tables/${t}`,e)}};var yt=class{constructor(t){this.http=t}http;async list(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async get(t){return this.http.get(`/columns/${t}`)}async create(t,e){let s=await this.http.post(`/tables/${t}/columns`,e);return s&&typeof s=="object"&&"data"in s?s.data:[s]}async update(t,e){return this.http.patch(`/columns/${t}`,e)}};async function*le(n,t={}){let e=Math.min(t.pageSize??100,500),s=0,r=0;for(;;){let i=t.maxItems?Math.min(e,t.maxItems-r):e;if(i<=0)break;let a=await n(i,s),p=a.data;if(p.length===0||(yield p,r+=p.length,s+=p.length,s>=a.pagination.total)||t.maxItems&&r>=t.maxItems)break}}async function*bt(n,t={}){let e=Math.min(t.pageSize??100,500),s=1,r=0;for(;;){let i=t.maxItems?Math.min(e,t.maxItems-r):e;if(i<=0)break;let a=await n(s,i),p=a.data;if(p.length===0||(yield p,r+=p.length,s++,s>a.pagination.totalPages)||t.maxItems&&r>=t.maxItems)break}}async function Rt(n){let t=[];for await(let e of n)t.push(...e);return t}var Ct=class{constructor(t){this.http=t}http;async getRows(t,e){let s={page:e?.page?.toString(),limit:e?.limit?.toString(),order:e?.order,status:e?.status};return this.http.get(`/extractions/${t}`,s)}async*getAllRows(t,e){yield*bt(async(s,r)=>this.http.get(`/extractions/${t}`,{page:s.toString(),limit:r.toString(),order:e?.order,status:e?.status}),e)}async collectAllRows(t,e){return Rt(this.getAllRows(t,e))}};var wt=class{constructor(t){this.http=t}http;async getStatus(t){return this.http.get(`/queue/${t}/status`)}async cancel(t){await this.http.post("/queue/cancel",{jobId:t})}async updateStatus(t,e){return this.http.patch(`/queue/${t}/status`,e)}};var St=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/classify",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/classify/${t}/get-url`,{filename:e})}async classify(t,e){return this.http.post(`/classify/${t}`,{fileId:e})}async classifyAsync(t,e){return this.http.post(`/classify/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/classify/${t}`,{classificationId:e})}async createClassifier(t){return this.http.post("/classify",t)}async createRoute(t,e){return this.http.post(`/classify/${t}/routes`,e)}};var vt=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/split",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/split/${t}/get-url`,{filename:e})}async split(t,e){return this.http.post(`/split/${t}`,{fileId:e})}async splitAsync(t,e){return this.http.post(`/split/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/split/${t}`,{splitId:e})}async listSplits(t){return this.http.get(`/split/${t}/splits`)}async createSplitter(t){return this.http.post("/split",t)}};var Et=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/deployments/${t}/configuration`)}async update(t,e){return this.http.patch(`/deployments/${t}/configuration`,e)}async getAllData(t){return this.http.get(`/deployments/${t}/all-data`)}};var It=class{constructor(t){this.http=t}http;async list(t){return this.http.get(`/projects/${t}/buckets`)}async get(t){return this.http.get(`/buckets/${t}`)}async create(t,e,s){return this.http.post(`/projects/${t}/buckets`,{name:e,description:s})}async delete(t){await this.http.del(`/buckets/${t}`)}async getUploadUrl(t,e){return this.http.get(`/buckets/${t}/get-url`,{filename:e})}async confirmUpload(t,e,s){await this.http.patch(`/buckets/${t}/files/${e}/status`,{status:"UPLOADED",...s!==void 0&&{sizeBytes:s}})}async listFiles(t,e){let s={};return e&&e.length>0&&(s.labels=e.join(",")),this.http.get(`/buckets/${t}/files`,s)}async getDownloadUrl(t,e){return this.http.get(`/buckets/${t}/files/${e}/download`)}async updateLabels(t,e,s){return this.http.patch(`/buckets/${t}/files/${e}`,{labels:s})}async deleteFile(t,e){await this.http.del(`/buckets/${t}/files/${e}`)}async sendTo(t,e,s,r){return this.http.post(`/buckets/${t}/files/${e}/send-to`,{targetType:s,targetId:r})}};var Pt=class{constructor(t){this.http=t}http;async list(t,e){let s={};return e?.status&&(s.status=e.status),this.http.get(`/projects/${t}/agents`,s)}async get(t,e){return this.http.get(`/projects/${t}/agents/${e}`)}async create(t,e){return this.http.post(`/projects/${t}/agents`,e)}async update(t,e,s){return this.http.patch(`/projects/${t}/agents/${e}`,s)}async delete(t,e){await this.http.del(`/projects/${t}/agents/${e}`)}async getFileUploadUrl(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/files/get-url`,{filename:s})}async deleteFile(t,e,s){await this.http.del(`/projects/${t}/agents/${e}/files/${s}`)}async updateFileMetadata(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/files/${s}`,r)}async getFileDownloadUrl(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/files/${s}/download`)}async listSkills(t,e){return this.http.get(`/projects/${t}/agents/${e}/skills`)}async createSkill(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/skills`,s)}async updateSkill(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/skills/${s}`,r)}async deleteSkill(t,e,s){await this.http.del(`/projects/${t}/agents/${e}/skills/${s}`)}async linkFileToSkill(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/skills/${s}/files`,{fileId:r})}async unlinkFileFromSkill(t,e,s,r){await this.http.del(`/projects/${t}/agents/${e}/skills/${s}/files/${r}`)}async listRuns(t,e,s){let r={};return s?.limit&&(r.limit=String(s.limit)),s?.status&&(r.status=s.status),this.http.get(`/projects/${t}/agents/${e}/runs`,r)}async getRun(t,e,s){return this.http.get(`/projects/${t}/agents/${e}/runs/${s}`)}async getRunConversation(t,e,s,r){let i={};return r?.stepId&&(i.stepId=r.stepId),this.http.get(`/projects/${t}/agents/${e}/runs/${s}/conversation`,i)}async getRunInferenceLogs(t,e,s,r){let i={};return r?.limit!==void 0&&(i.limit=String(r.limit)),r?.status&&(i.status=r.status),this.http.get(`/projects/${t}/agents/${e}/runs/${s}/inference-logs`,i)}async createRun(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/runs`,s)}async createStep(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps`,r)}async createSteps(t,e,s,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps`,{steps:r})}async updateRun(t,e,s,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}`,r)}async updateStep(t,e,s,r,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}`,i)}async updateStepConditions(t,e,s,r,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}`,{conditions:i})}async pauseRun(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/pause`,{})}async submitStepAction(t,e,s,r,i){return this.http.post(`/projects/${t}/agents/${e}/runs/${s}/steps/${r}/action`,i)}async sendEmail(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/send-email`,s)}async completeExecution(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/executions/complete`,s)}async getSharePointToken(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/sharepoint-token`,s)}async getArtifactUploadUrl(t,e,s){return this.http.post(`/projects/${t}/agents/${e}/upload-artifact/get-url`,s)}};var Tt=class{constructor(t){this.http=t}http;async ask(t,e){return this.http.post(`/projects/${t}/vision/ask`,e,12e4)}};var $t=class{constructor(t){this.http=t}http;async submit(t,e,s){return this.http.post(`/document/${t}/process-file/${e}/submit-validation`,s)}async listScripts(t){return(await this.http.get(`/deployments/${t}/validation-scripts`)).scripts}async getScript(t,e,s){return(await this.http.get(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`,s?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(t,e){return this.http.post(`/deployments/${t}/validation-scripts`,e)}async updateScript(t,e,s){return(await this.http.patch(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`,s)).script}async deleteScript(t,e){return this.http.del(`/deployments/${t}/validation-scripts/${encodeURIComponent(e)}`)}};var xt=class{constructor(t){this.http=t}http;async list(t,e){let s={};return e?.entityType&&(s.entityType=e.entityType),this.http.get(`/projects/${t}/labels`,s)}async addRemove(t,e,s,r,i){return this.http.post(`/projects/${t}/labels`,{entityType:e,entityId:s,add:r,remove:i})}async search(t,e){let s={};return e?.entityType&&(s.entityType=e.entityType),e?.labels&&(s.labels=e.labels),e?.key&&(s.key=e.key),this.http.get(`/projects/${t}/labels/search`,s)}};var At=class{constructor(t){this.http=t}http;basePath(t){return`/projects/${t}/webhooks`}async list(t){return this.http.get(this.basePath(t))}async get(t,e){return this.http.get(`${this.basePath(t)}/${e}`)}async create(t,e){return this.http.post(this.basePath(t),e,void 0,{retry:!1})}async update(t,e,s){return this.http.patch(`${this.basePath(t)}/${e}`,s,{retry:!1})}async delete(t,e){await this.http.del(`${this.basePath(t)}/${e}`)}async pause(t,e){return this.http.post(`${this.basePath(t)}/${e}/pause`)}async resume(t,e){return this.http.post(`${this.basePath(t)}/${e}/resume`)}async verify(t,e){return this.http.post(`${this.basePath(t)}/${e}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(t,e){return this.http.post(`${this.basePath(t)}/${e}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(t,e,s){let r={};return s?.status&&(r.status=s.status),s?.eventType&&(r.eventType=s.eventType),s?.deploymentId&&(r.deploymentId=s.deploymentId),s?.agentId&&(r.agentId=s.agentId),s?.classifierId&&(r.classifierId=s.classifierId),s?.splitterId&&(r.splitterId=s.splitterId),s?.limit!==void 0&&(r.limit=String(s.limit)),s?.offset!==void 0&&(r.offset=String(s.offset)),this.http.get(`${this.basePath(t)}/${e}/deliveries`,r)}async metrics(t,e,s){let r={};return s?.window&&(r.window=s.window),s?.bucket&&(r.bucket=s.bucket),this.http.get(`${this.basePath(t)}/${e}/metrics`,r)}async retry(t,e,s){return this.http.post(`${this.basePath(t)}/${e}/retry`,{eventIds:s})}};var kt=P(require("fs")),W=P(require("path"));var pe=P(require("fs")),ue=P(require("crypto"));async function de(n){return new Promise((t,e)=>{let s=ue.createHash("sha256"),r=pe.createReadStream(n);r.on("data",i=>s.update(i)),r.on("end",()=>t(s.digest("hex"))),r.on("error",e)})}var Ve={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Je(n){let t=W.extname(n).toLowerCase();return Ve[t]||"application/octet-stream"}async function Dt(n,t,e,s,r){let i=W.resolve(s),a=W.basename(i);if(!kt.existsSync(i))throw new k(`File not found: ${i}`);if(!kt.statSync(i).isFile())throw new k(`Not a file: ${i}`);let u=await de(i),c=await t.getUploadUrl(e,a,u);if(c.isDuplicate)return{fileId:c.fileId,filename:c.fileName??a,isDuplicate:!0,bytesUploaded:0};let g=Je(i),y=await n.putFile(c.url,i,g,r);return{fileId:c.fileId,filename:c.fileName??a,isDuplicate:!1,bytesUploaded:y}}var B=P(require("fs")),H=P(require("path"));var me=P(require("path"));var ge=250,qe=5,Ht=class{constructor(t){this.max=t}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(t=>{this.queue.push(t)})}release(){this.current--;let t=this.queue.shift();t&&(this.current++,t())}};async function he(n,t,e,s,r){let i=Math.min(r?.concurrency??qe,10),a=new Ht(i),p=s.map(m=>({path:m,filename:me.basename(m),status:"pending"})),u=p.map(async(m,E)=>{await a.acquire();try{m.status="uploading",r?.onFileStatus?.(m);let f=await Dt(n,t,e,m.path);m.fileId=f.fileId,m.status="uploaded",r?.onFileStatus?.(m)}catch(f){m.status="failed",m.error=f instanceof Error?f.message:String(f),r?.onFileStatus?.(m)}finally{a.release()}});if(await Promise.all(u),r?.process){let E=p.filter(f=>f.status==="uploaded"&&f.fileId).map(f=>f.fileId);for(let f=0;f<E.length;f+=ge){let A=E.slice(f,f+ge);try{let $=await t.processFilesAsync(e,A,r.processOptions);for(let[l,o]of Object.entries($.results)){let d=p.find(w=>w.fileId===l);d&&(o.status==="queued"?(d.status="queued",d.jobId=o.jobId):(d.status="failed",d.error=o.error),r?.onFileStatus?.(d))}}catch($){for(let l of A){let o=p.find(d=>d.fileId===l);o&&(o.status="failed",o.error=$ instanceof Error?$.message:String($),r?.onFileStatus?.(o))}}}}let c=p.filter(m=>m.status==="uploaded"||m.status==="queued").length,g=p.filter(m=>m.status==="queued").length,y=p.filter(m=>m.status==="failed").length;return{total:s.length,uploaded:c,queued:g,failed:y,files:p}}var Ke=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function fe(n,t){let e=[],s=B.readdirSync(n,{withFileTypes:!0});for(let r of s){let i=H.join(n,r.name);if(!r.name.startsWith(".")){if(r.isDirectory())e.push(...fe(i,t));else if(r.isFile()){let a=H.extname(r.name).toLowerCase();if(!Ke.has(a)||t&&!ze(r.name,t))continue;e.push(i)}}}return e.sort()}function ze(n,t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${e}$`,"i").test(n)}async function ye(n,t,e,s,r){let i=H.resolve(s);if(!B.existsSync(i))throw new Error(`Directory not found: ${i}`);if(!B.statSync(i).isDirectory())throw new Error(`Not a directory: ${i}`);let p=fe(i,r?.globPattern);return p.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:he(n,t,e,p,{concurrency:r?.concurrency,process:r?.process,processOptions:r?.processOptions,onFileStatus:r?.onFileStatus})}var Xe=1e3,Ye=1e4,Qe=1.5,Ze=3e5,ts=["COMPLETED","FAILED","STALLED"],G=class{constructor(t){this.queue=t}queue;async*poll(t,e){let s=e?.intervalMs??Xe,r=e?.maxIntervalMs??Ye,i=e?.backoffMultiplier??Qe,a=e?.timeoutMs??Ze,p=s,u=Date.now(),c;for(;;){if(Date.now()-u>a)throw new j(`Polling timed out after ${Math.round(a/1e3)}s for job ${t}`);let g=await this.queue.getStatus(t);if(g.status!==c&&(c=g.status,e?.onStatus?.(g),yield g),ts.includes(g.status))return;await new Promise(y=>setTimeout(y,p)),p=Math.min(p*i,r)}}async waitForCompletion(t,e){let s;for await(let r of this.poll(t,e))s=r;if(!s)throw new Error(`No status received for job ${t}`);return s}};var Ot=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(t){this.http=new F({apiUrl:t.apiUrl,token:t.token}),this.documents=new gt(this.http),this.projects=new mt(this.http),this.deployments=new ht(this.http),this.tables=new ft(this.http),this.columns=new yt(this.http),this.extractions=new Ct(this.http),this.queue=new wt(this.http),this.classify=new St(this.http),this.split=new vt(this.http),this.schema=new Et(this.http),this.buckets=new It(this.http),this.agents=new Pt(this.http),this.vision=new Tt(this.http),this.validations=new $t(this.http),this.labels=new xt(this.http),this.webhooks=new At(this.http)}async uploadFile(t,e,s){return Dt(this.http,this.documents,t,e,s)}async uploadFolder(t,e,s){return ye(this.http,this.documents,t,e,s)}async processAndWait(t,e,s){let r=await this.documents.processAsync(t,e,s?.processOptions),i=new G(this.queue),a;for await(let p of i.poll(r.jobId,s?.pollOptions))a=p;if(!a||a.status==="FAILED")throw new Error(`Extraction failed for file ${e}${a?`: ${a.status}`:""}`);return this.documents.getFileData(e,t,void 0,r.jobId)}async*downloadAll(t,e){yield*this.extractions.getAllRows(t,e)}};var v=P(require("fs")),J=P(require("path")),be=P(require("os")),Ut=require("child_process"),Gt=J.join(be.homedir(),".limai"),Z=J.join(Gt,"config.json"),es=".limai.token",V;function ss(n){if(!v.existsSync(n))return{};let t={};for(let e of v.readFileSync(n,"utf-8").split(/\r?\n/)){let s=e.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);s&&(t[s[1]]=s[2].replace(/^(["'])(.*)\1$/,"$2"))}return t}function Re(){if(V!==void 0)return V;try{let n=(0,Ut.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!v.existsSync(J.join(n,"packages","cli")))return V=null,null;let t=(0,Ut.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),e="";if(t!==".git"){let r=(0,Ut.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(r){let i=r.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");i&&(e=`${i}.`)}}let s=ss(J.join(n,"tables",".env.local"));return V={root:n,apiUrl:s.NEXT_PUBLIC_BASE_URL??`https://${e}tables.localhost`,sseUrl:s.NEXT_PUBLIC_SSE_URL??`https://${e}ws.localhost`},V}catch{return V=null,null}}function ns(){let n=Re();if(!n)return;let t=J.join(n.root,es);if(v.existsSync(t))return v.readFileSync(t,"utf-8").trim()}function Vt(){let n=process.env.LIMAI_API_TOKEN,t=process.env.LIMAI_API_URL,e=process.env.LIMAI_SSE_URL,s={};if(v.existsSync(Z))try{let u=v.readFileSync(Z,"utf-8"),c=JSON.parse(u);c&&typeof c=="object"&&!Array.isArray(c)&&(s=c)}catch{s={}}let r=Re(),i=n||ns()||s.token,a=t||s.apiUrl||r?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,p=e||s.sseUrl||r?.sseUrl||void 0;return!i||!a?null:{token:i,apiUrl:a,sseUrl:p,defaultProjectId:s.defaultProjectId,defaultDeploymentId:s.defaultDeploymentId}}function Ce(n){let t={};if(v.existsSync(Z))try{let s=v.readFileSync(Z,"utf-8");t=JSON.parse(s)}catch{t={}}let e={...t,...n};v.existsSync(Gt)||v.mkdirSync(Gt,{recursive:!0,mode:448}),v.writeFileSync(Z,JSON.stringify(e,null,2),{mode:384})}function we(){let n=Vt();return n||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),n}var jt=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}},Se=10,rs=13,_=32;function Jt(n){}function Ie(n){if(typeof n=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=Jt,onError:e=Jt,onRetry:s=Jt,onComment:r}=n,i=[],a=!0,p,u="",c=0,g;function y(l){if(a&&(a=!1,l.charCodeAt(0)===239&&l.charCodeAt(1)===187&&l.charCodeAt(2)===191&&(l=l.slice(3))),i.length===0){let w=m(l);w!==""&&i.push(w);return}if(l.indexOf(`
|
|
2
2
|
`)===-1&&l.indexOf("\r")===-1){i.push(l);return}i.push(l);let o=i.join("");i.length=0;let d=m(o);d!==""&&i.push(d)}function m(l){let o=0;if(l.indexOf("\r")===-1){let d=l.indexOf(`
|
|
3
3
|
`,o);for(;d!==-1;){if(o===d){c>0&&t({id:p,event:g,data:u}),p=void 0,u="",c=0,g=void 0,o=d+1,d=l.indexOf(`
|
|
4
4
|
`,o);continue}let w=l.charCodeAt(o);if(ve(l,o,w)){let S=l.charCodeAt(o+5)===_?o+6:o+5,O=l.slice(S,d);if(c===0&&l.charCodeAt(d+1)===Se){t({id:p,event:g,data:O}),p=void 0,u="",g=void 0,o=d+2,d=l.indexOf(`
|