twenty-sdk 2.10.0 → 2.12.0
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/{catalog-sync-BHD2q_KA.mjs → catalog-sync-DmIzcse2.mjs} +1 -1
- package/dist/{catalog-sync-Dp2RKu2c.js → catalog-sync-GJcaViDU.js} +1 -1
- package/dist/cli/commands/dev/dev-once.d.ts +1 -0
- package/dist/cli/commands/dev/generate-client.d.ts +6 -0
- package/dist/cli/operations/dev-once.d.ts +1 -0
- package/dist/cli/utilities/api/api-response-type.d.ts +5 -5
- package/dist/cli/utilities/api/api-service.d.ts +8 -2
- package/dist/cli/utilities/api/application-api.d.ts +7 -1
- package/dist/cli/utilities/api/file-api.d.ts +2 -1
- package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state.d.ts +1 -0
- package/dist/cli/utilities/dev/orchestrator/steps/format-sync-actions-summary.d.ts +3 -0
- package/dist/cli/utilities/dev/ui/components/dev-ui-application-panel.d.ts +2 -1
- package/dist/cli/utilities/dev/ui/components/dev-ui-entity-section.d.ts +3 -0
- package/dist/cli/utilities/dev/ui/components/dev-ui.d.ts +1 -1
- package/dist/cli/utilities/dev/ui/dev-ui-constants.d.ts +6 -0
- package/dist/cli/utilities/entity/entity-field-template.d.ts +5 -1
- package/dist/cli/utilities/error/format-manifest-validation-errors.d.ts +2 -1
- package/dist/cli/utilities/error/get-sync-error-recovery-hint.d.ts +1 -0
- package/dist/cli.cjs +107 -87
- package/dist/cli.mjs +2712 -2546
- package/dist/define/index.cjs +10 -10
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +1 -0
- package/dist/define/index.mjs +568 -566
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +5 -5
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.mjs +126 -123
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/{get-function-input-schema-DTlcRJz3-BweFaTLz.mjs → get-function-input-schema-DTlcRJz3-B0eNO1qG.mjs} +1 -1
- package/dist/{get-function-input-schema-DTlcRJz3-DWdkAlue.js → get-function-input-schema-DTlcRJz3-DAkVg26G.js} +1 -1
- package/dist/{login-oauth-BPSmh2dn.mjs → login-oauth-C0VXFL7H.mjs} +2747 -2675
- package/dist/{login-oauth-DnF6U1Ak.js → login-oauth-DzHcV9F2.js} +61 -51
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +2 -2
- package/dist/ui/index.cjs +25 -25
- package/dist/ui/index.d.ts +12 -12
- package/dist/ui/index.mjs +5414 -5425
- package/package.json +7 -10
package/dist/cli.cjs
CHANGED
|
@@ -1,48 +1,61 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
Update with: npm install -g twenty-sdk@${f}`)),console.warn(""))};class
|
|
4
|
-
`));const c=await
|
|
5
|
-
`));const f=
|
|
6
|
-
✓ Published ${
|
|
7
|
-
`)),console.log(" To install deployed application: `yarn twenty app:install`")}}class
|
|
8
|
-
`));const f=await
|
|
9
|
-
`)),r&&!await this.confirmationPrompt()&&(console.error(y.default.red("⛔️ Aborting uninstall")),process.exit(1));const f=await m.appUninstall({appPath:s});return f.success?(console.log(y.default.green("✅ Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(y.default.red("❌ Uninstall failed:"),f.error.message),{success:!1,error:f.error.message})}async confirmationPrompt(){const{confirmation:s}=await Je.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}const Em=l=>{const s=new tu,r=new nu,c=new ru;l.command("app:publish [appPath]").description("Build and publish to npm (default) or server registry").option("--private","Push to a Twenty server's registry instead of npm").option("-r, --remote <name>","Publish to a specific remote (with --private)").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(f,S)=>{await s.execute({appPath:he(f),private:S.private,remote:S.remote,tag:S.tag})}),l.command("app:install [appPath]").description("Install a deployed app on the server").option("-r, --remote <name>","Install on a specific remote").action(async(f,S)=>{await r.execute({appPath:he(f),remote:S.remote})}),l.command("app:uninstall [appPath]").description("Uninstall app from server").option("-y, --yes","Skip confirmation prompt").action(async(f,S)=>{try{const E=await c.execute({appPath:he(f),askForConfirmation:!S?.yes});process.exit(E.success?0:1)}catch{process.exit(1)}})};var Cn={exports:{}};var Am=Cn.exports,No;function bm(){return No||(No=1,(function(l,s){(function(){var r,c="4.17.21",f=200,S="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",E="Expected a function",C="Invalid `variable` option passed into `_.template`",P="__lodash_hash_undefined__",O=500,G="__lodash_placeholder__",J=1,se=2,Fe=4,Ve=1,Ye=2,Ie=1,Ze=2,Rn=4,$e=8,Ct=16,xe=32,Ee=64,st=128,rn=256,Er=512,pu=30,hu="...",gu=800,mu=16,Xi=1,vu=2,yu=3,Tt=1/0,mt=9007199254740991,_u=17976931348623157e292,Pn=NaN,Xe=4294967295,wu=Xe-1,Su=Xe>>>1,Iu=[["ary",st],["bind",Ie],["bindKey",Ze],["curry",$e],["curryRight",Ct],["flip",Er],["partial",xe],["partialRight",Ee],["rearg",rn]],Wt="[object Arguments]",Fn="[object Array]",xu="[object AsyncFunction]",sn="[object Boolean]",an="[object Date]",Eu="[object DOMException]",$n="[object Error]",Ln="[object Function]",Qi="[object GeneratorFunction]",Ge="[object Map]",on="[object Number]",Au="[object Null]",at="[object Object]",es="[object Promise]",bu="[object Proxy]",un="[object RegExp]",qe="[object Set]",ln="[object String]",Nn="[object Symbol]",Cu="[object Undefined]",cn="[object WeakMap]",Tu="[object WeakSet]",fn="[object ArrayBuffer]",Bt="[object DataView]",Ar="[object Float32Array]",br="[object Float64Array]",Cr="[object Int8Array]",Tr="[object Int16Array]",Rr="[object Int32Array]",Pr="[object Uint8Array]",Fr="[object Uint8ClampedArray]",$r="[object Uint16Array]",Lr="[object Uint32Array]",Ru=/\b__p \+= '';/g,Pu=/\b(__p \+=) '' \+/g,Fu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ts=/&(?:amp|lt|gt|quot|#39);/g,ns=/[&<>"']/g,$u=RegExp(ts.source),Lu=RegExp(ns.source),Nu=/<%-([\s\S]+?)%>/g,Ou=/<%([\s\S]+?)%>/g,rs=/<%=([\s\S]+?)%>/g,Uu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Du=/^\w*$/,Mu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nr=/[\\^$.*+?()[\]{}|]/g,Wu=RegExp(Nr.source),Or=/^\s+/,Bu=/\s/,ku=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Vu=/\{\n\/\* \[wrapped with (.+)\] \*/,Gu=/,? & /,qu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Hu=/[()=,{}\[\]\/\s]/,zu=/\\(\\)?/g,Ku=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,is=/\w*$/,ju=/^[-+]0x[0-9a-f]+$/i,Ju=/^0b[01]+$/i,Yu=/^\[object .+?Constructor\]$/,Zu=/^0o[0-7]+$/i,Xu=/^(?:0|[1-9]\d*)$/,Qu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,On=/($^)/,el=/['\n\r\u2028\u2029\\]/g,Un="\\ud800-\\udfff",tl="\\u0300-\\u036f",nl="\\ufe20-\\ufe2f",rl="\\u20d0-\\u20ff",ss=tl+nl+rl,as="\\u2700-\\u27bf",os="a-z\\xdf-\\xf6\\xf8-\\xff",il="\\xac\\xb1\\xd7\\xf7",sl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",al="\\u2000-\\u206f",ol=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",us="A-Z\\xc0-\\xd6\\xd8-\\xde",ls="\\ufe0e\\ufe0f",cs=il+sl+al+ol,Ur="['’]",ul="["+Un+"]",fs="["+cs+"]",Dn="["+ss+"]",ds="\\d+",ll="["+as+"]",ps="["+os+"]",hs="[^"+Un+cs+ds+as+os+us+"]",Dr="\\ud83c[\\udffb-\\udfff]",cl="(?:"+Dn+"|"+Dr+")",gs="[^"+Un+"]",Mr="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",kt="["+us+"]",ms="\\u200d",vs="(?:"+ps+"|"+hs+")",fl="(?:"+kt+"|"+hs+")",ys="(?:"+Ur+"(?:d|ll|m|re|s|t|ve))?",_s="(?:"+Ur+"(?:D|LL|M|RE|S|T|VE))?",ws=cl+"?",Ss="["+ls+"]?",dl="(?:"+ms+"(?:"+[gs,Mr,Wr].join("|")+")"+Ss+ws+")*",pl="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",hl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Is=Ss+ws+dl,gl="(?:"+[ll,Mr,Wr].join("|")+")"+Is,ml="(?:"+[gs+Dn+"?",Dn,Mr,Wr,ul].join("|")+")",vl=RegExp(Ur,"g"),yl=RegExp(Dn,"g"),Br=RegExp(Dr+"(?="+Dr+")|"+ml+Is,"g"),_l=RegExp([kt+"?"+ps+"+"+ys+"(?="+[fs,kt,"$"].join("|")+")",fl+"+"+_s+"(?="+[fs,kt+vs,"$"].join("|")+")",kt+"?"+vs+"+"+ys,kt+"+"+_s,hl,pl,ds,gl].join("|"),"g"),wl=RegExp("["+ms+Un+ss+ls+"]"),Sl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Il=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xl=-1,Q={};Q[Ar]=Q[br]=Q[Cr]=Q[Tr]=Q[Rr]=Q[Pr]=Q[Fr]=Q[$r]=Q[Lr]=!0,Q[Wt]=Q[Fn]=Q[fn]=Q[sn]=Q[Bt]=Q[an]=Q[$n]=Q[Ln]=Q[Ge]=Q[on]=Q[at]=Q[un]=Q[qe]=Q[ln]=Q[cn]=!1;var Y={};Y[Wt]=Y[Fn]=Y[fn]=Y[Bt]=Y[sn]=Y[an]=Y[Ar]=Y[br]=Y[Cr]=Y[Tr]=Y[Rr]=Y[Ge]=Y[on]=Y[at]=Y[un]=Y[qe]=Y[ln]=Y[Nn]=Y[Pr]=Y[Fr]=Y[$r]=Y[Lr]=!0,Y[$n]=Y[Ln]=Y[cn]=!1;var El={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Al={"&":"&","<":"<",">":">",'"':""","'":"'"},bl={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tl=parseFloat,Rl=parseInt,xs=typeof m.commonjsGlobal=="object"&&m.commonjsGlobal&&m.commonjsGlobal.Object===Object&&m.commonjsGlobal,Pl=typeof self=="object"&&self&&self.Object===Object&&self,ce=xs||Pl||Function("return this")(),kr=s&&!s.nodeType&&s,Rt=kr&&!0&&l&&!l.nodeType&&l,Es=Rt&&Rt.exports===kr,Vr=Es&&xs.process,Le=(function(){try{var h=Rt&&Rt.require&&Rt.require("util").types;return h||Vr&&Vr.binding&&Vr.binding("util")}catch{}})(),As=Le&&Le.isArrayBuffer,bs=Le&&Le.isDate,Cs=Le&&Le.isMap,Ts=Le&&Le.isRegExp,Rs=Le&&Le.isSet,Ps=Le&&Le.isTypedArray;function Ae(h,_,v){switch(v.length){case 0:return h.call(_);case 1:return h.call(_,v[0]);case 2:return h.call(_,v[0],v[1]);case 3:return h.call(_,v[0],v[1],v[2])}return h.apply(_,v)}function Fl(h,_,v,b){for(var N=-1,H=h==null?0:h.length;++N<H;){var ae=h[N];_(b,ae,v(ae),h)}return b}function Ne(h,_){for(var v=-1,b=h==null?0:h.length;++v<b&&_(h[v],v,h)!==!1;);return h}function $l(h,_){for(var v=h==null?0:h.length;v--&&_(h[v],v,h)!==!1;);return h}function Fs(h,_){for(var v=-1,b=h==null?0:h.length;++v<b;)if(!_(h[v],v,h))return!1;return!0}function vt(h,_){for(var v=-1,b=h==null?0:h.length,N=0,H=[];++v<b;){var ae=h[v];_(ae,v,h)&&(H[N++]=ae)}return H}function Mn(h,_){var v=h==null?0:h.length;return!!v&&Vt(h,_,0)>-1}function Gr(h,_,v){for(var b=-1,N=h==null?0:h.length;++b<N;)if(v(_,h[b]))return!0;return!1}function ee(h,_){for(var v=-1,b=h==null?0:h.length,N=Array(b);++v<b;)N[v]=_(h[v],v,h);return N}function yt(h,_){for(var v=-1,b=_.length,N=h.length;++v<b;)h[N+v]=_[v];return h}function qr(h,_,v,b){var N=-1,H=h==null?0:h.length;for(b&&H&&(v=h[++N]);++N<H;)v=_(v,h[N],N,h);return v}function Ll(h,_,v,b){var N=h==null?0:h.length;for(b&&N&&(v=h[--N]);N--;)v=_(v,h[N],N,h);return v}function Hr(h,_){for(var v=-1,b=h==null?0:h.length;++v<b;)if(_(h[v],v,h))return!0;return!1}var Nl=zr("length");function Ol(h){return h.split("")}function Ul(h){return h.match(qu)||[]}function $s(h,_,v){var b;return v(h,function(N,H,ae){if(_(N,H,ae))return b=H,!1}),b}function Wn(h,_,v,b){for(var N=h.length,H=v+(b?1:-1);b?H--:++H<N;)if(_(h[H],H,h))return H;return-1}function Vt(h,_,v){return _===_?jl(h,_,v):Wn(h,Ls,v)}function Dl(h,_,v,b){for(var N=v-1,H=h.length;++N<H;)if(b(h[N],_))return N;return-1}function Ls(h){return h!==h}function Ns(h,_){var v=h==null?0:h.length;return v?jr(h,_)/v:Pn}function zr(h){return function(_){return _==null?r:_[h]}}function Kr(h){return function(_){return h==null?r:h[_]}}function Os(h,_,v,b,N){return N(h,function(H,ae,j){v=b?(b=!1,H):_(v,H,ae,j)}),v}function Ml(h,_){var v=h.length;for(h.sort(_);v--;)h[v]=h[v].value;return h}function jr(h,_){for(var v,b=-1,N=h.length;++b<N;){var H=_(h[b]);H!==r&&(v=v===r?H:v+H)}return v}function Jr(h,_){for(var v=-1,b=Array(h);++v<h;)b[v]=_(v);return b}function Wl(h,_){return ee(_,function(v){return[v,h[v]]})}function Us(h){return h&&h.slice(0,Bs(h)+1).replace(Or,"")}function be(h){return function(_){return h(_)}}function Yr(h,_){return ee(_,function(v){return h[v]})}function dn(h,_){return h.has(_)}function Ds(h,_){for(var v=-1,b=h.length;++v<b&&Vt(_,h[v],0)>-1;);return v}function Ms(h,_){for(var v=h.length;v--&&Vt(_,h[v],0)>-1;);return v}function Bl(h,_){for(var v=h.length,b=0;v--;)h[v]===_&&++b;return b}var kl=Kr(El),Vl=Kr(Al);function Gl(h){return"\\"+Cl[h]}function ql(h,_){return h==null?r:h[_]}function Gt(h){return wl.test(h)}function Hl(h){return Sl.test(h)}function zl(h){for(var _,v=[];!(_=h.next()).done;)v.push(_.value);return v}function Zr(h){var _=-1,v=Array(h.size);return h.forEach(function(b,N){v[++_]=[N,b]}),v}function Ws(h,_){return function(v){return h(_(v))}}function _t(h,_){for(var v=-1,b=h.length,N=0,H=[];++v<b;){var ae=h[v];(ae===_||ae===G)&&(h[v]=G,H[N++]=v)}return H}function Bn(h){var _=-1,v=Array(h.size);return h.forEach(function(b){v[++_]=b}),v}function Kl(h){var _=-1,v=Array(h.size);return h.forEach(function(b){v[++_]=[b,b]}),v}function jl(h,_,v){for(var b=v-1,N=h.length;++b<N;)if(h[b]===_)return b;return-1}function Jl(h,_,v){for(var b=v+1;b--;)if(h[b]===_)return b;return b}function qt(h){return Gt(h)?Zl(h):Nl(h)}function He(h){return Gt(h)?Xl(h):Ol(h)}function Bs(h){for(var _=h.length;_--&&Bu.test(h.charAt(_)););return _}var Yl=Kr(bl);function Zl(h){for(var _=Br.lastIndex=0;Br.test(h);)++_;return _}function Xl(h){return h.match(Br)||[]}function Ql(h){return h.match(_l)||[]}var ec=(function h(_){_=_==null?ce:Ht.defaults(ce.Object(),_,Ht.pick(ce,Il));var v=_.Array,b=_.Date,N=_.Error,H=_.Function,ae=_.Math,j=_.Object,Xr=_.RegExp,tc=_.String,Oe=_.TypeError,kn=v.prototype,nc=H.prototype,zt=j.prototype,Vn=_["__core-js_shared__"],Gn=nc.toString,K=zt.hasOwnProperty,rc=0,ks=(function(){var e=/[^.]+$/.exec(Vn&&Vn.keys&&Vn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),qn=zt.toString,ic=Gn.call(j),sc=ce._,ac=Xr("^"+Gn.call(K).replace(Nr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=Es?_.Buffer:r,wt=_.Symbol,zn=_.Uint8Array,Vs=Hn?Hn.allocUnsafe:r,Kn=Ws(j.getPrototypeOf,j),Gs=j.create,qs=zt.propertyIsEnumerable,jn=kn.splice,Hs=wt?wt.isConcatSpreadable:r,pn=wt?wt.iterator:r,Pt=wt?wt.toStringTag:r,Jn=(function(){try{var e=Ot(j,"defineProperty");return e({},"",{}),e}catch{}})(),oc=_.clearTimeout!==ce.clearTimeout&&_.clearTimeout,uc=b&&b.now!==ce.Date.now&&b.now,lc=_.setTimeout!==ce.setTimeout&&_.setTimeout,Yn=ae.ceil,Zn=ae.floor,Qr=j.getOwnPropertySymbols,cc=Hn?Hn.isBuffer:r,zs=_.isFinite,fc=kn.join,dc=Ws(j.keys,j),oe=ae.max,de=ae.min,pc=b.now,hc=_.parseInt,Ks=ae.random,gc=kn.reverse,ei=Ot(_,"DataView"),hn=Ot(_,"Map"),ti=Ot(_,"Promise"),Kt=Ot(_,"Set"),gn=Ot(_,"WeakMap"),mn=Ot(j,"create"),Xn=gn&&new gn,jt={},mc=Ut(ei),vc=Ut(hn),yc=Ut(ti),_c=Ut(Kt),wc=Ut(gn),Qn=wt?wt.prototype:r,vn=Qn?Qn.valueOf:r,js=Qn?Qn.toString:r;function o(e){if(ne(e)&&!U(e)&&!(e instanceof k)){if(e instanceof Ue)return e;if(K.call(e,"__wrapped__"))return Ja(e)}return new Ue(e)}var Jt=(function(){function e(){}return function(t){if(!te(t))return{};if(Gs)return Gs(t);e.prototype=t;var n=new e;return e.prototype=r,n}})();function er(){}function Ue(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}o.templateSettings={escape:Nu,evaluate:Ou,interpolate:rs,variable:"",imports:{_:o}},o.prototype=er.prototype,o.prototype.constructor=o,Ue.prototype=Jt(er.prototype),Ue.prototype.constructor=Ue;function k(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Xe,this.__views__=[]}function Sc(){var e=new k(this.__wrapped__);return e.__actions__=ye(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ye(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ye(this.__views__),e}function Ic(){if(this.__filtered__){var e=new k(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function xc(){var e=this.__wrapped__.value(),t=this.__dir__,n=U(e),i=t<0,a=n?e.length:0,u=Uf(0,a,this.__views__),d=u.start,p=u.end,g=p-d,w=i?p:d-1,I=this.__iteratees__,x=I.length,A=0,R=de(g,this.__takeCount__);if(!n||!i&&a==g&&R==g)return ya(e,this.__actions__);var $=[];e:for(;g--&&A<R;){w+=t;for(var M=-1,L=e[w];++M<x;){var B=I[M],V=B.iteratee,Re=B.type,ve=V(L);if(Re==vu)L=ve;else if(!ve){if(Re==Xi)continue e;break e}}$[A++]=L}return $}k.prototype=Jt(er.prototype),k.prototype.constructor=k;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Ec(){this.__data__=mn?mn(null):{},this.size=0}function Ac(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function bc(e){var t=this.__data__;if(mn){var n=t[e];return n===P?r:n}return K.call(t,e)?t[e]:r}function Cc(e){var t=this.__data__;return mn?t[e]!==r:K.call(t,e)}function Tc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=mn&&t===r?P:t,this}Ft.prototype.clear=Ec,Ft.prototype.delete=Ac,Ft.prototype.get=bc,Ft.prototype.has=Cc,Ft.prototype.set=Tc;function ot(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Rc(){this.__data__=[],this.size=0}function Pc(e){var t=this.__data__,n=tr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():jn.call(t,n,1),--this.size,!0}function Fc(e){var t=this.__data__,n=tr(t,e);return n<0?r:t[n][1]}function $c(e){return tr(this.__data__,e)>-1}function Lc(e,t){var n=this.__data__,i=tr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}ot.prototype.clear=Rc,ot.prototype.delete=Pc,ot.prototype.get=Fc,ot.prototype.has=$c,ot.prototype.set=Lc;function ut(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Nc(){this.size=0,this.__data__={hash:new Ft,map:new(hn||ot),string:new Ft}}function Oc(e){var t=pr(this,e).delete(e);return this.size-=t?1:0,t}function Uc(e){return pr(this,e).get(e)}function Dc(e){return pr(this,e).has(e)}function Mc(e,t){var n=pr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}ut.prototype.clear=Nc,ut.prototype.delete=Oc,ut.prototype.get=Uc,ut.prototype.has=Dc,ut.prototype.set=Mc;function $t(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new ut;++t<n;)this.add(e[t])}function Wc(e){return this.__data__.set(e,P),this}function Bc(e){return this.__data__.has(e)}$t.prototype.add=$t.prototype.push=Wc,$t.prototype.has=Bc;function ze(e){var t=this.__data__=new ot(e);this.size=t.size}function kc(){this.__data__=new ot,this.size=0}function Vc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Gc(e){return this.__data__.get(e)}function qc(e){return this.__data__.has(e)}function Hc(e,t){var n=this.__data__;if(n instanceof ot){var i=n.__data__;if(!hn||i.length<f-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ut(i)}return n.set(e,t),this.size=n.size,this}ze.prototype.clear=kc,ze.prototype.delete=Vc,ze.prototype.get=Gc,ze.prototype.has=qc,ze.prototype.set=Hc;function Js(e,t){var n=U(e),i=!n&&Dt(e),a=!n&&!i&&At(e),u=!n&&!i&&!a&&Qt(e),d=n||i||a||u,p=d?Jr(e.length,tc):[],g=p.length;for(var w in e)(t||K.call(e,w))&&!(d&&(w=="length"||a&&(w=="offset"||w=="parent")||u&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||dt(w,g)))&&p.push(w);return p}function Ys(e){var t=e.length;return t?e[di(0,t-1)]:r}function zc(e,t){return hr(ye(e),Lt(t,0,e.length))}function Kc(e){return hr(ye(e))}function ni(e,t,n){(n!==r&&!Ke(e[t],n)||n===r&&!(t in e))&<(e,t,n)}function yn(e,t,n){var i=e[t];(!(K.call(e,t)&&Ke(i,n))||n===r&&!(t in e))&<(e,t,n)}function tr(e,t){for(var n=e.length;n--;)if(Ke(e[n][0],t))return n;return-1}function jc(e,t,n,i){return St(e,function(a,u,d){t(i,a,n(a),d)}),i}function Zs(e,t){return e&&et(t,ue(t),e)}function Jc(e,t){return e&&et(t,we(t),e)}function lt(e,t,n){t=="__proto__"&&Jn?Jn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ri(e,t){for(var n=-1,i=t.length,a=v(i),u=e==null;++n<i;)a[n]=u?r:Di(e,t[n]);return a}function Lt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function De(e,t,n,i,a,u){var d,p=t&J,g=t&se,w=t&Fe;if(n&&(d=a?n(e,i,a,u):n(e)),d!==r)return d;if(!te(e))return e;var I=U(e);if(I){if(d=Mf(e),!p)return ye(e,d)}else{var x=pe(e),A=x==Ln||x==Qi;if(At(e))return Sa(e,p);if(x==at||x==Wt||A&&!a){if(d=g||A?{}:Ba(e),!p)return g?Cf(e,Jc(d,e)):bf(e,Zs(d,e))}else{if(!Y[x])return a?e:{};d=Wf(e,x,p)}}u||(u=new ze);var R=u.get(e);if(R)return R;u.set(e,d),mo(e)?e.forEach(function(L){d.add(De(L,t,n,L,e,u))}):ho(e)&&e.forEach(function(L,B){d.set(B,De(L,t,n,B,e,u))});var $=w?g?xi:Ii:g?we:ue,M=I?r:$(e);return Ne(M||e,function(L,B){M&&(B=L,L=e[B]),yn(d,B,De(L,t,n,B,e,u))}),d}function Yc(e){var t=ue(e);return function(n){return Xs(n,e,t)}}function Xs(e,t,n){var i=n.length;if(e==null)return!i;for(e=j(e);i--;){var a=n[i],u=t[a],d=e[a];if(d===r&&!(a in e)||!u(d))return!1}return!0}function Qs(e,t,n){if(typeof e!="function")throw new Oe(E);return An(function(){e.apply(r,n)},t)}function _n(e,t,n,i){var a=-1,u=Mn,d=!0,p=e.length,g=[],w=t.length;if(!p)return g;n&&(t=ee(t,be(n))),i?(u=Gr,d=!1):t.length>=f&&(u=dn,d=!1,t=new $t(t));e:for(;++a<p;){var I=e[a],x=n==null?I:n(I);if(I=i||I!==0?I:0,d&&x===x){for(var A=w;A--;)if(t[A]===x)continue e;g.push(I)}else u(t,x,i)||g.push(I)}return g}var St=ba(Qe),ea=ba(si,!0);function Zc(e,t){var n=!0;return St(e,function(i,a,u){return n=!!t(i,a,u),n}),n}function nr(e,t,n){for(var i=-1,a=e.length;++i<a;){var u=e[i],d=t(u);if(d!=null&&(p===r?d===d&&!Te(d):n(d,p)))var p=d,g=u}return g}function Xc(e,t,n,i){var a=e.length;for(n=D(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:D(i),i<0&&(i+=a),i=n>i?0:yo(i);n<i;)e[n++]=t;return e}function ta(e,t){var n=[];return St(e,function(i,a,u){t(i,a,u)&&n.push(i)}),n}function fe(e,t,n,i,a){var u=-1,d=e.length;for(n||(n=kf),a||(a=[]);++u<d;){var p=e[u];t>0&&n(p)?t>1?fe(p,t-1,n,i,a):yt(a,p):i||(a[a.length]=p)}return a}var ii=Ca(),na=Ca(!0);function Qe(e,t){return e&&ii(e,t,ue)}function si(e,t){return e&&na(e,t,ue)}function rr(e,t){return vt(t,function(n){return pt(e[n])})}function Nt(e,t){t=xt(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[tt(t[n++])];return n&&n==i?e:r}function ra(e,t,n){var i=t(e);return U(e)?i:yt(i,n(e))}function ge(e){return e==null?e===r?Cu:Au:Pt&&Pt in j(e)?Of(e):jf(e)}function ai(e,t){return e>t}function Qc(e,t){return e!=null&&K.call(e,t)}function ef(e,t){return e!=null&&t in j(e)}function tf(e,t,n){return e>=de(t,n)&&e<oe(t,n)}function oi(e,t,n){for(var i=n?Gr:Mn,a=e[0].length,u=e.length,d=u,p=v(u),g=1/0,w=[];d--;){var I=e[d];d&&t&&(I=ee(I,be(t))),g=de(I.length,g),p[d]=!n&&(t||a>=120&&I.length>=120)?new $t(d&&I):r}I=e[0];var x=-1,A=p[0];e:for(;++x<a&&w.length<g;){var R=I[x],$=t?t(R):R;if(R=n||R!==0?R:0,!(A?dn(A,$):i(w,$,n))){for(d=u;--d;){var M=p[d];if(!(M?dn(M,$):i(e[d],$,n)))continue e}A&&A.push($),w.push(R)}}return w}function nf(e,t,n,i){return Qe(e,function(a,u,d){t(i,n(a),u,d)}),i}function wn(e,t,n){t=xt(t,e),e=qa(e,t);var i=e==null?e:e[tt(We(t))];return i==null?r:Ae(i,e,n)}function ia(e){return ne(e)&&ge(e)==Wt}function rf(e){return ne(e)&&ge(e)==fn}function sf(e){return ne(e)&&ge(e)==an}function Sn(e,t,n,i,a){return e===t?!0:e==null||t==null||!ne(e)&&!ne(t)?e!==e&&t!==t:af(e,t,n,i,Sn,a)}function af(e,t,n,i,a,u){var d=U(e),p=U(t),g=d?Fn:pe(e),w=p?Fn:pe(t);g=g==Wt?at:g,w=w==Wt?at:w;var I=g==at,x=w==at,A=g==w;if(A&&At(e)){if(!At(t))return!1;d=!0,I=!1}if(A&&!I)return u||(u=new ze),d||Qt(e)?Da(e,t,n,i,a,u):Lf(e,t,g,n,i,a,u);if(!(n&Ve)){var R=I&&K.call(e,"__wrapped__"),$=x&&K.call(t,"__wrapped__");if(R||$){var M=R?e.value():e,L=$?t.value():t;return u||(u=new ze),a(M,L,n,i,u)}}return A?(u||(u=new ze),Nf(e,t,n,i,a,u)):!1}function of(e){return ne(e)&&pe(e)==Ge}function ui(e,t,n,i){var a=n.length,u=a,d=!i;if(e==null)return!u;for(e=j(e);a--;){var p=n[a];if(d&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++a<u;){p=n[a];var g=p[0],w=e[g],I=p[1];if(d&&p[2]){if(w===r&&!(g in e))return!1}else{var x=new ze;if(i)var A=i(w,I,g,e,t,x);if(!(A===r?Sn(I,w,Ve|Ye,i,x):A))return!1}}return!0}function sa(e){if(!te(e)||Gf(e))return!1;var t=pt(e)?ac:Yu;return t.test(Ut(e))}function uf(e){return ne(e)&&ge(e)==un}function lf(e){return ne(e)&&pe(e)==qe}function cf(e){return ne(e)&&wr(e.length)&&!!Q[ge(e)]}function aa(e){return typeof e=="function"?e:e==null?Se:typeof e=="object"?U(e)?la(e[0],e[1]):ua(e):Ro(e)}function li(e){if(!En(e))return dc(e);var t=[];for(var n in j(e))K.call(e,n)&&n!="constructor"&&t.push(n);return t}function ff(e){if(!te(e))return Kf(e);var t=En(e),n=[];for(var i in e)i=="constructor"&&(t||!K.call(e,i))||n.push(i);return n}function ci(e,t){return e<t}function oa(e,t){var n=-1,i=_e(e)?v(e.length):[];return St(e,function(a,u,d){i[++n]=t(a,u,d)}),i}function ua(e){var t=Ai(e);return t.length==1&&t[0][2]?Va(t[0][0],t[0][1]):function(n){return n===e||ui(n,e,t)}}function la(e,t){return Ci(e)&&ka(t)?Va(tt(e),t):function(n){var i=Di(n,e);return i===r&&i===t?Mi(n,e):Sn(t,i,Ve|Ye)}}function ir(e,t,n,i,a){e!==t&&ii(t,function(u,d){if(a||(a=new ze),te(u))df(e,t,d,n,ir,i,a);else{var p=i?i(Ri(e,d),u,d+"",e,t,a):r;p===r&&(p=u),ni(e,d,p)}},we)}function df(e,t,n,i,a,u,d){var p=Ri(e,n),g=Ri(t,n),w=d.get(g);if(w){ni(e,n,w);return}var I=u?u(p,g,n+"",e,t,d):r,x=I===r;if(x){var A=U(g),R=!A&&At(g),$=!A&&!R&&Qt(g);I=g,A||R||$?U(p)?I=p:re(p)?I=ye(p):R?(x=!1,I=Sa(g,!0)):$?(x=!1,I=Ia(g,!0)):I=[]:bn(g)||Dt(g)?(I=p,Dt(p)?I=_o(p):(!te(p)||pt(p))&&(I=Ba(g))):x=!1}x&&(d.set(g,I),a(I,g,i,u,d),d.delete(g)),ni(e,n,I)}function ca(e,t){var n=e.length;if(n)return t+=t<0?n:0,dt(t,n)?e[t]:r}function fa(e,t,n){t.length?t=ee(t,function(u){return U(u)?function(d){return Nt(d,u.length===1?u[0]:u)}:u}):t=[Se];var i=-1;t=ee(t,be(F()));var a=oa(e,function(u,d,p){var g=ee(t,function(w){return w(u)});return{criteria:g,index:++i,value:u}});return Ml(a,function(u,d){return Af(u,d,n)})}function pf(e,t){return da(e,t,function(n,i){return Mi(e,i)})}function da(e,t,n){for(var i=-1,a=t.length,u={};++i<a;){var d=t[i],p=Nt(e,d);n(p,d)&&In(u,xt(d,e),p)}return u}function hf(e){return function(t){return Nt(t,e)}}function fi(e,t,n,i){var a=i?Dl:Vt,u=-1,d=t.length,p=e;for(e===t&&(t=ye(t)),n&&(p=ee(e,be(n)));++u<d;)for(var g=0,w=t[u],I=n?n(w):w;(g=a(p,I,g,i))>-1;)p!==e&&jn.call(p,g,1),jn.call(e,g,1);return e}function pa(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==u){var u=a;dt(a)?jn.call(e,a,1):gi(e,a)}}return e}function di(e,t){return e+Zn(Ks()*(t-e+1))}function gf(e,t,n,i){for(var a=-1,u=oe(Yn((t-e)/(n||1)),0),d=v(u);u--;)d[i?u:++a]=e,e+=n;return d}function pi(e,t){var n="";if(!e||t<1||t>mt)return n;do t%2&&(n+=e),t=Zn(t/2),t&&(e+=e);while(t);return n}function W(e,t){return Pi(Ga(e,t,Se),e+"")}function mf(e){return Ys(en(e))}function vf(e,t){var n=en(e);return hr(n,Lt(t,0,n.length))}function In(e,t,n,i){if(!te(e))return e;t=xt(t,e);for(var a=-1,u=t.length,d=u-1,p=e;p!=null&&++a<u;){var g=tt(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=d){var I=p[g];w=i?i(I,g,p):r,w===r&&(w=te(I)?I:dt(t[a+1])?[]:{})}yn(p,g,w),p=p[g]}return e}var ha=Xn?function(e,t){return Xn.set(e,t),e}:Se,yf=Jn?function(e,t){return Jn(e,"toString",{configurable:!0,enumerable:!1,value:Bi(t),writable:!0})}:Se;function _f(e){return hr(en(e))}function Me(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var u=v(a);++i<a;)u[i]=e[i+t];return u}function wf(e,t){var n;return St(e,function(i,a,u){return n=t(i,a,u),!n}),!!n}function sr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=Su){for(;i<a;){var u=i+a>>>1,d=e[u];d!==null&&!Te(d)&&(n?d<=t:d<t)?i=u+1:a=u}return a}return hi(e,t,Se,n)}function hi(e,t,n,i){var a=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var d=t!==t,p=t===null,g=Te(t),w=t===r;a<u;){var I=Zn((a+u)/2),x=n(e[I]),A=x!==r,R=x===null,$=x===x,M=Te(x);if(d)var L=i||$;else w?L=$&&(i||A):p?L=$&&A&&(i||!R):g?L=$&&A&&!R&&(i||!M):R||M?L=!1:L=i?x<=t:x<t;L?a=I+1:u=I}return de(u,wu)}function ga(e,t){for(var n=-1,i=e.length,a=0,u=[];++n<i;){var d=e[n],p=t?t(d):d;if(!n||!Ke(p,g)){var g=p;u[a++]=d===0?0:d}}return u}function ma(e){return typeof e=="number"?e:Te(e)?Pn:+e}function Ce(e){if(typeof e=="string")return e;if(U(e))return ee(e,Ce)+"";if(Te(e))return js?js.call(e):"";var t=e+"";return t=="0"&&1/e==-Tt?"-0":t}function It(e,t,n){var i=-1,a=Mn,u=e.length,d=!0,p=[],g=p;if(n)d=!1,a=Gr;else if(u>=f){var w=t?null:Ff(e);if(w)return Bn(w);d=!1,a=dn,g=new $t}else g=t?[]:p;e:for(;++i<u;){var I=e[i],x=t?t(I):I;if(I=n||I!==0?I:0,d&&x===x){for(var A=g.length;A--;)if(g[A]===x)continue e;t&&g.push(x),p.push(I)}else a(g,x,n)||(g!==p&&g.push(x),p.push(I))}return p}function gi(e,t){return t=xt(t,e),e=qa(e,t),e==null||delete e[tt(We(t))]}function va(e,t,n,i){return In(e,t,n(Nt(e,t)),i)}function ar(e,t,n,i){for(var a=e.length,u=i?a:-1;(i?u--:++u<a)&&t(e[u],u,e););return n?Me(e,i?0:u,i?u+1:a):Me(e,i?u+1:0,i?a:u)}function ya(e,t){var n=e;return n instanceof k&&(n=n.value()),qr(t,function(i,a){return a.func.apply(a.thisArg,yt([i],a.args))},n)}function mi(e,t,n){var i=e.length;if(i<2)return i?It(e[0]):[];for(var a=-1,u=v(i);++a<i;)for(var d=e[a],p=-1;++p<i;)p!=a&&(u[a]=_n(u[a]||d,e[p],t,n));return It(fe(u,1),t,n)}function _a(e,t,n){for(var i=-1,a=e.length,u=t.length,d={};++i<a;){var p=i<u?t[i]:r;n(d,e[i],p)}return d}function vi(e){return re(e)?e:[]}function yi(e){return typeof e=="function"?e:Se}function xt(e,t){return U(e)?e:Ci(e,t)?[e]:ja(z(e))}var Sf=W;function Et(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Me(e,t,n)}var wa=oc||function(e){return ce.clearTimeout(e)};function Sa(e,t){if(t)return e.slice();var n=e.length,i=Vs?Vs(n):new e.constructor(n);return e.copy(i),i}function _i(e){var t=new e.constructor(e.byteLength);return new zn(t).set(new zn(e)),t}function If(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function xf(e){var t=new e.constructor(e.source,is.exec(e));return t.lastIndex=e.lastIndex,t}function Ef(e){return vn?j(vn.call(e)):{}}function Ia(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xa(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,u=Te(e),d=t!==r,p=t===null,g=t===t,w=Te(t);if(!p&&!w&&!u&&e>t||u&&d&&g&&!p&&!w||i&&d&&g||!n&&g||!a)return 1;if(!i&&!u&&!w&&e<t||w&&n&&a&&!i&&!u||p&&n&&a||!d&&a||!g)return-1}return 0}function Af(e,t,n){for(var i=-1,a=e.criteria,u=t.criteria,d=a.length,p=n.length;++i<d;){var g=xa(a[i],u[i]);if(g){if(i>=p)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function Ea(e,t,n,i){for(var a=-1,u=e.length,d=n.length,p=-1,g=t.length,w=oe(u-d,0),I=v(g+w),x=!i;++p<g;)I[p]=t[p];for(;++a<d;)(x||a<u)&&(I[n[a]]=e[a]);for(;w--;)I[p++]=e[a++];return I}function Aa(e,t,n,i){for(var a=-1,u=e.length,d=-1,p=n.length,g=-1,w=t.length,I=oe(u-p,0),x=v(I+w),A=!i;++a<I;)x[a]=e[a];for(var R=a;++g<w;)x[R+g]=t[g];for(;++d<p;)(A||a<u)&&(x[R+n[d]]=e[a++]);return x}function ye(e,t){var n=-1,i=e.length;for(t||(t=v(i));++n<i;)t[n]=e[n];return t}function et(e,t,n,i){var a=!n;n||(n={});for(var u=-1,d=t.length;++u<d;){var p=t[u],g=i?i(n[p],e[p],p,n,e):r;g===r&&(g=e[p]),a?lt(n,p,g):yn(n,p,g)}return n}function bf(e,t){return et(e,bi(e),t)}function Cf(e,t){return et(e,Ma(e),t)}function or(e,t){return function(n,i){var a=U(n)?Fl:jc,u=t?t():{};return a(n,e,F(i,2),u)}}function Yt(e){return W(function(t,n){var i=-1,a=n.length,u=a>1?n[a-1]:r,d=a>2?n[2]:r;for(u=e.length>3&&typeof u=="function"?(a--,u):r,d&&me(n[0],n[1],d)&&(u=a<3?r:u,a=1),t=j(t);++i<a;){var p=n[i];p&&e(t,p,i,u)}return t})}function ba(e,t){return function(n,i){if(n==null)return n;if(!_e(n))return e(n,i);for(var a=n.length,u=t?a:-1,d=j(n);(t?u--:++u<a)&&i(d[u],u,d)!==!1;);return n}}function Ca(e){return function(t,n,i){for(var a=-1,u=j(t),d=i(t),p=d.length;p--;){var g=d[e?p:++a];if(n(u[g],g,u)===!1)break}return t}}function Tf(e,t,n){var i=t&Ie,a=xn(e);function u(){var d=this&&this!==ce&&this instanceof u?a:e;return d.apply(i?n:this,arguments)}return u}function Ta(e){return function(t){t=z(t);var n=Gt(t)?He(t):r,i=n?n[0]:t.charAt(0),a=n?Et(n,1).join(""):t.slice(1);return i[e]()+a}}function Zt(e){return function(t){return qr(Co(bo(t).replace(vl,"")),e,"")}}function xn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Jt(e.prototype),i=e.apply(n,t);return te(i)?i:n}}function Rf(e,t,n){var i=xn(e);function a(){for(var u=arguments.length,d=v(u),p=u,g=Xt(a);p--;)d[p]=arguments[p];var w=u<3&&d[0]!==g&&d[u-1]!==g?[]:_t(d,g);if(u-=w.length,u<n)return La(e,t,ur,a.placeholder,r,d,w,r,r,n-u);var I=this&&this!==ce&&this instanceof a?i:e;return Ae(I,this,d)}return a}function Ra(e){return function(t,n,i){var a=j(t);if(!_e(t)){var u=F(n,3);t=ue(t),n=function(p){return u(a[p],p,a)}}var d=e(t,n,i);return d>-1?a[u?t[d]:d]:r}}function Pa(e){return ft(function(t){var n=t.length,i=n,a=Ue.prototype.thru;for(e&&t.reverse();i--;){var u=t[i];if(typeof u!="function")throw new Oe(E);if(a&&!d&&dr(u)=="wrapper")var d=new Ue([],!0)}for(i=d?i:n;++i<n;){u=t[i];var p=dr(u),g=p=="wrapper"?Ei(u):r;g&&Ti(g[0])&&g[1]==(st|$e|xe|rn)&&!g[4].length&&g[9]==1?d=d[dr(g[0])].apply(d,g[3]):d=u.length==1&&Ti(u)?d[p]():d.thru(u)}return function(){var w=arguments,I=w[0];if(d&&w.length==1&&U(I))return d.plant(I).value();for(var x=0,A=n?t[x].apply(this,w):I;++x<n;)A=t[x].call(this,A);return A}})}function ur(e,t,n,i,a,u,d,p,g,w){var I=t&st,x=t&Ie,A=t&Ze,R=t&($e|Ct),$=t&Er,M=A?r:xn(e);function L(){for(var B=arguments.length,V=v(B),Re=B;Re--;)V[Re]=arguments[Re];if(R)var ve=Xt(L),Pe=Bl(V,ve);if(i&&(V=Ea(V,i,a,R)),u&&(V=Aa(V,u,d,R)),B-=Pe,R&&B<w){var ie=_t(V,ve);return La(e,t,ur,L.placeholder,n,V,ie,p,g,w-B)}var je=x?n:this,gt=A?je[e]:e;return B=V.length,p?V=Jf(V,p):$&&B>1&&V.reverse(),I&&g<B&&(V.length=g),this&&this!==ce&&this instanceof L&&(gt=M||xn(gt)),gt.apply(je,V)}return L}function Fa(e,t){return function(n,i){return nf(n,e,t(i),{})}}function lr(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=Ce(n),i=Ce(i)):(n=ma(n),i=ma(i)),a=e(n,i)}return a}}function wi(e){return ft(function(t){return t=ee(t,be(F())),W(function(n){var i=this;return e(t,function(a){return Ae(a,i,n)})})})}function cr(e,t){t=t===r?" ":Ce(t);var n=t.length;if(n<2)return n?pi(t,e):t;var i=pi(t,Yn(e/qt(t)));return Gt(t)?Et(He(i),0,e).join(""):i.slice(0,e)}function Pf(e,t,n,i){var a=t&Ie,u=xn(e);function d(){for(var p=-1,g=arguments.length,w=-1,I=i.length,x=v(I+g),A=this&&this!==ce&&this instanceof d?u:e;++w<I;)x[w]=i[w];for(;g--;)x[w++]=arguments[++p];return Ae(A,a?n:this,x)}return d}function $a(e){return function(t,n,i){return i&&typeof i!="number"&&me(t,n,i)&&(n=i=r),t=ht(t),n===r?(n=t,t=0):n=ht(n),i=i===r?t<n?1:-1:ht(i),gf(t,n,i,e)}}function fr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Be(t),n=Be(n)),e(t,n)}}function La(e,t,n,i,a,u,d,p,g,w){var I=t&$e,x=I?d:r,A=I?r:d,R=I?u:r,$=I?r:u;t|=I?xe:Ee,t&=~(I?Ee:xe),t&Rn||(t&=-4);var M=[e,t,a,R,x,$,A,p,g,w],L=n.apply(r,M);return Ti(e)&&Ha(L,M),L.placeholder=i,za(L,e,t)}function Si(e){var t=ae[e];return function(n,i){if(n=Be(n),i=i==null?0:de(D(i),292),i&&zs(n)){var a=(z(n)+"e").split("e"),u=t(a[0]+"e"+(+a[1]+i));return a=(z(u)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var Ff=Kt&&1/Bn(new Kt([,-0]))[1]==Tt?function(e){return new Kt(e)}:Gi;function Na(e){return function(t){var n=pe(t);return n==Ge?Zr(t):n==qe?Kl(t):Wl(t,e(t))}}function ct(e,t,n,i,a,u,d,p){var g=t&Ze;if(!g&&typeof e!="function")throw new Oe(E);var w=i?i.length:0;if(w||(t&=-97,i=a=r),d=d===r?d:oe(D(d),0),p=p===r?p:D(p),w-=a?a.length:0,t&Ee){var I=i,x=a;i=a=r}var A=g?r:Ei(e),R=[e,t,n,i,a,I,x,u,d,p];if(A&&zf(R,A),e=R[0],t=R[1],n=R[2],i=R[3],a=R[4],p=R[9]=R[9]===r?g?0:e.length:oe(R[9]-w,0),!p&&t&($e|Ct)&&(t&=-25),!t||t==Ie)var $=Tf(e,t,n);else t==$e||t==Ct?$=Rf(e,t,p):(t==xe||t==(Ie|xe))&&!a.length?$=Pf(e,t,n,i):$=ur.apply(r,R);var M=A?ha:Ha;return za(M($,R),e,t)}function Oa(e,t,n,i){return e===r||Ke(e,zt[n])&&!K.call(i,n)?t:e}function Ua(e,t,n,i,a,u){return te(e)&&te(t)&&(u.set(t,e),ir(e,t,r,Ua,u),u.delete(t)),e}function $f(e){return bn(e)?r:e}function Da(e,t,n,i,a,u){var d=n&Ve,p=e.length,g=t.length;if(p!=g&&!(d&&g>p))return!1;var w=u.get(e),I=u.get(t);if(w&&I)return w==t&&I==e;var x=-1,A=!0,R=n&Ye?new $t:r;for(u.set(e,t),u.set(t,e);++x<p;){var $=e[x],M=t[x];if(i)var L=d?i(M,$,x,t,e,u):i($,M,x,e,t,u);if(L!==r){if(L)continue;A=!1;break}if(R){if(!Hr(t,function(B,V){if(!dn(R,V)&&($===B||a($,B,n,i,u)))return R.push(V)})){A=!1;break}}else if(!($===M||a($,M,n,i,u))){A=!1;break}}return u.delete(e),u.delete(t),A}function Lf(e,t,n,i,a,u,d){switch(n){case Bt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case fn:return!(e.byteLength!=t.byteLength||!u(new zn(e),new zn(t)));case sn:case an:case on:return Ke(+e,+t);case $n:return e.name==t.name&&e.message==t.message;case un:case ln:return e==t+"";case Ge:var p=Zr;case qe:var g=i&Ve;if(p||(p=Bn),e.size!=t.size&&!g)return!1;var w=d.get(e);if(w)return w==t;i|=Ye,d.set(e,t);var I=Da(p(e),p(t),i,a,u,d);return d.delete(e),I;case Nn:if(vn)return vn.call(e)==vn.call(t)}return!1}function Nf(e,t,n,i,a,u){var d=n&Ve,p=Ii(e),g=p.length,w=Ii(t),I=w.length;if(g!=I&&!d)return!1;for(var x=g;x--;){var A=p[x];if(!(d?A in t:K.call(t,A)))return!1}var R=u.get(e),$=u.get(t);if(R&&$)return R==t&&$==e;var M=!0;u.set(e,t),u.set(t,e);for(var L=d;++x<g;){A=p[x];var B=e[A],V=t[A];if(i)var Re=d?i(V,B,A,t,e,u):i(B,V,A,e,t,u);if(!(Re===r?B===V||a(B,V,n,i,u):Re)){M=!1;break}L||(L=A=="constructor")}if(M&&!L){var ve=e.constructor,Pe=t.constructor;ve!=Pe&&"constructor"in e&&"constructor"in t&&!(typeof ve=="function"&&ve instanceof ve&&typeof Pe=="function"&&Pe instanceof Pe)&&(M=!1)}return u.delete(e),u.delete(t),M}function ft(e){return Pi(Ga(e,r,Xa),e+"")}function Ii(e){return ra(e,ue,bi)}function xi(e){return ra(e,we,Ma)}var Ei=Xn?function(e){return Xn.get(e)}:Gi;function dr(e){for(var t=e.name+"",n=jt[t],i=K.call(jt,t)?n.length:0;i--;){var a=n[i],u=a.func;if(u==null||u==e)return a.name}return t}function Xt(e){var t=K.call(o,"placeholder")?o:e;return t.placeholder}function F(){var e=o.iteratee||ki;return e=e===ki?aa:e,arguments.length?e(arguments[0],arguments[1]):e}function pr(e,t){var n=e.__data__;return Vf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ai(e){for(var t=ue(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,ka(a)]}return t}function Ot(e,t){var n=ql(e,t);return sa(n)?n:r}function Of(e){var t=K.call(e,Pt),n=e[Pt];try{e[Pt]=r;var i=!0}catch{}var a=qn.call(e);return i&&(t?e[Pt]=n:delete e[Pt]),a}var bi=Qr?function(e){return e==null?[]:(e=j(e),vt(Qr(e),function(t){return qs.call(e,t)}))}:qi,Ma=Qr?function(e){for(var t=[];e;)yt(t,bi(e)),e=Kn(e);return t}:qi,pe=ge;(ei&&pe(new ei(new ArrayBuffer(1)))!=Bt||hn&&pe(new hn)!=Ge||ti&&pe(ti.resolve())!=es||Kt&&pe(new Kt)!=qe||gn&&pe(new gn)!=cn)&&(pe=function(e){var t=ge(e),n=t==at?e.constructor:r,i=n?Ut(n):"";if(i)switch(i){case mc:return Bt;case vc:return Ge;case yc:return es;case _c:return qe;case wc:return cn}return t});function Uf(e,t,n){for(var i=-1,a=n.length;++i<a;){var u=n[i],d=u.size;switch(u.type){case"drop":e+=d;break;case"dropRight":t-=d;break;case"take":t=de(t,e+d);break;case"takeRight":e=oe(e,t-d);break}}return{start:e,end:t}}function Df(e){var t=e.match(Vu);return t?t[1].split(Gu):[]}function Wa(e,t,n){t=xt(t,e);for(var i=-1,a=t.length,u=!1;++i<a;){var d=tt(t[i]);if(!(u=e!=null&&n(e,d)))break;e=e[d]}return u||++i!=a?u:(a=e==null?0:e.length,!!a&&wr(a)&&dt(d,a)&&(U(e)||Dt(e)))}function Mf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&K.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Ba(e){return typeof e.constructor=="function"&&!En(e)?Jt(Kn(e)):{}}function Wf(e,t,n){var i=e.constructor;switch(t){case fn:return _i(e);case sn:case an:return new i(+e);case Bt:return If(e,n);case Ar:case br:case Cr:case Tr:case Rr:case Pr:case Fr:case $r:case Lr:return Ia(e,n);case Ge:return new i;case on:case ln:return new i(e);case un:return xf(e);case qe:return new i;case Nn:return Ef(e)}}function Bf(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(ku,`{
|
|
2
|
+
"use strict";var dm=Object.create;var Lo=Object.defineProperty;var pm=Object.getOwnPropertyDescriptor;var hm=Object.getOwnPropertyNames;var gm=Object.getPrototypeOf,mm=Object.prototype.hasOwnProperty;var vm=(l,s,r,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of hm(s))!mm.call(l,f)&&f!==r&&Lo(l,f,{get:()=>s[f],enumerable:!(c=pm(s,f))||c.enumerable});return l};var ym=(l,s,r)=>(r=l!=null?dm(gm(l)):{},vm(s||!l||!l.__esModule?Lo(r,"default",{value:l,enumerable:!0}):r,l));const j=require("path"),h=require("./login-oauth-DzHcV9F2.js"),nt=require("node:fs/promises"),_m=require("chalk"),wm=require("inquirer"),J=require("uuid"),Sm=require("chokidar"),Im=require("crypto"),Pn=require("node:child_process"),xm=require("node:path"),b=require("react/jsx-runtime"),bt=require("react"),tl=require("commander"),Am=require("util"),Dt=l=>l&&l.__esModule?l:{default:l},Zi=Dt(j),v=Dt(_m),Ye=Dt(wm),nl=Dt(Sm),Em=Dt(Im),Oo=Dt(xm),rl=Dt(bt),Y=process.env.INIT_CWD||process.cwd(),pe=l=>l&&!l?.startsWith("/")?j.join(Y,l):l,bm=async l=>{const s=j.join(l,"package.json");if(await h.pathExists(s))try{const r=await nt.readFile(s,"utf-8"),c=JSON.parse(r);return c.dependencies?.["twenty-sdk"]??c.devDependencies?.["twenty-sdk"]??void 0}catch{return}},Uo=l=>{const s=l.match(/(\d+)\./);if(s)return parseInt(s[1],10);const r=l.match(/^[~^>=<]*(\d+)$/);return r?parseInt(r[1],10):null},tn=async l=>{const s=h.packageJson.version,r=await bm(l);if(!r)return;const c=Uo(s),f=Uo(r);c===null||f===null||c!==f&&(console.warn(v.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${f}.x but the CLI running is v${s}. Major version mismatches may cause unexpected behavior.
|
|
3
|
+
Update with: npm install -g twenty-sdk@${f}`)),console.warn(""))};class il{async execute(s){s.private?await this.executePrivate(s):await this.executeNpm(s)}async executeNpm(s){const r=s.appPath??Y;await tn(r),console.log(v.default.blue("Publishing to npm...")),console.log(v.default.gray(`App path: ${r}
|
|
4
|
+
`));const c=await h.appPublish({appPath:r,npmTag:s.tag,onProgress:f=>console.log(v.default.gray(f))});c.success||(console.error(v.default.red(c.error.message)),process.exit(1)),console.log(v.default.green("✓ Published to npm successfully"))}async executePrivate(s){const r=s.appPath??Y;await tn(r);const c=s.remote??h.ConfigService.getActiveRemote();console.log(v.default.blue(`Deploying application on ${c}...`)),console.log(v.default.gray(`App path: ${r}
|
|
5
|
+
`));const f=B=>console.log(v.default.gray(B)),w=await h.appBuild({appPath:r,tarball:!0,onProgress:f});w.success||(console.error(v.default.red(w.error.message)),process.exit(1));const x=await h.appDeploy({tarballPath:w.data.tarballPath,remote:s.remote,onProgress:f});x.success||(console.error(v.default.red(x.error.message)),process.exit(1));const R=await h.readJson(Zi.default.join(r,"package.json")).catch(()=>{}),L=R?.name??x.data.name,T=R?.version??"unknown";console.log(v.default.green(`
|
|
6
|
+
✓ Published ${L} v${T} to ${c}
|
|
7
|
+
`)),console.log(" To install deployed application: `yarn twenty app:install`")}}class sl{async execute(s){const r=s.appPath??Y;await tn(r),await h.checkServerVersionCompatibility();const c=s.remote??h.ConfigService.getActiveRemote();console.log(v.default.blue(`Installing application on ${c}...`)),console.log(v.default.gray(`App path: ${r}
|
|
8
|
+
`));const f=await h.appInstall({appPath:r,remote:s.remote});f.success||(console.error(v.default.red(f.error.message)),process.exit(1)),console.log(v.default.green("✓ Application installed"))}}class al{async execute({appPath:s=Y,askForConfirmation:r}){const c=h.ConfigService.getActiveRemote();console.log(v.default.blue(`🚀 Uninstall Twenty Application on ${c}`)),console.log(v.default.gray(`📁 App Path: ${s}
|
|
9
|
+
`)),r&&!await this.confirmationPrompt()&&(console.error(v.default.red("⛔️ Aborting uninstall")),process.exit(1));const f=await h.appUninstall({appPath:s});return f.success?(console.log(v.default.green("✅ Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(v.default.red("❌ Uninstall failed:"),f.error.message),{success:!1,error:f.error.message})}async confirmationPrompt(){const{confirmation:s}=await Ye.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}const Cm=l=>{const s=new il,r=new sl,c=new al;l.command("app:publish [appPath]").description("Build and publish to npm (default) or server registry").option("--private","Push to a Twenty server's registry instead of npm").option("-r, --remote <name>","Publish to a specific remote (with --private)").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(f,w)=>{await s.execute({appPath:pe(f),private:w.private,remote:w.remote,tag:w.tag})}),l.command("app:install [appPath]").description("Install a deployed app on the server").option("-r, --remote <name>","Install on a specific remote").action(async(f,w)=>{await r.execute({appPath:pe(f),remote:w.remote})}),l.command("app:uninstall [appPath]").description("Uninstall app from server").option("-y, --yes","Skip confirmation prompt").action(async(f,w)=>{try{const x=await c.execute({appPath:pe(f),askForConfirmation:!w?.yes});process.exit(x.success?0:1)}catch{process.exit(1)}})};var Rn={exports:{}};var Tm=Rn.exports,Do;function Rm(){return Do||(Do=1,(function(l,s){(function(){var r,c="4.18.1",f=200,w="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",x="Expected a function",R="Invalid `variable` option passed into `_.template`",L="Invalid `imports` option passed into `_.template`",T="__lodash_hash_undefined__",B=500,ne="__lodash_placeholder__",Z=1,ht=2,Be=4,Fe=1,Mt=2,me=1,gt=2,rn=4,ke=8,rt=16,ce=32,sn=64,it=128,an=256,Ar=512,yl=30,_l="...",wl=800,Sl=16,Qi=1,Il=2,xl=3,Ct=1/0,mt=9007199254740991,Al=17976931348623157e292,Fn=NaN,Ze=4294967295,El=Ze-1,bl=Ze>>>1,Cl=[["ary",it],["bind",me],["bindKey",gt],["curry",ke],["curryRight",rt],["flip",Ar],["partial",ce],["partialRight",sn],["rearg",an]],Wt="[object Arguments]",$n="[object Array]",Tl="[object AsyncFunction]",on="[object Boolean]",ln="[object Date]",Rl="[object DOMException]",Nn="[object Error]",Ln="[object Function]",es="[object GeneratorFunction]",Ve="[object Map]",un="[object Number]",Pl="[object Null]",st="[object Object]",ts="[object Promise]",Fl="[object Proxy]",cn="[object RegExp]",Ge="[object Set]",fn="[object String]",On="[object Symbol]",$l="[object Undefined]",dn="[object WeakMap]",Nl="[object WeakSet]",pn="[object ArrayBuffer]",Bt="[object DataView]",Er="[object Float32Array]",br="[object Float64Array]",Cr="[object Int8Array]",Tr="[object Int16Array]",Rr="[object Int32Array]",Pr="[object Uint8Array]",Fr="[object Uint8ClampedArray]",$r="[object Uint16Array]",Nr="[object Uint32Array]",Ll=/\b__p \+= '';/g,Ol=/\b(__p \+=) '' \+/g,Ul=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ns=/&(?:amp|lt|gt|quot|#39);/g,rs=/[&<>"']/g,Dl=RegExp(ns.source),Ml=RegExp(rs.source),Wl=/<%-([\s\S]+?)%>/g,Bl=/<%([\s\S]+?)%>/g,is=/<%=([\s\S]+?)%>/g,kl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vl=/^\w*$/,Gl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lr=/[\\^$.*+?()[\]{}|]/g,jl=RegExp(Lr.source),Or=/^\s+/,ql=/\s/,Hl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zl=/\{\n\/\* \[wrapped with (.+)\] \*/,Kl=/,? & /,Yl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ss=/[()=,{}\[\]\/\s]/,Jl=/\\(\\)?/g,Zl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,as=/\w*$/,Xl=/^[-+]0x[0-9a-f]+$/i,Ql=/^0b[01]+$/i,eu=/^\[object .+?Constructor\]$/,tu=/^0o[0-7]+$/i,nu=/^(?:0|[1-9]\d*)$/,ru=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Un=/($^)/,iu=/['\n\r\u2028\u2029\\]/g,Dn="\\ud800-\\udfff",su="\\u0300-\\u036f",au="\\ufe20-\\ufe2f",ou="\\u20d0-\\u20ff",os=su+au+ou,ls="\\u2700-\\u27bf",us="a-z\\xdf-\\xf6\\xf8-\\xff",lu="\\xac\\xb1\\xd7\\xf7",uu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",cu="\\u2000-\\u206f",fu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cs="A-Z\\xc0-\\xd6\\xd8-\\xde",fs="\\ufe0e\\ufe0f",ds=lu+uu+cu+fu,Ur="['’]",du="["+Dn+"]",ps="["+ds+"]",Mn="["+os+"]",hs="\\d+",pu="["+ls+"]",gs="["+us+"]",ms="[^"+Dn+ds+hs+ls+us+cs+"]",Dr="\\ud83c[\\udffb-\\udfff]",hu="(?:"+Mn+"|"+Dr+")",vs="[^"+Dn+"]",Mr="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",kt="["+cs+"]",ys="\\u200d",_s="(?:"+gs+"|"+ms+")",gu="(?:"+kt+"|"+ms+")",ws="(?:"+Ur+"(?:d|ll|m|re|s|t|ve))?",Ss="(?:"+Ur+"(?:D|LL|M|RE|S|T|VE))?",Is=hu+"?",xs="["+fs+"]?",mu="(?:"+ys+"(?:"+[vs,Mr,Wr].join("|")+")"+xs+Is+")*",vu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",yu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",As=xs+Is+mu,_u="(?:"+[pu,Mr,Wr].join("|")+")"+As,wu="(?:"+[vs+Mn+"?",Mn,Mr,Wr,du].join("|")+")",Su=RegExp(Ur,"g"),Iu=RegExp(Mn,"g"),Br=RegExp(Dr+"(?="+Dr+")|"+wu+As,"g"),xu=RegExp([kt+"?"+gs+"+"+ws+"(?="+[ps,kt,"$"].join("|")+")",gu+"+"+Ss+"(?="+[ps,kt+_s,"$"].join("|")+")",kt+"?"+_s+"+"+ws,kt+"+"+Ss,yu,vu,hs,_u].join("|"),"g"),Au=RegExp("["+ys+Dn+os+fs+"]"),Eu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,bu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Cu=-1,Q={};Q[Er]=Q[br]=Q[Cr]=Q[Tr]=Q[Rr]=Q[Pr]=Q[Fr]=Q[$r]=Q[Nr]=!0,Q[Wt]=Q[$n]=Q[pn]=Q[on]=Q[Bt]=Q[ln]=Q[Nn]=Q[Ln]=Q[Ve]=Q[un]=Q[st]=Q[cn]=Q[Ge]=Q[fn]=Q[dn]=!1;var X={};X[Wt]=X[$n]=X[pn]=X[Bt]=X[on]=X[ln]=X[Er]=X[br]=X[Cr]=X[Tr]=X[Rr]=X[Ve]=X[un]=X[st]=X[cn]=X[Ge]=X[fn]=X[On]=X[Pr]=X[Fr]=X[$r]=X[Nr]=!0,X[Nn]=X[Ln]=X[dn]=!1;var Tu={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ru={"&":"&","<":"<",">":">",'"':""","'":"'"},Pu={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$u=parseFloat,Nu=parseInt,Es=typeof h.commonjsGlobal=="object"&&h.commonjsGlobal&&h.commonjsGlobal.Object===Object&&h.commonjsGlobal,Lu=typeof self=="object"&&self&&self.Object===Object&&self,fe=Es||Lu||Function("return this")(),kr=s&&!s.nodeType&&s,Tt=kr&&!0&&l&&!l.nodeType&&l,bs=Tt&&Tt.exports===kr,Vr=bs&&Es.process,$e=(function(){try{var g=Tt&&Tt.require&&Tt.require("util").types;return g||Vr&&Vr.binding&&Vr.binding("util")}catch{}})(),Cs=$e&&$e.isArrayBuffer,Ts=$e&&$e.isDate,Rs=$e&&$e.isMap,Ps=$e&&$e.isRegExp,Fs=$e&&$e.isSet,$s=$e&&$e.isTypedArray;function Ae(g,_,y){switch(y.length){case 0:return g.call(_);case 1:return g.call(_,y[0]);case 2:return g.call(_,y[0],y[1]);case 3:return g.call(_,y[0],y[1],y[2])}return g.apply(_,y)}function Ou(g,_,y,C){for(var O=-1,q=g==null?0:g.length;++O<q;){var ae=g[O];_(C,ae,y(ae),g)}return C}function Ee(g,_){for(var y=-1,C=g==null?0:g.length;++y<C&&_(g[y],y,g)!==!1;);return g}function Uu(g,_){for(var y=g==null?0:g.length;y--&&_(g[y],y,g)!==!1;);return g}function Ns(g,_){for(var y=-1,C=g==null?0:g.length;++y<C;)if(!_(g[y],y,g))return!1;return!0}function vt(g,_){for(var y=-1,C=g==null?0:g.length,O=0,q=[];++y<C;){var ae=g[y];_(ae,y,g)&&(q[O++]=ae)}return q}function Wn(g,_){var y=g==null?0:g.length;return!!y&&Vt(g,_,0)>-1}function Gr(g,_,y){for(var C=-1,O=g==null?0:g.length;++C<O;)if(y(_,g[C]))return!0;return!1}function ee(g,_){for(var y=-1,C=g==null?0:g.length,O=Array(C);++y<C;)O[y]=_(g[y],y,g);return O}function yt(g,_){for(var y=-1,C=_.length,O=g.length;++y<C;)g[O+y]=_[y];return g}function jr(g,_,y,C){var O=-1,q=g==null?0:g.length;for(C&&q&&(y=g[++O]);++O<q;)y=_(y,g[O],O,g);return y}function Du(g,_,y,C){var O=g==null?0:g.length;for(C&&O&&(y=g[--O]);O--;)y=_(y,g[O],O,g);return y}function qr(g,_){for(var y=-1,C=g==null?0:g.length;++y<C;)if(_(g[y],y,g))return!0;return!1}var Mu=Hr("length");function Wu(g){return g.split("")}function Bu(g){return g.match(Yl)||[]}function Ls(g,_,y){var C;return y(g,function(O,q,ae){if(_(O,q,ae))return C=q,!1}),C}function Bn(g,_,y,C){for(var O=g.length,q=y+(C?1:-1);C?q--:++q<O;)if(_(g[q],q,g))return q;return-1}function Vt(g,_,y){return _===_?Xu(g,_,y):Bn(g,Os,y)}function ku(g,_,y,C){for(var O=y-1,q=g.length;++O<q;)if(C(g[O],_))return O;return-1}function Os(g){return g!==g}function Us(g,_){var y=g==null?0:g.length;return y?Kr(g,_)/y:Fn}function Hr(g){return function(_){return _==null?r:_[g]}}function zr(g){return function(_){return g==null?r:g[_]}}function Ds(g,_,y,C,O){return O(g,function(q,ae,K){y=C?(C=!1,q):_(y,q,ae,K)}),y}function Vu(g,_){var y=g.length;for(g.sort(_);y--;)g[y]=g[y].value;return g}function Kr(g,_){for(var y,C=-1,O=g.length;++C<O;){var q=_(g[C]);q!==r&&(y=y===r?q:y+q)}return y}function Yr(g,_){for(var y=-1,C=Array(g);++y<g;)C[y]=_(y);return C}function Gu(g,_){return ee(_,function(y){return[y,g[y]]})}function Ms(g){return g&&g.slice(0,Vs(g)+1).replace(Or,"")}function be(g){return function(_){return g(_)}}function Jr(g,_){return ee(_,function(y){return g[y]})}function hn(g,_){return g.has(_)}function Ws(g,_){for(var y=-1,C=g.length;++y<C&&Vt(_,g[y],0)>-1;);return y}function Bs(g,_){for(var y=g.length;y--&&Vt(_,g[y],0)>-1;);return y}function ju(g,_){for(var y=g.length,C=0;y--;)g[y]===_&&++C;return C}var qu=zr(Tu),Hu=zr(Ru);function zu(g){return"\\"+Fu[g]}function Ku(g,_){return g==null?r:g[_]}function Gt(g){return Au.test(g)}function Yu(g){return Eu.test(g)}function Ju(g){for(var _,y=[];!(_=g.next()).done;)y.push(_.value);return y}function Zr(g){var _=-1,y=Array(g.size);return g.forEach(function(C,O){y[++_]=[O,C]}),y}function ks(g,_){return function(y){return g(_(y))}}function _t(g,_){for(var y=-1,C=g.length,O=0,q=[];++y<C;){var ae=g[y];(ae===_||ae===ne)&&(g[y]=ne,q[O++]=y)}return q}function kn(g){var _=-1,y=Array(g.size);return g.forEach(function(C){y[++_]=C}),y}function Zu(g){var _=-1,y=Array(g.size);return g.forEach(function(C){y[++_]=[C,C]}),y}function Xu(g,_,y){for(var C=y-1,O=g.length;++C<O;)if(g[C]===_)return C;return-1}function Qu(g,_,y){for(var C=y+1;C--;)if(g[C]===_)return C;return C}function jt(g){return Gt(g)?tc(g):Mu(g)}function je(g){return Gt(g)?nc(g):Wu(g)}function Vs(g){for(var _=g.length;_--&&ql.test(g.charAt(_)););return _}var ec=zr(Pu);function tc(g){for(var _=Br.lastIndex=0;Br.test(g);)++_;return _}function nc(g){return g.match(Br)||[]}function rc(g){return g.match(xu)||[]}var ic=(function g(_){_=_==null?fe:qt.defaults(fe.Object(),_,qt.pick(fe,bu));var y=_.Array,C=_.Date,O=_.Error,q=_.Function,ae=_.Math,K=_.Object,Xr=_.RegExp,sc=_.String,Ne=_.TypeError,Vn=y.prototype,ac=q.prototype,Ht=K.prototype,Gn=_["__core-js_shared__"],jn=ac.toString,H=Ht.hasOwnProperty,oc=0,Gs=(function(){var e=/[^.]+$/.exec(Gn&&Gn.keys&&Gn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),qn=Ht.toString,lc=jn.call(K),uc=fe._,cc=Xr("^"+jn.call(H).replace(Lr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=bs?_.Buffer:r,wt=_.Symbol,zn=_.Uint8Array,js=Hn?Hn.allocUnsafe:r,Kn=ks(K.getPrototypeOf,K),qs=K.create,Hs=Ht.propertyIsEnumerable,Yn=Vn.splice,zs=wt?wt.isConcatSpreadable:r,gn=wt?wt.iterator:r,Rt=wt?wt.toStringTag:r,Jn=(function(){try{var e=Lt(K,"defineProperty");return e({},"",{}),e}catch{}})(),fc=_.clearTimeout!==fe.clearTimeout&&_.clearTimeout,dc=C&&C.now!==fe.Date.now&&C.now,pc=_.setTimeout!==fe.setTimeout&&_.setTimeout,Zn=ae.ceil,Xn=ae.floor,Qr=K.getOwnPropertySymbols,hc=Hn?Hn.isBuffer:r,Ks=_.isFinite,gc=Vn.join,mc=ks(K.keys,K),oe=ae.max,he=ae.min,vc=C.now,yc=_.parseInt,Ys=ae.random,_c=Vn.reverse,ei=Lt(_,"DataView"),mn=Lt(_,"Map"),ti=Lt(_,"Promise"),zt=Lt(_,"Set"),vn=Lt(_,"WeakMap"),yn=Lt(K,"create"),Qn=vn&&new vn,Kt={},wc=Ot(ei),Sc=Ot(mn),Ic=Ot(ti),xc=Ot(zt),Ac=Ot(vn),er=wt?wt.prototype:r,_n=er?er.valueOf:r,Js=er?er.toString:r;function o(e){if(re(e)&&!U(e)&&!(e instanceof V)){if(e instanceof Le)return e;if(H.call(e,"__wrapped__"))return Za(e)}return new Le(e)}var Yt=(function(){function e(){}return function(t){if(!te(t))return{};if(qs)return qs(t);e.prototype=t;var n=new e;return e.prototype=r,n}})();function tr(){}function Le(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}o.templateSettings={escape:Wl,evaluate:Bl,interpolate:is,variable:"",imports:{_:o}},o.prototype=tr.prototype,o.prototype.constructor=o,Le.prototype=Yt(tr.prototype),Le.prototype.constructor=Le;function V(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ze,this.__views__=[]}function Ec(){var e=new V(this.__wrapped__);return e.__actions__=we(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=we(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=we(this.__views__),e}function bc(){if(this.__filtered__){var e=new V(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Cc(){var e=this.__wrapped__.value(),t=this.__dir__,n=U(e),i=t<0,a=n?e.length:0,u=Bf(0,a,this.__views__),d=u.start,p=u.end,m=p-d,S=i?p:d-1,I=this.__iteratees__,A=I.length,E=0,P=he(m,this.__takeCount__);if(!n||!i&&a==m&&P==m)return wa(e,this.__actions__);var N=[];e:for(;m--&&E<P;){S+=t;for(var M=-1,F=e[S];++M<A;){var k=I[M],G=k.iteratee,Re=k.type,_e=G(F);if(Re==Il)F=_e;else if(!_e){if(Re==Qi)continue e;break e}}N[E++]=F}return N}V.prototype=Yt(tr.prototype),V.prototype.constructor=V;function Pt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Tc(){this.__data__=yn?yn(null):{},this.size=0}function Rc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Pc(e){var t=this.__data__;if(yn){var n=t[e];return n===T?r:n}return H.call(t,e)?t[e]:r}function Fc(e){var t=this.__data__;return yn?t[e]!==r:H.call(t,e)}function $c(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=yn&&t===r?T:t,this}Pt.prototype.clear=Tc,Pt.prototype.delete=Rc,Pt.prototype.get=Pc,Pt.prototype.has=Fc,Pt.prototype.set=$c;function at(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Nc(){this.__data__=[],this.size=0}function Lc(e){var t=this.__data__,n=nr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():Yn.call(t,n,1),--this.size,!0}function Oc(e){var t=this.__data__,n=nr(t,e);return n<0?r:t[n][1]}function Uc(e){return nr(this.__data__,e)>-1}function Dc(e,t){var n=this.__data__,i=nr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}at.prototype.clear=Nc,at.prototype.delete=Lc,at.prototype.get=Oc,at.prototype.has=Uc,at.prototype.set=Dc;function ot(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Mc(){this.size=0,this.__data__={hash:new Pt,map:new(mn||at),string:new Pt}}function Wc(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}function Bc(e){return hr(this,e).get(e)}function kc(e){return hr(this,e).has(e)}function Vc(e,t){var n=hr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}ot.prototype.clear=Mc,ot.prototype.delete=Wc,ot.prototype.get=Bc,ot.prototype.has=kc,ot.prototype.set=Vc;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new ot;++t<n;)this.add(e[t])}function Gc(e){return this.__data__.set(e,T),this}function jc(e){return this.__data__.has(e)}Ft.prototype.add=Ft.prototype.push=Gc,Ft.prototype.has=jc;function qe(e){var t=this.__data__=new at(e);this.size=t.size}function qc(){this.__data__=new at,this.size=0}function Hc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function zc(e){return this.__data__.get(e)}function Kc(e){return this.__data__.has(e)}function Yc(e,t){var n=this.__data__;if(n instanceof at){var i=n.__data__;if(!mn||i.length<f-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ot(i)}return n.set(e,t),this.size=n.size,this}qe.prototype.clear=qc,qe.prototype.delete=Hc,qe.prototype.get=zc,qe.prototype.has=Kc,qe.prototype.set=Yc;function Zs(e,t){var n=U(e),i=!n&&Ut(e),a=!n&&!i&&Et(e),u=!n&&!i&&!a&&Qt(e),d=n||i||a||u,p=d?Yr(e.length,sc):[],m=p.length;for(var S in e)(t||H.call(e,S))&&!(d&&(S=="length"||a&&(S=="offset"||S=="parent")||u&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||ct(S,m)))&&p.push(S);return p}function Xs(e){var t=e.length;return t?e[di(0,t-1)]:r}function Jc(e,t){return gr(we(e),$t(t,0,e.length))}function Zc(e){return gr(we(e))}function ni(e,t,n){(n!==r&&!ze(e[t],n)||n===r&&!(t in e))&&Xe(e,t,n)}function wn(e,t,n){var i=e[t];(!(H.call(e,t)&&ze(i,n))||n===r&&!(t in e))&&Xe(e,t,n)}function nr(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1}function Xc(e,t,n,i){return St(e,function(a,u,d){t(i,a,n(a),d)}),i}function Qs(e,t){return e&&et(t,le(t),e)}function Qc(e,t){return e&&et(t,Ie(t),e)}function Xe(e,t,n){t=="__proto__"&&Jn?Jn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ri(e,t){for(var n=-1,i=t.length,a=y(i),u=e==null;++n<i;)a[n]=u?r:Mi(e,t[n]);return a}function $t(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Oe(e,t,n,i,a,u){var d,p=t&Z,m=t&ht,S=t&Be;if(n&&(d=a?n(e,i,a,u):n(e)),d!==r)return d;if(!te(e))return e;var I=U(e);if(I){if(d=Vf(e),!p)return we(e,d)}else{var A=ge(e),E=A==Ln||A==es;if(Et(e))return xa(e,p);if(A==st||A==Wt||E&&!a){if(d=m||E?{}:Va(e),!p)return m?Ff(e,Qc(d,e)):Pf(e,Qs(d,e))}else{if(!X[A])return a?e:{};d=Gf(e,A,p)}}u||(u=new qe);var P=u.get(e);if(P)return P;u.set(e,d),yo(e)?e.forEach(function(F){d.add(Oe(F,t,n,F,e,u))}):mo(e)&&e.forEach(function(F,k){d.set(k,Oe(F,t,n,k,e,u))});var N=S?m?xi:Ii:m?Ie:le,M=I?r:N(e);return Ee(M||e,function(F,k){M&&(k=F,F=e[k]),wn(d,k,Oe(F,t,n,k,e,u))}),d}function ef(e){var t=le(e);return function(n){return ea(n,e,t)}}function ea(e,t,n){var i=n.length;if(e==null)return!i;for(e=K(e);i--;){var a=n[i],u=t[a],d=e[a];if(d===r&&!(a in e)||!u(d))return!1}return!0}function ta(e,t,n){if(typeof e!="function")throw new Ne(x);return Cn(function(){e.apply(r,n)},t)}function Sn(e,t,n,i){var a=-1,u=Wn,d=!0,p=e.length,m=[],S=t.length;if(!p)return m;n&&(t=ee(t,be(n))),i?(u=Gr,d=!1):t.length>=f&&(u=hn,d=!1,t=new Ft(t));e:for(;++a<p;){var I=e[a],A=n==null?I:n(I);if(I=i||I!==0?I:0,d&&A===A){for(var E=S;E--;)if(t[E]===A)continue e;m.push(I)}else u(t,A,i)||m.push(I)}return m}var St=Ta(Qe),na=Ta(si,!0);function tf(e,t){var n=!0;return St(e,function(i,a,u){return n=!!t(i,a,u),n}),n}function rr(e,t,n){for(var i=-1,a=e.length;++i<a;){var u=e[i],d=t(u);if(d!=null&&(p===r?d===d&&!Te(d):n(d,p)))var p=d,m=u}return m}function nf(e,t,n,i){var a=e.length;for(n=D(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:D(i),i<0&&(i+=a),i=n>i?0:wo(i);n<i;)e[n++]=t;return e}function ra(e,t){var n=[];return St(e,function(i,a,u){t(i,a,u)&&n.push(i)}),n}function de(e,t,n,i,a){var u=-1,d=e.length;for(n||(n=qf),a||(a=[]);++u<d;){var p=e[u];t>0&&n(p)?t>1?de(p,t-1,n,i,a):yt(a,p):i||(a[a.length]=p)}return a}var ii=Ra(),ia=Ra(!0);function Qe(e,t){return e&&ii(e,t,le)}function si(e,t){return e&&ia(e,t,le)}function ir(e,t){return vt(t,function(n){return ft(e[n])})}function Nt(e,t){t=xt(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[He(t[n++])];return n&&n==i?e:r}function sa(e,t,n){var i=t(e);return U(e)?i:yt(i,n(e))}function ve(e){return e==null?e===r?$l:Pl:Rt&&Rt in K(e)?Wf(e):Xf(e)}function ai(e,t){return e>t}function rf(e,t){return e!=null&&H.call(e,t)}function sf(e,t){return e!=null&&t in K(e)}function af(e,t,n){return e>=he(t,n)&&e<oe(t,n)}function oi(e,t,n){for(var i=n?Gr:Wn,a=e[0].length,u=e.length,d=u,p=y(u),m=1/0,S=[];d--;){var I=e[d];d&&t&&(I=ee(I,be(t))),m=he(I.length,m),p[d]=!n&&(t||a>=120&&I.length>=120)?new Ft(d&&I):r}I=e[0];var A=-1,E=p[0];e:for(;++A<a&&S.length<m;){var P=I[A],N=t?t(P):P;if(P=n||P!==0?P:0,!(E?hn(E,N):i(S,N,n))){for(d=u;--d;){var M=p[d];if(!(M?hn(M,N):i(e[d],N,n)))continue e}E&&E.push(N),S.push(P)}}return S}function of(e,t,n,i){return Qe(e,function(a,u,d){t(i,n(a),u,d)}),i}function In(e,t,n){t=xt(t,e),e=Ha(e,t);var i=e==null?e:e[He(De(t))];return i==null?r:Ae(i,e,n)}function aa(e){return re(e)&&ve(e)==Wt}function lf(e){return re(e)&&ve(e)==pn}function uf(e){return re(e)&&ve(e)==ln}function xn(e,t,n,i,a){return e===t?!0:e==null||t==null||!re(e)&&!re(t)?e!==e&&t!==t:cf(e,t,n,i,xn,a)}function cf(e,t,n,i,a,u){var d=U(e),p=U(t),m=d?$n:ge(e),S=p?$n:ge(t);m=m==Wt?st:m,S=S==Wt?st:S;var I=m==st,A=S==st,E=m==S;if(E&&Et(e)){if(!Et(t))return!1;d=!0,I=!1}if(E&&!I)return u||(u=new qe),d||Qt(e)?Wa(e,t,n,i,a,u):Df(e,t,m,n,i,a,u);if(!(n&Fe)){var P=I&&H.call(e,"__wrapped__"),N=A&&H.call(t,"__wrapped__");if(P||N){var M=P?e.value():e,F=N?t.value():t;return u||(u=new qe),a(M,F,n,i,u)}}return E?(u||(u=new qe),Mf(e,t,n,i,a,u)):!1}function ff(e){return re(e)&&ge(e)==Ve}function li(e,t,n,i){var a=n.length,u=a,d=!i;if(e==null)return!u;for(e=K(e);a--;){var p=n[a];if(d&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++a<u;){p=n[a];var m=p[0],S=e[m],I=p[1];if(d&&p[2]){if(S===r&&!(m in e))return!1}else{var A=new qe;if(i)var E=i(S,I,m,e,t,A);if(!(E===r?xn(I,S,Fe|Mt,i,A):E))return!1}}return!0}function oa(e){if(!te(e)||zf(e))return!1;var t=ft(e)?cc:eu;return t.test(Ot(e))}function df(e){return re(e)&&ve(e)==cn}function pf(e){return re(e)&&ge(e)==Ge}function hf(e){return re(e)&&Sr(e.length)&&!!Q[ve(e)]}function la(e){return typeof e=="function"?e:e==null?xe:typeof e=="object"?U(e)?fa(e[0],e[1]):ca(e):$o(e)}function ui(e){if(!bn(e))return mc(e);var t=[];for(var n in K(e))H.call(e,n)&&n!="constructor"&&t.push(n);return t}function gf(e){if(!te(e))return Zf(e);var t=bn(e),n=[];for(var i in e)i=="constructor"&&(t||!H.call(e,i))||n.push(i);return n}function ci(e,t){return e<t}function ua(e,t){var n=-1,i=Se(e)?y(e.length):[];return St(e,function(a,u,d){i[++n]=t(a,u,d)}),i}function ca(e){var t=Ei(e);return t.length==1&&t[0][2]?ja(t[0][0],t[0][1]):function(n){return n===e||li(n,e,t)}}function fa(e,t){return Ci(e)&&Ga(t)?ja(He(e),t):function(n){var i=Mi(n,e);return i===r&&i===t?Wi(n,e):xn(t,i,Fe|Mt)}}function sr(e,t,n,i,a){e!==t&&ii(t,function(u,d){if(a||(a=new qe),te(u))mf(e,t,d,n,sr,i,a);else{var p=i?i(Ri(e,d),u,d+"",e,t,a):r;p===r&&(p=u),ni(e,d,p)}},Ie)}function mf(e,t,n,i,a,u,d){var p=Ri(e,n),m=Ri(t,n),S=d.get(m);if(S){ni(e,n,S);return}var I=u?u(p,m,n+"",e,t,d):r,A=I===r;if(A){var E=U(m),P=!E&&Et(m),N=!E&&!P&&Qt(m);I=m,E||P||N?U(p)?I=p:ie(p)?I=we(p):P?(A=!1,I=xa(m,!0)):N?(A=!1,I=Aa(m,!0)):I=[]:Tn(m)||Ut(m)?(I=p,Ut(p)?I=So(p):(!te(p)||ft(p))&&(I=Va(m))):A=!1}A&&(d.set(m,I),a(I,m,i,u,d),d.delete(m)),ni(e,n,I)}function da(e,t){var n=e.length;if(n)return t+=t<0?n:0,ct(t,n)?e[t]:r}function pa(e,t,n){t.length?t=ee(t,function(u){return U(u)?function(d){return Nt(d,u.length===1?u[0]:u)}:u}):t=[xe];var i=-1;t=ee(t,be($()));var a=ua(e,function(u,d,p){var m=ee(t,function(S){return S(u)});return{criteria:m,index:++i,value:u}});return Vu(a,function(u,d){return Rf(u,d,n)})}function vf(e,t){return ha(e,t,function(n,i){return Wi(e,i)})}function ha(e,t,n){for(var i=-1,a=t.length,u={};++i<a;){var d=t[i],p=Nt(e,d);n(p,d)&&An(u,xt(d,e),p)}return u}function yf(e){return function(t){return Nt(t,e)}}function fi(e,t,n,i){var a=i?ku:Vt,u=-1,d=t.length,p=e;for(e===t&&(t=we(t)),n&&(p=ee(e,be(n)));++u<d;)for(var m=0,S=t[u],I=n?n(S):S;(m=a(p,I,m,i))>-1;)p!==e&&Yn.call(p,m,1),Yn.call(e,m,1);return e}function ga(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==u){var u=a;ct(a)?Yn.call(e,a,1):gi(e,a)}}return e}function di(e,t){return e+Xn(Ys()*(t-e+1))}function _f(e,t,n,i){for(var a=-1,u=oe(Zn((t-e)/(n||1)),0),d=y(u);u--;)d[i?u:++a]=e,e+=n;return d}function pi(e,t){var n="";if(!e||t<1||t>mt)return n;do t%2&&(n+=e),t=Xn(t/2),t&&(e+=e);while(t);return n}function W(e,t){return Pi(qa(e,t,xe),e+"")}function wf(e){return Xs(en(e))}function Sf(e,t){var n=en(e);return gr(n,$t(t,0,n.length))}function An(e,t,n,i){if(!te(e))return e;t=xt(t,e);for(var a=-1,u=t.length,d=u-1,p=e;p!=null&&++a<u;){var m=He(t[a]),S=n;if(m==="__proto__"||m==="constructor"||m==="prototype")return e;if(a!=d){var I=p[m];S=i?i(I,m,p):r,S===r&&(S=te(I)?I:ct(t[a+1])?[]:{})}wn(p,m,S),p=p[m]}return e}var ma=Qn?function(e,t){return Qn.set(e,t),e}:xe,If=Jn?function(e,t){return Jn(e,"toString",{configurable:!0,enumerable:!1,value:ki(t),writable:!0})}:xe;function xf(e){return gr(en(e))}function Ue(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var u=y(a);++i<a;)u[i]=e[i+t];return u}function Af(e,t){var n;return St(e,function(i,a,u){return n=t(i,a,u),!n}),!!n}function ar(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=bl){for(;i<a;){var u=i+a>>>1,d=e[u];d!==null&&!Te(d)&&(n?d<=t:d<t)?i=u+1:a=u}return a}return hi(e,t,xe,n)}function hi(e,t,n,i){var a=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var d=t!==t,p=t===null,m=Te(t),S=t===r;a<u;){var I=Xn((a+u)/2),A=n(e[I]),E=A!==r,P=A===null,N=A===A,M=Te(A);if(d)var F=i||N;else S?F=N&&(i||E):p?F=N&&E&&(i||!P):m?F=N&&E&&!P&&(i||!M):P||M?F=!1:F=i?A<=t:A<t;F?a=I+1:u=I}return he(u,El)}function va(e,t){for(var n=-1,i=e.length,a=0,u=[];++n<i;){var d=e[n],p=t?t(d):d;if(!n||!ze(p,m)){var m=p;u[a++]=d===0?0:d}}return u}function ya(e){return typeof e=="number"?e:Te(e)?Fn:+e}function Ce(e){if(typeof e=="string")return e;if(U(e))return ee(e,Ce)+"";if(Te(e))return Js?Js.call(e):"";var t=e+"";return t=="0"&&1/e==-Ct?"-0":t}function It(e,t,n){var i=-1,a=Wn,u=e.length,d=!0,p=[],m=p;if(n)d=!1,a=Gr;else if(u>=f){var S=t?null:Of(e);if(S)return kn(S);d=!1,a=hn,m=new Ft}else m=t?[]:p;e:for(;++i<u;){var I=e[i],A=t?t(I):I;if(I=n||I!==0?I:0,d&&A===A){for(var E=m.length;E--;)if(m[E]===A)continue e;t&&m.push(A),p.push(I)}else a(m,A,n)||(m!==p&&m.push(A),p.push(I))}return p}function gi(e,t){t=xt(t,e);var n=-1,i=t.length;if(!i)return!0;for(;++n<i;){var a=He(t[n]);if(a==="__proto__"&&!H.call(e,"__proto__")||(a==="constructor"||a==="prototype")&&n<i-1)return!1}var u=Ha(e,t);return u==null||delete u[He(De(t))]}function _a(e,t,n,i){return An(e,t,n(Nt(e,t)),i)}function or(e,t,n,i){for(var a=e.length,u=i?a:-1;(i?u--:++u<a)&&t(e[u],u,e););return n?Ue(e,i?0:u,i?u+1:a):Ue(e,i?u+1:0,i?a:u)}function wa(e,t){var n=e;return n instanceof V&&(n=n.value()),jr(t,function(i,a){return a.func.apply(a.thisArg,yt([i],a.args))},n)}function mi(e,t,n){var i=e.length;if(i<2)return i?It(e[0]):[];for(var a=-1,u=y(i);++a<i;)for(var d=e[a],p=-1;++p<i;)p!=a&&(u[a]=Sn(u[a]||d,e[p],t,n));return It(de(u,1),t,n)}function Sa(e,t,n){for(var i=-1,a=e.length,u=t.length,d={};++i<a;){var p=i<u?t[i]:r;n(d,e[i],p)}return d}function vi(e){return ie(e)?e:[]}function yi(e){return typeof e=="function"?e:xe}function xt(e,t){return U(e)?e:Ci(e,t)?[e]:Ja(z(e))}var Ef=W;function At(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Ue(e,t,n)}var Ia=fc||function(e){return fe.clearTimeout(e)};function xa(e,t){if(t)return e.slice();var n=e.length,i=js?js(n):new e.constructor(n);return e.copy(i),i}function _i(e){var t=new e.constructor(e.byteLength);return new zn(t).set(new zn(e)),t}function bf(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Cf(e){var t=new e.constructor(e.source,as.exec(e));return t.lastIndex=e.lastIndex,t}function Tf(e){return _n?K(_n.call(e)):{}}function Aa(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ea(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,u=Te(e),d=t!==r,p=t===null,m=t===t,S=Te(t);if(!p&&!S&&!u&&e>t||u&&d&&m&&!p&&!S||i&&d&&m||!n&&m||!a)return 1;if(!i&&!u&&!S&&e<t||S&&n&&a&&!i&&!u||p&&n&&a||!d&&a||!m)return-1}return 0}function Rf(e,t,n){for(var i=-1,a=e.criteria,u=t.criteria,d=a.length,p=n.length;++i<d;){var m=Ea(a[i],u[i]);if(m){if(i>=p)return m;var S=n[i];return m*(S=="desc"?-1:1)}}return e.index-t.index}function ba(e,t,n,i){for(var a=-1,u=e.length,d=n.length,p=-1,m=t.length,S=oe(u-d,0),I=y(m+S),A=!i;++p<m;)I[p]=t[p];for(;++a<d;)(A||a<u)&&(I[n[a]]=e[a]);for(;S--;)I[p++]=e[a++];return I}function Ca(e,t,n,i){for(var a=-1,u=e.length,d=-1,p=n.length,m=-1,S=t.length,I=oe(u-p,0),A=y(I+S),E=!i;++a<I;)A[a]=e[a];for(var P=a;++m<S;)A[P+m]=t[m];for(;++d<p;)(E||a<u)&&(A[P+n[d]]=e[a++]);return A}function we(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function et(e,t,n,i){var a=!n;n||(n={});for(var u=-1,d=t.length;++u<d;){var p=t[u],m=i?i(n[p],e[p],p,n,e):r;m===r&&(m=e[p]),a?Xe(n,p,m):wn(n,p,m)}return n}function Pf(e,t){return et(e,bi(e),t)}function Ff(e,t){return et(e,Ba(e),t)}function lr(e,t){return function(n,i){var a=U(n)?Ou:Xc,u=t?t():{};return a(n,e,$(i,2),u)}}function Jt(e){return W(function(t,n){var i=-1,a=n.length,u=a>1?n[a-1]:r,d=a>2?n[2]:r;for(u=e.length>3&&typeof u=="function"?(a--,u):r,d&&ye(n[0],n[1],d)&&(u=a<3?r:u,a=1),t=K(t);++i<a;){var p=n[i];p&&e(t,p,i,u)}return t})}function Ta(e,t){return function(n,i){if(n==null)return n;if(!Se(n))return e(n,i);for(var a=n.length,u=t?a:-1,d=K(n);(t?u--:++u<a)&&i(d[u],u,d)!==!1;);return n}}function Ra(e){return function(t,n,i){for(var a=-1,u=K(t),d=i(t),p=d.length;p--;){var m=d[e?p:++a];if(n(u[m],m,u)===!1)break}return t}}function $f(e,t,n){var i=t&me,a=En(e);function u(){var d=this&&this!==fe&&this instanceof u?a:e;return d.apply(i?n:this,arguments)}return u}function Pa(e){return function(t){t=z(t);var n=Gt(t)?je(t):r,i=n?n[0]:t.charAt(0),a=n?At(n,1).join(""):t.slice(1);return i[e]()+a}}function Zt(e){return function(t){return jr(Po(Ro(t).replace(Su,"")),e,"")}}function En(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Yt(e.prototype),i=e.apply(n,t);return te(i)?i:n}}function Nf(e,t,n){var i=En(e);function a(){for(var u=arguments.length,d=y(u),p=u,m=Xt(a);p--;)d[p]=arguments[p];var S=u<3&&d[0]!==m&&d[u-1]!==m?[]:_t(d,m);if(u-=S.length,u<n)return Oa(e,t,ur,a.placeholder,r,d,S,r,r,n-u);var I=this&&this!==fe&&this instanceof a?i:e;return Ae(I,this,d)}return a}function Fa(e){return function(t,n,i){var a=K(t);if(!Se(t)){var u=$(n,3);t=le(t),n=function(p){return u(a[p],p,a)}}var d=e(t,n,i);return d>-1?a[u?t[d]:d]:r}}function $a(e){return ut(function(t){var n=t.length,i=n,a=Le.prototype.thru;for(e&&t.reverse();i--;){var u=t[i];if(typeof u!="function")throw new Ne(x);if(a&&!d&&pr(u)=="wrapper")var d=new Le([],!0)}for(i=d?i:n;++i<n;){u=t[i];var p=pr(u),m=p=="wrapper"?Ai(u):r;m&&Ti(m[0])&&m[1]==(it|ke|ce|an)&&!m[4].length&&m[9]==1?d=d[pr(m[0])].apply(d,m[3]):d=u.length==1&&Ti(u)?d[p]():d.thru(u)}return function(){var S=arguments,I=S[0];if(d&&S.length==1&&U(I))return d.plant(I).value();for(var A=0,E=n?t[A].apply(this,S):I;++A<n;)E=t[A].call(this,E);return E}})}function ur(e,t,n,i,a,u,d,p,m,S){var I=t&it,A=t&me,E=t>,P=t&(ke|rt),N=t&Ar,M=E?r:En(e);function F(){for(var k=arguments.length,G=y(k),Re=k;Re--;)G[Re]=arguments[Re];if(P)var _e=Xt(F),Pe=ju(G,_e);if(i&&(G=ba(G,i,a,P)),u&&(G=Ca(G,u,d,P)),k-=Pe,P&&k<S){var se=_t(G,_e);return Oa(e,t,ur,F.placeholder,n,G,se,p,m,S-k)}var Ke=A?n:this,pt=E?Ke[e]:e;return k=G.length,p?G=Qf(G,p):N&&k>1&&G.reverse(),I&&m<k&&(G.length=m),this&&this!==fe&&this instanceof F&&(pt=M||En(pt)),pt.apply(Ke,G)}return F}function Na(e,t){return function(n,i){return of(n,e,t(i),{})}}function cr(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=Ce(n),i=Ce(i)):(n=ya(n),i=ya(i)),a=e(n,i)}return a}}function wi(e){return ut(function(t){return t=ee(t,be($())),W(function(n){var i=this;return e(t,function(a){return Ae(a,i,n)})})})}function fr(e,t){t=t===r?" ":Ce(t);var n=t.length;if(n<2)return n?pi(t,e):t;var i=pi(t,Zn(e/jt(t)));return Gt(t)?At(je(i),0,e).join(""):i.slice(0,e)}function Lf(e,t,n,i){var a=t&me,u=En(e);function d(){for(var p=-1,m=arguments.length,S=-1,I=i.length,A=y(I+m),E=this&&this!==fe&&this instanceof d?u:e;++S<I;)A[S]=i[S];for(;m--;)A[S++]=arguments[++p];return Ae(E,a?n:this,A)}return d}function La(e){return function(t,n,i){return i&&typeof i!="number"&&ye(t,n,i)&&(n=i=r),t=dt(t),n===r?(n=t,t=0):n=dt(n),i=i===r?t<n?1:-1:dt(i),_f(t,n,i,e)}}function dr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Me(t),n=Me(n)),e(t,n)}}function Oa(e,t,n,i,a,u,d,p,m,S){var I=t&ke,A=I?d:r,E=I?r:d,P=I?u:r,N=I?r:u;t|=I?ce:sn,t&=~(I?sn:ce),t&rn||(t&=-4);var M=[e,t,a,P,A,N,E,p,m,S],F=n.apply(r,M);return Ti(e)&&za(F,M),F.placeholder=i,Ka(F,e,t)}function Si(e){var t=ae[e];return function(n,i){if(n=Me(n),i=i==null?0:he(D(i),292),i&&Ks(n)){var a=(z(n)+"e").split("e"),u=t(a[0]+"e"+(+a[1]+i));return a=(z(u)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var Of=zt&&1/kn(new zt([,-0]))[1]==Ct?function(e){return new zt(e)}:ji;function Ua(e){return function(t){var n=ge(t);return n==Ve?Zr(t):n==Ge?Zu(t):Gu(t,e(t))}}function lt(e,t,n,i,a,u,d,p){var m=t>if(!m&&typeof e!="function")throw new Ne(x);var S=i?i.length:0;if(S||(t&=-97,i=a=r),d=d===r?d:oe(D(d),0),p=p===r?p:D(p),S-=a?a.length:0,t&sn){var I=i,A=a;i=a=r}var E=m?r:Ai(e),P=[e,t,n,i,a,I,A,u,d,p];if(E&&Jf(P,E),e=P[0],t=P[1],n=P[2],i=P[3],a=P[4],p=P[9]=P[9]===r?m?0:e.length:oe(P[9]-S,0),!p&&t&(ke|rt)&&(t&=-25),!t||t==me)var N=$f(e,t,n);else t==ke||t==rt?N=Nf(e,t,p):(t==ce||t==(me|ce))&&!a.length?N=Lf(e,t,n,i):N=ur.apply(r,P);var M=E?ma:za;return Ka(M(N,P),e,t)}function Da(e,t,n,i){return e===r||ze(e,Ht[n])&&!H.call(i,n)?t:e}function Ma(e,t,n,i,a,u){return te(e)&&te(t)&&(u.set(t,e),sr(e,t,r,Ma,u),u.delete(t)),e}function Uf(e){return Tn(e)?r:e}function Wa(e,t,n,i,a,u){var d=n&Fe,p=e.length,m=t.length;if(p!=m&&!(d&&m>p))return!1;var S=u.get(e),I=u.get(t);if(S&&I)return S==t&&I==e;var A=-1,E=!0,P=n&Mt?new Ft:r;for(u.set(e,t),u.set(t,e);++A<p;){var N=e[A],M=t[A];if(i)var F=d?i(M,N,A,t,e,u):i(N,M,A,e,t,u);if(F!==r){if(F)continue;E=!1;break}if(P){if(!qr(t,function(k,G){if(!hn(P,G)&&(N===k||a(N,k,n,i,u)))return P.push(G)})){E=!1;break}}else if(!(N===M||a(N,M,n,i,u))){E=!1;break}}return u.delete(e),u.delete(t),E}function Df(e,t,n,i,a,u,d){switch(n){case Bt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case pn:return!(e.byteLength!=t.byteLength||!u(new zn(e),new zn(t)));case on:case ln:case un:return ze(+e,+t);case Nn:return e.name==t.name&&e.message==t.message;case cn:case fn:return e==t+"";case Ve:var p=Zr;case Ge:var m=i&Fe;if(p||(p=kn),e.size!=t.size&&!m)return!1;var S=d.get(e);if(S)return S==t;i|=Mt,d.set(e,t);var I=Wa(p(e),p(t),i,a,u,d);return d.delete(e),I;case On:if(_n)return _n.call(e)==_n.call(t)}return!1}function Mf(e,t,n,i,a,u){var d=n&Fe,p=Ii(e),m=p.length,S=Ii(t),I=S.length;if(m!=I&&!d)return!1;for(var A=m;A--;){var E=p[A];if(!(d?E in t:H.call(t,E)))return!1}var P=u.get(e),N=u.get(t);if(P&&N)return P==t&&N==e;var M=!0;u.set(e,t),u.set(t,e);for(var F=d;++A<m;){E=p[A];var k=e[E],G=t[E];if(i)var Re=d?i(G,k,E,t,e,u):i(k,G,E,e,t,u);if(!(Re===r?k===G||a(k,G,n,i,u):Re)){M=!1;break}F||(F=E=="constructor")}if(M&&!F){var _e=e.constructor,Pe=t.constructor;_e!=Pe&&"constructor"in e&&"constructor"in t&&!(typeof _e=="function"&&_e instanceof _e&&typeof Pe=="function"&&Pe instanceof Pe)&&(M=!1)}return u.delete(e),u.delete(t),M}function ut(e){return Pi(qa(e,r,eo),e+"")}function Ii(e){return sa(e,le,bi)}function xi(e){return sa(e,Ie,Ba)}var Ai=Qn?function(e){return Qn.get(e)}:ji;function pr(e){for(var t=e.name+"",n=Kt[t],i=H.call(Kt,t)?n.length:0;i--;){var a=n[i],u=a.func;if(u==null||u==e)return a.name}return t}function Xt(e){var t=H.call(o,"placeholder")?o:e;return t.placeholder}function $(){var e=o.iteratee||Vi;return e=e===Vi?la:e,arguments.length?e(arguments[0],arguments[1]):e}function hr(e,t){var n=e.__data__;return Hf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ei(e){for(var t=le(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,Ga(a)]}return t}function Lt(e,t){var n=Ku(e,t);return oa(n)?n:r}function Wf(e){var t=H.call(e,Rt),n=e[Rt];try{e[Rt]=r;var i=!0}catch{}var a=qn.call(e);return i&&(t?e[Rt]=n:delete e[Rt]),a}var bi=Qr?function(e){return e==null?[]:(e=K(e),vt(Qr(e),function(t){return Hs.call(e,t)}))}:qi,Ba=Qr?function(e){for(var t=[];e;)yt(t,bi(e)),e=Kn(e);return t}:qi,ge=ve;(ei&&ge(new ei(new ArrayBuffer(1)))!=Bt||mn&&ge(new mn)!=Ve||ti&&ge(ti.resolve())!=ts||zt&&ge(new zt)!=Ge||vn&&ge(new vn)!=dn)&&(ge=function(e){var t=ve(e),n=t==st?e.constructor:r,i=n?Ot(n):"";if(i)switch(i){case wc:return Bt;case Sc:return Ve;case Ic:return ts;case xc:return Ge;case Ac:return dn}return t});function Bf(e,t,n){for(var i=-1,a=n.length;++i<a;){var u=n[i],d=u.size;switch(u.type){case"drop":e+=d;break;case"dropRight":t-=d;break;case"take":t=he(t,e+d);break;case"takeRight":e=oe(e,t-d);break}}return{start:e,end:t}}function kf(e){var t=e.match(zl);return t?t[1].split(Kl):[]}function ka(e,t,n){t=xt(t,e);for(var i=-1,a=t.length,u=!1;++i<a;){var d=He(t[i]);if(!(u=e!=null&&n(e,d)))break;e=e[d]}return u||++i!=a?u:(a=e==null?0:e.length,!!a&&Sr(a)&&ct(d,a)&&(U(e)||Ut(e)))}function Vf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&H.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Va(e){return typeof e.constructor=="function"&&!bn(e)?Yt(Kn(e)):{}}function Gf(e,t,n){var i=e.constructor;switch(t){case pn:return _i(e);case on:case ln:return new i(+e);case Bt:return bf(e,n);case Er:case br:case Cr:case Tr:case Rr:case Pr:case Fr:case $r:case Nr:return Aa(e,n);case Ve:return new i;case un:case fn:return new i(e);case cn:return Cf(e);case Ge:return new i;case On:return Tf(e)}}function jf(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(Hl,`{
|
|
10
10
|
/* [wrapped with `+t+`] */
|
|
11
|
-
`)}function kf(e){return U(e)||Dt(e)||!!(Hs&&e&&e[Hs])}function dt(e,t){var n=typeof e;return t=t??mt,!!t&&(n=="number"||n!="symbol"&&Xu.test(e))&&e>-1&&e%1==0&&e<t}function me(e,t,n){if(!te(n))return!1;var i=typeof t;return(i=="number"?_e(n)&&dt(t,n.length):i=="string"&&t in n)?Ke(n[t],e):!1}function Ci(e,t){if(U(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Te(e)?!0:Du.test(e)||!Uu.test(e)||t!=null&&e in j(t)}function Vf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ti(e){var t=dr(e),n=o[t];if(typeof n!="function"||!(t in k.prototype))return!1;if(e===n)return!0;var i=Ei(n);return!!i&&e===i[0]}function Gf(e){return!!ks&&ks in e}var qf=Vn?pt:Hi;function En(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||zt;return e===n}function ka(e){return e===e&&!te(e)}function Va(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in j(n))}}function Hf(e){var t=yr(e,function(i){return n.size===O&&n.clear(),i}),n=t.cache;return t}function zf(e,t){var n=e[1],i=t[1],a=n|i,u=a<(Ie|Ze|st),d=i==st&&n==$e||i==st&&n==rn&&e[7].length<=t[8]||i==(st|rn)&&t[7].length<=t[8]&&n==$e;if(!(u||d))return e;i&Ie&&(e[2]=t[2],a|=n&Ie?0:Rn);var p=t[3];if(p){var g=e[3];e[3]=g?Ea(g,p,t[4]):p,e[4]=g?_t(e[3],G):t[4]}return p=t[5],p&&(g=e[5],e[5]=g?Aa(g,p,t[6]):p,e[6]=g?_t(e[5],G):t[6]),p=t[7],p&&(e[7]=p),i&st&&(e[8]=e[8]==null?t[8]:de(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function Kf(e){var t=[];if(e!=null)for(var n in j(e))t.push(n);return t}function jf(e){return qn.call(e)}function Ga(e,t,n){return t=oe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,u=oe(i.length-t,0),d=v(u);++a<u;)d[a]=i[t+a];a=-1;for(var p=v(t+1);++a<t;)p[a]=i[a];return p[t]=n(d),Ae(e,this,p)}}function qa(e,t){return t.length<2?e:Nt(e,Me(t,0,-1))}function Jf(e,t){for(var n=e.length,i=de(t.length,n),a=ye(e);i--;){var u=t[i];e[i]=dt(u,n)?a[u]:r}return e}function Ri(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Ha=Ka(ha),An=lc||function(e,t){return ce.setTimeout(e,t)},Pi=Ka(yf);function za(e,t,n){var i=t+"";return Pi(e,Bf(i,Yf(Df(i),n)))}function Ka(e){var t=0,n=0;return function(){var i=pc(),a=mu-(i-n);if(n=i,a>0){if(++t>=gu)return arguments[0]}else t=0;return e.apply(r,arguments)}}function hr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var u=di(n,a),d=e[u];e[u]=e[n],e[n]=d}return e.length=t,e}var ja=Hf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Mu,function(n,i,a,u){t.push(a?u.replace(zu,"$1"):i||n)}),t});function tt(e){if(typeof e=="string"||Te(e))return e;var t=e+"";return t=="0"&&1/e==-Tt?"-0":t}function Ut(e){if(e!=null){try{return Gn.call(e)}catch{}try{return e+""}catch{}}return""}function Yf(e,t){return Ne(Iu,function(n){var i="_."+n[0];t&n[1]&&!Mn(e,i)&&e.push(i)}),e.sort()}function Ja(e){if(e instanceof k)return e.clone();var t=new Ue(e.__wrapped__,e.__chain__);return t.__actions__=ye(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Zf(e,t,n){(n?me(e,t,n):t===r)?t=1:t=oe(D(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,u=0,d=v(Yn(i/t));a<i;)d[u++]=Me(e,a,a+=t);return d}function Xf(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var u=e[t];u&&(a[i++]=u)}return a}function Qf(){var e=arguments.length;if(!e)return[];for(var t=v(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return yt(U(n)?ye(n):[n],fe(t,1))}var ed=W(function(e,t){return re(e)?_n(e,fe(t,1,re,!0)):[]}),td=W(function(e,t){var n=We(t);return re(n)&&(n=r),re(e)?_n(e,fe(t,1,re,!0),F(n,2)):[]}),nd=W(function(e,t){var n=We(t);return re(n)&&(n=r),re(e)?_n(e,fe(t,1,re,!0),r,n):[]});function rd(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),Me(e,t<0?0:t,i)):[]}function id(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),t=i-t,Me(e,0,t<0?0:t)):[]}function sd(e,t){return e&&e.length?ar(e,F(t,3),!0,!0):[]}function ad(e,t){return e&&e.length?ar(e,F(t,3),!0):[]}function od(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&me(e,t,n)&&(n=0,i=a),Xc(e,t,n,i)):[]}function Ya(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:D(n);return a<0&&(a=oe(i+a,0)),Wn(e,F(t,3),a)}function Za(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=D(n),a=n<0?oe(i+a,0):de(a,i-1)),Wn(e,F(t,3),a,!0)}function Xa(e){var t=e==null?0:e.length;return t?fe(e,1):[]}function ud(e){var t=e==null?0:e.length;return t?fe(e,Tt):[]}function ld(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:D(t),fe(e,t)):[]}function cd(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];i[a[0]]=a[1]}return i}function Qa(e){return e&&e.length?e[0]:r}function fd(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:D(n);return a<0&&(a=oe(i+a,0)),Vt(e,t,a)}function dd(e){var t=e==null?0:e.length;return t?Me(e,0,-1):[]}var pd=W(function(e){var t=ee(e,vi);return t.length&&t[0]===e[0]?oi(t):[]}),hd=W(function(e){var t=We(e),n=ee(e,vi);return t===We(n)?t=r:n.pop(),n.length&&n[0]===e[0]?oi(n,F(t,2)):[]}),gd=W(function(e){var t=We(e),n=ee(e,vi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?oi(n,r,t):[]});function md(e,t){return e==null?"":fc.call(e,t)}function We(e){var t=e==null?0:e.length;return t?e[t-1]:r}function vd(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=D(n),a=a<0?oe(i+a,0):de(a,i-1)),t===t?Jl(e,t,a):Wn(e,Ls,a,!0)}function yd(e,t){return e&&e.length?ca(e,D(t)):r}var _d=W(eo);function eo(e,t){return e&&e.length&&t&&t.length?fi(e,t):e}function wd(e,t,n){return e&&e.length&&t&&t.length?fi(e,t,F(n,2)):e}function Sd(e,t,n){return e&&e.length&&t&&t.length?fi(e,t,r,n):e}var Id=ft(function(e,t){var n=e==null?0:e.length,i=ri(e,t);return pa(e,ee(t,function(a){return dt(a,n)?+a:a}).sort(xa)),i});function xd(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],u=e.length;for(t=F(t,3);++i<u;){var d=e[i];t(d,i,e)&&(n.push(d),a.push(i))}return pa(e,a),n}function Fi(e){return e==null?e:gc.call(e)}function Ed(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&me(e,t,n)?(t=0,n=i):(t=t==null?0:D(t),n=n===r?i:D(n)),Me(e,t,n)):[]}function Ad(e,t){return sr(e,t)}function bd(e,t,n){return hi(e,t,F(n,2))}function Cd(e,t){var n=e==null?0:e.length;if(n){var i=sr(e,t);if(i<n&&Ke(e[i],t))return i}return-1}function Td(e,t){return sr(e,t,!0)}function Rd(e,t,n){return hi(e,t,F(n,2),!0)}function Pd(e,t){var n=e==null?0:e.length;if(n){var i=sr(e,t,!0)-1;if(Ke(e[i],t))return i}return-1}function Fd(e){return e&&e.length?ga(e):[]}function $d(e,t){return e&&e.length?ga(e,F(t,2)):[]}function Ld(e){var t=e==null?0:e.length;return t?Me(e,1,t):[]}function Nd(e,t,n){return e&&e.length?(t=n||t===r?1:D(t),Me(e,0,t<0?0:t)):[]}function Od(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),t=i-t,Me(e,t<0?0:t,i)):[]}function Ud(e,t){return e&&e.length?ar(e,F(t,3),!1,!0):[]}function Dd(e,t){return e&&e.length?ar(e,F(t,3)):[]}var Md=W(function(e){return It(fe(e,1,re,!0))}),Wd=W(function(e){var t=We(e);return re(t)&&(t=r),It(fe(e,1,re,!0),F(t,2))}),Bd=W(function(e){var t=We(e);return t=typeof t=="function"?t:r,It(fe(e,1,re,!0),r,t)});function kd(e){return e&&e.length?It(e):[]}function Vd(e,t){return e&&e.length?It(e,F(t,2)):[]}function Gd(e,t){return t=typeof t=="function"?t:r,e&&e.length?It(e,r,t):[]}function $i(e){if(!(e&&e.length))return[];var t=0;return e=vt(e,function(n){if(re(n))return t=oe(n.length,t),!0}),Jr(t,function(n){return ee(e,zr(n))})}function to(e,t){if(!(e&&e.length))return[];var n=$i(e);return t==null?n:ee(n,function(i){return Ae(t,r,i)})}var qd=W(function(e,t){return re(e)?_n(e,t):[]}),Hd=W(function(e){return mi(vt(e,re))}),zd=W(function(e){var t=We(e);return re(t)&&(t=r),mi(vt(e,re),F(t,2))}),Kd=W(function(e){var t=We(e);return t=typeof t=="function"?t:r,mi(vt(e,re),r,t)}),jd=W($i);function Jd(e,t){return _a(e||[],t||[],yn)}function Yd(e,t){return _a(e||[],t||[],In)}var Zd=W(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,to(e,n)});function no(e){var t=o(e);return t.__chain__=!0,t}function Xd(e,t){return t(e),e}function gr(e,t){return t(e)}var Qd=ft(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(u){return ri(u,e)};return t>1||this.__actions__.length||!(i instanceof k)||!dt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:gr,args:[a],thisArg:r}),new Ue(i,this.__chain__).thru(function(u){return t&&!u.length&&u.push(r),u}))});function ep(){return no(this)}function tp(){return new Ue(this.value(),this.__chain__)}function np(){this.__values__===r&&(this.__values__=vo(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function rp(){return this}function ip(e){for(var t,n=this;n instanceof er;){var i=Ja(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function sp(){var e=this.__wrapped__;if(e instanceof k){var t=e;return this.__actions__.length&&(t=new k(this)),t=t.reverse(),t.__actions__.push({func:gr,args:[Fi],thisArg:r}),new Ue(t,this.__chain__)}return this.thru(Fi)}function ap(){return ya(this.__wrapped__,this.__actions__)}var op=or(function(e,t,n){K.call(e,n)?++e[n]:lt(e,n,1)});function up(e,t,n){var i=U(e)?Fs:Zc;return n&&me(e,t,n)&&(t=r),i(e,F(t,3))}function lp(e,t){var n=U(e)?vt:ta;return n(e,F(t,3))}var cp=Ra(Ya),fp=Ra(Za);function dp(e,t){return fe(mr(e,t),1)}function pp(e,t){return fe(mr(e,t),Tt)}function hp(e,t,n){return n=n===r?1:D(n),fe(mr(e,t),n)}function ro(e,t){var n=U(e)?Ne:St;return n(e,F(t,3))}function io(e,t){var n=U(e)?$l:ea;return n(e,F(t,3))}var gp=or(function(e,t,n){K.call(e,n)?e[n].push(t):lt(e,n,[t])});function mp(e,t,n,i){e=_e(e)?e:en(e),n=n&&!i?D(n):0;var a=e.length;return n<0&&(n=oe(a+n,0)),Sr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&Vt(e,t,n)>-1}var vp=W(function(e,t,n){var i=-1,a=typeof t=="function",u=_e(e)?v(e.length):[];return St(e,function(d){u[++i]=a?Ae(t,d,n):wn(d,t,n)}),u}),yp=or(function(e,t,n){lt(e,n,t)});function mr(e,t){var n=U(e)?ee:oa;return n(e,F(t,3))}function _p(e,t,n,i){return e==null?[]:(U(t)||(t=t==null?[]:[t]),n=i?r:n,U(n)||(n=n==null?[]:[n]),fa(e,t,n))}var wp=or(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Sp(e,t,n){var i=U(e)?qr:Os,a=arguments.length<3;return i(e,F(t,4),n,a,St)}function Ip(e,t,n){var i=U(e)?Ll:Os,a=arguments.length<3;return i(e,F(t,4),n,a,ea)}function xp(e,t){var n=U(e)?vt:ta;return n(e,_r(F(t,3)))}function Ep(e){var t=U(e)?Ys:mf;return t(e)}function Ap(e,t,n){(n?me(e,t,n):t===r)?t=1:t=D(t);var i=U(e)?zc:vf;return i(e,t)}function bp(e){var t=U(e)?Kc:_f;return t(e)}function Cp(e){if(e==null)return 0;if(_e(e))return Sr(e)?qt(e):e.length;var t=pe(e);return t==Ge||t==qe?e.size:li(e).length}function Tp(e,t,n){var i=U(e)?Hr:wf;return n&&me(e,t,n)&&(t=r),i(e,F(t,3))}var Rp=W(function(e,t){if(e==null)return[];var n=t.length;return n>1&&me(e,t[0],t[1])?t=[]:n>2&&me(t[0],t[1],t[2])&&(t=[t[0]]),fa(e,fe(t,1),[])}),vr=uc||function(){return ce.Date.now()};function Pp(e,t){if(typeof t!="function")throw new Oe(E);return e=D(e),function(){if(--e<1)return t.apply(this,arguments)}}function so(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,ct(e,st,r,r,r,r,t)}function ao(e,t){var n;if(typeof t!="function")throw new Oe(E);return e=D(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Li=W(function(e,t,n){var i=Ie;if(n.length){var a=_t(n,Xt(Li));i|=xe}return ct(e,i,t,n,a)}),oo=W(function(e,t,n){var i=Ie|Ze;if(n.length){var a=_t(n,Xt(oo));i|=xe}return ct(t,i,e,n,a)});function uo(e,t,n){t=n?r:t;var i=ct(e,$e,r,r,r,r,r,t);return i.placeholder=uo.placeholder,i}function lo(e,t,n){t=n?r:t;var i=ct(e,Ct,r,r,r,r,r,t);return i.placeholder=lo.placeholder,i}function co(e,t,n){var i,a,u,d,p,g,w=0,I=!1,x=!1,A=!0;if(typeof e!="function")throw new Oe(E);t=Be(t)||0,te(n)&&(I=!!n.leading,x="maxWait"in n,u=x?oe(Be(n.maxWait)||0,t):u,A="trailing"in n?!!n.trailing:A);function R(ie){var je=i,gt=a;return i=a=r,w=ie,d=e.apply(gt,je),d}function $(ie){return w=ie,p=An(B,t),I?R(ie):d}function M(ie){var je=ie-g,gt=ie-w,Po=t-je;return x?de(Po,u-gt):Po}function L(ie){var je=ie-g,gt=ie-w;return g===r||je>=t||je<0||x&>>=u}function B(){var ie=vr();if(L(ie))return V(ie);p=An(B,M(ie))}function V(ie){return p=r,A&&i?R(ie):(i=a=r,d)}function Re(){p!==r&&wa(p),w=0,i=g=a=p=r}function ve(){return p===r?d:V(vr())}function Pe(){var ie=vr(),je=L(ie);if(i=arguments,a=this,g=ie,je){if(p===r)return $(g);if(x)return wa(p),p=An(B,t),R(g)}return p===r&&(p=An(B,t)),d}return Pe.cancel=Re,Pe.flush=ve,Pe}var Fp=W(function(e,t){return Qs(e,1,t)}),$p=W(function(e,t,n){return Qs(e,Be(t)||0,n)});function Lp(e){return ct(e,Er)}function yr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Oe(E);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],u=n.cache;if(u.has(a))return u.get(a);var d=e.apply(this,i);return n.cache=u.set(a,d)||u,d};return n.cache=new(yr.Cache||ut),n}yr.Cache=ut;function _r(e){if(typeof e!="function")throw new Oe(E);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Np(e){return ao(2,e)}var Op=Sf(function(e,t){t=t.length==1&&U(t[0])?ee(t[0],be(F())):ee(fe(t,1),be(F()));var n=t.length;return W(function(i){for(var a=-1,u=de(i.length,n);++a<u;)i[a]=t[a].call(this,i[a]);return Ae(e,this,i)})}),Ni=W(function(e,t){var n=_t(t,Xt(Ni));return ct(e,xe,r,t,n)}),fo=W(function(e,t){var n=_t(t,Xt(fo));return ct(e,Ee,r,t,n)}),Up=ft(function(e,t){return ct(e,rn,r,r,r,t)});function Dp(e,t){if(typeof e!="function")throw new Oe(E);return t=t===r?t:D(t),W(e,t)}function Mp(e,t){if(typeof e!="function")throw new Oe(E);return t=t==null?0:oe(D(t),0),W(function(n){var i=n[t],a=Et(n,0,t);return i&&yt(a,i),Ae(e,this,a)})}function Wp(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new Oe(E);return te(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),co(e,t,{leading:i,maxWait:t,trailing:a})}function Bp(e){return so(e,1)}function kp(e,t){return Ni(yi(t),e)}function Vp(){if(!arguments.length)return[];var e=arguments[0];return U(e)?e:[e]}function Gp(e){return De(e,Fe)}function qp(e,t){return t=typeof t=="function"?t:r,De(e,Fe,t)}function Hp(e){return De(e,J|Fe)}function zp(e,t){return t=typeof t=="function"?t:r,De(e,J|Fe,t)}function Kp(e,t){return t==null||Xs(e,t,ue(t))}function Ke(e,t){return e===t||e!==e&&t!==t}var jp=fr(ai),Jp=fr(function(e,t){return e>=t}),Dt=ia((function(){return arguments})())?ia:function(e){return ne(e)&&K.call(e,"callee")&&!qs.call(e,"callee")},U=v.isArray,Yp=As?be(As):rf;function _e(e){return e!=null&&wr(e.length)&&!pt(e)}function re(e){return ne(e)&&_e(e)}function Zp(e){return e===!0||e===!1||ne(e)&&ge(e)==sn}var At=cc||Hi,Xp=bs?be(bs):sf;function Qp(e){return ne(e)&&e.nodeType===1&&!bn(e)}function eh(e){if(e==null)return!0;if(_e(e)&&(U(e)||typeof e=="string"||typeof e.splice=="function"||At(e)||Qt(e)||Dt(e)))return!e.length;var t=pe(e);if(t==Ge||t==qe)return!e.size;if(En(e))return!li(e).length;for(var n in e)if(K.call(e,n))return!1;return!0}function th(e,t){return Sn(e,t)}function nh(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?Sn(e,t,r,n):!!i}function Oi(e){if(!ne(e))return!1;var t=ge(e);return t==$n||t==Eu||typeof e.message=="string"&&typeof e.name=="string"&&!bn(e)}function rh(e){return typeof e=="number"&&zs(e)}function pt(e){if(!te(e))return!1;var t=ge(e);return t==Ln||t==Qi||t==xu||t==bu}function po(e){return typeof e=="number"&&e==D(e)}function wr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mt}function te(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ne(e){return e!=null&&typeof e=="object"}var ho=Cs?be(Cs):of;function ih(e,t){return e===t||ui(e,t,Ai(t))}function sh(e,t,n){return n=typeof n=="function"?n:r,ui(e,t,Ai(t),n)}function ah(e){return go(e)&&e!=+e}function oh(e){if(qf(e))throw new N(S);return sa(e)}function uh(e){return e===null}function lh(e){return e==null}function go(e){return typeof e=="number"||ne(e)&&ge(e)==on}function bn(e){if(!ne(e)||ge(e)!=at)return!1;var t=Kn(e);if(t===null)return!0;var n=K.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gn.call(n)==ic}var Ui=Ts?be(Ts):uf;function ch(e){return po(e)&&e>=-mt&&e<=mt}var mo=Rs?be(Rs):lf;function Sr(e){return typeof e=="string"||!U(e)&&ne(e)&&ge(e)==ln}function Te(e){return typeof e=="symbol"||ne(e)&&ge(e)==Nn}var Qt=Ps?be(Ps):cf;function fh(e){return e===r}function dh(e){return ne(e)&&pe(e)==cn}function ph(e){return ne(e)&&ge(e)==Tu}var hh=fr(ci),gh=fr(function(e,t){return e<=t});function vo(e){if(!e)return[];if(_e(e))return Sr(e)?He(e):ye(e);if(pn&&e[pn])return zl(e[pn]());var t=pe(e),n=t==Ge?Zr:t==qe?Bn:en;return n(e)}function ht(e){if(!e)return e===0?e:0;if(e=Be(e),e===Tt||e===-Tt){var t=e<0?-1:1;return t*_u}return e===e?e:0}function D(e){var t=ht(e),n=t%1;return t===t?n?t-n:t:0}function yo(e){return e?Lt(D(e),0,Xe):0}function Be(e){if(typeof e=="number")return e;if(Te(e))return Pn;if(te(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=te(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Us(e);var n=Ju.test(e);return n||Zu.test(e)?Rl(e.slice(2),n?2:8):ju.test(e)?Pn:+e}function _o(e){return et(e,we(e))}function mh(e){return e?Lt(D(e),-mt,mt):e===0?e:0}function z(e){return e==null?"":Ce(e)}var vh=Yt(function(e,t){if(En(t)||_e(t)){et(t,ue(t),e);return}for(var n in t)K.call(t,n)&&yn(e,n,t[n])}),wo=Yt(function(e,t){et(t,we(t),e)}),Ir=Yt(function(e,t,n,i){et(t,we(t),e,i)}),yh=Yt(function(e,t,n,i){et(t,ue(t),e,i)}),_h=ft(ri);function wh(e,t){var n=Jt(e);return t==null?n:Zs(n,t)}var Sh=W(function(e,t){e=j(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&me(t[0],t[1],a)&&(i=1);++n<i;)for(var u=t[n],d=we(u),p=-1,g=d.length;++p<g;){var w=d[p],I=e[w];(I===r||Ke(I,zt[w])&&!K.call(e,w))&&(e[w]=u[w])}return e}),Ih=W(function(e){return e.push(r,Ua),Ae(So,r,e)});function xh(e,t){return $s(e,F(t,3),Qe)}function Eh(e,t){return $s(e,F(t,3),si)}function Ah(e,t){return e==null?e:ii(e,F(t,3),we)}function bh(e,t){return e==null?e:na(e,F(t,3),we)}function Ch(e,t){return e&&Qe(e,F(t,3))}function Th(e,t){return e&&si(e,F(t,3))}function Rh(e){return e==null?[]:rr(e,ue(e))}function Ph(e){return e==null?[]:rr(e,we(e))}function Di(e,t,n){var i=e==null?r:Nt(e,t);return i===r?n:i}function Fh(e,t){return e!=null&&Wa(e,t,Qc)}function Mi(e,t){return e!=null&&Wa(e,t,ef)}var $h=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),e[t]=n},Bi(Se)),Lh=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),K.call(e,t)?e[t].push(n):e[t]=[n]},F),Nh=W(wn);function ue(e){return _e(e)?Js(e):li(e)}function we(e){return _e(e)?Js(e,!0):ff(e)}function Oh(e,t){var n={};return t=F(t,3),Qe(e,function(i,a,u){lt(n,t(i,a,u),i)}),n}function Uh(e,t){var n={};return t=F(t,3),Qe(e,function(i,a,u){lt(n,a,t(i,a,u))}),n}var Dh=Yt(function(e,t,n){ir(e,t,n)}),So=Yt(function(e,t,n,i){ir(e,t,n,i)}),Mh=ft(function(e,t){var n={};if(e==null)return n;var i=!1;t=ee(t,function(u){return u=xt(u,e),i||(i=u.length>1),u}),et(e,xi(e),n),i&&(n=De(n,J|se|Fe,$f));for(var a=t.length;a--;)gi(n,t[a]);return n});function Wh(e,t){return Io(e,_r(F(t)))}var Bh=ft(function(e,t){return e==null?{}:pf(e,t)});function Io(e,t){if(e==null)return{};var n=ee(xi(e),function(i){return[i]});return t=F(t),da(e,n,function(i,a){return t(i,a[0])})}function kh(e,t,n){t=xt(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var u=e==null?r:e[tt(t[i])];u===r&&(i=a,u=n),e=pt(u)?u.call(e):u}return e}function Vh(e,t,n){return e==null?e:In(e,t,n)}function Gh(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:In(e,t,n,i)}var xo=Na(ue),Eo=Na(we);function qh(e,t,n){var i=U(e),a=i||At(e)||Qt(e);if(t=F(t,4),n==null){var u=e&&e.constructor;a?n=i?new u:[]:te(e)?n=pt(u)?Jt(Kn(e)):{}:n={}}return(a?Ne:Qe)(e,function(d,p,g){return t(n,d,p,g)}),n}function Hh(e,t){return e==null?!0:gi(e,t)}function zh(e,t,n){return e==null?e:va(e,t,yi(n))}function Kh(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:va(e,t,yi(n),i)}function en(e){return e==null?[]:Yr(e,ue(e))}function jh(e){return e==null?[]:Yr(e,we(e))}function Jh(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Be(n),n=n===n?n:0),t!==r&&(t=Be(t),t=t===t?t:0),Lt(Be(e),t,n)}function Yh(e,t,n){return t=ht(t),n===r?(n=t,t=0):n=ht(n),e=Be(e),tf(e,t,n)}function Zh(e,t,n){if(n&&typeof n!="boolean"&&me(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=ht(e),t===r?(t=e,e=0):t=ht(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Ks();return de(e+a*(t-e+Tl("1e-"+((a+"").length-1))),t)}return di(e,t)}var Xh=Zt(function(e,t,n){return t=t.toLowerCase(),e+(n?Ao(t):t)});function Ao(e){return Wi(z(e).toLowerCase())}function bo(e){return e=z(e),e&&e.replace(Qu,kl).replace(yl,"")}function Qh(e,t,n){e=z(e),t=Ce(t);var i=e.length;n=n===r?i:Lt(D(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function eg(e){return e=z(e),e&&Lu.test(e)?e.replace(ns,Vl):e}function tg(e){return e=z(e),e&&Wu.test(e)?e.replace(Nr,"\\$&"):e}var ng=Zt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),rg=Zt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),ig=Ta("toLowerCase");function sg(e,t,n){e=z(e),t=D(t);var i=t?qt(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return cr(Zn(a),n)+e+cr(Yn(a),n)}function ag(e,t,n){e=z(e),t=D(t);var i=t?qt(e):0;return t&&i<t?e+cr(t-i,n):e}function og(e,t,n){e=z(e),t=D(t);var i=t?qt(e):0;return t&&i<t?cr(t-i,n)+e:e}function ug(e,t,n){return n||t==null?t=0:t&&(t=+t),hc(z(e).replace(Or,""),t||0)}function lg(e,t,n){return(n?me(e,t,n):t===r)?t=1:t=D(t),pi(z(e),t)}function cg(){var e=arguments,t=z(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var fg=Zt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function dg(e,t,n){return n&&typeof n!="number"&&me(e,t,n)&&(t=n=r),n=n===r?Xe:n>>>0,n?(e=z(e),e&&(typeof t=="string"||t!=null&&!Ui(t))&&(t=Ce(t),!t&&Gt(e))?Et(He(e),0,n):e.split(t,n)):[]}var pg=Zt(function(e,t,n){return e+(n?" ":"")+Wi(t)});function hg(e,t,n){return e=z(e),n=n==null?0:Lt(D(n),0,e.length),t=Ce(t),e.slice(n,n+t.length)==t}function gg(e,t,n){var i=o.templateSettings;n&&me(e,t,n)&&(t=r),e=z(e),t=Ir({},t,i,Oa);var a=Ir({},t.imports,i.imports,Oa),u=ue(a),d=Yr(a,u),p,g,w=0,I=t.interpolate||On,x="__p += '",A=Xr((t.escape||On).source+"|"+I.source+"|"+(I===rs?Ku:On).source+"|"+(t.evaluate||On).source+"|$","g"),R="//# sourceURL="+(K.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xl+"]")+`
|
|
12
|
-
`;e.replace(
|
|
13
|
-
__e(`+
|
|
14
|
-
'`),
|
|
15
|
-
`+
|
|
16
|
-
__p += '`),
|
|
17
|
-
((__t = (`+
|
|
18
|
-
'`),
|
|
19
|
-
`;var
|
|
20
|
-
`+
|
|
11
|
+
`)}function qf(e){return U(e)||Ut(e)||!!(zs&&e&&e[zs])}function ct(e,t){var n=typeof e;return t=t??mt,!!t&&(n=="number"||n!="symbol"&&nu.test(e))&&e>-1&&e%1==0&&e<t}function ye(e,t,n){if(!te(n))return!1;var i=typeof t;return(i=="number"?Se(n)&&ct(t,n.length):i=="string"&&t in n)?ze(n[t],e):!1}function Ci(e,t){if(U(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Te(e)?!0:Vl.test(e)||!kl.test(e)||t!=null&&e in K(t)}function Hf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ti(e){var t=pr(e),n=o[t];if(typeof n!="function"||!(t in V.prototype))return!1;if(e===n)return!0;var i=Ai(n);return!!i&&e===i[0]}function zf(e){return!!Gs&&Gs in e}var Kf=Gn?ft:Hi;function bn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Ht;return e===n}function Ga(e){return e===e&&!te(e)}function ja(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in K(n))}}function Yf(e){var t=_r(e,function(i){return n.size===B&&n.clear(),i}),n=t.cache;return t}function Jf(e,t){var n=e[1],i=t[1],a=n|i,u=a<(me|gt|it),d=i==it&&n==ke||i==it&&n==an&&e[7].length<=t[8]||i==(it|an)&&t[7].length<=t[8]&&n==ke;if(!(u||d))return e;i&me&&(e[2]=t[2],a|=n&me?0:rn);var p=t[3];if(p){var m=e[3];e[3]=m?ba(m,p,t[4]):p,e[4]=m?_t(e[3],ne):t[4]}return p=t[5],p&&(m=e[5],e[5]=m?Ca(m,p,t[6]):p,e[6]=m?_t(e[5],ne):t[6]),p=t[7],p&&(e[7]=p),i&it&&(e[8]=e[8]==null?t[8]:he(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function Zf(e){var t=[];if(e!=null)for(var n in K(e))t.push(n);return t}function Xf(e){return qn.call(e)}function qa(e,t,n){return t=oe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,u=oe(i.length-t,0),d=y(u);++a<u;)d[a]=i[t+a];a=-1;for(var p=y(t+1);++a<t;)p[a]=i[a];return p[t]=n(d),Ae(e,this,p)}}function Ha(e,t){return t.length<2?e:Nt(e,Ue(t,0,-1))}function Qf(e,t){for(var n=e.length,i=he(t.length,n),a=we(e);i--;){var u=t[i];e[i]=ct(u,n)?a[u]:r}return e}function Ri(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var za=Ya(ma),Cn=pc||function(e,t){return fe.setTimeout(e,t)},Pi=Ya(If);function Ka(e,t,n){var i=t+"";return Pi(e,jf(i,ed(kf(i),n)))}function Ya(e){var t=0,n=0;return function(){var i=vc(),a=Sl-(i-n);if(n=i,a>0){if(++t>=wl)return arguments[0]}else t=0;return e.apply(r,arguments)}}function gr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var u=di(n,a),d=e[u];e[u]=e[n],e[n]=d}return e.length=t,e}var Ja=Yf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Gl,function(n,i,a,u){t.push(a?u.replace(Jl,"$1"):i||n)}),t});function He(e){if(typeof e=="string"||Te(e))return e;var t=e+"";return t=="0"&&1/e==-Ct?"-0":t}function Ot(e){if(e!=null){try{return jn.call(e)}catch{}try{return e+""}catch{}}return""}function ed(e,t){return Ee(Cl,function(n){var i="_."+n[0];t&n[1]&&!Wn(e,i)&&e.push(i)}),e.sort()}function Za(e){if(e instanceof V)return e.clone();var t=new Le(e.__wrapped__,e.__chain__);return t.__actions__=we(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function td(e,t,n){(n?ye(e,t,n):t===r)?t=1:t=oe(D(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,u=0,d=y(Zn(i/t));a<i;)d[u++]=Ue(e,a,a+=t);return d}function nd(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var u=e[t];u&&(a[i++]=u)}return a}function rd(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return yt(U(n)?we(n):[n],de(t,1))}var id=W(function(e,t){return ie(e)?Sn(e,de(t,1,ie,!0)):[]}),sd=W(function(e,t){var n=De(t);return ie(n)&&(n=r),ie(e)?Sn(e,de(t,1,ie,!0),$(n,2)):[]}),ad=W(function(e,t){var n=De(t);return ie(n)&&(n=r),ie(e)?Sn(e,de(t,1,ie,!0),r,n):[]});function od(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),Ue(e,t<0?0:t,i)):[]}function ld(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),t=i-t,Ue(e,0,t<0?0:t)):[]}function ud(e,t){return e&&e.length?or(e,$(t,3),!0,!0):[]}function cd(e,t){return e&&e.length?or(e,$(t,3),!0):[]}function fd(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&ye(e,t,n)&&(n=0,i=a),nf(e,t,n,i)):[]}function Xa(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:D(n);return a<0&&(a=oe(i+a,0)),Bn(e,$(t,3),a)}function Qa(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=D(n),a=n<0?oe(i+a,0):he(a,i-1)),Bn(e,$(t,3),a,!0)}function eo(e){var t=e==null?0:e.length;return t?de(e,1):[]}function dd(e){var t=e==null?0:e.length;return t?de(e,Ct):[]}function pd(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:D(t),de(e,t)):[]}function hd(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];Xe(i,a[0],a[1])}return i}function to(e){return e&&e.length?e[0]:r}function gd(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:D(n);return a<0&&(a=oe(i+a,0)),Vt(e,t,a)}function md(e){var t=e==null?0:e.length;return t?Ue(e,0,-1):[]}var vd=W(function(e){var t=ee(e,vi);return t.length&&t[0]===e[0]?oi(t):[]}),yd=W(function(e){var t=De(e),n=ee(e,vi);return t===De(n)?t=r:n.pop(),n.length&&n[0]===e[0]?oi(n,$(t,2)):[]}),_d=W(function(e){var t=De(e),n=ee(e,vi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?oi(n,r,t):[]});function wd(e,t){return e==null?"":gc.call(e,t)}function De(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Sd(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=D(n),a=a<0?oe(i+a,0):he(a,i-1)),t===t?Qu(e,t,a):Bn(e,Os,a,!0)}function Id(e,t){return e&&e.length?da(e,D(t)):r}var xd=W(no);function no(e,t){return e&&e.length&&t&&t.length?fi(e,t):e}function Ad(e,t,n){return e&&e.length&&t&&t.length?fi(e,t,$(n,2)):e}function Ed(e,t,n){return e&&e.length&&t&&t.length?fi(e,t,r,n):e}var bd=ut(function(e,t){var n=e==null?0:e.length,i=ri(e,t);return ga(e,ee(t,function(a){return ct(a,n)?+a:a}).sort(Ea)),i});function Cd(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],u=e.length;for(t=$(t,3);++i<u;){var d=e[i];t(d,i,e)&&(n.push(d),a.push(i))}return ga(e,a),n}function Fi(e){return e==null?e:_c.call(e)}function Td(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&ye(e,t,n)?(t=0,n=i):(t=t==null?0:D(t),n=n===r?i:D(n)),Ue(e,t,n)):[]}function Rd(e,t){return ar(e,t)}function Pd(e,t,n){return hi(e,t,$(n,2))}function Fd(e,t){var n=e==null?0:e.length;if(n){var i=ar(e,t);if(i<n&&ze(e[i],t))return i}return-1}function $d(e,t){return ar(e,t,!0)}function Nd(e,t,n){return hi(e,t,$(n,2),!0)}function Ld(e,t){var n=e==null?0:e.length;if(n){var i=ar(e,t,!0)-1;if(ze(e[i],t))return i}return-1}function Od(e){return e&&e.length?va(e):[]}function Ud(e,t){return e&&e.length?va(e,$(t,2)):[]}function Dd(e){var t=e==null?0:e.length;return t?Ue(e,1,t):[]}function Md(e,t,n){return e&&e.length?(t=n||t===r?1:D(t),Ue(e,0,t<0?0:t)):[]}function Wd(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:D(t),t=i-t,Ue(e,t<0?0:t,i)):[]}function Bd(e,t){return e&&e.length?or(e,$(t,3),!1,!0):[]}function kd(e,t){return e&&e.length?or(e,$(t,3)):[]}var Vd=W(function(e){return It(de(e,1,ie,!0))}),Gd=W(function(e){var t=De(e);return ie(t)&&(t=r),It(de(e,1,ie,!0),$(t,2))}),jd=W(function(e){var t=De(e);return t=typeof t=="function"?t:r,It(de(e,1,ie,!0),r,t)});function qd(e){return e&&e.length?It(e):[]}function Hd(e,t){return e&&e.length?It(e,$(t,2)):[]}function zd(e,t){return t=typeof t=="function"?t:r,e&&e.length?It(e,r,t):[]}function $i(e){if(!(e&&e.length))return[];var t=0;return e=vt(e,function(n){if(ie(n))return t=oe(n.length,t),!0}),Yr(t,function(n){return ee(e,Hr(n))})}function ro(e,t){if(!(e&&e.length))return[];var n=$i(e);return t==null?n:ee(n,function(i){return Ae(t,r,i)})}var Kd=W(function(e,t){return ie(e)?Sn(e,t):[]}),Yd=W(function(e){return mi(vt(e,ie))}),Jd=W(function(e){var t=De(e);return ie(t)&&(t=r),mi(vt(e,ie),$(t,2))}),Zd=W(function(e){var t=De(e);return t=typeof t=="function"?t:r,mi(vt(e,ie),r,t)}),Xd=W($i);function Qd(e,t){return Sa(e||[],t||[],wn)}function ep(e,t){return Sa(e||[],t||[],An)}var tp=W(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,ro(e,n)});function io(e){var t=o(e);return t.__chain__=!0,t}function np(e,t){return t(e),e}function mr(e,t){return t(e)}var rp=ut(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(u){return ri(u,e)};return t>1||this.__actions__.length||!(i instanceof V)||!ct(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:mr,args:[a],thisArg:r}),new Le(i,this.__chain__).thru(function(u){return t&&!u.length&&u.push(r),u}))});function ip(){return io(this)}function sp(){return new Le(this.value(),this.__chain__)}function ap(){this.__values__===r&&(this.__values__=_o(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function op(){return this}function lp(e){for(var t,n=this;n instanceof tr;){var i=Za(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function up(){var e=this.__wrapped__;if(e instanceof V){var t=e;return this.__actions__.length&&(t=new V(this)),t=t.reverse(),t.__actions__.push({func:mr,args:[Fi],thisArg:r}),new Le(t,this.__chain__)}return this.thru(Fi)}function cp(){return wa(this.__wrapped__,this.__actions__)}var fp=lr(function(e,t,n){H.call(e,n)?++e[n]:Xe(e,n,1)});function dp(e,t,n){var i=U(e)?Ns:tf;return n&&ye(e,t,n)&&(t=r),i(e,$(t,3))}function pp(e,t){var n=U(e)?vt:ra;return n(e,$(t,3))}var hp=Fa(Xa),gp=Fa(Qa);function mp(e,t){return de(vr(e,t),1)}function vp(e,t){return de(vr(e,t),Ct)}function yp(e,t,n){return n=n===r?1:D(n),de(vr(e,t),n)}function so(e,t){var n=U(e)?Ee:St;return n(e,$(t,3))}function ao(e,t){var n=U(e)?Uu:na;return n(e,$(t,3))}var _p=lr(function(e,t,n){H.call(e,n)?e[n].push(t):Xe(e,n,[t])});function wp(e,t,n,i){e=Se(e)?e:en(e),n=n&&!i?D(n):0;var a=e.length;return n<0&&(n=oe(a+n,0)),Ir(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&Vt(e,t,n)>-1}var Sp=W(function(e,t,n){var i=-1,a=typeof t=="function",u=Se(e)?y(e.length):[];return St(e,function(d){u[++i]=a?Ae(t,d,n):In(d,t,n)}),u}),Ip=lr(function(e,t,n){Xe(e,n,t)});function vr(e,t){var n=U(e)?ee:ua;return n(e,$(t,3))}function xp(e,t,n,i){return e==null?[]:(U(t)||(t=t==null?[]:[t]),n=i?r:n,U(n)||(n=n==null?[]:[n]),pa(e,t,n))}var Ap=lr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Ep(e,t,n){var i=U(e)?jr:Ds,a=arguments.length<3;return i(e,$(t,4),n,a,St)}function bp(e,t,n){var i=U(e)?Du:Ds,a=arguments.length<3;return i(e,$(t,4),n,a,na)}function Cp(e,t){var n=U(e)?vt:ra;return n(e,wr($(t,3)))}function Tp(e){var t=U(e)?Xs:wf;return t(e)}function Rp(e,t,n){(n?ye(e,t,n):t===r)?t=1:t=D(t);var i=U(e)?Jc:Sf;return i(e,t)}function Pp(e){var t=U(e)?Zc:xf;return t(e)}function Fp(e){if(e==null)return 0;if(Se(e))return Ir(e)?jt(e):e.length;var t=ge(e);return t==Ve||t==Ge?e.size:ui(e).length}function $p(e,t,n){var i=U(e)?qr:Af;return n&&ye(e,t,n)&&(t=r),i(e,$(t,3))}var Np=W(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ye(e,t[0],t[1])?t=[]:n>2&&ye(t[0],t[1],t[2])&&(t=[t[0]]),pa(e,de(t,1),[])}),yr=dc||function(){return fe.Date.now()};function Lp(e,t){if(typeof t!="function")throw new Ne(x);return e=D(e),function(){if(--e<1)return t.apply(this,arguments)}}function oo(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,lt(e,it,r,r,r,r,t)}function lo(e,t){var n;if(typeof t!="function")throw new Ne(x);return e=D(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Ni=W(function(e,t,n){var i=me;if(n.length){var a=_t(n,Xt(Ni));i|=ce}return lt(e,i,t,n,a)}),uo=W(function(e,t,n){var i=me|gt;if(n.length){var a=_t(n,Xt(uo));i|=ce}return lt(t,i,e,n,a)});function co(e,t,n){t=n?r:t;var i=lt(e,ke,r,r,r,r,r,t);return i.placeholder=co.placeholder,i}function fo(e,t,n){t=n?r:t;var i=lt(e,rt,r,r,r,r,r,t);return i.placeholder=fo.placeholder,i}function po(e,t,n){var i,a,u,d,p,m,S=0,I=!1,A=!1,E=!0;if(typeof e!="function")throw new Ne(x);t=Me(t)||0,te(n)&&(I=!!n.leading,A="maxWait"in n,u=A?oe(Me(n.maxWait)||0,t):u,E="trailing"in n?!!n.trailing:E);function P(se){var Ke=i,pt=a;return i=a=r,S=se,d=e.apply(pt,Ke),d}function N(se){return S=se,p=Cn(k,t),I?P(se):d}function M(se){var Ke=se-m,pt=se-S,No=t-Ke;return A?he(No,u-pt):No}function F(se){var Ke=se-m,pt=se-S;return m===r||Ke>=t||Ke<0||A&&pt>=u}function k(){var se=yr();if(F(se))return G(se);p=Cn(k,M(se))}function G(se){return p=r,E&&i?P(se):(i=a=r,d)}function Re(){p!==r&&Ia(p),S=0,i=m=a=p=r}function _e(){return p===r?d:G(yr())}function Pe(){var se=yr(),Ke=F(se);if(i=arguments,a=this,m=se,Ke){if(p===r)return N(m);if(A)return Ia(p),p=Cn(k,t),P(m)}return p===r&&(p=Cn(k,t)),d}return Pe.cancel=Re,Pe.flush=_e,Pe}var Op=W(function(e,t){return ta(e,1,t)}),Up=W(function(e,t,n){return ta(e,Me(t)||0,n)});function Dp(e){return lt(e,Ar)}function _r(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ne(x);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],u=n.cache;if(u.has(a))return u.get(a);var d=e.apply(this,i);return n.cache=u.set(a,d)||u,d};return n.cache=new(_r.Cache||ot),n}_r.Cache=ot;function wr(e){if(typeof e!="function")throw new Ne(x);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Mp(e){return lo(2,e)}var Wp=Ef(function(e,t){t=t.length==1&&U(t[0])?ee(t[0],be($())):ee(de(t,1),be($()));var n=t.length;return W(function(i){for(var a=-1,u=he(i.length,n);++a<u;)i[a]=t[a].call(this,i[a]);return Ae(e,this,i)})}),Li=W(function(e,t){var n=_t(t,Xt(Li));return lt(e,ce,r,t,n)}),ho=W(function(e,t){var n=_t(t,Xt(ho));return lt(e,sn,r,t,n)}),Bp=ut(function(e,t){return lt(e,an,r,r,r,t)});function kp(e,t){if(typeof e!="function")throw new Ne(x);return t=t===r?t:D(t),W(e,t)}function Vp(e,t){if(typeof e!="function")throw new Ne(x);return t=t==null?0:oe(D(t),0),W(function(n){var i=n[t],a=At(n,0,t);return i&&yt(a,i),Ae(e,this,a)})}function Gp(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new Ne(x);return te(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),po(e,t,{leading:i,maxWait:t,trailing:a})}function jp(e){return oo(e,1)}function qp(e,t){return Li(yi(t),e)}function Hp(){if(!arguments.length)return[];var e=arguments[0];return U(e)?e:[e]}function zp(e){return Oe(e,Be)}function Kp(e,t){return t=typeof t=="function"?t:r,Oe(e,Be,t)}function Yp(e){return Oe(e,Z|Be)}function Jp(e,t){return t=typeof t=="function"?t:r,Oe(e,Z|Be,t)}function Zp(e,t){return t==null||ea(e,t,le(t))}function ze(e,t){return e===t||e!==e&&t!==t}var Xp=dr(ai),Qp=dr(function(e,t){return e>=t}),Ut=aa((function(){return arguments})())?aa:function(e){return re(e)&&H.call(e,"callee")&&!Hs.call(e,"callee")},U=y.isArray,eh=Cs?be(Cs):lf;function Se(e){return e!=null&&Sr(e.length)&&!ft(e)}function ie(e){return re(e)&&Se(e)}function th(e){return e===!0||e===!1||re(e)&&ve(e)==on}var Et=hc||Hi,nh=Ts?be(Ts):uf;function rh(e){return re(e)&&e.nodeType===1&&!Tn(e)}function ih(e){if(e==null)return!0;if(Se(e)&&(U(e)||typeof e=="string"||typeof e.splice=="function"||Et(e)||Qt(e)||Ut(e)))return!e.length;var t=ge(e);if(t==Ve||t==Ge)return!e.size;if(bn(e))return!ui(e).length;for(var n in e)if(H.call(e,n))return!1;return!0}function sh(e,t){return xn(e,t)}function ah(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?xn(e,t,r,n):!!i}function Oi(e){if(!re(e))return!1;var t=ve(e);return t==Nn||t==Rl||typeof e.message=="string"&&typeof e.name=="string"&&!Tn(e)}function oh(e){return typeof e=="number"&&Ks(e)}function ft(e){if(!te(e))return!1;var t=ve(e);return t==Ln||t==es||t==Tl||t==Fl}function go(e){return typeof e=="number"&&e==D(e)}function Sr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mt}function te(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function re(e){return e!=null&&typeof e=="object"}var mo=Rs?be(Rs):ff;function lh(e,t){return e===t||li(e,t,Ei(t))}function uh(e,t,n){return n=typeof n=="function"?n:r,li(e,t,Ei(t),n)}function ch(e){return vo(e)&&e!=+e}function fh(e){if(Kf(e))throw new O(w);return oa(e)}function dh(e){return e===null}function ph(e){return e==null}function vo(e){return typeof e=="number"||re(e)&&ve(e)==un}function Tn(e){if(!re(e)||ve(e)!=st)return!1;var t=Kn(e);if(t===null)return!0;var n=H.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&jn.call(n)==lc}var Ui=Ps?be(Ps):df;function hh(e){return go(e)&&e>=-mt&&e<=mt}var yo=Fs?be(Fs):pf;function Ir(e){return typeof e=="string"||!U(e)&&re(e)&&ve(e)==fn}function Te(e){return typeof e=="symbol"||re(e)&&ve(e)==On}var Qt=$s?be($s):hf;function gh(e){return e===r}function mh(e){return re(e)&&ge(e)==dn}function vh(e){return re(e)&&ve(e)==Nl}var yh=dr(ci),_h=dr(function(e,t){return e<=t});function _o(e){if(!e)return[];if(Se(e))return Ir(e)?je(e):we(e);if(gn&&e[gn])return Ju(e[gn]());var t=ge(e),n=t==Ve?Zr:t==Ge?kn:en;return n(e)}function dt(e){if(!e)return e===0?e:0;if(e=Me(e),e===Ct||e===-Ct){var t=e<0?-1:1;return t*Al}return e===e?e:0}function D(e){var t=dt(e),n=t%1;return t===t?n?t-n:t:0}function wo(e){return e?$t(D(e),0,Ze):0}function Me(e){if(typeof e=="number")return e;if(Te(e))return Fn;if(te(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=te(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ms(e);var n=Ql.test(e);return n||tu.test(e)?Nu(e.slice(2),n?2:8):Xl.test(e)?Fn:+e}function So(e){return et(e,Ie(e))}function wh(e){return e?$t(D(e),-mt,mt):e===0?e:0}function z(e){return e==null?"":Ce(e)}var Sh=Jt(function(e,t){if(bn(t)||Se(t)){et(t,le(t),e);return}for(var n in t)H.call(t,n)&&wn(e,n,t[n])}),Io=Jt(function(e,t){et(t,Ie(t),e)}),xo=Jt(function(e,t,n,i){et(t,Ie(t),e,i)}),Di=Jt(function(e,t,n,i){et(t,le(t),e,i)}),Ih=ut(ri);function xh(e,t){var n=Yt(e);return t==null?n:Qs(n,t)}var Ah=W(function(e,t){e=K(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&ye(t[0],t[1],a)&&(i=1);++n<i;)for(var u=t[n],d=Ie(u),p=-1,m=d.length;++p<m;){var S=d[p],I=e[S];(I===r||ze(I,Ht[S])&&!H.call(e,S))&&(e[S]=u[S])}return e}),Eh=W(function(e){return e.push(r,Ma),Ae(Ao,r,e)});function bh(e,t){return Ls(e,$(t,3),Qe)}function Ch(e,t){return Ls(e,$(t,3),si)}function Th(e,t){return e==null?e:ii(e,$(t,3),Ie)}function Rh(e,t){return e==null?e:ia(e,$(t,3),Ie)}function Ph(e,t){return e&&Qe(e,$(t,3))}function Fh(e,t){return e&&si(e,$(t,3))}function $h(e){return e==null?[]:ir(e,le(e))}function Nh(e){return e==null?[]:ir(e,Ie(e))}function Mi(e,t,n){var i=e==null?r:Nt(e,t);return i===r?n:i}function Lh(e,t){return e!=null&&ka(e,t,rf)}function Wi(e,t){return e!=null&&ka(e,t,sf)}var Oh=Na(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),e[t]=n},ki(xe)),Uh=Na(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),H.call(e,t)?e[t].push(n):e[t]=[n]},$),Dh=W(In);function le(e){return Se(e)?Zs(e):ui(e)}function Ie(e){return Se(e)?Zs(e,!0):gf(e)}function Mh(e,t){var n={};return t=$(t,3),Qe(e,function(i,a,u){Xe(n,t(i,a,u),i)}),n}function Wh(e,t){var n={};return t=$(t,3),Qe(e,function(i,a,u){Xe(n,a,t(i,a,u))}),n}var Bh=Jt(function(e,t,n){sr(e,t,n)}),Ao=Jt(function(e,t,n,i){sr(e,t,n,i)}),kh=ut(function(e,t){var n={};if(e==null)return n;var i=!1;t=ee(t,function(u){return u=xt(u,e),i||(i=u.length>1),u}),et(e,xi(e),n),i&&(n=Oe(n,Z|ht|Be,Uf));for(var a=t.length;a--;)gi(n,t[a]);return n});function Vh(e,t){return Eo(e,wr($(t)))}var Gh=ut(function(e,t){return e==null?{}:vf(e,t)});function Eo(e,t){if(e==null)return{};var n=ee(xi(e),function(i){return[i]});return t=$(t),ha(e,n,function(i,a){return t(i,a[0])})}function jh(e,t,n){t=xt(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var u=e==null?r:e[He(t[i])];u===r&&(i=a,u=n),e=ft(u)?u.call(e):u}return e}function qh(e,t,n){return e==null?e:An(e,t,n)}function Hh(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:An(e,t,n,i)}var bo=Ua(le),Co=Ua(Ie);function zh(e,t,n){var i=U(e),a=i||Et(e)||Qt(e);if(t=$(t,4),n==null){var u=e&&e.constructor;a?n=i?new u:[]:te(e)?n=ft(u)?Yt(Kn(e)):{}:n={}}return(a?Ee:Qe)(e,function(d,p,m){return t(n,d,p,m)}),n}function Kh(e,t){return e==null?!0:gi(e,t)}function Yh(e,t,n){return e==null?e:_a(e,t,yi(n))}function Jh(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:_a(e,t,yi(n),i)}function en(e){return e==null?[]:Jr(e,le(e))}function Zh(e){return e==null?[]:Jr(e,Ie(e))}function Xh(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Me(n),n=n===n?n:0),t!==r&&(t=Me(t),t=t===t?t:0),$t(Me(e),t,n)}function Qh(e,t,n){return t=dt(t),n===r?(n=t,t=0):n=dt(n),e=Me(e),af(e,t,n)}function eg(e,t,n){if(n&&typeof n!="boolean"&&ye(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=dt(e),t===r?(t=e,e=0):t=dt(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Ys();return he(e+a*(t-e+$u("1e-"+((a+"").length-1))),t)}return di(e,t)}var tg=Zt(function(e,t,n){return t=t.toLowerCase(),e+(n?To(t):t)});function To(e){return Bi(z(e).toLowerCase())}function Ro(e){return e=z(e),e&&e.replace(ru,qu).replace(Iu,"")}function ng(e,t,n){e=z(e),t=Ce(t);var i=e.length;n=n===r?i:$t(D(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function rg(e){return e=z(e),e&&Ml.test(e)?e.replace(rs,Hu):e}function ig(e){return e=z(e),e&&jl.test(e)?e.replace(Lr,"\\$&"):e}var sg=Zt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),ag=Zt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),og=Pa("toLowerCase");function lg(e,t,n){e=z(e),t=D(t);var i=t?jt(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return fr(Xn(a),n)+e+fr(Zn(a),n)}function ug(e,t,n){e=z(e),t=D(t);var i=t?jt(e):0;return t&&i<t?e+fr(t-i,n):e}function cg(e,t,n){e=z(e),t=D(t);var i=t?jt(e):0;return t&&i<t?fr(t-i,n)+e:e}function fg(e,t,n){return n||t==null?t=0:t&&(t=+t),yc(z(e).replace(Or,""),t||0)}function dg(e,t,n){return(n?ye(e,t,n):t===r)?t=1:t=D(t),pi(z(e),t)}function pg(){var e=arguments,t=z(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var hg=Zt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function gg(e,t,n){return n&&typeof n!="number"&&ye(e,t,n)&&(t=n=r),n=n===r?Ze:n>>>0,n?(e=z(e),e&&(typeof t=="string"||t!=null&&!Ui(t))&&(t=Ce(t),!t&&Gt(e))?At(je(e),0,n):e.split(t,n)):[]}var mg=Zt(function(e,t,n){return e+(n?" ":"")+Bi(t)});function vg(e,t,n){return e=z(e),n=n==null?0:$t(D(n),0,e.length),t=Ce(t),e.slice(n,n+t.length)==t}function yg(e,t,n){var i=o.templateSettings;n&&ye(e,t,n)&&(t=r),e=z(e),t=Di({},t,i,Da);var a=Di({},t.imports,i.imports,Da),u=le(a),d=Jr(a,u);Ee(u,function(F){if(ss.test(F))throw new O(L)});var p,m,S=0,I=t.interpolate||Un,A="__p += '",E=Xr((t.escape||Un).source+"|"+I.source+"|"+(I===is?Zl:Un).source+"|"+(t.evaluate||Un).source+"|$","g"),P="//# sourceURL="+(H.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Cu+"]")+`
|
|
12
|
+
`;e.replace(E,function(F,k,G,Re,_e,Pe){return G||(G=Re),A+=e.slice(S,Pe).replace(iu,zu),k&&(p=!0,A+=`' +
|
|
13
|
+
__e(`+k+`) +
|
|
14
|
+
'`),_e&&(m=!0,A+=`';
|
|
15
|
+
`+_e+`;
|
|
16
|
+
__p += '`),G&&(A+=`' +
|
|
17
|
+
((__t = (`+G+`)) == null ? '' : __t) +
|
|
18
|
+
'`),S=Pe+F.length,F}),A+=`';
|
|
19
|
+
`;var N=H.call(t,"variable")&&t.variable;if(!N)A=`with (obj) {
|
|
20
|
+
`+A+`
|
|
21
21
|
}
|
|
22
|
-
`;else if(
|
|
23
|
-
`+(
|
|
24
|
-
`)+"var __t, __p = ''"+(p?", __e = _.escape":"")+(
|
|
22
|
+
`;else if(ss.test(N))throw new O(R);A=(m?A.replace(Ll,""):A).replace(Ol,"$1").replace(Ul,"$1;"),A="function("+(N||"obj")+`) {
|
|
23
|
+
`+(N?"":`obj || (obj = {});
|
|
24
|
+
`)+"var __t, __p = ''"+(p?", __e = _.escape":"")+(m?`, __j = Array.prototype.join;
|
|
25
25
|
function print() { __p += __j.call(arguments, '') }
|
|
26
26
|
`:`;
|
|
27
|
-
`)+
|
|
28
|
-
}`;var M=To(function(){return H(u,R+"return "+x).apply(r,d)});if(M.source=x,Oi(M))throw M;return M}function mg(e){return z(e).toLowerCase()}function vg(e){return z(e).toUpperCase()}function yg(e,t,n){if(e=z(e),e&&(n||t===r))return Us(e);if(!e||!(t=Ce(t)))return e;var i=He(e),a=He(t),u=Ds(i,a),d=Ms(i,a)+1;return Et(i,u,d).join("")}function _g(e,t,n){if(e=z(e),e&&(n||t===r))return e.slice(0,Bs(e)+1);if(!e||!(t=Ce(t)))return e;var i=He(e),a=Ms(i,He(t))+1;return Et(i,0,a).join("")}function wg(e,t,n){if(e=z(e),e&&(n||t===r))return e.replace(Or,"");if(!e||!(t=Ce(t)))return e;var i=He(e),a=Ds(i,He(t));return Et(i,a).join("")}function Sg(e,t){var n=pu,i=hu;if(te(t)){var a="separator"in t?t.separator:a;n="length"in t?D(t.length):n,i="omission"in t?Ce(t.omission):i}e=z(e);var u=e.length;if(Gt(e)){var d=He(e);u=d.length}if(n>=u)return e;var p=n-qt(i);if(p<1)return i;var g=d?Et(d,0,p).join(""):e.slice(0,p);if(a===r)return g+i;if(d&&(p+=g.length-p),Ui(a)){if(e.slice(p).search(a)){var w,I=g;for(a.global||(a=Xr(a.source,z(is.exec(a))+"g")),a.lastIndex=0;w=a.exec(I);)var x=w.index;g=g.slice(0,x===r?p:x)}}else if(e.indexOf(Ce(a),p)!=p){var A=g.lastIndexOf(a);A>-1&&(g=g.slice(0,A))}return g+i}function Ig(e){return e=z(e),e&&$u.test(e)?e.replace(ts,Yl):e}var xg=Zt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wi=Ta("toUpperCase");function Co(e,t,n){return e=z(e),t=n?r:t,t===r?Hl(e)?Ql(e):Ul(e):e.match(t)||[]}var To=W(function(e,t){try{return Ae(e,r,t)}catch(n){return Oi(n)?n:new N(n)}}),Eg=ft(function(e,t){return Ne(t,function(n){n=tt(n),lt(e,n,Li(e[n],e))}),e});function Ag(e){var t=e==null?0:e.length,n=F();return e=t?ee(e,function(i){if(typeof i[1]!="function")throw new Oe(E);return[n(i[0]),i[1]]}):[],W(function(i){for(var a=-1;++a<t;){var u=e[a];if(Ae(u[0],this,i))return Ae(u[1],this,i)}})}function bg(e){return Yc(De(e,J))}function Bi(e){return function(){return e}}function Cg(e,t){return e==null||e!==e?t:e}var Tg=Pa(),Rg=Pa(!0);function Se(e){return e}function ki(e){return aa(typeof e=="function"?e:De(e,J))}function Pg(e){return ua(De(e,J))}function Fg(e,t){return la(e,De(t,J))}var $g=W(function(e,t){return function(n){return wn(n,e,t)}}),Lg=W(function(e,t){return function(n){return wn(e,n,t)}});function Vi(e,t,n){var i=ue(t),a=rr(t,i);n==null&&!(te(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=rr(t,ue(t)));var u=!(te(n)&&"chain"in n)||!!n.chain,d=pt(e);return Ne(a,function(p){var g=t[p];e[p]=g,d&&(e.prototype[p]=function(){var w=this.__chain__;if(u||w){var I=e(this.__wrapped__),x=I.__actions__=ye(this.__actions__);return x.push({func:g,args:arguments,thisArg:e}),I.__chain__=w,I}return g.apply(e,yt([this.value()],arguments))})}),e}function Ng(){return ce._===this&&(ce._=sc),this}function Gi(){}function Og(e){return e=D(e),W(function(t){return ca(t,e)})}var Ug=wi(ee),Dg=wi(Fs),Mg=wi(Hr);function Ro(e){return Ci(e)?zr(tt(e)):hf(e)}function Wg(e){return function(t){return e==null?r:Nt(e,t)}}var Bg=$a(),kg=$a(!0);function qi(){return[]}function Hi(){return!1}function Vg(){return{}}function Gg(){return""}function qg(){return!0}function Hg(e,t){if(e=D(e),e<1||e>mt)return[];var n=Xe,i=de(e,Xe);t=F(t),e-=Xe;for(var a=Jr(i,t);++n<e;)t(n);return a}function zg(e){return U(e)?ee(e,tt):Te(e)?[e]:ye(ja(z(e)))}function Kg(e){var t=++rc;return z(e)+t}var jg=lr(function(e,t){return e+t},0),Jg=Si("ceil"),Yg=lr(function(e,t){return e/t},1),Zg=Si("floor");function Xg(e){return e&&e.length?nr(e,Se,ai):r}function Qg(e,t){return e&&e.length?nr(e,F(t,2),ai):r}function em(e){return Ns(e,Se)}function tm(e,t){return Ns(e,F(t,2))}function nm(e){return e&&e.length?nr(e,Se,ci):r}function rm(e,t){return e&&e.length?nr(e,F(t,2),ci):r}var im=lr(function(e,t){return e*t},1),sm=Si("round"),am=lr(function(e,t){return e-t},0);function om(e){return e&&e.length?jr(e,Se):0}function um(e,t){return e&&e.length?jr(e,F(t,2)):0}return o.after=Pp,o.ary=so,o.assign=vh,o.assignIn=wo,o.assignInWith=Ir,o.assignWith=yh,o.at=_h,o.before=ao,o.bind=Li,o.bindAll=Eg,o.bindKey=oo,o.castArray=Vp,o.chain=no,o.chunk=Zf,o.compact=Xf,o.concat=Qf,o.cond=Ag,o.conforms=bg,o.constant=Bi,o.countBy=op,o.create=wh,o.curry=uo,o.curryRight=lo,o.debounce=co,o.defaults=Sh,o.defaultsDeep=Ih,o.defer=Fp,o.delay=$p,o.difference=ed,o.differenceBy=td,o.differenceWith=nd,o.drop=rd,o.dropRight=id,o.dropRightWhile=sd,o.dropWhile=ad,o.fill=od,o.filter=lp,o.flatMap=dp,o.flatMapDeep=pp,o.flatMapDepth=hp,o.flatten=Xa,o.flattenDeep=ud,o.flattenDepth=ld,o.flip=Lp,o.flow=Tg,o.flowRight=Rg,o.fromPairs=cd,o.functions=Rh,o.functionsIn=Ph,o.groupBy=gp,o.initial=dd,o.intersection=pd,o.intersectionBy=hd,o.intersectionWith=gd,o.invert=$h,o.invertBy=Lh,o.invokeMap=vp,o.iteratee=ki,o.keyBy=yp,o.keys=ue,o.keysIn=we,o.map=mr,o.mapKeys=Oh,o.mapValues=Uh,o.matches=Pg,o.matchesProperty=Fg,o.memoize=yr,o.merge=Dh,o.mergeWith=So,o.method=$g,o.methodOf=Lg,o.mixin=Vi,o.negate=_r,o.nthArg=Og,o.omit=Mh,o.omitBy=Wh,o.once=Np,o.orderBy=_p,o.over=Ug,o.overArgs=Op,o.overEvery=Dg,o.overSome=Mg,o.partial=Ni,o.partialRight=fo,o.partition=wp,o.pick=Bh,o.pickBy=Io,o.property=Ro,o.propertyOf=Wg,o.pull=_d,o.pullAll=eo,o.pullAllBy=wd,o.pullAllWith=Sd,o.pullAt=Id,o.range=Bg,o.rangeRight=kg,o.rearg=Up,o.reject=xp,o.remove=xd,o.rest=Dp,o.reverse=Fi,o.sampleSize=Ap,o.set=Vh,o.setWith=Gh,o.shuffle=bp,o.slice=Ed,o.sortBy=Rp,o.sortedUniq=Fd,o.sortedUniqBy=$d,o.split=dg,o.spread=Mp,o.tail=Ld,o.take=Nd,o.takeRight=Od,o.takeRightWhile=Ud,o.takeWhile=Dd,o.tap=Xd,o.throttle=Wp,o.thru=gr,o.toArray=vo,o.toPairs=xo,o.toPairsIn=Eo,o.toPath=zg,o.toPlainObject=_o,o.transform=qh,o.unary=Bp,o.union=Md,o.unionBy=Wd,o.unionWith=Bd,o.uniq=kd,o.uniqBy=Vd,o.uniqWith=Gd,o.unset=Hh,o.unzip=$i,o.unzipWith=to,o.update=zh,o.updateWith=Kh,o.values=en,o.valuesIn=jh,o.without=qd,o.words=Co,o.wrap=kp,o.xor=Hd,o.xorBy=zd,o.xorWith=Kd,o.zip=jd,o.zipObject=Jd,o.zipObjectDeep=Yd,o.zipWith=Zd,o.entries=xo,o.entriesIn=Eo,o.extend=wo,o.extendWith=Ir,Vi(o,o),o.add=jg,o.attempt=To,o.camelCase=Xh,o.capitalize=Ao,o.ceil=Jg,o.clamp=Jh,o.clone=Gp,o.cloneDeep=Hp,o.cloneDeepWith=zp,o.cloneWith=qp,o.conformsTo=Kp,o.deburr=bo,o.defaultTo=Cg,o.divide=Yg,o.endsWith=Qh,o.eq=Ke,o.escape=eg,o.escapeRegExp=tg,o.every=up,o.find=cp,o.findIndex=Ya,o.findKey=xh,o.findLast=fp,o.findLastIndex=Za,o.findLastKey=Eh,o.floor=Zg,o.forEach=ro,o.forEachRight=io,o.forIn=Ah,o.forInRight=bh,o.forOwn=Ch,o.forOwnRight=Th,o.get=Di,o.gt=jp,o.gte=Jp,o.has=Fh,o.hasIn=Mi,o.head=Qa,o.identity=Se,o.includes=mp,o.indexOf=fd,o.inRange=Yh,o.invoke=Nh,o.isArguments=Dt,o.isArray=U,o.isArrayBuffer=Yp,o.isArrayLike=_e,o.isArrayLikeObject=re,o.isBoolean=Zp,o.isBuffer=At,o.isDate=Xp,o.isElement=Qp,o.isEmpty=eh,o.isEqual=th,o.isEqualWith=nh,o.isError=Oi,o.isFinite=rh,o.isFunction=pt,o.isInteger=po,o.isLength=wr,o.isMap=ho,o.isMatch=ih,o.isMatchWith=sh,o.isNaN=ah,o.isNative=oh,o.isNil=lh,o.isNull=uh,o.isNumber=go,o.isObject=te,o.isObjectLike=ne,o.isPlainObject=bn,o.isRegExp=Ui,o.isSafeInteger=ch,o.isSet=mo,o.isString=Sr,o.isSymbol=Te,o.isTypedArray=Qt,o.isUndefined=fh,o.isWeakMap=dh,o.isWeakSet=ph,o.join=md,o.kebabCase=ng,o.last=We,o.lastIndexOf=vd,o.lowerCase=rg,o.lowerFirst=ig,o.lt=hh,o.lte=gh,o.max=Xg,o.maxBy=Qg,o.mean=em,o.meanBy=tm,o.min=nm,o.minBy=rm,o.stubArray=qi,o.stubFalse=Hi,o.stubObject=Vg,o.stubString=Gg,o.stubTrue=qg,o.multiply=im,o.nth=yd,o.noConflict=Ng,o.noop=Gi,o.now=vr,o.pad=sg,o.padEnd=ag,o.padStart=og,o.parseInt=ug,o.random=Zh,o.reduce=Sp,o.reduceRight=Ip,o.repeat=lg,o.replace=cg,o.result=kh,o.round=sm,o.runInContext=h,o.sample=Ep,o.size=Cp,o.snakeCase=fg,o.some=Tp,o.sortedIndex=Ad,o.sortedIndexBy=bd,o.sortedIndexOf=Cd,o.sortedLastIndex=Td,o.sortedLastIndexBy=Rd,o.sortedLastIndexOf=Pd,o.startCase=pg,o.startsWith=hg,o.subtract=am,o.sum=om,o.sumBy=um,o.template=gg,o.times=Hg,o.toFinite=ht,o.toInteger=D,o.toLength=yo,o.toLower=mg,o.toNumber=Be,o.toSafeInteger=mh,o.toString=z,o.toUpper=vg,o.trim=yg,o.trimEnd=_g,o.trimStart=wg,o.truncate=Sg,o.unescape=Ig,o.uniqueId=Kg,o.upperCase=xg,o.upperFirst=Wi,o.each=ro,o.eachRight=io,o.first=Qa,Vi(o,(function(){var e={};return Qe(o,function(t,n){K.call(o.prototype,n)||(e[n]=t)}),e})(),{chain:!1}),o.VERSION=c,Ne(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Ne(["drop","take"],function(e,t){k.prototype[e]=function(n){n=n===r?1:oe(D(n),0);var i=this.__filtered__&&!t?new k(this):this.clone();return i.__filtered__?i.__takeCount__=de(n,i.__takeCount__):i.__views__.push({size:de(n,Xe),type:e+(i.__dir__<0?"Right":"")}),i},k.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ne(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==Xi||n==yu;k.prototype[e]=function(a){var u=this.clone();return u.__iteratees__.push({iteratee:F(a,3),type:n}),u.__filtered__=u.__filtered__||i,u}}),Ne(["head","last"],function(e,t){var n="take"+(t?"Right":"");k.prototype[e]=function(){return this[n](1).value()[0]}}),Ne(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");k.prototype[e]=function(){return this.__filtered__?new k(this):this[n](1)}}),k.prototype.compact=function(){return this.filter(Se)},k.prototype.find=function(e){return this.filter(e).head()},k.prototype.findLast=function(e){return this.reverse().find(e)},k.prototype.invokeMap=W(function(e,t){return typeof e=="function"?new k(this):this.map(function(n){return wn(n,e,t)})}),k.prototype.reject=function(e){return this.filter(_r(F(e)))},k.prototype.slice=function(e,t){e=D(e);var n=this;return n.__filtered__&&(e>0||t<0)?new k(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=D(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},k.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},k.prototype.toArray=function(){return this.take(Xe)},Qe(k.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=o[i?"take"+(t=="last"?"Right":""):t],u=i||/^find/.test(t);a&&(o.prototype[t]=function(){var d=this.__wrapped__,p=i?[1]:arguments,g=d instanceof k,w=p[0],I=g||U(d),x=function(B){var V=a.apply(o,yt([B],p));return i&&A?V[0]:V};I&&n&&typeof w=="function"&&w.length!=1&&(g=I=!1);var A=this.__chain__,R=!!this.__actions__.length,$=u&&!A,M=g&&!R;if(!u&&I){d=M?d:new k(this);var L=e.apply(d,p);return L.__actions__.push({func:gr,args:[x],thisArg:r}),new Ue(L,A)}return $&&M?e.apply(this,p):(L=this.thru(x),$?i?L.value()[0]:L.value():L)})}),Ne(["pop","push","shift","sort","splice","unshift"],function(e){var t=kn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var u=this.value();return t.apply(U(u)?u:[],a)}return this[n](function(d){return t.apply(U(d)?d:[],a)})}}),Qe(k.prototype,function(e,t){var n=o[t];if(n){var i=n.name+"";K.call(jt,i)||(jt[i]=[]),jt[i].push({name:t,func:n})}}),jt[ur(r,Ze).name]=[{name:"wrapper",func:r}],k.prototype.clone=Sc,k.prototype.reverse=Ic,k.prototype.value=xc,o.prototype.at=Qd,o.prototype.chain=ep,o.prototype.commit=tp,o.prototype.next=np,o.prototype.plant=ip,o.prototype.reverse=sp,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=ap,o.prototype.first=o.prototype.head,pn&&(o.prototype[pn]=rp),o}),Ht=ec();Rt?((Rt.exports=Ht)._=Ht,kr._=Ht):ce._=Ht}).call(Am)})(Cn,Cn.exports)),Cn.exports}var Cm=bm();const zi=l=>{const s=Cm.startCase(l).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},Tm=["src/application.config.ts","src/application-config.ts","src/applicationConfig.ts"],Oo=/serverVariables\s*:\s*\{/,Rm=/defineApplication\s*\(\s*\{/,Pm=async({projectRoot:l,variables:s})=>{const r=await Fm(l);if(r===null)return{status:"skipped-no-config"};const c=await rt.readFile(r,"utf8"),f=s.filter(C=>!new RegExp(`\\b${C.name}\\s*:`).test(c));if(f.length===0)return{status:"skipped-existing"};const S=$m(f);if(Oo.test(c)){const C=c.replace(Oo,P=>`${P}
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
`});return
|
|
27
|
+
`)+A+`return __p
|
|
28
|
+
}`;var M=Fo(function(){return q(u,P+"return "+A).apply(r,d)});if(M.source=A,Oi(M))throw M;return M}function _g(e){return z(e).toLowerCase()}function wg(e){return z(e).toUpperCase()}function Sg(e,t,n){if(e=z(e),e&&(n||t===r))return Ms(e);if(!e||!(t=Ce(t)))return e;var i=je(e),a=je(t),u=Ws(i,a),d=Bs(i,a)+1;return At(i,u,d).join("")}function Ig(e,t,n){if(e=z(e),e&&(n||t===r))return e.slice(0,Vs(e)+1);if(!e||!(t=Ce(t)))return e;var i=je(e),a=Bs(i,je(t))+1;return At(i,0,a).join("")}function xg(e,t,n){if(e=z(e),e&&(n||t===r))return e.replace(Or,"");if(!e||!(t=Ce(t)))return e;var i=je(e),a=Ws(i,je(t));return At(i,a).join("")}function Ag(e,t){var n=yl,i=_l;if(te(t)){var a="separator"in t?t.separator:a;n="length"in t?D(t.length):n,i="omission"in t?Ce(t.omission):i}e=z(e);var u=e.length;if(Gt(e)){var d=je(e);u=d.length}if(n>=u)return e;var p=n-jt(i);if(p<1)return i;var m=d?At(d,0,p).join(""):e.slice(0,p);if(a===r)return m+i;if(d&&(p+=m.length-p),Ui(a)){if(e.slice(p).search(a)){var S,I=m;for(a.global||(a=Xr(a.source,z(as.exec(a))+"g")),a.lastIndex=0;S=a.exec(I);)var A=S.index;m=m.slice(0,A===r?p:A)}}else if(e.indexOf(Ce(a),p)!=p){var E=m.lastIndexOf(a);E>-1&&(m=m.slice(0,E))}return m+i}function Eg(e){return e=z(e),e&&Dl.test(e)?e.replace(ns,ec):e}var bg=Zt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Bi=Pa("toUpperCase");function Po(e,t,n){return e=z(e),t=n?r:t,t===r?Yu(e)?rc(e):Bu(e):e.match(t)||[]}var Fo=W(function(e,t){try{return Ae(e,r,t)}catch(n){return Oi(n)?n:new O(n)}}),Cg=ut(function(e,t){return Ee(t,function(n){n=He(n),Xe(e,n,Ni(e[n],e))}),e});function Tg(e){var t=e==null?0:e.length,n=$();return e=t?ee(e,function(i){if(typeof i[1]!="function")throw new Ne(x);return[n(i[0]),i[1]]}):[],W(function(i){for(var a=-1;++a<t;){var u=e[a];if(Ae(u[0],this,i))return Ae(u[1],this,i)}})}function Rg(e){return ef(Oe(e,Z))}function ki(e){return function(){return e}}function Pg(e,t){return e==null||e!==e?t:e}var Fg=$a(),$g=$a(!0);function xe(e){return e}function Vi(e){return la(typeof e=="function"?e:Oe(e,Z))}function Ng(e){return ca(Oe(e,Z))}function Lg(e,t){return fa(e,Oe(t,Z))}var Og=W(function(e,t){return function(n){return In(n,e,t)}}),Ug=W(function(e,t){return function(n){return In(e,n,t)}});function Gi(e,t,n){var i=le(t),a=ir(t,i);n==null&&!(te(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=ir(t,le(t)));var u=!(te(n)&&"chain"in n)||!!n.chain,d=ft(e);return Ee(a,function(p){var m=t[p];e[p]=m,d&&(e.prototype[p]=function(){var S=this.__chain__;if(u||S){var I=e(this.__wrapped__),A=I.__actions__=we(this.__actions__);return A.push({func:m,args:arguments,thisArg:e}),I.__chain__=S,I}return m.apply(e,yt([this.value()],arguments))})}),e}function Dg(){return fe._===this&&(fe._=uc),this}function ji(){}function Mg(e){return e=D(e),W(function(t){return da(t,e)})}var Wg=wi(ee),Bg=wi(Ns),kg=wi(qr);function $o(e){return Ci(e)?Hr(He(e)):yf(e)}function Vg(e){return function(t){return e==null?r:Nt(e,t)}}var Gg=La(),jg=La(!0);function qi(){return[]}function Hi(){return!1}function qg(){return{}}function Hg(){return""}function zg(){return!0}function Kg(e,t){if(e=D(e),e<1||e>mt)return[];var n=Ze,i=he(e,Ze);t=$(t),e-=Ze;for(var a=Yr(i,t);++n<e;)t(n);return a}function Yg(e){return U(e)?ee(e,He):Te(e)?[e]:we(Ja(z(e)))}function Jg(e){var t=++oc;return z(e)+t}var Zg=cr(function(e,t){return e+t},0),Xg=Si("ceil"),Qg=cr(function(e,t){return e/t},1),em=Si("floor");function tm(e){return e&&e.length?rr(e,xe,ai):r}function nm(e,t){return e&&e.length?rr(e,$(t,2),ai):r}function rm(e){return Us(e,xe)}function im(e,t){return Us(e,$(t,2))}function sm(e){return e&&e.length?rr(e,xe,ci):r}function am(e,t){return e&&e.length?rr(e,$(t,2),ci):r}var om=cr(function(e,t){return e*t},1),lm=Si("round"),um=cr(function(e,t){return e-t},0);function cm(e){return e&&e.length?Kr(e,xe):0}function fm(e,t){return e&&e.length?Kr(e,$(t,2)):0}return o.after=Lp,o.ary=oo,o.assign=Sh,o.assignIn=Io,o.assignInWith=xo,o.assignWith=Di,o.at=Ih,o.before=lo,o.bind=Ni,o.bindAll=Cg,o.bindKey=uo,o.castArray=Hp,o.chain=io,o.chunk=td,o.compact=nd,o.concat=rd,o.cond=Tg,o.conforms=Rg,o.constant=ki,o.countBy=fp,o.create=xh,o.curry=co,o.curryRight=fo,o.debounce=po,o.defaults=Ah,o.defaultsDeep=Eh,o.defer=Op,o.delay=Up,o.difference=id,o.differenceBy=sd,o.differenceWith=ad,o.drop=od,o.dropRight=ld,o.dropRightWhile=ud,o.dropWhile=cd,o.fill=fd,o.filter=pp,o.flatMap=mp,o.flatMapDeep=vp,o.flatMapDepth=yp,o.flatten=eo,o.flattenDeep=dd,o.flattenDepth=pd,o.flip=Dp,o.flow=Fg,o.flowRight=$g,o.fromPairs=hd,o.functions=$h,o.functionsIn=Nh,o.groupBy=_p,o.initial=md,o.intersection=vd,o.intersectionBy=yd,o.intersectionWith=_d,o.invert=Oh,o.invertBy=Uh,o.invokeMap=Sp,o.iteratee=Vi,o.keyBy=Ip,o.keys=le,o.keysIn=Ie,o.map=vr,o.mapKeys=Mh,o.mapValues=Wh,o.matches=Ng,o.matchesProperty=Lg,o.memoize=_r,o.merge=Bh,o.mergeWith=Ao,o.method=Og,o.methodOf=Ug,o.mixin=Gi,o.negate=wr,o.nthArg=Mg,o.omit=kh,o.omitBy=Vh,o.once=Mp,o.orderBy=xp,o.over=Wg,o.overArgs=Wp,o.overEvery=Bg,o.overSome=kg,o.partial=Li,o.partialRight=ho,o.partition=Ap,o.pick=Gh,o.pickBy=Eo,o.property=$o,o.propertyOf=Vg,o.pull=xd,o.pullAll=no,o.pullAllBy=Ad,o.pullAllWith=Ed,o.pullAt=bd,o.range=Gg,o.rangeRight=jg,o.rearg=Bp,o.reject=Cp,o.remove=Cd,o.rest=kp,o.reverse=Fi,o.sampleSize=Rp,o.set=qh,o.setWith=Hh,o.shuffle=Pp,o.slice=Td,o.sortBy=Np,o.sortedUniq=Od,o.sortedUniqBy=Ud,o.split=gg,o.spread=Vp,o.tail=Dd,o.take=Md,o.takeRight=Wd,o.takeRightWhile=Bd,o.takeWhile=kd,o.tap=np,o.throttle=Gp,o.thru=mr,o.toArray=_o,o.toPairs=bo,o.toPairsIn=Co,o.toPath=Yg,o.toPlainObject=So,o.transform=zh,o.unary=jp,o.union=Vd,o.unionBy=Gd,o.unionWith=jd,o.uniq=qd,o.uniqBy=Hd,o.uniqWith=zd,o.unset=Kh,o.unzip=$i,o.unzipWith=ro,o.update=Yh,o.updateWith=Jh,o.values=en,o.valuesIn=Zh,o.without=Kd,o.words=Po,o.wrap=qp,o.xor=Yd,o.xorBy=Jd,o.xorWith=Zd,o.zip=Xd,o.zipObject=Qd,o.zipObjectDeep=ep,o.zipWith=tp,o.entries=bo,o.entriesIn=Co,o.extend=Io,o.extendWith=xo,Gi(o,o),o.add=Zg,o.attempt=Fo,o.camelCase=tg,o.capitalize=To,o.ceil=Xg,o.clamp=Xh,o.clone=zp,o.cloneDeep=Yp,o.cloneDeepWith=Jp,o.cloneWith=Kp,o.conformsTo=Zp,o.deburr=Ro,o.defaultTo=Pg,o.divide=Qg,o.endsWith=ng,o.eq=ze,o.escape=rg,o.escapeRegExp=ig,o.every=dp,o.find=hp,o.findIndex=Xa,o.findKey=bh,o.findLast=gp,o.findLastIndex=Qa,o.findLastKey=Ch,o.floor=em,o.forEach=so,o.forEachRight=ao,o.forIn=Th,o.forInRight=Rh,o.forOwn=Ph,o.forOwnRight=Fh,o.get=Mi,o.gt=Xp,o.gte=Qp,o.has=Lh,o.hasIn=Wi,o.head=to,o.identity=xe,o.includes=wp,o.indexOf=gd,o.inRange=Qh,o.invoke=Dh,o.isArguments=Ut,o.isArray=U,o.isArrayBuffer=eh,o.isArrayLike=Se,o.isArrayLikeObject=ie,o.isBoolean=th,o.isBuffer=Et,o.isDate=nh,o.isElement=rh,o.isEmpty=ih,o.isEqual=sh,o.isEqualWith=ah,o.isError=Oi,o.isFinite=oh,o.isFunction=ft,o.isInteger=go,o.isLength=Sr,o.isMap=mo,o.isMatch=lh,o.isMatchWith=uh,o.isNaN=ch,o.isNative=fh,o.isNil=ph,o.isNull=dh,o.isNumber=vo,o.isObject=te,o.isObjectLike=re,o.isPlainObject=Tn,o.isRegExp=Ui,o.isSafeInteger=hh,o.isSet=yo,o.isString=Ir,o.isSymbol=Te,o.isTypedArray=Qt,o.isUndefined=gh,o.isWeakMap=mh,o.isWeakSet=vh,o.join=wd,o.kebabCase=sg,o.last=De,o.lastIndexOf=Sd,o.lowerCase=ag,o.lowerFirst=og,o.lt=yh,o.lte=_h,o.max=tm,o.maxBy=nm,o.mean=rm,o.meanBy=im,o.min=sm,o.minBy=am,o.stubArray=qi,o.stubFalse=Hi,o.stubObject=qg,o.stubString=Hg,o.stubTrue=zg,o.multiply=om,o.nth=Id,o.noConflict=Dg,o.noop=ji,o.now=yr,o.pad=lg,o.padEnd=ug,o.padStart=cg,o.parseInt=fg,o.random=eg,o.reduce=Ep,o.reduceRight=bp,o.repeat=dg,o.replace=pg,o.result=jh,o.round=lm,o.runInContext=g,o.sample=Tp,o.size=Fp,o.snakeCase=hg,o.some=$p,o.sortedIndex=Rd,o.sortedIndexBy=Pd,o.sortedIndexOf=Fd,o.sortedLastIndex=$d,o.sortedLastIndexBy=Nd,o.sortedLastIndexOf=Ld,o.startCase=mg,o.startsWith=vg,o.subtract=um,o.sum=cm,o.sumBy=fm,o.template=yg,o.times=Kg,o.toFinite=dt,o.toInteger=D,o.toLength=wo,o.toLower=_g,o.toNumber=Me,o.toSafeInteger=wh,o.toString=z,o.toUpper=wg,o.trim=Sg,o.trimEnd=Ig,o.trimStart=xg,o.truncate=Ag,o.unescape=Eg,o.uniqueId=Jg,o.upperCase=bg,o.upperFirst=Bi,o.each=so,o.eachRight=ao,o.first=to,Gi(o,(function(){var e={};return Qe(o,function(t,n){H.call(o.prototype,n)||(e[n]=t)}),e})(),{chain:!1}),o.VERSION=c,Ee(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Ee(["drop","take"],function(e,t){V.prototype[e]=function(n){n=n===r?1:oe(D(n),0);var i=this.__filtered__&&!t?new V(this):this.clone();return i.__filtered__?i.__takeCount__=he(n,i.__takeCount__):i.__views__.push({size:he(n,Ze),type:e+(i.__dir__<0?"Right":"")}),i},V.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ee(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==Qi||n==xl;V.prototype[e]=function(a){var u=this.clone();return u.__iteratees__.push({iteratee:$(a,3),type:n}),u.__filtered__=u.__filtered__||i,u}}),Ee(["head","last"],function(e,t){var n="take"+(t?"Right":"");V.prototype[e]=function(){return this[n](1).value()[0]}}),Ee(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");V.prototype[e]=function(){return this.__filtered__?new V(this):this[n](1)}}),V.prototype.compact=function(){return this.filter(xe)},V.prototype.find=function(e){return this.filter(e).head()},V.prototype.findLast=function(e){return this.reverse().find(e)},V.prototype.invokeMap=W(function(e,t){return typeof e=="function"?new V(this):this.map(function(n){return In(n,e,t)})}),V.prototype.reject=function(e){return this.filter(wr($(e)))},V.prototype.slice=function(e,t){e=D(e);var n=this;return n.__filtered__&&(e>0||t<0)?new V(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=D(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},V.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},V.prototype.toArray=function(){return this.take(Ze)},Qe(V.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=o[i?"take"+(t=="last"?"Right":""):t],u=i||/^find/.test(t);a&&(o.prototype[t]=function(){var d=this.__wrapped__,p=i?[1]:arguments,m=d instanceof V,S=p[0],I=m||U(d),A=function(k){var G=a.apply(o,yt([k],p));return i&&E?G[0]:G};I&&n&&typeof S=="function"&&S.length!=1&&(m=I=!1);var E=this.__chain__,P=!!this.__actions__.length,N=u&&!E,M=m&&!P;if(!u&&I){d=M?d:new V(this);var F=e.apply(d,p);return F.__actions__.push({func:mr,args:[A],thisArg:r}),new Le(F,E)}return N&&M?e.apply(this,p):(F=this.thru(A),N?i?F.value()[0]:F.value():F)})}),Ee(["pop","push","shift","sort","splice","unshift"],function(e){var t=Vn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var u=this.value();return t.apply(U(u)?u:[],a)}return this[n](function(d){return t.apply(U(d)?d:[],a)})}}),Qe(V.prototype,function(e,t){var n=o[t];if(n){var i=n.name+"";H.call(Kt,i)||(Kt[i]=[]),Kt[i].push({name:t,func:n})}}),Kt[ur(r,gt).name]=[{name:"wrapper",func:r}],V.prototype.clone=Ec,V.prototype.reverse=bc,V.prototype.value=Cc,o.prototype.at=rp,o.prototype.chain=ip,o.prototype.commit=sp,o.prototype.next=ap,o.prototype.plant=lp,o.prototype.reverse=up,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=cp,o.prototype.first=o.prototype.head,gn&&(o.prototype[gn]=op),o}),qt=ic();Tt?((Tt.exports=qt)._=qt,kr._=qt):fe._=qt}).call(Tm)})(Rn,Rn.exports)),Rn.exports}var Pm=Rm();const zi=l=>{const s=Pm.startCase(l).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},Fm=["src/application.config.ts","src/application-config.ts","src/applicationConfig.ts"],Mo=/serverVariables\s*:\s*\{/,$m=/defineApplication\s*\(\s*\{/,Nm=async({projectRoot:l,variables:s})=>{const r=await Lm(l);if(r===null)return{status:"skipped-no-config"};const c=await nt.readFile(r,"utf8"),f=s.filter(R=>!new RegExp(`\\b${R.name}\\s*:`).test(c));if(f.length===0)return{status:"skipped-existing"};const w=Om(f);if(Mo.test(c)){const R=c.replace(Mo,L=>`${L}
|
|
29
|
+
${w}`);return await nt.writeFile(r,R,"utf8"),{status:"appended",file:r}}if(!$m.test(c))return{status:"skipped-no-app-call"};const x=c.replace(/\n(\s*)\}\s*\)\s*;?\s*$/,(R,L)=>{const T=Um(f,L);return`
|
|
30
|
+
${L}${T}
|
|
31
|
+
${L}});
|
|
32
|
+
`});return x===c?{status:"skipped-no-app-call"}:(await nt.writeFile(r,x,"utf8"),{status:"created",file:r})},Lm=async l=>{for(const s of Fm){const r=`${l}/${s}`;if(await h.pathExists(r))return r}return null},Om=l=>l.map(({name:s,description:r,isSecret:c})=>` ${s}: {
|
|
33
33
|
description: ${JSON.stringify(r)},
|
|
34
34
|
isSecret: ${c},
|
|
35
35
|
isRequired: true,
|
|
36
36
|
},`).join(`
|
|
37
|
-
`),
|
|
38
|
-
${l.map(({name:c,description:f,isSecret:
|
|
37
|
+
`),Um=(l,s)=>`serverVariables: {
|
|
38
|
+
${l.map(({name:c,description:f,isSecret:w})=>`${s} ${c}: {
|
|
39
39
|
${s} description: ${JSON.stringify(f)},
|
|
40
|
-
${s} isSecret: ${
|
|
40
|
+
${s} isSecret: ${w},
|
|
41
41
|
${s} isRequired: true,
|
|
42
42
|
${s} },`).join(`
|
|
43
43
|
`)}
|
|
44
|
-
${s}},`,
|
|
45
|
-
description: '${l.description}',`:"";
|
|
44
|
+
${s}},`,Dm=({data:l})=>{const s=J.v4(),r=l.description?`
|
|
45
|
+
description: '${l.description}',`:"";if(l.type===h.R.RELATION||l.type===h.R.MORPH_RELATION){const f=l.onDelete&&l.onDelete!=="None",w=`import { defineField, FieldType, RelationType${f?", OnDeleteAction":""} } from 'twenty-sdk/define';`,x=f?`, onDelete: OnDeleteAction.${l.onDelete}`:"",R=l.type===h.R.MORPH_RELATION?`
|
|
46
|
+
morphId: '${J.v4()}',`:"";return`${w}
|
|
47
|
+
|
|
48
|
+
export default defineField({
|
|
49
|
+
universalIdentifier: '${s}',
|
|
50
|
+
name: '${l.name}',
|
|
51
|
+
label: '${l.label}',
|
|
52
|
+
type: FieldType.${l.type},
|
|
53
|
+
objectUniversalIdentifier: '${l.objectUniversalIdentifier}',
|
|
54
|
+
relationTargetObjectMetadataUniversalIdentifier: '${l.relationTargetObjectMetadataUniversalIdentifier}',
|
|
55
|
+
relationTargetFieldMetadataUniversalIdentifier: '${l.relationTargetFieldMetadataUniversalIdentifier}',
|
|
56
|
+
universalSettings: { relationType: RelationType.${l.relationType}${x} },${R}${r}
|
|
57
|
+
});
|
|
58
|
+
`}return`import { defineField, FieldType } from 'twenty-sdk/define';
|
|
46
59
|
|
|
47
60
|
export default defineField({
|
|
48
61
|
universalIdentifier: '${s}',
|
|
@@ -51,7 +64,7 @@ export default defineField({
|
|
|
51
64
|
type: FieldType.${l.type},
|
|
52
65
|
objectUniversalIdentifier: '${l.objectUniversalIdentifier}',${r}
|
|
53
66
|
});
|
|
54
|
-
`},
|
|
67
|
+
`},ue=l=>l.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/([a-zA-Z])(\d)/g,"$1-$2").replace(/(\d)([a-zA-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase(),Mm=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l);return`import { defineFrontComponent } from 'twenty-sdk/define';
|
|
55
68
|
|
|
56
69
|
// React component - implement your UI here
|
|
57
70
|
const Component = () => {
|
|
@@ -69,7 +82,7 @@ export default defineFrontComponent({
|
|
|
69
82
|
description: 'Add a description for your front component',
|
|
70
83
|
component: Component,
|
|
71
84
|
});
|
|
72
|
-
`},
|
|
85
|
+
`},Wm=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l);return`import { defineLogicFunction } from 'twenty-sdk/define';
|
|
73
86
|
|
|
74
87
|
// Logic function handler - rename and implement your logic
|
|
75
88
|
const handler = async (params: {
|
|
@@ -106,20 +119,20 @@ export default defineLogicFunction({
|
|
|
106
119
|
// eventName: 'objectName.created',
|
|
107
120
|
// },
|
|
108
121
|
});
|
|
109
|
-
`},
|
|
110
|
-
targetObjectUniversalIdentifier: '${f}',`:r==="VIEW"&&c?
|
|
111
|
-
viewUniversalIdentifier: '${c}',`:r==="LINK"?
|
|
112
|
-
link: 'https://example.com',`:r==="FOLDER"?
|
|
122
|
+
`},Wo=({name:l,universalIdentifier:s=J.v4(),type:r,viewUniversalIdentifier:c,targetObjectUniversalIdentifier:f})=>{const w=ue(l);let x;return r==="OBJECT"&&f?x=` type: NavigationMenuItemType.OBJECT,
|
|
123
|
+
targetObjectUniversalIdentifier: '${f}',`:r==="VIEW"&&c?x=` type: NavigationMenuItemType.VIEW,
|
|
124
|
+
viewUniversalIdentifier: '${c}',`:r==="LINK"?x=` type: NavigationMenuItemType.LINK,
|
|
125
|
+
link: 'https://example.com',`:r==="FOLDER"?x=" type: NavigationMenuItemType.FOLDER,":x=` type: NavigationMenuItemType.VIEW,
|
|
113
126
|
// viewUniversalIdentifier: '...',`,`import { defineNavigationMenuItem, NavigationMenuItemType } from 'twenty-sdk/define';
|
|
114
127
|
|
|
115
128
|
export default defineNavigationMenuItem({
|
|
116
129
|
universalIdentifier: '${s}',
|
|
117
|
-
name: '${
|
|
130
|
+
name: '${w}',
|
|
118
131
|
icon: 'IconList',
|
|
119
132
|
position: 0,
|
|
120
|
-
${
|
|
133
|
+
${x}
|
|
121
134
|
});
|
|
122
|
-
`},
|
|
135
|
+
`},Bm=({data:l,universalIdentifier:s=J.v4(),nameFieldUniversalIdentifier:r=J.v4()})=>`import { defineObject, FieldType } from 'twenty-sdk/define';
|
|
123
136
|
|
|
124
137
|
export const NAME_FIELD_UNIVERSAL_IDENTIFIER =
|
|
125
138
|
'${r}';
|
|
@@ -143,32 +156,32 @@ export default defineObject({
|
|
|
143
156
|
},
|
|
144
157
|
],
|
|
145
158
|
});
|
|
146
|
-
`,
|
|
159
|
+
`,km=({name:l})=>`import { defineCommandMenuItem } from 'twenty-sdk/define';
|
|
147
160
|
|
|
148
161
|
export default defineCommandMenuItem({
|
|
149
|
-
universalIdentifier: '${
|
|
162
|
+
universalIdentifier: '${J.v4()}',
|
|
150
163
|
frontComponentUniversalIdentifier:
|
|
151
164
|
'replace-with-existing-front-component-uuid',
|
|
152
165
|
label: '${l}',
|
|
153
166
|
availabilityType: 'GLOBAL',
|
|
154
167
|
});
|
|
155
|
-
`,
|
|
168
|
+
`,Vm=({name:l})=>`import { definePageLayout } from 'twenty-sdk/define';
|
|
156
169
|
|
|
157
170
|
export default definePageLayout({
|
|
158
|
-
universalIdentifier: '${
|
|
171
|
+
universalIdentifier: '${J.v4()}',
|
|
159
172
|
name: '${l}',
|
|
160
173
|
tabs: [
|
|
161
174
|
{
|
|
162
|
-
universalIdentifier: '${
|
|
175
|
+
universalIdentifier: '${J.v4()}',
|
|
163
176
|
title: 'Overview',
|
|
164
177
|
widgets: [],
|
|
165
178
|
},
|
|
166
179
|
],
|
|
167
180
|
});
|
|
168
|
-
`,
|
|
181
|
+
`,Gm=({name:l})=>`import { definePageLayoutTab, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
|
|
169
182
|
|
|
170
183
|
export default definePageLayoutTab({
|
|
171
|
-
universalIdentifier: '${
|
|
184
|
+
universalIdentifier: '${J.v4()}',
|
|
172
185
|
pageLayoutUniversalIdentifier: 'replace-with-existing-page-layout-uuid',
|
|
173
186
|
title: '${l}',
|
|
174
187
|
position: 1000,
|
|
@@ -176,23 +189,23 @@ export default definePageLayoutTab({
|
|
|
176
189
|
layoutMode: PageLayoutTabLayoutMode.CANVAS,
|
|
177
190
|
widgets: [],
|
|
178
191
|
});
|
|
179
|
-
`,
|
|
192
|
+
`,jm=({objectLabelSingular:l,objectUniversalIdentifier:s,fieldsWidgetViewUniversalIdentifier:r})=>`import { definePageLayout, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
|
|
180
193
|
|
|
181
194
|
export default definePageLayout({
|
|
182
|
-
universalIdentifier: '${
|
|
195
|
+
universalIdentifier: '${J.v4()}',
|
|
183
196
|
name: 'Default ${l} Layout',
|
|
184
197
|
type: 'RECORD_PAGE',
|
|
185
198
|
objectUniversalIdentifier: '${s}',
|
|
186
199
|
tabs: [
|
|
187
200
|
{
|
|
188
|
-
universalIdentifier: '${
|
|
201
|
+
universalIdentifier: '${J.v4()}',
|
|
189
202
|
title: 'Home',
|
|
190
203
|
position: 10,
|
|
191
204
|
icon: 'IconHome',
|
|
192
205
|
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
193
206
|
widgets: [
|
|
194
207
|
{
|
|
195
|
-
universalIdentifier: '${
|
|
208
|
+
universalIdentifier: '${J.v4()}',
|
|
196
209
|
title: 'Fields',
|
|
197
210
|
type: 'FIELDS',
|
|
198
211
|
configuration: {
|
|
@@ -203,14 +216,14 @@ export default definePageLayout({
|
|
|
203
216
|
],
|
|
204
217
|
},
|
|
205
218
|
{
|
|
206
|
-
universalIdentifier: '${
|
|
219
|
+
universalIdentifier: '${J.v4()}',
|
|
207
220
|
title: 'Timeline',
|
|
208
221
|
position: 20,
|
|
209
222
|
icon: 'IconTimelineEvent',
|
|
210
223
|
layoutMode: PageLayoutTabLayoutMode.CANVAS,
|
|
211
224
|
widgets: [
|
|
212
225
|
{
|
|
213
|
-
universalIdentifier: '${
|
|
226
|
+
universalIdentifier: '${J.v4()}',
|
|
214
227
|
title: 'Timeline',
|
|
215
228
|
type: 'TIMELINE',
|
|
216
229
|
configuration: {
|
|
@@ -221,7 +234,7 @@ export default definePageLayout({
|
|
|
221
234
|
},
|
|
222
235
|
],
|
|
223
236
|
});
|
|
224
|
-
`,
|
|
237
|
+
`,qm=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l);return`import { defineRole } from 'twenty-sdk/define';
|
|
225
238
|
|
|
226
239
|
export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
|
|
227
240
|
'${s}';
|
|
@@ -235,7 +248,7 @@ export default defineRole({
|
|
|
235
248
|
canSoftDeleteAllObjectRecords: true,
|
|
236
249
|
canDestroyAllObjectRecords: false,
|
|
237
250
|
});
|
|
238
|
-
`},
|
|
251
|
+
`},Hm=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l);return`import { defineAgent } from 'twenty-sdk/define';
|
|
239
252
|
|
|
240
253
|
export const ${r.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER =
|
|
241
254
|
'${s}';
|
|
@@ -248,7 +261,7 @@ export default defineAgent({
|
|
|
248
261
|
prompt: 'Add the agent system prompt here',
|
|
249
262
|
responseFormat: {type: 'text'},
|
|
250
263
|
});
|
|
251
|
-
`},
|
|
264
|
+
`},zm=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l),c=r.toUpperCase().replace(/-/g,"_"),f=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'");return`import { defineConnectionProvider } from 'twenty-sdk/define';
|
|
252
265
|
|
|
253
266
|
export const ${c}_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER =
|
|
254
267
|
'${s}';
|
|
@@ -268,7 +281,7 @@ export default defineConnectionProvider({
|
|
|
268
281
|
clientSecretVariable: '${c}_CLIENT_SECRET',
|
|
269
282
|
},
|
|
270
283
|
});
|
|
271
|
-
`},
|
|
284
|
+
`},Km=({name:l,universalIdentifier:s=J.v4()})=>{const r=ue(l);return`import { defineSkill } from 'twenty-sdk/define';
|
|
272
285
|
|
|
273
286
|
export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
274
287
|
'${s}';
|
|
@@ -280,17 +293,17 @@ export default defineSkill({
|
|
|
280
293
|
description: 'Add a description for your skill',
|
|
281
294
|
content: 'Add the skill content here',
|
|
282
295
|
});
|
|
283
|
-
`},
|
|
296
|
+
`},Ym=({field:l,index:s,objectUniversalIdentifier:r})=>{const c=l.universalIdentifier??J.v4(),f=l.position??s,w=l.isVisible??!0,x=l.size??200,R="defaultFieldName"in l?` fieldMetadataUniversalIdentifier: generateDefaultFieldUniversalIdentifier({
|
|
284
297
|
objectUniversalIdentifier: '${r}',
|
|
285
298
|
fieldName: '${l.defaultFieldName}',
|
|
286
299
|
})`:` fieldMetadataUniversalIdentifier: '${l.fieldMetadataUniversalIdentifier}'`;return` {
|
|
287
300
|
universalIdentifier: '${c}',
|
|
288
|
-
${
|
|
301
|
+
${R},
|
|
289
302
|
position: ${f},
|
|
290
|
-
isVisible: ${
|
|
291
|
-
size: ${
|
|
292
|
-
}`},Ki=({name:l,universalIdentifier:s=
|
|
293
|
-
${c.map((
|
|
303
|
+
isVisible: ${w},
|
|
304
|
+
size: ${x},
|
|
305
|
+
}`},Ki=({name:l,universalIdentifier:s=J.v4(),objectUniversalIdentifier:r="fill-later",fields:c=[],type:f})=>{const w=ue(l),x=c.some(ne=>"defaultFieldName"in ne),L=c.length>0?` fields: [
|
|
306
|
+
${c.map((ne,Z)=>Ym({field:ne,index:Z,objectUniversalIdentifier:r})).join(`,
|
|
294
307
|
`)},
|
|
295
308
|
],`:` // fields: [
|
|
296
309
|
// {
|
|
@@ -299,19 +312,19 @@ ${c.map((J,se)=>zm({field:J,index:se,objectUniversalIdentifier:r})).join(`,
|
|
|
299
312
|
// position: 0,
|
|
300
313
|
// isVisible: true,
|
|
301
314
|
// },
|
|
302
|
-
// ],`,
|
|
303
|
-
`:"";return`${
|
|
315
|
+
// ],`,T=f!==void 0?` type: '${f}',
|
|
316
|
+
`:"";return`${x?`import {
|
|
304
317
|
defineView,
|
|
305
318
|
generateDefaultFieldUniversalIdentifier,
|
|
306
319
|
} from 'twenty-sdk/define';`:"import { defineView } from 'twenty-sdk/define';"}
|
|
307
320
|
|
|
308
321
|
export default defineView({
|
|
309
322
|
universalIdentifier: '${s}',
|
|
310
|
-
name: '${
|
|
323
|
+
name: '${w}',
|
|
311
324
|
objectUniversalIdentifier: '${r}',
|
|
312
|
-
${
|
|
325
|
+
${T} icon: 'IconList',
|
|
313
326
|
position: 0,
|
|
314
|
-
${
|
|
327
|
+
${L}
|
|
315
328
|
// filters: [
|
|
316
329
|
// {
|
|
317
330
|
// universalIdentifier: '...',
|
|
@@ -328,7 +341,7 @@ ${P}
|
|
|
328
341
|
// },
|
|
329
342
|
// ],
|
|
330
343
|
});
|
|
331
|
-
`},
|
|
344
|
+
`},Jm=({universalIdentifier:l=J.v4()})=>`import {
|
|
332
345
|
defineViewField,
|
|
333
346
|
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
334
347
|
} from 'twenty-sdk/define';
|
|
@@ -343,17 +356,17 @@ export default defineViewField({
|
|
|
343
356
|
isVisible: true,
|
|
344
357
|
size: 150,
|
|
345
358
|
});
|
|
346
|
-
`,
|
|
347
|
-
`+c.map(
|
|
348
|
-
`)));break}}buildRecordPageFieldsViewFields(s){const c=["createdAt","updatedAt","createdBy","updatedBy"].map(
|
|
349
|
-
`));const c=await
|
|
350
|
-
`));const
|
|
351
|
-
`);const
|
|
352
|
-
`),
|
|
353
|
-
`)),
|
|
354
|
-
`))}}const
|
|
355
|
-
`));const c=await
|
|
356
|
-
`,
|
|
359
|
+
`,Zm="src/application.config.ts",xr="src";class ol{async execute(s,r){try{const c=s??await this.getEntity(),f=this.getFolderName(c),w=r?j.join(Y,r):j.join(Y,xr,f);await h.ensureDir(w);const{name:x,file:R}=await this.getEntityData(c),L=j.join(w,this.getFileName(x,c));if(await h.pathExists(L)){const{overwrite:T}=await this.handleFileExist();if(!T)return}await nt.writeFile(L,R),console.log(v.default.green(`✓ Created ${f}:`),v.default.cyan(j.relative(Y,L))),c===h.o$1.Object&&await this.promptAndCreateObjectCompanions(x,r),c===h.o$1.ConnectionProvider&&await this.registerConnectionProviderServerVariables(x)}catch(c){console.error(v.default.red("Add new entity failed:"),c instanceof Error?c.message:c),process.exit(1)}}async getEntityData(s){switch(s){case h.o$1.Object:{const r=await this.getObjectData(),c=r.nameSingular,f=J.v4(),w=J.v4();this.lastObjectUniversalIdentifier=f,this.lastNameFieldUniversalIdentifier=w,this.lastObjectLabelSingular=r.labelSingular;const x=Bm({data:r,universalIdentifier:f,nameFieldUniversalIdentifier:w});return{name:c,file:x}}case h.o$1.Field:{const r=await this.getFieldData(),c=r.name,f=Dm({data:r});return{name:c,file:f}}case h.o$1.LogicFunction:{const r=await this.getEntityName(s),c=Wm({name:r});return{name:r,file:c}}case h.o$1.FrontComponent:{const r=await this.getEntityName(s),c=Mm({name:r});return{name:r,file:c}}case h.o$1.Role:{const r=await this.getEntityName(s),c=qm({name:r});return{name:r,file:c}}case h.o$1.Skill:{const r=await this.getEntityName(s),c=Km({name:r});return{name:r,file:c}}case h.o$1.Agent:{const r=await this.getEntityName(s),c=Hm({name:r});return{name:r,file:c}}case h.o$1.ConnectionProvider:{const r=await this.getEntityName(s),c=zm({name:r});return{name:r,file:c}}case h.o$1.View:{const c=(await this.getViewData()).name,f=Ki({name:c});return{name:c,file:f}}case h.o$1.ViewField:{const r=await this.getEntityName(s),c=Jm({});return{name:r,file:c}}case h.o$1.NavigationMenuItem:{const r=await this.getEntityName(s),c=Wo({name:r});return{name:r,file:c}}case h.o$1.PageLayout:{const r=await this.getEntityName(s),c=Vm({name:r});return{name:r,file:c}}case h.o$1.PageLayoutTab:{const r=await this.getEntityName(s),c=Gm({name:r});return{name:r,file:c}}case h.o$1.CommandMenuItem:{const r=await this.getEntityName(s),c=km({name:r});return{name:r,file:c}}default:h.$()}}async promptAndCreateObjectCompanions(s,r){const{createCompanions:c}=await Ye.default.prompt([{type:"confirm",name:"createCompanions",message:"Also create a view, navigation menu item, and record page layout for this object? (recommended)",default:!0}]);if(!c||!this.lastObjectUniversalIdentifier)return;const f=J.v4(),w=J.v4(),x=Ki({name:`all-${ue(s)}`,universalIdentifier:f,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),R=r?j.join(Y,r):j.join(Y,xr,this.getFolderName(h.o$1.View));await h.ensureDir(R);const L=`all-${ue(s)}.ts`,T=j.join(R,L);if(await h.pathExists(T)){const{overwrite:ce}=await this.handleFileExist();if(!ce)return}await nt.writeFile(T,x),console.log(v.default.green("✓ Created view:"),v.default.cyan(j.relative(Y,T)));const B=this.buildRecordPageFieldsViewFields(this.lastNameFieldUniversalIdentifier),ne=Ki({name:`${ue(s)}-record-page-fields`,universalIdentifier:w,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,type:h.NE.FIELDS_WIDGET,fields:B}),Z=`${ue(s)}-record-page-fields.ts`,ht=j.join(R,Z);if(await h.pathExists(ht)){const{overwrite:ce}=await this.handleFileExist();if(!ce)return}await nt.writeFile(ht,ne),console.log(v.default.green("✓ Created record-page-fields view:"),v.default.cyan(j.relative(Y,ht)));const Be=Wo({name:s,type:"OBJECT",targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),Fe=r?j.join(Y,r):j.join(Y,xr,this.getFolderName(h.o$1.NavigationMenuItem));await h.ensureDir(Fe);const Mt=`${ue(s)}.ts`,me=j.join(Fe,Mt);if(await h.pathExists(me)){const{overwrite:ce}=await this.handleFileExist();if(!ce)return}await nt.writeFile(me,Be),console.log(v.default.green("✓ Created navigation menu item:"),v.default.cyan(j.relative(Y,me)));const gt=jm({objectLabelSingular:this.lastObjectLabelSingular??s,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fieldsWidgetViewUniversalIdentifier:w}),rn=r?j.join(Y,r):j.join(Y,xr,this.getFolderName(h.o$1.PageLayout));await h.ensureDir(rn);const ke=`${ue(s)}-record-page-layout.ts`,rt=j.join(rn,ke);if(await h.pathExists(rt)){const{overwrite:ce}=await this.handleFileExist();if(!ce)return}await nt.writeFile(rt,gt),console.log(v.default.green("✓ Created record page layout:"),v.default.cyan(j.relative(Y,rt)))}async registerConnectionProviderServerVariables(s){const r=ue(s).toUpperCase().replace(/-/g,"_"),c=[{name:`${r}_CLIENT_ID`,description:"OAuth client ID issued by the third-party provider. Filled in once by the server admin on the application registration.",isSecret:!1},{name:`${r}_CLIENT_SECRET`,description:"OAuth client secret issued by the third-party provider. Stored encrypted; never echoed in API responses.",isSecret:!0}],f=await Nm({projectRoot:Y,variables:c});switch(f.status){case"appended":case"created":{console.log(v.default.green(`✓ Added ${c.map(w=>w.name).join(" + ")} to defineApplication.serverVariables:`),v.default.cyan(j.relative(Y,f.file)));break}case"skipped-existing":console.log(v.default.dim(` (${c.map(w=>w.name).join(" / ")} already declared on defineApplication.serverVariables)`));break;case"skipped-no-config":case"skipped-no-app-call":console.log(v.default.yellow(`! Couldn't auto-update ${Zm}. Add these manually to defineApplication.serverVariables:
|
|
360
|
+
`+c.map(w=>` ${w.name}: { description: '...', isSecret: ${w.isSecret}, isRequired: true },`).join(`
|
|
361
|
+
`)));break}}buildRecordPageFieldsViewFields(s){const c=["createdAt","updatedAt","createdBy","updatedBy"].map(w=>({defaultFieldName:w,isVisible:!0,size:200}));return(s?[{fieldMetadataUniversalIdentifier:s,isVisible:!0,size:200},...c]:c).map((w,x)=>({...w,position:x}))}async getEntity(){const{entity:s}=await Ye.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(h.o$1)}]);return s}async handleFileExist(){return await Ye.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(s){const{name:r}=await Ye.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${s}:`,default:"",validate:c=>c.length===0?`${s} name is required`:!0}]);return r}async getFieldData(){const s=r=>r===h.R.RELATION||r===h.R.MORPH_RELATION;return Ye.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:r=>!r||r.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:r=>zi(r.name),validate:r=>!r||r.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(h.R),default:h.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:r=>!r||r.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""},{type:"input",name:"relationTargetObjectMetadataUniversalIdentifier",message:"Enter the universalIdentifier of the target object of the relation:",default:"fill-later",when:r=>s(r.type),validate:r=>!r||r.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"relationTargetFieldMetadataUniversalIdentifier",message:"Enter the universalIdentifier of the target field on the related object:",default:"fill-later",when:r=>s(r.type),validate:r=>!r||r.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"relationType",message:"Select the relation type:",choices:Object.values(h.d),default:h.d.ONE_TO_MANY,when:r=>s(r.type)},{type:"select",name:"onDelete",message:"Select the onDelete behavior:",choices:Object.values(h.$$1),default:h.$$1.CASCADE,when:r=>s(r.type)}])}async getObjectData(){return Ye.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(s,r)=>s.trim()===r?.nameSingular.trim()?"Name plural must be different from name singular":!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:s=>zi(s.nameSingular),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:s=>zi(s.namePlural),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return Ye.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this view belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(s){return`${ue(s)}s`}getFileName(s,r){return r===h.o$1.FrontComponent?`${ue(s)}.tsx`:`${ue(s)}.ts`}}class ll{async execute(s){const r=s.appPath??Y;await tn(r),console.log(v.default.blue("Building application...")),console.log(v.default.gray(`App path: ${r}
|
|
362
|
+
`));const c=await h.appBuild({appPath:r,tarball:s.tarball,onProgress:f=>console.log(v.default.gray(f))});c.success||(console.error(v.default.red(c.error.message)),process.exit(1)),console.log(v.default.green(`✓ Build succeeded (${c.data.fileCount} file${c.data.fileCount===1?"":"s"})`)),console.log(v.default.gray(`Output: ${c.data.outputDir}`)),c.data.tarballPath&&console.log(v.default.gray(`Tarball: ${c.data.tarballPath}`))}}class ul{async execute({appPath:s=Y,postInstall:r=!1,preInstall:c=!1,functionUniversalIdentifier:f,functionName:w,payload:x="{}"}){let R;try{R=JSON.parse(x)}catch{console.error(v.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const L=r?"post install":c?"pre install":f??w,T=h.ConfigService.getActiveRemote();console.log(v.default.blue(`🚀 Executing function "${L}" on ${T}...`)),console.log(v.default.gray(` Payload: ${JSON.stringify(R)}
|
|
363
|
+
`));const B=r?{appPath:s,postInstall:!0,payload:R}:c?{appPath:s,preInstall:!0,payload:R}:f?{appPath:s,functionUniversalIdentifier:f,payload:R}:{appPath:s,functionName:w,payload:R},ne=await h.functionExecute(B);if(!ne.success){switch(ne.error.code){case h.APP_ERROR_CODES.MANIFEST_NOT_FOUND:{console.error(v.default.red("Failed to build manifest."));break}case h.FUNCTION_ERROR_CODES.FETCH_FUNCTIONS_FAILED:{console.error(v.default.red("Failed to fetch functions:"),ne.error.message);break}case h.FUNCTION_ERROR_CODES.FUNCTION_NOT_FOUND:{console.error(v.default.red(ne.error.message),`
|
|
364
|
+
`);const Be=ne.error.details?.availableFunctions??[];Be.length>0?(console.log(v.default.cyan("Available functions:")),Be.forEach(Fe=>{console.log(` - ${v.default.white(Fe.name)} (${Fe.universalIdentifier})`)})):console.log(v.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case h.FUNCTION_ERROR_CODES.EXECUTION_FAILED:{console.error(v.default.red("Execution failed:"),ne.error.message);break}default:console.error(v.default.red(ne.error.message))}process.exit(1)}const Z=ne.data;console.log(v.default.cyan("─".repeat(60))),console.log(v.default.cyan("Execution Result")),console.log(v.default.cyan("─".repeat(60)));const ht=Z.status==="SUCCESS"?v.default.green:v.default.red;console.log(`${v.default.bold("Status:")} ${ht(Z.status)}`),console.log(`${v.default.bold("Duration:")} ${Z.duration}ms
|
|
365
|
+
`),h.o(Z.data)&&(console.log(v.default.bold("Data:")),console.log(v.default.white(JSON.stringify(Z.data,null,2)))),Z.error&&(console.log(v.default.bold.red("Error:")),console.log(v.default.red(` Type: ${Z.error.errorType}`)),console.log(v.default.red(` Message: ${Z.error.errorMessage}
|
|
366
|
+
`)),Z.error.stackTrace&&(console.log(v.default.gray("Stack trace:")),console.log(v.default.gray(Z.error.stackTrace)))),Z.logs&&(console.log(v.default.bold("Logs:")),console.log(v.default.gray(Z.logs))),console.log(v.default.cyan("─".repeat(60))),Z.status!=="SUCCESS"&&process.exit(1)}}class cl{constructor(){this.apiService=new h.ApiService}async execute({appPath:s=Y,functionUniversalIdentifier:r,functionName:c}){try{const f=await h.readManifestFromFile(s);f||process.exit(1),this.logWatchInfo({appName:f.application.displayName,functionUniversalIdentifier:r,functionName:c}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:f.application.universalIdentifier,functionUniversalIdentifier:r,functionName:c})}catch(f){console.error(v.default.red("Watch logs failed:"),f instanceof Error?f.message:f),process.exit(1)}}logWatchInfo({appName:s,functionUniversalIdentifier:r,functionName:c}){const f=s??"Twenty Application",w=r||c?`function "${r||c}"`:"functions",x=h.ConfigService.getActiveRemote();console.log(v.default.blue(`🚀 Watching ${f} ${w} logs on ${x}:
|
|
367
|
+
`))}}const Xm=l=>`${v.default.cyan(l.file)}:${v.default.yellow(String(l.line))}:${v.default.yellow(String(l.column+1))} - ${v.default.red("error")} ${l.text}`;class fl{async execute(s){const r=s.appPath??Y;console.log(v.default.blue("Running type check...")),console.log(v.default.gray(`App path: ${r}
|
|
368
|
+
`));const c=await h.runTypecheck(r);c.length===0&&(console.log(v.default.green("✓ No type errors found")),process.exit(0));for(const f of c)console.log(Xm(f));console.log(`
|
|
369
|
+
`,v.default.red(`✗ Found ${c.length} type error${c.length===1?"":"s"}`)),process.exit(1)}}const tt=(l,s)=>console.warn(v.default.yellow(`⚠ \`twenty ${l}\` is deprecated. Use \`twenty ${s}\` instead.`)),Qm=l=>{const s=new ll,r=new fl,c=new cl,f=new ul,w=new ol,x=new il,R=new sl,L=new al;l.command("build [appPath]",{hidden:!0}).option("--tarball","Also pack into a .tgz tarball").action(async(T,B)=>{tt("build","dev:build"),await s.execute({appPath:pe(T),tarball:B.tarball})}),l.command("typecheck [appPath]",{hidden:!0}).action(async T=>{tt("typecheck","dev:typecheck"),await r.execute({appPath:pe(T)})}),l.command("logs [appPath]",{hidden:!0}).option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").action(async(T,B)=>{tt("logs","dev:function:logs"),await c.execute({...B,appPath:pe(T)})}),l.command("exec [appPath]",{hidden:!0}).option("--postInstall","Execute post-install logic function if defined").option("--preInstall","Execute pre-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").action(async(T,B)=>{tt("exec","dev:function:exec"),!B?.postInstall&&!B?.preInstall&&!B?.functionUniversalIdentifier&&!B?.functionName&&(console.error(v.default.red("Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await f.execute({...B,payload:B?.payload??"{}",appPath:pe(T)})}),l.command("add [entityType]",{hidden:!0}).option("--path <path>","Path in which the entity should be created.").action(async(T,B)=>{tt("add","dev:add"),await w.execute(T,B?.path)}),l.command("publish [appPath]",{hidden:!0}).option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(T,B)=>{tt("publish","app:publish"),await x.execute({appPath:pe(T),tag:B.tag})}),l.command("deploy [appPath]",{hidden:!0}).option("-r, --remote <name>","Deploy to a specific remote").action(async(T,B)=>{tt("deploy","app:publish --private"),await x.execute({appPath:pe(T),private:!0,remote:B.remote})}),l.command("install [appPath]",{hidden:!0}).option("-r, --remote <name>","Install on a specific remote").action(async(T,B)=>{tt("install","app:install"),await R.execute({appPath:pe(T),remote:B.remote})}),l.command("uninstall [appPath]",{hidden:!0}).option("-y, --yes","Skip confirmation prompt").action(async(T,B)=>{tt("uninstall","app:uninstall");try{const ne=await L.execute({appPath:pe(T),askForConfirmation:!B?.yes});process.exit(ne.success?0:1)}catch{process.exit(1)}}),l.command("catalog-sync",{hidden:!0}).option("-r, --remote <name>","Sync on a specific remote").action(async T=>{tt("catalog-sync","dev:catalog-sync");const{CatalogSyncCommand:B}=await Promise.resolve().then(()=>require("./catalog-sync-GJcaViDU.js"));await new B().execute({remote:T.remote})})};class ev{constructor({state:s,notify:r}){this.state=s,this.notify=r}async execute(s){const r=this.state.steps.buildManifest;r.status="in_progress",this.state.updatePipeline({status:"building"});const c=[{message:"Building manifest",status:"info"}],f=await h.buildAndValidateManifest(s.appPath);if(!f.success){for(const x of f.errors)c.push({message:x,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(c),null}if(f.warnings.length>0)for(const x of f.warnings)c.push({message:`⚠ ${x}`,status:"warning"});c.push({message:"Successfully built manifest",status:"success"});const w={manifest:f.manifest,filePaths:f.filePaths};return r.output={result:w},r.status="done",this.state.updatePipeline({appName:f.manifest.application.displayName}),this.state.updateEntitiesFromManifest(f.filePaths),this.state.applyStepEvents(c),w}}class tv{constructor({apiService:s,state:r,notify:c}){this.hasRetried=!1,this.apiService=s,this.state=r,this.notify=c}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();if(!r.serverUp){const f=await h.detectLocalServer();return f&&!this.hasRetried?(this.hasRetried=!0,await new h.ConfigService().setConfig({apiUrl:f}),this.execute()):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:`Cannot reach Twenty server.
|
|
357
370
|
|
|
358
371
|
Start a local server:
|
|
359
372
|
yarn twenty docker:start
|
|
@@ -361,9 +374,16 @@ export default defineViewField({
|
|
|
361
374
|
Check server status:
|
|
362
375
|
yarn twenty docker:status
|
|
363
376
|
|
|
364
|
-
Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!r.authValid)return s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed. Run `yarn twenty remote:add --local` to authenticate.",status:"error"}]),this.state.updatePipeline({status:"error"})),!1;const c=s.output.isReady;if(s.output={isReady:!0,errorLogged:!1},s.status="done",!
|
|
365
|
-
`);this.buffer=r.pop()??"";for(const c of r)this.processLine(c)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const c=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||c)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=m.parseTscOutputLine(s);r&&this.pendingErrors.push(r)}}const nv=new Set(["node_modules","dist",".twenty"]);class rv{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected,this.verbose=s.verbose??!1}async start(){const s=this.appPath;this.watcher=Qo.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:r=>{const c=q.relative(s,r);if(c==="")return!1;const f=c.split(Yi.default.sep)[0];return nv.has(f)||f.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,c)=>{if(r==="addDir"||r==="unlinkDir")return;const f=q.relative(this.appPath,c),S=f.startsWith(m._),E=["package.json","yarn.lock"].includes(f);!(f.endsWith(".ts")||f.endsWith(".tsx"))&&!S&&!E||this.handleChangeDetected(f,r)})}async close(){await this.watcher?.close()}}class iv{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt,this.shouldSkipTypecheck=s.shouldSkipTypecheck,this.verbose=s.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new rv({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:c}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,c);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(c)&&await this.frontComponentsWatcher.restart(c)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info"}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.verbose&&this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder,usesSdkClient:s.usesSdkClient}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=m.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=m.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Do({appPath:this.state.appPath,fileFolder:m.v.PublicAsset,watchPaths:[m._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Do({appPath:this.state.appPath,fileFolder:m.v.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new tv({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}class sv{constructor({apiService:s,state:r,notify:c,verbose:f}){this.apiService=s,this.state=r,this.notify=c,this.verbose=f??!1}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const c=[],f=m.manifestUpdateChecksums({manifest:s.manifest,builtFileInfos:s.builtFileInfos});c.push({message:"Manifest checksums set",status:"info"}),await m.writeManifestToOutput(s.appPath,f),c.push({message:"Manifest saved to output directory",status:"info"}),c.push({message:"Syncing manifest",status:"info"});const S=await this.apiService.syncApplication(f);if(S.success){c.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(c);return}const E=this.verbose?null:m.formatManifestValidationErrors(S.error);E?(c.push(...E),c.push({message:"Add --verbose to see full error log",status:"info"})):c.push({message:`Sync failed with error: ${m.serializeError(S.error)}`,status:"error"});const C=E?E[0].message:"Sync failed";r.output={syncStatus:"error",error:C},r.status="error",this.state.updatePipeline({status:"error",error:C}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(c)}}class av{constructor({state:s,notify:r,verbose:c}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=s,this.notify=r,this.verbose=c??!1}get isInitialized(){return m.o(this.state.steps.uploadFiles.output.fileUploader)}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new m.FileUploader({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,c){const f=this.state.steps.uploadFiles;if(!f.output.fileUploader)return;f.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading"),this.notify();const S=f.output.fileUploader.uploadFile({builtPath:s,fileFolder:c}).then(E=>{E.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${s}: ${E.error}`,status:"error"}))}).catch(E=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${s}: ${E}`,status:"error"})}).finally(()=>{f.output.activeUploads.delete(S),f.output.activeUploads.size===0&&(this.logUploadSummary(),f.status="done",this.notify())});f.output.activeUploads.add(S)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}logUploadSummary(){if(this.totalQueued===0){this.resetCounters();return}this.failedCount>0&&this.state.addEvent({message:`Uploaded ${this.uploadedCount}/${this.totalQueued} files (${this.failedCount} failed)`,status:"error"}),this.state.addEvent({message:`Successfully uploaded ${this.uploadedCount} file${this.uploadedCount!==1?"s":""}`,status:"success"}),this.resetCounters()}resetCounters(){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:c}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,c,r)}}class ov{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??2e3,this.state=s.state,this.verbose=s.verbose??!1,this.apiService=new m.ApiService({disableInterceptors:!0});const r=this.apiService,c=new m.ConfigService;this.clientService=new m.ClientService;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Xm({...f,apiService:r}),this.buildManifestStep=new Zm(f),this.registerAppStep=new ev({...f,apiService:r,configService:c}),this.uploadFilesStep=new av({...f,verbose:this.verbose}),this.generateApiClientStep=new Qm({...f,clientService:this.clientService,configService:c}),this.syncApplicationStep=new sv({...f,apiService:r,verbose:this.verbose}),this.startWatchersStep=new iv({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const s=Yi.default.join(this.state.appPath,m.u);await m.ensureDir(s),await m.emptyDir(s),this.state.addEvent({message:`Using remote "${m.ConfigService.getActiveRemote()}"`,status:"info"}),this.verbose||this.state.addEvent({message:"Add --verbose to see fully detailed logs",status:"info"}),this.state.notify(),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${m.serializeError(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;this.state.steps.ensureValidTokens.status="done";const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const c=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&c&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(s){await this.registerAppStep.execute({manifest:s});const r=await this.apiService.createDevelopmentApplication({universalIdentifier:s.application.universalIdentifier,name:s.application.displayName});return!r.success||!r.data?(this.state.applyStepEvents([{message:"Failed to install development application",status:"error"},{message:JSON.stringify(r,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:r.data.id,universalIdentifier:r.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application installed",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0)}}const uv={objects:m.o$1.Object,fields:m.o$1.Field,logicFunctions:m.o$1.LogicFunction,frontComponents:m.o$1.FrontComponent,roles:m.o$1.Role,skills:m.o$1.Skill,connectionProviders:m.o$1.ConnectionProvider,views:m.o$1.View,viewFields:m.o$1.ViewField,navigationMenuItems:m.o$1.NavigationMenuItem,pageLayouts:m.o$1.PageLayout,pageLayoutTabs:m.o$1.PageLayoutTab,commandMenuItems:m.o$1.CommandMenuItem},lv=200,cv={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class fv{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.versionInfo=null,this.entities=new Map,this.events=[]}setVersionInfo(s){this.versionInfo=s,this.notify()}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(c=>(this.eventIdCounter+=1,{...c,id:this.eventIdCounter,timestamp:new Date,message:c.message.slice(0,5e3)}));this.events=[...this.events.slice(-(lv-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const c=new Map(this.entities),f=c.get(s);f?.status&&!cv[f.status].includes(r)||(c.set(s,f?{...f,status:r}:{name:s,path:s,status:r}),this.entities=c)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[c,f]of r)r.set(c,{...f,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[f,S]of Object.entries(s)){const E=uv[f];if(E)for(const C of S)r.set(C,E)}const c=new Map(this.entities);for(const[f,S]of c)c.set(f,{...S,type:r.get(f)});for(const[f,S]of r)c.has(f)||c.set(f,{name:f,path:f,type:S,status:"pending"});this.entities=c}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),c=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,c}}const ke={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},dv=l=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[l],pv=l=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[l],hv=l=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[l],gv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},ji=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Ji=["↑","⇡","↟","⤒"],lu={[m.o$1.Object]:"Objects",[m.o$1.Field]:"Fields",[m.o$1.LogicFunction]:"Logic functions",[m.o$1.FrontComponent]:"Front components",[m.o$1.CommandMenuItem]:"Command menu items",[m.o$1.Role]:"Roles",[m.o$1.Skill]:"Skills",[m.o$1.View]:"Views",[m.o$1.ViewField]:"View fields",[m.o$1.NavigationMenuItem]:"Navigation menu items",[m.o$1.PageLayout]:"Page layouts",[m.o$1.PageLayoutTab]:"Page layout tabs",[m.o$1.Agent]:"Agents",[m.o$1.ConnectionProvider]:"Connection providers"},cu=Object.keys(lu),mv={info:"gray",success:"green",error:"red",warning:"yellow"},vv=l=>l.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),yv=(l,s=40)=>{if(l.length<=s)return l;const r=l.split("/");return r.length<=2?l:`.../${r.slice(-2).join("/")}`},_v=l=>{const s=new Map;for(const r of cu)s.set(r,[]);for(const r of l.values()){if(!r.type)continue;const c=s.get(r.type)??[];c.push(r),s.set(r.type,c)}return s},wv=l=>{const s=l.steps.resolveApplication.output.applicationId;return!m.o(l.frontendUrl)||!m.o(s)?null:`${l.frontendUrl}/settings/applications/${s}`},Sv=l=>l.some(s=>s==="error")?"error":l.some(s=>s==="in_progress")?"in_progress":l.every(s=>s==="done")?"done":"idle",Iv=l=>{const s=[...l.entities.values()],r=s.some(E=>E.status==="error"),c=s.some(E=>E.status==="building"),f=s.length>0&&s.every(E=>E.status==="uploading"||E.status==="success"),S=r?"error":c?"in_progress":f?"done":"idle";return[{label:"Application Initialization",status:Sv([l.steps.checkServer.status,l.steps.ensureValidTokens.status,l.steps.resolveApplication.status])},{label:"Resources Build",status:S},{label:"Resources Upload",status:l.steps.uploadFiles.status},{label:"Manifest Build",status:l.steps.buildManifest.status},{label:"Application Synchronization",status:l.steps.syncApplication.status},{label:"Api Client Generation",status:l.steps.generateApiClient.status}]},fu=120,xv=Math.round(200/fu),Mo=()=>{const l=Math.floor(Date.now()/fu);return{spinnerFrame:ji[l%ji.length],uploadFrame:Ji[Math.floor(l/xv)%Ji.length]}},Zi=l=>{const s=ke[l];return s.icon==="spinner"?Mo().spinnerFrame:s.icon==="upload"?Mo().uploadFrame:s.icon},du=eu.default.createContext(null),Ev=du.Provider,it=()=>{const l=eu.default.useContext(du);if(!l)throw new Error("useInk must be used within InkProvider");return l},Av=({uiStatus:l})=>{const{Text:s}=it(),r=Zi(l),c=ke[l];return T.jsxs(s,{color:c.color,children:[r," "]})},bv=({entity:l})=>{const{Box:s,Text:r}=it();return T.jsxs(s,{children:[T.jsx(Av,{uiStatus:pv(l.status)}),T.jsx(r,{children:l.name}),l.path!==l.name&&T.jsxs(r,{dimColor:!0,children:[" (",yv(l.path),")"]})]})},Cv=({type:l,entities:s})=>{const{Box:r,Text:c}=it();return s.length===0?null:T.jsxs(r,{flexDirection:"column",marginTop:1,children:[T.jsx(c,{bold:!0,dimColor:!0,children:lu[l]}),s.map(f=>T.jsx(bv,{entity:f},f.path))]})},Tv=()=>{const{Box:l,Text:s}=it();return T.jsx(l,{marginTop:1,children:T.jsxs(s,{dimColor:!0,children:[T.jsx(s,{color:ke.idle.color,children:ke.idle.icon})," ","pending"," ",T.jsx(s,{color:ke.in_progress.color,children:ji[0]})," ","building"," ",T.jsx(s,{color:ke.uploading.color,children:Ji[0]})," ","uploading"," ",T.jsx(s,{color:ke.done.color,children:ke.done.icon})," ","success"," ",T.jsx(s,{color:ke.error.color,children:ke.error.icon})," ","error"]})})},Rv=7,Pv=({versionInfo:l})=>{const{Box:s,Text:r}=it();if(l===null)return null;const{cliVersion:c,localServerVersion:f,latestServerVersion:S,isMinorOrMajorBehind:E,daysBehind:C}=l,P=E&&C!==null&&C>Rv,O=f!==null&&S!==null&&f===S;return T.jsxs(s,{children:[T.jsx(r,{dimColor:!0,children:"Versions: "}),T.jsx(r,{dimColor:!0,children:"CLI "}),T.jsxs(r,{children:["v",c]}),f!==null&&T.jsxs(T.Fragment,{children:[T.jsx(r,{dimColor:!0,children:" • Server "}),T.jsxs(r,{color:P?"yellow":void 0,children:["v",f]}),O&&T.jsx(r,{color:"green",children:" ✓ latest"}),P&&S!==null&&T.jsxs(T.Fragment,{children:[T.jsxs(r,{color:"yellow",children:[" → v",S]}),C!==null&&T.jsxs(r,{dimColor:!0,children:[" (",C,"d behind)"]})]})]})]})},Fv=({state:l})=>{const{Text:s}=it(),r=hv(l.pipeline.status),c=Zi(r),f=ke[r],S=gv[l.pipeline.status];return T.jsxs(s,{color:f.color,children:[c," ",S]})},$v=({label:l,status:s})=>{const{Box:r,Text:c}=it(),f=dv(s),S=Zi(f),E=ke[f];return T.jsxs(r,{children:[T.jsxs(c,{dimColor:!0,children:[l,": "]}),T.jsxs(c,{color:E.color,children:[S," ",s.replace("_"," ")]})]})},Lv=({state:l})=>{const{Box:s,Text:r}=it(),c=_v(l.entities),f=wv(l);return T.jsxs(s,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[T.jsx(r,{bold:!0,color:"cyan",children:"Application"}),T.jsxs(s,{marginLeft:2,flexDirection:"column",children:[T.jsxs(s,{children:[T.jsx(r,{dimColor:!0,children:"Name: "}),T.jsx(r,{bold:!0,children:l.pipeline.appName??"Loading..."})]}),T.jsxs(s,{children:[T.jsx(r,{dimColor:!0,children:"Overall Status: "}),T.jsx(Fv,{state:l})]}),f&&T.jsxs(s,{children:[T.jsx(r,{dimColor:!0,children:"Open:"}),T.jsxs(r,{bold:!0,color:"cyan",children:[" ",f]})]}),T.jsx(Pv,{versionInfo:l.versionInfo})]}),T.jsx(s,{marginLeft:2,flexDirection:"column",marginTop:1,children:Iv(l).map(S=>T.jsx($v,{label:S.label,status:S.status},S.label))}),T.jsx(s,{marginLeft:2,flexDirection:"column",children:cu.map(S=>{const E=c.get(S)??[];return T.jsx(Cv,{type:S,entities:E},S)})})]})},Nv=({event:l})=>{const{Box:s,Text:r}=it(),c=mv[l.status],f=vv(l.timestamp);return T.jsxs(s,{children:[T.jsxs(r,{dimColor:!0,children:[f," "]}),T.jsx(r,{color:c,children:l.message})]})},Ov=new Set(["building","syncing"]),Wo=120,Uv=80,Dv=({uiStateManager:l})=>{const{Box:s,Static:r}=it(),[,c]=bt.useReducer(P=>P+1,0),f=bt.useRef(null),S=bt.useRef(0),E=bt.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,S.current=Date.now(),c()},Uv)},[]);bt.useEffect(()=>l.subscribe(()=>{E()}),[l,E]),bt.useEffect(()=>{const P=setInterval(()=>{const O=l.getSnapshot();Ov.has(O.pipeline.status)&&(Date.now()-S.current<Wo||c())},Wo);return()=>clearInterval(P)},[l]),bt.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const C=l.getSnapshot();return T.jsxs(T.Fragment,{children:[T.jsx(r,{items:C.events,children:P=>T.jsx(Nv,{event:P},P.id)}),T.jsxs(s,{marginTop:1,flexDirection:"column",children:[T.jsx(Lv,{state:C}),T.jsx(Tv,{})]})]})},Mv=async l=>{const s=await import("ink"),{render:r,Box:c,Text:f,Static:S}=s,{unmount:E}=r(T.jsx(Ev,{value:{Box:c,Text:f,Static:S},children:T.jsx(Dv,{uiStateManager:l})}),{incrementalRendering:!0});return{unmount:E}};class Wv{constructor(s){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const s of this.listeners)s(this.orchestratorState)}))}}class Bv{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(s){const r=s.appPath??Z;await tn(r),s.headless&&await m.checkServerVersionCompatibility();const c=new fv({appPath:r});if(!s.headless){const f=new Wv(c);c.onChange=()=>f.notify();const{unmount:S}=await Mv(f);this.unmountUI=S,m.getVersionInfo().then(E=>c.setVersionInfo(E))}this.orchestrator=new ov({state:c,verbose:s.verbose,debounceMs:s.debounceMs}),await this.orchestrator.start(),s.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>{this.close().then(()=>process.exit(0))};process.on("SIGINT",s),process.on("SIGTERM",s)}}class kv{async execute(s){const r=s.appPath??Z;await tn(r);const c=m.ConfigService.getActiveRemote();console.log(y.default.blue(`Syncing application on ${c}...`)),console.log(y.default.gray(`App path: ${r}
|
|
366
|
-
`));const f=await
|
|
367
|
-
✓
|
|
368
|
-
|
|
369
|
-
|
|
377
|
+
Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!r.authValid)return s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed. Run `yarn twenty remote:add --local` to authenticate.",status:"error"}]),this.state.updatePipeline({status:"error"})),!1;const c=s.output.isReady;if(s.output={isReady:!0,errorLogged:!1},s.status="done",!h.o(this.state.frontendUrl)){const f=await this.apiService.getWorkspaceFrontendUrl();h.o(f)&&(this.state.frontendUrl=f)}return c||this.notify(),!0}}class nv{constructor({clientService:s,configService:r,state:c,notify:f}){this.clientService=s,this.configService=r,this.state=c,this.notify=f}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const c=await h.ensureAppAccessTokenIsValidOrRefresh(this.configService,s.credentials);await this.clientService.generateCoreClient({appPath:s.appPath,appAccessToken:c}),r.status="done"}catch(c){this.state.applyStepEvents([{message:`Failed to generate API client: ${c instanceof Error?c.message:String(c)}`,status:"error"}]),r.status="error"}this.notify()}}class rv{constructor({apiService:s,configService:r,state:c,notify:f}){this.apiService=s,this.configService=r,this.state=c,this.notify=f}async execute(s){try{const r=await h.ensureAppRegistration(this.apiService,this.configService,{name:s.manifest.application.displayName,universalIdentifier:s.manifest.application.universalIdentifier});this.registrationCredentials={clientId:r.clientId,clientSecret:r.clientSecret},this.state.applyStepEvents([{message:r.isNewRegistration?`App registration created: ${s.manifest.application.displayName}`:"Existing app registration found",status:r.isNewRegistration?"success":"info"},...r.isNewRegistration?[{message:"Credentials saved to config.",status:"info"}]:[]])}catch(r){throw this.state.applyStepEvents([{message:`Failed to register app: ${r instanceof Error?r.message:String(r)}`,status:"error"}]),r}this.notify()}}class Bo{constructor(s){this.watcher=null,this.appPath=s.appPath,this.fileFolder=s.fileFolder,this.watchPaths=s.watchPaths,this.handleFileBuilt=s.handleFileBuilt}async start(){const s=(await Promise.all(this.watchPaths.map(async r=>{const c=j.join(this.appPath,r);return await h.pathExists(c)?c:null}))).filter(r=>r!==null);s.length!==0&&(this.watcher=nl.default.watch(s,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,c)=>{r==="addDir"||r==="unlinkDir"||((r==="add"||r==="change")&&this.copyAndNotify(c),r==="unlink"&&this.handleUnlink(c))}))}async close(){await this.watcher?.close()}async copyAndNotify(s){const r=j.relative(this.appPath,s),c=j.join(h.u,r),f=j.join(this.appPath,c);await h.ensureDir(j.dirname(f)),await h.copy(s,f);const w=await nt.readFile(f),x=Em.default.createHash("md5").update(w).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:c,sourcePath:r,checksum:x})}async handleUnlink(s){const r=j.relative(this.appPath,s),c=j.join(h.u,r),f=j.join(this.appPath,c);await h.remove(f)}}class iv{constructor(s){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=s.appPath,this.onErrors=s.onErrors}async start(){const s=Oo.default.join(this.appPath,"node_modules",".bin","tsc");if(!await h.pathExists(s))return;const r=Oo.default.join(this.appPath,"tsconfig.json");this.process=Pn.spawn(s,["--watch","--noEmit","--pretty","false","-p",r],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",c=>{this.handleOutput(c.toString())}),this.process.stderr?.on("data",c=>{this.handleOutput(c.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(s){this.buffer+=s;const r=this.buffer.split(`
|
|
378
|
+
`);this.buffer=r.pop()??"";for(const c of r)this.processLine(c)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const c=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||c)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=h.parseTscOutputLine(s);r&&this.pendingErrors.push(r)}}const sv=new Set(["node_modules","dist",".twenty"]);class av{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected,this.verbose=s.verbose??!1}async start(){const s=this.appPath;this.watcher=nl.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:r=>{const c=j.relative(s,r);if(c==="")return!1;const f=c.split(Zi.default.sep)[0];return sv.has(f)||f.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,c)=>{if(r==="addDir"||r==="unlinkDir")return;const f=j.relative(this.appPath,c),w=f.startsWith(h._),x=["package.json","yarn.lock"].includes(f);!(f.endsWith(".ts")||f.endsWith(".tsx"))&&!w&&!x||this.handleChangeDetected(f,r)})}async close(){await this.watcher?.close()}}class ov{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt,this.shouldSkipTypecheck=s.shouldSkipTypecheck,this.verbose=s.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new av({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:c}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,c);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(c)&&await this.frontComponentsWatcher.restart(c)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info",spacingBefore:!0}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.verbose&&this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder,usesSdkClient:s.usesSdkClient}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=h.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=h.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Bo({appPath:this.state.appPath,fileFolder:h.v.PublicAsset,watchPaths:[h._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Bo({appPath:this.state.appPath,fileFolder:h.v.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new iv({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}class lv{constructor({apiService:s,state:r,notify:c,verbose:f}){this.apiService=s,this.state=r,this.notify=c,this.verbose=f??!1}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const c=[],f=h.manifestUpdateChecksums({manifest:s.manifest,builtFileInfos:s.builtFileInfos});c.push({message:"Manifest checksums set",status:"info"}),await h.writeManifestToOutput(s.appPath,f),c.push({message:"Manifest saved to output directory",status:"info"}),c.push({message:"Syncing manifest",status:"info"});const w=await this.apiService.syncApplication(f);if(w.success){const T=w.data;c.push(...h.formatSyncActionsSummary(T.actions)),c.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(c);return}const x=this.verbose?null:h.formatManifestValidationErrors(w.error);x?(c.push(...x),c.push({message:"Add --verbose to see full error log",status:"info"})):c.push({message:`Sync failed with error: ${w.message??"Sync failed"}`,status:"error"});const R=h.getSyncErrorRecoveryHint(w.message);R&&c.push({message:R,status:"info"});const L=x?x[0].message:"Sync failed";r.output={syncStatus:"error",error:L},r.status="error",this.state.updatePipeline({status:"error",error:L}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(c)}}class uv{constructor({state:s,notify:r,verbose:c}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=s,this.notify=r,this.verbose=c??!1}get isInitialized(){return h.o(this.state.steps.uploadFiles.output.fileUploader)}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new h.FileUploader({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,c){const f=this.state.steps.uploadFiles;if(!f.output.fileUploader)return;f.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading"),this.notify();const w=f.output.fileUploader.uploadFile({builtPath:s,fileFolder:c}).then(x=>{x.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${s}: ${x.error}`,status:"error"}))}).catch(x=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${s}: ${x}`,status:"error"})}).finally(()=>{f.output.activeUploads.delete(w),f.output.activeUploads.size===0&&(this.logUploadSummary(),f.status="done",this.notify())});f.output.activeUploads.add(w)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}logUploadSummary(){if(this.totalQueued===0){this.resetCounters();return}this.failedCount>0&&this.state.addEvent({message:`Uploaded ${this.uploadedCount}/${this.totalQueued} files (${this.failedCount} failed)`,status:"error"}),this.state.addEvent({message:`Successfully uploaded ${this.uploadedCount} file${this.uploadedCount!==1?"s":""}`,status:"success"}),this.resetCounters()}resetCounters(){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:c}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,c,r)}}class cv{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??1e3,this.state=s.state,this.verbose=s.verbose??!1,this.apiService=new h.ApiService({disableInterceptors:!0});const r=this.apiService,c=new h.ConfigService;this.clientService=new h.ClientService;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new tv({...f,apiService:r}),this.buildManifestStep=new ev(f),this.registerAppStep=new rv({...f,apiService:r,configService:c}),this.uploadFilesStep=new uv({...f,verbose:this.verbose}),this.generateApiClientStep=new nv({...f,clientService:this.clientService,configService:c}),this.syncApplicationStep=new lv({...f,apiService:r,verbose:this.verbose}),this.startWatchersStep=new ov({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const s=Zi.default.join(this.state.appPath,h.u);await h.ensureDir(s),await h.emptyDir(s),this.state.addEvent({message:`Using remote "${h.ConfigService.getActiveRemote()}"`,status:"info"}),this.verbose||this.state.addEvent({message:"Add --verbose to see fully detailed logs",status:"info"}),this.state.notify(),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${h.serializeError(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;this.state.steps.ensureValidTokens.status="done";const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const c=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&c&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(s){await this.registerAppStep.execute({manifest:s});const r=await this.apiService.createDevelopmentApplication({universalIdentifier:s.application.universalIdentifier,name:s.application.displayName});return!r.success||!r.data?(this.state.applyStepEvents([{message:"Failed to install development application",status:"error"},{message:JSON.stringify(r,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:r.data.id,universalIdentifier:r.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application installed",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0)}}const fv={objects:h.o$1.Object,fields:h.o$1.Field,logicFunctions:h.o$1.LogicFunction,frontComponents:h.o$1.FrontComponent,roles:h.o$1.Role,skills:h.o$1.Skill,connectionProviders:h.o$1.ConnectionProvider,views:h.o$1.View,viewFields:h.o$1.ViewField,navigationMenuItems:h.o$1.NavigationMenuItem,pageLayouts:h.o$1.PageLayout,pageLayoutTabs:h.o$1.PageLayoutTab,commandMenuItems:h.o$1.CommandMenuItem},dv=200,pv={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class hv{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.versionInfo=null,this.entities=new Map,this.events=[]}setVersionInfo(s){this.versionInfo=s,this.notify()}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(c=>(this.eventIdCounter+=1,{...c,id:this.eventIdCounter,timestamp:new Date,message:c.message.slice(0,5e3)}));this.events=[...this.events.slice(-(dv-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const c=new Map(this.entities),f=c.get(s);f?.status&&!pv[f.status].includes(r)||(c.set(s,f?{...f,status:r}:{name:s,path:s,status:r}),this.entities=c)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[c,f]of r)r.set(c,{...f,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[f,w]of Object.entries(s)){const x=fv[f];if(x)for(const R of w)r.set(R,x)}const c=new Map(this.entities);for(const[f,w]of c)c.set(f,{...w,type:r.get(f)});for(const[f,w]of r)c.has(f)||c.set(f,{name:f,path:f,type:w,status:"pending"});this.entities=c}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),c=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,c}}const We={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},gv=l=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[l],dl=l=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[l],mv=l=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[l],vv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},Yi=["◐","◓","◑","◒"],Ji=["↑","⇡","↑","⇡"],pl={[h.o$1.Object]:"Objects",[h.o$1.Field]:"Fields",[h.o$1.LogicFunction]:"Logic functions",[h.o$1.FrontComponent]:"Front components",[h.o$1.CommandMenuItem]:"Command menu items",[h.o$1.Role]:"Roles",[h.o$1.Skill]:"Skills",[h.o$1.View]:"Views",[h.o$1.ViewField]:"View fields",[h.o$1.NavigationMenuItem]:"Navigation menu items",[h.o$1.PageLayout]:"Page layouts",[h.o$1.PageLayoutTab]:"Page layout tabs",[h.o$1.Agent]:"Agents",[h.o$1.ConnectionProvider]:"Connection providers"},hl=Object.keys(pl),yv={info:"gray",success:"green",error:"red",warning:"yellow"},_v=l=>l.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),wv=(l,s=40)=>{if(l.length<=s)return l;const r=l.split("/");return r.length<=2?l:`.../${r.slice(-2).join("/")}`},Sv=l=>{const s=new Map;for(const r of hl)s.set(r,[]);for(const r of l.values()){if(!r.type)continue;const c=s.get(r.type)??[];c.push(r),s.set(r.type,c)}return s},Iv=[{status:"success",label:"synced"},{status:"building",label:"building"},{status:"uploading",label:"uploading"},{status:"pending",label:"pending"},{status:"error",label:"error"}],xv=l=>{const s={pending:0,building:0,uploading:0,success:0,error:0};for(const r of l)s[r.status]+=1;return Iv.filter(({status:r})=>s[r]>0).map(({status:r,label:c})=>({status:r,count:s[r],label:c}))},Av=l=>{const s=l.steps.resolveApplication.output.applicationId;return!h.o(l.frontendUrl)||!h.o(s)?null:`${l.frontendUrl}/settings/applications/${s}`},Ev=l=>l.some(s=>s==="error")?"error":l.some(s=>s==="in_progress")?"in_progress":l.every(s=>s==="done")?"done":"idle",bv=l=>{const s=[...l.entities.values()],r=s.some(x=>x.status==="error"),c=s.some(x=>x.status==="building"),f=s.length>0&&s.every(x=>x.status==="uploading"||x.status==="success"),w=r?"error":c?"in_progress":f?"done":"idle";return[{label:"Application Initialization",status:Ev([l.steps.checkServer.status,l.steps.ensureValidTokens.status,l.steps.resolveApplication.status])},{label:"Resources Build",status:w},{label:"Resources Upload",status:l.steps.uploadFiles.status},{label:"Manifest Build",status:l.steps.buildManifest.status},{label:"Application Synchronization",status:l.steps.syncApplication.status},{label:"Api Client Generation",status:l.steps.generateApiClient.status}]},gl=120,Cv=Math.round(200/gl),ko=()=>{const l=Math.floor(Date.now()/gl);return{spinnerFrame:Yi[l%Yi.length],uploadFrame:Ji[Math.floor(l/Cv)%Ji.length]}},Xi=l=>{const s=We[l];return s.icon==="spinner"?ko().spinnerFrame:s.icon==="upload"?ko().uploadFrame:s.icon},ml=rl.default.createContext(null),Tv=ml.Provider,Je=()=>{const l=rl.default.useContext(ml);if(!l)throw new Error("useInk must be used within InkProvider");return l},vl=({uiStatus:l})=>{const{Text:s}=Je(),r=Xi(l),c=We[l];return b.jsxs(s,{color:c.color,children:[r," "]})},Rv=({entity:l})=>{const{Box:s,Text:r}=Je();return b.jsxs(s,{children:[b.jsx(vl,{uiStatus:dl(l.status)}),b.jsx(r,{children:l.name}),l.path!==l.name&&b.jsxs(r,{dimColor:!0,children:[" (",wv(l.path),")"]})]})},Pv=({type:l,entities:s})=>{const{Box:r,Text:c}=Je();return s.length===0?null:b.jsxs(r,{flexDirection:"column",marginTop:1,children:[b.jsx(c,{bold:!0,dimColor:!0,children:pl[l]}),s.map(f=>b.jsx(Rv,{entity:f},f.path))]})},Fv=({entities:l})=>{const{Box:s,Text:r}=Je();if(l.length===0)return null;const c=xv(l);return b.jsxs(s,{marginTop:1,children:[b.jsxs(r,{bold:!0,dimColor:!0,children:["Entities"," "]}),c.map((f,w)=>b.jsxs(s,{children:[w>0&&b.jsx(r,{dimColor:!0,children:" · "}),b.jsx(vl,{uiStatus:dl(f.status)}),b.jsxs(r,{children:[f.count," ",f.label]})]},f.status))]})},$v=()=>{const{Box:l,Text:s}=Je();return b.jsx(l,{marginTop:1,children:b.jsxs(s,{dimColor:!0,children:[b.jsx(s,{color:We.idle.color,children:We.idle.icon})," ","pending"," ",b.jsx(s,{color:We.in_progress.color,children:Yi[0]})," ","building"," ",b.jsx(s,{color:We.uploading.color,children:Ji[0]})," ","uploading"," ",b.jsx(s,{color:We.done.color,children:We.done.icon})," ","success"," ",b.jsx(s,{color:We.error.color,children:We.error.icon})," ","error"]})})},Nv=7,Lv=({versionInfo:l})=>{const{Box:s,Text:r}=Je();if(l===null)return null;const{cliVersion:c,localServerVersion:f,latestServerVersion:w,isMinorOrMajorBehind:x,daysBehind:R}=l,L=x&&R!==null&&R>Nv,T=f!==null&&w!==null&&f===w;return b.jsxs(s,{children:[b.jsx(r,{dimColor:!0,children:"Versions: "}),b.jsx(r,{dimColor:!0,children:"CLI "}),b.jsxs(r,{children:["v",c]}),f!==null&&b.jsxs(b.Fragment,{children:[b.jsx(r,{dimColor:!0,children:" • Server "}),b.jsxs(r,{color:L?"yellow":void 0,children:["v",f]}),T&&b.jsx(r,{color:"green",children:" ✓ latest"}),L&&w!==null&&b.jsxs(b.Fragment,{children:[b.jsxs(r,{color:"yellow",children:[" → v",w]}),R!==null&&b.jsxs(r,{dimColor:!0,children:[" (",R,"d behind)"]})]})]})]})},Ov=({state:l})=>{const{Text:s}=Je(),r=mv(l.pipeline.status),c=Xi(r),f=We[r],w=vv[l.pipeline.status];return b.jsxs(s,{color:f.color,children:[c," ",w]})},Uv=({label:l,status:s})=>{const{Box:r,Text:c}=Je(),f=gv(s),w=Xi(f),x=We[f];return b.jsxs(r,{children:[b.jsxs(c,{dimColor:!0,children:[l,": "]}),b.jsxs(c,{color:x.color,children:[w," ",s.replace("_"," ")]})]})},Dv=({state:l,verbose:s=!1})=>{const{Box:r,Text:c}=Je(),f=Sv(l.entities),w=Av(l);return b.jsxs(r,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[b.jsx(c,{bold:!0,color:"cyan",children:"Application"}),b.jsxs(r,{marginLeft:2,flexDirection:"column",children:[b.jsxs(r,{children:[b.jsx(c,{dimColor:!0,children:"Name: "}),b.jsx(c,{bold:!0,children:l.pipeline.appName??"Loading..."})]}),b.jsxs(r,{children:[b.jsx(c,{dimColor:!0,children:"Overall Status: "}),b.jsx(Ov,{state:l})]}),w&&b.jsxs(r,{children:[b.jsx(c,{dimColor:!0,children:"Open:"}),b.jsxs(c,{bold:!0,color:"cyan",children:[" ",w]})]}),b.jsx(Lv,{versionInfo:l.versionInfo})]}),b.jsx(r,{marginLeft:2,flexDirection:"column",marginTop:1,children:bv(l).map(x=>b.jsx(Uv,{label:x.label,status:x.status},x.label))}),b.jsx(r,{marginLeft:2,flexDirection:"column",children:s?hl.map(x=>{const R=f.get(x)??[];return b.jsx(Pv,{type:x,entities:R},x)}):b.jsx(Fv,{entities:Array.from(l.entities.values())})})]})},Mv=({event:l})=>{const{Box:s,Text:r}=Je(),c=yv[l.status],f=_v(l.timestamp);return b.jsxs(s,{marginTop:l.spacingBefore?1:0,children:[b.jsxs(r,{dimColor:!0,children:[f," "]}),b.jsx(r,{color:c,children:l.message})]})},Wv=new Set(["building","syncing"]),Vo=120,Bv=80,kv=({uiStateManager:l,verbose:s})=>{const{Box:r,Static:c}=Je(),[,f]=bt.useReducer(T=>T+1,0),w=bt.useRef(null),x=bt.useRef(0),R=bt.useCallback(()=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{w.current=null,x.current=Date.now(),f()},Bv)},[]);bt.useEffect(()=>l.subscribe(()=>{R()}),[l,R]),bt.useEffect(()=>{const T=setInterval(()=>{const B=l.getSnapshot();Wv.has(B.pipeline.status)&&(Date.now()-x.current<Vo||f())},Vo);return()=>clearInterval(T)},[l]),bt.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]);const L=l.getSnapshot();return b.jsxs(b.Fragment,{children:[b.jsx(c,{items:L.events,children:T=>b.jsx(Mv,{event:T},T.id)}),b.jsxs(r,{marginTop:1,flexDirection:"column",children:[b.jsx(Dv,{state:L,verbose:s}),s&&b.jsx($v,{})]})]})},Vv=async(l,s=!1)=>{const r=await import("ink"),{render:c,Box:f,Text:w,Static:x}=r,{unmount:R}=c(b.jsx(Tv,{value:{Box:f,Text:w,Static:x},children:b.jsx(kv,{uiStateManager:l,verbose:s})}));return{unmount:R}};class Gv{constructor(s){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const s of this.listeners)s(this.orchestratorState)}))}}class jv{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(s){const r=s.appPath??Y;await tn(r),s.headless&&await h.checkServerVersionCompatibility();const c=new hv({appPath:r});if(!s.headless){const f=new Gv(c);c.onChange=()=>f.notify();const{unmount:w}=await Vv(f,s.verbose);this.unmountUI=w,h.getVersionInfo().then(x=>c.setVersionInfo(x))}this.orchestrator=new cv({state:c,verbose:s.verbose,debounceMs:s.debounceMs}),await this.orchestrator.start(),s.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>{this.close().then(()=>process.exit(0))};process.on("SIGINT",s),process.on("SIGTERM",s)}}class qv{async execute(s){const r=s.appPath??Y;await tn(r);const c=h.ConfigService.getActiveRemote();console.log(v.default.blue(`${s.dryRun?"Previewing application diff":"Syncing application"} on ${c}...`)),console.log(v.default.gray(`App path: ${r}
|
|
379
|
+
`));const f=await h.appDevOnce({appPath:r,verbose:s.verbose,dryRun:s.dryRun,onProgress:w=>console.log(v.default.gray(w))});if(f.success||(console.error(v.default.red(f.error.message)),process.exit(1)),s.dryRun){console.log(v.default.green(`
|
|
380
|
+
✓ Dry run complete for ${f.data.applicationDisplayName} — no changes were applied`));return}console.log(v.default.green(`
|
|
381
|
+
✓ Synced ${f.data.applicationDisplayName} (${f.data.fileCount} file${f.data.fileCount===1?"":"s"})`)),console.log(v.default.gray(`Output: ${f.data.outputDir}`))}}class Hv{async execute(s){const r=s.appPath??Y,c=j.join(r,"node_modules","twenty-client-sdk");await h.pathExists(c)||(console.error(v.default.red(`Cannot find twenty-client-sdk in ${r}.
|
|
382
|
+
|
|
383
|
+
Install it first:
|
|
384
|
+
yarn add twenty-client-sdk`)),process.exit(1));const w=await new h.ApiService({disableInterceptors:!0}).validateAuth();w.serverUp||(console.error(v.default.red(`Cannot reach Twenty server.
|
|
385
|
+
|
|
386
|
+
Check your remotes:
|
|
387
|
+
yarn twenty remote:status`)),process.exit(1)),w.authValid||(console.error(v.default.red("Authentication failed. Run `yarn twenty remote:add` to authenticate.")),process.exit(1)),console.log(v.default.blue("Generating API client..."));try{await new h.ClientService({skipAuth:!1}).generateCoreClient({appPath:r})}catch(x){console.error(v.default.red(`Failed to generate API client: ${h.serializeError(x)}`)),process.exit(1)}console.log(v.default.green("✓ API client generated")),console.log(v.default.gray(`Output: ${j.join(c,"dist","core","generated")}`))}}const zv=l=>{const s=new cl,r=new ul;l.command("dev:function:logs [appPath]").description("Stream logic function logs").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").action(async(c,f)=>{await s.execute({...f,appPath:pe(c)})}),l.command("dev:function:exec [appPath]").description("Execute a logic function").option("--postInstall","Execute post-install logic function if defined").option("--preInstall","Execute pre-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").action(async(c,f)=>{!f?.postInstall&&!f?.preInstall&&!f?.functionUniversalIdentifier&&!f?.functionName&&(console.error(v.default.red("Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await r.execute({...f,payload:f?.payload??"{}",appPath:pe(c)})})},Kv=l=>{const s=new ll,r=new jv,c=new qv,f=new fl,w=new ol,x=new Hv,R=async(L,T)=>{T.dryRun&&!T.once&&console.warn(v.default.yellow("--dry-run only applies with --once. Ignoring it; run `yarn twenty dev --once --dry-run` to preview changes."));const B={appPath:pe(L),verbose:T.verbose||T.debug,debounceMs:T.debounceMs?parseInt(T.debounceMs,10):void 0};if(T.once){await c.execute({...B,dryRun:T.dryRun});return}await r.execute(B)};l.command("dev [appPath]").description("Build and sync local changes").option("-o, --once","Build and sync once, then exit (useful for CI, scripts, and pre-commit hooks)").option("--dry-run","Preview the metadata changes without applying them (requires --once)").option("--debounceMs <ms>","Debounce in ms (default: 1 000)").option("-v, --verbose","Show detailed logs").option("-d, --debug","Show detailed logs (alias for --verbose)").action(R),l.command("dev:build [appPath]").description("Build and generate API client").option("--tarball","Also pack into a .tgz tarball").action(async(L,T)=>{await s.execute({appPath:pe(L),tarball:T.tarball})}),l.command("dev:typecheck [appPath]").description("Run TypeScript type checking").action(async L=>{await f.execute({appPath:pe(L)})}),l.command("dev:add [entityType]").description(`Scaffold a new entity (${Object.values(h.o$1).join("|")})`).option("--path <path>","Path in which the entity should be created.").action(async(L,T)=>{await w.execute(L,T?.path)}),l.command("dev:catalog-sync").description("Trigger marketplace catalog sync").option("-r, --remote <name>","Sync on a specific remote").action(async L=>{const{CatalogSyncCommand:T}=await Promise.resolve().then(()=>require("./catalog-sync-GJcaViDU.js"));await new T().execute({remote:L.remote})}),l.command("dev:generate-client [appPath]").description("Generate the typed API client from the active remote (no app definition required)").action(async L=>{await x.execute({appPath:pe(L)})}),zv(l)},Go=async l=>{const s=l.test?h.DEFAULT_TEST_PORT:h.DEFAULT_PORT,r=l.port?parseInt(l.port,10):s;(isNaN(r)||r<1||r>65535)&&(console.error(v.default.red("Invalid port number.")),process.exit(1));const c=await h.serverStart({port:r,test:l.test,onProgress:f=>console.log(v.default.gray(f))});c.success||(console.error(v.default.red(c.error.message)),process.exit(1))},jo=l=>{const s=l.test?h.TEST_CONTAINER_NAME:h.CONTAINER_NAME;if(!h.containerExists(s)){console.log(v.default.yellow("No Twenty server container found."));return}Pn.execSync(`docker stop ${s}`,{stdio:"ignore"}),console.log(v.default.green("Twenty server stopped."))},qo=l=>{const s=l.test?h.TEST_CONTAINER_NAME:h.CONTAINER_NAME;if(!h.containerExists(s)){console.log(v.default.yellow("No Twenty server container found."));return}try{Pn.spawnSync("docker",["logs","-f","--tail",l.lines,s],{stdio:"inherit"})}catch{}},Ho=async l=>{const s=l.test?h.TEST_CONTAINER_NAME:h.CONTAINER_NAME,r=l.test?h.DEFAULT_TEST_PORT:h.DEFAULT_PORT;if(!h.containerExists(s)){console.log(` Status: ${v.default.gray("not created")}`),console.log(v.default.gray(` Run 'yarn twenty docker:start${l.test?" --test":""}' to create one.`));return}const c=h.isContainerRunning(s),f=c?h.getContainerPort(s):r,w=c?await h.checkServerHealth(f):!1,x=w?v.default.green("running (healthy)"):c?v.default.yellow("running (starting...)"):v.default.gray("stopped"),R=h.getContainerEnvVar("APP_VERSION",s);console.log(` Status: ${x}`),console.log(` URL: http://localhost:${f}`),R&&console.log(` Version: ${v.default.gray(R)}`),w&&console.log(v.default.gray(" Login: tim@apple.dev / tim@apple.dev"))},zo=l=>{const s=l.test?h.TEST_CONTAINER_NAME:h.CONTAINER_NAME,r=l.test?"twenty-app-dev-test-data":"twenty-app-dev-data",c=l.test?"twenty-app-dev-test-storage":"twenty-app-dev-storage";h.containerExists(s)&&Pn.execSync(`docker rm -f ${s}`,{stdio:"ignore"});try{Pn.execSync(`docker volume rm ${r} ${c}`,{stdio:"ignore"})}catch{}console.log(v.default.green("Twenty server data reset.")),console.log(v.default.gray(`Run 'yarn twenty docker:start${l.test?" --test":""}' to start a fresh instance.`))},Ko=async(l,s)=>{const r=await h.serverUpgrade({version:l??"latest",test:s.test,onProgress:f=>console.log(v.default.gray(f))});r.success||(console.error(v.default.red(r.error.message)),process.exit(1));const{data:c}=r;if(!c.imageUpdated){console.log(v.default.green(` Already up to date (${c.image}).`));return}console.log(v.default.green(` Upgraded to: ${c.image}`)),c.containerRecreated&&console.log(v.default.gray(` Run 'yarn twenty docker:start${s.test?" --test":""}' to wait for the server to be ready.`))},Yv=l=>{l.command("docker:start").description("Start the local Twenty container").option("-p, --port <port>","HTTP port").option("--test","Start a separate test instance (port 2021)").action(Go),l.command("docker:stop").description("Stop the local Twenty container").option("--test","Stop the test instance").action(jo),l.command("docker:logs").description("Stream container logs").option("-n, --lines <lines>","Number of lines to show","50").option("--test","Show logs for the test instance").action(qo),l.command("docker:status").description("Show container status").option("--test","Show status of the test instance").action(Ho),l.command("docker:reset").description("Delete all data and start fresh").option("--test","Reset the test instance").action(zo),l.command("docker:upgrade [version]").description("Upgrade the Docker image").option("--test","Upgrade the test instance").action(Ko);const s=l.command("server",{hidden:!0}).description("Manage a Twenty server (local instance and server-side actions)"),r=(c,f)=>console.warn(v.default.yellow(`⚠ \`twenty server ${c}\` is deprecated. Use \`twenty ${f}\` instead.`));s.command("start").option("-p, --port <port>","HTTP port").option("--test","Start a separate test instance (port 2021)").action(async c=>{r("start","docker:start"),await Go(c)}),s.command("stop").option("--test","Stop the test instance").action(c=>{r("stop","docker:stop"),jo(c)}),s.command("logs").option("-n, --lines <lines>","Number of lines to show","50").option("--test","Show logs for the test instance").action(c=>{r("logs","docker:logs"),qo(c)}),s.command("status").option("--test","Show status of the test instance").action(async c=>{r("status","docker:status"),await Ho(c)}),s.command("reset").option("--test","Reset the test instance").action(c=>{r("reset","docker:reset"),zo(c)}),s.command("upgrade [version]").option("--test","Upgrade the test instance").action(async(c,f)=>{r("upgrade","docker:upgrade"),await Ko(c,f)}),s.command("catalog-sync").option("-r, --remote <name>","Sync on a specific remote").action(async c=>{r("catalog-sync","dev:catalog-sync");const{CatalogSyncCommand:f}=await Promise.resolve().then(()=>require("./catalog-sync-GJcaViDU.js"));await new f().execute({remote:c.remote})})},Jv=l=>{try{return new URL(l).hostname.replace(/\./g,"-")}catch{return"remote"}},Yo=async(l,s)=>s?((await h.authLogin({apiKey:s,apiUrl:l})).success||(console.error(v.default.red("✗ Authentication failed.")),process.exit(1)),"API key"):Zv(l),Zv=async l=>{console.log(v.default.gray("Opening browser for authentication..."));const s=await h.authLoginOAuth({apiUrl:l});if(s.success)return"OAuth";console.log(v.default.yellow(s.error.message));const r=await Ye.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:f=>f.length>0||"API key is required"}]);return(await h.authLogin({apiKey:r.apiKey,apiUrl:l})).success||(console.error(v.default.red("✗ Authentication failed.")),process.exit(1)),"API key"},Jo=async l=>{l.apiUrl&&console.warn(v.default.yellow("⚠ --api-url is deprecated. Use --url instead."));const s=l.test?h.getConfigPath(!0):void 0,r=new h.ConfigService(s?{configPath:s}:void 0),c=await r.getRemotes();if(l.as!==void 0&&c.includes(l.as)){const R=await r.getConfigForRemote(l.as);h.ConfigService.setActiveRemote(l.as);const L=await Yo(R.apiUrl,l.apiKey);console.log(v.default.green(`✓ Re-authenticated "${l.as}" via ${L}.`)),await r.setDefaultRemote(l.as),console.log(v.default.green(`✓ Default remote set to "${l.as}".`));return}let f=l.url??l.apiUrl;if(f)f=h.Da(f);else{const R=await h.detectLocalServer();l.local?(R||(console.error(v.default.red(`No local Twenty server found.
|
|
388
|
+
Start one with: yarn twenty docker:start`)),process.exit(1)),console.log(v.default.gray(`Found local server at ${R}`)),f=R):f=h.Da((await Ye.default.prompt([{type:"input",name:"serverUrl",message:"Twenty server URL:",validate:L=>{try{return new URL(L),!0}catch{return"Please enter a valid URL"}}}])).serverUrl)}const w=l.as??Jv(f);h.ConfigService.setActiveRemote(w);const x=await Yo(f,l.apiKey);console.log(v.default.green(`✓ Remote "${w}" added (${f}) via ${x}.`)),await r.setDefaultRemote(w),console.log(v.default.green(`✓ Default remote set to "${w}".`))},Zo=async()=>{const l=new h.ConfigService,s=await l.getRemotes(),r=await l.getDefaultRemote();if(s.length===0){console.log("No remotes configured."),console.log("Use 'twenty remote:add' to add one.");return}console.log("");for(const c of s){const f=await l.getConfigForRemote(c),w=f.twentyCLIAccessToken?"oauth":f.apiKey?"api-key":"none",x=c===r,R=x?"* ":" ",L=x?v.default.bold(c):c;console.log(`${R}${L} ${v.default.gray(f.apiUrl)} [${w}]`)}console.log(`
|
|
389
|
+
`,v.default.gray("Use 'twenty remote:use <name>' to change default"))},Xo=async l=>{const s=new h.ConfigService,r=l??(await Ye.default.prompt([{type:"select",name:"remote",message:"Select default remote:",choices:await s.getRemotes()}])).remote;(await s.getRemotes()).includes(r)||(console.error(v.default.red(`Remote "${r}" not found.`)),process.exit(1)),await s.setDefaultRemote(r),console.log(v.default.green(`✓ Default remote set to "${r}".`))},Qo=async()=>{const l=new h.ConfigService,s=new h.ApiService,r=h.ConfigService.getActiveRemote(),c=await l.getConfig(),f=c.twentyCLIAccessToken?"oauth":c.apiKey?"api-key":"none";if(console.log(` Remote: ${v.default.bold(r)}`),console.log(` Server: ${c.apiUrl}`),f==="none"){console.log(` Auth: ${v.default.yellow("not configured")}`);return}const{authValid:w}=await s.validateAuth(),x=w?v.default.green(`${f} (valid)`):v.default.red(`${f} (invalid)`);console.log(` Auth: ${x}`)},el=async l=>{const s=new h.ConfigService;(await s.getRemotes()).includes(l)||(console.error(v.default.red(`Remote "${l}" not found.`)),process.exit(1)),h.ConfigService.setActiveRemote(l),await s.clearConfig(),console.log(v.default.green(`✓ Remote "${l}" removed.`))},Xv=l=>{l.command("remote:add").description("Add or re-authenticate a remote").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--url <url>","Server URL").option("--api-url <apiUrl>","[deprecated: use --url]").option("--local","Connect to a local Twenty server (auto-detect)").option("--test","Write to config.test.json (for integration tests)").action(Jo),l.command("remote:list").description("List all configured remotes").action(Zo),l.command("remote:use [name]").description("Set the default remote").action(Xo),l.command("remote:status").description("Show active remote auth status").action(Qo),l.command("remote:remove <name>").description("Remove a remote").action(el);const s=l.command("remote",{hidden:!0}).description("Manage remote Twenty servers"),r=(c,f)=>console.warn(v.default.yellow(`⚠ \`twenty remote ${c}\` is deprecated. Use \`twenty ${f}\` instead.`));s.command("add").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--url <url>","Server URL").option("--api-url <apiUrl>","[deprecated: use --url]").option("--local","Connect to a local Twenty server (auto-detect)").option("--test","Write to config.test.json (for integration tests)").action(async c=>{r("add","remote:add"),await Jo(c)}),s.command("list").action(async()=>{r("list","remote:list"),await Zo()}),s.command("switch [name]").action(async c=>{r("switch","remote:use"),await Xo(c)}),s.command("status").action(async()=>{r("status","remote:status"),await Qo()}),s.command("remove <name>").action(async c=>{r("remove","remote:remove"),await el(c)})},Qv=l=>{Kv(l),Cm(l),Yv(l),Xv(l),Qm(l)};Am.inspect.defaultOptions.depth=10;const nn=new tl.Command;nn.name("twenty").description("CLI for Twenty application development").version(h.packageJson.version);nn.option("-r, --remote <name>","Use a specific remote (overrides the default set by remote:use)");nn.hook("preAction",async l=>{let r=(l.optsWithGlobals?l.optsWithGlobals():l.opts()).remote;r?console.log(v.default.gray(`Using remote: ${r}`)):r=await new h.ConfigService().getDefaultRemote(),h.ConfigService.setActiveRemote(r)});Qv(nn);nn.exitOverride();try{nn.parse()}catch(l){l instanceof tl.CommanderError&&process.exit(l.exitCode),l instanceof Error&&(console.error(v.default.red("Error:"),l.message),process.exit(1))}
|