@noormdev/cli 1.0.0-alpha.7 → 1.0.0-alpha.8
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.
|
@@ -200,7 +200,7 @@ You can either \`unset ${g("APP_PROBLEMATIC")}\` or scope all vars to \`${g("APP
|
|
|
200
200
|
`,u).length:l,c?(o===null?0:o.length)+a.length:0,c?a.length+l:0);return f<m},parse:function(r,s,i,u){let{bom:o,comment_no_infix:a,encoding:c,from_line:d,ltrim:l,max_record_size:f,raw:m,relax_quotes:y,rtrim:h,skip_empty_lines:p,to:g,to_line:D}=this.options,{comment:E,escape:A,quote:C,record_delimiter:_}=this.options,{bomSkipped:x,previousBuf:S,rawBuffer:R,escapeIsQuote:H}=this.state,k;if(S===void 0)if(r===void 0){u();return}else k=r;else S!==void 0&&r===void 0?k=S:k=Buffer.concat([S,r]);if(x===!1)if(o===!1)this.state.bomSkipped=!0;else if(k.length<3){if(s===!1){this.state.previousBuf=k;return}}else{for(let K in Bt)if(Bt[K].compare(k,0,Bt[K].length)===0){let ue=Bt[K].length;this.state.bufBytesStart+=ue,k=k.slice(ue);let Le=iu({...this.original_options,encoding:K});for(let V in Le)this.options[V]=Le[V];({comment:E,escape:A,quote:C}=this.options);break}this.state.bomSkipped=!0}let q=k.length,N;for(N=0;N<q&&!this.__needMoreData(N,q,s);N++){if(this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1),D!==-1&&this.info.lines>D){this.state.stop=!0,u();return}this.state.quoting===!1&&_.length===0&&this.__autoDiscoverRecordDelimiter(k,N)&&(_=this.options.record_delimiter);let K=k[N];if(m===!0&&R.append(K),(K===Rm||K===qm)&&this.state.wasRowDelimiter===!1&&(this.state.wasRowDelimiter=!0),this.state.escaping===!0)this.state.escaping=!1;else{if(A!==null&&this.state.quoting===!0&&this.__isEscape(k,N,K)&&N+A.length<q)if(H){if(this.__isQuote(k,N+A.length)){this.state.escaping=!0,N+=A.length-1;continue}}else{this.state.escaping=!0,N+=A.length-1;continue}if(this.state.commenting===!1&&this.__isQuote(k,N))if(this.state.quoting===!0){let V=k[N+C.length],he=h&&this.__isCharTrimable(k,N+C.length),oe=E!==null&&this.__compareBytes(E,k,N+C.length,V),Ce=this.__isDelimiter(k,N+C.length,V),Sn=_.length===0?this.__autoDiscoverRecordDelimiter(k,N+C.length):this.__isRecordDelimiter(V,k,N+C.length);if(A!==null&&this.__isEscape(k,N,K)&&this.__isQuote(k,N+A.length))N+=A.length-1;else if(!V||Ce||Sn||oe||he){this.state.quoting=!1,this.state.wasQuoting=!0,N+=C.length-1;continue}else if(y===!1){let vu=this.__error(new L("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(V)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(vu!==void 0)return vu}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(C),N+=C.length-1}else if(this.state.field.length!==0){if(y===!1){let V=this.__infoField(),he=Object.keys(Bt).map(Ce=>Bt[Ce].equals(this.state.field.toString())?Ce:!1).filter(Boolean)[0],oe=this.__error(new L("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found on field ${JSON.stringify(V.column)} at line ${V.lines}, value is ${JSON.stringify(this.state.field.toString(c))}`,he?`(${he} bom)`:void 0],this.options,V,{field:this.state.field}));if(oe!==void 0)return oe}}else{this.state.quoting=!0,N+=C.length-1;continue}if(this.state.quoting===!1){let V=this.__isRecordDelimiter(K,k,N);if(V!==0){if(this.state.commenting&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0)this.info.comment_lines++;else{if(this.state.enabled===!1&&this.info.lines+(this.state.wasRowDelimiter===!0?1:0)>=d){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),N+=V-1;continue}if(p===!0&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0){this.info.empty_lines++,N+=V-1;continue}this.info.bytes=this.state.bufBytesStart+N;let Ce=this.__onField();if(Ce!==void 0)return Ce;this.info.bytes=this.state.bufBytesStart+N+V;let Sn=this.__onRecord(i);if(Sn!==void 0)return Sn;if(g!==-1&&this.info.records>=g){this.state.stop=!0,u();return}}this.state.commenting=!1,N+=V-1;continue}if(this.state.commenting)continue;if(E!==null&&(a===!1||this.state.record.length===0&&this.state.field.length===0)&&this.__compareBytes(E,k,N,K)!==0){this.state.commenting=!0;continue}let he=this.__isDelimiter(k,N,K);if(he!==0){this.info.bytes=this.state.bufBytesStart+N;let oe=this.__onField();if(oe!==void 0)return oe;N+=he-1;continue}}}if(this.state.commenting===!1&&f!==0&&this.state.record_length+this.state.field.length>f)return this.__error(new L("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${f}`,`at line ${this.info.lines}`],this.options,this.__infoField()));let ue=l===!1||this.state.quoting===!0||this.state.field.length!==0||!this.__isCharTrimable(k,N),Le=h===!1||this.state.wasQuoting===!1;if(ue===!0&&Le===!0)this.state.field.append(K);else{if(h===!0&&!this.__isCharTrimable(k,N))return this.__error(new L("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()));ue===!1&&(N+=this.__isCharTrimable(k,N)-1);continue}}if(s===!0)if(this.state.quoting===!0){let K=this.__error(new L("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(K!==void 0)return K}else if(this.state.wasQuoting===!0||this.state.record.length!==0||this.state.field.length!==0){this.info.bytes=this.state.bufBytesStart+N;let K=this.__onField();if(K!==void 0)return K;let ue=this.__onRecord(i);if(ue!==void 0)return ue}else this.state.wasRowDelimiter===!0?this.info.empty_lines++:this.state.commenting===!0&&this.info.comment_lines++;else this.state.bufBytesStart+=N,this.state.previousBuf=k.slice(N);this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1)},__onRecord:function(r){let{columns:s,group_columns_by_name:i,encoding:u,info:o,from:a,relax_column_count:c,relax_column_count_less:d,relax_column_count_more:l,raw:f,skip_records_with_empty_values:m}=this.options,{enabled:y,record:h}=this.state;if(y===!1)return this.__resetRecord();let p=h.length;if(s===!0){if(m===!0&&Wc(h)){this.__resetRecord();return}return this.__firstLineToColumns(h)}if(s===!1&&this.info.records===0&&(this.state.expectedRecordLength=p),p!==this.state.expectedRecordLength){let g=s===!1?new L("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${p} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h}):new L("CSV_RECORD_INCONSISTENT_COLUMNS",["Invalid Record Length:",`columns length is ${s.length},`,`got ${p} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h});if(c===!0||d===!0&&p<this.state.expectedRecordLength||l===!0&&p>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=g;else{let D=this.__error(g);if(D)return D}}if(m===!0&&Wc(h)){this.__resetRecord();return}if(this.state.recordHasError===!0){this.__resetRecord(),this.state.recordHasError=!1;return}if(this.info.records++,a===1||this.info.records>=a){let{objname:g}=this.options;if(s!==!1){let D={};for(let E=0,A=h.length;E<A;E++)s[E]===void 0||s[E].disabled||(i===!0&&D[s[E].name]!==void 0?Array.isArray(D[s[E].name])?D[s[E].name]=D[s[E].name].concat(h[E]):D[s[E].name]=[D[s[E].name],h[E]]:D[s[E].name]=h[E]);if(f===!0||o===!0){let E=Object.assign({record:D},f===!0?{raw:this.state.rawBuffer.toString(u)}:{},o===!0?{info:this.__infoRecord()}:{}),A=this.__push(g===void 0?E:[D[g],E],r);if(A)return A}else{let E=this.__push(g===void 0?D:[D[g],D],r);if(E)return E}}else if(f===!0||o===!0){let D=Object.assign({record:h},f===!0?{raw:this.state.rawBuffer.toString(u)}:{},o===!0?{info:this.__infoRecord()}:{}),E=this.__push(g===void 0?D:[h[g],D],r);if(E)return E}else{let D=this.__push(g===void 0?h:[h[g],h],r);if(D)return D}}this.__resetRecord()},__firstLineToColumns:function(r){let{firstLineToHeaders:s}=this.state;try{let i=s===void 0?r:s.call(null,r);if(!Array.isArray(i))return this.__error(new L("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(i)}`],this.options,this.__infoField(),{headers:i}));let u=Yr(i);this.state.expectedRecordLength=u.length,this.options.columns=u,this.__resetRecord();return}catch(i){return i}},__resetRecord:function(){this.options.raw===!0&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0},__onField:function(){let{cast:r,encoding:s,rtrim:i,max_record_size:u}=this.options,{enabled:o,wasQuoting:a}=this.state;if(o===!1)return this.__resetField();let c=this.state.field.toString(s);if(i===!0&&a===!1&&(c=c.trimRight()),r===!0){let[d,l]=this.__cast(c);if(d!==void 0)return d;c=l}this.state.record.push(c),u!==0&&typeof c=="string"&&(this.state.record_length+=c.length),this.__resetField()},__resetField:function(){this.state.field.reset(),this.state.wasQuoting=!1},__push:function(r,s){let{on_record:i}=this.options;if(i!==void 0){let u=this.__infoRecord();try{r=i.call(null,r,u)}catch(o){return o}if(r==null)return}s(r)},__cast:function(r){let{columns:s,relax_column_count:i}=this.options;if(Array.isArray(s)===!0&&i&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(this.state.castField!==null)try{let o=this.__infoField();return[void 0,this.state.castField.call(null,r,o)]}catch(o){return[o]}if(this.__isFloat(r))return[void 0,parseFloat(r)];if(this.options.cast_date!==!1){let o=this.__infoField();return[void 0,this.options.cast_date.call(null,r,o)]}return[void 0,r]},__isCharTrimable:function(r,s){return((u,o)=>{let{timchars:a}=this.state;e:for(let c=0;c<a.length;c++){let d=a[c];for(let l=0;l<d.length;l++)if(d[l]!==u[o+l])continue e;return d.length}return 0})(r,s)},__isFloat:function(r){return r-parseFloat(r)+1>=0},__compareBytes:function(r,s,i,u){if(r[0]!==u)return 0;let o=r.length;for(let a=1;a<o;a++)if(r[a]!==s[i+a])return 0;return o},__isDelimiter:function(r,s,i){let{delimiter:u,ignore_last_delimiters:o}=this.options;if(o===!0&&this.state.record.length===this.options.columns.length-1)return 0;if(o!==!1&&typeof o=="number"&&this.state.record.length===o-1)return 0;e:for(let a=0;a<u.length;a++){let c=u[a];if(c[0]===i){for(let d=1;d<c.length;d++)if(c[d]!==r[s+d])continue e;return c.length}}return 0},__isRecordDelimiter:function(r,s,i){let{record_delimiter:u}=this.options,o=u.length;e:for(let a=0;a<o;a++){let c=u[a],d=c.length;if(c[0]===r){for(let l=1;l<d;l++)if(c[l]!==s[i+l])continue e;return c.length}}return 0},__isEscape:function(r,s,i){let{escape:u}=this.options;if(u===null)return!1;let o=u.length;if(u[0]===i){for(let a=0;a<o;a++)if(u[a]!==r[s+a])return!1;return!0}return!1},__isQuote:function(r,s){let{quote:i}=this.options;if(i===null)return!1;let u=i.length;for(let o=0;o<u;o++)if(i[o]!==r[s+o])return!1;return!0},__autoDiscoverRecordDelimiter:function(r,s){let{encoding:i}=this.options,u=[Buffer.from(`\r
|
|
201
201
|
`,i),Buffer.from(`
|
|
202
202
|
`,i),Buffer.from("\r",i)];e:for(let o=0;o<u.length;o++){let a=u[o].length;for(let c=0;c<a;c++)if(u[o][c]!==r[s+c])continue e;return this.options.record_delimiter.push(u[o]),this.state.recordDelimiterMaxLength=u[o].length,u[o].length}return 0},__error:function(r){let{encoding:s,raw:i,skip_records_with_error:u}=this.options,o=typeof r=="string"?new Error(r):r;if(u){if(this.state.recordHasError=!0,this.options.on_skip!==void 0)try{this.options.on_skip(o,i?this.state.rawBuffer.toString(s):void 0)}catch(a){return a}return}else return o},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){let{columns:r,raw:s,encoding:i}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:r===!0,index:this.state.record.length,raw:s?this.state.rawBuffer.toString(i):void 0}},__infoField:function(){let{columns:r}=this.options,s=Array.isArray(r);return{...this.__infoRecord(),column:s===!0?r.length>this.state.record.length?r[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}};var Yc=function(t,e={}){typeof t=="string"&&(t=Buffer.from(t));let n=e&&e.objname?{}:[],r=Jc(e),s=o=>{r.options.objname===void 0?n.push(o):n[o[0]]=o[1]},i=()=>{},u=r.parse(t,!0,s,i);if(u!==void 0)throw u;return n};async function uu(t){let e=await Mm(t,"utf-8");return Yc(e,{columns:!0,skip_empty_lines:!0,trim:!0})}import{readFile as $m}from"fs/promises";async function ou(t){return $m(t,"utf-8")}var Hc={".json":Gn,".json5":Gn,".yaml":Jr,".yml":Jr,".csv":uu,".js":tt,".mjs":tt,".ts":tt,".sql":ou};function Gc(t){return t in Hc}function Um(t){return Hc[t]}async function au(t){let e=jm.extname(t).toLowerCase(),n=Um(e);if(!n)throw new Error(`No loader registered for extension: ${e}`);return n(t)}function lu(){return lu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lu.apply(this,arguments)}function Km(t,e){return Wm(t)||Ym(t,e)||Gm()}function Vm(t){return zm(t)||Jm(t)||Hm()}function zm(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}function Wm(t){if(Array.isArray(t))return t}function Jm(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function Ym(t,e){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]"){var n=[],r=!0,s=!1,i=void 0;try{for(var u=t[Symbol.iterator](),o;!(r=(o=u.next()).done)&&(n.push(o.value),!(e&&n.length===e));r=!0);}catch(a){s=!0,i=a}finally{try{!r&&u.return!=null&&u.return()}finally{if(s)throw i}}return n}}function Hm(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function Gm(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function M(t){return t==null}function rl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return M(t)?e:!!t}function wn(t){return typeof t=="string"}function w(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return M(t)?e:wn(t)?t:String(t)}function pu(t,e){var n=w(t),r=rl(e);return n===""?"":(r&&(n=n.toLowerCase()),n.substr(0,1).toUpperCase()+n.substr(1))}function Zr(t){var e=w(t,"");return e.toLowerCase()}var mu="\\d",es="\\s\\uFEFF\\xA0",Ye="\\uD800-\\uDBFF",He="\\uDC00-\\uDFFF",ft="\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F",sl="\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF",gu=new RegExp("(["+sl+"]|["+Ye+"]["+He+"]|["+Ye+"](?!["+He+"])|(?:[^"+Ye+"]|^)["+He+"])(["+ft+"]+)","g"),il=new RegExp("(["+Ye+"])(["+He+"])","g"),fu=new RegExp("((?:["+sl+"]|["+Ye+"]["+He+"]|["+Ye+"](?!["+He+"])|(?:[^"+Ye+"]|^)["+He+"])(?:["+ft+"]+))|(["+Ye+"]["+He+"])|([\\n\\r\\u2028\\u2029])|(.)","g"),Qm=new RegExp("["+es+"]"),Xm=new RegExp("^["+es+"]+"),Zm=new RegExp("["+es+"]+$"),eg=new RegExp("^"+mu+"+$"),tg=/[-[\]{}()*+!<=:?./\\^$|#,]/g,ul=/[^A-Za-z0-9]/g,ng=/[<>&"'`]/g,rg=/(%{1,2})(?:(\d+)\$)?(\+)?([ 0]|'.{1})?(-)?(\d+)?(?:\.(\d+))?([bcdiouxXeEfgGs])?/g,sg=/\.?0+$/g,ig=/<([A-Za-z0-9]+)>/g,ug="\\u2000-\\u206F",og="\\x00-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7b-\\xBF\\xD7\\xF7",ag="\\u2700-\\u27BF",Gr="a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F",Qr="\\x41-\\x5a\\xc0-\\xd6\\xd8-\\xde\\u0100\\u0102\\u0104\\u0106\\u0108\\u010a\\u010c\\u010e\\u0110\\u0112\\u0114\\u0116\\u0118\\u011a\\u011c\\u011e\\u0120\\u0122\\u0124\\u0126\\u0128\\u012a\\u012c\\u012e\\u0130\\u0132\\u0134\\u0136\\u0139\\u013b\\u013d\\u013f\\u0141\\u0143\\u0145\\u0147\\u014a\\u014c\\u014e\\u0150\\u0152\\u0154\\u0156\\u0158\\u015a\\u015c\\u015e\\u0160\\u0162\\u0164\\u0166\\u0168\\u016a\\u016c\\u016e\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017b\\u017d\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018b\\u018e-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019c\\u019d\\u019f\\u01a0\\u01a2\\u01a4\\u01a6\\u01a7\\u01a9\\u01ac\\u01ae\\u01af\\u01b1-\\u01b3\\u01b5\\u01b7\\u01b8\\u01bc\\u01c4\\u01c5\\u01c7\\u01c8\\u01ca\\u01cb\\u01cd\\u01cf\\u01d1\\u01d3\\u01d5\\u01d7\\u01d9\\u01db\\u01de\\u01e0\\u01e2\\u01e4\\u01e6\\u01e8\\u01ea\\u01ec\\u01ee\\u01f1\\u01f2\\u01f4\\u01f6-\\u01f8\\u01fa\\u01fc\\u01fe\\u0200\\u0202\\u0204\\u0206\\u0208\\u020a\\u020c\\u020e\\u0210\\u0212\\u0214\\u0216\\u0218\\u021a\\u021c\\u021e\\u0220\\u0222\\u0224\\u0226\\u0228\\u022a\\u022c\\u022e\\u0230\\u0232\\u023a\\u023b\\u023d\\u023e\\u0241\\u0243-\\u0246\\u0248\\u024a\\u024c\\u024e",yu=new RegExp("(?:["+Qr+"]["+ft+"]*)?(?:["+Gr+"]["+ft+"]*)+|(?:["+Qr+"]["+ft+"]*)+(?!["+Gr+"])|["+mu+"]+|["+ag+"]|[^"+og+ug+es+"]+","g"),Du=/[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g,cg=new RegExp("^(?:["+Gr+Qr+"]["+ft+"]*)+$"),lg=new RegExp("^((?:["+Gr+Qr+"]["+ft+"]*)|["+mu+"])+$"),bu=/^[\x01-\xFF]*$/;function kt(t,e){return t??e}function Ie(t){return M(t)?null:wn(t)?t:String(t)}function Cn(t,e,n){var r=w(t),s;if(M(e))s=bu.test(r)?Du:yu;else if(e instanceof RegExp)s=e;else{var i=Ie(kt(n,""));s=new RegExp(Ie(e),i)}return kt(r.match(s),[])}function fg(t,e){return e===0?Zr(t):pu(t,!0)}function hg(t){var e=w(t);return e===""?"":Cn(e).map(fg).join("")}function dg(t){var e=w(t);return e===""?"":e.substr(0,1).toLowerCase()+e.substr(1)}function ol(t){var e=w(t);return e===""?"":Cn(e).map(Zr).join("-")}function pg(t){var e=w(t);return e===""?"":Cn(e).map(Zr).join("_")}function mg(t){var e=w(t);return e.toUpperCase()}function gg(t){var e=w(t);return e.split("").reduce(yg,"")}function yg(t,e){var n=e.toLowerCase(),r=e.toUpperCase();return t+(e===n?r:n)}function Dg(t,e){var n=w(t),r=Array.isArray(e)?e:[],s=bu.test(n)?Du:yu;return n.replace(s,function(i,u){var o=u>0&&r.indexOf(n[u-1])>=0;return o?i.toLowerCase():pu(i,!0)})}function fe(t,e,n){return t<=e?e:t>=n?n:t}var we=9007199254740991;function re(t){return t===1/0?we:t===-1/0?-we:~~t}function al(t,e,n){var r=w(t),s=M(e)?r.length:fe(re(e),0,we),i=w(n,"...");return s>=r.length?r:r.substr(0,e-i.length)+i}function bg(t,e){var n=w(t);return n.charAt(e)}var cl=55296,Eg=56319,ll=56320,Ag=57343;function wg(t){return t>=cl&&t<=Eg}function Cg(t){return t>=ll&&t<=Ag}function Sg(t,e){return(t-cl)*1024+e-ll+65536}function Te(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return M(t)?e:typeof t=="number"?t:Number(t)}function fl(t,e){return t!==t?e:t}function hl(t,e){var n=w(t),r=n.length,s=Te(e);if(s=fl(s,0),!(s<0||s>=r)){var i=n.charCodeAt(s),u;return wg(i)&&r>s+1&&(u=n.charCodeAt(s+1),Cg(u))?Sg(i,u):i}}function vg(t,e){var n=w(t),r=M(e)?1:fe(re(e),0,we);return n.length<=r?n:n.substr(0,r)}function Fg(t,e){var n=w(t),r=Te(e),s,i=0;for(r=fl(r,0);(s=fu.exec(n))!==null;){if(i===r)return fu.lastIndex=0,s[0];i++}return""}function _g(t,e){var n=w(t),r=M(e)?1:fe(re(e),0,we);return n.length<=r?n:n.substr(n.length-r,r)}function xg(t,e,n){var r=w(t),s=M(e)?r.length:fe(re(e),0,we),i=w(n,"...");if(s>=r.length)return r;var u=bu.test(r)?Du:yu,o=0;return r.replace(u,function(a,c){var d=c+a.length;d<=s-i.length&&(o=d)}),r.substr(0,o)+i}function Ng(t,e,n){return w(t).slice(e,n)}function Bg(t,e,n){return w(t).substr(e,n)}function Og(t,e,n){return w(t).substring(e,n)}function kg(t){return w(t).length}function Ig(t){return w(t).replace(gu,"*").replace(il,"*").length}function Tg(t,e){var n=w(t),r=w(e),s=r.length,i=0,u=0;if(n===""||r==="")return i;do u=n.indexOf(r,u),u!==-1&&(i++,u+=s);while(u!==-1);return i}var Lg=Array.prototype.reduce;function Pg(t,e,n){var r=w(t);if(r===""||typeof e!="function")return 0;var s=e.bind(n);return Lg.call(r,function(i,u,o){return s(u,o,r)?i+1:i},0)}function Rg(t,e,n){return Cn(t,e,n).length}function ts(){this.index=0}ts.prototype.increment=function(){this.index++};ts.prototype.incrementOnEmptyPosition=function(t){M(t)&&this.increment()};ts.prototype.getIndexByPosition=function(t){return M(t)?this.index:t-1};var qg="i",dl="b",pl="c",Mg="d",ml="o",$g="u",gl="x",yl="X",Dl="e",bl="E",El="f",Al="g",Eu="G",jg="s",Ug="'",Qc="+",Kg="-",Vg="%%",zg=2,Wg=8,Xc=16;function wl(t,e){for(var n=w(t),r=M(e)?1:fe(re(e),0,we),s="";r;)r&1&&(s+=n),r>1&&(n+=n),r>>=1;return s}function Xr(t,e){var n=re(e/t.length),r=e%t.length;return wl(t,n+r).substr(0,e)}function Cl(t,e,n){var r=w(t),s=M(e)?0:fe(re(e),0,we),i=w(n," ");return s<=r.length?r:Xr(i,s-r.length)+r}function Sl(t,e,n){var r=w(t),s=M(e)?0:fe(re(e),0,we),i=w(n," ");return s<=r.length?r:r+Xr(i,s-r.length)}function Jg(t,e){var n=e.width;if(M(n)||t.length>=n)return t;var r=e.alignmentSpecifier===Kg?Sl:Cl;return r(t,n,e.getPaddingCharacter())}function vl(t,e,n){return n.signSpecifier===Qc&&t>=0&&(e=Qc+e),e}function Yg(t,e){var n=parseFloat(t),r;isNaN(n)&&(n=0);var s=Te(e.precision,6);switch(e.typeSpecifier){case El:r=n.toFixed(s);break;case Dl:r=n.toExponential(s);break;case bl:r=n.toExponential(s).toUpperCase();break;case Al:case Eu:r=Hg(n,s,e);break}return r=vl(n,r,e),w(r)}function Hg(t,e,n){if(t===0)return"0";var r=e===0?1:e,s=t.toPrecision(r).replace(sg,"");return n.typeSpecifier===Eu&&(s=s.toUpperCase()),s}function Gg(t,e){var n=parseInt(t);switch(isNaN(n)&&(n=0),n=n>>>0,e.typeSpecifier){case pl:n=String.fromCharCode(n);break;case dl:n=n.toString(zg);break;case ml:n=n.toString(Wg);break;case gl:n=n.toString(Xc);break;case yl:n=n.toString(Xc).toUpperCase();break}return w(n)}function Qg(t,e){var n=parseInt(t);return isNaN(n)&&(n=0),vl(n,Ie(n),e)}function Xg(t,e){var n=t,r=e.precision;return!M(r)&&n.length>r&&(n=al(n,r,"")),n}function Zg(t,e){var n;switch(e.typeSpecifier){case jg:n=Xg;break;case Mg:case qg:n=Qg;break;case pl:case dl:case ml:case gl:case yl:case $g:n=Gg;break;case El:case Dl:case bl:case Al:case Eu:n=Yg;break}var r=n(t,e);return Jg(r,e)}function Au(t){this.percent=t.percent,this.signSpecifier=t.signSpecifier,this.paddingSpecifier=t.paddingSpecifier,this.alignmentSpecifier=t.alignmentSpecifier,this.width=t.width,this.precision=t.precision,this.typeSpecifier=t.typeSpecifier}Au.prototype.isPercentLiteral=function(){return Vg===this.percent};Au.prototype.getPaddingCharacter=function(){var t=kt(this.paddingSpecifier," ");return t.length===2&&t[0]===Ug&&(t=t[1]),t};function ey(t,e,n){if(M(n.typeSpecifier))throw new Error("sprintf(): Unknown type specifier");if(t>e-1)throw new Error("sprintf(): Too few arguments");if(t<0)throw new Error("sprintf(): Argument number must be greater than zero")}function ty(t,e,n,r,s,i,u,o,a,c,d){var l=new Au({percent:r,signSpecifier:i,paddingSpecifier:u,alignmentSpecifier:o,width:Te(a,null),precision:Te(c,null),typeSpecifier:d});if(l.isPercentLiteral())return n.slice(1);var f=t.getIndexByPosition(s);return t.incrementOnEmptyPosition(s),ey(f,e.length,l),Zg(e[f],l)}function Fl(t){var e=w(t);if(e==="")return e;for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var i=ty.bind(void 0,new ts,r);return e.replace(rg,i)}function ny(t,e){return Fl.apply(void 0,[t].concat(Vm(kt(e,[]))))}var ry={"<":"<",">":">","&":"&",'"':""","'":"'","`":"`"};function sy(t){return ry[t]}function iy(t){return w(t).replace(ng,sy)}function uy(t){return w(t).replace(tg,"\\$&")}var _l={"<":/(<)|(�*3c;)|(�*60;)/gi,">":/(>)|(�*3e;)|(�*62;)/gi,"&":/(&)|(�*26;)|(�*38;)/gi,'"':/(")|(�*22;)|(�*34;)/gi,"'":/(�*27;)|(�*39;)/gi,"`":/(�*60;)|(�*96;)/gi},oy=Object.keys(_l);function ay(t,e){return t.replace(_l[e],e)}function cy(t){var e=w(t);return oy.reduce(ay,e)}function ly(t,e,n){var r=w(t);return r.indexOf(e,n)}function fy(t,e,n){var r=w(t);return r.lastIndexOf(e,n)}function hy(t,e,n){var r=w(t),s=M(n)?0:fe(re(n),0,r.length),i=r.substr(s).search(e);return i!==-1&&!isNaN(s)&&(i+=s),i}function dy(t,e,n){var r=w(t),s=w(e),i=Te(n);return i<0||i>r.length||s===""?r:r.slice(0,i)+s+r.slice(i)}var Zc={3:"\u039E\u03BE",8:"\u0398\u03B8",A:"A\xC0\xC1\xC2\xC3\xC4\xC5\u0100\u0102\u0104\u01CD\u01DE\u01E0\u01FA\u0200\u0202\u0226\u023A\u0386\u0391\u0410",B:"B\u0181\u0182\u0243\u0392\u0411",C:"C\xC7\u0106\u0108\u010A\u010C\u0187\u023B\u0426",D:"D\u010E\u0110\u0189\u018A\u018B\xD0\u0394\u0414",E:"E\xC8\xC9\xCA\xCB\u0112\u0114\u0116\u0118\u011A\u018E\u0190\u0204\u0206\u0228\u0388\u0395\u0415\u042D",F:"F\u0191\u03A6\u0424",G:"G\u011C\u011E\u0120\u0122\u0193\u01E4\u01E6\u01F4\u0393\u0413\u0490",H:"H\u0124\u0126\u021E\u0389\u0397\u0425",I:"I\xCC\xCD\xCE\xCF\u0128\u012A\u012C\u012E\u0130\u0197\u01CF\u0208\u020A\u038A\u0399\u03AA\u0406\u0418",J:"J\u0134\u0248\u0419",K:"K\u0136\u0198\u01E8\u039A\u041A",L:"L\u0139\u013B\u013D\u013F\u0141\u023D\u039B\u041B",M:"M\u019C\u039C\u041C",N:"N\xD1\u0143\u0145\u0147\u019D\u01F8\u0220\u039D\u041D",O:"O\xD2\xD3\xD4\xD5\xD6\xD8\u014C\u014E\u0150\u0186\u019F\u01A0\u01D1\u01EA\u01EC\u01FE\u020C\u020E\u022A\u022C\u022E\u0230\u038C\u039F\u041E",P:"P\u01A4\u03A0\u041F",Q:"Q\u024A",R:"R\u0154\u0156\u0158\u0210\u0212\u024C\u03A1\u0420",S:"S\u015A\u015C\u015E\u0160\u0218\u03A3\u0421",T:"T\u0162\u0164\u0166\u01AC\u01AE\u021A\u023E\u03A4\u0422",U:"U\xD9\xDA\xDB\xDC\u0168\u016A\u016C\u016E\u0170\u0172\u01AF\u01D3\u01D5\u01D7\u01D9\u01DB\u0214\u0216\u0244\u0423\u042A",V:"V\u01B2\u0245\u0412",W:"W\u0174\u038F\u03A9",X:"X\u03A7",Y:"Y\xDD\u0176\u0178\u01B3\u0232\u024E\u038E\u03A5\u03AB\u042B",Z:"Z\u0179\u017B\u017D\u01B5\u0224\u0396\u0417",a:"a\xE0\xE1\xE2\xE3\xE4\xE5\u0101\u0103\u0105\u01CE\u01DF\u01E1\u01FB\u0201\u0203\u0227\u0250\u03AC\u03B1\u0430",b:"b\u0180\u0183\u0253\u03B2\u0431",c:"c\xE7\u0107\u0109\u010B\u010D\u0188\u023C\u0446",d:"d\u010F\u0111\u018C\u0256\u0257\xF0\u03B4\u0434",e:"e\xE8\xE9\xEA\xEB\u0113\u0115\u0117\u0119\u011B\u01DD\u0205\u0207\u0229\u0247\u025B\u03AD\u03B5\u0435\u044D",f:"f\u0192\u03C6\u0444",g:"g\u011D\u011F\u0121\u0123\u01E5\u01E7\u01F5\u0260\u03B3\u0433\u0491",h:"h\u0125\u0127\u021F\u0265\u03AE\u03B7\u0445",i:"i\xEC\xED\xEE\xEF\u0129\u012B\u012D\u012F\u0131\u01D0\u0209\u020B\u0268\u0390\u03AF\u03B9\u03CA\u0438\u0456",j:"j\u0135\u01F0\u0249\u0439",k:"k\u0137\u0199\u01E9\u03BA\u043A",l:"l\u013A\u013C\u013E\u0140\u0142\u017F\u019A\u026B\u03BB\u043B",m:"m\u026F\u0271\u03BC\u043C",n:"n\xF1\u0144\u0146\u0148\u0149\u019E\u01F9\u0272\u03BD\u043D",o:"o\xF2\xF3\xF4\xF5\xF6\xF8\u014D\u014F\u0151\u01A1\u01D2\u01EB\u01ED\u01FF\u020D\u020F\u022B\u022D\u022F\u0231\u0254\u0275\u03BF\u03CC\u043E",p:"p\u01A5\u03C0\u043F",q:"q\u024B",r:"r\u0155\u0157\u0159\u0211\u0213\u024D\u027D\u03C1\u0440",s:"s\xDF\u015B\u015D\u015F\u0161\u0219\u023F\u03C2\u03C3\u0441",t:"t\u0163\u0165\u0167\u01AD\u021B\u0288\u03C4\u0442",u:"u\xF9\xFA\xFB\xFC\u0169\u016B\u016D\u016F\u0171\u0173\u01B0\u01D4\u01D6\u01D8\u01DA\u01DC\u0215\u0217\u0289\u0443\u044A",v:"v\u028B\u028C\u0432",w:"w\u0175\u03C9\u03CE",x:"x\u03C7",y:"y\xFD\xFF\u0177\u01B4\u0233\u024F\u03B0\u03C5\u03CB\u03CD\u044B",z:"z\u017A\u017C\u017E\u01B6\u0225\u0240\u03B6\u0437",OE:"\x8C\u0152",oe:"\x9C\u0153",AE:"\xC6\u01E2\u01FC",ae:"\xE6\u01E3\u01FD",hv:"\u0195",OI:"\u01A2",oi:"\u01A3",DZ:"\u01C4\u01F1",Dz:"\u01C5\u01F2",dz:"\u01C6\u01F3",LJ:"\u01C7",Lj:"\u01C8",lj:"\u01C9",NJ:"\u01CA",Nj:"\u01CB",nj:"\u01CC",OU:"\u0222",ou:"\u0223",TH:"\xDE",th:"\xFE",PS:"\u03A8",ps:"\u03C8",Yo:"\u0401",Ye:"\u0404",Yi:"\u0407",Zh:"\u0416",Ch:"\u0427",Sh:"\u0428\u0429","":"\u042A\u042C\u044C",Yu:"\u042E",Ya:"\u042F",zh:"\u0436",ch:"\u0447",sh:"\u0448\u0449",yu:"\u044E",ya:"\u044F",yo:"\u0451",ye:"\u0454",yi:"\u0457"},En=null;function py(){return En!==null||(En={},Object.keys(Zc).forEach(function(t){for(var e=Zc[t],n=0;n<e.length;n++){var r=e[n];En[r]=t}})),En}function my(t){var e=py()[t];return e||t}function gy(t,e){return e}function xl(t){var e=w(t);return e===""?"":e.replace(ul,my).replace(gu,gy)}function yy(t,e,n){var r=w(t),s=M(e)?0:fe(re(e),0,we),i=w(n," ");if(s<=r.length)return r;var u=s-r.length,o=re(u/2),a=u%2;return Xr(i,o)+r+Xr(i,o+a)}function Dy(t,e,n){var r=w(t);return r.replace(e,n)}function Nl(t,e,n){var r=w(t);if(e instanceof RegExp){if(e.flags.indexOf("g")===-1)throw new TypeError("search argument is a non-global regular expression");return r.replace(e,n)}var s=w(e),i=typeof n=="function";i||(n=w(n));var u=s.length;if(u===0)return Nl(t,/(?:)/g,n);for(var o=u>1?u:1,a=[],c=r.indexOf(s,0);c!==-1;)a.push(c),c=r.indexOf(s,c+o);for(var d=0,l="",f=0;f<a.length;f++){var m=a[f],y=n;i&&(y=w(n.call(void 0,s,m,r))),l+=r.slice(d,m)+y,d=m+u}return d<r.length&&(l+=r.slice(d)),l}function by(t){var e=w(t);return e.split("").reverse().join("")}function Bl(t){var e=w(t);e=e.replace(gu,function(s,i,u){return Bl(u)+i}).replace(il,"$2$1");for(var n="",r=e.length;r--;)n+=e.charAt(r);return n}function Ey(t){var e=w(t);if(e==="")return"";var n=xl(e).replace(ul,"-");return ol(n)}function Ay(t,e,n,r){var s=w(t),i=w(r),u=Te(e);u<0?(u=s.length+u,u<0&&(u=0)):u>s.length&&(u=s.length);var o=Te(n,s.length-u);return o<0&&(o=0),s.slice(0,u)+i+s.slice(u+o)}function wy(t,e,n){var r=w(t),s,i;if(wn(e)&&wn(n))s=e.split(""),i=n.split("");else{var u=Cy(kt(e,{})),o=Km(u,2);s=o[0],i=o[1]}var a=s.length;if(a===0)return r;for(var c="",d=i.length,l=0;l<r.length;l++){for(var f=!1,m=void 0,y=0;y<a&&y<d;y++){var h=s[y];if(r.substr(l,h.length)===h){f=!0,m=i[y],l=l+h.length-1;break}}c+=f?m:r[l]}return c}function Cy(t){var e=Object.keys(t),n=e.sort(Sy).map(function(r){return t[r]});return[e,n]}function Sy(t,e){return t.length===e.length?0:t.length<e.length?1:-1}function wu(t,e,n){var r=w(t),s=Ie(e);return s===null?!1:s===""?!0:(n=M(n)?0:fe(re(n),0,r.length),r.indexOf(s,n)!==-1)}var vy=Array.prototype.reduce;function Ol(t,e){var n=w(t);if(e===""||n==="")return n;var r=Ie(e);if(M(r))return n.replace(Xm,"");var s=!0;return vy.call(n,function(i,u){return s&&wu(r,u)?i:(s=!1,i+u)},"")}var Fy=Array.prototype.reduceRight;function kl(t,e){var n=w(t);if(e===""||n==="")return n;var r=Ie(e);if(M(r))return n.replace(Zm,"");var s=!0;return Fy.call(n,function(i,u){return s&&wu(r,u)?i:(s=!1,u+i)},"")}function _y(t,e){var n=w(t);if(e===""||n==="")return n;var r=Ie(e);return M(r)?n.trim():kl(Ol(n,r),r)}var xy="width",Ny="newLine",By="indent",Oy="cut";function ky(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=w(t),r=Iy(e),s=r.width,i=r.newLine,u=r.indent,o=r.cut;if(n===""||s<=0)return u;for(var a=n.length,c=n.substring.bind(n),d=0,l="";a-d>s;){if(n[d]===" "){d++;continue}var f=n.lastIndexOf(" ",s+d);f>=d?(l+=u+c(d,f)+i,d=f+1):o?(l+=u+c(d,s+d)+i,d+=s):(f=n.indexOf(" ",s+d),f>=0?(l+=u+c(d,f)+i,d=f+1):(l+=u+c(d),d=a))}return d<a&&(l+=u+c(d)),l}function Iy(t){return{width:Te(t[xy],75),newLine:w(t[Ny],`
|
|
203
|
-
`),indent:w(t[By],""),cut:rl(t[Oy],!1)}}function Ty(t,e,n){if(M(e))return!1;var r=w(t),s=w(e);if(s==="")return!0;n=M(n)?r.length:fe(re(n),0,r.length),n-=s.length;var i=r.indexOf(s,n);return i!==-1&&i===n}function Cu(t){var e=w(t);return cg.test(e)}function Ly(t){var e=w(t);return lg.test(e)}function Py(t){var e=w(t);return e.trim().length===0}function Ry(t){var e=w(t);return eg.test(e)}function qy(t){var e=w(t);return e.length===0}function My(t){var e=w(t);return Cu(e)&&e.toLowerCase()===e}function $y(t){var e=typeof t=="object"&&!M(t)?Number(t):t;return(typeof e=="number"||typeof e=="string")&&!isNaN(e-parseFloat(e))}function jy(t){var e=w(t);return Cu(e)&&e.toUpperCase()===e}function Uy(t,e,n){var r=w(t),s=w(n),i;if(!(e instanceof RegExp)){if(i=Ie(e),i===null)return!1;e=new RegExp(i,s)}return e.test(r)}function Ky(t,e,n){var r=w(t),s=Ie(e);return s===null?!1:s===""?!0:(n=M(n)?0:fe(re(n),0,r.length),r.substr(n,s.length)===s)}function Vy(t){var e=w(t);return e.split("")}function zy(t){for(var e=w(t),n=e.length,r=[],s=0,i;s<n;)i=hl(e,s),r.push(i),s+=i>65535?2:1;return r}function Wy(t){var e=w(t);return kt(e.match(fu),[])}function Jy(t,e,n){var r=w(t);return r.split(e,n)}var Yy="\uFEFF";function Hy(t){var e=w(t);return e===""?"":e[0]===Yy?e.substring(1):e}function Gy(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=0;r&&(s=-e.length+1);var i=t.substr(n+s,e.length);return i.toLowerCase()===e}function Qy(t){for(var e=[],n;(n=ig.exec(t))!==null;)e.push(n[1]);return e}var el=0,tl=1,cu=2;function Xy(t){for(var e=el,n="",r=0;e!==cu;){var s=t[r++].toLowerCase();switch(s){case"<":break;case">":e=cu;break;default:Qm.test(s)?e===tl&&(e=cu):(e===el&&(e=tl),s!=="/"&&(n+=s));break}}return n}var An=0,lt=1,Hr=2,nl=3;function Zy(t,e,n){if(t=w(t),t==="")return"";if(!Array.isArray(e)){var r=w(e);e=r===""?[]:Qy(r)}for(var s=w(n),i=t.length,u=e.length>0,o=Gy.bind(null,t),a=An,c=0,d="",l="",f=null,m=0;m<i;m++){var y=t[m],h=!1;switch(y){case"<":if(f)break;if(o("< ",m,!1)){h=!0;break}if(a===An){h=!0,a=lt;break}if(a===lt){c++;break}h=!0;break;case"!":if(a===lt&&o("<!",m)){a=Hr;break}h=!0;break;case"-":if(a===Hr&&o("!--",m)){a=nl;break}h=!0;break;case'"':case"'":a===lt&&(f===y?f=null:f||(f=y)),h=!0;break;case"E":case"e":if(a===Hr&&o("doctype",m)){a=lt;break}h=!0;break;case">":if(c>0){c--;break}if(f)break;if(a===lt){if(f=null,a=An,u){l+=">";var p=Xy(l);e.indexOf(p.toLowerCase())!==-1?d+=l:d+=s,l=""}else d+=s;break}if(a===Hr||a===nl&&o("-->",m)){f=null,a=An,l="";break}h=!0;break;default:h=!0}if(h)switch(a){case An:d+=y;break;case lt:u&&(l+=y);break}}return d}var Ot=null;function eD(){return Ot!==null||(typeof global=="object"&&global.Object===Object?Ot=global:typeof self=="object"&&self.Object===Object?Ot=self:Ot=new Function("return this")()),Ot}var hu=eD(),tD=hu.v;function nD(){return this===hu.v&&(hu.v=tD),this}var rD="1.4.0",du={camelCase:hg,capitalize:pu,decapitalize:dg,kebabCase:ol,lowerCase:Zr,snakeCase:pg,swapCase:gg,titleCase:Dg,upperCase:mg,count:kg,countGraphemes:Ig,countSubstrings:Tg,countWhere:Pg,countWords:Rg,escapeHtml:iy,escapeRegExp:uy,unescapeHtml:cy,sprintf:Fl,vprintf:ny,indexOf:ly,lastIndexOf:fy,search:hy,charAt:bg,codePointAt:hl,first:vg,graphemeAt:Fg,last:_g,prune:xg,slice:Ng,substr:Bg,substring:Og,truncate:al,insert:dy,latinise:xl,pad:yy,padLeft:Cl,padRight:Sl,repeat:wl,replace:Dy,replaceAll:Nl,reverse:by,reverseGrapheme:Bl,slugify:Ey,splice:Ay,tr:wy,trim:_y,trimLeft:Ol,trimRight:kl,wordWrap:ky,endsWith:Ty,includes:wu,isAlpha:Cu,isAlphaDigit:Ly,isBlank:Py,isDigit:Ry,isEmpty:qy,isLowerCase:My,isNumeric:$y,isString:wn,isUpperCase:jy,matches:Uy,startsWith:Ky,chars:Vy,codePoints:zy,graphemes:Wy,split:Jy,words:Cn,stripBom:Hy,stripTags:Zy,noConflict:nD,version:rD};function ie(t,e){this._wrappedValue=t,this._explicitChain=e}ie.prototype.value=function(){return this._wrappedValue};ie.prototype.valueOf=function(){return this.value()};ie.prototype.toJSON=function(){return this.value()};ie.prototype.toString=function(){return String(this.value())};ie.prototype.chain=function(){return new ie(this._wrappedValue,!0)};ie.prototype.thru=function(t){return typeof t=="function"?new ie(t(this._wrappedValue),this._explicitChain):this};ie.prototype._explicitChain=!0;function sD(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=t.apply(void 0,[this._wrappedValue].concat(n));return this._explicitChain||typeof s=="string"?new ie(s,this._explicitChain):s}}Object.keys(du).forEach(function(t){ie.prototype[t]=sD(du[t])});function iD(t){return new ie(t,!0)}function Il(t){return new ie(t,!1)}lu(Il,du,{chain:iD});var Tl=Il;import Ll from"path";function Pl(t){let e=Ll.extname(t),n=Ll.basename(t,e);return Tl.camelCase(n)}function Su(t){return t.replace(/'/g,"''")}function Rl(t){return t===null?"NULL":`'${Su(String(t))}'`}function ql(){return crypto.randomUUID()}function Ml(){return new Date().toISOString()}async function $l(t,e={}){let n=ns.dirname(t),r=e.projectRoot??process.cwd(),s=await Yu(n,r),i=await oD(n),u="config"in i;return{...s,...i,...u?{}:{config:e.config},secrets:e.secrets??{},globalSecrets:e.globalSecrets??{},env:process.env,include:aD(n,r,e),escape:Su,quote:Rl,json:a=>JSON.stringify(a),now:Ml,uuid:ql}}async function oD(t){let e={},[n,r]=await G(()=>uD(t,{withFileTypes:!0}));if(r||!n)return _e.emit("error",{source:"template",error:r??new Error("Failed to read directory"),context:{dir:t,operation:"scan-data-files"}}),e;for(let s of n){if(!s.isFile()||s.name.startsWith(zn)||s.name.endsWith(".tmpl"))continue;let i=ns.extname(s.name).toLowerCase();if(!Gc(i)||i===".sql")continue;let u=ns.join(t,s.name),o=Pl(s.name),[a,c]=await G(()=>au(u));if(c){_e.emit("error",{source:"template",error:c,context:{filepath:u,operation:"load-data-file"}});continue}e[o]=a,_e.emit("template:load",{filepath:u,format:i})}return e}function aD(t,e,n){return async r=>{let s=ns.resolve(t,r);if(!s.startsWith(e))throw new Error(`Include path escapes project root: ${r}`);if(s.endsWith(".tmpl")){let{processFile:o}=await import("./engine-
|
|
203
|
+
`),indent:w(t[By],""),cut:rl(t[Oy],!1)}}function Ty(t,e,n){if(M(e))return!1;var r=w(t),s=w(e);if(s==="")return!0;n=M(n)?r.length:fe(re(n),0,r.length),n-=s.length;var i=r.indexOf(s,n);return i!==-1&&i===n}function Cu(t){var e=w(t);return cg.test(e)}function Ly(t){var e=w(t);return lg.test(e)}function Py(t){var e=w(t);return e.trim().length===0}function Ry(t){var e=w(t);return eg.test(e)}function qy(t){var e=w(t);return e.length===0}function My(t){var e=w(t);return Cu(e)&&e.toLowerCase()===e}function $y(t){var e=typeof t=="object"&&!M(t)?Number(t):t;return(typeof e=="number"||typeof e=="string")&&!isNaN(e-parseFloat(e))}function jy(t){var e=w(t);return Cu(e)&&e.toUpperCase()===e}function Uy(t,e,n){var r=w(t),s=w(n),i;if(!(e instanceof RegExp)){if(i=Ie(e),i===null)return!1;e=new RegExp(i,s)}return e.test(r)}function Ky(t,e,n){var r=w(t),s=Ie(e);return s===null?!1:s===""?!0:(n=M(n)?0:fe(re(n),0,r.length),r.substr(n,s.length)===s)}function Vy(t){var e=w(t);return e.split("")}function zy(t){for(var e=w(t),n=e.length,r=[],s=0,i;s<n;)i=hl(e,s),r.push(i),s+=i>65535?2:1;return r}function Wy(t){var e=w(t);return kt(e.match(fu),[])}function Jy(t,e,n){var r=w(t);return r.split(e,n)}var Yy="\uFEFF";function Hy(t){var e=w(t);return e===""?"":e[0]===Yy?e.substring(1):e}function Gy(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=0;r&&(s=-e.length+1);var i=t.substr(n+s,e.length);return i.toLowerCase()===e}function Qy(t){for(var e=[],n;(n=ig.exec(t))!==null;)e.push(n[1]);return e}var el=0,tl=1,cu=2;function Xy(t){for(var e=el,n="",r=0;e!==cu;){var s=t[r++].toLowerCase();switch(s){case"<":break;case">":e=cu;break;default:Qm.test(s)?e===tl&&(e=cu):(e===el&&(e=tl),s!=="/"&&(n+=s));break}}return n}var An=0,lt=1,Hr=2,nl=3;function Zy(t,e,n){if(t=w(t),t==="")return"";if(!Array.isArray(e)){var r=w(e);e=r===""?[]:Qy(r)}for(var s=w(n),i=t.length,u=e.length>0,o=Gy.bind(null,t),a=An,c=0,d="",l="",f=null,m=0;m<i;m++){var y=t[m],h=!1;switch(y){case"<":if(f)break;if(o("< ",m,!1)){h=!0;break}if(a===An){h=!0,a=lt;break}if(a===lt){c++;break}h=!0;break;case"!":if(a===lt&&o("<!",m)){a=Hr;break}h=!0;break;case"-":if(a===Hr&&o("!--",m)){a=nl;break}h=!0;break;case'"':case"'":a===lt&&(f===y?f=null:f||(f=y)),h=!0;break;case"E":case"e":if(a===Hr&&o("doctype",m)){a=lt;break}h=!0;break;case">":if(c>0){c--;break}if(f)break;if(a===lt){if(f=null,a=An,u){l+=">";var p=Xy(l);e.indexOf(p.toLowerCase())!==-1?d+=l:d+=s,l=""}else d+=s;break}if(a===Hr||a===nl&&o("-->",m)){f=null,a=An,l="";break}h=!0;break;default:h=!0}if(h)switch(a){case An:d+=y;break;case lt:u&&(l+=y);break}}return d}var Ot=null;function eD(){return Ot!==null||(typeof global=="object"&&global.Object===Object?Ot=global:typeof self=="object"&&self.Object===Object?Ot=self:Ot=new Function("return this")()),Ot}var hu=eD(),tD=hu.v;function nD(){return this===hu.v&&(hu.v=tD),this}var rD="1.4.0",du={camelCase:hg,capitalize:pu,decapitalize:dg,kebabCase:ol,lowerCase:Zr,snakeCase:pg,swapCase:gg,titleCase:Dg,upperCase:mg,count:kg,countGraphemes:Ig,countSubstrings:Tg,countWhere:Pg,countWords:Rg,escapeHtml:iy,escapeRegExp:uy,unescapeHtml:cy,sprintf:Fl,vprintf:ny,indexOf:ly,lastIndexOf:fy,search:hy,charAt:bg,codePointAt:hl,first:vg,graphemeAt:Fg,last:_g,prune:xg,slice:Ng,substr:Bg,substring:Og,truncate:al,insert:dy,latinise:xl,pad:yy,padLeft:Cl,padRight:Sl,repeat:wl,replace:Dy,replaceAll:Nl,reverse:by,reverseGrapheme:Bl,slugify:Ey,splice:Ay,tr:wy,trim:_y,trimLeft:Ol,trimRight:kl,wordWrap:ky,endsWith:Ty,includes:wu,isAlpha:Cu,isAlphaDigit:Ly,isBlank:Py,isDigit:Ry,isEmpty:qy,isLowerCase:My,isNumeric:$y,isString:wn,isUpperCase:jy,matches:Uy,startsWith:Ky,chars:Vy,codePoints:zy,graphemes:Wy,split:Jy,words:Cn,stripBom:Hy,stripTags:Zy,noConflict:nD,version:rD};function ie(t,e){this._wrappedValue=t,this._explicitChain=e}ie.prototype.value=function(){return this._wrappedValue};ie.prototype.valueOf=function(){return this.value()};ie.prototype.toJSON=function(){return this.value()};ie.prototype.toString=function(){return String(this.value())};ie.prototype.chain=function(){return new ie(this._wrappedValue,!0)};ie.prototype.thru=function(t){return typeof t=="function"?new ie(t(this._wrappedValue),this._explicitChain):this};ie.prototype._explicitChain=!0;function sD(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=t.apply(void 0,[this._wrappedValue].concat(n));return this._explicitChain||typeof s=="string"?new ie(s,this._explicitChain):s}}Object.keys(du).forEach(function(t){ie.prototype[t]=sD(du[t])});function iD(t){return new ie(t,!0)}function Il(t){return new ie(t,!1)}lu(Il,du,{chain:iD});var Tl=Il;import Ll from"path";function Pl(t){let e=Ll.extname(t),n=Ll.basename(t,e);return Tl.camelCase(n)}function Su(t){return t.replace(/'/g,"''")}function Rl(t){return t===null?"NULL":`'${Su(String(t))}'`}function ql(){return crypto.randomUUID()}function Ml(){return new Date().toISOString()}async function $l(t,e={}){let n=ns.dirname(t),r=e.projectRoot??process.cwd(),s=await Yu(n,r),i=await oD(n),u="config"in i;return{...s,...i,...u?{}:{config:e.config},secrets:e.secrets??{},globalSecrets:e.globalSecrets??{},env:process.env,include:aD(n,r,e),escape:Su,quote:Rl,json:a=>JSON.stringify(a),now:Ml,uuid:ql}}async function oD(t){let e={},[n,r]=await G(()=>uD(t,{withFileTypes:!0}));if(r||!n)return _e.emit("error",{source:"template",error:r??new Error("Failed to read directory"),context:{dir:t,operation:"scan-data-files"}}),e;for(let s of n){if(!s.isFile()||s.name.startsWith(zn)||s.name.endsWith(".tmpl"))continue;let i=ns.extname(s.name).toLowerCase();if(!Gc(i)||i===".sql")continue;let u=ns.join(t,s.name),o=Pl(s.name),[a,c]=await G(()=>au(u));if(c){_e.emit("error",{source:"template",error:c,context:{filepath:u,operation:"load-data-file"}});continue}e[o]=a,_e.emit("template:load",{filepath:u,format:i})}return e}function aD(t,e,n){return async r=>{let s=ns.resolve(t,r);if(!s.startsWith(e))throw new Error(`Include path escapes project root: ${r}`);if(s.endsWith(".tmpl")){let{processFile:o}=await import("./engine-OB3KW3J3.js");return(await o(s,n)).sql}let[i,u]=await G(()=>au(s));if(u)throw new Error(`Failed to include '${r}': ${u.message}`);return typeof i=="string"?i:JSON.stringify(i)}}var lD=new Iu({tags:["{%","%}"],varName:"$",autoEscape:!1,useWith:!1,cache:!1});function fD(t){return t.endsWith(Wu)}async function hD(t,e){return lD.renderStringAsync(t,e)}async function dD(t,e={}){let n=await cD(t,"utf-8");if(!fD(t))return{sql:n,isTemplate:!1};let r=performance.now(),s=await $l(t,e),i=await hD(n,s),u=performance.now()-r;return _e.emit("template:render",{filepath:t,durationMs:u}),{sql:i,isTemplate:!0,durationMs:u}}async function xC(t,e={}){let n=[];for(let r of t){let s=await dD(r,e);n.push(s)}return n}export{Z as a,Lt as b,G as c,ce as d,me as e,y1 as f,nE as g,_e as h,jc as i,Tl as j,$l as k,lD as l,fD as m,hD as n,dD as o,xC as p};
|
|
204
204
|
/*! Bundled license information:
|
|
205
205
|
|
|
206
206
|
voca/es/index.js:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{l as a,m as b,n as c,o as d,p as e}from"./chunk-ZVSL653B.js";import"./chunk-UR6MHSHU.js";export{a as eta,b as isTemplate,d as processFile,e as processFiles,c as renderTemplate};
|