twenty-sdk 0.8.0 → 0.9.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.
Files changed (42) hide show
  1. package/dist/cli/commands/dev-once.d.ts +7 -0
  2. package/dist/cli/commands/exec.d.ts +2 -2
  3. package/dist/cli/operations/dev-once.d.ts +13 -0
  4. package/dist/cli/operations/execute.d.ts +2 -2
  5. package/dist/cli/operations/index.d.ts +2 -0
  6. package/dist/cli/operations/server-start.d.ts +1 -0
  7. package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +1 -1
  8. package/dist/cli/utilities/build/manifest/utils/add-missing-field-option-ids.d.ts +2 -0
  9. package/dist/cli/utilities/build/manifest/utils/from-role-config-to-role-manifest.d.ts +3 -0
  10. package/dist/cli/utilities/config/config-service.d.ts +3 -1
  11. package/dist/cli/utilities/config/get-config-path.d.ts +1 -1
  12. package/dist/cli/utilities/server/docker-container.d.ts +5 -3
  13. package/dist/cli.cjs +46 -44
  14. package/dist/cli.mjs +2035 -2089
  15. package/dist/{frontComponentHostCommunicationApi-op3Q7sYg.mjs → frontComponentHostCommunicationApi-Bz03t3FY.mjs} +66 -74
  16. package/dist/{frontComponentHostCommunicationApi-DvdpnfNz.js → frontComponentHostCommunicationApi-DyOxvANW.js} +3 -3
  17. package/dist/{get-function-input-schema-BZ7_XyUh-xI83N7kX.mjs → get-function-input-schema-BZ7_XyUh-CtECetlr.mjs} +1 -1
  18. package/dist/{get-function-input-schema-BZ7_XyUh-Bf_NiyDR.js → get-function-input-schema-BZ7_XyUh-D2ypJxjI.js} +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.mjs +9 -9
  21. package/dist/operations.cjs +1 -1
  22. package/dist/operations.mjs +14 -13
  23. package/dist/sdk/application/application-config.d.ts +1 -1
  24. package/dist/sdk/common/types/define-entity.type.d.ts +5 -2
  25. package/dist/sdk/index.d.ts +1 -1
  26. package/dist/sdk/logic-functions/define-post-install-logic-function.d.ts +2 -5
  27. package/dist/sdk/logic-functions/define-post-install-logic-function.js.map +1 -1
  28. package/dist/sdk/logic-functions/define-pre-install-logic-function.d.ts +2 -5
  29. package/dist/sdk/logic-functions/define-pre-install-logic-function.js.map +1 -1
  30. package/dist/sdk/logic-functions/install-payload-type.d.ts +5 -0
  31. package/dist/sdk/logic-functions/post-install-logic-function-config.d.ts +4 -0
  32. package/dist/sdk/logic-functions/pre-install-logic-function-config.d.ts +5 -0
  33. package/dist/sdk/roles/define-role.d.ts +2 -2
  34. package/dist/sdk/roles/define-role.js.map +1 -1
  35. package/dist/sdk/roles/role-config.d.ts +7 -0
  36. package/dist/ui/index.cjs +413 -398
  37. package/dist/ui/index.mjs +2164 -2134
  38. package/dist/uninstall-CXlUxs8p.js +189 -0
  39. package/dist/{uninstall-9yB-e13_.mjs → uninstall-CrGYRb-Z.mjs} +993 -663
  40. package/package.json +2 -2
  41. package/dist/sdk/logic-functions/install-logic-function-payload-type.d.ts +0 -4
  42. package/dist/uninstall-BCUbP_Bn.js +0 -178
package/dist/cli.cjs CHANGED
@@ -1,31 +1,31 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var zg=Object.create;var Po=Object.defineProperty;var Yg=Object.getOwnPropertyDescriptor;var Vg=Object.getOwnPropertyNames;var Jg=Object.getPrototypeOf,Zg=Object.prototype.hasOwnProperty;var jg=(f,a,i,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of Vg(a))!Zg.call(f,p)&&p!==i&&Po(f,p,{get:()=>a[p],enumerable:!(l=Yg(a,p))||l.enumerable});return f};var Xg=(f,a,i)=>(i=f!=null?zg(Jg(f)):{},jg(a||!f||!f.__esModule?Po(i,"default",{value:f,enumerable:!0}):i,f));const Z=require("path"),Qg=require("chalk"),T=require("./frontComponentHostCommunicationApi-DvdpnfNz.js"),ev=require("inquirer"),bn=require("node:fs/promises"),de=require("uuid"),E=require("./uninstall-BCUbP_Bn.js"),tv=require("twenty-client-sdk/generate"),nv=require("chokidar"),rv=require("crypto"),An=require("node:child_process"),iv=require("node:path"),sv=require("axios"),O=require("react/jsx-runtime"),xt=require("react"),ko=require("commander"),av=require("util"),It=f=>f&&f.__esModule?f:{default:f},Ji=It(Z),w=It(Qg),We=It(ev),Go=It(nv),ov=It(rv),Oo=It(iv),uv=It(sv),qo=It(xt),ue=process.env.INIT_CWD||process.cwd(),ct=f=>f&&!f?.startsWith("/")?Z.join(ue,f):f;var En={exports:{}};/**
2
+ "use strict";var Hg=Object.create;var Ro=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var zg=Object.getOwnPropertyNames;var Yg=Object.getPrototypeOf,Vg=Object.prototype.hasOwnProperty;var Zg=(f,a,i,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of zg(a))!Vg.call(f,p)&&p!==i&&Ro(f,p,{get:()=>a[p],enumerable:!(l=Kg(a,p))||l.enumerable});return f};var Jg=(f,a,i)=>(i=f!=null?Hg(Yg(f)):{},Zg(a||!f||!f.__esModule?Ro(i,"default",{value:f,enumerable:!0}):i,f));const j=require("path"),Xg=require("chalk"),P=require("./frontComponentHostCommunicationApi-DyOxvANW.js"),jg=require("inquirer"),Tn=require("node:fs/promises"),de=require("uuid"),A=require("./uninstall-CXlUxs8p.js"),Qg=require("chokidar"),ev=require("crypto"),Cn=require("node:child_process"),tv=require("node:path"),O=require("react/jsx-runtime"),Et=require("react"),Mo=require("commander"),nv=require("util"),Nt=f=>f&&f.__esModule?f:{default:f},Bo=Nt(j),y=Nt(Xg),We=Nt(jg),ko=Nt(Qg),rv=Nt(ev),Fo=Nt(tv),Go=Nt(Et),ae=process.env.INIT_CWD||process.cwd(),ft=f=>f&&!f?.startsWith("/")?j.join(ae,f):f;var bn={exports:{}};/**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
5
5
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
6
  * Released under MIT license <https://lodash.com/license>
7
7
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
8
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
- */var lv=En.exports,Lo;function cv(){return Lo||(Lo=1,function(f,a){(function(){var i,l="4.17.21",p=200,x="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",I="Expected a function",B="Invalid `variable` option passed into `_.template`",L="__lodash_hash_undefined__",se=500,Q="__lodash_placeholder__",K=1,q=2,W=4,Me=1,Rn=2,Be=1,Ut=2,ji=4,je=8,Xt=16,Xe=32,Qt=64,Qe=128,en=256,Ir=512,Zo=30,jo="...",Xo=800,Qo=16,Xi=1,eu=2,tu=3,At=1/0,ht=9007199254740991,nu=17976931348623157e292,Tn=NaN,Ye=4294967295,ru=Ye-1,iu=Ye>>>1,su=[["ary",Qe],["bind",Be],["bindKey",Ut],["curry",je],["curryRight",Xt],["flip",Ir],["partial",Xe],["partialRight",Qt],["rearg",en]],$t="[object Arguments]",Fn="[object Array]",au="[object AsyncFunction]",tn="[object Boolean]",nn="[object Date]",ou="[object DOMException]",Pn="[object Error]",On="[object Function]",Qi="[object GeneratorFunction]",ke="[object Map]",rn="[object Number]",uu="[object Null]",et="[object Object]",es="[object Promise]",lu="[object Proxy]",sn="[object RegExp]",Ge="[object Set]",an="[object String]",Ln="[object Symbol]",cu="[object Undefined]",on="[object WeakMap]",fu="[object WeakSet]",un="[object ArrayBuffer]",Nt="[object DataView]",Ar="[object Float32Array]",Er="[object Float64Array]",br="[object Int8Array]",Cr="[object Int16Array]",Rr="[object Int32Array]",Tr="[object Uint8Array]",Fr="[object Uint8ClampedArray]",Pr="[object Uint16Array]",Or="[object Uint32Array]",hu=/\b__p \+= '';/g,pu=/\b(__p \+=) '' \+/g,du=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ts=/&(?:amp|lt|gt|quot|#39);/g,ns=/[&<>"']/g,gu=RegExp(ts.source),vu=RegExp(ns.source),mu=/<%-([\s\S]+?)%>/g,_u=/<%([\s\S]+?)%>/g,rs=/<%=([\s\S]+?)%>/g,yu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wu=/^\w*$/,Su=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lr=/[\\^$.*+?()[\]{}|]/g,xu=RegExp(Lr.source),Ur=/^\s+/,Iu=/\s/,Au=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Eu=/\{\n\/\* \[wrapped with (.+)\] \*/,bu=/,? & /,Cu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ru=/[()=,{}\[\]\/\s]/,Tu=/\\(\\)?/g,Fu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,is=/\w*$/,Pu=/^[-+]0x[0-9a-f]+$/i,Ou=/^0b[01]+$/i,Lu=/^\[object .+?Constructor\]$/,Uu=/^0o[0-7]+$/i,$u=/^(?:0|[1-9]\d*)$/,Nu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Un=/($^)/,Du=/['\n\r\u2028\u2029\\]/g,$n="\\ud800-\\udfff",Wu="\\u0300-\\u036f",Mu="\\ufe20-\\ufe2f",Bu="\\u20d0-\\u20ff",ss=Wu+Mu+Bu,as="\\u2700-\\u27bf",os="a-z\\xdf-\\xf6\\xf8-\\xff",ku="\\xac\\xb1\\xd7\\xf7",Gu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qu="\\u2000-\\u206f",Hu=" \\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=ku+Gu+qu+Hu,$r="['’]",Ku="["+$n+"]",fs="["+cs+"]",Nn="["+ss+"]",hs="\\d+",zu="["+as+"]",ps="["+os+"]",ds="[^"+$n+cs+hs+as+os+us+"]",Nr="\\ud83c[\\udffb-\\udfff]",Yu="(?:"+Nn+"|"+Nr+")",gs="[^"+$n+"]",Dr="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",Dt="["+us+"]",vs="\\u200d",ms="(?:"+ps+"|"+ds+")",Vu="(?:"+Dt+"|"+ds+")",_s="(?:"+$r+"(?:d|ll|m|re|s|t|ve))?",ys="(?:"+$r+"(?:D|LL|M|RE|S|T|VE))?",ws=Yu+"?",Ss="["+ls+"]?",Ju="(?:"+vs+"(?:"+[gs,Dr,Wr].join("|")+")"+Ss+ws+")*",Zu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ju="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",xs=Ss+ws+Ju,Xu="(?:"+[zu,Dr,Wr].join("|")+")"+xs,Qu="(?:"+[gs+Nn+"?",Nn,Dr,Wr,Ku].join("|")+")",el=RegExp($r,"g"),tl=RegExp(Nn,"g"),Mr=RegExp(Nr+"(?="+Nr+")|"+Qu+xs,"g"),nl=RegExp([Dt+"?"+ps+"+"+_s+"(?="+[fs,Dt,"$"].join("|")+")",Vu+"+"+ys+"(?="+[fs,Dt+ms,"$"].join("|")+")",Dt+"?"+ms+"+"+_s,Dt+"+"+ys,ju,Zu,hs,Xu].join("|"),"g"),rl=RegExp("["+vs+$n+ss+ls+"]"),il=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,sl=["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"],al=-1,X={};X[Ar]=X[Er]=X[br]=X[Cr]=X[Rr]=X[Tr]=X[Fr]=X[Pr]=X[Or]=!0,X[$t]=X[Fn]=X[un]=X[tn]=X[Nt]=X[nn]=X[Pn]=X[On]=X[ke]=X[rn]=X[et]=X[sn]=X[Ge]=X[an]=X[on]=!1;var j={};j[$t]=j[Fn]=j[un]=j[Nt]=j[tn]=j[nn]=j[Ar]=j[Er]=j[br]=j[Cr]=j[Rr]=j[ke]=j[rn]=j[et]=j[sn]=j[Ge]=j[an]=j[Ln]=j[Tr]=j[Fr]=j[Pr]=j[Or]=!0,j[Pn]=j[On]=j[on]=!1;var ol={À:"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"},ul={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ll={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},cl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fl=parseFloat,hl=parseInt,Is=typeof T.commonjsGlobal=="object"&&T.commonjsGlobal&&T.commonjsGlobal.Object===Object&&T.commonjsGlobal,pl=typeof self=="object"&&self&&self.Object===Object&&self,ce=Is||pl||Function("return this")(),Br=a&&!a.nodeType&&a,Et=Br&&!0&&f&&!f.nodeType&&f,As=Et&&Et.exports===Br,kr=As&&Is.process,Te=function(){try{var d=Et&&Et.require&&Et.require("util").types;return d||kr&&kr.binding&&kr.binding("util")}catch{}}(),Es=Te&&Te.isArrayBuffer,bs=Te&&Te.isDate,Cs=Te&&Te.isMap,Rs=Te&&Te.isRegExp,Ts=Te&&Te.isSet,Fs=Te&&Te.isTypedArray;function xe(d,m,v){switch(v.length){case 0:return d.call(m);case 1:return d.call(m,v[0]);case 2:return d.call(m,v[0],v[1]);case 3:return d.call(m,v[0],v[1],v[2])}return d.apply(m,v)}function dl(d,m,v,b){for(var U=-1,z=d==null?0:d.length;++U<z;){var ae=d[U];m(b,ae,v(ae),d)}return b}function Fe(d,m){for(var v=-1,b=d==null?0:d.length;++v<b&&m(d[v],v,d)!==!1;);return d}function gl(d,m){for(var v=d==null?0:d.length;v--&&m(d[v],v,d)!==!1;);return d}function Ps(d,m){for(var v=-1,b=d==null?0:d.length;++v<b;)if(!m(d[v],v,d))return!1;return!0}function pt(d,m){for(var v=-1,b=d==null?0:d.length,U=0,z=[];++v<b;){var ae=d[v];m(ae,v,d)&&(z[U++]=ae)}return z}function Dn(d,m){var v=d==null?0:d.length;return!!v&&Wt(d,m,0)>-1}function Gr(d,m,v){for(var b=-1,U=d==null?0:d.length;++b<U;)if(v(m,d[b]))return!0;return!1}function ee(d,m){for(var v=-1,b=d==null?0:d.length,U=Array(b);++v<b;)U[v]=m(d[v],v,d);return U}function dt(d,m){for(var v=-1,b=m.length,U=d.length;++v<b;)d[U+v]=m[v];return d}function qr(d,m,v,b){var U=-1,z=d==null?0:d.length;for(b&&z&&(v=d[++U]);++U<z;)v=m(v,d[U],U,d);return v}function vl(d,m,v,b){var U=d==null?0:d.length;for(b&&U&&(v=d[--U]);U--;)v=m(v,d[U],U,d);return v}function Hr(d,m){for(var v=-1,b=d==null?0:d.length;++v<b;)if(m(d[v],v,d))return!0;return!1}var ml=Kr("length");function _l(d){return d.split("")}function yl(d){return d.match(Cu)||[]}function Os(d,m,v){var b;return v(d,function(U,z,ae){if(m(U,z,ae))return b=z,!1}),b}function Wn(d,m,v,b){for(var U=d.length,z=v+(b?1:-1);b?z--:++z<U;)if(m(d[z],z,d))return z;return-1}function Wt(d,m,v){return m===m?Pl(d,m,v):Wn(d,Ls,v)}function wl(d,m,v,b){for(var U=v-1,z=d.length;++U<z;)if(b(d[U],m))return U;return-1}function Ls(d){return d!==d}function Us(d,m){var v=d==null?0:d.length;return v?Yr(d,m)/v:Tn}function Kr(d){return function(m){return m==null?i:m[d]}}function zr(d){return function(m){return d==null?i:d[m]}}function $s(d,m,v,b,U){return U(d,function(z,ae,J){v=b?(b=!1,z):m(v,z,ae,J)}),v}function Sl(d,m){var v=d.length;for(d.sort(m);v--;)d[v]=d[v].value;return d}function Yr(d,m){for(var v,b=-1,U=d.length;++b<U;){var z=m(d[b]);z!==i&&(v=v===i?z:v+z)}return v}function Vr(d,m){for(var v=-1,b=Array(d);++v<d;)b[v]=m(v);return b}function xl(d,m){return ee(m,function(v){return[v,d[v]]})}function Ns(d){return d&&d.slice(0,Bs(d)+1).replace(Ur,"")}function Ie(d){return function(m){return d(m)}}function Jr(d,m){return ee(m,function(v){return d[v]})}function ln(d,m){return d.has(m)}function Ds(d,m){for(var v=-1,b=d.length;++v<b&&Wt(m,d[v],0)>-1;);return v}function Ws(d,m){for(var v=d.length;v--&&Wt(m,d[v],0)>-1;);return v}function Il(d,m){for(var v=d.length,b=0;v--;)d[v]===m&&++b;return b}var Al=zr(ol),El=zr(ul);function bl(d){return"\\"+cl[d]}function Cl(d,m){return d==null?i:d[m]}function Mt(d){return rl.test(d)}function Rl(d){return il.test(d)}function Tl(d){for(var m,v=[];!(m=d.next()).done;)v.push(m.value);return v}function Zr(d){var m=-1,v=Array(d.size);return d.forEach(function(b,U){v[++m]=[U,b]}),v}function Ms(d,m){return function(v){return d(m(v))}}function gt(d,m){for(var v=-1,b=d.length,U=0,z=[];++v<b;){var ae=d[v];(ae===m||ae===Q)&&(d[v]=Q,z[U++]=v)}return z}function Mn(d){var m=-1,v=Array(d.size);return d.forEach(function(b){v[++m]=b}),v}function Fl(d){var m=-1,v=Array(d.size);return d.forEach(function(b){v[++m]=[b,b]}),v}function Pl(d,m,v){for(var b=v-1,U=d.length;++b<U;)if(d[b]===m)return b;return-1}function Ol(d,m,v){for(var b=v+1;b--;)if(d[b]===m)return b;return b}function Bt(d){return Mt(d)?Ul(d):ml(d)}function qe(d){return Mt(d)?$l(d):_l(d)}function Bs(d){for(var m=d.length;m--&&Iu.test(d.charAt(m)););return m}var Ll=zr(ll);function Ul(d){for(var m=Mr.lastIndex=0;Mr.test(d);)++m;return m}function $l(d){return d.match(Mr)||[]}function Nl(d){return d.match(nl)||[]}var Dl=function d(m){m=m==null?ce:kt.defaults(ce.Object(),m,kt.pick(ce,sl));var v=m.Array,b=m.Date,U=m.Error,z=m.Function,ae=m.Math,J=m.Object,jr=m.RegExp,Wl=m.String,Pe=m.TypeError,Bn=v.prototype,Ml=z.prototype,Gt=J.prototype,kn=m["__core-js_shared__"],Gn=Ml.toString,V=Gt.hasOwnProperty,Bl=0,ks=function(){var e=/[^.]+$/.exec(kn&&kn.keys&&kn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),qn=Gt.toString,kl=Gn.call(J),Gl=ce._,ql=jr("^"+Gn.call(V).replace(Lr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=As?m.Buffer:i,vt=m.Symbol,Kn=m.Uint8Array,Gs=Hn?Hn.allocUnsafe:i,zn=Ms(J.getPrototypeOf,J),qs=J.create,Hs=Gt.propertyIsEnumerable,Yn=Bn.splice,Ks=vt?vt.isConcatSpreadable:i,cn=vt?vt.iterator:i,bt=vt?vt.toStringTag:i,Vn=function(){try{var e=Pt(J,"defineProperty");return e({},"",{}),e}catch{}}(),Hl=m.clearTimeout!==ce.clearTimeout&&m.clearTimeout,Kl=b&&b.now!==ce.Date.now&&b.now,zl=m.setTimeout!==ce.setTimeout&&m.setTimeout,Jn=ae.ceil,Zn=ae.floor,Xr=J.getOwnPropertySymbols,Yl=Hn?Hn.isBuffer:i,zs=m.isFinite,Vl=Bn.join,Jl=Ms(J.keys,J),oe=ae.max,he=ae.min,Zl=b.now,jl=m.parseInt,Ys=ae.random,Xl=Bn.reverse,Qr=Pt(m,"DataView"),fn=Pt(m,"Map"),ei=Pt(m,"Promise"),qt=Pt(m,"Set"),hn=Pt(m,"WeakMap"),pn=Pt(J,"create"),jn=hn&&new hn,Ht={},Ql=Ot(Qr),ec=Ot(fn),tc=Ot(ei),nc=Ot(qt),rc=Ot(hn),Xn=vt?vt.prototype:i,dn=Xn?Xn.valueOf:i,Vs=Xn?Xn.toString:i;function o(e){if(ne(e)&&!$(e)&&!(e instanceof G)){if(e instanceof Oe)return e;if(V.call(e,"__wrapped__"))return Ja(e)}return new Oe(e)}var Kt=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=i,n}}();function Qn(){}function Oe(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}o.templateSettings={escape:mu,evaluate:_u,interpolate:rs,variable:"",imports:{_:o}},o.prototype=Qn.prototype,o.prototype.constructor=o,Oe.prototype=Kt(Qn.prototype),Oe.prototype.constructor=Oe;function G(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ye,this.__views__=[]}function ic(){var e=new G(this.__wrapped__);return e.__actions__=_e(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=_e(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=_e(this.__views__),e}function sc(){if(this.__filtered__){var e=new G(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function ac(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),r=t<0,s=n?e.length:0,u=yf(0,s,this.__views__),c=u.start,h=u.end,g=h-c,_=r?h:c-1,y=this.__iteratees__,S=y.length,A=0,C=he(g,this.__takeCount__);if(!n||!r&&s==g&&C==g)return _a(e,this.__actions__);var F=[];e:for(;g--&&A<C;){_+=t;for(var D=-1,P=e[_];++D<S;){var k=y[D],H=k.iteratee,be=k.type,me=H(P);if(be==eu)P=me;else if(!me){if(be==Xi)continue e;break e}}F[A++]=P}return F}G.prototype=Kt(Qn.prototype),G.prototype.constructor=G;function Ct(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function oc(){this.__data__=pn?pn(null):{},this.size=0}function uc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function lc(e){var t=this.__data__;if(pn){var n=t[e];return n===L?i:n}return V.call(t,e)?t[e]:i}function cc(e){var t=this.__data__;return pn?t[e]!==i:V.call(t,e)}function fc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=pn&&t===i?L:t,this}Ct.prototype.clear=oc,Ct.prototype.delete=uc,Ct.prototype.get=lc,Ct.prototype.has=cc,Ct.prototype.set=fc;function tt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function hc(){this.__data__=[],this.size=0}function pc(e){var t=this.__data__,n=er(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Yn.call(t,n,1),--this.size,!0}function dc(e){var t=this.__data__,n=er(t,e);return n<0?i:t[n][1]}function gc(e){return er(this.__data__,e)>-1}function vc(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}tt.prototype.clear=hc,tt.prototype.delete=pc,tt.prototype.get=dc,tt.prototype.has=gc,tt.prototype.set=vc;function nt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function mc(){this.size=0,this.__data__={hash:new Ct,map:new(fn||tt),string:new Ct}}function _c(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}function yc(e){return hr(this,e).get(e)}function wc(e){return hr(this,e).has(e)}function Sc(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}nt.prototype.clear=mc,nt.prototype.delete=_c,nt.prototype.get=yc,nt.prototype.has=wc,nt.prototype.set=Sc;function Rt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new nt;++t<n;)this.add(e[t])}function xc(e){return this.__data__.set(e,L),this}function Ic(e){return this.__data__.has(e)}Rt.prototype.add=Rt.prototype.push=xc,Rt.prototype.has=Ic;function He(e){var t=this.__data__=new tt(e);this.size=t.size}function Ac(){this.__data__=new tt,this.size=0}function Ec(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function bc(e){return this.__data__.get(e)}function Cc(e){return this.__data__.has(e)}function Rc(e,t){var n=this.__data__;if(n instanceof tt){var r=n.__data__;if(!fn||r.length<p-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new nt(r)}return n.set(e,t),this.size=n.size,this}He.prototype.clear=Ac,He.prototype.delete=Ec,He.prototype.get=bc,He.prototype.has=Cc,He.prototype.set=Rc;function Js(e,t){var n=$(e),r=!n&&Lt(e),s=!n&&!r&&St(e),u=!n&&!r&&!s&&Jt(e),c=n||r||s||u,h=c?Vr(e.length,Wl):[],g=h.length;for(var _ in e)(t||V.call(e,_))&&!(c&&(_=="length"||s&&(_=="offset"||_=="parent")||u&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||at(_,g)))&&h.push(_);return h}function Zs(e){var t=e.length;return t?e[fi(0,t-1)]:i}function Tc(e,t){return pr(_e(e),Tt(t,0,e.length))}function Fc(e){return pr(_e(e))}function ti(e,t,n){(n!==i&&!Ke(e[t],n)||n===i&&!(t in e))&&rt(e,t,n)}function gn(e,t,n){var r=e[t];(!(V.call(e,t)&&Ke(r,n))||n===i&&!(t in e))&&rt(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Ke(e[n][0],t))return n;return-1}function Pc(e,t,n,r){return mt(e,function(s,u,c){t(r,s,n(s),c)}),r}function js(e,t){return e&&Je(t,le(t),e)}function Oc(e,t){return e&&Je(t,we(t),e)}function rt(e,t,n){t=="__proto__"&&Vn?Vn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ni(e,t){for(var n=-1,r=t.length,s=v(r),u=e==null;++n<r;)s[n]=u?i:Ni(e,t[n]);return s}function Tt(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function Le(e,t,n,r,s,u){var c,h=t&K,g=t&q,_=t&W;if(n&&(c=s?n(e,r,s,u):n(e)),c!==i)return c;if(!te(e))return e;var y=$(e);if(y){if(c=Sf(e),!h)return _e(e,c)}else{var S=pe(e),A=S==On||S==Qi;if(St(e))return Sa(e,h);if(S==et||S==$t||A&&!s){if(c=g||A?{}:Ba(e),!h)return g?cf(e,Oc(c,e)):lf(e,js(c,e))}else{if(!j[S])return s?e:{};c=xf(e,S,h)}}u||(u=new He);var C=u.get(e);if(C)return C;u.set(e,c),vo(e)?e.forEach(function(P){c.add(Le(P,t,n,P,e,u))}):po(e)&&e.forEach(function(P,k){c.set(k,Le(P,t,n,k,e,u))});var F=_?g?xi:Si:g?we:le,D=y?i:F(e);return Fe(D||e,function(P,k){D&&(k=P,P=e[k]),gn(c,k,Le(P,t,n,k,e,u))}),c}function Lc(e){var t=le(e);return function(n){return Xs(n,e,t)}}function Xs(e,t,n){var r=n.length;if(e==null)return!r;for(e=J(e);r--;){var s=n[r],u=t[s],c=e[s];if(c===i&&!(s in e)||!u(c))return!1}return!0}function Qs(e,t,n){if(typeof e!="function")throw new Pe(I);return xn(function(){e.apply(i,n)},t)}function vn(e,t,n,r){var s=-1,u=Dn,c=!0,h=e.length,g=[],_=t.length;if(!h)return g;n&&(t=ee(t,Ie(n))),r?(u=Gr,c=!1):t.length>=p&&(u=ln,c=!1,t=new Rt(t));e:for(;++s<h;){var y=e[s],S=n==null?y:n(y);if(y=r||y!==0?y:0,c&&S===S){for(var A=_;A--;)if(t[A]===S)continue e;g.push(y)}else u(t,S,r)||g.push(y)}return g}var mt=ba(Ve),ea=ba(ii,!0);function Uc(e,t){var n=!0;return mt(e,function(r,s,u){return n=!!t(r,s,u),n}),n}function tr(e,t,n){for(var r=-1,s=e.length;++r<s;){var u=e[r],c=t(u);if(c!=null&&(h===i?c===c&&!Ee(c):n(c,h)))var h=c,g=u}return g}function $c(e,t,n,r){var s=e.length;for(n=N(n),n<0&&(n=-n>s?0:s+n),r=r===i||r>s?s:N(r),r<0&&(r+=s),r=n>r?0:_o(r);n<r;)e[n++]=t;return e}function ta(e,t){var n=[];return mt(e,function(r,s,u){t(r,s,u)&&n.push(r)}),n}function fe(e,t,n,r,s){var u=-1,c=e.length;for(n||(n=Af),s||(s=[]);++u<c;){var h=e[u];t>0&&n(h)?t>1?fe(h,t-1,n,r,s):dt(s,h):r||(s[s.length]=h)}return s}var ri=Ca(),na=Ca(!0);function Ve(e,t){return e&&ri(e,t,le)}function ii(e,t){return e&&na(e,t,le)}function nr(e,t){return pt(t,function(n){return ot(e[n])})}function Ft(e,t){t=yt(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ze(t[n++])];return n&&n==r?e:i}function ra(e,t,n){var r=t(e);return $(e)?r:dt(r,n(e))}function ge(e){return e==null?e===i?cu:uu:bt&&bt in J(e)?_f(e):Pf(e)}function si(e,t){return e>t}function Nc(e,t){return e!=null&&V.call(e,t)}function Dc(e,t){return e!=null&&t in J(e)}function Wc(e,t,n){return e>=he(t,n)&&e<oe(t,n)}function ai(e,t,n){for(var r=n?Gr:Dn,s=e[0].length,u=e.length,c=u,h=v(u),g=1/0,_=[];c--;){var y=e[c];c&&t&&(y=ee(y,Ie(t))),g=he(y.length,g),h[c]=!n&&(t||s>=120&&y.length>=120)?new Rt(c&&y):i}y=e[0];var S=-1,A=h[0];e:for(;++S<s&&_.length<g;){var C=y[S],F=t?t(C):C;if(C=n||C!==0?C:0,!(A?ln(A,F):r(_,F,n))){for(c=u;--c;){var D=h[c];if(!(D?ln(D,F):r(e[c],F,n)))continue e}A&&A.push(F),_.push(C)}}return _}function Mc(e,t,n,r){return Ve(e,function(s,u,c){t(r,n(s),u,c)}),r}function mn(e,t,n){t=yt(t,e),e=Ha(e,t);var r=e==null?e:e[Ze($e(t))];return r==null?i:xe(r,e,n)}function ia(e){return ne(e)&&ge(e)==$t}function Bc(e){return ne(e)&&ge(e)==un}function kc(e){return ne(e)&&ge(e)==nn}function _n(e,t,n,r,s){return e===t?!0:e==null||t==null||!ne(e)&&!ne(t)?e!==e&&t!==t:Gc(e,t,n,r,_n,s)}function Gc(e,t,n,r,s,u){var c=$(e),h=$(t),g=c?Fn:pe(e),_=h?Fn:pe(t);g=g==$t?et:g,_=_==$t?et:_;var y=g==et,S=_==et,A=g==_;if(A&&St(e)){if(!St(t))return!1;c=!0,y=!1}if(A&&!y)return u||(u=new He),c||Jt(e)?Da(e,t,n,r,s,u):vf(e,t,g,n,r,s,u);if(!(n&Me)){var C=y&&V.call(e,"__wrapped__"),F=S&&V.call(t,"__wrapped__");if(C||F){var D=C?e.value():e,P=F?t.value():t;return u||(u=new He),s(D,P,n,r,u)}}return A?(u||(u=new He),mf(e,t,n,r,s,u)):!1}function qc(e){return ne(e)&&pe(e)==ke}function oi(e,t,n,r){var s=n.length,u=s,c=!r;if(e==null)return!u;for(e=J(e);s--;){var h=n[s];if(c&&h[2]?h[1]!==e[h[0]]:!(h[0]in e))return!1}for(;++s<u;){h=n[s];var g=h[0],_=e[g],y=h[1];if(c&&h[2]){if(_===i&&!(g in e))return!1}else{var S=new He;if(r)var A=r(_,y,g,e,t,S);if(!(A===i?_n(y,_,Me|Rn,r,S):A))return!1}}return!0}function sa(e){if(!te(e)||bf(e))return!1;var t=ot(e)?ql:Lu;return t.test(Ot(e))}function Hc(e){return ne(e)&&ge(e)==sn}function Kc(e){return ne(e)&&pe(e)==Ge}function zc(e){return ne(e)&&yr(e.length)&&!!X[ge(e)]}function aa(e){return typeof e=="function"?e:e==null?Se:typeof e=="object"?$(e)?la(e[0],e[1]):ua(e):To(e)}function ui(e){if(!Sn(e))return Jl(e);var t=[];for(var n in J(e))V.call(e,n)&&n!="constructor"&&t.push(n);return t}function Yc(e){if(!te(e))return Ff(e);var t=Sn(e),n=[];for(var r in e)r=="constructor"&&(t||!V.call(e,r))||n.push(r);return n}function li(e,t){return e<t}function oa(e,t){var n=-1,r=ye(e)?v(e.length):[];return mt(e,function(s,u,c){r[++n]=t(s,u,c)}),r}function ua(e){var t=Ai(e);return t.length==1&&t[0][2]?Ga(t[0][0],t[0][1]):function(n){return n===e||oi(n,e,t)}}function la(e,t){return bi(e)&&ka(t)?Ga(Ze(e),t):function(n){var r=Ni(n,e);return r===i&&r===t?Di(n,e):_n(t,r,Me|Rn)}}function rr(e,t,n,r,s){e!==t&&ri(t,function(u,c){if(s||(s=new He),te(u))Vc(e,t,c,n,rr,r,s);else{var h=r?r(Ri(e,c),u,c+"",e,t,s):i;h===i&&(h=u),ti(e,c,h)}},we)}function Vc(e,t,n,r,s,u,c){var h=Ri(e,n),g=Ri(t,n),_=c.get(g);if(_){ti(e,n,_);return}var y=u?u(h,g,n+"",e,t,c):i,S=y===i;if(S){var A=$(g),C=!A&&St(g),F=!A&&!C&&Jt(g);y=g,A||C||F?$(h)?y=h:re(h)?y=_e(h):C?(S=!1,y=Sa(g,!0)):F?(S=!1,y=xa(g,!0)):y=[]:In(g)||Lt(g)?(y=h,Lt(h)?y=yo(h):(!te(h)||ot(h))&&(y=Ba(g))):S=!1}S&&(c.set(g,y),s(y,g,r,u,c),c.delete(g)),ti(e,n,y)}function ca(e,t){var n=e.length;if(n)return t+=t<0?n:0,at(t,n)?e[t]:i}function fa(e,t,n){t.length?t=ee(t,function(u){return $(u)?function(c){return Ft(c,u.length===1?u[0]:u)}:u}):t=[Se];var r=-1;t=ee(t,Ie(R()));var s=oa(e,function(u,c,h){var g=ee(t,function(_){return _(u)});return{criteria:g,index:++r,value:u}});return Sl(s,function(u,c){return uf(u,c,n)})}function Jc(e,t){return ha(e,t,function(n,r){return Di(e,r)})}function ha(e,t,n){for(var r=-1,s=t.length,u={};++r<s;){var c=t[r],h=Ft(e,c);n(h,c)&&yn(u,yt(c,e),h)}return u}function Zc(e){return function(t){return Ft(t,e)}}function ci(e,t,n,r){var s=r?wl:Wt,u=-1,c=t.length,h=e;for(e===t&&(t=_e(t)),n&&(h=ee(e,Ie(n)));++u<c;)for(var g=0,_=t[u],y=n?n(_):_;(g=s(h,y,g,r))>-1;)h!==e&&Yn.call(h,g,1),Yn.call(e,g,1);return e}function pa(e,t){for(var n=e?t.length:0,r=n-1;n--;){var s=t[n];if(n==r||s!==u){var u=s;at(s)?Yn.call(e,s,1):di(e,s)}}return e}function fi(e,t){return e+Zn(Ys()*(t-e+1))}function jc(e,t,n,r){for(var s=-1,u=oe(Jn((t-e)/(n||1)),0),c=v(u);u--;)c[r?u:++s]=e,e+=n;return c}function hi(e,t){var n="";if(!e||t<1||t>ht)return n;do t%2&&(n+=e),t=Zn(t/2),t&&(e+=e);while(t);return n}function M(e,t){return Ti(qa(e,t,Se),e+"")}function Xc(e){return Zs(Zt(e))}function Qc(e,t){var n=Zt(e);return pr(n,Tt(t,0,n.length))}function yn(e,t,n,r){if(!te(e))return e;t=yt(t,e);for(var s=-1,u=t.length,c=u-1,h=e;h!=null&&++s<u;){var g=Ze(t[s]),_=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(s!=c){var y=h[g];_=r?r(y,g,h):i,_===i&&(_=te(y)?y:at(t[s+1])?[]:{})}gn(h,g,_),h=h[g]}return e}var da=jn?function(e,t){return jn.set(e,t),e}:Se,ef=Vn?function(e,t){return Vn(e,"toString",{configurable:!0,enumerable:!1,value:Mi(t),writable:!0})}:Se;function tf(e){return pr(Zt(e))}function Ue(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var u=v(s);++r<s;)u[r]=e[r+t];return u}function nf(e,t){var n;return mt(e,function(r,s,u){return n=t(r,s,u),!n}),!!n}function ir(e,t,n){var r=0,s=e==null?r:e.length;if(typeof t=="number"&&t===t&&s<=iu){for(;r<s;){var u=r+s>>>1,c=e[u];c!==null&&!Ee(c)&&(n?c<=t:c<t)?r=u+1:s=u}return s}return pi(e,t,Se,n)}function pi(e,t,n,r){var s=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var c=t!==t,h=t===null,g=Ee(t),_=t===i;s<u;){var y=Zn((s+u)/2),S=n(e[y]),A=S!==i,C=S===null,F=S===S,D=Ee(S);if(c)var P=r||F;else _?P=F&&(r||A):h?P=F&&A&&(r||!C):g?P=F&&A&&!C&&(r||!D):C||D?P=!1:P=r?S<=t:S<t;P?s=y+1:u=y}return he(u,ru)}function ga(e,t){for(var n=-1,r=e.length,s=0,u=[];++n<r;){var c=e[n],h=t?t(c):c;if(!n||!Ke(h,g)){var g=h;u[s++]=c===0?0:c}}return u}function va(e){return typeof e=="number"?e:Ee(e)?Tn:+e}function Ae(e){if(typeof e=="string")return e;if($(e))return ee(e,Ae)+"";if(Ee(e))return Vs?Vs.call(e):"";var t=e+"";return t=="0"&&1/e==-At?"-0":t}function _t(e,t,n){var r=-1,s=Dn,u=e.length,c=!0,h=[],g=h;if(n)c=!1,s=Gr;else if(u>=p){var _=t?null:df(e);if(_)return Mn(_);c=!1,s=ln,g=new Rt}else g=t?[]:h;e:for(;++r<u;){var y=e[r],S=t?t(y):y;if(y=n||y!==0?y:0,c&&S===S){for(var A=g.length;A--;)if(g[A]===S)continue e;t&&g.push(S),h.push(y)}else s(g,S,n)||(g!==h&&g.push(S),h.push(y))}return h}function di(e,t){return t=yt(t,e),e=Ha(e,t),e==null||delete e[Ze($e(t))]}function ma(e,t,n,r){return yn(e,t,n(Ft(e,t)),r)}function sr(e,t,n,r){for(var s=e.length,u=r?s:-1;(r?u--:++u<s)&&t(e[u],u,e););return n?Ue(e,r?0:u,r?u+1:s):Ue(e,r?u+1:0,r?s:u)}function _a(e,t){var n=e;return n instanceof G&&(n=n.value()),qr(t,function(r,s){return s.func.apply(s.thisArg,dt([r],s.args))},n)}function gi(e,t,n){var r=e.length;if(r<2)return r?_t(e[0]):[];for(var s=-1,u=v(r);++s<r;)for(var c=e[s],h=-1;++h<r;)h!=s&&(u[s]=vn(u[s]||c,e[h],t,n));return _t(fe(u,1),t,n)}function ya(e,t,n){for(var r=-1,s=e.length,u=t.length,c={};++r<s;){var h=r<u?t[r]:i;n(c,e[r],h)}return c}function vi(e){return re(e)?e:[]}function mi(e){return typeof e=="function"?e:Se}function yt(e,t){return $(e)?e:bi(e,t)?[e]:Va(Y(e))}var rf=M;function wt(e,t,n){var r=e.length;return n=n===i?r:n,!t&&n>=r?e:Ue(e,t,n)}var wa=Hl||function(e){return ce.clearTimeout(e)};function Sa(e,t){if(t)return e.slice();var n=e.length,r=Gs?Gs(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new Kn(t).set(new Kn(e)),t}function sf(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function af(e){var t=new e.constructor(e.source,is.exec(e));return t.lastIndex=e.lastIndex,t}function of(e){return dn?J(dn.call(e)):{}}function xa(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ia(e,t){if(e!==t){var n=e!==i,r=e===null,s=e===e,u=Ee(e),c=t!==i,h=t===null,g=t===t,_=Ee(t);if(!h&&!_&&!u&&e>t||u&&c&&g&&!h&&!_||r&&c&&g||!n&&g||!s)return 1;if(!r&&!u&&!_&&e<t||_&&n&&s&&!r&&!u||h&&n&&s||!c&&s||!g)return-1}return 0}function uf(e,t,n){for(var r=-1,s=e.criteria,u=t.criteria,c=s.length,h=n.length;++r<c;){var g=Ia(s[r],u[r]);if(g){if(r>=h)return g;var _=n[r];return g*(_=="desc"?-1:1)}}return e.index-t.index}function Aa(e,t,n,r){for(var s=-1,u=e.length,c=n.length,h=-1,g=t.length,_=oe(u-c,0),y=v(g+_),S=!r;++h<g;)y[h]=t[h];for(;++s<c;)(S||s<u)&&(y[n[s]]=e[s]);for(;_--;)y[h++]=e[s++];return y}function Ea(e,t,n,r){for(var s=-1,u=e.length,c=-1,h=n.length,g=-1,_=t.length,y=oe(u-h,0),S=v(y+_),A=!r;++s<y;)S[s]=e[s];for(var C=s;++g<_;)S[C+g]=t[g];for(;++c<h;)(A||s<u)&&(S[C+n[c]]=e[s++]);return S}function _e(e,t){var n=-1,r=e.length;for(t||(t=v(r));++n<r;)t[n]=e[n];return t}function Je(e,t,n,r){var s=!n;n||(n={});for(var u=-1,c=t.length;++u<c;){var h=t[u],g=r?r(n[h],e[h],h,n,e):i;g===i&&(g=e[h]),s?rt(n,h,g):gn(n,h,g)}return n}function lf(e,t){return Je(e,Ei(e),t)}function cf(e,t){return Je(e,Wa(e),t)}function ar(e,t){return function(n,r){var s=$(n)?dl:Pc,u=t?t():{};return s(n,e,R(r,2),u)}}function zt(e){return M(function(t,n){var r=-1,s=n.length,u=s>1?n[s-1]:i,c=s>2?n[2]:i;for(u=e.length>3&&typeof u=="function"?(s--,u):i,c&&ve(n[0],n[1],c)&&(u=s<3?i:u,s=1),t=J(t);++r<s;){var h=n[r];h&&e(t,h,r,u)}return t})}function ba(e,t){return function(n,r){if(n==null)return n;if(!ye(n))return e(n,r);for(var s=n.length,u=t?s:-1,c=J(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}function Ca(e){return function(t,n,r){for(var s=-1,u=J(t),c=r(t),h=c.length;h--;){var g=c[e?h:++s];if(n(u[g],g,u)===!1)break}return t}}function ff(e,t,n){var r=t&Be,s=wn(e);function u(){var c=this&&this!==ce&&this instanceof u?s:e;return c.apply(r?n:this,arguments)}return u}function Ra(e){return function(t){t=Y(t);var n=Mt(t)?qe(t):i,r=n?n[0]:t.charAt(0),s=n?wt(n,1).join(""):t.slice(1);return r[e]()+s}}function Yt(e){return function(t){return qr(Co(bo(t).replace(el,"")),e,"")}}function wn(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=Kt(e.prototype),r=e.apply(n,t);return te(r)?r:n}}function hf(e,t,n){var r=wn(e);function s(){for(var u=arguments.length,c=v(u),h=u,g=Vt(s);h--;)c[h]=arguments[h];var _=u<3&&c[0]!==g&&c[u-1]!==g?[]:gt(c,g);if(u-=_.length,u<n)return La(e,t,or,s.placeholder,i,c,_,i,i,n-u);var y=this&&this!==ce&&this instanceof s?r:e;return xe(y,this,c)}return s}function Ta(e){return function(t,n,r){var s=J(t);if(!ye(t)){var u=R(n,3);t=le(t),n=function(h){return u(s[h],h,s)}}var c=e(t,n,r);return c>-1?s[u?t[c]:c]:i}}function Fa(e){return st(function(t){var n=t.length,r=n,s=Oe.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if(typeof u!="function")throw new Pe(I);if(s&&!c&&fr(u)=="wrapper")var c=new Oe([],!0)}for(r=c?r:n;++r<n;){u=t[r];var h=fr(u),g=h=="wrapper"?Ii(u):i;g&&Ci(g[0])&&g[1]==(Qe|je|Xe|en)&&!g[4].length&&g[9]==1?c=c[fr(g[0])].apply(c,g[3]):c=u.length==1&&Ci(u)?c[h]():c.thru(u)}return function(){var _=arguments,y=_[0];if(c&&_.length==1&&$(y))return c.plant(y).value();for(var S=0,A=n?t[S].apply(this,_):y;++S<n;)A=t[S].call(this,A);return A}})}function or(e,t,n,r,s,u,c,h,g,_){var y=t&Qe,S=t&Be,A=t&Ut,C=t&(je|Xt),F=t&Ir,D=A?i:wn(e);function P(){for(var k=arguments.length,H=v(k),be=k;be--;)H[be]=arguments[be];if(C)var me=Vt(P),Ce=Il(H,me);if(r&&(H=Aa(H,r,s,C)),u&&(H=Ea(H,u,c,C)),k-=Ce,C&&k<_){var ie=gt(H,me);return La(e,t,or,P.placeholder,n,H,ie,h,g,_-k)}var ze=S?n:this,lt=A?ze[e]:e;return k=H.length,h?H=Of(H,h):F&&k>1&&H.reverse(),y&&g<k&&(H.length=g),this&&this!==ce&&this instanceof P&&(lt=D||wn(lt)),lt.apply(ze,H)}return P}function Pa(e,t){return function(n,r){return Mc(n,e,t(r),{})}}function ur(e,t){return function(n,r){var s;if(n===i&&r===i)return t;if(n!==i&&(s=n),r!==i){if(s===i)return r;typeof n=="string"||typeof r=="string"?(n=Ae(n),r=Ae(r)):(n=va(n),r=va(r)),s=e(n,r)}return s}}function yi(e){return st(function(t){return t=ee(t,Ie(R())),M(function(n){var r=this;return e(t,function(s){return xe(s,r,n)})})})}function lr(e,t){t=t===i?" ":Ae(t);var n=t.length;if(n<2)return n?hi(t,e):t;var r=hi(t,Jn(e/Bt(t)));return Mt(t)?wt(qe(r),0,e).join(""):r.slice(0,e)}function pf(e,t,n,r){var s=t&Be,u=wn(e);function c(){for(var h=-1,g=arguments.length,_=-1,y=r.length,S=v(y+g),A=this&&this!==ce&&this instanceof c?u:e;++_<y;)S[_]=r[_];for(;g--;)S[_++]=arguments[++h];return xe(A,s?n:this,S)}return c}function Oa(e){return function(t,n,r){return r&&typeof r!="number"&&ve(t,n,r)&&(n=r=i),t=ut(t),n===i?(n=t,t=0):n=ut(n),r=r===i?t<n?1:-1:ut(r),jc(t,n,r,e)}}function cr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ne(t),n=Ne(n)),e(t,n)}}function La(e,t,n,r,s,u,c,h,g,_){var y=t&je,S=y?c:i,A=y?i:c,C=y?u:i,F=y?i:u;t|=y?Xe:Qt,t&=~(y?Qt:Xe),t&ji||(t&=-4);var D=[e,t,s,C,S,F,A,h,g,_],P=n.apply(i,D);return Ci(e)&&Ka(P,D),P.placeholder=r,za(P,e,t)}function wi(e){var t=ae[e];return function(n,r){if(n=Ne(n),r=r==null?0:he(N(r),292),r&&zs(n)){var s=(Y(n)+"e").split("e"),u=t(s[0]+"e"+(+s[1]+r));return s=(Y(u)+"e").split("e"),+(s[0]+"e"+(+s[1]-r))}return t(n)}}var df=qt&&1/Mn(new qt([,-0]))[1]==At?function(e){return new qt(e)}:Gi;function Ua(e){return function(t){var n=pe(t);return n==ke?Zr(t):n==Ge?Fl(t):xl(t,e(t))}}function it(e,t,n,r,s,u,c,h){var g=t&Ut;if(!g&&typeof e!="function")throw new Pe(I);var _=r?r.length:0;if(_||(t&=-97,r=s=i),c=c===i?c:oe(N(c),0),h=h===i?h:N(h),_-=s?s.length:0,t&Qt){var y=r,S=s;r=s=i}var A=g?i:Ii(e),C=[e,t,n,r,s,y,S,u,c,h];if(A&&Tf(C,A),e=C[0],t=C[1],n=C[2],r=C[3],s=C[4],h=C[9]=C[9]===i?g?0:e.length:oe(C[9]-_,0),!h&&t&(je|Xt)&&(t&=-25),!t||t==Be)var F=ff(e,t,n);else t==je||t==Xt?F=hf(e,t,h):(t==Xe||t==(Be|Xe))&&!s.length?F=pf(e,t,n,r):F=or.apply(i,C);var D=A?da:Ka;return za(D(F,C),e,t)}function $a(e,t,n,r){return e===i||Ke(e,Gt[n])&&!V.call(r,n)?t:e}function Na(e,t,n,r,s,u){return te(e)&&te(t)&&(u.set(t,e),rr(e,t,i,Na,u),u.delete(t)),e}function gf(e){return In(e)?i:e}function Da(e,t,n,r,s,u){var c=n&Me,h=e.length,g=t.length;if(h!=g&&!(c&&g>h))return!1;var _=u.get(e),y=u.get(t);if(_&&y)return _==t&&y==e;var S=-1,A=!0,C=n&Rn?new Rt:i;for(u.set(e,t),u.set(t,e);++S<h;){var F=e[S],D=t[S];if(r)var P=c?r(D,F,S,t,e,u):r(F,D,S,e,t,u);if(P!==i){if(P)continue;A=!1;break}if(C){if(!Hr(t,function(k,H){if(!ln(C,H)&&(F===k||s(F,k,n,r,u)))return C.push(H)})){A=!1;break}}else if(!(F===D||s(F,D,n,r,u))){A=!1;break}}return u.delete(e),u.delete(t),A}function vf(e,t,n,r,s,u,c){switch(n){case Nt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case un:return!(e.byteLength!=t.byteLength||!u(new Kn(e),new Kn(t)));case tn:case nn:case rn:return Ke(+e,+t);case Pn:return e.name==t.name&&e.message==t.message;case sn:case an:return e==t+"";case ke:var h=Zr;case Ge:var g=r&Me;if(h||(h=Mn),e.size!=t.size&&!g)return!1;var _=c.get(e);if(_)return _==t;r|=Rn,c.set(e,t);var y=Da(h(e),h(t),r,s,u,c);return c.delete(e),y;case Ln:if(dn)return dn.call(e)==dn.call(t)}return!1}function mf(e,t,n,r,s,u){var c=n&Me,h=Si(e),g=h.length,_=Si(t),y=_.length;if(g!=y&&!c)return!1;for(var S=g;S--;){var A=h[S];if(!(c?A in t:V.call(t,A)))return!1}var C=u.get(e),F=u.get(t);if(C&&F)return C==t&&F==e;var D=!0;u.set(e,t),u.set(t,e);for(var P=c;++S<g;){A=h[S];var k=e[A],H=t[A];if(r)var be=c?r(H,k,A,t,e,u):r(k,H,A,e,t,u);if(!(be===i?k===H||s(k,H,n,r,u):be)){D=!1;break}P||(P=A=="constructor")}if(D&&!P){var me=e.constructor,Ce=t.constructor;me!=Ce&&"constructor"in e&&"constructor"in t&&!(typeof me=="function"&&me instanceof me&&typeof Ce=="function"&&Ce instanceof Ce)&&(D=!1)}return u.delete(e),u.delete(t),D}function st(e){return Ti(qa(e,i,Xa),e+"")}function Si(e){return ra(e,le,Ei)}function xi(e){return ra(e,we,Wa)}var Ii=jn?function(e){return jn.get(e)}:Gi;function fr(e){for(var t=e.name+"",n=Ht[t],r=V.call(Ht,t)?n.length:0;r--;){var s=n[r],u=s.func;if(u==null||u==e)return s.name}return t}function Vt(e){var t=V.call(o,"placeholder")?o:e;return t.placeholder}function R(){var e=o.iteratee||Bi;return e=e===Bi?aa:e,arguments.length?e(arguments[0],arguments[1]):e}function hr(e,t){var n=e.__data__;return Ef(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ai(e){for(var t=le(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,ka(s)]}return t}function Pt(e,t){var n=Cl(e,t);return sa(n)?n:i}function _f(e){var t=V.call(e,bt),n=e[bt];try{e[bt]=i;var r=!0}catch{}var s=qn.call(e);return r&&(t?e[bt]=n:delete e[bt]),s}var Ei=Xr?function(e){return e==null?[]:(e=J(e),pt(Xr(e),function(t){return Hs.call(e,t)}))}:qi,Wa=Xr?function(e){for(var t=[];e;)dt(t,Ei(e)),e=zn(e);return t}:qi,pe=ge;(Qr&&pe(new Qr(new ArrayBuffer(1)))!=Nt||fn&&pe(new fn)!=ke||ei&&pe(ei.resolve())!=es||qt&&pe(new qt)!=Ge||hn&&pe(new hn)!=on)&&(pe=function(e){var t=ge(e),n=t==et?e.constructor:i,r=n?Ot(n):"";if(r)switch(r){case Ql:return Nt;case ec:return ke;case tc:return es;case nc:return Ge;case rc:return on}return t});function yf(e,t,n){for(var r=-1,s=n.length;++r<s;){var u=n[r],c=u.size;switch(u.type){case"drop":e+=c;break;case"dropRight":t-=c;break;case"take":t=he(t,e+c);break;case"takeRight":e=oe(e,t-c);break}}return{start:e,end:t}}function wf(e){var t=e.match(Eu);return t?t[1].split(bu):[]}function Ma(e,t,n){t=yt(t,e);for(var r=-1,s=t.length,u=!1;++r<s;){var c=Ze(t[r]);if(!(u=e!=null&&n(e,c)))break;e=e[c]}return u||++r!=s?u:(s=e==null?0:e.length,!!s&&yr(s)&&at(c,s)&&($(e)||Lt(e)))}function Sf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&V.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Ba(e){return typeof e.constructor=="function"&&!Sn(e)?Kt(zn(e)):{}}function xf(e,t,n){var r=e.constructor;switch(t){case un:return _i(e);case tn:case nn:return new r(+e);case Nt:return sf(e,n);case Ar:case Er:case br:case Cr:case Rr:case Tr:case Fr:case Pr:case Or:return xa(e,n);case ke:return new r;case rn:case an:return new r(e);case sn:return af(e);case Ge:return new r;case Ln:return of(e)}}function If(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Au,`{
9
+ */var iv=bn.exports,Po;function sv(){return Po||(Po=1,function(f,a){(function(){var i,l="4.17.21",p=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",x="Expected a function",G="Invalid `variable` option passed into `_.template`",W="__lodash_hash_undefined__",re=500,ee="__lodash_placeholder__",Z=1,ze=2,q=4,B=1,Xe=2,Me=1,Ut=2,Zi=4,je=8,en=16,Qe=32,tn=64,et=128,nn=256,xr=512,Vo=30,Zo="...",Jo=800,Xo=16,Ji=1,jo=2,Qo=3,At=1/0,pt=9007199254740991,eu=17976931348623157e292,Rn=NaN,Ye=4294967295,tu=Ye-1,nu=Ye>>>1,ru=[["ary",et],["bind",Me],["bindKey",Ut],["curry",je],["curryRight",en],["flip",xr],["partial",Qe],["partialRight",tn],["rearg",nn]],$t="[object Arguments]",Fn="[object Array]",iu="[object AsyncFunction]",rn="[object Boolean]",sn="[object Date]",su="[object DOMException]",Pn="[object Error]",On="[object Function]",Xi="[object GeneratorFunction]",Be="[object Map]",an="[object Number]",au="[object Null]",tt="[object Object]",ji="[object Promise]",ou="[object Proxy]",on="[object RegExp]",ke="[object Set]",un="[object String]",Ln="[object Symbol]",uu="[object Undefined]",ln="[object WeakMap]",lu="[object WeakSet]",cn="[object ArrayBuffer]",Dt="[object DataView]",Er="[object Float32Array]",Ar="[object Float64Array]",Ir="[object Int8Array]",Cr="[object Int16Array]",br="[object Int32Array]",Tr="[object Uint8Array]",Rr="[object Uint8ClampedArray]",Fr="[object Uint16Array]",Pr="[object Uint32Array]",cu=/\b__p \+= '';/g,fu=/\b(__p \+=) '' \+/g,hu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Qi=/&(?:amp|lt|gt|quot|#39);/g,es=/[&<>"']/g,pu=RegExp(Qi.source),du=RegExp(es.source),gu=/<%-([\s\S]+?)%>/g,vu=/<%([\s\S]+?)%>/g,ts=/<%=([\s\S]+?)%>/g,mu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_u=/^\w*$/,yu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Or=/[\\^$.*+?()[\]{}|]/g,wu=RegExp(Or.source),Lr=/^\s+/,Su=/\s/,xu=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Eu=/\{\n\/\* \[wrapped with (.+)\] \*/,Au=/,? & /,Iu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Cu=/[()=,{}\[\]\/\s]/,bu=/\\(\\)?/g,Tu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ns=/\w*$/,Ru=/^[-+]0x[0-9a-f]+$/i,Fu=/^0b[01]+$/i,Pu=/^\[object .+?Constructor\]$/,Ou=/^0o[0-7]+$/i,Lu=/^(?:0|[1-9]\d*)$/,Nu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Nn=/($^)/,Uu=/['\n\r\u2028\u2029\\]/g,Un="\\ud800-\\udfff",$u="\\u0300-\\u036f",Du="\\ufe20-\\ufe2f",Wu="\\u20d0-\\u20ff",rs=$u+Du+Wu,is="\\u2700-\\u27bf",ss="a-z\\xdf-\\xf6\\xf8-\\xff",Mu="\\xac\\xb1\\xd7\\xf7",Bu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ku="\\u2000-\\u206f",Gu=" \\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",as="A-Z\\xc0-\\xd6\\xd8-\\xde",os="\\ufe0e\\ufe0f",us=Mu+Bu+ku+Gu,Nr="['’]",qu="["+Un+"]",ls="["+us+"]",$n="["+rs+"]",cs="\\d+",Hu="["+is+"]",fs="["+ss+"]",hs="[^"+Un+us+cs+is+ss+as+"]",Ur="\\ud83c[\\udffb-\\udfff]",Ku="(?:"+$n+"|"+Ur+")",ps="[^"+Un+"]",$r="(?:\\ud83c[\\udde6-\\uddff]){2}",Dr="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+as+"]",ds="\\u200d",gs="(?:"+fs+"|"+hs+")",zu="(?:"+Wt+"|"+hs+")",vs="(?:"+Nr+"(?:d|ll|m|re|s|t|ve))?",ms="(?:"+Nr+"(?:D|LL|M|RE|S|T|VE))?",_s=Ku+"?",ys="["+os+"]?",Yu="(?:"+ds+"(?:"+[ps,$r,Dr].join("|")+")"+ys+_s+")*",Vu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ws=ys+_s+Yu,Ju="(?:"+[Hu,$r,Dr].join("|")+")"+ws,Xu="(?:"+[ps+$n+"?",$n,$r,Dr,qu].join("|")+")",ju=RegExp(Nr,"g"),Qu=RegExp($n,"g"),Wr=RegExp(Ur+"(?="+Ur+")|"+Xu+ws,"g"),el=RegExp([Wt+"?"+fs+"+"+vs+"(?="+[ls,Wt,"$"].join("|")+")",zu+"+"+ms+"(?="+[ls,Wt+gs,"$"].join("|")+")",Wt+"?"+gs+"+"+vs,Wt+"+"+ms,Zu,Vu,cs,Ju].join("|"),"g"),tl=RegExp("["+ds+Un+rs+os+"]"),nl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rl=["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"],il=-1,X={};X[Er]=X[Ar]=X[Ir]=X[Cr]=X[br]=X[Tr]=X[Rr]=X[Fr]=X[Pr]=!0,X[$t]=X[Fn]=X[cn]=X[rn]=X[Dt]=X[sn]=X[Pn]=X[On]=X[Be]=X[an]=X[tt]=X[on]=X[ke]=X[un]=X[ln]=!1;var J={};J[$t]=J[Fn]=J[cn]=J[Dt]=J[rn]=J[sn]=J[Er]=J[Ar]=J[Ir]=J[Cr]=J[br]=J[Be]=J[an]=J[tt]=J[on]=J[ke]=J[un]=J[Ln]=J[Tr]=J[Rr]=J[Fr]=J[Pr]=!0,J[Pn]=J[On]=J[ln]=!1;var sl={À:"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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ol={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ul={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ll=parseFloat,cl=parseInt,Ss=typeof P.commonjsGlobal=="object"&&P.commonjsGlobal&&P.commonjsGlobal.Object===Object&&P.commonjsGlobal,fl=typeof self=="object"&&self&&self.Object===Object&&self,ce=Ss||fl||Function("return this")(),Mr=a&&!a.nodeType&&a,It=Mr&&!0&&f&&!f.nodeType&&f,xs=It&&It.exports===Mr,Br=xs&&Ss.process,Re=function(){try{var d=It&&It.require&&It.require("util").types;return d||Br&&Br.binding&&Br.binding("util")}catch{}}(),Es=Re&&Re.isArrayBuffer,As=Re&&Re.isDate,Is=Re&&Re.isMap,Cs=Re&&Re.isRegExp,bs=Re&&Re.isSet,Ts=Re&&Re.isTypedArray;function xe(d,m,v){switch(v.length){case 0:return d.call(m);case 1:return d.call(m,v[0]);case 2:return d.call(m,v[0],v[1]);case 3:return d.call(m,v[0],v[1],v[2])}return d.apply(m,v)}function hl(d,m,v,C){for(var L=-1,K=d==null?0:d.length;++L<K;){var oe=d[L];m(C,oe,v(oe),d)}return C}function Fe(d,m){for(var v=-1,C=d==null?0:d.length;++v<C&&m(d[v],v,d)!==!1;);return d}function pl(d,m){for(var v=d==null?0:d.length;v--&&m(d[v],v,d)!==!1;);return d}function Rs(d,m){for(var v=-1,C=d==null?0:d.length;++v<C;)if(!m(d[v],v,d))return!1;return!0}function dt(d,m){for(var v=-1,C=d==null?0:d.length,L=0,K=[];++v<C;){var oe=d[v];m(oe,v,d)&&(K[L++]=oe)}return K}function Dn(d,m){var v=d==null?0:d.length;return!!v&&Mt(d,m,0)>-1}function kr(d,m,v){for(var C=-1,L=d==null?0:d.length;++C<L;)if(v(m,d[C]))return!0;return!1}function Q(d,m){for(var v=-1,C=d==null?0:d.length,L=Array(C);++v<C;)L[v]=m(d[v],v,d);return L}function gt(d,m){for(var v=-1,C=m.length,L=d.length;++v<C;)d[L+v]=m[v];return d}function Gr(d,m,v,C){var L=-1,K=d==null?0:d.length;for(C&&K&&(v=d[++L]);++L<K;)v=m(v,d[L],L,d);return v}function dl(d,m,v,C){var L=d==null?0:d.length;for(C&&L&&(v=d[--L]);L--;)v=m(v,d[L],L,d);return v}function qr(d,m){for(var v=-1,C=d==null?0:d.length;++v<C;)if(m(d[v],v,d))return!0;return!1}var gl=Hr("length");function vl(d){return d.split("")}function ml(d){return d.match(Iu)||[]}function Fs(d,m,v){var C;return v(d,function(L,K,oe){if(m(L,K,oe))return C=K,!1}),C}function Wn(d,m,v,C){for(var L=d.length,K=v+(C?1:-1);C?K--:++K<L;)if(m(d[K],K,d))return K;return-1}function Mt(d,m,v){return m===m?Rl(d,m,v):Wn(d,Ps,v)}function _l(d,m,v,C){for(var L=v-1,K=d.length;++L<K;)if(C(d[L],m))return L;return-1}function Ps(d){return d!==d}function Os(d,m){var v=d==null?0:d.length;return v?zr(d,m)/v:Rn}function Hr(d){return function(m){return m==null?i:m[d]}}function Kr(d){return function(m){return d==null?i:d[m]}}function Ls(d,m,v,C,L){return L(d,function(K,oe,V){v=C?(C=!1,K):m(v,K,oe,V)}),v}function yl(d,m){var v=d.length;for(d.sort(m);v--;)d[v]=d[v].value;return d}function zr(d,m){for(var v,C=-1,L=d.length;++C<L;){var K=m(d[C]);K!==i&&(v=v===i?K:v+K)}return v}function Yr(d,m){for(var v=-1,C=Array(d);++v<d;)C[v]=m(v);return C}function wl(d,m){return Q(m,function(v){return[v,d[v]]})}function Ns(d){return d&&d.slice(0,Ws(d)+1).replace(Lr,"")}function Ee(d){return function(m){return d(m)}}function Vr(d,m){return Q(m,function(v){return d[v]})}function fn(d,m){return d.has(m)}function Us(d,m){for(var v=-1,C=d.length;++v<C&&Mt(m,d[v],0)>-1;);return v}function $s(d,m){for(var v=d.length;v--&&Mt(m,d[v],0)>-1;);return v}function Sl(d,m){for(var v=d.length,C=0;v--;)d[v]===m&&++C;return C}var xl=Kr(sl),El=Kr(al);function Al(d){return"\\"+ul[d]}function Il(d,m){return d==null?i:d[m]}function Bt(d){return tl.test(d)}function Cl(d){return nl.test(d)}function bl(d){for(var m,v=[];!(m=d.next()).done;)v.push(m.value);return v}function Zr(d){var m=-1,v=Array(d.size);return d.forEach(function(C,L){v[++m]=[L,C]}),v}function Ds(d,m){return function(v){return d(m(v))}}function vt(d,m){for(var v=-1,C=d.length,L=0,K=[];++v<C;){var oe=d[v];(oe===m||oe===ee)&&(d[v]=ee,K[L++]=v)}return K}function Mn(d){var m=-1,v=Array(d.size);return d.forEach(function(C){v[++m]=C}),v}function Tl(d){var m=-1,v=Array(d.size);return d.forEach(function(C){v[++m]=[C,C]}),v}function Rl(d,m,v){for(var C=v-1,L=d.length;++C<L;)if(d[C]===m)return C;return-1}function Fl(d,m,v){for(var C=v+1;C--;)if(d[C]===m)return C;return C}function kt(d){return Bt(d)?Ol(d):gl(d)}function Ge(d){return Bt(d)?Ll(d):vl(d)}function Ws(d){for(var m=d.length;m--&&Su.test(d.charAt(m)););return m}var Pl=Kr(ol);function Ol(d){for(var m=Wr.lastIndex=0;Wr.test(d);)++m;return m}function Ll(d){return d.match(Wr)||[]}function Nl(d){return d.match(el)||[]}var Ul=function d(m){m=m==null?ce:Gt.defaults(ce.Object(),m,Gt.pick(ce,rl));var v=m.Array,C=m.Date,L=m.Error,K=m.Function,oe=m.Math,V=m.Object,Jr=m.RegExp,$l=m.String,Pe=m.TypeError,Bn=v.prototype,Dl=K.prototype,qt=V.prototype,kn=m["__core-js_shared__"],Gn=Dl.toString,Y=qt.hasOwnProperty,Wl=0,Ms=function(){var e=/[^.]+$/.exec(kn&&kn.keys&&kn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),qn=qt.toString,Ml=Gn.call(V),Bl=ce._,kl=Jr("^"+Gn.call(Y).replace(Or,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=xs?m.Buffer:i,mt=m.Symbol,Kn=m.Uint8Array,Bs=Hn?Hn.allocUnsafe:i,zn=Ds(V.getPrototypeOf,V),ks=V.create,Gs=qt.propertyIsEnumerable,Yn=Bn.splice,qs=mt?mt.isConcatSpreadable:i,hn=mt?mt.iterator:i,Ct=mt?mt.toStringTag:i,Vn=function(){try{var e=Pt(V,"defineProperty");return e({},"",{}),e}catch{}}(),Gl=m.clearTimeout!==ce.clearTimeout&&m.clearTimeout,ql=C&&C.now!==ce.Date.now&&C.now,Hl=m.setTimeout!==ce.setTimeout&&m.setTimeout,Zn=oe.ceil,Jn=oe.floor,Xr=V.getOwnPropertySymbols,Kl=Hn?Hn.isBuffer:i,Hs=m.isFinite,zl=Bn.join,Yl=Ds(V.keys,V),ue=oe.max,he=oe.min,Vl=C.now,Zl=m.parseInt,Ks=oe.random,Jl=Bn.reverse,jr=Pt(m,"DataView"),pn=Pt(m,"Map"),Qr=Pt(m,"Promise"),Ht=Pt(m,"Set"),dn=Pt(m,"WeakMap"),gn=Pt(V,"create"),Xn=dn&&new dn,Kt={},Xl=Ot(jr),jl=Ot(pn),Ql=Ot(Qr),ec=Ot(Ht),tc=Ot(dn),jn=mt?mt.prototype:i,vn=jn?jn.valueOf:i,zs=jn?jn.toString:i;function o(e){if(ne(e)&&!N(e)&&!(e instanceof k)){if(e instanceof Oe)return e;if(Y.call(e,"__wrapped__"))return Ya(e)}return new Oe(e)}var zt=function(){function e(){}return function(t){if(!te(t))return{};if(ks)return ks(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Qn(){}function Oe(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}o.templateSettings={escape:gu,evaluate:vu,interpolate:ts,variable:"",imports:{_:o}},o.prototype=Qn.prototype,o.prototype.constructor=o,Oe.prototype=zt(Qn.prototype),Oe.prototype.constructor=Oe;function k(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ye,this.__views__=[]}function nc(){var e=new k(this.__wrapped__);return e.__actions__=_e(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=_e(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=_e(this.__views__),e}function rc(){if(this.__filtered__){var e=new k(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function ic(){var e=this.__wrapped__.value(),t=this.__dir__,n=N(e),r=t<0,s=n?e.length:0,u=mf(0,s,this.__views__),c=u.start,h=u.end,g=h-c,_=r?h:c-1,w=this.__iteratees__,S=w.length,I=0,b=he(g,this.__takeCount__);if(!n||!r&&s==g&&b==g)return va(e,this.__actions__);var R=[];e:for(;g--&&I<b;){_+=t;for(var $=-1,F=e[_];++$<S;){var M=w[$],H=M.iteratee,Ce=M.type,me=H(F);if(Ce==jo)F=me;else if(!me){if(Ce==Ji)continue e;break e}}R[I++]=F}return R}k.prototype=zt(Qn.prototype),k.prototype.constructor=k;function bt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function sc(){this.__data__=gn?gn(null):{},this.size=0}function ac(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function oc(e){var t=this.__data__;if(gn){var n=t[e];return n===W?i:n}return Y.call(t,e)?t[e]:i}function uc(e){var t=this.__data__;return gn?t[e]!==i:Y.call(t,e)}function lc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&t===i?W:t,this}bt.prototype.clear=sc,bt.prototype.delete=ac,bt.prototype.get=oc,bt.prototype.has=uc,bt.prototype.set=lc;function nt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function cc(){this.__data__=[],this.size=0}function fc(e){var t=this.__data__,n=er(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Yn.call(t,n,1),--this.size,!0}function hc(e){var t=this.__data__,n=er(t,e);return n<0?i:t[n][1]}function pc(e){return er(this.__data__,e)>-1}function dc(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}nt.prototype.clear=cc,nt.prototype.delete=fc,nt.prototype.get=hc,nt.prototype.has=pc,nt.prototype.set=dc;function rt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function gc(){this.size=0,this.__data__={hash:new bt,map:new(pn||nt),string:new bt}}function vc(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}function mc(e){return hr(this,e).get(e)}function _c(e){return hr(this,e).has(e)}function yc(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}rt.prototype.clear=gc,rt.prototype.delete=vc,rt.prototype.get=mc,rt.prototype.has=_c,rt.prototype.set=yc;function Tt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new rt;++t<n;)this.add(e[t])}function wc(e){return this.__data__.set(e,W),this}function Sc(e){return this.__data__.has(e)}Tt.prototype.add=Tt.prototype.push=wc,Tt.prototype.has=Sc;function qe(e){var t=this.__data__=new nt(e);this.size=t.size}function xc(){this.__data__=new nt,this.size=0}function Ec(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ac(e){return this.__data__.get(e)}function Ic(e){return this.__data__.has(e)}function Cc(e,t){var n=this.__data__;if(n instanceof nt){var r=n.__data__;if(!pn||r.length<p-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new rt(r)}return n.set(e,t),this.size=n.size,this}qe.prototype.clear=xc,qe.prototype.delete=Ec,qe.prototype.get=Ac,qe.prototype.has=Ic,qe.prototype.set=Cc;function Ys(e,t){var n=N(e),r=!n&&Lt(e),s=!n&&!r&&xt(e),u=!n&&!r&&!s&&Jt(e),c=n||r||s||u,h=c?Yr(e.length,$l):[],g=h.length;for(var _ in e)(t||Y.call(e,_))&&!(c&&(_=="length"||s&&(_=="offset"||_=="parent")||u&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||ot(_,g)))&&h.push(_);return h}function Vs(e){var t=e.length;return t?e[ci(0,t-1)]:i}function bc(e,t){return pr(_e(e),Rt(t,0,e.length))}function Tc(e){return pr(_e(e))}function ei(e,t,n){(n!==i&&!He(e[t],n)||n===i&&!(t in e))&&it(e,t,n)}function mn(e,t,n){var r=e[t];(!(Y.call(e,t)&&He(r,n))||n===i&&!(t in e))&&it(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(He(e[n][0],t))return n;return-1}function Rc(e,t,n,r){return _t(e,function(s,u,c){t(r,s,n(s),c)}),r}function Zs(e,t){return e&&Ze(t,le(t),e)}function Fc(e,t){return e&&Ze(t,we(t),e)}function it(e,t,n){t=="__proto__"&&Vn?Vn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ti(e,t){for(var n=-1,r=t.length,s=v(r),u=e==null;++n<r;)s[n]=u?i:Ui(e,t[n]);return s}function Rt(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function Le(e,t,n,r,s,u){var c,h=t&Z,g=t&ze,_=t&q;if(n&&(c=s?n(e,r,s,u):n(e)),c!==i)return c;if(!te(e))return e;var w=N(e);if(w){if(c=yf(e),!h)return _e(e,c)}else{var S=pe(e),I=S==On||S==Xi;if(xt(e))return ya(e,h);if(S==tt||S==$t||I&&!s){if(c=g||I?{}:Wa(e),!h)return g?uf(e,Fc(c,e)):of(e,Zs(c,e))}else{if(!J[S])return s?e:{};c=wf(e,S,h)}}u||(u=new qe);var b=u.get(e);if(b)return b;u.set(e,c),po(e)?e.forEach(function(F){c.add(Le(F,t,n,F,e,u))}):fo(e)&&e.forEach(function(F,M){c.set(M,Le(F,t,n,M,e,u))});var R=_?g?Si:wi:g?we:le,$=w?i:R(e);return Fe($||e,function(F,M){$&&(M=F,F=e[M]),mn(c,M,Le(F,t,n,M,e,u))}),c}function Pc(e){var t=le(e);return function(n){return Js(n,e,t)}}function Js(e,t,n){var r=n.length;if(e==null)return!r;for(e=V(e);r--;){var s=n[r],u=t[s],c=e[s];if(c===i&&!(s in e)||!u(c))return!1}return!0}function Xs(e,t,n){if(typeof e!="function")throw new Pe(x);return An(function(){e.apply(i,n)},t)}function _n(e,t,n,r){var s=-1,u=Dn,c=!0,h=e.length,g=[],_=t.length;if(!h)return g;n&&(t=Q(t,Ee(n))),r?(u=kr,c=!1):t.length>=p&&(u=fn,c=!1,t=new Tt(t));e:for(;++s<h;){var w=e[s],S=n==null?w:n(w);if(w=r||w!==0?w:0,c&&S===S){for(var I=_;I--;)if(t[I]===S)continue e;g.push(w)}else u(t,S,r)||g.push(w)}return g}var _t=Aa(Ve),js=Aa(ri,!0);function Oc(e,t){var n=!0;return _t(e,function(r,s,u){return n=!!t(r,s,u),n}),n}function tr(e,t,n){for(var r=-1,s=e.length;++r<s;){var u=e[r],c=t(u);if(c!=null&&(h===i?c===c&&!Ie(c):n(c,h)))var h=c,g=u}return g}function Lc(e,t,n,r){var s=e.length;for(n=U(n),n<0&&(n=-n>s?0:s+n),r=r===i||r>s?s:U(r),r<0&&(r+=s),r=n>r?0:vo(r);n<r;)e[n++]=t;return e}function Qs(e,t){var n=[];return _t(e,function(r,s,u){t(r,s,u)&&n.push(r)}),n}function fe(e,t,n,r,s){var u=-1,c=e.length;for(n||(n=xf),s||(s=[]);++u<c;){var h=e[u];t>0&&n(h)?t>1?fe(h,t-1,n,r,s):gt(s,h):r||(s[s.length]=h)}return s}var ni=Ia(),ea=Ia(!0);function Ve(e,t){return e&&ni(e,t,le)}function ri(e,t){return e&&ea(e,t,le)}function nr(e,t){return dt(t,function(n){return ut(e[n])})}function Ft(e,t){t=wt(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Je(t[n++])];return n&&n==r?e:i}function ta(e,t,n){var r=t(e);return N(e)?r:gt(r,n(e))}function ge(e){return e==null?e===i?uu:au:Ct&&Ct in V(e)?vf(e):Rf(e)}function ii(e,t){return e>t}function Nc(e,t){return e!=null&&Y.call(e,t)}function Uc(e,t){return e!=null&&t in V(e)}function $c(e,t,n){return e>=he(t,n)&&e<ue(t,n)}function si(e,t,n){for(var r=n?kr:Dn,s=e[0].length,u=e.length,c=u,h=v(u),g=1/0,_=[];c--;){var w=e[c];c&&t&&(w=Q(w,Ee(t))),g=he(w.length,g),h[c]=!n&&(t||s>=120&&w.length>=120)?new Tt(c&&w):i}w=e[0];var S=-1,I=h[0];e:for(;++S<s&&_.length<g;){var b=w[S],R=t?t(b):b;if(b=n||b!==0?b:0,!(I?fn(I,R):r(_,R,n))){for(c=u;--c;){var $=h[c];if(!($?fn($,R):r(e[c],R,n)))continue e}I&&I.push(R),_.push(b)}}return _}function Dc(e,t,n,r){return Ve(e,function(s,u,c){t(r,n(s),u,c)}),r}function yn(e,t,n){t=wt(t,e),e=Ga(e,t);var r=e==null?e:e[Je(Ue(t))];return r==null?i:xe(r,e,n)}function na(e){return ne(e)&&ge(e)==$t}function Wc(e){return ne(e)&&ge(e)==cn}function Mc(e){return ne(e)&&ge(e)==sn}function wn(e,t,n,r,s){return e===t?!0:e==null||t==null||!ne(e)&&!ne(t)?e!==e&&t!==t:Bc(e,t,n,r,wn,s)}function Bc(e,t,n,r,s,u){var c=N(e),h=N(t),g=c?Fn:pe(e),_=h?Fn:pe(t);g=g==$t?tt:g,_=_==$t?tt:_;var w=g==tt,S=_==tt,I=g==_;if(I&&xt(e)){if(!xt(t))return!1;c=!0,w=!1}if(I&&!w)return u||(u=new qe),c||Jt(e)?Ua(e,t,n,r,s,u):df(e,t,g,n,r,s,u);if(!(n&B)){var b=w&&Y.call(e,"__wrapped__"),R=S&&Y.call(t,"__wrapped__");if(b||R){var $=b?e.value():e,F=R?t.value():t;return u||(u=new qe),s($,F,n,r,u)}}return I?(u||(u=new qe),gf(e,t,n,r,s,u)):!1}function kc(e){return ne(e)&&pe(e)==Be}function ai(e,t,n,r){var s=n.length,u=s,c=!r;if(e==null)return!u;for(e=V(e);s--;){var h=n[s];if(c&&h[2]?h[1]!==e[h[0]]:!(h[0]in e))return!1}for(;++s<u;){h=n[s];var g=h[0],_=e[g],w=h[1];if(c&&h[2]){if(_===i&&!(g in e))return!1}else{var S=new qe;if(r)var I=r(_,w,g,e,t,S);if(!(I===i?wn(w,_,B|Xe,r,S):I))return!1}}return!0}function ra(e){if(!te(e)||Af(e))return!1;var t=ut(e)?kl:Pu;return t.test(Ot(e))}function Gc(e){return ne(e)&&ge(e)==on}function qc(e){return ne(e)&&pe(e)==ke}function Hc(e){return ne(e)&&yr(e.length)&&!!X[ge(e)]}function ia(e){return typeof e=="function"?e:e==null?Se:typeof e=="object"?N(e)?oa(e[0],e[1]):aa(e):bo(e)}function oi(e){if(!En(e))return Yl(e);var t=[];for(var n in V(e))Y.call(e,n)&&n!="constructor"&&t.push(n);return t}function Kc(e){if(!te(e))return Tf(e);var t=En(e),n=[];for(var r in e)r=="constructor"&&(t||!Y.call(e,r))||n.push(r);return n}function ui(e,t){return e<t}function sa(e,t){var n=-1,r=ye(e)?v(e.length):[];return _t(e,function(s,u,c){r[++n]=t(s,u,c)}),r}function aa(e){var t=Ei(e);return t.length==1&&t[0][2]?Ba(t[0][0],t[0][1]):function(n){return n===e||ai(n,e,t)}}function oa(e,t){return Ii(e)&&Ma(t)?Ba(Je(e),t):function(n){var r=Ui(n,e);return r===i&&r===t?$i(n,e):wn(t,r,B|Xe)}}function rr(e,t,n,r,s){e!==t&&ni(t,function(u,c){if(s||(s=new qe),te(u))zc(e,t,c,n,rr,r,s);else{var h=r?r(bi(e,c),u,c+"",e,t,s):i;h===i&&(h=u),ei(e,c,h)}},we)}function zc(e,t,n,r,s,u,c){var h=bi(e,n),g=bi(t,n),_=c.get(g);if(_){ei(e,n,_);return}var w=u?u(h,g,n+"",e,t,c):i,S=w===i;if(S){var I=N(g),b=!I&&xt(g),R=!I&&!b&&Jt(g);w=g,I||b||R?N(h)?w=h:ie(h)?w=_e(h):b?(S=!1,w=ya(g,!0)):R?(S=!1,w=wa(g,!0)):w=[]:In(g)||Lt(g)?(w=h,Lt(h)?w=mo(h):(!te(h)||ut(h))&&(w=Wa(g))):S=!1}S&&(c.set(g,w),s(w,g,r,u,c),c.delete(g)),ei(e,n,w)}function ua(e,t){var n=e.length;if(n)return t+=t<0?n:0,ot(t,n)?e[t]:i}function la(e,t,n){t.length?t=Q(t,function(u){return N(u)?function(c){return Ft(c,u.length===1?u[0]:u)}:u}):t=[Se];var r=-1;t=Q(t,Ee(T()));var s=sa(e,function(u,c,h){var g=Q(t,function(_){return _(u)});return{criteria:g,index:++r,value:u}});return yl(s,function(u,c){return af(u,c,n)})}function Yc(e,t){return ca(e,t,function(n,r){return $i(e,r)})}function ca(e,t,n){for(var r=-1,s=t.length,u={};++r<s;){var c=t[r],h=Ft(e,c);n(h,c)&&Sn(u,wt(c,e),h)}return u}function Vc(e){return function(t){return Ft(t,e)}}function li(e,t,n,r){var s=r?_l:Mt,u=-1,c=t.length,h=e;for(e===t&&(t=_e(t)),n&&(h=Q(e,Ee(n)));++u<c;)for(var g=0,_=t[u],w=n?n(_):_;(g=s(h,w,g,r))>-1;)h!==e&&Yn.call(h,g,1),Yn.call(e,g,1);return e}function fa(e,t){for(var n=e?t.length:0,r=n-1;n--;){var s=t[n];if(n==r||s!==u){var u=s;ot(s)?Yn.call(e,s,1):pi(e,s)}}return e}function ci(e,t){return e+Jn(Ks()*(t-e+1))}function Zc(e,t,n,r){for(var s=-1,u=ue(Zn((t-e)/(n||1)),0),c=v(u);u--;)c[r?u:++s]=e,e+=n;return c}function fi(e,t){var n="";if(!e||t<1||t>pt)return n;do t%2&&(n+=e),t=Jn(t/2),t&&(e+=e);while(t);return n}function D(e,t){return Ti(ka(e,t,Se),e+"")}function Jc(e){return Vs(Xt(e))}function Xc(e,t){var n=Xt(e);return pr(n,Rt(t,0,n.length))}function Sn(e,t,n,r){if(!te(e))return e;t=wt(t,e);for(var s=-1,u=t.length,c=u-1,h=e;h!=null&&++s<u;){var g=Je(t[s]),_=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(s!=c){var w=h[g];_=r?r(w,g,h):i,_===i&&(_=te(w)?w:ot(t[s+1])?[]:{})}mn(h,g,_),h=h[g]}return e}var ha=Xn?function(e,t){return Xn.set(e,t),e}:Se,jc=Vn?function(e,t){return Vn(e,"toString",{configurable:!0,enumerable:!1,value:Wi(t),writable:!0})}:Se;function Qc(e){return pr(Xt(e))}function Ne(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var u=v(s);++r<s;)u[r]=e[r+t];return u}function ef(e,t){var n;return _t(e,function(r,s,u){return n=t(r,s,u),!n}),!!n}function ir(e,t,n){var r=0,s=e==null?r:e.length;if(typeof t=="number"&&t===t&&s<=nu){for(;r<s;){var u=r+s>>>1,c=e[u];c!==null&&!Ie(c)&&(n?c<=t:c<t)?r=u+1:s=u}return s}return hi(e,t,Se,n)}function hi(e,t,n,r){var s=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var c=t!==t,h=t===null,g=Ie(t),_=t===i;s<u;){var w=Jn((s+u)/2),S=n(e[w]),I=S!==i,b=S===null,R=S===S,$=Ie(S);if(c)var F=r||R;else _?F=R&&(r||I):h?F=R&&I&&(r||!b):g?F=R&&I&&!b&&(r||!$):b||$?F=!1:F=r?S<=t:S<t;F?s=w+1:u=w}return he(u,tu)}function pa(e,t){for(var n=-1,r=e.length,s=0,u=[];++n<r;){var c=e[n],h=t?t(c):c;if(!n||!He(h,g)){var g=h;u[s++]=c===0?0:c}}return u}function da(e){return typeof e=="number"?e:Ie(e)?Rn:+e}function Ae(e){if(typeof e=="string")return e;if(N(e))return Q(e,Ae)+"";if(Ie(e))return zs?zs.call(e):"";var t=e+"";return t=="0"&&1/e==-At?"-0":t}function yt(e,t,n){var r=-1,s=Dn,u=e.length,c=!0,h=[],g=h;if(n)c=!1,s=kr;else if(u>=p){var _=t?null:hf(e);if(_)return Mn(_);c=!1,s=fn,g=new Tt}else g=t?[]:h;e:for(;++r<u;){var w=e[r],S=t?t(w):w;if(w=n||w!==0?w:0,c&&S===S){for(var I=g.length;I--;)if(g[I]===S)continue e;t&&g.push(S),h.push(w)}else s(g,S,n)||(g!==h&&g.push(S),h.push(w))}return h}function pi(e,t){return t=wt(t,e),e=Ga(e,t),e==null||delete e[Je(Ue(t))]}function ga(e,t,n,r){return Sn(e,t,n(Ft(e,t)),r)}function sr(e,t,n,r){for(var s=e.length,u=r?s:-1;(r?u--:++u<s)&&t(e[u],u,e););return n?Ne(e,r?0:u,r?u+1:s):Ne(e,r?u+1:0,r?s:u)}function va(e,t){var n=e;return n instanceof k&&(n=n.value()),Gr(t,function(r,s){return s.func.apply(s.thisArg,gt([r],s.args))},n)}function di(e,t,n){var r=e.length;if(r<2)return r?yt(e[0]):[];for(var s=-1,u=v(r);++s<r;)for(var c=e[s],h=-1;++h<r;)h!=s&&(u[s]=_n(u[s]||c,e[h],t,n));return yt(fe(u,1),t,n)}function ma(e,t,n){for(var r=-1,s=e.length,u=t.length,c={};++r<s;){var h=r<u?t[r]:i;n(c,e[r],h)}return c}function gi(e){return ie(e)?e:[]}function vi(e){return typeof e=="function"?e:Se}function wt(e,t){return N(e)?e:Ii(e,t)?[e]:za(z(e))}var tf=D;function St(e,t,n){var r=e.length;return n=n===i?r:n,!t&&n>=r?e:Ne(e,t,n)}var _a=Gl||function(e){return ce.clearTimeout(e)};function ya(e,t){if(t)return e.slice();var n=e.length,r=Bs?Bs(n):new e.constructor(n);return e.copy(r),r}function mi(e){var t=new e.constructor(e.byteLength);return new Kn(t).set(new Kn(e)),t}function nf(e,t){var n=t?mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function rf(e){var t=new e.constructor(e.source,ns.exec(e));return t.lastIndex=e.lastIndex,t}function sf(e){return vn?V(vn.call(e)):{}}function wa(e,t){var n=t?mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Sa(e,t){if(e!==t){var n=e!==i,r=e===null,s=e===e,u=Ie(e),c=t!==i,h=t===null,g=t===t,_=Ie(t);if(!h&&!_&&!u&&e>t||u&&c&&g&&!h&&!_||r&&c&&g||!n&&g||!s)return 1;if(!r&&!u&&!_&&e<t||_&&n&&s&&!r&&!u||h&&n&&s||!c&&s||!g)return-1}return 0}function af(e,t,n){for(var r=-1,s=e.criteria,u=t.criteria,c=s.length,h=n.length;++r<c;){var g=Sa(s[r],u[r]);if(g){if(r>=h)return g;var _=n[r];return g*(_=="desc"?-1:1)}}return e.index-t.index}function xa(e,t,n,r){for(var s=-1,u=e.length,c=n.length,h=-1,g=t.length,_=ue(u-c,0),w=v(g+_),S=!r;++h<g;)w[h]=t[h];for(;++s<c;)(S||s<u)&&(w[n[s]]=e[s]);for(;_--;)w[h++]=e[s++];return w}function Ea(e,t,n,r){for(var s=-1,u=e.length,c=-1,h=n.length,g=-1,_=t.length,w=ue(u-h,0),S=v(w+_),I=!r;++s<w;)S[s]=e[s];for(var b=s;++g<_;)S[b+g]=t[g];for(;++c<h;)(I||s<u)&&(S[b+n[c]]=e[s++]);return S}function _e(e,t){var n=-1,r=e.length;for(t||(t=v(r));++n<r;)t[n]=e[n];return t}function Ze(e,t,n,r){var s=!n;n||(n={});for(var u=-1,c=t.length;++u<c;){var h=t[u],g=r?r(n[h],e[h],h,n,e):i;g===i&&(g=e[h]),s?it(n,h,g):mn(n,h,g)}return n}function of(e,t){return Ze(e,Ai(e),t)}function uf(e,t){return Ze(e,$a(e),t)}function ar(e,t){return function(n,r){var s=N(n)?hl:Rc,u=t?t():{};return s(n,e,T(r,2),u)}}function Yt(e){return D(function(t,n){var r=-1,s=n.length,u=s>1?n[s-1]:i,c=s>2?n[2]:i;for(u=e.length>3&&typeof u=="function"?(s--,u):i,c&&ve(n[0],n[1],c)&&(u=s<3?i:u,s=1),t=V(t);++r<s;){var h=n[r];h&&e(t,h,r,u)}return t})}function Aa(e,t){return function(n,r){if(n==null)return n;if(!ye(n))return e(n,r);for(var s=n.length,u=t?s:-1,c=V(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}function Ia(e){return function(t,n,r){for(var s=-1,u=V(t),c=r(t),h=c.length;h--;){var g=c[e?h:++s];if(n(u[g],g,u)===!1)break}return t}}function lf(e,t,n){var r=t&Me,s=xn(e);function u(){var c=this&&this!==ce&&this instanceof u?s:e;return c.apply(r?n:this,arguments)}return u}function Ca(e){return function(t){t=z(t);var n=Bt(t)?Ge(t):i,r=n?n[0]:t.charAt(0),s=n?St(n,1).join(""):t.slice(1);return r[e]()+s}}function Vt(e){return function(t){return Gr(Io(Ao(t).replace(ju,"")),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=zt(e.prototype),r=e.apply(n,t);return te(r)?r:n}}function cf(e,t,n){var r=xn(e);function s(){for(var u=arguments.length,c=v(u),h=u,g=Zt(s);h--;)c[h]=arguments[h];var _=u<3&&c[0]!==g&&c[u-1]!==g?[]:vt(c,g);if(u-=_.length,u<n)return Pa(e,t,or,s.placeholder,i,c,_,i,i,n-u);var w=this&&this!==ce&&this instanceof s?r:e;return xe(w,this,c)}return s}function ba(e){return function(t,n,r){var s=V(t);if(!ye(t)){var u=T(n,3);t=le(t),n=function(h){return u(s[h],h,s)}}var c=e(t,n,r);return c>-1?s[u?t[c]:c]:i}}function Ta(e){return at(function(t){var n=t.length,r=n,s=Oe.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if(typeof u!="function")throw new Pe(x);if(s&&!c&&fr(u)=="wrapper")var c=new Oe([],!0)}for(r=c?r:n;++r<n;){u=t[r];var h=fr(u),g=h=="wrapper"?xi(u):i;g&&Ci(g[0])&&g[1]==(et|je|Qe|nn)&&!g[4].length&&g[9]==1?c=c[fr(g[0])].apply(c,g[3]):c=u.length==1&&Ci(u)?c[h]():c.thru(u)}return function(){var _=arguments,w=_[0];if(c&&_.length==1&&N(w))return c.plant(w).value();for(var S=0,I=n?t[S].apply(this,_):w;++S<n;)I=t[S].call(this,I);return I}})}function or(e,t,n,r,s,u,c,h,g,_){var w=t&et,S=t&Me,I=t&Ut,b=t&(je|en),R=t&xr,$=I?i:xn(e);function F(){for(var M=arguments.length,H=v(M),Ce=M;Ce--;)H[Ce]=arguments[Ce];if(b)var me=Zt(F),be=Sl(H,me);if(r&&(H=xa(H,r,s,b)),u&&(H=Ea(H,u,c,b)),M-=be,b&&M<_){var se=vt(H,me);return Pa(e,t,or,F.placeholder,n,H,se,h,g,_-M)}var Ke=S?n:this,ct=I?Ke[e]:e;return M=H.length,h?H=Ff(H,h):R&&M>1&&H.reverse(),w&&g<M&&(H.length=g),this&&this!==ce&&this instanceof F&&(ct=$||xn(ct)),ct.apply(Ke,H)}return F}function Ra(e,t){return function(n,r){return Dc(n,e,t(r),{})}}function ur(e,t){return function(n,r){var s;if(n===i&&r===i)return t;if(n!==i&&(s=n),r!==i){if(s===i)return r;typeof n=="string"||typeof r=="string"?(n=Ae(n),r=Ae(r)):(n=da(n),r=da(r)),s=e(n,r)}return s}}function _i(e){return at(function(t){return t=Q(t,Ee(T())),D(function(n){var r=this;return e(t,function(s){return xe(s,r,n)})})})}function lr(e,t){t=t===i?" ":Ae(t);var n=t.length;if(n<2)return n?fi(t,e):t;var r=fi(t,Zn(e/kt(t)));return Bt(t)?St(Ge(r),0,e).join(""):r.slice(0,e)}function ff(e,t,n,r){var s=t&Me,u=xn(e);function c(){for(var h=-1,g=arguments.length,_=-1,w=r.length,S=v(w+g),I=this&&this!==ce&&this instanceof c?u:e;++_<w;)S[_]=r[_];for(;g--;)S[_++]=arguments[++h];return xe(I,s?n:this,S)}return c}function Fa(e){return function(t,n,r){return r&&typeof r!="number"&&ve(t,n,r)&&(n=r=i),t=lt(t),n===i?(n=t,t=0):n=lt(n),r=r===i?t<n?1:-1:lt(r),Zc(t,n,r,e)}}function cr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=$e(t),n=$e(n)),e(t,n)}}function Pa(e,t,n,r,s,u,c,h,g,_){var w=t&je,S=w?c:i,I=w?i:c,b=w?u:i,R=w?i:u;t|=w?Qe:tn,t&=~(w?tn:Qe),t&Zi||(t&=-4);var $=[e,t,s,b,S,R,I,h,g,_],F=n.apply(i,$);return Ci(e)&&qa(F,$),F.placeholder=r,Ha(F,e,t)}function yi(e){var t=oe[e];return function(n,r){if(n=$e(n),r=r==null?0:he(U(r),292),r&&Hs(n)){var s=(z(n)+"e").split("e"),u=t(s[0]+"e"+(+s[1]+r));return s=(z(u)+"e").split("e"),+(s[0]+"e"+(+s[1]-r))}return t(n)}}var hf=Ht&&1/Mn(new Ht([,-0]))[1]==At?function(e){return new Ht(e)}:ki;function Oa(e){return function(t){var n=pe(t);return n==Be?Zr(t):n==ke?Tl(t):wl(t,e(t))}}function st(e,t,n,r,s,u,c,h){var g=t&Ut;if(!g&&typeof e!="function")throw new Pe(x);var _=r?r.length:0;if(_||(t&=-97,r=s=i),c=c===i?c:ue(U(c),0),h=h===i?h:U(h),_-=s?s.length:0,t&tn){var w=r,S=s;r=s=i}var I=g?i:xi(e),b=[e,t,n,r,s,w,S,u,c,h];if(I&&bf(b,I),e=b[0],t=b[1],n=b[2],r=b[3],s=b[4],h=b[9]=b[9]===i?g?0:e.length:ue(b[9]-_,0),!h&&t&(je|en)&&(t&=-25),!t||t==Me)var R=lf(e,t,n);else t==je||t==en?R=cf(e,t,h):(t==Qe||t==(Me|Qe))&&!s.length?R=ff(e,t,n,r):R=or.apply(i,b);var $=I?ha:qa;return Ha($(R,b),e,t)}function La(e,t,n,r){return e===i||He(e,qt[n])&&!Y.call(r,n)?t:e}function Na(e,t,n,r,s,u){return te(e)&&te(t)&&(u.set(t,e),rr(e,t,i,Na,u),u.delete(t)),e}function pf(e){return In(e)?i:e}function Ua(e,t,n,r,s,u){var c=n&B,h=e.length,g=t.length;if(h!=g&&!(c&&g>h))return!1;var _=u.get(e),w=u.get(t);if(_&&w)return _==t&&w==e;var S=-1,I=!0,b=n&Xe?new Tt:i;for(u.set(e,t),u.set(t,e);++S<h;){var R=e[S],$=t[S];if(r)var F=c?r($,R,S,t,e,u):r(R,$,S,e,t,u);if(F!==i){if(F)continue;I=!1;break}if(b){if(!qr(t,function(M,H){if(!fn(b,H)&&(R===M||s(R,M,n,r,u)))return b.push(H)})){I=!1;break}}else if(!(R===$||s(R,$,n,r,u))){I=!1;break}}return u.delete(e),u.delete(t),I}function df(e,t,n,r,s,u,c){switch(n){case Dt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case cn:return!(e.byteLength!=t.byteLength||!u(new Kn(e),new Kn(t)));case rn:case sn:case an:return He(+e,+t);case Pn:return e.name==t.name&&e.message==t.message;case on:case un:return e==t+"";case Be:var h=Zr;case ke:var g=r&B;if(h||(h=Mn),e.size!=t.size&&!g)return!1;var _=c.get(e);if(_)return _==t;r|=Xe,c.set(e,t);var w=Ua(h(e),h(t),r,s,u,c);return c.delete(e),w;case Ln:if(vn)return vn.call(e)==vn.call(t)}return!1}function gf(e,t,n,r,s,u){var c=n&B,h=wi(e),g=h.length,_=wi(t),w=_.length;if(g!=w&&!c)return!1;for(var S=g;S--;){var I=h[S];if(!(c?I in t:Y.call(t,I)))return!1}var b=u.get(e),R=u.get(t);if(b&&R)return b==t&&R==e;var $=!0;u.set(e,t),u.set(t,e);for(var F=c;++S<g;){I=h[S];var M=e[I],H=t[I];if(r)var Ce=c?r(H,M,I,t,e,u):r(M,H,I,e,t,u);if(!(Ce===i?M===H||s(M,H,n,r,u):Ce)){$=!1;break}F||(F=I=="constructor")}if($&&!F){var me=e.constructor,be=t.constructor;me!=be&&"constructor"in e&&"constructor"in t&&!(typeof me=="function"&&me instanceof me&&typeof be=="function"&&be instanceof be)&&($=!1)}return u.delete(e),u.delete(t),$}function at(e){return Ti(ka(e,i,Ja),e+"")}function wi(e){return ta(e,le,Ai)}function Si(e){return ta(e,we,$a)}var xi=Xn?function(e){return Xn.get(e)}:ki;function fr(e){for(var t=e.name+"",n=Kt[t],r=Y.call(Kt,t)?n.length:0;r--;){var s=n[r],u=s.func;if(u==null||u==e)return s.name}return t}function Zt(e){var t=Y.call(o,"placeholder")?o:e;return t.placeholder}function T(){var e=o.iteratee||Mi;return e=e===Mi?ia:e,arguments.length?e(arguments[0],arguments[1]):e}function hr(e,t){var n=e.__data__;return Ef(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ei(e){for(var t=le(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,Ma(s)]}return t}function Pt(e,t){var n=Il(e,t);return ra(n)?n:i}function vf(e){var t=Y.call(e,Ct),n=e[Ct];try{e[Ct]=i;var r=!0}catch{}var s=qn.call(e);return r&&(t?e[Ct]=n:delete e[Ct]),s}var Ai=Xr?function(e){return e==null?[]:(e=V(e),dt(Xr(e),function(t){return Gs.call(e,t)}))}:Gi,$a=Xr?function(e){for(var t=[];e;)gt(t,Ai(e)),e=zn(e);return t}:Gi,pe=ge;(jr&&pe(new jr(new ArrayBuffer(1)))!=Dt||pn&&pe(new pn)!=Be||Qr&&pe(Qr.resolve())!=ji||Ht&&pe(new Ht)!=ke||dn&&pe(new dn)!=ln)&&(pe=function(e){var t=ge(e),n=t==tt?e.constructor:i,r=n?Ot(n):"";if(r)switch(r){case Xl:return Dt;case jl:return Be;case Ql:return ji;case ec:return ke;case tc:return ln}return t});function mf(e,t,n){for(var r=-1,s=n.length;++r<s;){var u=n[r],c=u.size;switch(u.type){case"drop":e+=c;break;case"dropRight":t-=c;break;case"take":t=he(t,e+c);break;case"takeRight":e=ue(e,t-c);break}}return{start:e,end:t}}function _f(e){var t=e.match(Eu);return t?t[1].split(Au):[]}function Da(e,t,n){t=wt(t,e);for(var r=-1,s=t.length,u=!1;++r<s;){var c=Je(t[r]);if(!(u=e!=null&&n(e,c)))break;e=e[c]}return u||++r!=s?u:(s=e==null?0:e.length,!!s&&yr(s)&&ot(c,s)&&(N(e)||Lt(e)))}function yf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Y.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Wa(e){return typeof e.constructor=="function"&&!En(e)?zt(zn(e)):{}}function wf(e,t,n){var r=e.constructor;switch(t){case cn:return mi(e);case rn:case sn:return new r(+e);case Dt:return nf(e,n);case Er:case Ar:case Ir:case Cr:case br:case Tr:case Rr:case Fr:case Pr:return wa(e,n);case Be:return new r;case an:case un:return new r(e);case on:return rf(e);case ke:return new r;case Ln:return sf(e)}}function Sf(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(xu,`{
10
10
  /* [wrapped with `+t+`] */
11
- `)}function Af(e){return $(e)||Lt(e)||!!(Ks&&e&&e[Ks])}function at(e,t){var n=typeof e;return t=t??ht,!!t&&(n=="number"||n!="symbol"&&$u.test(e))&&e>-1&&e%1==0&&e<t}function ve(e,t,n){if(!te(n))return!1;var r=typeof t;return(r=="number"?ye(n)&&at(t,n.length):r=="string"&&t in n)?Ke(n[t],e):!1}function bi(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ee(e)?!0:wu.test(e)||!yu.test(e)||t!=null&&e in J(t)}function Ef(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ci(e){var t=fr(e),n=o[t];if(typeof n!="function"||!(t in G.prototype))return!1;if(e===n)return!0;var r=Ii(n);return!!r&&e===r[0]}function bf(e){return!!ks&&ks in e}var Cf=kn?ot:Hi;function Sn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Gt;return e===n}function ka(e){return e===e&&!te(e)}function Ga(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in J(n))}}function Rf(e){var t=mr(e,function(r){return n.size===se&&n.clear(),r}),n=t.cache;return t}function Tf(e,t){var n=e[1],r=t[1],s=n|r,u=s<(Be|Ut|Qe),c=r==Qe&&n==je||r==Qe&&n==en&&e[7].length<=t[8]||r==(Qe|en)&&t[7].length<=t[8]&&n==je;if(!(u||c))return e;r&Be&&(e[2]=t[2],s|=n&Be?0:ji);var h=t[3];if(h){var g=e[3];e[3]=g?Aa(g,h,t[4]):h,e[4]=g?gt(e[3],Q):t[4]}return h=t[5],h&&(g=e[5],e[5]=g?Ea(g,h,t[6]):h,e[6]=g?gt(e[5],Q):t[6]),h=t[7],h&&(e[7]=h),r&Qe&&(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]=s,e}function Ff(e){var t=[];if(e!=null)for(var n in J(e))t.push(n);return t}function Pf(e){return qn.call(e)}function qa(e,t,n){return t=oe(t===i?e.length-1:t,0),function(){for(var r=arguments,s=-1,u=oe(r.length-t,0),c=v(u);++s<u;)c[s]=r[t+s];s=-1;for(var h=v(t+1);++s<t;)h[s]=r[s];return h[t]=n(c),xe(e,this,h)}}function Ha(e,t){return t.length<2?e:Ft(e,Ue(t,0,-1))}function Of(e,t){for(var n=e.length,r=he(t.length,n),s=_e(e);r--;){var u=t[r];e[r]=at(u,n)?s[u]:i}return e}function Ri(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Ka=Ya(da),xn=zl||function(e,t){return ce.setTimeout(e,t)},Ti=Ya(ef);function za(e,t,n){var r=t+"";return Ti(e,If(r,Lf(wf(r),n)))}function Ya(e){var t=0,n=0;return function(){var r=Zl(),s=Qo-(r-n);if(n=r,s>0){if(++t>=Xo)return arguments[0]}else t=0;return e.apply(i,arguments)}}function pr(e,t){var n=-1,r=e.length,s=r-1;for(t=t===i?r:t;++n<t;){var u=fi(n,s),c=e[u];e[u]=e[n],e[n]=c}return e.length=t,e}var Va=Rf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Su,function(n,r,s,u){t.push(s?u.replace(Tu,"$1"):r||n)}),t});function Ze(e){if(typeof e=="string"||Ee(e))return e;var t=e+"";return t=="0"&&1/e==-At?"-0":t}function Ot(e){if(e!=null){try{return Gn.call(e)}catch{}try{return e+""}catch{}}return""}function Lf(e,t){return Fe(su,function(n){var r="_."+n[0];t&n[1]&&!Dn(e,r)&&e.push(r)}),e.sort()}function Ja(e){if(e instanceof G)return e.clone();var t=new Oe(e.__wrapped__,e.__chain__);return t.__actions__=_e(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Uf(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=oe(N(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var s=0,u=0,c=v(Jn(r/t));s<r;)c[u++]=Ue(e,s,s+=t);return c}function $f(e){for(var t=-1,n=e==null?0:e.length,r=0,s=[];++t<n;){var u=e[t];u&&(s[r++]=u)}return s}function Nf(){var e=arguments.length;if(!e)return[];for(var t=v(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return dt($(n)?_e(n):[n],fe(t,1))}var Df=M(function(e,t){return re(e)?vn(e,fe(t,1,re,!0)):[]}),Wf=M(function(e,t){var n=$e(t);return re(n)&&(n=i),re(e)?vn(e,fe(t,1,re,!0),R(n,2)):[]}),Mf=M(function(e,t){var n=$e(t);return re(n)&&(n=i),re(e)?vn(e,fe(t,1,re,!0),i,n):[]});function Bf(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:N(t),Ue(e,t<0?0:t,r)):[]}function kf(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:N(t),t=r-t,Ue(e,0,t<0?0:t)):[]}function Gf(e,t){return e&&e.length?sr(e,R(t,3),!0,!0):[]}function qf(e,t){return e&&e.length?sr(e,R(t,3),!0):[]}function Hf(e,t,n,r){var s=e==null?0:e.length;return s?(n&&typeof n!="number"&&ve(e,t,n)&&(n=0,r=s),$c(e,t,n,r)):[]}function Za(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:N(n);return s<0&&(s=oe(r+s,0)),Wn(e,R(t,3),s)}function ja(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r-1;return n!==i&&(s=N(n),s=n<0?oe(r+s,0):he(s,r-1)),Wn(e,R(t,3),s,!0)}function Xa(e){var t=e==null?0:e.length;return t?fe(e,1):[]}function Kf(e){var t=e==null?0:e.length;return t?fe(e,At):[]}function zf(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:N(t),fe(e,t)):[]}function Yf(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var s=e[t];r[s[0]]=s[1]}return r}function Qa(e){return e&&e.length?e[0]:i}function Vf(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:N(n);return s<0&&(s=oe(r+s,0)),Wt(e,t,s)}function Jf(e){var t=e==null?0:e.length;return t?Ue(e,0,-1):[]}var Zf=M(function(e){var t=ee(e,vi);return t.length&&t[0]===e[0]?ai(t):[]}),jf=M(function(e){var t=$e(e),n=ee(e,vi);return t===$e(n)?t=i:n.pop(),n.length&&n[0]===e[0]?ai(n,R(t,2)):[]}),Xf=M(function(e){var t=$e(e),n=ee(e,vi);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?ai(n,i,t):[]});function Qf(e,t){return e==null?"":Vl.call(e,t)}function $e(e){var t=e==null?0:e.length;return t?e[t-1]:i}function eh(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r;return n!==i&&(s=N(n),s=s<0?oe(r+s,0):he(s,r-1)),t===t?Ol(e,t,s):Wn(e,Ls,s,!0)}function th(e,t){return e&&e.length?ca(e,N(t)):i}var nh=M(eo);function eo(e,t){return e&&e.length&&t&&t.length?ci(e,t):e}function rh(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,R(n,2)):e}function ih(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,i,n):e}var sh=st(function(e,t){var n=e==null?0:e.length,r=ni(e,t);return pa(e,ee(t,function(s){return at(s,n)?+s:s}).sort(Ia)),r});function ah(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,s=[],u=e.length;for(t=R(t,3);++r<u;){var c=e[r];t(c,r,e)&&(n.push(c),s.push(r))}return pa(e,s),n}function Fi(e){return e==null?e:Xl.call(e)}function oh(e,t,n){var r=e==null?0:e.length;return r?(n&&typeof n!="number"&&ve(e,t,n)?(t=0,n=r):(t=t==null?0:N(t),n=n===i?r:N(n)),Ue(e,t,n)):[]}function uh(e,t){return ir(e,t)}function lh(e,t,n){return pi(e,t,R(n,2))}function ch(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t);if(r<n&&Ke(e[r],t))return r}return-1}function fh(e,t){return ir(e,t,!0)}function hh(e,t,n){return pi(e,t,R(n,2),!0)}function ph(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t,!0)-1;if(Ke(e[r],t))return r}return-1}function dh(e){return e&&e.length?ga(e):[]}function gh(e,t){return e&&e.length?ga(e,R(t,2)):[]}function vh(e){var t=e==null?0:e.length;return t?Ue(e,1,t):[]}function mh(e,t,n){return e&&e.length?(t=n||t===i?1:N(t),Ue(e,0,t<0?0:t)):[]}function _h(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:N(t),t=r-t,Ue(e,t<0?0:t,r)):[]}function yh(e,t){return e&&e.length?sr(e,R(t,3),!1,!0):[]}function wh(e,t){return e&&e.length?sr(e,R(t,3)):[]}var Sh=M(function(e){return _t(fe(e,1,re,!0))}),xh=M(function(e){var t=$e(e);return re(t)&&(t=i),_t(fe(e,1,re,!0),R(t,2))}),Ih=M(function(e){var t=$e(e);return t=typeof t=="function"?t:i,_t(fe(e,1,re,!0),i,t)});function Ah(e){return e&&e.length?_t(e):[]}function Eh(e,t){return e&&e.length?_t(e,R(t,2)):[]}function bh(e,t){return t=typeof t=="function"?t:i,e&&e.length?_t(e,i,t):[]}function Pi(e){if(!(e&&e.length))return[];var t=0;return e=pt(e,function(n){if(re(n))return t=oe(n.length,t),!0}),Vr(t,function(n){return ee(e,Kr(n))})}function to(e,t){if(!(e&&e.length))return[];var n=Pi(e);return t==null?n:ee(n,function(r){return xe(t,i,r)})}var Ch=M(function(e,t){return re(e)?vn(e,t):[]}),Rh=M(function(e){return gi(pt(e,re))}),Th=M(function(e){var t=$e(e);return re(t)&&(t=i),gi(pt(e,re),R(t,2))}),Fh=M(function(e){var t=$e(e);return t=typeof t=="function"?t:i,gi(pt(e,re),i,t)}),Ph=M(Pi);function Oh(e,t){return ya(e||[],t||[],gn)}function Lh(e,t){return ya(e||[],t||[],yn)}var Uh=M(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,to(e,n)});function no(e){var t=o(e);return t.__chain__=!0,t}function $h(e,t){return t(e),e}function dr(e,t){return t(e)}var Nh=st(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,s=function(u){return ni(u,e)};return t>1||this.__actions__.length||!(r instanceof G)||!at(n)?this.thru(s):(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:dr,args:[s],thisArg:i}),new Oe(r,this.__chain__).thru(function(u){return t&&!u.length&&u.push(i),u}))});function Dh(){return no(this)}function Wh(){return new Oe(this.value(),this.__chain__)}function Mh(){this.__values__===i&&(this.__values__=mo(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function Bh(){return this}function kh(e){for(var t,n=this;n instanceof Qn;){var r=Ja(n);r.__index__=0,r.__values__=i,t?s.__wrapped__=r:t=r;var s=r;n=n.__wrapped__}return s.__wrapped__=e,t}function Gh(){var e=this.__wrapped__;if(e instanceof G){var t=e;return this.__actions__.length&&(t=new G(this)),t=t.reverse(),t.__actions__.push({func:dr,args:[Fi],thisArg:i}),new Oe(t,this.__chain__)}return this.thru(Fi)}function qh(){return _a(this.__wrapped__,this.__actions__)}var Hh=ar(function(e,t,n){V.call(e,n)?++e[n]:rt(e,n,1)});function Kh(e,t,n){var r=$(e)?Ps:Uc;return n&&ve(e,t,n)&&(t=i),r(e,R(t,3))}function zh(e,t){var n=$(e)?pt:ta;return n(e,R(t,3))}var Yh=Ta(Za),Vh=Ta(ja);function Jh(e,t){return fe(gr(e,t),1)}function Zh(e,t){return fe(gr(e,t),At)}function jh(e,t,n){return n=n===i?1:N(n),fe(gr(e,t),n)}function ro(e,t){var n=$(e)?Fe:mt;return n(e,R(t,3))}function io(e,t){var n=$(e)?gl:ea;return n(e,R(t,3))}var Xh=ar(function(e,t,n){V.call(e,n)?e[n].push(t):rt(e,n,[t])});function Qh(e,t,n,r){e=ye(e)?e:Zt(e),n=n&&!r?N(n):0;var s=e.length;return n<0&&(n=oe(s+n,0)),wr(e)?n<=s&&e.indexOf(t,n)>-1:!!s&&Wt(e,t,n)>-1}var ep=M(function(e,t,n){var r=-1,s=typeof t=="function",u=ye(e)?v(e.length):[];return mt(e,function(c){u[++r]=s?xe(t,c,n):mn(c,t,n)}),u}),tp=ar(function(e,t,n){rt(e,n,t)});function gr(e,t){var n=$(e)?ee:oa;return n(e,R(t,3))}function np(e,t,n,r){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=r?i:n,$(n)||(n=n==null?[]:[n]),fa(e,t,n))}var rp=ar(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function ip(e,t,n){var r=$(e)?qr:$s,s=arguments.length<3;return r(e,R(t,4),n,s,mt)}function sp(e,t,n){var r=$(e)?vl:$s,s=arguments.length<3;return r(e,R(t,4),n,s,ea)}function ap(e,t){var n=$(e)?pt:ta;return n(e,_r(R(t,3)))}function op(e){var t=$(e)?Zs:Xc;return t(e)}function up(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=N(t);var r=$(e)?Tc:Qc;return r(e,t)}function lp(e){var t=$(e)?Fc:tf;return t(e)}function cp(e){if(e==null)return 0;if(ye(e))return wr(e)?Bt(e):e.length;var t=pe(e);return t==ke||t==Ge?e.size:ui(e).length}function fp(e,t,n){var r=$(e)?Hr:nf;return n&&ve(e,t,n)&&(t=i),r(e,R(t,3))}var hp=M(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ve(e,t[0],t[1])?t=[]:n>2&&ve(t[0],t[1],t[2])&&(t=[t[0]]),fa(e,fe(t,1),[])}),vr=Kl||function(){return ce.Date.now()};function pp(e,t){if(typeof t!="function")throw new Pe(I);return e=N(e),function(){if(--e<1)return t.apply(this,arguments)}}function so(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,it(e,Qe,i,i,i,i,t)}function ao(e,t){var n;if(typeof t!="function")throw new Pe(I);return e=N(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Oi=M(function(e,t,n){var r=Be;if(n.length){var s=gt(n,Vt(Oi));r|=Xe}return it(e,r,t,n,s)}),oo=M(function(e,t,n){var r=Be|Ut;if(n.length){var s=gt(n,Vt(oo));r|=Xe}return it(t,r,e,n,s)});function uo(e,t,n){t=n?i:t;var r=it(e,je,i,i,i,i,i,t);return r.placeholder=uo.placeholder,r}function lo(e,t,n){t=n?i:t;var r=it(e,Xt,i,i,i,i,i,t);return r.placeholder=lo.placeholder,r}function co(e,t,n){var r,s,u,c,h,g,_=0,y=!1,S=!1,A=!0;if(typeof e!="function")throw new Pe(I);t=Ne(t)||0,te(n)&&(y=!!n.leading,S="maxWait"in n,u=S?oe(Ne(n.maxWait)||0,t):u,A="trailing"in n?!!n.trailing:A);function C(ie){var ze=r,lt=s;return r=s=i,_=ie,c=e.apply(lt,ze),c}function F(ie){return _=ie,h=xn(k,t),y?C(ie):c}function D(ie){var ze=ie-g,lt=ie-_,Fo=t-ze;return S?he(Fo,u-lt):Fo}function P(ie){var ze=ie-g,lt=ie-_;return g===i||ze>=t||ze<0||S&&lt>=u}function k(){var ie=vr();if(P(ie))return H(ie);h=xn(k,D(ie))}function H(ie){return h=i,A&&r?C(ie):(r=s=i,c)}function be(){h!==i&&wa(h),_=0,r=g=s=h=i}function me(){return h===i?c:H(vr())}function Ce(){var ie=vr(),ze=P(ie);if(r=arguments,s=this,g=ie,ze){if(h===i)return F(g);if(S)return wa(h),h=xn(k,t),C(g)}return h===i&&(h=xn(k,t)),c}return Ce.cancel=be,Ce.flush=me,Ce}var dp=M(function(e,t){return Qs(e,1,t)}),gp=M(function(e,t,n){return Qs(e,Ne(t)||0,n)});function vp(e){return it(e,Ir)}function mr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Pe(I);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],u=n.cache;if(u.has(s))return u.get(s);var c=e.apply(this,r);return n.cache=u.set(s,c)||u,c};return n.cache=new(mr.Cache||nt),n}mr.Cache=nt;function _r(e){if(typeof e!="function")throw new Pe(I);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 ao(2,e)}var _p=rf(function(e,t){t=t.length==1&&$(t[0])?ee(t[0],Ie(R())):ee(fe(t,1),Ie(R()));var n=t.length;return M(function(r){for(var s=-1,u=he(r.length,n);++s<u;)r[s]=t[s].call(this,r[s]);return xe(e,this,r)})}),Li=M(function(e,t){var n=gt(t,Vt(Li));return it(e,Xe,i,t,n)}),fo=M(function(e,t){var n=gt(t,Vt(fo));return it(e,Qt,i,t,n)}),yp=st(function(e,t){return it(e,en,i,i,i,t)});function wp(e,t){if(typeof e!="function")throw new Pe(I);return t=t===i?t:N(t),M(e,t)}function Sp(e,t){if(typeof e!="function")throw new Pe(I);return t=t==null?0:oe(N(t),0),M(function(n){var r=n[t],s=wt(n,0,t);return r&&dt(s,r),xe(e,this,s)})}function xp(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new Pe(I);return te(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),co(e,t,{leading:r,maxWait:t,trailing:s})}function Ip(e){return so(e,1)}function Ap(e,t){return Li(mi(t),e)}function Ep(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function bp(e){return Le(e,W)}function Cp(e,t){return t=typeof t=="function"?t:i,Le(e,W,t)}function Rp(e){return Le(e,K|W)}function Tp(e,t){return t=typeof t=="function"?t:i,Le(e,K|W,t)}function Fp(e,t){return t==null||Xs(e,t,le(t))}function Ke(e,t){return e===t||e!==e&&t!==t}var Pp=cr(si),Op=cr(function(e,t){return e>=t}),Lt=ia(function(){return arguments}())?ia:function(e){return ne(e)&&V.call(e,"callee")&&!Hs.call(e,"callee")},$=v.isArray,Lp=Es?Ie(Es):Bc;function ye(e){return e!=null&&yr(e.length)&&!ot(e)}function re(e){return ne(e)&&ye(e)}function Up(e){return e===!0||e===!1||ne(e)&&ge(e)==tn}var St=Yl||Hi,$p=bs?Ie(bs):kc;function Np(e){return ne(e)&&e.nodeType===1&&!In(e)}function Dp(e){if(e==null)return!0;if(ye(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||St(e)||Jt(e)||Lt(e)))return!e.length;var t=pe(e);if(t==ke||t==Ge)return!e.size;if(Sn(e))return!ui(e).length;for(var n in e)if(V.call(e,n))return!1;return!0}function Wp(e,t){return _n(e,t)}function Mp(e,t,n){n=typeof n=="function"?n:i;var r=n?n(e,t):i;return r===i?_n(e,t,i,n):!!r}function Ui(e){if(!ne(e))return!1;var t=ge(e);return t==Pn||t==ou||typeof e.message=="string"&&typeof e.name=="string"&&!In(e)}function Bp(e){return typeof e=="number"&&zs(e)}function ot(e){if(!te(e))return!1;var t=ge(e);return t==On||t==Qi||t==au||t==lu}function ho(e){return typeof e=="number"&&e==N(e)}function yr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ht}function te(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ne(e){return e!=null&&typeof e=="object"}var po=Cs?Ie(Cs):qc;function kp(e,t){return e===t||oi(e,t,Ai(t))}function Gp(e,t,n){return n=typeof n=="function"?n:i,oi(e,t,Ai(t),n)}function qp(e){return go(e)&&e!=+e}function Hp(e){if(Cf(e))throw new U(x);return sa(e)}function Kp(e){return e===null}function zp(e){return e==null}function go(e){return typeof e=="number"||ne(e)&&ge(e)==rn}function In(e){if(!ne(e)||ge(e)!=et)return!1;var t=zn(e);if(t===null)return!0;var n=V.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gn.call(n)==kl}var $i=Rs?Ie(Rs):Hc;function Yp(e){return ho(e)&&e>=-ht&&e<=ht}var vo=Ts?Ie(Ts):Kc;function wr(e){return typeof e=="string"||!$(e)&&ne(e)&&ge(e)==an}function Ee(e){return typeof e=="symbol"||ne(e)&&ge(e)==Ln}var Jt=Fs?Ie(Fs):zc;function Vp(e){return e===i}function Jp(e){return ne(e)&&pe(e)==on}function Zp(e){return ne(e)&&ge(e)==fu}var jp=cr(li),Xp=cr(function(e,t){return e<=t});function mo(e){if(!e)return[];if(ye(e))return wr(e)?qe(e):_e(e);if(cn&&e[cn])return Tl(e[cn]());var t=pe(e),n=t==ke?Zr:t==Ge?Mn:Zt;return n(e)}function ut(e){if(!e)return e===0?e:0;if(e=Ne(e),e===At||e===-At){var t=e<0?-1:1;return t*nu}return e===e?e:0}function N(e){var t=ut(e),n=t%1;return t===t?n?t-n:t:0}function _o(e){return e?Tt(N(e),0,Ye):0}function Ne(e){if(typeof e=="number")return e;if(Ee(e))return Tn;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=Ns(e);var n=Ou.test(e);return n||Uu.test(e)?hl(e.slice(2),n?2:8):Pu.test(e)?Tn:+e}function yo(e){return Je(e,we(e))}function Qp(e){return e?Tt(N(e),-ht,ht):e===0?e:0}function Y(e){return e==null?"":Ae(e)}var ed=zt(function(e,t){if(Sn(t)||ye(t)){Je(t,le(t),e);return}for(var n in t)V.call(t,n)&&gn(e,n,t[n])}),wo=zt(function(e,t){Je(t,we(t),e)}),Sr=zt(function(e,t,n,r){Je(t,we(t),e,r)}),td=zt(function(e,t,n,r){Je(t,le(t),e,r)}),nd=st(ni);function rd(e,t){var n=Kt(e);return t==null?n:js(n,t)}var id=M(function(e,t){e=J(e);var n=-1,r=t.length,s=r>2?t[2]:i;for(s&&ve(t[0],t[1],s)&&(r=1);++n<r;)for(var u=t[n],c=we(u),h=-1,g=c.length;++h<g;){var _=c[h],y=e[_];(y===i||Ke(y,Gt[_])&&!V.call(e,_))&&(e[_]=u[_])}return e}),sd=M(function(e){return e.push(i,Na),xe(So,i,e)});function ad(e,t){return Os(e,R(t,3),Ve)}function od(e,t){return Os(e,R(t,3),ii)}function ud(e,t){return e==null?e:ri(e,R(t,3),we)}function ld(e,t){return e==null?e:na(e,R(t,3),we)}function cd(e,t){return e&&Ve(e,R(t,3))}function fd(e,t){return e&&ii(e,R(t,3))}function hd(e){return e==null?[]:nr(e,le(e))}function pd(e){return e==null?[]:nr(e,we(e))}function Ni(e,t,n){var r=e==null?i:Ft(e,t);return r===i?n:r}function dd(e,t){return e!=null&&Ma(e,t,Nc)}function Di(e,t){return e!=null&&Ma(e,t,Dc)}var gd=Pa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),e[t]=n},Mi(Se)),vd=Pa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),V.call(e,t)?e[t].push(n):e[t]=[n]},R),md=M(mn);function le(e){return ye(e)?Js(e):ui(e)}function we(e){return ye(e)?Js(e,!0):Yc(e)}function _d(e,t){var n={};return t=R(t,3),Ve(e,function(r,s,u){rt(n,t(r,s,u),r)}),n}function yd(e,t){var n={};return t=R(t,3),Ve(e,function(r,s,u){rt(n,s,t(r,s,u))}),n}var wd=zt(function(e,t,n){rr(e,t,n)}),So=zt(function(e,t,n,r){rr(e,t,n,r)}),Sd=st(function(e,t){var n={};if(e==null)return n;var r=!1;t=ee(t,function(u){return u=yt(u,e),r||(r=u.length>1),u}),Je(e,xi(e),n),r&&(n=Le(n,K|q|W,gf));for(var s=t.length;s--;)di(n,t[s]);return n});function xd(e,t){return xo(e,_r(R(t)))}var Id=st(function(e,t){return e==null?{}:Jc(e,t)});function xo(e,t){if(e==null)return{};var n=ee(xi(e),function(r){return[r]});return t=R(t),ha(e,n,function(r,s){return t(r,s[0])})}function Ad(e,t,n){t=yt(t,e);var r=-1,s=t.length;for(s||(s=1,e=i);++r<s;){var u=e==null?i:e[Ze(t[r])];u===i&&(r=s,u=n),e=ot(u)?u.call(e):u}return e}function Ed(e,t,n){return e==null?e:yn(e,t,n)}function bd(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:yn(e,t,n,r)}var Io=Ua(le),Ao=Ua(we);function Cd(e,t,n){var r=$(e),s=r||St(e)||Jt(e);if(t=R(t,4),n==null){var u=e&&e.constructor;s?n=r?new u:[]:te(e)?n=ot(u)?Kt(zn(e)):{}:n={}}return(s?Fe:Ve)(e,function(c,h,g){return t(n,c,h,g)}),n}function Rd(e,t){return e==null?!0:di(e,t)}function Td(e,t,n){return e==null?e:ma(e,t,mi(n))}function Fd(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:ma(e,t,mi(n),r)}function Zt(e){return e==null?[]:Jr(e,le(e))}function Pd(e){return e==null?[]:Jr(e,we(e))}function Od(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=Ne(n),n=n===n?n:0),t!==i&&(t=Ne(t),t=t===t?t:0),Tt(Ne(e),t,n)}function Ld(e,t,n){return t=ut(t),n===i?(n=t,t=0):n=ut(n),e=Ne(e),Wc(e,t,n)}function Ud(e,t,n){if(n&&typeof n!="boolean"&&ve(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=ut(e),t===i?(t=e,e=0):t=ut(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var s=Ys();return he(e+s*(t-e+fl("1e-"+((s+"").length-1))),t)}return fi(e,t)}var $d=Yt(function(e,t,n){return t=t.toLowerCase(),e+(n?Eo(t):t)});function Eo(e){return Wi(Y(e).toLowerCase())}function bo(e){return e=Y(e),e&&e.replace(Nu,Al).replace(tl,"")}function Nd(e,t,n){e=Y(e),t=Ae(t);var r=e.length;n=n===i?r:Tt(N(n),0,r);var s=n;return n-=t.length,n>=0&&e.slice(n,s)==t}function Dd(e){return e=Y(e),e&&vu.test(e)?e.replace(ns,El):e}function Wd(e){return e=Y(e),e&&xu.test(e)?e.replace(Lr,"\\$&"):e}var Md=Yt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Bd=Yt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),kd=Ra("toLowerCase");function Gd(e,t,n){e=Y(e),t=N(t);var r=t?Bt(e):0;if(!t||r>=t)return e;var s=(t-r)/2;return lr(Zn(s),n)+e+lr(Jn(s),n)}function qd(e,t,n){e=Y(e),t=N(t);var r=t?Bt(e):0;return t&&r<t?e+lr(t-r,n):e}function Hd(e,t,n){e=Y(e),t=N(t);var r=t?Bt(e):0;return t&&r<t?lr(t-r,n)+e:e}function Kd(e,t,n){return n||t==null?t=0:t&&(t=+t),jl(Y(e).replace(Ur,""),t||0)}function zd(e,t,n){return(n?ve(e,t,n):t===i)?t=1:t=N(t),hi(Y(e),t)}function Yd(){var e=arguments,t=Y(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Vd=Yt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Jd(e,t,n){return n&&typeof n!="number"&&ve(e,t,n)&&(t=n=i),n=n===i?Ye:n>>>0,n?(e=Y(e),e&&(typeof t=="string"||t!=null&&!$i(t))&&(t=Ae(t),!t&&Mt(e))?wt(qe(e),0,n):e.split(t,n)):[]}var Zd=Yt(function(e,t,n){return e+(n?" ":"")+Wi(t)});function jd(e,t,n){return e=Y(e),n=n==null?0:Tt(N(n),0,e.length),t=Ae(t),e.slice(n,n+t.length)==t}function Xd(e,t,n){var r=o.templateSettings;n&&ve(e,t,n)&&(t=i),e=Y(e),t=Sr({},t,r,$a);var s=Sr({},t.imports,r.imports,$a),u=le(s),c=Jr(s,u),h,g,_=0,y=t.interpolate||Un,S="__p += '",A=jr((t.escape||Un).source+"|"+y.source+"|"+(y===rs?Fu:Un).source+"|"+(t.evaluate||Un).source+"|$","g"),C="//# sourceURL="+(V.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++al+"]")+`
12
- `;e.replace(A,function(P,k,H,be,me,Ce){return H||(H=be),S+=e.slice(_,Ce).replace(Du,bl),k&&(h=!0,S+=`' +
13
- __e(`+k+`) +
11
+ `)}function xf(e){return N(e)||Lt(e)||!!(qs&&e&&e[qs])}function ot(e,t){var n=typeof e;return t=t??pt,!!t&&(n=="number"||n!="symbol"&&Lu.test(e))&&e>-1&&e%1==0&&e<t}function ve(e,t,n){if(!te(n))return!1;var r=typeof t;return(r=="number"?ye(n)&&ot(t,n.length):r=="string"&&t in n)?He(n[t],e):!1}function Ii(e,t){if(N(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ie(e)?!0:_u.test(e)||!mu.test(e)||t!=null&&e in V(t)}function Ef(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ci(e){var t=fr(e),n=o[t];if(typeof n!="function"||!(t in k.prototype))return!1;if(e===n)return!0;var r=xi(n);return!!r&&e===r[0]}function Af(e){return!!Ms&&Ms in e}var If=kn?ut:qi;function En(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||qt;return e===n}function Ma(e){return e===e&&!te(e)}function Ba(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in V(n))}}function Cf(e){var t=mr(e,function(r){return n.size===re&&n.clear(),r}),n=t.cache;return t}function bf(e,t){var n=e[1],r=t[1],s=n|r,u=s<(Me|Ut|et),c=r==et&&n==je||r==et&&n==nn&&e[7].length<=t[8]||r==(et|nn)&&t[7].length<=t[8]&&n==je;if(!(u||c))return e;r&Me&&(e[2]=t[2],s|=n&Me?0:Zi);var h=t[3];if(h){var g=e[3];e[3]=g?xa(g,h,t[4]):h,e[4]=g?vt(e[3],ee):t[4]}return h=t[5],h&&(g=e[5],e[5]=g?Ea(g,h,t[6]):h,e[6]=g?vt(e[5],ee):t[6]),h=t[7],h&&(e[7]=h),r&et&&(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]=s,e}function Tf(e){var t=[];if(e!=null)for(var n in V(e))t.push(n);return t}function Rf(e){return qn.call(e)}function ka(e,t,n){return t=ue(t===i?e.length-1:t,0),function(){for(var r=arguments,s=-1,u=ue(r.length-t,0),c=v(u);++s<u;)c[s]=r[t+s];s=-1;for(var h=v(t+1);++s<t;)h[s]=r[s];return h[t]=n(c),xe(e,this,h)}}function Ga(e,t){return t.length<2?e:Ft(e,Ne(t,0,-1))}function Ff(e,t){for(var n=e.length,r=he(t.length,n),s=_e(e);r--;){var u=t[r];e[r]=ot(u,n)?s[u]:i}return e}function bi(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var qa=Ka(ha),An=Hl||function(e,t){return ce.setTimeout(e,t)},Ti=Ka(jc);function Ha(e,t,n){var r=t+"";return Ti(e,Sf(r,Pf(_f(r),n)))}function Ka(e){var t=0,n=0;return function(){var r=Vl(),s=Xo-(r-n);if(n=r,s>0){if(++t>=Jo)return arguments[0]}else t=0;return e.apply(i,arguments)}}function pr(e,t){var n=-1,r=e.length,s=r-1;for(t=t===i?r:t;++n<t;){var u=ci(n,s),c=e[u];e[u]=e[n],e[n]=c}return e.length=t,e}var za=Cf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yu,function(n,r,s,u){t.push(s?u.replace(bu,"$1"):r||n)}),t});function Je(e){if(typeof e=="string"||Ie(e))return e;var t=e+"";return t=="0"&&1/e==-At?"-0":t}function Ot(e){if(e!=null){try{return Gn.call(e)}catch{}try{return e+""}catch{}}return""}function Pf(e,t){return Fe(ru,function(n){var r="_."+n[0];t&n[1]&&!Dn(e,r)&&e.push(r)}),e.sort()}function Ya(e){if(e instanceof k)return e.clone();var t=new Oe(e.__wrapped__,e.__chain__);return t.__actions__=_e(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Of(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=ue(U(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var s=0,u=0,c=v(Zn(r/t));s<r;)c[u++]=Ne(e,s,s+=t);return c}function Lf(e){for(var t=-1,n=e==null?0:e.length,r=0,s=[];++t<n;){var u=e[t];u&&(s[r++]=u)}return s}function Nf(){var e=arguments.length;if(!e)return[];for(var t=v(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return gt(N(n)?_e(n):[n],fe(t,1))}var Uf=D(function(e,t){return ie(e)?_n(e,fe(t,1,ie,!0)):[]}),$f=D(function(e,t){var n=Ue(t);return ie(n)&&(n=i),ie(e)?_n(e,fe(t,1,ie,!0),T(n,2)):[]}),Df=D(function(e,t){var n=Ue(t);return ie(n)&&(n=i),ie(e)?_n(e,fe(t,1,ie,!0),i,n):[]});function Wf(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),Ne(e,t<0?0:t,r)):[]}function Mf(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),t=r-t,Ne(e,0,t<0?0:t)):[]}function Bf(e,t){return e&&e.length?sr(e,T(t,3),!0,!0):[]}function kf(e,t){return e&&e.length?sr(e,T(t,3),!0):[]}function Gf(e,t,n,r){var s=e==null?0:e.length;return s?(n&&typeof n!="number"&&ve(e,t,n)&&(n=0,r=s),Lc(e,t,n,r)):[]}function Va(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:U(n);return s<0&&(s=ue(r+s,0)),Wn(e,T(t,3),s)}function Za(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r-1;return n!==i&&(s=U(n),s=n<0?ue(r+s,0):he(s,r-1)),Wn(e,T(t,3),s,!0)}function Ja(e){var t=e==null?0:e.length;return t?fe(e,1):[]}function qf(e){var t=e==null?0:e.length;return t?fe(e,At):[]}function Hf(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:U(t),fe(e,t)):[]}function Kf(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var s=e[t];r[s[0]]=s[1]}return r}function Xa(e){return e&&e.length?e[0]:i}function zf(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:U(n);return s<0&&(s=ue(r+s,0)),Mt(e,t,s)}function Yf(e){var t=e==null?0:e.length;return t?Ne(e,0,-1):[]}var Vf=D(function(e){var t=Q(e,gi);return t.length&&t[0]===e[0]?si(t):[]}),Zf=D(function(e){var t=Ue(e),n=Q(e,gi);return t===Ue(n)?t=i:n.pop(),n.length&&n[0]===e[0]?si(n,T(t,2)):[]}),Jf=D(function(e){var t=Ue(e),n=Q(e,gi);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?si(n,i,t):[]});function Xf(e,t){return e==null?"":zl.call(e,t)}function Ue(e){var t=e==null?0:e.length;return t?e[t-1]:i}function jf(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r;return n!==i&&(s=U(n),s=s<0?ue(r+s,0):he(s,r-1)),t===t?Fl(e,t,s):Wn(e,Ps,s,!0)}function Qf(e,t){return e&&e.length?ua(e,U(t)):i}var eh=D(ja);function ja(e,t){return e&&e.length&&t&&t.length?li(e,t):e}function th(e,t,n){return e&&e.length&&t&&t.length?li(e,t,T(n,2)):e}function nh(e,t,n){return e&&e.length&&t&&t.length?li(e,t,i,n):e}var rh=at(function(e,t){var n=e==null?0:e.length,r=ti(e,t);return fa(e,Q(t,function(s){return ot(s,n)?+s:s}).sort(Sa)),r});function ih(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,s=[],u=e.length;for(t=T(t,3);++r<u;){var c=e[r];t(c,r,e)&&(n.push(c),s.push(r))}return fa(e,s),n}function Ri(e){return e==null?e:Jl.call(e)}function sh(e,t,n){var r=e==null?0:e.length;return r?(n&&typeof n!="number"&&ve(e,t,n)?(t=0,n=r):(t=t==null?0:U(t),n=n===i?r:U(n)),Ne(e,t,n)):[]}function ah(e,t){return ir(e,t)}function oh(e,t,n){return hi(e,t,T(n,2))}function uh(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t);if(r<n&&He(e[r],t))return r}return-1}function lh(e,t){return ir(e,t,!0)}function ch(e,t,n){return hi(e,t,T(n,2),!0)}function fh(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t,!0)-1;if(He(e[r],t))return r}return-1}function hh(e){return e&&e.length?pa(e):[]}function ph(e,t){return e&&e.length?pa(e,T(t,2)):[]}function dh(e){var t=e==null?0:e.length;return t?Ne(e,1,t):[]}function gh(e,t,n){return e&&e.length?(t=n||t===i?1:U(t),Ne(e,0,t<0?0:t)):[]}function vh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),t=r-t,Ne(e,t<0?0:t,r)):[]}function mh(e,t){return e&&e.length?sr(e,T(t,3),!1,!0):[]}function _h(e,t){return e&&e.length?sr(e,T(t,3)):[]}var yh=D(function(e){return yt(fe(e,1,ie,!0))}),wh=D(function(e){var t=Ue(e);return ie(t)&&(t=i),yt(fe(e,1,ie,!0),T(t,2))}),Sh=D(function(e){var t=Ue(e);return t=typeof t=="function"?t:i,yt(fe(e,1,ie,!0),i,t)});function xh(e){return e&&e.length?yt(e):[]}function Eh(e,t){return e&&e.length?yt(e,T(t,2)):[]}function Ah(e,t){return t=typeof t=="function"?t:i,e&&e.length?yt(e,i,t):[]}function Fi(e){if(!(e&&e.length))return[];var t=0;return e=dt(e,function(n){if(ie(n))return t=ue(n.length,t),!0}),Yr(t,function(n){return Q(e,Hr(n))})}function Qa(e,t){if(!(e&&e.length))return[];var n=Fi(e);return t==null?n:Q(n,function(r){return xe(t,i,r)})}var Ih=D(function(e,t){return ie(e)?_n(e,t):[]}),Ch=D(function(e){return di(dt(e,ie))}),bh=D(function(e){var t=Ue(e);return ie(t)&&(t=i),di(dt(e,ie),T(t,2))}),Th=D(function(e){var t=Ue(e);return t=typeof t=="function"?t:i,di(dt(e,ie),i,t)}),Rh=D(Fi);function Fh(e,t){return ma(e||[],t||[],mn)}function Ph(e,t){return ma(e||[],t||[],Sn)}var Oh=D(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,Qa(e,n)});function eo(e){var t=o(e);return t.__chain__=!0,t}function Lh(e,t){return t(e),e}function dr(e,t){return t(e)}var Nh=at(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,s=function(u){return ti(u,e)};return t>1||this.__actions__.length||!(r instanceof k)||!ot(n)?this.thru(s):(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:dr,args:[s],thisArg:i}),new Oe(r,this.__chain__).thru(function(u){return t&&!u.length&&u.push(i),u}))});function Uh(){return eo(this)}function $h(){return new Oe(this.value(),this.__chain__)}function Dh(){this.__values__===i&&(this.__values__=go(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function Wh(){return this}function Mh(e){for(var t,n=this;n instanceof Qn;){var r=Ya(n);r.__index__=0,r.__values__=i,t?s.__wrapped__=r:t=r;var s=r;n=n.__wrapped__}return s.__wrapped__=e,t}function Bh(){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:dr,args:[Ri],thisArg:i}),new Oe(t,this.__chain__)}return this.thru(Ri)}function kh(){return va(this.__wrapped__,this.__actions__)}var Gh=ar(function(e,t,n){Y.call(e,n)?++e[n]:it(e,n,1)});function qh(e,t,n){var r=N(e)?Rs:Oc;return n&&ve(e,t,n)&&(t=i),r(e,T(t,3))}function Hh(e,t){var n=N(e)?dt:Qs;return n(e,T(t,3))}var Kh=ba(Va),zh=ba(Za);function Yh(e,t){return fe(gr(e,t),1)}function Vh(e,t){return fe(gr(e,t),At)}function Zh(e,t,n){return n=n===i?1:U(n),fe(gr(e,t),n)}function to(e,t){var n=N(e)?Fe:_t;return n(e,T(t,3))}function no(e,t){var n=N(e)?pl:js;return n(e,T(t,3))}var Jh=ar(function(e,t,n){Y.call(e,n)?e[n].push(t):it(e,n,[t])});function Xh(e,t,n,r){e=ye(e)?e:Xt(e),n=n&&!r?U(n):0;var s=e.length;return n<0&&(n=ue(s+n,0)),wr(e)?n<=s&&e.indexOf(t,n)>-1:!!s&&Mt(e,t,n)>-1}var jh=D(function(e,t,n){var r=-1,s=typeof t=="function",u=ye(e)?v(e.length):[];return _t(e,function(c){u[++r]=s?xe(t,c,n):yn(c,t,n)}),u}),Qh=ar(function(e,t,n){it(e,n,t)});function gr(e,t){var n=N(e)?Q:sa;return n(e,T(t,3))}function ep(e,t,n,r){return e==null?[]:(N(t)||(t=t==null?[]:[t]),n=r?i:n,N(n)||(n=n==null?[]:[n]),la(e,t,n))}var tp=ar(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function np(e,t,n){var r=N(e)?Gr:Ls,s=arguments.length<3;return r(e,T(t,4),n,s,_t)}function rp(e,t,n){var r=N(e)?dl:Ls,s=arguments.length<3;return r(e,T(t,4),n,s,js)}function ip(e,t){var n=N(e)?dt:Qs;return n(e,_r(T(t,3)))}function sp(e){var t=N(e)?Vs:Jc;return t(e)}function ap(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=U(t);var r=N(e)?bc:Xc;return r(e,t)}function op(e){var t=N(e)?Tc:Qc;return t(e)}function up(e){if(e==null)return 0;if(ye(e))return wr(e)?kt(e):e.length;var t=pe(e);return t==Be||t==ke?e.size:oi(e).length}function lp(e,t,n){var r=N(e)?qr:ef;return n&&ve(e,t,n)&&(t=i),r(e,T(t,3))}var cp=D(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ve(e,t[0],t[1])?t=[]:n>2&&ve(t[0],t[1],t[2])&&(t=[t[0]]),la(e,fe(t,1),[])}),vr=ql||function(){return ce.Date.now()};function fp(e,t){if(typeof t!="function")throw new Pe(x);return e=U(e),function(){if(--e<1)return t.apply(this,arguments)}}function ro(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,st(e,et,i,i,i,i,t)}function io(e,t){var n;if(typeof t!="function")throw new Pe(x);return e=U(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Pi=D(function(e,t,n){var r=Me;if(n.length){var s=vt(n,Zt(Pi));r|=Qe}return st(e,r,t,n,s)}),so=D(function(e,t,n){var r=Me|Ut;if(n.length){var s=vt(n,Zt(so));r|=Qe}return st(t,r,e,n,s)});function ao(e,t,n){t=n?i:t;var r=st(e,je,i,i,i,i,i,t);return r.placeholder=ao.placeholder,r}function oo(e,t,n){t=n?i:t;var r=st(e,en,i,i,i,i,i,t);return r.placeholder=oo.placeholder,r}function uo(e,t,n){var r,s,u,c,h,g,_=0,w=!1,S=!1,I=!0;if(typeof e!="function")throw new Pe(x);t=$e(t)||0,te(n)&&(w=!!n.leading,S="maxWait"in n,u=S?ue($e(n.maxWait)||0,t):u,I="trailing"in n?!!n.trailing:I);function b(se){var Ke=r,ct=s;return r=s=i,_=se,c=e.apply(ct,Ke),c}function R(se){return _=se,h=An(M,t),w?b(se):c}function $(se){var Ke=se-g,ct=se-_,To=t-Ke;return S?he(To,u-ct):To}function F(se){var Ke=se-g,ct=se-_;return g===i||Ke>=t||Ke<0||S&&ct>=u}function M(){var se=vr();if(F(se))return H(se);h=An(M,$(se))}function H(se){return h=i,I&&r?b(se):(r=s=i,c)}function Ce(){h!==i&&_a(h),_=0,r=g=s=h=i}function me(){return h===i?c:H(vr())}function be(){var se=vr(),Ke=F(se);if(r=arguments,s=this,g=se,Ke){if(h===i)return R(g);if(S)return _a(h),h=An(M,t),b(g)}return h===i&&(h=An(M,t)),c}return be.cancel=Ce,be.flush=me,be}var hp=D(function(e,t){return Xs(e,1,t)}),pp=D(function(e,t,n){return Xs(e,$e(t)||0,n)});function dp(e){return st(e,xr)}function mr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Pe(x);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],u=n.cache;if(u.has(s))return u.get(s);var c=e.apply(this,r);return n.cache=u.set(s,c)||u,c};return n.cache=new(mr.Cache||rt),n}mr.Cache=rt;function _r(e){if(typeof e!="function")throw new Pe(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 gp(e){return io(2,e)}var vp=tf(function(e,t){t=t.length==1&&N(t[0])?Q(t[0],Ee(T())):Q(fe(t,1),Ee(T()));var n=t.length;return D(function(r){for(var s=-1,u=he(r.length,n);++s<u;)r[s]=t[s].call(this,r[s]);return xe(e,this,r)})}),Oi=D(function(e,t){var n=vt(t,Zt(Oi));return st(e,Qe,i,t,n)}),lo=D(function(e,t){var n=vt(t,Zt(lo));return st(e,tn,i,t,n)}),mp=at(function(e,t){return st(e,nn,i,i,i,t)});function _p(e,t){if(typeof e!="function")throw new Pe(x);return t=t===i?t:U(t),D(e,t)}function yp(e,t){if(typeof e!="function")throw new Pe(x);return t=t==null?0:ue(U(t),0),D(function(n){var r=n[t],s=St(n,0,t);return r&&gt(s,r),xe(e,this,s)})}function wp(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new Pe(x);return te(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),uo(e,t,{leading:r,maxWait:t,trailing:s})}function Sp(e){return ro(e,1)}function xp(e,t){return Oi(vi(t),e)}function Ep(){if(!arguments.length)return[];var e=arguments[0];return N(e)?e:[e]}function Ap(e){return Le(e,q)}function Ip(e,t){return t=typeof t=="function"?t:i,Le(e,q,t)}function Cp(e){return Le(e,Z|q)}function bp(e,t){return t=typeof t=="function"?t:i,Le(e,Z|q,t)}function Tp(e,t){return t==null||Js(e,t,le(t))}function He(e,t){return e===t||e!==e&&t!==t}var Rp=cr(ii),Fp=cr(function(e,t){return e>=t}),Lt=na(function(){return arguments}())?na:function(e){return ne(e)&&Y.call(e,"callee")&&!Gs.call(e,"callee")},N=v.isArray,Pp=Es?Ee(Es):Wc;function ye(e){return e!=null&&yr(e.length)&&!ut(e)}function ie(e){return ne(e)&&ye(e)}function Op(e){return e===!0||e===!1||ne(e)&&ge(e)==rn}var xt=Kl||qi,Lp=As?Ee(As):Mc;function Np(e){return ne(e)&&e.nodeType===1&&!In(e)}function Up(e){if(e==null)return!0;if(ye(e)&&(N(e)||typeof e=="string"||typeof e.splice=="function"||xt(e)||Jt(e)||Lt(e)))return!e.length;var t=pe(e);if(t==Be||t==ke)return!e.size;if(En(e))return!oi(e).length;for(var n in e)if(Y.call(e,n))return!1;return!0}function $p(e,t){return wn(e,t)}function Dp(e,t,n){n=typeof n=="function"?n:i;var r=n?n(e,t):i;return r===i?wn(e,t,i,n):!!r}function Li(e){if(!ne(e))return!1;var t=ge(e);return t==Pn||t==su||typeof e.message=="string"&&typeof e.name=="string"&&!In(e)}function Wp(e){return typeof e=="number"&&Hs(e)}function ut(e){if(!te(e))return!1;var t=ge(e);return t==On||t==Xi||t==iu||t==ou}function co(e){return typeof e=="number"&&e==U(e)}function yr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pt}function te(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ne(e){return e!=null&&typeof e=="object"}var fo=Is?Ee(Is):kc;function Mp(e,t){return e===t||ai(e,t,Ei(t))}function Bp(e,t,n){return n=typeof n=="function"?n:i,ai(e,t,Ei(t),n)}function kp(e){return ho(e)&&e!=+e}function Gp(e){if(If(e))throw new L(E);return ra(e)}function qp(e){return e===null}function Hp(e){return e==null}function ho(e){return typeof e=="number"||ne(e)&&ge(e)==an}function In(e){if(!ne(e)||ge(e)!=tt)return!1;var t=zn(e);if(t===null)return!0;var n=Y.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gn.call(n)==Ml}var Ni=Cs?Ee(Cs):Gc;function Kp(e){return co(e)&&e>=-pt&&e<=pt}var po=bs?Ee(bs):qc;function wr(e){return typeof e=="string"||!N(e)&&ne(e)&&ge(e)==un}function Ie(e){return typeof e=="symbol"||ne(e)&&ge(e)==Ln}var Jt=Ts?Ee(Ts):Hc;function zp(e){return e===i}function Yp(e){return ne(e)&&pe(e)==ln}function Vp(e){return ne(e)&&ge(e)==lu}var Zp=cr(ui),Jp=cr(function(e,t){return e<=t});function go(e){if(!e)return[];if(ye(e))return wr(e)?Ge(e):_e(e);if(hn&&e[hn])return bl(e[hn]());var t=pe(e),n=t==Be?Zr:t==ke?Mn:Xt;return n(e)}function lt(e){if(!e)return e===0?e:0;if(e=$e(e),e===At||e===-At){var t=e<0?-1:1;return t*eu}return e===e?e:0}function U(e){var t=lt(e),n=t%1;return t===t?n?t-n:t:0}function vo(e){return e?Rt(U(e),0,Ye):0}function $e(e){if(typeof e=="number")return e;if(Ie(e))return Rn;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=Ns(e);var n=Fu.test(e);return n||Ou.test(e)?cl(e.slice(2),n?2:8):Ru.test(e)?Rn:+e}function mo(e){return Ze(e,we(e))}function Xp(e){return e?Rt(U(e),-pt,pt):e===0?e:0}function z(e){return e==null?"":Ae(e)}var jp=Yt(function(e,t){if(En(t)||ye(t)){Ze(t,le(t),e);return}for(var n in t)Y.call(t,n)&&mn(e,n,t[n])}),_o=Yt(function(e,t){Ze(t,we(t),e)}),Sr=Yt(function(e,t,n,r){Ze(t,we(t),e,r)}),Qp=Yt(function(e,t,n,r){Ze(t,le(t),e,r)}),ed=at(ti);function td(e,t){var n=zt(e);return t==null?n:Zs(n,t)}var nd=D(function(e,t){e=V(e);var n=-1,r=t.length,s=r>2?t[2]:i;for(s&&ve(t[0],t[1],s)&&(r=1);++n<r;)for(var u=t[n],c=we(u),h=-1,g=c.length;++h<g;){var _=c[h],w=e[_];(w===i||He(w,qt[_])&&!Y.call(e,_))&&(e[_]=u[_])}return e}),rd=D(function(e){return e.push(i,Na),xe(yo,i,e)});function id(e,t){return Fs(e,T(t,3),Ve)}function sd(e,t){return Fs(e,T(t,3),ri)}function ad(e,t){return e==null?e:ni(e,T(t,3),we)}function od(e,t){return e==null?e:ea(e,T(t,3),we)}function ud(e,t){return e&&Ve(e,T(t,3))}function ld(e,t){return e&&ri(e,T(t,3))}function cd(e){return e==null?[]:nr(e,le(e))}function fd(e){return e==null?[]:nr(e,we(e))}function Ui(e,t,n){var r=e==null?i:Ft(e,t);return r===i?n:r}function hd(e,t){return e!=null&&Da(e,t,Nc)}function $i(e,t){return e!=null&&Da(e,t,Uc)}var pd=Ra(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),e[t]=n},Wi(Se)),dd=Ra(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),Y.call(e,t)?e[t].push(n):e[t]=[n]},T),gd=D(yn);function le(e){return ye(e)?Ys(e):oi(e)}function we(e){return ye(e)?Ys(e,!0):Kc(e)}function vd(e,t){var n={};return t=T(t,3),Ve(e,function(r,s,u){it(n,t(r,s,u),r)}),n}function md(e,t){var n={};return t=T(t,3),Ve(e,function(r,s,u){it(n,s,t(r,s,u))}),n}var _d=Yt(function(e,t,n){rr(e,t,n)}),yo=Yt(function(e,t,n,r){rr(e,t,n,r)}),yd=at(function(e,t){var n={};if(e==null)return n;var r=!1;t=Q(t,function(u){return u=wt(u,e),r||(r=u.length>1),u}),Ze(e,Si(e),n),r&&(n=Le(n,Z|ze|q,pf));for(var s=t.length;s--;)pi(n,t[s]);return n});function wd(e,t){return wo(e,_r(T(t)))}var Sd=at(function(e,t){return e==null?{}:Yc(e,t)});function wo(e,t){if(e==null)return{};var n=Q(Si(e),function(r){return[r]});return t=T(t),ca(e,n,function(r,s){return t(r,s[0])})}function xd(e,t,n){t=wt(t,e);var r=-1,s=t.length;for(s||(s=1,e=i);++r<s;){var u=e==null?i:e[Je(t[r])];u===i&&(r=s,u=n),e=ut(u)?u.call(e):u}return e}function Ed(e,t,n){return e==null?e:Sn(e,t,n)}function Ad(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:Sn(e,t,n,r)}var So=Oa(le),xo=Oa(we);function Id(e,t,n){var r=N(e),s=r||xt(e)||Jt(e);if(t=T(t,4),n==null){var u=e&&e.constructor;s?n=r?new u:[]:te(e)?n=ut(u)?zt(zn(e)):{}:n={}}return(s?Fe:Ve)(e,function(c,h,g){return t(n,c,h,g)}),n}function Cd(e,t){return e==null?!0:pi(e,t)}function bd(e,t,n){return e==null?e:ga(e,t,vi(n))}function Td(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:ga(e,t,vi(n),r)}function Xt(e){return e==null?[]:Vr(e,le(e))}function Rd(e){return e==null?[]:Vr(e,we(e))}function Fd(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=$e(n),n=n===n?n:0),t!==i&&(t=$e(t),t=t===t?t:0),Rt($e(e),t,n)}function Pd(e,t,n){return t=lt(t),n===i?(n=t,t=0):n=lt(n),e=$e(e),$c(e,t,n)}function Od(e,t,n){if(n&&typeof n!="boolean"&&ve(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=lt(e),t===i?(t=e,e=0):t=lt(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var s=Ks();return he(e+s*(t-e+ll("1e-"+((s+"").length-1))),t)}return ci(e,t)}var Ld=Vt(function(e,t,n){return t=t.toLowerCase(),e+(n?Eo(t):t)});function Eo(e){return Di(z(e).toLowerCase())}function Ao(e){return e=z(e),e&&e.replace(Nu,xl).replace(Qu,"")}function Nd(e,t,n){e=z(e),t=Ae(t);var r=e.length;n=n===i?r:Rt(U(n),0,r);var s=n;return n-=t.length,n>=0&&e.slice(n,s)==t}function Ud(e){return e=z(e),e&&du.test(e)?e.replace(es,El):e}function $d(e){return e=z(e),e&&wu.test(e)?e.replace(Or,"\\$&"):e}var Dd=Vt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Wd=Vt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Md=Ca("toLowerCase");function Bd(e,t,n){e=z(e),t=U(t);var r=t?kt(e):0;if(!t||r>=t)return e;var s=(t-r)/2;return lr(Jn(s),n)+e+lr(Zn(s),n)}function kd(e,t,n){e=z(e),t=U(t);var r=t?kt(e):0;return t&&r<t?e+lr(t-r,n):e}function Gd(e,t,n){e=z(e),t=U(t);var r=t?kt(e):0;return t&&r<t?lr(t-r,n)+e:e}function qd(e,t,n){return n||t==null?t=0:t&&(t=+t),Zl(z(e).replace(Lr,""),t||0)}function Hd(e,t,n){return(n?ve(e,t,n):t===i)?t=1:t=U(t),fi(z(e),t)}function Kd(){var e=arguments,t=z(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var zd=Vt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Yd(e,t,n){return n&&typeof n!="number"&&ve(e,t,n)&&(t=n=i),n=n===i?Ye:n>>>0,n?(e=z(e),e&&(typeof t=="string"||t!=null&&!Ni(t))&&(t=Ae(t),!t&&Bt(e))?St(Ge(e),0,n):e.split(t,n)):[]}var Vd=Vt(function(e,t,n){return e+(n?" ":"")+Di(t)});function Zd(e,t,n){return e=z(e),n=n==null?0:Rt(U(n),0,e.length),t=Ae(t),e.slice(n,n+t.length)==t}function Jd(e,t,n){var r=o.templateSettings;n&&ve(e,t,n)&&(t=i),e=z(e),t=Sr({},t,r,La);var s=Sr({},t.imports,r.imports,La),u=le(s),c=Vr(s,u),h,g,_=0,w=t.interpolate||Nn,S="__p += '",I=Jr((t.escape||Nn).source+"|"+w.source+"|"+(w===ts?Tu:Nn).source+"|"+(t.evaluate||Nn).source+"|$","g"),b="//# sourceURL="+(Y.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++il+"]")+`
12
+ `;e.replace(I,function(F,M,H,Ce,me,be){return H||(H=Ce),S+=e.slice(_,be).replace(Uu,Al),M&&(h=!0,S+=`' +
13
+ __e(`+M+`) +
14
14
  '`),me&&(g=!0,S+=`';
15
15
  `+me+`;
16
16
  __p += '`),H&&(S+=`' +
17
17
  ((__t = (`+H+`)) == null ? '' : __t) +
18
- '`),_=Ce+P.length,P}),S+=`';
19
- `;var F=V.call(t,"variable")&&t.variable;if(!F)S=`with (obj) {
18
+ '`),_=be+F.length,F}),S+=`';
19
+ `;var R=Y.call(t,"variable")&&t.variable;if(!R)S=`with (obj) {
20
20
  `+S+`
21
21
  }
22
- `;else if(Ru.test(F))throw new U(B);S=(g?S.replace(hu,""):S).replace(pu,"$1").replace(du,"$1;"),S="function("+(F||"obj")+`) {
23
- `+(F?"":`obj || (obj = {});
22
+ `;else if(Cu.test(R))throw new L(G);S=(g?S.replace(cu,""):S).replace(fu,"$1").replace(hu,"$1;"),S="function("+(R||"obj")+`) {
23
+ `+(R?"":`obj || (obj = {});
24
24
  `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
25
25
  function print() { __p += __j.call(arguments, '') }
26
26
  `:`;
27
27
  `)+S+`return __p
28
- }`;var D=Ro(function(){return z(u,C+"return "+S).apply(i,c)});if(D.source=S,Ui(D))throw D;return D}function Qd(e){return Y(e).toLowerCase()}function eg(e){return Y(e).toUpperCase()}function tg(e,t,n){if(e=Y(e),e&&(n||t===i))return Ns(e);if(!e||!(t=Ae(t)))return e;var r=qe(e),s=qe(t),u=Ds(r,s),c=Ws(r,s)+1;return wt(r,u,c).join("")}function ng(e,t,n){if(e=Y(e),e&&(n||t===i))return e.slice(0,Bs(e)+1);if(!e||!(t=Ae(t)))return e;var r=qe(e),s=Ws(r,qe(t))+1;return wt(r,0,s).join("")}function rg(e,t,n){if(e=Y(e),e&&(n||t===i))return e.replace(Ur,"");if(!e||!(t=Ae(t)))return e;var r=qe(e),s=Ds(r,qe(t));return wt(r,s).join("")}function ig(e,t){var n=Zo,r=jo;if(te(t)){var s="separator"in t?t.separator:s;n="length"in t?N(t.length):n,r="omission"in t?Ae(t.omission):r}e=Y(e);var u=e.length;if(Mt(e)){var c=qe(e);u=c.length}if(n>=u)return e;var h=n-Bt(r);if(h<1)return r;var g=c?wt(c,0,h).join(""):e.slice(0,h);if(s===i)return g+r;if(c&&(h+=g.length-h),$i(s)){if(e.slice(h).search(s)){var _,y=g;for(s.global||(s=jr(s.source,Y(is.exec(s))+"g")),s.lastIndex=0;_=s.exec(y);)var S=_.index;g=g.slice(0,S===i?h:S)}}else if(e.indexOf(Ae(s),h)!=h){var A=g.lastIndexOf(s);A>-1&&(g=g.slice(0,A))}return g+r}function sg(e){return e=Y(e),e&&gu.test(e)?e.replace(ts,Ll):e}var ag=Yt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wi=Ra("toUpperCase");function Co(e,t,n){return e=Y(e),t=n?i:t,t===i?Rl(e)?Nl(e):yl(e):e.match(t)||[]}var Ro=M(function(e,t){try{return xe(e,i,t)}catch(n){return Ui(n)?n:new U(n)}}),og=st(function(e,t){return Fe(t,function(n){n=Ze(n),rt(e,n,Oi(e[n],e))}),e});function ug(e){var t=e==null?0:e.length,n=R();return e=t?ee(e,function(r){if(typeof r[1]!="function")throw new Pe(I);return[n(r[0]),r[1]]}):[],M(function(r){for(var s=-1;++s<t;){var u=e[s];if(xe(u[0],this,r))return xe(u[1],this,r)}})}function lg(e){return Lc(Le(e,K))}function Mi(e){return function(){return e}}function cg(e,t){return e==null||e!==e?t:e}var fg=Fa(),hg=Fa(!0);function Se(e){return e}function Bi(e){return aa(typeof e=="function"?e:Le(e,K))}function pg(e){return ua(Le(e,K))}function dg(e,t){return la(e,Le(t,K))}var gg=M(function(e,t){return function(n){return mn(n,e,t)}}),vg=M(function(e,t){return function(n){return mn(e,n,t)}});function ki(e,t,n){var r=le(t),s=nr(t,r);n==null&&!(te(t)&&(s.length||!r.length))&&(n=t,t=e,e=this,s=nr(t,le(t)));var u=!(te(n)&&"chain"in n)||!!n.chain,c=ot(e);return Fe(s,function(h){var g=t[h];e[h]=g,c&&(e.prototype[h]=function(){var _=this.__chain__;if(u||_){var y=e(this.__wrapped__),S=y.__actions__=_e(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),y.__chain__=_,y}return g.apply(e,dt([this.value()],arguments))})}),e}function mg(){return ce._===this&&(ce._=Gl),this}function Gi(){}function _g(e){return e=N(e),M(function(t){return ca(t,e)})}var yg=yi(ee),wg=yi(Ps),Sg=yi(Hr);function To(e){return bi(e)?Kr(Ze(e)):Zc(e)}function xg(e){return function(t){return e==null?i:Ft(e,t)}}var Ig=Oa(),Ag=Oa(!0);function qi(){return[]}function Hi(){return!1}function Eg(){return{}}function bg(){return""}function Cg(){return!0}function Rg(e,t){if(e=N(e),e<1||e>ht)return[];var n=Ye,r=he(e,Ye);t=R(t),e-=Ye;for(var s=Vr(r,t);++n<e;)t(n);return s}function Tg(e){return $(e)?ee(e,Ze):Ee(e)?[e]:_e(Va(Y(e)))}function Fg(e){var t=++Bl;return Y(e)+t}var Pg=ur(function(e,t){return e+t},0),Og=wi("ceil"),Lg=ur(function(e,t){return e/t},1),Ug=wi("floor");function $g(e){return e&&e.length?tr(e,Se,si):i}function Ng(e,t){return e&&e.length?tr(e,R(t,2),si):i}function Dg(e){return Us(e,Se)}function Wg(e,t){return Us(e,R(t,2))}function Mg(e){return e&&e.length?tr(e,Se,li):i}function Bg(e,t){return e&&e.length?tr(e,R(t,2),li):i}var kg=ur(function(e,t){return e*t},1),Gg=wi("round"),qg=ur(function(e,t){return e-t},0);function Hg(e){return e&&e.length?Yr(e,Se):0}function Kg(e,t){return e&&e.length?Yr(e,R(t,2)):0}return o.after=pp,o.ary=so,o.assign=ed,o.assignIn=wo,o.assignInWith=Sr,o.assignWith=td,o.at=nd,o.before=ao,o.bind=Oi,o.bindAll=og,o.bindKey=oo,o.castArray=Ep,o.chain=no,o.chunk=Uf,o.compact=$f,o.concat=Nf,o.cond=ug,o.conforms=lg,o.constant=Mi,o.countBy=Hh,o.create=rd,o.curry=uo,o.curryRight=lo,o.debounce=co,o.defaults=id,o.defaultsDeep=sd,o.defer=dp,o.delay=gp,o.difference=Df,o.differenceBy=Wf,o.differenceWith=Mf,o.drop=Bf,o.dropRight=kf,o.dropRightWhile=Gf,o.dropWhile=qf,o.fill=Hf,o.filter=zh,o.flatMap=Jh,o.flatMapDeep=Zh,o.flatMapDepth=jh,o.flatten=Xa,o.flattenDeep=Kf,o.flattenDepth=zf,o.flip=vp,o.flow=fg,o.flowRight=hg,o.fromPairs=Yf,o.functions=hd,o.functionsIn=pd,o.groupBy=Xh,o.initial=Jf,o.intersection=Zf,o.intersectionBy=jf,o.intersectionWith=Xf,o.invert=gd,o.invertBy=vd,o.invokeMap=ep,o.iteratee=Bi,o.keyBy=tp,o.keys=le,o.keysIn=we,o.map=gr,o.mapKeys=_d,o.mapValues=yd,o.matches=pg,o.matchesProperty=dg,o.memoize=mr,o.merge=wd,o.mergeWith=So,o.method=gg,o.methodOf=vg,o.mixin=ki,o.negate=_r,o.nthArg=_g,o.omit=Sd,o.omitBy=xd,o.once=mp,o.orderBy=np,o.over=yg,o.overArgs=_p,o.overEvery=wg,o.overSome=Sg,o.partial=Li,o.partialRight=fo,o.partition=rp,o.pick=Id,o.pickBy=xo,o.property=To,o.propertyOf=xg,o.pull=nh,o.pullAll=eo,o.pullAllBy=rh,o.pullAllWith=ih,o.pullAt=sh,o.range=Ig,o.rangeRight=Ag,o.rearg=yp,o.reject=ap,o.remove=ah,o.rest=wp,o.reverse=Fi,o.sampleSize=up,o.set=Ed,o.setWith=bd,o.shuffle=lp,o.slice=oh,o.sortBy=hp,o.sortedUniq=dh,o.sortedUniqBy=gh,o.split=Jd,o.spread=Sp,o.tail=vh,o.take=mh,o.takeRight=_h,o.takeRightWhile=yh,o.takeWhile=wh,o.tap=$h,o.throttle=xp,o.thru=dr,o.toArray=mo,o.toPairs=Io,o.toPairsIn=Ao,o.toPath=Tg,o.toPlainObject=yo,o.transform=Cd,o.unary=Ip,o.union=Sh,o.unionBy=xh,o.unionWith=Ih,o.uniq=Ah,o.uniqBy=Eh,o.uniqWith=bh,o.unset=Rd,o.unzip=Pi,o.unzipWith=to,o.update=Td,o.updateWith=Fd,o.values=Zt,o.valuesIn=Pd,o.without=Ch,o.words=Co,o.wrap=Ap,o.xor=Rh,o.xorBy=Th,o.xorWith=Fh,o.zip=Ph,o.zipObject=Oh,o.zipObjectDeep=Lh,o.zipWith=Uh,o.entries=Io,o.entriesIn=Ao,o.extend=wo,o.extendWith=Sr,ki(o,o),o.add=Pg,o.attempt=Ro,o.camelCase=$d,o.capitalize=Eo,o.ceil=Og,o.clamp=Od,o.clone=bp,o.cloneDeep=Rp,o.cloneDeepWith=Tp,o.cloneWith=Cp,o.conformsTo=Fp,o.deburr=bo,o.defaultTo=cg,o.divide=Lg,o.endsWith=Nd,o.eq=Ke,o.escape=Dd,o.escapeRegExp=Wd,o.every=Kh,o.find=Yh,o.findIndex=Za,o.findKey=ad,o.findLast=Vh,o.findLastIndex=ja,o.findLastKey=od,o.floor=Ug,o.forEach=ro,o.forEachRight=io,o.forIn=ud,o.forInRight=ld,o.forOwn=cd,o.forOwnRight=fd,o.get=Ni,o.gt=Pp,o.gte=Op,o.has=dd,o.hasIn=Di,o.head=Qa,o.identity=Se,o.includes=Qh,o.indexOf=Vf,o.inRange=Ld,o.invoke=md,o.isArguments=Lt,o.isArray=$,o.isArrayBuffer=Lp,o.isArrayLike=ye,o.isArrayLikeObject=re,o.isBoolean=Up,o.isBuffer=St,o.isDate=$p,o.isElement=Np,o.isEmpty=Dp,o.isEqual=Wp,o.isEqualWith=Mp,o.isError=Ui,o.isFinite=Bp,o.isFunction=ot,o.isInteger=ho,o.isLength=yr,o.isMap=po,o.isMatch=kp,o.isMatchWith=Gp,o.isNaN=qp,o.isNative=Hp,o.isNil=zp,o.isNull=Kp,o.isNumber=go,o.isObject=te,o.isObjectLike=ne,o.isPlainObject=In,o.isRegExp=$i,o.isSafeInteger=Yp,o.isSet=vo,o.isString=wr,o.isSymbol=Ee,o.isTypedArray=Jt,o.isUndefined=Vp,o.isWeakMap=Jp,o.isWeakSet=Zp,o.join=Qf,o.kebabCase=Md,o.last=$e,o.lastIndexOf=eh,o.lowerCase=Bd,o.lowerFirst=kd,o.lt=jp,o.lte=Xp,o.max=$g,o.maxBy=Ng,o.mean=Dg,o.meanBy=Wg,o.min=Mg,o.minBy=Bg,o.stubArray=qi,o.stubFalse=Hi,o.stubObject=Eg,o.stubString=bg,o.stubTrue=Cg,o.multiply=kg,o.nth=th,o.noConflict=mg,o.noop=Gi,o.now=vr,o.pad=Gd,o.padEnd=qd,o.padStart=Hd,o.parseInt=Kd,o.random=Ud,o.reduce=ip,o.reduceRight=sp,o.repeat=zd,o.replace=Yd,o.result=Ad,o.round=Gg,o.runInContext=d,o.sample=op,o.size=cp,o.snakeCase=Vd,o.some=fp,o.sortedIndex=uh,o.sortedIndexBy=lh,o.sortedIndexOf=ch,o.sortedLastIndex=fh,o.sortedLastIndexBy=hh,o.sortedLastIndexOf=ph,o.startCase=Zd,o.startsWith=jd,o.subtract=qg,o.sum=Hg,o.sumBy=Kg,o.template=Xd,o.times=Rg,o.toFinite=ut,o.toInteger=N,o.toLength=_o,o.toLower=Qd,o.toNumber=Ne,o.toSafeInteger=Qp,o.toString=Y,o.toUpper=eg,o.trim=tg,o.trimEnd=ng,o.trimStart=rg,o.truncate=ig,o.unescape=sg,o.uniqueId=Fg,o.upperCase=ag,o.upperFirst=Wi,o.each=ro,o.eachRight=io,o.first=Qa,ki(o,function(){var e={};return Ve(o,function(t,n){V.call(o.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),o.VERSION=l,Fe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Fe(["drop","take"],function(e,t){G.prototype[e]=function(n){n=n===i?1:oe(N(n),0);var r=this.__filtered__&&!t?new G(this):this.clone();return r.__filtered__?r.__takeCount__=he(n,r.__takeCount__):r.__views__.push({size:he(n,Ye),type:e+(r.__dir__<0?"Right":"")}),r},G.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Fe(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==Xi||n==tu;G.prototype[e]=function(s){var u=this.clone();return u.__iteratees__.push({iteratee:R(s,3),type:n}),u.__filtered__=u.__filtered__||r,u}}),Fe(["head","last"],function(e,t){var n="take"+(t?"Right":"");G.prototype[e]=function(){return this[n](1).value()[0]}}),Fe(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");G.prototype[e]=function(){return this.__filtered__?new G(this):this[n](1)}}),G.prototype.compact=function(){return this.filter(Se)},G.prototype.find=function(e){return this.filter(e).head()},G.prototype.findLast=function(e){return this.reverse().find(e)},G.prototype.invokeMap=M(function(e,t){return typeof e=="function"?new G(this):this.map(function(n){return mn(n,e,t)})}),G.prototype.reject=function(e){return this.filter(_r(R(e)))},G.prototype.slice=function(e,t){e=N(e);var n=this;return n.__filtered__&&(e>0||t<0)?new G(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(t=N(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},G.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},G.prototype.toArray=function(){return this.take(Ye)},Ve(G.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),s=o[r?"take"+(t=="last"?"Right":""):t],u=r||/^find/.test(t);s&&(o.prototype[t]=function(){var c=this.__wrapped__,h=r?[1]:arguments,g=c instanceof G,_=h[0],y=g||$(c),S=function(k){var H=s.apply(o,dt([k],h));return r&&A?H[0]:H};y&&n&&typeof _=="function"&&_.length!=1&&(g=y=!1);var A=this.__chain__,C=!!this.__actions__.length,F=u&&!A,D=g&&!C;if(!u&&y){c=D?c:new G(this);var P=e.apply(c,h);return P.__actions__.push({func:dr,args:[S],thisArg:i}),new Oe(P,A)}return F&&D?e.apply(this,h):(P=this.thru(S),F?r?P.value()[0]:P.value():P)})}),Fe(["pop","push","shift","sort","splice","unshift"],function(e){var t=Bn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var s=arguments;if(r&&!this.__chain__){var u=this.value();return t.apply($(u)?u:[],s)}return this[n](function(c){return t.apply($(c)?c:[],s)})}}),Ve(G.prototype,function(e,t){var n=o[t];if(n){var r=n.name+"";V.call(Ht,r)||(Ht[r]=[]),Ht[r].push({name:t,func:n})}}),Ht[or(i,Ut).name]=[{name:"wrapper",func:i}],G.prototype.clone=ic,G.prototype.reverse=sc,G.prototype.value=ac,o.prototype.at=Nh,o.prototype.chain=Dh,o.prototype.commit=Wh,o.prototype.next=Mh,o.prototype.plant=kh,o.prototype.reverse=Gh,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=qh,o.prototype.first=o.prototype.head,cn&&(o.prototype[cn]=Bh),o},kt=Dl();Et?((Et.exports=kt)._=kt,Br._=kt):ce._=kt}).call(lv)}(En,En.exports)),En.exports}var fv=cv();const Ki=f=>{const a=fv.startCase(f).toLowerCase();return a.charAt(0).toUpperCase()+a.slice(1)},hv=({data:f})=>{const a=de.v4(),i=f.description?`
28
+ }`;var $=Co(function(){return K(u,b+"return "+S).apply(i,c)});if($.source=S,Li($))throw $;return $}function Xd(e){return z(e).toLowerCase()}function jd(e){return z(e).toUpperCase()}function Qd(e,t,n){if(e=z(e),e&&(n||t===i))return Ns(e);if(!e||!(t=Ae(t)))return e;var r=Ge(e),s=Ge(t),u=Us(r,s),c=$s(r,s)+1;return St(r,u,c).join("")}function eg(e,t,n){if(e=z(e),e&&(n||t===i))return e.slice(0,Ws(e)+1);if(!e||!(t=Ae(t)))return e;var r=Ge(e),s=$s(r,Ge(t))+1;return St(r,0,s).join("")}function tg(e,t,n){if(e=z(e),e&&(n||t===i))return e.replace(Lr,"");if(!e||!(t=Ae(t)))return e;var r=Ge(e),s=Us(r,Ge(t));return St(r,s).join("")}function ng(e,t){var n=Vo,r=Zo;if(te(t)){var s="separator"in t?t.separator:s;n="length"in t?U(t.length):n,r="omission"in t?Ae(t.omission):r}e=z(e);var u=e.length;if(Bt(e)){var c=Ge(e);u=c.length}if(n>=u)return e;var h=n-kt(r);if(h<1)return r;var g=c?St(c,0,h).join(""):e.slice(0,h);if(s===i)return g+r;if(c&&(h+=g.length-h),Ni(s)){if(e.slice(h).search(s)){var _,w=g;for(s.global||(s=Jr(s.source,z(ns.exec(s))+"g")),s.lastIndex=0;_=s.exec(w);)var S=_.index;g=g.slice(0,S===i?h:S)}}else if(e.indexOf(Ae(s),h)!=h){var I=g.lastIndexOf(s);I>-1&&(g=g.slice(0,I))}return g+r}function rg(e){return e=z(e),e&&pu.test(e)?e.replace(Qi,Pl):e}var ig=Vt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Di=Ca("toUpperCase");function Io(e,t,n){return e=z(e),t=n?i:t,t===i?Cl(e)?Nl(e):ml(e):e.match(t)||[]}var Co=D(function(e,t){try{return xe(e,i,t)}catch(n){return Li(n)?n:new L(n)}}),sg=at(function(e,t){return Fe(t,function(n){n=Je(n),it(e,n,Pi(e[n],e))}),e});function ag(e){var t=e==null?0:e.length,n=T();return e=t?Q(e,function(r){if(typeof r[1]!="function")throw new Pe(x);return[n(r[0]),r[1]]}):[],D(function(r){for(var s=-1;++s<t;){var u=e[s];if(xe(u[0],this,r))return xe(u[1],this,r)}})}function og(e){return Pc(Le(e,Z))}function Wi(e){return function(){return e}}function ug(e,t){return e==null||e!==e?t:e}var lg=Ta(),cg=Ta(!0);function Se(e){return e}function Mi(e){return ia(typeof e=="function"?e:Le(e,Z))}function fg(e){return aa(Le(e,Z))}function hg(e,t){return oa(e,Le(t,Z))}var pg=D(function(e,t){return function(n){return yn(n,e,t)}}),dg=D(function(e,t){return function(n){return yn(e,n,t)}});function Bi(e,t,n){var r=le(t),s=nr(t,r);n==null&&!(te(t)&&(s.length||!r.length))&&(n=t,t=e,e=this,s=nr(t,le(t)));var u=!(te(n)&&"chain"in n)||!!n.chain,c=ut(e);return Fe(s,function(h){var g=t[h];e[h]=g,c&&(e.prototype[h]=function(){var _=this.__chain__;if(u||_){var w=e(this.__wrapped__),S=w.__actions__=_e(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),w.__chain__=_,w}return g.apply(e,gt([this.value()],arguments))})}),e}function gg(){return ce._===this&&(ce._=Bl),this}function ki(){}function vg(e){return e=U(e),D(function(t){return ua(t,e)})}var mg=_i(Q),_g=_i(Rs),yg=_i(qr);function bo(e){return Ii(e)?Hr(Je(e)):Vc(e)}function wg(e){return function(t){return e==null?i:Ft(e,t)}}var Sg=Fa(),xg=Fa(!0);function Gi(){return[]}function qi(){return!1}function Eg(){return{}}function Ag(){return""}function Ig(){return!0}function Cg(e,t){if(e=U(e),e<1||e>pt)return[];var n=Ye,r=he(e,Ye);t=T(t),e-=Ye;for(var s=Yr(r,t);++n<e;)t(n);return s}function bg(e){return N(e)?Q(e,Je):Ie(e)?[e]:_e(za(z(e)))}function Tg(e){var t=++Wl;return z(e)+t}var Rg=ur(function(e,t){return e+t},0),Fg=yi("ceil"),Pg=ur(function(e,t){return e/t},1),Og=yi("floor");function Lg(e){return e&&e.length?tr(e,Se,ii):i}function Ng(e,t){return e&&e.length?tr(e,T(t,2),ii):i}function Ug(e){return Os(e,Se)}function $g(e,t){return Os(e,T(t,2))}function Dg(e){return e&&e.length?tr(e,Se,ui):i}function Wg(e,t){return e&&e.length?tr(e,T(t,2),ui):i}var Mg=ur(function(e,t){return e*t},1),Bg=yi("round"),kg=ur(function(e,t){return e-t},0);function Gg(e){return e&&e.length?zr(e,Se):0}function qg(e,t){return e&&e.length?zr(e,T(t,2)):0}return o.after=fp,o.ary=ro,o.assign=jp,o.assignIn=_o,o.assignInWith=Sr,o.assignWith=Qp,o.at=ed,o.before=io,o.bind=Pi,o.bindAll=sg,o.bindKey=so,o.castArray=Ep,o.chain=eo,o.chunk=Of,o.compact=Lf,o.concat=Nf,o.cond=ag,o.conforms=og,o.constant=Wi,o.countBy=Gh,o.create=td,o.curry=ao,o.curryRight=oo,o.debounce=uo,o.defaults=nd,o.defaultsDeep=rd,o.defer=hp,o.delay=pp,o.difference=Uf,o.differenceBy=$f,o.differenceWith=Df,o.drop=Wf,o.dropRight=Mf,o.dropRightWhile=Bf,o.dropWhile=kf,o.fill=Gf,o.filter=Hh,o.flatMap=Yh,o.flatMapDeep=Vh,o.flatMapDepth=Zh,o.flatten=Ja,o.flattenDeep=qf,o.flattenDepth=Hf,o.flip=dp,o.flow=lg,o.flowRight=cg,o.fromPairs=Kf,o.functions=cd,o.functionsIn=fd,o.groupBy=Jh,o.initial=Yf,o.intersection=Vf,o.intersectionBy=Zf,o.intersectionWith=Jf,o.invert=pd,o.invertBy=dd,o.invokeMap=jh,o.iteratee=Mi,o.keyBy=Qh,o.keys=le,o.keysIn=we,o.map=gr,o.mapKeys=vd,o.mapValues=md,o.matches=fg,o.matchesProperty=hg,o.memoize=mr,o.merge=_d,o.mergeWith=yo,o.method=pg,o.methodOf=dg,o.mixin=Bi,o.negate=_r,o.nthArg=vg,o.omit=yd,o.omitBy=wd,o.once=gp,o.orderBy=ep,o.over=mg,o.overArgs=vp,o.overEvery=_g,o.overSome=yg,o.partial=Oi,o.partialRight=lo,o.partition=tp,o.pick=Sd,o.pickBy=wo,o.property=bo,o.propertyOf=wg,o.pull=eh,o.pullAll=ja,o.pullAllBy=th,o.pullAllWith=nh,o.pullAt=rh,o.range=Sg,o.rangeRight=xg,o.rearg=mp,o.reject=ip,o.remove=ih,o.rest=_p,o.reverse=Ri,o.sampleSize=ap,o.set=Ed,o.setWith=Ad,o.shuffle=op,o.slice=sh,o.sortBy=cp,o.sortedUniq=hh,o.sortedUniqBy=ph,o.split=Yd,o.spread=yp,o.tail=dh,o.take=gh,o.takeRight=vh,o.takeRightWhile=mh,o.takeWhile=_h,o.tap=Lh,o.throttle=wp,o.thru=dr,o.toArray=go,o.toPairs=So,o.toPairsIn=xo,o.toPath=bg,o.toPlainObject=mo,o.transform=Id,o.unary=Sp,o.union=yh,o.unionBy=wh,o.unionWith=Sh,o.uniq=xh,o.uniqBy=Eh,o.uniqWith=Ah,o.unset=Cd,o.unzip=Fi,o.unzipWith=Qa,o.update=bd,o.updateWith=Td,o.values=Xt,o.valuesIn=Rd,o.without=Ih,o.words=Io,o.wrap=xp,o.xor=Ch,o.xorBy=bh,o.xorWith=Th,o.zip=Rh,o.zipObject=Fh,o.zipObjectDeep=Ph,o.zipWith=Oh,o.entries=So,o.entriesIn=xo,o.extend=_o,o.extendWith=Sr,Bi(o,o),o.add=Rg,o.attempt=Co,o.camelCase=Ld,o.capitalize=Eo,o.ceil=Fg,o.clamp=Fd,o.clone=Ap,o.cloneDeep=Cp,o.cloneDeepWith=bp,o.cloneWith=Ip,o.conformsTo=Tp,o.deburr=Ao,o.defaultTo=ug,o.divide=Pg,o.endsWith=Nd,o.eq=He,o.escape=Ud,o.escapeRegExp=$d,o.every=qh,o.find=Kh,o.findIndex=Va,o.findKey=id,o.findLast=zh,o.findLastIndex=Za,o.findLastKey=sd,o.floor=Og,o.forEach=to,o.forEachRight=no,o.forIn=ad,o.forInRight=od,o.forOwn=ud,o.forOwnRight=ld,o.get=Ui,o.gt=Rp,o.gte=Fp,o.has=hd,o.hasIn=$i,o.head=Xa,o.identity=Se,o.includes=Xh,o.indexOf=zf,o.inRange=Pd,o.invoke=gd,o.isArguments=Lt,o.isArray=N,o.isArrayBuffer=Pp,o.isArrayLike=ye,o.isArrayLikeObject=ie,o.isBoolean=Op,o.isBuffer=xt,o.isDate=Lp,o.isElement=Np,o.isEmpty=Up,o.isEqual=$p,o.isEqualWith=Dp,o.isError=Li,o.isFinite=Wp,o.isFunction=ut,o.isInteger=co,o.isLength=yr,o.isMap=fo,o.isMatch=Mp,o.isMatchWith=Bp,o.isNaN=kp,o.isNative=Gp,o.isNil=Hp,o.isNull=qp,o.isNumber=ho,o.isObject=te,o.isObjectLike=ne,o.isPlainObject=In,o.isRegExp=Ni,o.isSafeInteger=Kp,o.isSet=po,o.isString=wr,o.isSymbol=Ie,o.isTypedArray=Jt,o.isUndefined=zp,o.isWeakMap=Yp,o.isWeakSet=Vp,o.join=Xf,o.kebabCase=Dd,o.last=Ue,o.lastIndexOf=jf,o.lowerCase=Wd,o.lowerFirst=Md,o.lt=Zp,o.lte=Jp,o.max=Lg,o.maxBy=Ng,o.mean=Ug,o.meanBy=$g,o.min=Dg,o.minBy=Wg,o.stubArray=Gi,o.stubFalse=qi,o.stubObject=Eg,o.stubString=Ag,o.stubTrue=Ig,o.multiply=Mg,o.nth=Qf,o.noConflict=gg,o.noop=ki,o.now=vr,o.pad=Bd,o.padEnd=kd,o.padStart=Gd,o.parseInt=qd,o.random=Od,o.reduce=np,o.reduceRight=rp,o.repeat=Hd,o.replace=Kd,o.result=xd,o.round=Bg,o.runInContext=d,o.sample=sp,o.size=up,o.snakeCase=zd,o.some=lp,o.sortedIndex=ah,o.sortedIndexBy=oh,o.sortedIndexOf=uh,o.sortedLastIndex=lh,o.sortedLastIndexBy=ch,o.sortedLastIndexOf=fh,o.startCase=Vd,o.startsWith=Zd,o.subtract=kg,o.sum=Gg,o.sumBy=qg,o.template=Jd,o.times=Cg,o.toFinite=lt,o.toInteger=U,o.toLength=vo,o.toLower=Xd,o.toNumber=$e,o.toSafeInteger=Xp,o.toString=z,o.toUpper=jd,o.trim=Qd,o.trimEnd=eg,o.trimStart=tg,o.truncate=ng,o.unescape=rg,o.uniqueId=Tg,o.upperCase=ig,o.upperFirst=Di,o.each=to,o.eachRight=no,o.first=Xa,Bi(o,function(){var e={};return Ve(o,function(t,n){Y.call(o.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),o.VERSION=l,Fe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Fe(["drop","take"],function(e,t){k.prototype[e]=function(n){n=n===i?1:ue(U(n),0);var r=this.__filtered__&&!t?new k(this):this.clone();return r.__filtered__?r.__takeCount__=he(n,r.__takeCount__):r.__views__.push({size:he(n,Ye),type:e+(r.__dir__<0?"Right":"")}),r},k.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Fe(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==Ji||n==Qo;k.prototype[e]=function(s){var u=this.clone();return u.__iteratees__.push({iteratee:T(s,3),type:n}),u.__filtered__=u.__filtered__||r,u}}),Fe(["head","last"],function(e,t){var n="take"+(t?"Right":"");k.prototype[e]=function(){return this[n](1).value()[0]}}),Fe(["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=D(function(e,t){return typeof e=="function"?new k(this):this.map(function(n){return yn(n,e,t)})}),k.prototype.reject=function(e){return this.filter(_r(T(e)))},k.prototype.slice=function(e,t){e=U(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!==i&&(t=U(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(Ye)},Ve(k.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),s=o[r?"take"+(t=="last"?"Right":""):t],u=r||/^find/.test(t);s&&(o.prototype[t]=function(){var c=this.__wrapped__,h=r?[1]:arguments,g=c instanceof k,_=h[0],w=g||N(c),S=function(M){var H=s.apply(o,gt([M],h));return r&&I?H[0]:H};w&&n&&typeof _=="function"&&_.length!=1&&(g=w=!1);var I=this.__chain__,b=!!this.__actions__.length,R=u&&!I,$=g&&!b;if(!u&&w){c=$?c:new k(this);var F=e.apply(c,h);return F.__actions__.push({func:dr,args:[S],thisArg:i}),new Oe(F,I)}return R&&$?e.apply(this,h):(F=this.thru(S),R?r?F.value()[0]:F.value():F)})}),Fe(["pop","push","shift","sort","splice","unshift"],function(e){var t=Bn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var s=arguments;if(r&&!this.__chain__){var u=this.value();return t.apply(N(u)?u:[],s)}return this[n](function(c){return t.apply(N(c)?c:[],s)})}}),Ve(k.prototype,function(e,t){var n=o[t];if(n){var r=n.name+"";Y.call(Kt,r)||(Kt[r]=[]),Kt[r].push({name:t,func:n})}}),Kt[or(i,Ut).name]=[{name:"wrapper",func:i}],k.prototype.clone=nc,k.prototype.reverse=rc,k.prototype.value=ic,o.prototype.at=Nh,o.prototype.chain=Uh,o.prototype.commit=$h,o.prototype.next=Dh,o.prototype.plant=Mh,o.prototype.reverse=Bh,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=kh,o.prototype.first=o.prototype.head,hn&&(o.prototype[hn]=Wh),o},Gt=Ul();It?((It.exports=Gt)._=Gt,Mr._=Gt):ce._=Gt}).call(iv)}(bn,bn.exports)),bn.exports}var av=sv();const Hi=f=>{const a=av.startCase(f).toLowerCase();return a.charAt(0).toUpperCase()+a.slice(1)},ov=({data:f})=>{const a=de.v4(),i=f.description?`
29
29
  description: '${f.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
30
30
 
31
31
  export default defineField({
@@ -35,7 +35,7 @@ export default defineField({
35
35
  type: FieldType.${f.type},
36
36
  objectUniversalIdentifier: '${f.objectUniversalIdentifier}',${i}
37
37
  });
38
- `},Re=f=>f.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(),pv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Re(f);return`import { defineFrontComponent } from 'twenty-sdk';
38
+ `},Te=f=>f.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(),uv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Te(f);return`import { defineFrontComponent } from 'twenty-sdk';
39
39
 
40
40
  // React component - implement your UI here
41
41
  const Component = () => {
@@ -53,7 +53,7 @@ export default defineFrontComponent({
53
53
  description: 'Add a description for your front component',
54
54
  component: Component,
55
55
  });
56
- `},dv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Re(f);return`import { defineLogicFunction } from 'twenty-sdk';
56
+ `},lv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Te(f);return`import { defineLogicFunction } from 'twenty-sdk';
57
57
 
58
58
  // Logic function handler - rename and implement your logic
59
59
  const handler = async (params: {
@@ -90,20 +90,20 @@ export default defineLogicFunction({
90
90
  // eventName: 'objectName.created',
91
91
  // },
92
92
  });
93
- `},Uo=({name:f,universalIdentifier:a=de.v4(),type:i,viewUniversalIdentifier:l,targetObjectUniversalIdentifier:p})=>{const x=Re(f);let I;return i==="OBJECT"&&p?I=` type: 'OBJECT',
94
- targetObjectUniversalIdentifier: '${p}',`:i==="VIEW"&&l?I=` type: 'VIEW',
95
- viewUniversalIdentifier: '${l}',`:i==="LINK"?I=` type: 'LINK',
96
- link: 'https://example.com',`:i==="FOLDER"?I=" type: 'FOLDER',":I=` type: 'VIEW',
93
+ `},Oo=({name:f,universalIdentifier:a=de.v4(),type:i,viewUniversalIdentifier:l,targetObjectUniversalIdentifier:p})=>{const E=Te(f);let x;return i==="OBJECT"&&p?x=` type: 'OBJECT',
94
+ targetObjectUniversalIdentifier: '${p}',`:i==="VIEW"&&l?x=` type: 'VIEW',
95
+ viewUniversalIdentifier: '${l}',`:i==="LINK"?x=` type: 'LINK',
96
+ link: 'https://example.com',`:i==="FOLDER"?x=" type: 'FOLDER',":x=` type: 'VIEW',
97
97
  // viewUniversalIdentifier: '...',`,`import { defineNavigationMenuItem } from 'twenty-sdk';
98
98
 
99
99
  export default defineNavigationMenuItem({
100
100
  universalIdentifier: '${a}',
101
- name: '${x}',
101
+ name: '${E}',
102
102
  icon: 'IconList',
103
103
  position: 0,
104
- ${I}
104
+ ${x}
105
105
  });
106
- `},gv=({data:f,universalIdentifier:a=de.v4(),nameFieldUniversalIdentifier:i=de.v4()})=>`import { defineObject, FieldType } from 'twenty-sdk';
106
+ `},cv=({data:f,universalIdentifier:a=de.v4(),nameFieldUniversalIdentifier:i=de.v4()})=>`import { defineObject, FieldType } from 'twenty-sdk';
107
107
 
108
108
  export const NAME_FIELD_UNIVERSAL_IDENTIFIER =
109
109
  '${i}';
@@ -127,7 +127,7 @@ export default defineObject({
127
127
  },
128
128
  ],
129
129
  });
130
- `,vv=({name:f})=>`import { definePageLayout } from 'twenty-sdk';
130
+ `,fv=({name:f})=>`import { definePageLayout } from 'twenty-sdk';
131
131
 
132
132
  export default definePageLayout({
133
133
  universalIdentifier: '${de.v4()}',
@@ -140,7 +140,7 @@ export default definePageLayout({
140
140
  },
141
141
  ],
142
142
  });
143
- `,mv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Re(f);return`import { defineRole } from 'twenty-sdk';
143
+ `,hv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Te(f);return`import { defineRole } from 'twenty-sdk';
144
144
 
145
145
  export const ${i.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
146
146
  '${a}';
@@ -154,7 +154,7 @@ export default defineRole({
154
154
  canSoftDeleteAllObjectRecords: true,
155
155
  canDestroyAllObjectRecords: false,
156
156
  });
157
- `},_v=({name:f,universalIdentifier:a=de.v4()})=>{const i=Re(f);return`import { defineAgent } from 'twenty-sdk';
157
+ `},pv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Te(f);return`import { defineAgent } from 'twenty-sdk';
158
158
 
159
159
  export const ${i.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER =
160
160
  '${a}';
@@ -166,7 +166,7 @@ export default defineAgent({
166
166
  description: 'Add a description for your agent',
167
167
  prompt: 'Add the agent system prompt here',
168
168
  });
169
- `},yv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Re(f);return`import { defineSkill } from 'twenty-sdk';
169
+ `},dv=({name:f,universalIdentifier:a=de.v4()})=>{const i=Te(f);return`import { defineSkill } from 'twenty-sdk';
170
170
 
171
171
  export const ${i.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
172
172
  '${a}';
@@ -178,8 +178,8 @@ export default defineSkill({
178
178
  description: 'Add a description for your skill',
179
179
  content: 'Add the skill content here',
180
180
  });
181
- `},$o=({name:f,universalIdentifier:a=de.v4(),objectUniversalIdentifier:i="fill-later",fields:l=[]})=>{const p=Re(f),x=l.map((L,se)=>({universalIdentifier:L.universalIdentifier??de.v4(),fieldMetadataUniversalIdentifier:L.fieldMetadataUniversalIdentifier,position:L.position??se,isVisible:L.isVisible??!0,size:L.size??200})),B=l.length>0?` fields: [
182
- ${x.map(L=>JSON.stringify(L,null,2)).join(`,
181
+ `},Lo=({name:f,universalIdentifier:a=de.v4(),objectUniversalIdentifier:i="fill-later",fields:l=[]})=>{const p=Te(f),E=l.map((W,re)=>({universalIdentifier:W.universalIdentifier??de.v4(),fieldMetadataUniversalIdentifier:W.fieldMetadataUniversalIdentifier,position:W.position??re,isVisible:W.isVisible??!0,size:W.size??200})),G=l.length>0?` fields: [
182
+ ${E.map(W=>JSON.stringify(W,null,2)).join(`,
183
183
  `)},
184
184
 
185
185
  ],`:` // fields: [
@@ -197,7 +197,7 @@ export default defineView({
197
197
  objectUniversalIdentifier: '${i}',
198
198
  icon: 'IconList',
199
199
  position: 0,
200
- ${B}
200
+ ${G}
201
201
  // filters: [
202
202
  // {
203
203
  // universalIdentifier: '...',
@@ -207,10 +207,10 @@ ${B}
207
207
  // },
208
208
  // ],
209
209
  });
210
- `},zi="src";class wv{async execute(a,i){try{const l=a??await this.getEntity(),p=this.getFolderName(l),x=i?Z.join(ue,i):Z.join(ue,zi,p);await E.ensureDir(x);const{name:I,file:B}=await this.getEntityData(l),L=Z.join(x,this.getFileName(I,l));if(await E.pathExists(L)){const{overwrite:se}=await this.handleFileExist();if(!se)return}await bn.writeFile(L,B),console.log(w.default.green(`✓ Created ${p}:`),w.default.cyan(Z.relative(ue,L))),l===T.o$1.Object&&await this.promptAndCreateViewAndNavigationMenuItem(I,i)}catch(l){console.error(w.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(a){switch(a){case T.o$1.Object:{const i=await this.getObjectData(),l=i.nameSingular,p=de.v4(),x=de.v4();this.lastObjectUniversalIdentifier=p,this.lastNameFieldUniversalIdentifier=x;const I=gv({data:i,universalIdentifier:p,nameFieldUniversalIdentifier:x});return{name:l,file:I}}case T.o$1.Field:{const i=await this.getFieldData(),l=i.name,p=hv({data:i});return{name:l,file:p}}case T.o$1.LogicFunction:{const i=await this.getEntityName(a),l=dv({name:i});return{name:i,file:l}}case T.o$1.FrontComponent:{const i=await this.getEntityName(a),l=pv({name:i});return{name:i,file:l}}case T.o$1.Role:{const i=await this.getEntityName(a),l=mv({name:i});return{name:i,file:l}}case T.o$1.Skill:{const i=await this.getEntityName(a),l=yv({name:i});return{name:i,file:l}}case T.o$1.Agent:{const i=await this.getEntityName(a),l=_v({name:i});return{name:i,file:l}}case T.o$1.View:{const l=(await this.getViewData()).name,p=$o({name:l});return{name:l,file:p}}case T.o$1.NavigationMenuItem:{const i=await this.getEntityName(a),l=Uo({name:i});return{name:i,file:l}}case T.o$1.PageLayout:{const i=await this.getEntityName(a),l=vv({name:i});return{name:i,file:l}}default:T.yt()}}async promptAndCreateViewAndNavigationMenuItem(a,i){const{createViewAndNavItem:l}=await We.default.prompt([{type:"confirm",name:"createViewAndNavItem",message:"Also create a view and navigation menu item for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const p=de.v4(),x=$o({name:`all-${Re(a)}`,universalIdentifier:p,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),I=i?Z.join(ue,i):Z.join(ue,zi,this.getFolderName(T.o$1.View));await E.ensureDir(I);const B=`all-${Re(a)}.ts`,L=Z.join(I,B);if(await E.pathExists(L)){const{overwrite:W}=await this.handleFileExist();if(!W)return}await bn.writeFile(L,x),console.log(w.default.green("✓ Created view:"),w.default.cyan(Z.relative(ue,L)));const se=Uo({name:a,type:"OBJECT",targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),Q=i?Z.join(ue,i):Z.join(ue,zi,this.getFolderName(T.o$1.NavigationMenuItem));await E.ensureDir(Q);const K=`${Re(a)}.ts`,q=Z.join(Q,K);if(await E.pathExists(q)){const{overwrite:W}=await this.handleFileExist();if(!W)return}await bn.writeFile(q,se),console.log(w.default.green("✓ Created navigation menu item:"),w.default.cyan(Z.relative(ue,q)))}async getEntity(){const{entity:a}=await We.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(T.o$1)}]);return a}async handleFileExist(){return await We.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(a){const{name:i}=await We.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${a}:`,default:"",validate:l=>l.length===0?`${a} name is required`:!0}]);return i}async getFieldData(){return We.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:a=>Ki(a.name),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(T.R),default:T.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return We.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:a=>!a||a.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:(a,i)=>a.trim()===i?.nameSingular.trim()?"Name plural must be different from name singular":!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:a=>Ki(a.nameSingular),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:a=>Ki(a.namePlural),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return We.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:a=>!a||a.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:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(a){return`${Re(a)}s`}getFileName(a,i){switch(i){case T.o$1.FrontComponent:return`${Re(a)}.tsx`;default:return`${Re(a)}.ts`}}}const Sv="0.8.0",Ho={version:Sv},xv=async f=>{const a=Z.join(f,"package.json");if(await E.pathExists(a))try{const i=await bn.readFile(a,"utf-8"),l=JSON.parse(i);return l.dependencies?.["twenty-sdk"]??l.devDependencies?.["twenty-sdk"]??void 0}catch{return}},No=f=>{const a=f.match(/(\d+)\./);if(a)return parseInt(a[1],10);const i=f.match(/^[~^>=<]*(\d+)$/);return i?parseInt(i[1],10):null},Cn=async f=>{const a=Ho.version,i=await xv(f);if(!i)return;const l=No(a),p=No(i);l===null||p===null||l!==p&&(console.warn(w.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${p}.x but the CLI running is v${a}. Major version mismatches may cause unexpected behavior.
211
- Update with: npm install -g twenty-sdk@${p}`)),console.warn(""))};class Iv{async execute(a){const i=a.appPath??ue;await Cn(i),console.log(w.default.blue("Building application...")),console.log(w.default.gray(`App path: ${i}
212
- `));const l=await E.appBuild({appPath:i,tarball:a.tarball,onProgress:p=>console.log(w.default.gray(p))});l.success||(console.error(w.default.red(l.error.message)),process.exit(1)),console.log(w.default.green(`✓ Build succeeded (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(w.default.gray(`Output: ${l.data.outputDir}`)),l.data.tarballPath&&console.log(w.default.gray(`Tarball: ${l.data.tarballPath}`))}}class Av{async execute(a){a.remote&&E.ConfigService.setActiveRemote(a.remote),console.log(w.default.blue("Syncing marketplace catalog..."));const l=await new E.ApiService().syncMarketplaceCatalog();l.success||(console.error(w.default.red(`Catalog sync failed: ${l.error instanceof Error?l.error.message:String(l.error)}`)),process.exit(1)),console.log(w.default.green("✓ Marketplace catalog synced successfully"))}}class Ev{async execute(a){const i=a.appPath??ue;await Cn(i),console.log(w.default.blue("Deploying application...")),console.log(w.default.gray(`App path: ${i}
213
- `));const l=I=>console.log(w.default.gray(I)),p=await E.appBuild({appPath:i,tarball:!0,onProgress:l});p.success||(console.error(w.default.red(p.error.message)),process.exit(1));const x=await E.appDeploy({tarballPath:p.data.tarballPath,remote:a.remote,onProgress:l});x.success||(console.error(w.default.red(x.error.message)),process.exit(1)),console.log(w.default.green("✓ Deployed successfully"))}}class bv{constructor(a){this.apiService=new E.ApiService({disableInterceptors:!0,serverUrl:a?.serverUrl,skipAuth:!0,token:a?.token})}async generateCoreClient({appPath:a,authToken:i}){const l=await this.apiService.getSchema({authToken:i});if(!l.success)throw new Error(`Failed to introspect core schema: ${JSON.stringify(l.error)}`);await tv.replaceCoreClient({packageRoot:Z.join(a,"node_modules","twenty-client-sdk"),schema:l.data})}}class Cv{constructor({state:a,notify:i}){this.state=a,this.notify=i}async execute(a){const i=this.state.steps.buildManifest;i.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],p=await E.buildAndValidateManifest(a.appPath);if(!p.success){for(const I of p.errors)l.push({message:I,status:"error"});return i.output={result:null},i.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(p.warnings.length>0)for(const I of p.warnings)l.push({message:`⚠ ${I}`,status:"warning"});l.push({message:"Successfully built manifest",status:"success"});const x={manifest:p.manifest,filePaths:p.filePaths};return i.output={result:x},i.status="done",this.state.updatePipeline({appName:p.manifest.application.displayName}),this.state.updateEntitiesFromManifest(p.filePaths),this.state.applyStepEvents(l),x}}class Rv{constructor({apiService:a,state:i,notify:l}){this.hasRetried=!1,this.apiService=a,this.state=i,this.notify=l}async execute(){const a=this.state.steps.checkServer,i=await this.apiService.validateAuth();if(!i.serverUp){const p=await E.detectLocalServer();return p&&!this.hasRetried?(this.hasRetried=!0,await new E.ConfigService().setConfig({apiUrl:p}),this.execute()):(a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.status="error",this.state.applyStepEvents([{message:`Cannot reach Twenty server.
210
+ `},Ki="src";class gv{async execute(a,i){try{const l=a??await this.getEntity(),p=this.getFolderName(l),E=i?j.join(ae,i):j.join(ae,Ki,p);await A.ensureDir(E);const{name:x,file:G}=await this.getEntityData(l),W=j.join(E,this.getFileName(x,l));if(await A.pathExists(W)){const{overwrite:re}=await this.handleFileExist();if(!re)return}await Tn.writeFile(W,G),console.log(y.default.green(`✓ Created ${p}:`),y.default.cyan(j.relative(ae,W))),l===P.o$1.Object&&await this.promptAndCreateViewAndNavigationMenuItem(x,i)}catch(l){console.error(y.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(a){switch(a){case P.o$1.Object:{const i=await this.getObjectData(),l=i.nameSingular,p=de.v4(),E=de.v4();this.lastObjectUniversalIdentifier=p,this.lastNameFieldUniversalIdentifier=E;const x=cv({data:i,universalIdentifier:p,nameFieldUniversalIdentifier:E});return{name:l,file:x}}case P.o$1.Field:{const i=await this.getFieldData(),l=i.name,p=ov({data:i});return{name:l,file:p}}case P.o$1.LogicFunction:{const i=await this.getEntityName(a),l=lv({name:i});return{name:i,file:l}}case P.o$1.FrontComponent:{const i=await this.getEntityName(a),l=uv({name:i});return{name:i,file:l}}case P.o$1.Role:{const i=await this.getEntityName(a),l=hv({name:i});return{name:i,file:l}}case P.o$1.Skill:{const i=await this.getEntityName(a),l=dv({name:i});return{name:i,file:l}}case P.o$1.Agent:{const i=await this.getEntityName(a),l=pv({name:i});return{name:i,file:l}}case P.o$1.View:{const l=(await this.getViewData()).name,p=Lo({name:l});return{name:l,file:p}}case P.o$1.NavigationMenuItem:{const i=await this.getEntityName(a),l=Oo({name:i});return{name:i,file:l}}case P.o$1.PageLayout:{const i=await this.getEntityName(a),l=fv({name:i});return{name:i,file:l}}default:P.yt()}}async promptAndCreateViewAndNavigationMenuItem(a,i){const{createViewAndNavItem:l}=await We.default.prompt([{type:"confirm",name:"createViewAndNavItem",message:"Also create a view and navigation menu item for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const p=de.v4(),E=Lo({name:`all-${Te(a)}`,universalIdentifier:p,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),x=i?j.join(ae,i):j.join(ae,Ki,this.getFolderName(P.o$1.View));await A.ensureDir(x);const G=`all-${Te(a)}.ts`,W=j.join(x,G);if(await A.pathExists(W)){const{overwrite:q}=await this.handleFileExist();if(!q)return}await Tn.writeFile(W,E),console.log(y.default.green("✓ Created view:"),y.default.cyan(j.relative(ae,W)));const re=Oo({name:a,type:"OBJECT",targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),ee=i?j.join(ae,i):j.join(ae,Ki,this.getFolderName(P.o$1.NavigationMenuItem));await A.ensureDir(ee);const Z=`${Te(a)}.ts`,ze=j.join(ee,Z);if(await A.pathExists(ze)){const{overwrite:q}=await this.handleFileExist();if(!q)return}await Tn.writeFile(ze,re),console.log(y.default.green("✓ Created navigation menu item:"),y.default.cyan(j.relative(ae,ze)))}async getEntity(){const{entity:a}=await We.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(P.o$1)}]);return a}async handleFileExist(){return await We.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(a){const{name:i}=await We.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${a}:`,default:"",validate:l=>l.length===0?`${a} name is required`:!0}]);return i}async getFieldData(){return We.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:a=>Hi(a.name),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(P.R),default:P.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return We.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:a=>!a||a.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:(a,i)=>a.trim()===i?.nameSingular.trim()?"Name plural must be different from name singular":!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:a=>Hi(a.nameSingular),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:a=>Hi(a.namePlural),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return We.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:a=>!a||a.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:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(a){return`${Te(a)}s`}getFileName(a,i){switch(i){case P.o$1.FrontComponent:return`${Te(a)}.tsx`;default:return`${Te(a)}.ts`}}}const vv="0.9.0",qo={version:vv},mv=async f=>{const a=j.join(f,"package.json");if(await A.pathExists(a))try{const i=await Tn.readFile(a,"utf-8"),l=JSON.parse(i);return l.dependencies?.["twenty-sdk"]??l.devDependencies?.["twenty-sdk"]??void 0}catch{return}},No=f=>{const a=f.match(/(\d+)\./);if(a)return parseInt(a[1],10);const i=f.match(/^[~^>=<]*(\d+)$/);return i?parseInt(i[1],10):null},jt=async f=>{const a=qo.version,i=await mv(f);if(!i)return;const l=No(a),p=No(i);l===null||p===null||l!==p&&(console.warn(y.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${p}.x but the CLI running is v${a}. Major version mismatches may cause unexpected behavior.
211
+ Update with: npm install -g twenty-sdk@${p}`)),console.warn(""))};class _v{async execute(a){const i=a.appPath??ae;await jt(i),console.log(y.default.blue("Building application...")),console.log(y.default.gray(`App path: ${i}
212
+ `));const l=await A.appBuild({appPath:i,tarball:a.tarball,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green(`✓ Build succeeded (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(y.default.gray(`Output: ${l.data.outputDir}`)),l.data.tarballPath&&console.log(y.default.gray(`Tarball: ${l.data.tarballPath}`))}}class yv{async execute(a){a.remote&&A.ConfigService.setActiveRemote(a.remote),console.log(y.default.blue("Syncing marketplace catalog..."));const l=await new A.ApiService().syncMarketplaceCatalog();l.success||(console.error(y.default.red(`Catalog sync failed: ${l.error instanceof Error?l.error.message:String(l.error)}`)),process.exit(1)),console.log(y.default.green("✓ Marketplace catalog synced successfully"))}}class wv{async execute(a){const i=a.appPath??ae;await jt(i),console.log(y.default.blue("Deploying application...")),console.log(y.default.gray(`App path: ${i}
213
+ `));const l=x=>console.log(y.default.gray(x)),p=await A.appBuild({appPath:i,tarball:!0,onProgress:l});p.success||(console.error(y.default.red(p.error.message)),process.exit(1));const E=await A.appDeploy({tarballPath:p.data.tarballPath,remote:a.remote,onProgress:l});E.success||(console.error(y.default.red(E.error.message)),process.exit(1)),console.log(y.default.green("✓ Deployed successfully"))}}class Sv{constructor({state:a,notify:i}){this.state=a,this.notify=i}async execute(a){const i=this.state.steps.buildManifest;i.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],p=await A.buildAndValidateManifest(a.appPath);if(!p.success){for(const x of p.errors)l.push({message:x,status:"error"});return i.output={result:null},i.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(p.warnings.length>0)for(const x of p.warnings)l.push({message:`⚠ ${x}`,status:"warning"});l.push({message:"Successfully built manifest",status:"success"});const E={manifest:p.manifest,filePaths:p.filePaths};return i.output={result:E},i.status="done",this.state.updatePipeline({appName:p.manifest.application.displayName}),this.state.updateEntitiesFromManifest(p.filePaths),this.state.applyStepEvents(l),E}}class xv{constructor({apiService:a,state:i,notify:l}){this.hasRetried=!1,this.apiService=a,this.state=i,this.notify=l}async execute(){const a=this.state.steps.checkServer,i=await this.apiService.validateAuth();if(!i.serverUp){const p=await A.detectLocalServer();return p&&!this.hasRetried?(this.hasRetried=!0,await new A.ConfigService().setConfig({apiUrl:p}),this.execute()):(a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.status="error",this.state.applyStepEvents([{message:`Cannot reach Twenty server.
214
214
 
215
215
  Start a local server:
216
216
  yarn twenty server start
@@ -218,17 +218,19 @@ ${B}
218
218
  Check server status:
219
219
  yarn twenty server status
220
220
 
221
- Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!i.authValid)return a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.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 l=a.output.isReady;return a.output={isReady:!0,errorLogged:!1},a.status="done",l||this.notify(),!0}}class Tv{constructor({clientService:a,configService:i,state:l,notify:p}){this.clientService=a,this.configService=i,this.state=l,this.notify=p}async execute(a){const i=this.state.steps.generateApiClient;i.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generateCoreClient({appPath:a.appPath,authToken:l.accessToken}),i.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),i.status="error"}this.notify()}}class Fv{constructor({apiService:a,configService:i,state:l,notify:p}){this.apiService=a,this.configService=i,this.state=l,this.notify=p}async execute(a){const i=a.manifest.application.universalIdentifier,l=await this.apiService.findApplicationRegistrationByUniversalIdentifier(i);if(!l.success)return this.state.applyStepEvents([{message:"Failed to check app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null};if(l.data)return this.state.applyStepEvents([{message:`App registration found: ${l.data.name}`,status:"info"}]),this.notify(),{applicationRegistrationId:l.data.id,clientId:l.data.oAuthClientId};const p=await this.apiService.createApplicationRegistration({name:a.manifest.application.displayName,universalIdentifier:i});return!p.success||!p.data?(this.state.applyStepEvents([{message:"Failed to create app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null}):(await this.configService.setConfig({oauthClientId:p.data.applicationRegistration.oAuthClientId}),this.state.applyStepEvents([{message:`App registration created: ${a.manifest.application.displayName}`,status:"success"},{message:`Client ID: ${p.data.applicationRegistration.oAuthClientId}`,status:"info"},{message:`Client Secret: ${p.data.clientSecret}`,status:"warning"},{message:"Credentials saved to config. The secret will not be shown again.",status:"warning"}]),this.notify(),{applicationRegistrationId:p.data.applicationRegistration.id,clientId:p.data.applicationRegistration.oAuthClientId})}}class Do{constructor(a){this.watcher=null,this.appPath=a.appPath,this.fileFolder=a.fileFolder,this.watchPaths=a.watchPaths,this.handleFileBuilt=a.handleFileBuilt}async start(){const a=this.watchPaths.map(i=>Z.join(this.appPath,i));for(const i of a)if(!await E.pathExists(i))return;this.watcher=Go.default.watch(a,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{i==="addDir"||i==="unlinkDir"||((i==="add"||i==="change")&&this.copyAndNotify(l),i==="unlink"&&this.handleUnlink(l))})}async close(){await this.watcher?.close()}async copyAndNotify(a){const i=Z.relative(this.appPath,a),l=Z.join(T.E,i),p=Z.join(this.appPath,l);await E.ensureDir(Z.dirname(p)),await E.copy(a,p);const x=await bn.readFile(p),I=ov.default.createHash("md5").update(x).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:i,checksum:I})}async handleUnlink(a){const i=Z.relative(this.appPath,a),l=Z.join(T.E,i),p=Z.join(this.appPath,l);await E.remove(p)}}class Pv{constructor(a){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=a.appPath,this.onErrors=a.onErrors}async start(){const a=Oo.default.join(this.appPath,"node_modules",".bin","tsc");if(!await E.pathExists(a))return;const i=Oo.default.join(this.appPath,"tsconfig.json");this.process=An.spawn(a,["--watch","--noEmit","--pretty","false","-p",i],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(a){this.buffer+=a;const i=this.buffer.split(`
222
- `);this.buffer=i.pop()??"";for(const l of i)this.processLine(l)}processLine(a){if(a.includes("Starting compilation in watch mode...")||a.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(a.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const i=E.parseTscOutputLine(a);i&&this.pendingErrors.push(i)}}const Ov=new Set(["node_modules","dist",".twenty"]);class Lv{constructor(a){this.watcher=null,this.appPath=a.appPath,this.handleChangeDetected=a.handleChangeDetected,this.verbose=a.verbose??!1}async start(){const a=this.appPath;this.watcher=Go.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:i=>{const l=Z.relative(a,i);if(l==="")return!1;const p=l.split(Ji.default.sep)[0];return Ov.has(p)||p.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{if(i==="addDir"||i==="unlinkDir")return;const p=Z.relative(this.appPath,l),x=p.startsWith(T._),I=["package.json","yarn.lock"].includes(p);!(p.endsWith(".ts")||p.endsWith(".tsx"))&&!x&&!I||this.handleChangeDetected(p,i)})}async close(){await this.watcher?.close()}}class Uv{constructor(a){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=a.state,this.scheduleSync=a.scheduleSync,this.notify=a.notify,this.onFileBuilt=a.onFileBuilt,this.shouldSkipTypecheck=a.shouldSkipTypecheck,this.verbose=a.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new Lv({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(a){const{logicFunctions:i,frontComponents:l}=a.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(i,l);return}this.logicFunctionsWatcher?.shouldRestart(i)&&await this.logicFunctionsWatcher.restart(i),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(a,i){this.state.addEvent({message:`Change detected: ${a}`,status:"info"}),i==="unlink"?this.state.removeEntity(a):this.state.updateEntityStatus(a,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(a){this.state.addEvent({message:"Build failed:",status:"error"});for(const i of a)this.state.addEvent({message:i.error,status:"error"});this.notify()}handleFileBuilt(a){this.verbose&&this.state.addEvent({message:`Successfully built ${a.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(a.builtPath,{checksum:a.checksum,builtPath:a.builtPath,sourcePath:a.sourcePath,fileFolder:a.fileFolder,usesSdkClient:a.usesSdkClient}),this.onFileBuilt(a),this.notify(),this.scheduleSync()}async startFileWatchers(a,i){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(a),this.startFrontComponentsWatcher(i),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(a){this.logicFunctionsWatcher=E.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:a,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(a){this.frontComponentsWatcher=E.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:a,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:T.B.PublicAsset,watchPaths:[T._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Do({appPath:this.state.appPath,fileFolder:T.B.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new Pv({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(a){a.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(a.map(i=>({message:`Type error in ${i.file}(${i.line},${i.column}): ${i.text}`,status:"error"}))),this.notify()}}const $v=f=>{if(!f||typeof f!="object")return null;const i=f.extensions;if(!i?.errors||!i?.summary)return null;const l=[],p=i.summary.totalErrors;l.push({message:`Sync failed with ${p} error${p!==1?"s":""}`,status:"error"});for(const[x,I]of Object.entries(i.errors)){const B=i.summary[x]??I.length;l.push({message:`${x}: ${B} error${B!==1?"s":""}`,status:"error"});let L=1;for(const se of I){const Q=se.flatEntityMinimalInformation?.universalIdentifier;for(const K of se.errors){const q=[];K.value&&q.push(`value: ${K.value}`),Q&&q.push(`universalIdentifier: ${Q}`);const W=q.length>0?` (${q.join(", ")})`:"";l.push({message:` ${L}. ${K.code}: ${K.message}${W}`,status:"error"}),L++}}}return l},xr=f=>{try{const a=JSON.stringify(f,null,2);return a==="{}"||a===void 0?String(f):a}catch{return String(f)}},Ko=f=>{if(typeof f=="string")return f;if(uv.default.isAxiosError(f)){const a=[],i=f.response?.status,l=f.response?.statusText;i&&a.push(`HTTP ${i}${l?` ${l}`:""}`);const p=f.response?.data,x=p?.errors;if(Array.isArray(x)&&x.length>0){const I=x.map(B=>typeof B.message=="string"?B.message:xr(B)).join("; ");a.push(I)}else p?.message?a.push(typeof p.message=="string"?p.message:xr(p.message)):p?a.push(xr(p)):f.message&&a.push(f.message);return f.code&&a.push(`(${f.code})`),a.join(" - ")||"Unknown Axios error"}return f instanceof Error?f.message||f.toString():xr(f)};class Nv{constructor({apiService:a,state:i,notify:l,verbose:p}){this.apiService=a,this.state=i,this.notify=l,this.verbose=p??!1}async execute(a){const i=this.state.steps.syncApplication;i.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],p=E.manifestUpdateChecksums({manifest:a.manifest,builtFileInfos:a.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await E.writeManifestToOutput(a.appPath,p),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const x=await this.apiService.syncApplication(p);if(x.success){l.push({message:"✓ Synced",status:"success"}),i.output={syncStatus:"synced",error:null},i.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const I=this.verbose?null:$v(x.error);I?(l.push(...I),l.push({message:"Add --verbose to see full error log",status:"info"})):l.push({message:`Sync failed with error: ${Ko(x.error)}`,status:"error"});const B=I?I[0].message:"Sync failed";i.output={syncStatus:"error",error:B},i.status="error",this.state.updatePipeline({status:"error",error:B}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Dv{constructor(a){this.apiService=new E.ApiService,this.applicationUniversalIdentifier=a.applicationUniversalIdentifier,this.appPath=a.appPath}async uploadFile({builtPath:a,fileFolder:i}){const l=Z.relative(T.E,a);return await this.apiService.uploadFile({filePath:Ji.default.join(this.appPath,a),builtHandlerPath:l,fileFolder:i,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}class Wv{constructor({state:a,notify:i,verbose:l}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=a,this.notify=i,this.verbose=l??!1}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(a){const i=this.state.steps.uploadFiles;i.output={...i.output,fileUploader:new Dv({appPath:a.appPath,applicationUniversalIdentifier:a.universalIdentifier})},i.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(a,i,l){const p=this.state.steps.uploadFiles;if(!p.output.fileUploader)return;p.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${a}`,status:"info"}),this.state.updateEntityStatus(i,"uploading"),this.notify();const x=p.output.fileUploader.uploadFile({builtPath:a,fileFolder:l}).then(I=>{I.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${a}`,status:"success"}),this.state.updateEntityStatus(i,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${a}: ${I.error}`,status:"error"}))}).catch(I=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${a}: ${I}`,status:"error"})}).finally(()=>{p.output.activeUploads.delete(x),p.output.activeUploads.size===0&&(this.logUploadSummary(),p.status="done",this.notify())});p.output.activeUploads.add(x)}async waitForUploads(){const a=this.state.steps.uploadFiles;for(;a.output.activeUploads.size>0;)await Promise.all(a.output.activeUploads);a.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[a,{fileFolder:i,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(a,l,i)}}class Mv{constructor(a){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=a.debounceMs??200,this.state=a.state,this.verbose=a.verbose??!1,this.apiService=new E.ApiService({disableInterceptors:!0});const i=this.apiService,l=new E.ConfigService;this.clientService=new bv;const p={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Rv({...p,apiService:i}),this.buildManifestStep=new Cv(p),this.registerAppStep=new Fv({...p,apiService:i,configService:l}),this.uploadFilesStep=new Wv({...p,verbose:this.verbose}),this.generateApiClientStep=new Tv({...p,clientService:this.clientService,configService:l}),this.syncApplicationStep=new Nv({...p,apiService:i,verbose:this.verbose}),this.startWatchersStep=new Uv({...p,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const a=Ji.default.join(this.state.appPath,T.E);await E.ensureDir(a),await E.emptyDir(a),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(a){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(a.builtPath,a.sourcePath,a.fileFolder)}async checkServerHealth(){const a=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!a&&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(a){this.state.addEvent({message:`Sync failed with error: ${Ko(a)}`,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 i=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!i||(await this.startWatchersStep.handleWatcherRestarts(i),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(i.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(i.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:i.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),this.skipTypecheck=!1)}async initializePipeline(a){await this.registerAppStep.execute({manifest:a});const i=await this.apiService.createDevelopmentApplication({universalIdentifier:a.application.universalIdentifier,name:a.application.displayName});return!i.success||!i.data?(this.state.applyStepEvents([{message:"Failed to create development application",status:"error"},{message:JSON.stringify(i,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:i.data.id,universalIdentifier:i.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application created",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:a.application.universalIdentifier}),!0)}}const Bv={objects:T.o$1.Object,fields:T.o$1.Field,logicFunctions:T.o$1.LogicFunction,frontComponents:T.o$1.FrontComponent,roles:T.o$1.Role,skills:T.o$1.Skill,views:T.o$1.View,navigationMenuItems:T.o$1.NavigationMenuItem,pageLayouts:T.o$1.PageLayout},kv=200,Gv={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 qv{constructor(a){this.eventIdCounter=0,this.appPath=a.appPath,this.frontendUrl=a.frontendUrl,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.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(a){Object.assign(this.pipeline,a),this.notify()}applyStepEvents(a){const i=a.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(kv-i.length)),...i]}addEvent(a){this.applyStepEvents([a])}updateEntityStatus(a,i){const l=new Map(this.entities),p=l.get(a);p?.status&&!Gv[p.status].includes(i)||(l.set(a,p?{...p,status:i}:{name:a,path:a,status:i}),this.entities=l)}removeEntity(a){const i=new Map(this.entities);i.delete(a),this.entities=i}updateAllEntitiesStatus(a){const i=new Map(this.entities);for(const[l,p]of i)i.set(l,{...p,status:a});this.entities=i}updateEntitiesFromManifest(a){const i=new Map;for(const[p,x]of Object.entries(a)){const I=Bv[p];if(I)for(const B of x)i.set(B,I)}const l=new Map(this.entities);for(const[p,x]of l)l.set(p,{...x,type:i.get(p)});for(const[p,x]of i)l.has(p)||l.set(p,{name:p,path:p,type:x,status:"pending"});this.entities=l}hasObjectsOrFieldsChanged(a){const i=JSON.stringify({objects:a.objects,fields:a.fields}),l=i!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=i,l}}const De={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},Hv=f=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[f],Kv=f=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[f],zv=f=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[f],Yv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},Yi=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Vi=["↑","⇡","↟","⤒"],zo={[T.o$1.Object]:"Objects",[T.o$1.Field]:"Fields",[T.o$1.LogicFunction]:"Logic functions",[T.o$1.FrontComponent]:"Front components",[T.o$1.Role]:"Roles",[T.o$1.Skill]:"Skills",[T.o$1.View]:"Views",[T.o$1.NavigationMenuItem]:"Navigation menu items",[T.o$1.PageLayout]:"Page layouts",[T.o$1.Agent]:"Agents"},Yo=Object.keys(zo),Vv={info:"gray",success:"green",error:"red",warning:"yellow"},Jv=f=>f.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),Zv=(f,a=40)=>{if(f.length<=a)return f;const i=f.split("/");return i.length<=2?f:`.../${i.slice(-2).join("/")}`},jv=f=>{const a=new Map;for(const i of Yo)a.set(i,[]);for(const i of f.values()){if(!i.type)continue;const l=a.get(i.type)??[];l.push(i),a.set(i.type,l)}return a},Xv=f=>!f.frontendUrl||!f.steps.resolveApplication.output.universalIdentifier?null:`${f.frontendUrl}/settings/applications`,Qv=f=>f.some(a=>a==="error")?"error":f.some(a=>a==="in_progress")?"in_progress":f.every(a=>a==="done")?"done":"idle",em=f=>{const a=[...f.entities.values()],i=a.some(I=>I.status==="error"),l=a.some(I=>I.status==="building"),p=a.length>0&&a.every(I=>I.status==="uploading"||I.status==="success"),x=i?"error":l?"in_progress":p?"done":"idle";return[{label:"Application Initialization",status:Qv([f.steps.checkServer.status,f.steps.ensureValidTokens.status,f.steps.resolveApplication.status])},{label:"Resources Build",status:x},{label:"Resources Upload",status:f.steps.uploadFiles.status},{label:"Manifest Build",status:f.steps.buildManifest.status},{label:"Application Synchronization",status:f.steps.syncApplication.status},{label:"Api Client Generation",status:f.steps.generateApiClient.status}]},Vo=120,tm=Math.round(200/Vo),Wo=()=>{const f=Math.floor(Date.now()/Vo);return{spinnerFrame:Yi[f%Yi.length],uploadFrame:Vi[Math.floor(f/tm)%Vi.length]}},Zi=f=>{const a=De[f];return a.icon==="spinner"?Wo().spinnerFrame:a.icon==="upload"?Wo().uploadFrame:a.icon},Jo=qo.default.createContext(null),nm=Jo.Provider,ft=()=>{const f=qo.default.useContext(Jo);if(!f)throw new Error("useInk must be used within InkProvider");return f},rm=({uiStatus:f})=>{const{Text:a}=ft(),i=Zi(f),l=De[f];return O.jsxs(a,{color:l.color,children:[i," "]})},im=({entity:f})=>{const{Box:a,Text:i}=ft();return O.jsxs(a,{children:[O.jsx(rm,{uiStatus:Kv(f.status)}),O.jsx(i,{children:f.name}),f.path!==f.name&&O.jsxs(i,{dimColor:!0,children:[" (",Zv(f.path),")"]})]})},sm=({type:f,entities:a})=>{const{Box:i,Text:l}=ft();return a.length===0?null:O.jsxs(i,{flexDirection:"column",marginTop:1,children:[O.jsx(l,{bold:!0,dimColor:!0,children:zo[f]}),a.map(p=>O.jsx(im,{entity:p},p.path))]})},am=()=>{const{Box:f,Text:a}=ft();return O.jsx(f,{marginTop:1,children:O.jsxs(a,{dimColor:!0,children:[O.jsx(a,{color:De.idle.color,children:De.idle.icon})," ","pending"," ",O.jsx(a,{color:De.in_progress.color,children:Yi[0]})," ","building"," ",O.jsx(a,{color:De.uploading.color,children:Vi[0]})," ","uploading"," ",O.jsx(a,{color:De.done.color,children:De.done.icon})," ","success"," ",O.jsx(a,{color:De.error.color,children:De.error.icon})," ","error"]})})},om=({state:f})=>{const{Text:a}=ft(),i=zv(f.pipeline.status),l=Zi(i),p=De[i],x=Yv[f.pipeline.status];return O.jsxs(a,{color:p.color,children:[l," ",x]})},um=({label:f,status:a})=>{const{Box:i,Text:l}=ft(),p=Hv(a),x=Zi(p),I=De[p];return O.jsxs(i,{children:[O.jsxs(l,{dimColor:!0,children:[f,": "]}),O.jsxs(l,{color:I.color,children:[x," ",a.replace("_"," ")]})]})},lm=({state:f})=>{const{Box:a,Text:i}=ft(),l=jv(f.entities),p=Xv(f);return O.jsxs(a,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[O.jsx(i,{bold:!0,color:"cyan",children:"Application"}),O.jsxs(a,{marginLeft:2,flexDirection:"column",children:[O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Name: "}),O.jsx(i,{bold:!0,children:f.pipeline.appName??"Loading..."})]}),O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Overall Status: "}),O.jsx(om,{state:f})]}),p&&O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Open:"}),O.jsxs(i,{bold:!0,color:"cyan",children:[" ",p]})]})]}),O.jsx(a,{marginLeft:2,flexDirection:"column",marginTop:1,children:em(f).map(x=>O.jsx(um,{label:x.label,status:x.status},x.label))}),O.jsx(a,{marginLeft:2,flexDirection:"column",children:Yo.map(x=>{const I=l.get(x)??[];return O.jsx(sm,{type:x,entities:I},x)})})]})},cm=({event:f})=>{const{Box:a,Text:i}=ft(),l=Vv[f.status],p=Jv(f.timestamp);return O.jsxs(a,{children:[O.jsxs(i,{dimColor:!0,children:[p," "]}),O.jsx(i,{color:l,children:f.message})]})},fm=new Set(["building","syncing"]),Mo=120,hm=80,pm=({uiStateManager:f})=>{const{Box:a,Static:i}=ft(),[,l]=xt.useReducer(L=>L+1,0),p=xt.useRef(null),x=xt.useRef(0),I=xt.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,x.current=Date.now(),l()},hm)},[]);xt.useEffect(()=>f.subscribe(()=>{I()}),[f,I]),xt.useEffect(()=>{const L=setInterval(()=>{const se=f.getSnapshot();fm.has(se.pipeline.status)&&(Date.now()-x.current<Mo||l())},Mo);return()=>clearInterval(L)},[f]),xt.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const B=f.getSnapshot();return O.jsxs(O.Fragment,{children:[O.jsx(i,{items:B.events,children:L=>O.jsx(cm,{event:L},L.id)}),O.jsxs(a,{marginTop:1,flexDirection:"column",children:[O.jsx(lm,{state:B}),O.jsx(am,{})]})]})},dm=async f=>{const a=await import("ink"),{render:i,Box:l,Text:p,Static:x}=a,{unmount:I}=i(O.jsx(nm,{value:{Box:l,Text:p,Static:x},children:O.jsx(pm,{uiStateManager:f})}),{incrementalRendering:!0});return{unmount:I}};class gm{constructor(a){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=a}getSnapshot(){return this.orchestratorState}subscribe(a){return this.listeners.add(a),a(this.orchestratorState),()=>this.listeners.delete(a)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const a of this.listeners)a(this.orchestratorState)}))}}class vm{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(a){const i=a.appPath??ue;await Cn(i);const l=new qv({appPath:i,frontendUrl:process.env.FRONTEND_URL});if(!a.headless){const p=new gm(l);l.onChange=()=>p.notify();const{unmount:x}=await dm(p);this.unmountUI=x}this.orchestrator=new Mv({state:l,verbose:a.verbose}),await this.orchestrator.start(),a.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const a=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",a),process.on("SIGTERM",a)}}class mm{async execute({appPath:a=ue,preInstall:i=!1,postInstall:l=!1,functionUniversalIdentifier:p,functionName:x,payload:I="{}"}){let B;try{B=JSON.parse(I)}catch{console.error(w.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const L=i?"pre install":l?"post install":p??x;console.log(w.default.blue(`🚀 Executing function "${L}"...`)),console.log(w.default.gray(` Payload: ${JSON.stringify(B)}
223
- `));const se=i?{appPath:a,preInstall:!0,payload:B}:l?{appPath:a,postInstall:!0,payload:B}:p?{appPath:a,functionUniversalIdentifier:p,payload:B}:{appPath:a,functionName:x,payload:B},Q=await E.functionExecute(se);if(!Q.success){switch(Q.error.code){case E.APP_ERROR_CODES.MANIFEST_NOT_FOUND:{console.error(w.default.red("Failed to build manifest."));break}case E.FUNCTION_ERROR_CODES.FETCH_FUNCTIONS_FAILED:{console.error(w.default.red("Failed to fetch functions:"),Q.error.message);break}case E.FUNCTION_ERROR_CODES.FUNCTION_NOT_FOUND:{console.error(w.default.red(Q.error.message),`
224
- `);const W=Q.error.details?.availableFunctions??[];W.length>0?(console.log(w.default.cyan("Available functions:")),W.forEach(Me=>{console.log(` - ${w.default.white(Me.name)} (${Me.universalIdentifier})`)})):console.log(w.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case E.FUNCTION_ERROR_CODES.EXECUTION_FAILED:{console.error(w.default.red("Execution failed:"),Q.error.message);break}default:console.error(w.default.red(Q.error.message))}process.exit(1)}const K=Q.data;console.log(w.default.cyan("─".repeat(60))),console.log(w.default.cyan("Execution Result")),console.log(w.default.cyan("─".repeat(60)));const q=K.status==="SUCCESS"?w.default.green:w.default.red;console.log(`${w.default.bold("Status:")} ${q(K.status)}`),console.log(`${w.default.bold("Duration:")} ${K.duration}ms
225
- `),T.o(K.data)&&(console.log(w.default.bold("Data:")),console.log(w.default.white(JSON.stringify(K.data,null,2)))),K.error&&(console.log(w.default.bold.red("Error:")),console.log(w.default.red(` Type: ${K.error.errorType}`)),console.log(w.default.red(` Message: ${K.error.errorMessage}
226
- `)),K.error.stackTrace&&(console.log(w.default.gray("Stack trace:")),console.log(w.default.gray(K.error.stackTrace)))),K.logs&&(console.log(w.default.bold("Logs:")),console.log(w.default.gray(K.logs))),console.log(w.default.cyan("─".repeat(60))),K.status!=="SUCCESS"&&process.exit(1)}}class _m{async execute(a){const i=a.appPath??ue;await Cn(i),console.log(w.default.blue("Installing application...")),console.log(w.default.gray(`App path: ${i}
227
- `));const l=await E.appInstall({appPath:i,remote:a.remote});l.success||(console.error(w.default.red(l.error.message)),process.exit(1)),console.log(w.default.green("✓ Application installed"))}}class ym{constructor(){this.apiService=new E.ApiService}async execute({appPath:a=ue,functionUniversalIdentifier:i,functionName:l}){try{const p=await E.readManifestFromFile(a);p||process.exit(1),this.logWatchInfo({appName:p.application.displayName,functionUniversalIdentifier:i,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:p.application.universalIdentifier,functionUniversalIdentifier:i,functionName:l})}catch(p){console.error(w.default.red("Watch logs failed:"),p instanceof Error?p.message:p),process.exit(1)}}logWatchInfo({appName:a,functionUniversalIdentifier:i,functionName:l}){const p=a??"Twenty Application",x=i||l?`function "${i||l}"`:"functions";console.log(w.default.blue(`🚀 Watching ${p} ${x} logs:
228
- `))}}class wm{async execute(a){const i=a.appPath??ue;await Cn(i),console.log(w.default.blue("Publishing to npm...")),console.log(w.default.gray(`App path: ${i}
229
- `));const l=await E.appPublish({appPath:i,npmTag:a.tag,onProgress:p=>console.log(w.default.gray(p))});l.success||(console.error(w.default.red(l.error.message)),process.exit(1)),console.log(w.default.green("✓ Published to npm successfully"))}}const Sm=f=>{try{return new URL(f).hostname.replace(/\./g,"-")}catch{return"remote"}},Bo=async(f,a)=>{(a?await E.authLogin({apiKey:a,apiUrl:f}):await xm(f)).success||(console.error(w.default.red("✗ Authentication failed.")),process.exit(1))},xm=async f=>{await We.default.prompt([{type:"input",name:"confirm",message:"Press Enter to open the browser for authentication..."}]);const a=await E.authLoginOAuth({apiUrl:f});if(a.success)return a;console.log(w.default.yellow(a.error.message));const i=await We.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:l=>l.length>0||"API key is required"}]);return E.authLogin({apiKey:i.apiKey,apiUrl:f})},Im=f=>{const a=f.command("remote").description("Manage remote Twenty servers");a.command("add").description("Add a new remote or re-authenticate an existing one").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--api-url <apiUrl>","Server URL").option("--local","Connect to a local Twenty server (auto-detect)").action(async i=>{const l=new E.ConfigService,p=await l.getRemotes();if(i.as!==void 0&&p.includes(i.as)){const L=await l.getConfigForRemote(i.as);E.ConfigService.setActiveRemote(i.as),await Bo(L.apiUrl,i.apiKey);return}let x=i.apiUrl;if(!x){const L=await E.detectLocalServer();i.local?(L||(console.error(w.default.red(`No local Twenty server found.
230
- Start one with: yarn twenty server start`)),process.exit(1)),console.log(w.default.gray(`Found local server at ${L}`)),x=L):x=(await We.default.prompt([{type:"input",name:"apiUrl",message:"Twenty server URL:",validate:se=>{try{return new URL(se),!0}catch{return"Please enter a valid URL"}}}])).apiUrl}const I=i.as??Sm(x);E.ConfigService.setActiveRemote(I),await Bo(x,i.apiKey),await l.getDefaultRemote()==="local"&&await l.setDefaultRemote(I)}),a.command("list").description("List all configured remotes").action(async()=>{const i=new E.ConfigService,l=await i.getRemotes(),p=await i.getDefaultRemote();if(l.length===0){console.log("No remotes configured."),console.log("Use 'twenty remote add' to add one.");return}console.log("");for(const x of l){const I=await i.getConfigForRemote(x),B=I.accessToken?"oauth":I.apiKey?"api-key":"none",L=x===p,se=L?"* ":" ",Q=L?w.default.bold(x):x;console.log(`${se}${Q} ${w.default.gray(I.apiUrl)} [${B}]`)}console.log(`
231
- `,w.default.gray("Use 'twenty remote switch <name>' to change default"))}),a.command("switch [name]").description("Set the default remote").action(async i=>{const l=new E.ConfigService,p=i??(await We.default.prompt([{type:"list",name:"remote",message:"Select default remote:",choices:await l.getRemotes()}])).remote;(await l.getRemotes()).includes(p)||(console.error(w.default.red(`Remote "${p}" not found.`)),process.exit(1)),await l.setDefaultRemote(p),console.log(w.default.green(`✓ Default remote set to "${p}".`))}),a.command("status").description("Show active remote and authentication status").action(async()=>{const i=new E.ConfigService,l=new E.ApiService,p=E.ConfigService.getActiveRemote(),x=await i.getConfig(),I=x.accessToken?"oauth":x.apiKey?"api-key":"none";if(console.log(` Remote: ${w.default.bold(p)}`),console.log(` Server: ${x.apiUrl}`),I==="none"){console.log(` Auth: ${w.default.yellow("not configured")}`);return}const{authValid:B}=await l.validateAuth(),L=B?w.default.green(`${I} (valid)`):w.default.red(`${I} (invalid)`);console.log(` Auth: ${L}`)}),a.command("remove <name>").description("Remove a remote").action(async i=>{const l=new E.ConfigService;(await l.getRemotes()).includes(i)||(console.error(w.default.red(`Remote "${i}" not found.`)),process.exit(1)),E.ConfigService.setActiveRemote(i),await l.clearConfig(),console.log(w.default.green(`✓ Remote "${i}" removed.`))})},Am=f=>{const a=f.command("server").description("Manage a local Twenty server instance");a.command("start").description("Start a local Twenty server").option("-p, --port <port>","HTTP port",String(E.DEFAULT_PORT)).action(async i=>{const l=parseInt(i.port,10);(isNaN(l)||l<1||l>65535)&&(console.error(w.default.red("Invalid port number.")),process.exit(1));const p=await E.serverStart({port:l,onProgress:x=>console.log(w.default.gray(x))});p.success||(console.error(w.default.red(p.error.message)),process.exit(1))}),a.command("stop").description("Stop the local Twenty server").action(()=>{if(!E.containerExists()){console.log(w.default.yellow("No Twenty server container found."));return}An.execSync(`docker stop ${E.CONTAINER_NAME}`,{stdio:"ignore"}),console.log(w.default.green("Twenty server stopped."))}),a.command("logs").description("Stream Twenty server logs").option("-n, --lines <lines>","Number of lines to show","50").action(i=>{if(!E.containerExists()){console.log(w.default.yellow("No Twenty server container found."));return}try{An.spawnSync("docker",["logs","-f","--tail",i.lines,E.CONTAINER_NAME],{stdio:"inherit"})}catch{}}),a.command("status").description("Show Twenty server status").action(async()=>{if(!E.containerExists()){console.log(` Status: ${w.default.gray("not created")}`),console.log(w.default.gray(" Run 'yarn twenty server start' to create one."));return}const i=E.isContainerRunning(),l=i?E.getContainerPort():E.DEFAULT_PORT,p=i?await E.checkServerHealth(l):!1,x=p?w.default.green("running (healthy)"):i?w.default.yellow("running (starting...)"):w.default.gray("stopped");console.log(` Status: ${x}`),console.log(` URL: http://localhost:${l}`),p&&console.log(w.default.gray(" Login: tim@apple.dev / tim@apple.dev"))}),a.command("reset").description("Delete all data and start fresh").action(()=>{E.containerExists()&&An.execSync(`docker rm -f ${E.CONTAINER_NAME}`,{stdio:"ignore"});try{An.execSync("docker volume rm twenty-app-dev-data twenty-app-dev-storage",{stdio:"ignore"})}catch{}console.log(w.default.green("Twenty server data reset.")),console.log(w.default.gray("Run 'yarn twenty server start' to start a fresh instance."))})},Em=f=>`${w.default.cyan(f.file)}:${w.default.yellow(String(f.line))}:${w.default.yellow(String(f.column+1))} - ${w.default.red("error")} ${f.text}`;class bm{async execute(a){const i=a.appPath??ue;console.log(w.default.blue("Running type check...")),console.log(w.default.gray(`App path: ${i}
232
- `));const l=await E.runTypecheck(i);l.length===0&&(console.log(w.default.green("✓ No type errors found")),process.exit(0));for(const p of l)console.log(Em(p));console.log(`
233
- `,w.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}class Cm{async execute({appPath:a=ue,askForConfirmation:i}){console.log(w.default.blue("🚀 Uninstall Twenty Application")),console.log(w.default.gray(`📁 App Path: ${a}
234
- `)),i&&!await this.confirmationPrompt()&&(console.error(w.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await E.appUninstall({appPath:a});return l.success?(console.log(w.default.green(" Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(w.default.red("❌ Uninstall failed:"),l.error.message),{success:!1,error:l.error.message})}async confirmationPrompt(){const{confirmation:a}=await We.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return a}}const Rm=f=>{const a=new Iv,i=new vm,l=new _m,p=new wm,x=new bm,I=new Cm,B=new Av,L=new Ev,se=new wv,Q=new ym,K=new mm;f.command("dev [appPath]").description("Watch and sync local application changes").option("-v, --verbose","Show detailed logs").option("-d, --debug","Show detailed logs (alias for --verbose)").action(async(q,W)=>{await i.execute({appPath:ct(q),verbose:W.verbose||W.debug})}),f.command("build [appPath]").description("Build, sync, and generate API client into .twenty/output/").option("--tarball","Also pack into a .tgz tarball").action(async(q,W)=>{await a.execute({appPath:ct(q),tarball:W.tarball})}),f.command("install [appPath]").description("Install a deployed application on the connected server").option("-r, --remote <name>","Install on a specific remote").action(async(q,W)=>{await l.execute({appPath:ct(q),remote:W.remote})}),f.command("deploy [appPath]").description("Build and upload application to a Twenty server").option("-r, --remote <name>","Deploy to a specific remote").action(async(q,W)=>{await L.execute({appPath:ct(q),remote:W.remote})}),f.command("publish [appPath]").description("Build and publish to npm").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(q,W)=>{await p.execute({appPath:ct(q),tag:W.tag})}),f.command("catalog-sync").description("Trigger marketplace catalog sync on the server").option("-r, --remote <name>","Sync on a specific remote").action(async q=>{await B.execute({remote:q.remote})}),f.command("typecheck [appPath]").description("Run TypeScript type checking on the application").action(async q=>{await x.execute({appPath:ct(q)})}),f.command("uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(q,W)=>{try{const Me=await I.execute({appPath:ct(q),askForConfirmation:!W?.yes});process.exit(Me.success?0:1)}catch{process.exit(1)}}),Im(f),Am(f),f.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(T.o$1).join("|")})`).action(async(q,W)=>{await se.execute(q,W?.path)}),f.command("exec [appPath]").option("--preInstall","Execute pre-install logic function if defined").option("--postInstall","Execute post-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").description("Execute a logic function with a JSON payload").action(async(q,W)=>{!W?.preInstall&&!W?.postInstall&&!W?.functionUniversalIdentifier&&!W?.functionName&&(console.error(w.default.red("Error: Either --preInstall, --postInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await K.execute({...W,payload:W?.payload??"{}",appPath:ct(q)})}),f.command("logs [appPath]").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").description("Watch application function logs").action(async(q,W)=>{await Q.execute({...W,appPath:ct(q)})})};av.inspect.defaultOptions.depth=10;const jt=new ko.Command;jt.name("twenty").description("CLI for Twenty application development").version(Ho.version);jt.option("-r, --remote <name>","Use a specific remote (overrides the default set by remote switch)");jt.hook("preAction",async f=>{let i=(f.optsWithGlobals?f.optsWithGlobals():f.opts()).remote;i?console.log(w.default.gray(`Using remote: ${i}`)):i=await new E.ConfigService().getDefaultRemote(),E.ConfigService.setActiveRemote(i)});Rm(jt);jt.exitOverride();try{jt.parse()}catch(f){f instanceof ko.CommanderError&&process.exit(f.exitCode),f instanceof Error&&(console.error(w.default.red("Error:"),f.message),process.exit(1))}
221
+ Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!i.authValid)return a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.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 l=a.output.isReady;return a.output={isReady:!0,errorLogged:!1},a.status="done",l||this.notify(),!0}}class Ev{constructor({clientService:a,configService:i,state:l,notify:p}){this.clientService=a,this.configService=i,this.state=l,this.notify=p}async execute(a){const i=this.state.steps.generateApiClient;i.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generateCoreClient({appPath:a.appPath,authToken:l.accessToken}),i.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),i.status="error"}this.notify()}}class Av{constructor({apiService:a,configService:i,state:l,notify:p}){this.apiService=a,this.configService=i,this.state=l,this.notify=p}async execute(a){const i=a.manifest.application.universalIdentifier,l=await this.apiService.findApplicationRegistrationByUniversalIdentifier(i);if(!l.success)return this.state.applyStepEvents([{message:"Failed to check app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null};if(l.data)return this.state.applyStepEvents([{message:`App registration found: ${l.data.name}`,status:"info"}]),this.notify(),{applicationRegistrationId:l.data.id,clientId:l.data.oAuthClientId};const p=await this.apiService.createApplicationRegistration({name:a.manifest.application.displayName,universalIdentifier:i});return!p.success||!p.data?(this.state.applyStepEvents([{message:"Failed to create app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null}):(await this.configService.setConfig({oauthClientId:p.data.applicationRegistration.oAuthClientId}),this.state.applyStepEvents([{message:`App registration created: ${a.manifest.application.displayName}`,status:"success"},{message:`Client ID: ${p.data.applicationRegistration.oAuthClientId}`,status:"info"},{message:`Client Secret: ${p.data.clientSecret}`,status:"warning"},{message:"Credentials saved to config. The secret will not be shown again.",status:"warning"}]),this.notify(),{applicationRegistrationId:p.data.applicationRegistration.id,clientId:p.data.applicationRegistration.oAuthClientId})}}class Uo{constructor(a){this.watcher=null,this.appPath=a.appPath,this.fileFolder=a.fileFolder,this.watchPaths=a.watchPaths,this.handleFileBuilt=a.handleFileBuilt}async start(){const a=this.watchPaths.map(i=>j.join(this.appPath,i));for(const i of a)if(!await A.pathExists(i))return;this.watcher=ko.default.watch(a,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{i==="addDir"||i==="unlinkDir"||((i==="add"||i==="change")&&this.copyAndNotify(l),i==="unlink"&&this.handleUnlink(l))})}async close(){await this.watcher?.close()}async copyAndNotify(a){const i=j.relative(this.appPath,a),l=j.join(P.E,i),p=j.join(this.appPath,l);await A.ensureDir(j.dirname(p)),await A.copy(a,p);const E=await Tn.readFile(p),x=rv.default.createHash("md5").update(E).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:i,checksum:x})}async handleUnlink(a){const i=j.relative(this.appPath,a),l=j.join(P.E,i),p=j.join(this.appPath,l);await A.remove(p)}}class Iv{constructor(a){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=a.appPath,this.onErrors=a.onErrors}async start(){const a=Fo.default.join(this.appPath,"node_modules",".bin","tsc");if(!await A.pathExists(a))return;const i=Fo.default.join(this.appPath,"tsconfig.json");this.process=Cn.spawn(a,["--watch","--noEmit","--pretty","false","-p",i],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(a){this.buffer+=a;const i=this.buffer.split(`
222
+ `);this.buffer=i.pop()??"";for(const l of i)this.processLine(l)}processLine(a){if(a.includes("Starting compilation in watch mode...")||a.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(a.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const i=A.parseTscOutputLine(a);i&&this.pendingErrors.push(i)}}const Cv=new Set(["node_modules","dist",".twenty"]);class bv{constructor(a){this.watcher=null,this.appPath=a.appPath,this.handleChangeDetected=a.handleChangeDetected,this.verbose=a.verbose??!1}async start(){const a=this.appPath;this.watcher=ko.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:i=>{const l=j.relative(a,i);if(l==="")return!1;const p=l.split(Bo.default.sep)[0];return Cv.has(p)||p.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{if(i==="addDir"||i==="unlinkDir")return;const p=j.relative(this.appPath,l),E=p.startsWith(P._),x=["package.json","yarn.lock"].includes(p);!(p.endsWith(".ts")||p.endsWith(".tsx"))&&!E&&!x||this.handleChangeDetected(p,i)})}async close(){await this.watcher?.close()}}class Tv{constructor(a){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=a.state,this.scheduleSync=a.scheduleSync,this.notify=a.notify,this.onFileBuilt=a.onFileBuilt,this.shouldSkipTypecheck=a.shouldSkipTypecheck,this.verbose=a.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new bv({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(a){const{logicFunctions:i,frontComponents:l}=a.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(i,l);return}this.logicFunctionsWatcher?.shouldRestart(i)&&await this.logicFunctionsWatcher.restart(i),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(a,i){this.state.addEvent({message:`Change detected: ${a}`,status:"info"}),i==="unlink"?this.state.removeEntity(a):this.state.updateEntityStatus(a,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(a){this.state.addEvent({message:"Build failed:",status:"error"});for(const i of a)this.state.addEvent({message:i.error,status:"error"});this.notify()}handleFileBuilt(a){this.verbose&&this.state.addEvent({message:`Successfully built ${a.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(a.builtPath,{checksum:a.checksum,builtPath:a.builtPath,sourcePath:a.sourcePath,fileFolder:a.fileFolder,usesSdkClient:a.usesSdkClient}),this.onFileBuilt(a),this.notify(),this.scheduleSync()}async startFileWatchers(a,i){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(a),this.startFrontComponentsWatcher(i),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(a){this.logicFunctionsWatcher=A.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:a,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(a){this.frontComponentsWatcher=A.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:a,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Uo({appPath:this.state.appPath,fileFolder:P.B.PublicAsset,watchPaths:[P._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Uo({appPath:this.state.appPath,fileFolder:P.B.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(a){a.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(a.map(i=>({message:`Type error in ${i.file}(${i.line},${i.column}): ${i.text}`,status:"error"}))),this.notify()}}class Rv{constructor({apiService:a,state:i,notify:l,verbose:p}){this.apiService=a,this.state=i,this.notify=l,this.verbose=p??!1}async execute(a){const i=this.state.steps.syncApplication;i.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],p=A.manifestUpdateChecksums({manifest:a.manifest,builtFileInfos:a.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await A.writeManifestToOutput(a.appPath,p),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const E=await this.apiService.syncApplication(p);if(E.success){l.push({message:"✓ Synced",status:"success"}),i.output={syncStatus:"synced",error:null},i.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const x=this.verbose?null:A.formatSyncErrorEvents(E.error);x?(l.push(...x),l.push({message:"Add --verbose to see full error log",status:"info"})):l.push({message:`Sync failed with error: ${A.serializeError(E.error)}`,status:"error"});const G=x?x[0].message:"Sync failed";i.output={syncStatus:"error",error:G},i.status="error",this.state.updatePipeline({status:"error",error:G}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Fv{constructor({state:a,notify:i,verbose:l}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=a,this.notify=i,this.verbose=l??!1}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(a){const i=this.state.steps.uploadFiles;i.output={...i.output,fileUploader:new A.FileUploader({appPath:a.appPath,applicationUniversalIdentifier:a.universalIdentifier})},i.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(a,i,l){const p=this.state.steps.uploadFiles;if(!p.output.fileUploader)return;p.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${a}`,status:"info"}),this.state.updateEntityStatus(i,"uploading"),this.notify();const E=p.output.fileUploader.uploadFile({builtPath:a,fileFolder:l}).then(x=>{x.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${a}`,status:"success"}),this.state.updateEntityStatus(i,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${a}: ${x.error}`,status:"error"}))}).catch(x=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${a}: ${x}`,status:"error"})}).finally(()=>{p.output.activeUploads.delete(E),p.output.activeUploads.size===0&&(this.logUploadSummary(),p.status="done",this.notify())});p.output.activeUploads.add(E)}async waitForUploads(){const a=this.state.steps.uploadFiles;for(;a.output.activeUploads.size>0;)await Promise.all(a.output.activeUploads);a.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[a,{fileFolder:i,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(a,l,i)}}class Pv{constructor(a){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=a.debounceMs??200,this.state=a.state,this.verbose=a.verbose??!1,this.apiService=new A.ApiService({disableInterceptors:!0});const i=this.apiService,l=new A.ConfigService;this.clientService=new A.ClientService;const p={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new xv({...p,apiService:i}),this.buildManifestStep=new Sv(p),this.registerAppStep=new Av({...p,apiService:i,configService:l}),this.uploadFilesStep=new Fv({...p,verbose:this.verbose}),this.generateApiClientStep=new Ev({...p,clientService:this.clientService,configService:l}),this.syncApplicationStep=new Rv({...p,apiService:i,verbose:this.verbose}),this.startWatchersStep=new Tv({...p,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const a=Bo.default.join(this.state.appPath,P.E);await A.ensureDir(a),await A.emptyDir(a),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(a){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(a.builtPath,a.sourcePath,a.fileFolder)}async checkServerHealth(){const a=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!a&&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(a){this.state.addEvent({message:`Sync failed with error: ${A.serializeError(a)}`,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 i=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!i||(await this.startWatchersStep.handleWatcherRestarts(i),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(i.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(i.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:i.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),this.skipTypecheck=!1)}async initializePipeline(a){await this.registerAppStep.execute({manifest:a});const i=await this.apiService.createDevelopmentApplication({universalIdentifier:a.application.universalIdentifier,name:a.application.displayName});return!i.success||!i.data?(this.state.applyStepEvents([{message:"Failed to create development application",status:"error"},{message:JSON.stringify(i,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:i.data.id,universalIdentifier:i.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application created",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:a.application.universalIdentifier}),!0)}}const Ov={objects:P.o$1.Object,fields:P.o$1.Field,logicFunctions:P.o$1.LogicFunction,frontComponents:P.o$1.FrontComponent,roles:P.o$1.Role,skills:P.o$1.Skill,views:P.o$1.View,navigationMenuItems:P.o$1.NavigationMenuItem,pageLayouts:P.o$1.PageLayout},Lv=200,Nv={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 Uv{constructor(a){this.eventIdCounter=0,this.appPath=a.appPath,this.frontendUrl=a.frontendUrl,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.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(a){Object.assign(this.pipeline,a),this.notify()}applyStepEvents(a){const i=a.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Lv-i.length)),...i]}addEvent(a){this.applyStepEvents([a])}updateEntityStatus(a,i){const l=new Map(this.entities),p=l.get(a);p?.status&&!Nv[p.status].includes(i)||(l.set(a,p?{...p,status:i}:{name:a,path:a,status:i}),this.entities=l)}removeEntity(a){const i=new Map(this.entities);i.delete(a),this.entities=i}updateAllEntitiesStatus(a){const i=new Map(this.entities);for(const[l,p]of i)i.set(l,{...p,status:a});this.entities=i}updateEntitiesFromManifest(a){const i=new Map;for(const[p,E]of Object.entries(a)){const x=Ov[p];if(x)for(const G of E)i.set(G,x)}const l=new Map(this.entities);for(const[p,E]of l)l.set(p,{...E,type:i.get(p)});for(const[p,E]of i)l.has(p)||l.set(p,{name:p,path:p,type:E,status:"pending"});this.entities=l}hasObjectsOrFieldsChanged(a){const i=JSON.stringify({objects:a.objects,fields:a.fields}),l=i!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=i,l}}const De={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},$v=f=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[f],Dv=f=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[f],Wv=f=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[f],Mv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},zi=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Yi=["↑","⇡","↟","⤒"],Ho={[P.o$1.Object]:"Objects",[P.o$1.Field]:"Fields",[P.o$1.LogicFunction]:"Logic functions",[P.o$1.FrontComponent]:"Front components",[P.o$1.Role]:"Roles",[P.o$1.Skill]:"Skills",[P.o$1.View]:"Views",[P.o$1.NavigationMenuItem]:"Navigation menu items",[P.o$1.PageLayout]:"Page layouts",[P.o$1.Agent]:"Agents"},Ko=Object.keys(Ho),Bv={info:"gray",success:"green",error:"red",warning:"yellow"},kv=f=>f.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),Gv=(f,a=40)=>{if(f.length<=a)return f;const i=f.split("/");return i.length<=2?f:`.../${i.slice(-2).join("/")}`},qv=f=>{const a=new Map;for(const i of Ko)a.set(i,[]);for(const i of f.values()){if(!i.type)continue;const l=a.get(i.type)??[];l.push(i),a.set(i.type,l)}return a},Hv=f=>!f.frontendUrl||!f.steps.resolveApplication.output.universalIdentifier?null:`${f.frontendUrl}/settings/applications`,Kv=f=>f.some(a=>a==="error")?"error":f.some(a=>a==="in_progress")?"in_progress":f.every(a=>a==="done")?"done":"idle",zv=f=>{const a=[...f.entities.values()],i=a.some(x=>x.status==="error"),l=a.some(x=>x.status==="building"),p=a.length>0&&a.every(x=>x.status==="uploading"||x.status==="success"),E=i?"error":l?"in_progress":p?"done":"idle";return[{label:"Application Initialization",status:Kv([f.steps.checkServer.status,f.steps.ensureValidTokens.status,f.steps.resolveApplication.status])},{label:"Resources Build",status:E},{label:"Resources Upload",status:f.steps.uploadFiles.status},{label:"Manifest Build",status:f.steps.buildManifest.status},{label:"Application Synchronization",status:f.steps.syncApplication.status},{label:"Api Client Generation",status:f.steps.generateApiClient.status}]},zo=120,Yv=Math.round(200/zo),$o=()=>{const f=Math.floor(Date.now()/zo);return{spinnerFrame:zi[f%zi.length],uploadFrame:Yi[Math.floor(f/Yv)%Yi.length]}},Vi=f=>{const a=De[f];return a.icon==="spinner"?$o().spinnerFrame:a.icon==="upload"?$o().uploadFrame:a.icon},Yo=Go.default.createContext(null),Vv=Yo.Provider,ht=()=>{const f=Go.default.useContext(Yo);if(!f)throw new Error("useInk must be used within InkProvider");return f},Zv=({uiStatus:f})=>{const{Text:a}=ht(),i=Vi(f),l=De[f];return O.jsxs(a,{color:l.color,children:[i," "]})},Jv=({entity:f})=>{const{Box:a,Text:i}=ht();return O.jsxs(a,{children:[O.jsx(Zv,{uiStatus:Dv(f.status)}),O.jsx(i,{children:f.name}),f.path!==f.name&&O.jsxs(i,{dimColor:!0,children:[" (",Gv(f.path),")"]})]})},Xv=({type:f,entities:a})=>{const{Box:i,Text:l}=ht();return a.length===0?null:O.jsxs(i,{flexDirection:"column",marginTop:1,children:[O.jsx(l,{bold:!0,dimColor:!0,children:Ho[f]}),a.map(p=>O.jsx(Jv,{entity:p},p.path))]})},jv=()=>{const{Box:f,Text:a}=ht();return O.jsx(f,{marginTop:1,children:O.jsxs(a,{dimColor:!0,children:[O.jsx(a,{color:De.idle.color,children:De.idle.icon})," ","pending"," ",O.jsx(a,{color:De.in_progress.color,children:zi[0]})," ","building"," ",O.jsx(a,{color:De.uploading.color,children:Yi[0]})," ","uploading"," ",O.jsx(a,{color:De.done.color,children:De.done.icon})," ","success"," ",O.jsx(a,{color:De.error.color,children:De.error.icon})," ","error"]})})},Qv=({state:f})=>{const{Text:a}=ht(),i=Wv(f.pipeline.status),l=Vi(i),p=De[i],E=Mv[f.pipeline.status];return O.jsxs(a,{color:p.color,children:[l," ",E]})},em=({label:f,status:a})=>{const{Box:i,Text:l}=ht(),p=$v(a),E=Vi(p),x=De[p];return O.jsxs(i,{children:[O.jsxs(l,{dimColor:!0,children:[f,": "]}),O.jsxs(l,{color:x.color,children:[E," ",a.replace("_"," ")]})]})},tm=({state:f})=>{const{Box:a,Text:i}=ht(),l=qv(f.entities),p=Hv(f);return O.jsxs(a,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[O.jsx(i,{bold:!0,color:"cyan",children:"Application"}),O.jsxs(a,{marginLeft:2,flexDirection:"column",children:[O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Name: "}),O.jsx(i,{bold:!0,children:f.pipeline.appName??"Loading..."})]}),O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Overall Status: "}),O.jsx(Qv,{state:f})]}),p&&O.jsxs(a,{children:[O.jsx(i,{dimColor:!0,children:"Open:"}),O.jsxs(i,{bold:!0,color:"cyan",children:[" ",p]})]})]}),O.jsx(a,{marginLeft:2,flexDirection:"column",marginTop:1,children:zv(f).map(E=>O.jsx(em,{label:E.label,status:E.status},E.label))}),O.jsx(a,{marginLeft:2,flexDirection:"column",children:Ko.map(E=>{const x=l.get(E)??[];return O.jsx(Xv,{type:E,entities:x},E)})})]})},nm=({event:f})=>{const{Box:a,Text:i}=ht(),l=Bv[f.status],p=kv(f.timestamp);return O.jsxs(a,{children:[O.jsxs(i,{dimColor:!0,children:[p," "]}),O.jsx(i,{color:l,children:f.message})]})},rm=new Set(["building","syncing"]),Do=120,im=80,sm=({uiStateManager:f})=>{const{Box:a,Static:i}=ht(),[,l]=Et.useReducer(W=>W+1,0),p=Et.useRef(null),E=Et.useRef(0),x=Et.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,E.current=Date.now(),l()},im)},[]);Et.useEffect(()=>f.subscribe(()=>{x()}),[f,x]),Et.useEffect(()=>{const W=setInterval(()=>{const re=f.getSnapshot();rm.has(re.pipeline.status)&&(Date.now()-E.current<Do||l())},Do);return()=>clearInterval(W)},[f]),Et.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const G=f.getSnapshot();return O.jsxs(O.Fragment,{children:[O.jsx(i,{items:G.events,children:W=>O.jsx(nm,{event:W},W.id)}),O.jsxs(a,{marginTop:1,flexDirection:"column",children:[O.jsx(tm,{state:G}),O.jsx(jv,{})]})]})},am=async f=>{const a=await import("ink"),{render:i,Box:l,Text:p,Static:E}=a,{unmount:x}=i(O.jsx(Vv,{value:{Box:l,Text:p,Static:E},children:O.jsx(sm,{uiStateManager:f})}),{incrementalRendering:!0});return{unmount:x}};class om{constructor(a){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=a}getSnapshot(){return this.orchestratorState}subscribe(a){return this.listeners.add(a),a(this.orchestratorState),()=>this.listeners.delete(a)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const a of this.listeners)a(this.orchestratorState)}))}}class um{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(a){const i=a.appPath??ae;await jt(i);const l=await new A.ConfigService().getConfig(),p=new Uv({appPath:i,frontendUrl:l.apiUrl});if(!a.headless){const E=new om(p);p.onChange=()=>E.notify();const{unmount:x}=await am(E);this.unmountUI=x}this.orchestrator=new Pv({state:p,verbose:a.verbose}),await this.orchestrator.start(),a.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const a=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",a),process.on("SIGTERM",a)}}class lm{async execute({appPath:a=ae,postInstall:i=!1,preInstall:l=!1,functionUniversalIdentifier:p,functionName:E,payload:x="{}"}){let G;try{G=JSON.parse(x)}catch{console.error(y.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const W=i?"post install":l?"pre install":p??E;console.log(y.default.blue(`🚀 Executing function "${W}"...`)),console.log(y.default.gray(` Payload: ${JSON.stringify(G)}
223
+ `));const re=i?{appPath:a,postInstall:!0,payload:G}:l?{appPath:a,preInstall:!0,payload:G}:p?{appPath:a,functionUniversalIdentifier:p,payload:G}:{appPath:a,functionName:E,payload:G},ee=await A.functionExecute(re);if(!ee.success){switch(ee.error.code){case A.APP_ERROR_CODES.MANIFEST_NOT_FOUND:{console.error(y.default.red("Failed to build manifest."));break}case A.FUNCTION_ERROR_CODES.FETCH_FUNCTIONS_FAILED:{console.error(y.default.red("Failed to fetch functions:"),ee.error.message);break}case A.FUNCTION_ERROR_CODES.FUNCTION_NOT_FOUND:{console.error(y.default.red(ee.error.message),`
224
+ `);const q=ee.error.details?.availableFunctions??[];q.length>0?(console.log(y.default.cyan("Available functions:")),q.forEach(B=>{console.log(` - ${y.default.white(B.name)} (${B.universalIdentifier})`)})):console.log(y.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case A.FUNCTION_ERROR_CODES.EXECUTION_FAILED:{console.error(y.default.red("Execution failed:"),ee.error.message);break}default:console.error(y.default.red(ee.error.message))}process.exit(1)}const Z=ee.data;console.log(y.default.cyan("─".repeat(60))),console.log(y.default.cyan("Execution Result")),console.log(y.default.cyan("─".repeat(60)));const ze=Z.status==="SUCCESS"?y.default.green:y.default.red;console.log(`${y.default.bold("Status:")} ${ze(Z.status)}`),console.log(`${y.default.bold("Duration:")} ${Z.duration}ms
225
+ `),P.o(Z.data)&&(console.log(y.default.bold("Data:")),console.log(y.default.white(JSON.stringify(Z.data,null,2)))),Z.error&&(console.log(y.default.bold.red("Error:")),console.log(y.default.red(` Type: ${Z.error.errorType}`)),console.log(y.default.red(` Message: ${Z.error.errorMessage}
226
+ `)),Z.error.stackTrace&&(console.log(y.default.gray("Stack trace:")),console.log(y.default.gray(Z.error.stackTrace)))),Z.logs&&(console.log(y.default.bold("Logs:")),console.log(y.default.gray(Z.logs))),console.log(y.default.cyan("─".repeat(60))),Z.status!=="SUCCESS"&&process.exit(1)}}class cm{async execute(a){const i=a.appPath??ae;await jt(i),console.log(y.default.blue("Installing application...")),console.log(y.default.gray(`App path: ${i}
227
+ `));const l=await A.appInstall({appPath:i,remote:a.remote});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green("✓ Application installed"))}}class fm{constructor(){this.apiService=new A.ApiService}async execute({appPath:a=ae,functionUniversalIdentifier:i,functionName:l}){try{const p=await A.readManifestFromFile(a);p||process.exit(1),this.logWatchInfo({appName:p.application.displayName,functionUniversalIdentifier:i,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:p.application.universalIdentifier,functionUniversalIdentifier:i,functionName:l})}catch(p){console.error(y.default.red("Watch logs failed:"),p instanceof Error?p.message:p),process.exit(1)}}logWatchInfo({appName:a,functionUniversalIdentifier:i,functionName:l}){const p=a??"Twenty Application",E=i||l?`function "${i||l}"`:"functions";console.log(y.default.blue(`🚀 Watching ${p} ${E} logs:
228
+ `))}}class hm{async execute(a){const i=a.appPath??ae;await jt(i),console.log(y.default.blue("Publishing to npm...")),console.log(y.default.gray(`App path: ${i}
229
+ `));const l=await A.appPublish({appPath:i,npmTag:a.tag,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green("✓ Published to npm successfully"))}}const pm=f=>{try{return new URL(f).hostname.replace(/\./g,"-")}catch{return"remote"}},Wo=async(f,a)=>{(a?await A.authLogin({apiKey:a,apiUrl:f}):await dm(f)).success||(console.error(y.default.red("✗ Authentication failed.")),process.exit(1))},dm=async f=>{await We.default.prompt([{type:"input",name:"confirm",message:"Press Enter to open the browser for authentication..."}]);const a=await A.authLoginOAuth({apiUrl:f});if(a.success)return a;console.log(y.default.yellow(a.error.message));const i=await We.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:l=>l.length>0||"API key is required"}]);return A.authLogin({apiKey:i.apiKey,apiUrl:f})},gm=f=>{const a=f.command("remote").description("Manage remote Twenty servers");a.command("add").description("Add a new remote or re-authenticate an existing one").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--api-url <apiUrl>","Server URL").option("--local","Connect to a local Twenty server (auto-detect)").option("--test","Write to config.test.json (for integration tests)").action(async i=>{const l=i.test?A.getConfigPath(!0):void 0,p=new A.ConfigService(l?{configPath:l}:void 0),E=await p.getRemotes();if(i.as!==void 0&&E.includes(i.as)){const re=await p.getConfigForRemote(i.as);A.ConfigService.setActiveRemote(i.as),await Wo(re.apiUrl,i.apiKey);return}let x=i.apiUrl;if(!x){const re=await A.detectLocalServer();i.local?(re||(console.error(y.default.red(`No local Twenty server found.
230
+ Start one with: yarn twenty server start`)),process.exit(1)),console.log(y.default.gray(`Found local server at ${re}`)),x=re):x=(await We.default.prompt([{type:"input",name:"apiUrl",message:"Twenty server URL:",validate:ee=>{try{return new URL(ee),!0}catch{return"Please enter a valid URL"}}}])).apiUrl}const G=i.as??pm(x);A.ConfigService.setActiveRemote(G),await Wo(x,i.apiKey),await p.getDefaultRemote()==="local"&&await p.setDefaultRemote(G)}),a.command("list").description("List all configured remotes").action(async()=>{const i=new A.ConfigService,l=await i.getRemotes(),p=await i.getDefaultRemote();if(l.length===0){console.log("No remotes configured."),console.log("Use 'twenty remote add' to add one.");return}console.log("");for(const E of l){const x=await i.getConfigForRemote(E),G=x.accessToken?"oauth":x.apiKey?"api-key":"none",W=E===p,re=W?"* ":" ",ee=W?y.default.bold(E):E;console.log(`${re}${ee} ${y.default.gray(x.apiUrl)} [${G}]`)}console.log(`
231
+ `,y.default.gray("Use 'twenty remote switch <name>' to change default"))}),a.command("switch [name]").description("Set the default remote").action(async i=>{const l=new A.ConfigService,p=i??(await We.default.prompt([{type:"list",name:"remote",message:"Select default remote:",choices:await l.getRemotes()}])).remote;(await l.getRemotes()).includes(p)||(console.error(y.default.red(`Remote "${p}" not found.`)),process.exit(1)),await l.setDefaultRemote(p),console.log(y.default.green(`✓ Default remote set to "${p}".`))}),a.command("status").description("Show active remote and authentication status").action(async()=>{const i=new A.ConfigService,l=new A.ApiService,p=A.ConfigService.getActiveRemote(),E=await i.getConfig(),x=E.accessToken?"oauth":E.apiKey?"api-key":"none";if(console.log(` Remote: ${y.default.bold(p)}`),console.log(` Server: ${E.apiUrl}`),x==="none"){console.log(` Auth: ${y.default.yellow("not configured")}`);return}const{authValid:G}=await l.validateAuth(),W=G?y.default.green(`${x} (valid)`):y.default.red(`${x} (invalid)`);console.log(` Auth: ${W}`)}),a.command("remove <name>").description("Remove a remote").action(async i=>{const l=new A.ConfigService;(await l.getRemotes()).includes(i)||(console.error(y.default.red(`Remote "${i}" not found.`)),process.exit(1)),A.ConfigService.setActiveRemote(i),await l.clearConfig(),console.log(y.default.green(`✓ Remote "${i}" removed.`))})},vm=f=>{const a=f.command("server").description("Manage a local Twenty server instance");a.command("start").description("Start a local Twenty server").option("-p, --port <port>","HTTP port").option("--test","Start a separate test instance (port 2021)").action(async i=>{const l=i.test?A.DEFAULT_TEST_PORT:A.DEFAULT_PORT,p=i.port?parseInt(i.port,10):l;(isNaN(p)||p<1||p>65535)&&(console.error(y.default.red("Invalid port number.")),process.exit(1));const E=await A.serverStart({port:p,test:i.test,onProgress:x=>console.log(y.default.gray(x))});E.success||(console.error(y.default.red(E.error.message)),process.exit(1))}),a.command("stop").description("Stop the local Twenty server").option("--test","Stop the test instance").action(i=>{const l=i.test?A.TEST_CONTAINER_NAME:A.CONTAINER_NAME;if(!A.containerExists(l)){console.log(y.default.yellow("No Twenty server container found."));return}Cn.execSync(`docker stop ${l}`,{stdio:"ignore"}),console.log(y.default.green("Twenty server stopped."))}),a.command("logs").description("Stream Twenty server logs").option("-n, --lines <lines>","Number of lines to show","50").option("--test","Show logs for the test instance").action(i=>{const l=i.test?A.TEST_CONTAINER_NAME:A.CONTAINER_NAME;if(!A.containerExists(l)){console.log(y.default.yellow("No Twenty server container found."));return}try{Cn.spawnSync("docker",["logs","-f","--tail",i.lines,l],{stdio:"inherit"})}catch{}}),a.command("status").description("Show Twenty server status").option("--test","Show status of the test instance").action(async i=>{const l=i.test?A.TEST_CONTAINER_NAME:A.CONTAINER_NAME,p=i.test?A.DEFAULT_TEST_PORT:A.DEFAULT_PORT;if(!A.containerExists(l)){console.log(` Status: ${y.default.gray("not created")}`),console.log(y.default.gray(` Run 'yarn twenty server start${i.test?" --test":""}' to create one.`));return}const E=A.isContainerRunning(l),x=E?A.getContainerPort(l):p,G=E?await A.checkServerHealth(x):!1,W=G?y.default.green("running (healthy)"):E?y.default.yellow("running (starting...)"):y.default.gray("stopped");console.log(` Status: ${W}`),console.log(` URL: http://localhost:${x}`),G&&console.log(y.default.gray(" Login: tim@apple.dev / tim@apple.dev"))}),a.command("reset").description("Delete all data and start fresh").option("--test","Reset the test instance").action(i=>{const l=i.test?A.TEST_CONTAINER_NAME:A.CONTAINER_NAME,p=i.test?"twenty-app-dev-test-data":"twenty-app-dev-data",E=i.test?"twenty-app-dev-test-storage":"twenty-app-dev-storage";A.containerExists(l)&&Cn.execSync(`docker rm -f ${l}`,{stdio:"ignore"});try{Cn.execSync(`docker volume rm ${p} ${E}`,{stdio:"ignore"})}catch{}console.log(y.default.green("Twenty server data reset.")),console.log(y.default.gray(`Run 'yarn twenty server start${i.test?" --test":""}' to start a fresh instance.`))})};class mm{async execute(a){const i=a.appPath??ae;await jt(i),console.log(y.default.blue("Syncing application...")),console.log(y.default.gray(`App path: ${i}
232
+ `));const l=await A.appDevOnce({appPath:i,verbose:a.verbose,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green(`
233
+ ✓ Synced ${l.data.applicationDisplayName} (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(y.default.gray(`Output: ${l.data.outputDir}`))}}const _m=f=>`${y.default.cyan(f.file)}:${y.default.yellow(String(f.line))}:${y.default.yellow(String(f.column+1))} - ${y.default.red("error")} ${f.text}`;class ym{async execute(a){const i=a.appPath??ae;console.log(y.default.blue("Running type check...")),console.log(y.default.gray(`App path: ${i}
234
+ `));const l=await A.runTypecheck(i);l.length===0&&(console.log(y.default.green(" No type errors found")),process.exit(0));for(const p of l)console.log(_m(p));console.log(`
235
+ `,y.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}class wm{async execute({appPath:a=ae,askForConfirmation:i}){console.log(y.default.blue("🚀 Uninstall Twenty Application")),console.log(y.default.gray(`📁 App Path: ${a}
236
+ `)),i&&!await this.confirmationPrompt()&&(console.error(y.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await A.appUninstall({appPath:a});return l.success?(console.log(y.default.green("✅ Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(y.default.red("❌ Uninstall failed:"),l.error.message),{success:!1,error:l.error.message})}async confirmationPrompt(){const{confirmation:a}=await We.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return a}}const Sm=f=>{const a=new _v,i=new um,l=new mm,p=new cm,E=new hm,x=new ym,G=new wm,W=new yv,re=new wv,ee=new gv,Z=new fm,ze=new lm;f.command("dev [appPath]").description("Build and sync local application changes (watches by default; use --once for a one-shot sync)").option("-w, --watch","Watch source files and re-sync on every change (default behavior)").option("-o, --once","Build and sync once, then exit (useful for CI, scripts, and pre-commit hooks)").option("-v, --verbose","Show detailed logs").option("-d, --debug","Show detailed logs (alias for --verbose)").action(async(q,B)=>{B.once&&B.watch&&(console.error(y.default.red("Error: --once and --watch are mutually exclusive. Watch mode is the default.")),process.exit(1));const Xe={appPath:ft(q),verbose:B.verbose||B.debug};if(B.once){await l.execute(Xe);return}await i.execute(Xe)}),f.command("build [appPath]").description("Build, sync, and generate API client into .twenty/output/").option("--tarball","Also pack into a .tgz tarball").action(async(q,B)=>{await a.execute({appPath:ft(q),tarball:B.tarball})}),f.command("install [appPath]").description("Install a deployed application on the connected server").option("-r, --remote <name>","Install on a specific remote").action(async(q,B)=>{await p.execute({appPath:ft(q),remote:B.remote})}),f.command("deploy [appPath]").description("Build and upload application to a Twenty server").option("-r, --remote <name>","Deploy to a specific remote").action(async(q,B)=>{await re.execute({appPath:ft(q),remote:B.remote})}),f.command("publish [appPath]").description("Build and publish to npm").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(q,B)=>{await E.execute({appPath:ft(q),tag:B.tag})}),f.command("catalog-sync").description("Trigger marketplace catalog sync on the server").option("-r, --remote <name>","Sync on a specific remote").action(async q=>{await W.execute({remote:q.remote})}),f.command("typecheck [appPath]").description("Run TypeScript type checking on the application").action(async q=>{await x.execute({appPath:ft(q)})}),f.command("uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(q,B)=>{try{const Xe=await G.execute({appPath:ft(q),askForConfirmation:!B?.yes});process.exit(Xe.success?0:1)}catch{process.exit(1)}}),gm(f),vm(f),f.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(P.o$1).join("|")})`).action(async(q,B)=>{await ee.execute(q,B?.path)}),f.command("exec [appPath]").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").description("Execute a logic function with a JSON payload").action(async(q,B)=>{!B?.postInstall&&!B?.preInstall&&!B?.functionUniversalIdentifier&&!B?.functionName&&(console.error(y.default.red("Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await ze.execute({...B,payload:B?.payload??"{}",appPath:ft(q)})}),f.command("logs [appPath]").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").description("Watch application function logs").action(async(q,B)=>{await Z.execute({...B,appPath:ft(q)})})};nv.inspect.defaultOptions.depth=10;const Qt=new Mo.Command;Qt.name("twenty").description("CLI for Twenty application development").version(qo.version);Qt.option("-r, --remote <name>","Use a specific remote (overrides the default set by remote switch)");Qt.hook("preAction",async f=>{let i=(f.optsWithGlobals?f.optsWithGlobals():f.opts()).remote;i?console.log(y.default.gray(`Using remote: ${i}`)):i=await new A.ConfigService().getDefaultRemote(),A.ConfigService.setActiveRemote(i)});Sm(Qt);Qt.exitOverride();try{Qt.parse()}catch(f){f instanceof Mo.CommanderError&&process.exit(f.exitCode),f instanceof Error&&(console.error(y.default.red("Error:"),f.message),process.exit(1))}