twenty-sdk 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/{AllIcons-BwIoyggb-BCMFgulw.mjs → AllIcons-CdbaxNyc-CJcUHQBl.mjs} +492 -493
- package/dist/AllIcons-CdbaxNyc-DR-8e_UM.js +1 -0
- package/dist/assets/halftone-backdrop.png +0 -0
- package/dist/billing/index.cjs +1 -1
- package/dist/billing/index.cjs.map +1 -1
- package/dist/billing/index.mjs +2 -1
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{catalog-sync-CXDxoJ8O.mjs → catalog-sync-BYM3GqZl.mjs} +1 -1
- package/dist/catalog-sync-w6yKppKP.js +1 -0
- package/dist/cli/commands/dev/dev.d.ts +1 -0
- package/dist/cli/operations/index.d.ts +2 -0
- package/dist/cli/operations/server-start.d.ts +1 -0
- package/dist/cli/utilities/api/api-client.d.ts +3 -1
- package/dist/cli/utilities/api/api-response-type.d.ts +1 -0
- package/dist/cli/utilities/auth/reauth-helper.d.ts +2 -0
- package/dist/cli/utilities/build/common/build-application.d.ts +2 -0
- package/dist/cli/utilities/build/cover/apply-generated-cover.d.ts +9 -0
- package/dist/cli/utilities/build/cover/assets/twenty-logo-mark-path.d.ts +1 -0
- package/dist/cli/utilities/build/cover/generate-cover-image.d.ts +5 -0
- package/dist/cli/utilities/build/cover/generated-asset.type.d.ts +4 -0
- package/dist/cli/utilities/build/cover/generated-cover-path.d.ts +1 -0
- package/dist/cli/utilities/server/docker-container.d.ts +1 -0
- package/dist/cli/utilities/version/get-engine-version-range.d.ts +1 -0
- package/dist/cli/utilities/version/resolve-highest-engine-version.d.ts +1 -0
- package/dist/cli.cjs +34 -34
- package/dist/cli.mjs +1605 -1600
- package/dist/define/index.cjs +21 -21
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +127 -7
- package/dist/define/index.mjs +36027 -34678
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +1 -1
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +2 -2
- package/dist/front-component/index.mjs +3 -3
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/front-component-renderer.cjs +1 -1
- package/dist/get-function-input-schema-GNk3NRLJ-D8x7FINz.js +1 -0
- package/dist/{get-function-input-schema-NI9y_bIk-Cdh2RIb9.mjs → get-function-input-schema-GNk3NRLJ-zQkANyT3.mjs} +31 -21
- package/dist/icon-DMT-YeKi-C9-AduNa.mjs +10168 -0
- package/dist/icon-DMT-YeKi-Cz0W5sJA.js +1 -0
- package/dist/isDefined-Dtu5EYqP-Dp026Ry1.js +1 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-D8x7FINz.js +2 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-D8x7FINz.js.map +1 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs +75 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs.map +1 -0
- package/dist/logic-function/index.cjs +4 -4
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.d.ts +26 -5
- package/dist/logic-function/index.mjs +144 -28
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/logic-function/isDefined-Dtu5EYqP-CMNeFg4z.mjs +7 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-CMNeFg4z.mjs.map +1 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-Dp026Ry1.js +2 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-Dp026Ry1.js.map +1 -0
- package/dist/login-D7nyXinY.js +345 -0
- package/dist/{login-oauth-BRpqOH2x.mjs → login-rU5te3B6.mjs} +43931 -42338
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +4 -4
- package/dist/ui/index.cjs +25 -6
- package/dist/ui/index.d.ts +18 -12
- package/dist/ui/index.mjs +15247 -1078
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.mjs +11 -9
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +6 -3
- package/dist/AllIcons-BwIoyggb-Pq3paugc.js +0 -1
- package/dist/catalog-sync-sANH0f3Y.js +0 -1
- package/dist/display-Co0K-nTB-CGtaWbMi.js +0 -83
- package/dist/display-Co0K-nTB-DAirZFT6.mjs +0 -54635
- package/dist/get-function-input-schema-NI9y_bIk-CqUY25sG.js +0 -1
- package/dist/login-oauth-0T8eWvyh.js +0 -345
package/dist/cli.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./get-front-component-build-plugins-DBupR4cF.js"),t=require("./login-oauth-0T8eWvyh.js");let n=require("path");n=e.i(n);let r=require("crypto");r=e.i(r);let i=require("node:fs/promises"),a=require("uuid"),o=require("node:path");o=e.i(o);let s=require("react");s=e.i(s);let c=require("node:child_process"),l=require("chalk");l=e.i(l);let u=require("inquirer");u=e.i(u);let d=require("chokidar");d=e.i(d);let f=require("react/jsx-runtime"),p=require("commander"),m=require("util");var h=process.env.INIT_CWD||process.cwd(),g=e=>e&&!e?.startsWith(`/`)?(0,n.join)(h,e):e,_=async e=>{let r=(0,n.join)(e,`package.json`);if(await t.at(r))try{let e=await(0,i.readFile)(r,`utf-8`),t=JSON.parse(e);return t.dependencies?.[`twenty-sdk`]??t.devDependencies?.[`twenty-sdk`]??void 0}catch{return}},v=e=>{let t=e.match(/(\d+)\./);if(t)return parseInt(t[1],10);let n=e.match(/^[~^>=<]*(\d+)$/);return n?parseInt(n[1],10):null},y=async e=>{let n=t.N.version,r=await _(e);if(!n||!r)return;let i=v(n),a=v(r);i===null||a===null||i!==a&&(console.warn(l.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${a}.x but the CLI running is v${n}. Major version mismatches may cause unexpected behavior.\n Update with: npm install -g twenty-sdk@${a}`)),console.warn(``))},b=class{async execute(e){e.private?await this.executePrivate(e):await this.executeNpm(e)}async executeNpm(e){let n=e.appPath??h;await y(n),console.log(l.default.blue(`Publishing to npm...`)),console.log(l.default.gray(`App path: ${n}\n`));let r=await t.P({appPath:n,npmTag:e.tag,onProgress:e=>console.log(l.default.gray(e))});r.success||(console.error(l.default.red(r.error.message)),process.exit(1)),console.log(l.default.green(`✓ Published to npm successfully`))}async executePrivate(e){let r=e.appPath??h;await y(r);let i=e.remote??t.R.getActiveRemote();console.log(l.default.blue(`Deploying application on ${i}...`)),console.log(l.default.gray(`App path: ${r}\n`));let a=e=>console.log(l.default.gray(e)),o=await t.B({appPath:r,tarball:!0,onProgress:a});o.success||(console.error(l.default.red(o.error.message)),process.exit(1));let s=await t.F({tarballPath:o.data.tarballPath,remote:e.remote,onProgress:a});s.success||(console.error(l.default.red(s.error.message)),process.exit(1));let c=await t.ot(n.default.join(r,`package.json`)).catch(()=>void 0),u=c?.name??s.data.name,d=c?.version??`unknown`;console.log(l.default.green(`\n✓ Published ${u} v${d} to ${i}\n`)),console.log(" To install deployed application: `yarn twenty app:install`")}},x=class{async execute(e){let n=e.appPath??h;await y(n),await t.g();let r=e.remote??t.R.getActiveRemote();console.log(l.default.blue(`Installing application on ${r}...`)),console.log(l.default.gray(`App path: ${n}\n`));let i=await t.A({appPath:n,remote:e.remote});i.success||(console.error(l.default.red(i.error.message)),process.exit(1)),console.log(l.default.green(`✓ Application installed`))}},S=class{async execute({appPath:e=h,askForConfirmation:n}){let r=t.R.getActiveRemote();console.log(l.default.blue(`🚀 Uninstall Twenty Application on ${r}`)),console.log(l.default.gray(`📁 App Path: ${e}\n`)),n&&!await this.confirmationPrompt()&&(console.error(l.default.red(`⛔️ Aborting uninstall`)),process.exit(1));let i=await t.h({appPath:e});return i.success?(console.log(l.default.green(`✅ Application uninstalled successfully`)),{success:!0,data:void 0}):(console.error(l.default.red(`❌ Uninstall failed:`),i.error.message),{success:!1,error:i.error.message})}async confirmationPrompt(){let{confirmation:e}=await u.default.prompt([{type:`confirm`,name:`confirmation`,message:`Are you sure you want to uninstall this application?`,default:!1}]);return e}},C=e=>{let t=new b,n=new x,r=new S;e.command(`app:publish [appPath]`).description(`Build and publish to npm (default) or server registry`).option(`--private`,`Push to a Twenty server's registry instead of npm`).option(`-r, --remote <name>`,`Publish to a specific remote (with --private)`).option(`--tag <tag>`,`npm dist-tag (e.g. beta, next)`).action(async(e,n)=>{await t.execute({appPath:g(e),private:n.private,remote:n.remote,tag:n.tag})}),e.command(`app:install [appPath]`).description(`Install a deployed app on the server`).option(`-r, --remote <name>`,`Install on a specific remote`).action(async(e,t)=>{await n.execute({appPath:g(e),remote:t.remote})}),e.command(`app:uninstall [appPath]`).description(`Uninstall app from server`).option(`-y, --yes`,`Skip confirmation prompt`).action(async(e,t)=>{try{let n=await r.execute({appPath:g(e),askForConfirmation:!t?.yes});process.exit(+!n.success)}catch{process.exit(1)}})},ee=e.n(((e,t)=>{(function(){var n,r=`4.18.1`,i=200,a=`Unsupported core-js use. Try https://npms.io/search?q=ponyfill.`,o=`Expected a function`,s="Invalid `variable` option passed into `_.template`",c="Invalid `imports` option passed into `_.template`",l=`__lodash_hash_undefined__`,u=500,d=`__lodash_placeholder__`,f=1,p=2,m=4,h=1,g=2,_=1,v=2,y=4,b=8,x=16,S=32,C=64,ee=128,te=256,ne=512,re=30,ie=`...`,ae=800,oe=16,se=1,ce=2,le=3,w=1/0,ue=9007199254740991,de=17976931348623157e292,fe=NaN,pe=4294967295,me=pe-1,he=pe>>>1,ge=[[`ary`,ee],[`bind`,_],[`bindKey`,v],[`curry`,b],[`curryRight`,x],[`flip`,ne],[`partial`,S],[`partialRight`,C],[`rearg`,te]],_e=`[object Arguments]`,ve=`[object Array]`,ye=`[object AsyncFunction]`,be=`[object Boolean]`,xe=`[object Date]`,Se=`[object DOMException]`,Ce=`[object Error]`,we=`[object Function]`,Te=`[object GeneratorFunction]`,T=`[object Map]`,Ee=`[object Number]`,De=`[object Null]`,Oe=`[object Object]`,ke=`[object Promise]`,Ae=`[object Proxy]`,je=`[object RegExp]`,E=`[object Set]`,Me=`[object String]`,Ne=`[object Symbol]`,Pe=`[object Undefined]`,Fe=`[object WeakMap]`,Ie=`[object WeakSet]`,Le=`[object ArrayBuffer]`,Re=`[object DataView]`,ze=`[object Float32Array]`,Be=`[object Float64Array]`,Ve=`[object Int8Array]`,He=`[object Int16Array]`,Ue=`[object Int32Array]`,We=`[object Uint8Array]`,Ge=`[object Uint8ClampedArray]`,Ke=`[object Uint16Array]`,qe=`[object Uint32Array]`,Je=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,Xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ze=/&(?:amp|lt|gt|quot|#39);/g,Qe=/[&<>"']/g,$e=RegExp(Ze.source),et=RegExp(Qe.source),tt=/<%-([\s\S]+?)%>/g,nt=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,it=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,at=/^\w*$/,ot=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,st=/[\\^$.*+?()[\]{}|]/g,ct=RegExp(st.source),lt=/^\s+/,D=/\s/,ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,dt=/\{\n\/\* \[wrapped with (.+)\] \*/,ft=/,? & /,pt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,mt=/[()=,{}\[\]\/\s]/,ht=/\\(\\)?/g,gt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,vt=/^[-+]0x[0-9a-f]+$/i,yt=/^0b[01]+$/i,bt=/^\[object .+?Constructor\]$/,xt=/^0o[0-7]+$/i,St=/^(?:0|[1-9]\d*)$/,Ct=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wt=/($^)/,Tt=/['\n\r\u2028\u2029\\]/g,Et=`\\ud800-\\udfff`,Dt=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Ot=`\\u2700-\\u27bf`,O=`a-z\\xdf-\\xf6\\xf8-\\xff`,kt=`\\xac\\xb1\\xd7\\xf7`,At=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,k=`\\u2000-\\u206f`,jt=` \\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`,Mt=`A-Z\\xc0-\\xd6\\xd8-\\xde`,Nt=`\\ufe0e\\ufe0f`,Pt=kt+At+k+jt,Ft=`['’]`,A=`[`+Et+`]`,It=`[`+Pt+`]`,Lt=`[`+Dt+`]`,Rt=`\\d+`,zt=`[`+Ot+`]`,Bt=`[`+O+`]`,Vt=`[^`+Et+Pt+Rt+Ot+O+Mt+`]`,Ht=`\\ud83c[\\udffb-\\udfff]`,Ut=`(?:`+Lt+`|`+Ht+`)`,Wt=`[^`+Et+`]`,Gt=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Kt=`[\\ud800-\\udbff][\\udc00-\\udfff]`,qt=`[`+Mt+`]`,Jt=`\\u200d`,Yt=`(?:`+Bt+`|`+Vt+`)`,Xt=`(?:`+qt+`|`+Vt+`)`,Zt=`(?:`+Ft+`(?:d|ll|m|re|s|t|ve))?`,Qt=`(?:`+Ft+`(?:D|LL|M|RE|S|T|VE))?`,$t=Ut+`?`,en=`[`+Nt+`]?`,tn=`(?:`+Jt+`(?:`+[Wt,Gt,Kt].join(`|`)+`)`+en+$t+`)*`,nn=`\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])`,rn=`\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])`,an=en+$t+tn,on=`(?:`+[zt,Gt,Kt].join(`|`)+`)`+an,sn=`(?:`+[Wt+Lt+`?`,Lt,Gt,Kt,A].join(`|`)+`)`,cn=RegExp(Ft,`g`),ln=RegExp(Lt,`g`),un=RegExp(Ht+`(?=`+Ht+`)|`+sn+an,`g`),dn=RegExp([qt+`?`+Bt+`+`+Zt+`(?=`+[It,qt,`$`].join(`|`)+`)`,Xt+`+`+Qt+`(?=`+[It,qt+Yt,`$`].join(`|`)+`)`,qt+`?`+Yt+`+`+Zt,qt+`+`+Qt,rn,nn,Rt,on].join(`|`),`g`),fn=RegExp(`[`+Jt+Et+Dt+Nt+`]`),j=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,pn=`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`.split(`.`),mn=-1,M={};M[ze]=M[Be]=M[Ve]=M[He]=M[Ue]=M[We]=M[Ge]=M[Ke]=M[qe]=!0,M[_e]=M[ve]=M[Le]=M[be]=M[Re]=M[xe]=M[Ce]=M[we]=M[T]=M[Ee]=M[Oe]=M[je]=M[E]=M[Me]=M[Fe]=!1;var N={};N[_e]=N[ve]=N[Le]=N[Re]=N[be]=N[xe]=N[ze]=N[Be]=N[Ve]=N[He]=N[Ue]=N[T]=N[Ee]=N[Oe]=N[je]=N[E]=N[Me]=N[Ne]=N[We]=N[Ge]=N[Ke]=N[qe]=!0,N[Ce]=N[we]=N[Fe]=!1;var P={À:`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`},hn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},gn={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`},_n={"\\":`\\`,"'":`'`,"\n":`n`,"\r":`r`,"\u2028":`u2028`,"\u2029":`u2029`},vn=parseFloat,yn=parseInt,bn=typeof global==`object`&&global&&global.Object===Object&&global,xn=typeof self==`object`&&self&&self.Object===Object&&self,F=bn||xn||Function(`return this`)(),Sn=typeof e==`object`&&e&&!e.nodeType&&e,Cn=Sn&&typeof t==`object`&&t&&!t.nodeType&&t,wn=Cn&&Cn.exports===Sn,Tn=wn&&bn.process,I=function(){try{return Cn&&Cn.require&&Cn.require(`util`).types||Tn&&Tn.binding&&Tn.binding(`util`)}catch{}}(),En=I&&I.isArrayBuffer,Dn=I&&I.isDate,On=I&&I.isMap,kn=I&&I.isRegExp,An=I&&I.isSet,jn=I&&I.isTypedArray;function Mn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Nn(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function Pn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function Fn(e,t){for(var n=e==null?0:e.length;n--&&t(e[n],n,e)!==!1;);return e}function In(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Ln(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function Rn(e,t){return!!(e!=null&&e.length)&&Yn(e,t,0)>-1}function zn(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function L(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Bn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Vn(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Hn(e,t,n,r){var i=e==null?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Un(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Wn=$n(`length`);function Gn(e){return e.split(``)}function Kn(e){return e.match(pt)||[]}function qn(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Jn(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Yn(e,t,n){return t===t?Tr(e,t,n):Jn(e,Zn,n)}function Xn(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Zn(e){return e!==e}function Qn(e,t){var n=e==null?0:e.length;return n?rr(e,t)/n:fe}function $n(e){return function(t){return t==null?n:t[e]}}function er(e){return function(t){return e==null?n:e[t]}}function tr(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function nr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function rr(e,t){for(var r,i=-1,a=e.length;++i<a;){var o=t(e[i]);o!==n&&(r=r===n?o:r+o)}return r}function ir(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function ar(e,t){return L(t,function(t){return[t,e[t]]})}function or(e){return e&&e.slice(0,kr(e)+1).replace(lt,``)}function sr(e){return function(t){return e(t)}}function cr(e,t){return L(t,function(t){return e[t]})}function lr(e,t){return e.has(t)}function ur(e,t){for(var n=-1,r=e.length;++n<r&&Yn(t,e[n],0)>-1;);return n}function dr(e,t){for(var n=e.length;n--&&Yn(t,e[n],0)>-1;);return n}function fr(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var pr=er(P),mr=er(hn);function hr(e){return`\\`+_n[e]}function gr(e,t){return e==null?n:e[t]}function _r(e){return fn.test(e)}function vr(e){return j.test(e)}function yr(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function br(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function xr(e,t){return function(n){return e(t(n))}}function Sr(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n];(o===t||o===d)&&(e[n]=d,a[i++]=n)}return a}function Cr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function wr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Tr(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Er(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}function Dr(e){return _r(e)?jr(e):Wn(e)}function Or(e){return _r(e)?Mr(e):Gn(e)}function kr(e){for(var t=e.length;t--&&D.test(e.charAt(t)););return t}var Ar=er(gn);function jr(e){for(var t=un.lastIndex=0;un.test(e);)++t;return t}function Mr(e){return e.match(un)||[]}function Nr(e){return e.match(dn)||[]}var Pr=(function e(t){t=t==null?F:Pr.defaults(F.Object(),t,Pr.pick(F,pn));var D=t.Array,pt=t.Date,Et=t.Error,Dt=t.Function,Ot=t.Math,O=t.Object,kt=t.RegExp,At=t.String,k=t.TypeError,jt=D.prototype,Mt=Dt.prototype,Nt=O.prototype,Pt=t[`__core-js_shared__`],Ft=Mt.toString,A=Nt.hasOwnProperty,It=0,Lt=function(){var e=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),Rt=Nt.toString,zt=Ft.call(O),Bt=F._,Vt=kt(`^`+Ft.call(A).replace(st,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ht=wn?t.Buffer:n,Ut=t.Symbol,Wt=t.Uint8Array,Gt=Ht?Ht.allocUnsafe:n,Kt=xr(O.getPrototypeOf,O),qt=O.create,Jt=Nt.propertyIsEnumerable,Yt=jt.splice,Xt=Ut?Ut.isConcatSpreadable:n,Zt=Ut?Ut.iterator:n,Qt=Ut?Ut.toStringTag:n,$t=function(){try{var e=is(O,`defineProperty`);return e({},``,{}),e}catch{}}(),en=t.clearTimeout!==F.clearTimeout&&t.clearTimeout,tn=pt&&pt.now!==F.Date.now&&pt.now,nn=t.setTimeout!==F.setTimeout&&t.setTimeout,rn=Ot.ceil,an=Ot.floor,on=O.getOwnPropertySymbols,sn=Ht?Ht.isBuffer:n,un=t.isFinite,dn=jt.join,fn=xr(O.keys,O),j=Ot.max,P=Ot.min,hn=pt.now,gn=t.parseInt,_n=Ot.random,bn=jt.reverse,xn=is(t,`DataView`),Sn=is(t,`Map`),Cn=is(t,`Promise`),Tn=is(t,`Set`),I=is(t,`WeakMap`),Wn=is(O,`create`),Gn=I&&new I,er={},Tr=Vs(xn),jr=Vs(Sn),Mr=Vs(Cn),Fr=Vs(Tn),Ir=Vs(I),Lr=Ut?Ut.prototype:n,Rr=Lr?Lr.valueOf:n,zr=Lr?Lr.toString:n;function R(e){if(Y(e)&&!K(e)&&!(e instanceof z)){if(e instanceof Hr)return e;if(A.call(e,`__wrapped__`))return Us(e)}return new Hr(e)}var Br=function(){function e(){}return function(t){if(!J(t))return{};if(qt)return qt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Vr(){}function Hr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}R.templateSettings={escape:tt,evaluate:nt,interpolate:rt,variable:``,imports:{_:R}},R.prototype=Vr.prototype,R.prototype.constructor=R,Hr.prototype=Br(Vr.prototype),Hr.prototype.constructor=Hr;function z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=pe,this.__views__=[]}function Ur(){var e=new z(this.__wrapped__);return e.__actions__=go(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=go(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=go(this.__views__),e}function Wr(){if(this.__filtered__){var e=new z(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Gr(){var e=this.__wrapped__.value(),t=this.__dir__,n=K(e),r=t<0,i=n?e.length:0,a=cs(0,i,this.__views__),o=a.start,s=a.end,c=s-o,l=r?s:o-1,u=this.__iteratees__,d=u.length,f=0,p=P(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return Xa(e,this.__actions__);var m=[];outer:for(;c--&&f<p;){l+=t;for(var h=-1,g=e[l];++h<d;){var _=u[h],v=_.iteratee,y=_.type,b=v(g);if(y==ce)g=b;else if(!b){if(y==se)continue outer;break outer}}m[f++]=g}return m}z.prototype=Br(Vr.prototype),z.prototype.constructor=z;function Kr(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 qr(){this.__data__=Wn?Wn(null):{},this.size=0}function Jr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Yr(e){var t=this.__data__;if(Wn){var r=t[e];return r===l?n:r}return A.call(t,e)?t[e]:n}function Xr(e){var t=this.__data__;return Wn?t[e]!==n:A.call(t,e)}function Zr(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Wn&&t===n?l:t,this}Kr.prototype.clear=qr,Kr.prototype.delete=Jr,Kr.prototype.get=Yr,Kr.prototype.has=Xr,Kr.prototype.set=Zr;function Qr(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 $r(){this.__data__=[],this.size=0}function ei(e){var t=this.__data__,n=Ti(t,e);return n<0?!1:(n==t.length-1?t.pop():Yt.call(t,n,1),--this.size,!0)}function ti(e){var t=this.__data__,r=Ti(t,e);return r<0?n:t[r][1]}function ni(e){return Ti(this.__data__,e)>-1}function ri(e,t){var n=this.__data__,r=Ti(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Qr.prototype.clear=$r,Qr.prototype.delete=ei,Qr.prototype.get=ti,Qr.prototype.has=ni,Qr.prototype.set=ri;function ii(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 ai(){this.size=0,this.__data__={hash:new Kr,map:new(Sn||Qr),string:new Kr}}function oi(e){var t=ns(this,e).delete(e);return this.size-=+!!t,t}function si(e){return ns(this,e).get(e)}function ci(e){return ns(this,e).has(e)}function li(e,t){var n=ns(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}ii.prototype.clear=ai,ii.prototype.delete=oi,ii.prototype.get=si,ii.prototype.has=ci,ii.prototype.set=li;function ui(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new ii;++t<n;)this.add(e[t])}function di(e){return this.__data__.set(e,l),this}function fi(e){return this.__data__.has(e)}ui.prototype.add=ui.prototype.push=di,ui.prototype.has=fi;function pi(e){var t=this.__data__=new Qr(e);this.size=t.size}function mi(){this.__data__=new Qr,this.size=0}function hi(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function gi(e){return this.__data__.get(e)}function _i(e){return this.__data__.has(e)}function vi(e,t){var n=this.__data__;if(n instanceof Qr){var r=n.__data__;if(!Sn||r.length<i-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ii(r)}return n.set(e,t),this.size=n.size,this}pi.prototype.clear=mi,pi.prototype.delete=hi,pi.prototype.get=gi,pi.prototype.has=_i,pi.prototype.set=vi;function yi(e,t){var n=K(e),r=!n&&gu(e),i=!n&&!r&&bu(e),a=!n&&!r&&!i&&Gu(e),o=n||r||i||a,s=o?ir(e.length,At):[],c=s.length;for(var l in e)(t||A.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||gs(l,c)))&&s.push(l);return s}function bi(e){var t=e.length;return t?e[Aa(0,t-1)]:n}function xi(e,t){return Rs(go(e),ji(t,0,e.length))}function Si(e){return Rs(go(e))}function Ci(e,t,r){(r!==n&&!pu(e[t],r)||r===n&&!(t in e))&&ki(e,t,r)}function wi(e,t,r){var i=e[t];(!(A.call(e,t)&&pu(i,r))||r===n&&!(t in e))&&ki(e,t,r)}function Ti(e,t){for(var n=e.length;n--;)if(pu(e[n][0],t))return n;return-1}function Ei(e,t,n,r){return Li(e,function(e,i,a){t(r,e,n(e),a)}),r}function Di(e,t){return e&&_o(t,Q(t),e)}function Oi(e,t){return e&&_o(t,Td(t),e)}function ki(e,t,n){t==`__proto__`&&$t?$t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ai(e,t){for(var r=-1,i=t.length,a=D(i),o=e==null;++r<i;)a[r]=o?n:yd(e,t[r]);return a}function ji(e,t,r){return e===e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function Mi(e,t,r,i,a,o){var s,c=t&f,l=t&p,u=t&m;if(r&&(s=a?r(e,i,a,o):r(e)),s!==n)return s;if(!J(e))return e;var d=K(e);if(d){if(s=ds(e),!c)return go(e,s)}else{var h=W(e),g=h==we||h==Te;if(bu(e))return ao(e,c);if(h==Oe||h==_e||g&&!a){if(s=l||g?{}:fs(e),!c)return l?yo(e,Oi(s,e)):vo(e,Di(s,e))}else{if(!N[h])return a?e:{};s=ps(e,h,c)}}o||=new pi;var _=o.get(e);if(_)return _;o.set(e,s),Hu(e)?e.forEach(function(n){s.add(Mi(n,t,r,n,e,o))}):ju(e)&&e.forEach(function(n,i){s.set(i,Mi(n,t,r,i,e,o))});var v=d?n:(u?l?Qo:Zo:l?Td:Q)(e);return Pn(v||e,function(n,i){v&&(i=n,n=e[i]),wi(s,i,Mi(n,t,r,i,e,o))}),s}function Ni(e){var t=Q(e);return function(n){return Pi(n,e,t)}}function Pi(e,t,r){var i=r.length;if(e==null)return!i;for(e=O(e);i--;){var a=r[i],o=t[a],s=e[a];if(s===n&&!(a in e)||!o(s))return!1}return!0}function Fi(e,t,r){if(typeof e!=`function`)throw new k(o);return Ps(function(){e.apply(n,r)},t)}function Ii(e,t,n,r){var a=-1,o=Rn,s=!0,c=e.length,l=[],u=t.length;if(!c)return l;n&&(t=L(t,sr(n))),r?(o=zn,s=!1):t.length>=i&&(o=lr,s=!1,t=new ui(t));outer:for(;++a<c;){var d=e[a],f=n==null?d:n(d);if(d=r||d!==0?d:0,s&&f===f){for(var p=u;p--;)if(t[p]===f)continue outer;l.push(d)}else o(t,f,r)||l.push(d)}return l}var Li=So(Gi),Ri=So(Ki,!0);function zi(e,t){var n=!0;return Li(e,function(e,r,i){return n=!!t(e,r,i),n}),n}function Bi(e,t,r){for(var i=-1,a=e.length;++i<a;){var o=e[i],s=t(o);if(s!=null&&(c===n?s===s&&!Wu(s):r(s,c)))var c=s,l=o}return l}function Vi(e,t,r,i){var a=e.length;for(r=X(r),r<0&&(r=-r>a?0:a+r),i=i===n||i>a?a:X(i),i<0&&(i+=a),i=r>i?0:$u(i);r<i;)e[r++]=t;return e}function Hi(e,t){var n=[];return Li(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function B(e,t,n,r,i){var a=-1,o=e.length;for(n||=hs,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?B(s,t-1,n,r,i):Bn(i,s):r||(i[i.length]=s)}return i}var Ui=Co(),Wi=Co(!0);function Gi(e,t){return e&&Ui(e,t,Q)}function Ki(e,t){return e&&Wi(e,t,Q)}function qi(e,t){return Ln(t,function(t){return Ou(e[t])})}function Ji(e,t){t=to(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[Bs(t[r++])];return r&&r==i?e:n}function Yi(e,t,n){var r=t(e);return K(e)?r:Bn(r,n(e))}function V(e){return e==null?e===n?Pe:De:Qt&&Qt in O(e)?as(e):Os(e)}function Xi(e,t){return e>t}function Zi(e,t){return e!=null&&A.call(e,t)}function Qi(e,t){return e!=null&&t in O(e)}function $i(e,t,n){return e>=P(t,n)&&e<j(t,n)}function ea(e,t,r){for(var i=r?zn:Rn,a=e[0].length,o=e.length,s=o,c=D(o),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=L(d,sr(t))),l=P(d.length,l),c[s]=!r&&(t||a>=120&&d.length>=120)?new ui(s&&d):n}d=e[0];var f=-1,p=c[0];outer:for(;++f<a&&u.length<l;){var m=d[f],h=t?t(m):m;if(m=r||m!==0?m:0,!(p?lr(p,h):i(u,h,r))){for(s=o;--s;){var g=c[s];if(!(g?lr(g,h):i(e[s],h,r)))continue outer}p&&p.push(h),u.push(m)}}return u}function ta(e,t,n,r){return Gi(e,function(e,i,a){t(r,n(e),i,a)}),r}function na(e,t,r){t=to(t,e),e=As(e,t);var i=e==null?e:e[Bs(mc(t))];return i==null?n:Mn(i,e,r)}function ra(e){return Y(e)&&V(e)==_e}function ia(e){return Y(e)&&V(e)==Le}function aa(e){return Y(e)&&V(e)==xe}function oa(e,t,n,r,i){return e===t?!0:e==null||t==null||!Y(e)&&!Y(t)?e!==e&&t!==t:sa(e,t,n,r,oa,i)}function sa(e,t,n,r,i,a){var o=K(e),s=K(t),c=o?ve:W(e),l=s?ve:W(t);c=c==_e?Oe:c,l=l==_e?Oe:l;var u=c==Oe,d=l==Oe,f=c==l;if(f&&bu(e)){if(!bu(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new pi,o||Gu(e)?qo(e,t,n,r,i,a):Jo(e,t,c,n,r,i,a);if(!(n&h)){var p=u&&A.call(e,`__wrapped__`),m=d&&A.call(t,`__wrapped__`);if(p||m){var g=p?e.value():e,_=m?t.value():t;return a||=new pi,i(g,_,n,r,a)}}return f?(a||=new pi,Yo(e,t,n,r,i,a)):!1}function ca(e){return Y(e)&&W(e)==T}function la(e,t,r,i){var a=r.length,o=a,s=!i;if(e==null)return!o;for(e=O(e);a--;){var c=r[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<o;){c=r[a];var l=c[0],u=e[l],d=c[1];if(s&&c[2]){if(u===n&&!(l in e))return!1}else{var f=new pi;if(i)var p=i(u,d,l,e,t,f);if(!(p===n?oa(d,u,h|g,i,f):p))return!1}}return!0}function ua(e){return!J(e)||bs(e)?!1:(Ou(e)?Vt:bt).test(Vs(e))}function da(e){return Y(e)&&V(e)==je}function fa(e){return Y(e)&&W(e)==E}function pa(e){return Y(e)&&Au(e.length)&&!!M[V(e)]}function ma(e){return typeof e==`function`?e:e==null?$:typeof e==`object`?K(e)?ba(e[0],e[1]):ya(e):Gf(e)}function ha(e){if(!Ss(e))return fn(e);var t=[];for(var n in O(e))A.call(e,n)&&n!=`constructor`&&t.push(n);return t}function ga(e){if(!J(e))return Ds(e);var t=Ss(e),n=[];for(var r in e)r==`constructor`&&(t||!A.call(e,r))||n.push(r);return n}function _a(e,t){return e<t}function va(e,t){var n=-1,r=vu(e)?D(e.length):[];return Li(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function ya(e){var t=rs(e);return t.length==1&&t[0][2]?ws(t[0][0],t[0][1]):function(n){return n===e||la(n,e,t)}}function ba(e,t){return _s(e)&&Cs(t)?ws(Bs(e),t):function(r){var i=yd(r,e);return i===n&&i===t?xd(r,e):oa(t,i,h|g)}}function xa(e,t,r,i,a){e!==t&&Ui(t,function(o,s){if(a||=new pi,J(o))Sa(e,t,s,r,xa,i,a);else{var c=i?i(Ms(e,s),o,s+``,e,t,a):n;c===n&&(c=o),Ci(e,s,c)}},Td)}function Sa(e,t,r,i,a,o,s){var c=Ms(e,r),l=Ms(t,r),u=s.get(l);if(u){Ci(e,r,u);return}var d=o?o(c,l,r+``,e,t,s):n,f=d===n;if(f){var p=K(l),m=!p&&bu(l),h=!p&&!m&&Gu(l);d=l,p||m||h?K(c)?d=c:q(c)?d=go(c):m?(f=!1,d=ao(l,!0)):h?(f=!1,d=uo(l,!0)):d=[]:zu(l)||gu(l)?(d=c,gu(c)?d=td(c):(!J(c)||Ou(c))&&(d=fs(l))):f=!1}f&&(s.set(l,d),a(d,l,i,o,s),s.delete(l)),Ci(e,r,d)}function Ca(e,t){var r=e.length;if(r)return t+=t<0?r:0,gs(t,r)?e[t]:n}function wa(e,t,n){t=t.length?L(t,function(e){return K(e)?function(t){return Ji(t,e.length===1?e[0]:e)}:e}):[$];var r=-1;return t=L(t,sr(U())),nr(va(e,function(e,n,i){return{criteria:L(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return po(e,t,n)})}function Ta(e,t){return Ea(e,t,function(t,n){return xd(e,n)})}function Ea(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Ji(e,o);n(s,o)&&Fa(a,to(o,e),s)}return a}function Da(e){return function(t){return Ji(t,e)}}function Oa(e,t,n,r){var i=r?Xn:Yn,a=-1,o=t.length,s=e;for(e===t&&(t=go(t)),n&&(s=L(e,sr(n)));++a<o;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&Yt.call(s,c,1),Yt.call(e,c,1);return e}function ka(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;gs(i)?Yt.call(e,i,1):qa(e,i)}}return e}function Aa(e,t){return e+an(_n()*(t-e+1))}function ja(e,t,n,r){for(var i=-1,a=j(rn((t-e)/(n||1)),0),o=D(a);a--;)o[r?a:++i]=e,e+=n;return o}function Ma(e,t){var n=``;if(!e||t<1||t>ue)return n;do t%2&&(n+=e),t=an(t/2),t&&(e+=e);while(t);return n}function H(e,t){return Fs(ks(e,t,$),e+``)}function Na(e){return bi(Ud(e))}function Pa(e,t){var n=Ud(e);return Rs(n,ji(t,0,n.length))}function Fa(e,t,r,i){if(!J(e))return e;t=to(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=Bs(t[a]),u=r;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):n,u===n&&(u=J(d)?d:gs(t[a+1])?[]:{})}wi(c,l,u),c=c[l]}return e}var Ia=Gn?function(e,t){return Gn.set(e,t),e}:$,La=$t?function(e,t){return $t(e,`toString`,{configurable:!0,enumerable:!1,value:kf(t),writable:!0})}:$;function Ra(e){return Rs(Ud(e))}function za(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=D(i);++r<i;)a[r]=e[r+t];return a}function Ba(e,t){var n;return Li(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function Va(e,t,n){var r=0,i=e==null?r:e.length;if(typeof t==`number`&&t===t&&i<=he){for(;r<i;){var a=r+i>>>1,o=e[a];o!==null&&!Wu(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return Ha(e,t,$,n)}function Ha(e,t,r,i){var a=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var s=t!==t,c=t===null,l=Wu(t),u=t===n;a<o;){var d=an((a+o)/2),f=r(e[d]),p=f!==n,m=f===null,h=f===f,g=Wu(f);if(s)var _=i||h;else _=u?h&&(i||p):c?h&&p&&(i||!m):l?h&&p&&!m&&(i||!g):m||g?!1:i?f<=t:f<t;_?a=d+1:o=d}return P(o,me)}function Ua(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!pu(s,c)){var c=s;a[i++]=o===0?0:o}}return a}function Wa(e){return typeof e==`number`?e:Wu(e)?fe:+e}function Ga(e){if(typeof e==`string`)return e;if(K(e))return L(e,Ga)+``;if(Wu(e))return zr?zr.call(e):``;var t=e+``;return t==`0`&&1/e==-w?`-0`:t}function Ka(e,t,n){var r=-1,a=Rn,o=e.length,s=!0,c=[],l=c;if(n)s=!1,a=zn;else if(o>=i){var u=t?null:Vo(e);if(u)return Cr(u);s=!1,a=lr,l=new ui}else l=t?[]:c;outer:for(;++r<o;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,s&&f===f){for(var p=l.length;p--;)if(l[p]===f)continue outer;t&&l.push(f),c.push(d)}else a(l,f,n)||(l!==c&&l.push(f),c.push(d))}return c}function qa(e,t){t=to(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Bs(t[n]);if(i===`__proto__`&&!A.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=As(e,t);return a==null||delete a[Bs(mc(t))]}function Ja(e,t,n,r){return Fa(e,t,n(Ji(e,t)),r)}function Ya(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?za(e,r?0:a,r?a+1:i):za(e,r?a+1:0,r?i:a)}function Xa(e,t){var n=e;return n instanceof z&&(n=n.value()),Vn(t,function(e,t){return t.func.apply(t.thisArg,Bn([e],t.args))},n)}function Za(e,t,n){var r=e.length;if(r<2)return r?Ka(e[0]):[];for(var i=-1,a=D(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=Ii(a[i]||o,e[s],t,n));return Ka(B(a,1),t,n)}function Qa(e,t,r){for(var i=-1,a=e.length,o=t.length,s={};++i<a;){var c=i<o?t[i]:n;r(s,e[i],c)}return s}function $a(e){return q(e)?e:[]}function eo(e){return typeof e==`function`?e:$}function to(e,t){return K(e)?e:_s(e,t)?[e]:zs(Z(e))}var no=H;function ro(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:za(e,t,r)}var io=en||function(e){return F.clearTimeout(e)};function ao(e,t){if(t)return e.slice();var n=e.length,r=Gt?Gt(n):new e.constructor(n);return e.copy(r),r}function oo(e){var t=new e.constructor(e.byteLength);return new Wt(t).set(new Wt(e)),t}function so(e,t){var n=t?oo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function co(e){var t=new e.constructor(e.source,_t.exec(e));return t.lastIndex=e.lastIndex,t}function lo(e){return Rr?O(Rr.call(e)):{}}function uo(e,t){var n=t?oo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function fo(e,t){if(e!==t){var r=e!==n,i=e===null,a=e===e,o=Wu(e),s=t!==n,c=t===null,l=t===t,u=Wu(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function po(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=fo(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function mo(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=j(a-o,0),u=D(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function ho(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=j(a-s,0),d=D(u+l),f=!r;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++o<s;)(f||i<a)&&(d[p+n[o]]=e[i++]);return d}function go(e,t){var n=-1,r=e.length;for(t||=D(r);++n<r;)t[n]=e[n];return t}function _o(e,t,r,i){var a=!r;r||={};for(var o=-1,s=t.length;++o<s;){var c=t[o],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?ki(r,c,l):wi(r,c,l)}return r}function vo(e,t){return _o(e,os(e),t)}function yo(e,t){return _o(e,ss(e),t)}function bo(e,t){return function(n,r){var i=K(n)?Nn:Ei,a=t?t():{};return i(n,e,U(r,2),a)}}function xo(e){return H(function(t,r){var i=-1,a=r.length,o=a>1?r[a-1]:n,s=a>2?r[2]:n;for(o=e.length>3&&typeof o==`function`?(a--,o):n,s&&G(r[0],r[1],s)&&(o=a<3?n:o,a=1),t=O(t);++i<a;){var c=r[i];c&&e(t,c,i,o)}return t})}function So(e,t){return function(n,r){if(n==null)return n;if(!vu(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=O(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}function Co(e){return function(t,n,r){for(var i=-1,a=O(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function wo(e,t,n){var r=t&_,i=Do(e);function a(){return(this&&this!==F&&this instanceof a?i:e).apply(r?n:this,arguments)}return a}function To(e){return function(t){t=Z(t);var r=_r(t)?Or(t):n,i=r?r[0]:t.charAt(0),a=r?ro(r,1).join(``):t.slice(1);return i[e]()+a}}function Eo(e){return function(t){return Vn(wf(Xd(t).replace(cn,``)),e,``)}}function Do(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=Br(e.prototype),r=e.apply(n,t);return J(r)?r:n}}function Oo(e,t,r){var i=Do(e);function a(){for(var o=arguments.length,s=D(o),c=o,l=ts(a);c--;)s[c]=arguments[c];var u=o<3&&s[0]!==l&&s[o-1]!==l?[]:Sr(s,l);return o-=u.length,o<r?zo(e,t,jo,a.placeholder,n,s,u,n,n,r-o):Mn(this&&this!==F&&this instanceof a?i:e,this,s)}return a}function ko(e){return function(t,r,i){var a=O(t);if(!vu(t)){var o=U(r,3);t=Q(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,i);return s>-1?a[o?t[s]:s]:n}}function Ao(e){return Xo(function(t){var r=t.length,i=r,a=Hr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if(typeof s!=`function`)throw new k(o);if(a&&!c&&es(s)==`wrapper`)var c=new Hr([],!0)}for(i=c?i:r;++i<r;){s=t[i];var l=es(s),u=l==`wrapper`?$o(s):n;c=u&&ys(u[0])&&u[1]==(ee|b|S|te)&&!u[4].length&&u[9]==1?c[es(u[0])].apply(c,u[3]):s.length==1&&ys(s)?c[l]():c.thru(s)}return function(){var e=arguments,n=e[0];if(c&&e.length==1&&K(n))return c.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}})}function jo(e,t,r,i,a,o,s,c,l,u){var d=t&ee,f=t&_,p=t&v,m=t&(b|x),h=t&ne,g=p?n:Do(e);function y(){for(var n=arguments.length,_=D(n),v=n;v--;)_[v]=arguments[v];if(m)var b=ts(y),x=fr(_,b);if(i&&(_=mo(_,i,a,m)),o&&(_=ho(_,o,s,m)),n-=x,m&&n<u){var S=Sr(_,b);return zo(e,t,jo,y.placeholder,r,_,S,c,l,u-n)}var C=f?r:this,ee=p?C[e]:e;return n=_.length,c?_=js(_,c):h&&n>1&&_.reverse(),d&&l<n&&(_.length=l),this&&this!==F&&this instanceof y&&(ee=g||Do(ee)),ee.apply(C,_)}return y}function Mo(e,t){return function(n,r){return ta(n,e,t(r),{})}}function No(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;typeof r==`string`||typeof i==`string`?(r=Ga(r),i=Ga(i)):(r=Wa(r),i=Wa(i)),a=e(r,i)}return a}}function Po(e){return Xo(function(t){return t=L(t,sr(U())),H(function(n){var r=this;return e(t,function(e){return Mn(e,r,n)})})})}function Fo(e,t){t=t===n?` `:Ga(t);var r=t.length;if(r<2)return r?Ma(t,e):t;var i=Ma(t,rn(e/Dr(t)));return _r(t)?ro(Or(i),0,e).join(``):i.slice(0,e)}function Io(e,t,n,r){var i=t&_,a=Do(e);function o(){for(var t=-1,s=arguments.length,c=-1,l=r.length,u=D(l+s),d=this&&this!==F&&this instanceof o?a:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++t];return Mn(d,i?n:this,u)}return o}function Lo(e){return function(t,r,i){return i&&typeof i!=`number`&&G(t,r,i)&&(r=i=n),t=Qu(t),r===n?(r=t,t=0):r=Qu(r),i=i===n?t<r?1:-1:Qu(i),ja(t,r,i,e)}}function Ro(e){return function(t,n){return typeof t==`string`&&typeof n==`string`||(t=ed(t),n=ed(n)),e(t,n)}}function zo(e,t,r,i,a,o,s,c,l,u){var d=t&b,f=d?s:n,p=d?n:s,m=d?o:n,h=d?n:o;t|=d?S:C,t&=~(d?C:S),t&y||(t&=~(_|v));var g=[e,t,a,m,f,h,p,c,l,u],x=r.apply(n,g);return ys(e)&&Ns(x,g),x.placeholder=i,Is(x,e,t)}function Bo(e){var t=Ot[e];return function(e,n){if(e=ed(e),n=n==null?0:P(X(n),292),n&&un(e)){var r=(Z(e)+`e`).split(`e`);return r=(Z(t(r[0]+`e`+(+r[1]+n)))+`e`).split(`e`),+(r[0]+`e`+(+r[1]-n))}return t(e)}}var Vo=Tn&&1/Cr(new Tn([,-0]))[1]==w?function(e){return new Tn(e)}:Bf;function Ho(e){return function(t){var n=W(t);return n==T?br(t):n==E?wr(t):ar(t,e(t))}}function Uo(e,t,r,i,a,s,c,l){var u=t&v;if(!u&&typeof e!=`function`)throw new k(o);var d=i?i.length:0;if(d||(t&=~(S|C),i=a=n),c=c===n?c:j(X(c),0),l=l===n?l:X(l),d-=a?a.length:0,t&C){var f=i,p=a;i=a=n}var m=u?n:$o(e),h=[e,t,r,i,a,f,p,s,c,l];if(m&&Es(h,m),e=h[0],t=h[1],r=h[2],i=h[3],a=h[4],l=h[9]=h[9]===n?u?0:e.length:j(h[9]-d,0),!l&&t&(b|x)&&(t&=~(b|x)),!t||t==_)var g=wo(e,t,r);else g=t==b||t==x?Oo(e,t,l):(t==S||t==(_|S))&&!a.length?Io(e,t,r,i):jo.apply(n,h);return Is((m?Ia:Ns)(g,h),e,t)}function Wo(e,t,r,i){return e===n||pu(e,Nt[r])&&!A.call(i,r)?t:e}function Go(e,t,r,i,a,o){return J(e)&&J(t)&&(o.set(t,e),xa(e,t,n,Go,o),o.delete(t)),e}function Ko(e){return zu(e)?n:e}function qo(e,t,r,i,a,o){var s=r&h,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,m=r&g?new ui:n;for(o.set(e,t),o.set(t,e);++f<c;){var _=e[f],v=t[f];if(i)var y=s?i(v,_,f,t,e,o):i(_,v,f,e,t,o);if(y!==n){if(y)continue;p=!1;break}if(m){if(!Un(t,function(e,t){if(!lr(m,t)&&(_===e||a(_,e,r,i,o)))return m.push(t)})){p=!1;break}}else if(!(_===v||a(_,v,r,i,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function Jo(e,t,n,r,i,a,o){switch(n){case Re:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Le:return!(e.byteLength!=t.byteLength||!a(new Wt(e),new Wt(t)));case be:case xe:case Ee:return pu(+e,+t);case Ce:return e.name==t.name&&e.message==t.message;case je:case Me:return e==t+``;case T:var s=br;case E:var c=r&h;if(s||=Cr,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=g,o.set(e,t);var u=qo(s(e),s(t),r,i,a,o);return o.delete(e),u;case Ne:if(Rr)return Rr.call(e)==Rr.call(t)}return!1}function Yo(e,t,r,i,a,o){var s=r&h,c=Zo(e),l=c.length;if(l!=Zo(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:A.call(t,d)))return!1}var f=o.get(e),p=o.get(t);if(f&&p)return f==t&&p==e;var m=!0;o.set(e,t),o.set(t,e);for(var g=s;++u<l;){d=c[u];var _=e[d],v=t[d];if(i)var y=s?i(v,_,d,t,e,o):i(_,v,d,e,t,o);if(!(y===n?_===v||a(_,v,r,i,o):y)){m=!1;break}g||=d==`constructor`}if(m&&!g){var b=e.constructor,x=t.constructor;b!=x&&`constructor`in e&&`constructor`in t&&!(typeof b==`function`&&b instanceof b&&typeof x==`function`&&x instanceof x)&&(m=!1)}return o.delete(e),o.delete(t),m}function Xo(e){return Fs(ks(e,n,rc),e+``)}function Zo(e){return Yi(e,Q,os)}function Qo(e){return Yi(e,Td,ss)}var $o=Gn?function(e){return Gn.get(e)}:Bf;function es(e){for(var t=e.name+``,n=er[t],r=A.call(er,t)?n.length:0;r--;){var i=n[r],a=i.func;if(a==null||a==e)return i.name}return t}function ts(e){return(A.call(R,`placeholder`)?R:e).placeholder}function U(){var e=R.iteratee||Nf;return e=e===Nf?ma:e,arguments.length?e(arguments[0],arguments[1]):e}function ns(e,t){var n=e.__data__;return vs(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function rs(e){for(var t=Q(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Cs(i)]}return t}function is(e,t){var r=gr(e,t);return ua(r)?r:n}function as(e){var t=A.call(e,Qt),r=e[Qt];try{e[Qt]=n;var i=!0}catch{}var a=Rt.call(e);return i&&(t?e[Qt]=r:delete e[Qt]),a}var os=on?function(e){return e==null?[]:(e=O(e),Ln(on(e),function(t){return Jt.call(e,t)}))}:Yf,ss=on?function(e){for(var t=[];e;)Bn(t,os(e)),e=Kt(e);return t}:Yf,W=V;(xn&&W(new xn(new ArrayBuffer(1)))!=Re||Sn&&W(new Sn)!=T||Cn&&W(Cn.resolve())!=ke||Tn&&W(new Tn)!=E||I&&W(new I)!=Fe)&&(W=function(e){var t=V(e),r=t==Oe?e.constructor:n,i=r?Vs(r):``;if(i)switch(i){case Tr:return Re;case jr:return T;case Mr:return ke;case Fr:return E;case Ir:return Fe}return t});function cs(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],o=a.size;switch(a.type){case`drop`:e+=o;break;case`dropRight`:t-=o;break;case`take`:t=P(t,e+o);break;case`takeRight`:e=j(e,t-o);break}}return{start:e,end:t}}function ls(e){var t=e.match(dt);return t?t[1].split(ft):[]}function us(e,t,n){t=to(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Bs(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Au(i)&&gs(o,i)&&(K(e)||gu(e)))}function ds(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&A.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function fs(e){return typeof e.constructor==`function`&&!Ss(e)?Br(Kt(e)):{}}function ps(e,t,n){var r=e.constructor;switch(t){case Le:return oo(e);case be:case xe:return new r(+e);case Re:return so(e,n);case ze:case Be:case Ve:case He:case Ue:case We:case Ge:case Ke:case qe:return uo(e,n);case T:return new r;case Ee:case Me:return new r(e);case je:return co(e);case E:return new r;case Ne:return lo(e)}}function ms(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(ut,`{
|
|
2
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./get-front-component-build-plugins-DBupR4cF.js"),t=require("./login-D7nyXinY.js"),n=require("./isDefined-Dtu5EYqP-Dp026Ry1.js");let r=require("path");r=e.i(r);let i=require("node:fs/promises"),a=require("uuid"),o=require("react");o=e.i(o);let s=require("node:path");s=e.i(s);let c=require("crypto");c=e.i(c);let l=require("node:child_process"),u=require("chalk");u=e.i(u);let d=require("inquirer");d=e.i(d);let f=require("chokidar");f=e.i(f);let p=require("react/jsx-runtime"),m=require("commander"),h=require("util");var g=e=>e&&!e?.startsWith(`/`)?(0,r.join)(t.vt,e):e,_=async e=>{let n=(0,r.join)(e,`package.json`);if(await t.at(n))try{let e=await(0,i.readFile)(n,`utf-8`),t=JSON.parse(e);return t.dependencies?.[`twenty-sdk`]??t.devDependencies?.[`twenty-sdk`]??void 0}catch{return}},v=e=>{let t=e.match(/(\d+)\./);if(t)return parseInt(t[1],10);let n=e.match(/^[~^>=<]*(\d+)$/);return n?parseInt(n[1],10):null},y=async e=>{let n=t.P.version,r=await _(e);if(!n||!r)return;let i=v(n),a=v(r);i===null||a===null||i!==a&&(console.warn(u.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${a}.x but the CLI running is v${n}. Major version mismatches may cause unexpected behavior.\n Update with: npm install -g twenty-sdk@${a}`)),console.warn(``))},b=class{async execute(e){e.private?await this.executePrivate(e):await this.executeNpm(e)}async executeNpm(e){let n=e.appPath??t.vt;await y(n),console.log(u.default.blue(`Publishing to npm...`)),console.log(u.default.gray(`App path: ${n}\n`));let r=await t.F({appPath:n,npmTag:e.tag,onProgress:e=>console.log(u.default.gray(e))});r.success||(console.error(u.default.red(r.error.message)),process.exit(1)),console.log(u.default.green(`✓ Published to npm successfully`))}async executePrivate(e){let n=e.appPath??t.vt;await y(n);let i=e.remote??t.V.getActiveRemote();console.log(u.default.blue(`Deploying application on ${i}...`)),console.log(u.default.gray(`App path: ${n}\n`));let a=e=>console.log(u.default.gray(e)),o=await t.U({appPath:n,tarball:!0,onProgress:a});o.success||(console.error(u.default.red(o.error.message)),process.exit(1));let s=await t.I({tarballPath:o.data.tarballPath,remote:e.remote,onProgress:a});s.success||(console.error(u.default.red(s.error.message)),process.exit(1));let c=await t.ot(r.default.join(n,`package.json`)).catch(()=>void 0),l=c?.name??s.data.name,d=c?.version??`unknown`;console.log(u.default.green(`\n✓ Published ${l} v${d} to ${i}\n`)),console.log(" To install deployed application: `yarn twenty app:install`")}},x=class{async execute(e){let n=e.appPath??t.vt;await y(n),await t._();let r=e.remote??t.V.getActiveRemote();console.log(u.default.blue(`Installing application on ${r}...`)),console.log(u.default.gray(`App path: ${n}\n`));let i=await t.j({appPath:n,remote:e.remote});i.success||(console.error(u.default.red(i.error.message)),process.exit(1)),console.log(u.default.green(`✓ Application installed`))}},S=class{async execute({appPath:e=t.vt,askForConfirmation:n}){let r=t.V.getActiveRemote();console.log(u.default.blue(`🚀 Uninstall Twenty Application on ${r}`)),console.log(u.default.gray(`📁 App Path: ${e}\n`)),n&&!await this.confirmationPrompt()&&(console.error(u.default.red(`⛔️ Aborting uninstall`)),process.exit(1));let i=await t.g({appPath:e});return i.success?(console.log(u.default.green(`✅ Application uninstalled successfully`)),{success:!0,data:void 0}):(console.error(u.default.red(`❌ Uninstall failed:`),i.error.message),{success:!1,error:i.error.message})}async confirmationPrompt(){let{confirmation:e}=await d.default.prompt([{type:`confirm`,name:`confirmation`,message:`Are you sure you want to uninstall this application?`,default:!1}]);return e}},ee=e=>{let t=new b,n=new x,r=new S;e.command(`app:publish [appPath]`).description(`Build and publish to npm (default) or server registry`).option(`--private`,`Push to a Twenty server's registry instead of npm`).option(`-r, --remote <name>`,`Publish to a specific remote (with --private)`).option(`--tag <tag>`,`npm dist-tag (e.g. beta, next)`).action(async(e,n)=>{await t.execute({appPath:g(e),private:n.private,remote:n.remote,tag:n.tag})}),e.command(`app:install [appPath]`).description(`Install a deployed app on the server`).option(`-r, --remote <name>`,`Install on a specific remote`).action(async(e,t)=>{await n.execute({appPath:g(e),remote:t.remote})}),e.command(`app:uninstall [appPath]`).description(`Uninstall app from server`).option(`-y, --yes`,`Skip confirmation prompt`).action(async(e,t)=>{try{let n=await r.execute({appPath:g(e),askForConfirmation:!t?.yes});process.exit(+!n.success)}catch{process.exit(1)}})},te=e.n(((e,t)=>{(function(){var n,r=`4.18.1`,i=200,a=`Unsupported core-js use. Try https://npms.io/search?q=ponyfill.`,o=`Expected a function`,s="Invalid `variable` option passed into `_.template`",c="Invalid `imports` option passed into `_.template`",l=`__lodash_hash_undefined__`,u=500,d=`__lodash_placeholder__`,f=1,p=2,m=4,h=1,g=2,_=1,v=2,y=4,b=8,x=16,S=32,ee=64,te=128,ne=256,re=512,ie=30,ae=`...`,oe=800,se=16,ce=1,le=2,ue=3,C=1/0,de=9007199254740991,fe=17976931348623157e292,pe=NaN,me=4294967295,he=me-1,ge=me>>>1,_e=[[`ary`,te],[`bind`,_],[`bindKey`,v],[`curry`,b],[`curryRight`,x],[`flip`,re],[`partial`,S],[`partialRight`,ee],[`rearg`,ne]],ve=`[object Arguments]`,ye=`[object Array]`,be=`[object AsyncFunction]`,xe=`[object Boolean]`,Se=`[object Date]`,Ce=`[object DOMException]`,we=`[object Error]`,Te=`[object Function]`,Ee=`[object GeneratorFunction]`,w=`[object Map]`,De=`[object Number]`,Oe=`[object Null]`,ke=`[object Object]`,Ae=`[object Promise]`,je=`[object Proxy]`,Me=`[object RegExp]`,T=`[object Set]`,Ne=`[object String]`,Pe=`[object Symbol]`,Fe=`[object Undefined]`,Ie=`[object WeakMap]`,Le=`[object WeakSet]`,Re=`[object ArrayBuffer]`,ze=`[object DataView]`,Be=`[object Float32Array]`,Ve=`[object Float64Array]`,He=`[object Int8Array]`,Ue=`[object Int16Array]`,We=`[object Int32Array]`,Ge=`[object Uint8Array]`,Ke=`[object Uint8ClampedArray]`,qe=`[object Uint16Array]`,Je=`[object Uint32Array]`,Ye=/\b__p \+= '';/g,Xe=/\b(__p \+=) '' \+/g,Ze=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Qe=/&(?:amp|lt|gt|quot|#39);/g,$e=/[&<>"']/g,et=RegExp(Qe.source),tt=RegExp($e.source),nt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,it=/<%=([\s\S]+?)%>/g,at=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ot=/^\w*$/,st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ct=/[\\^$.*+?()[\]{}|]/g,lt=RegExp(ct.source),ut=/^\s+/,E=/\s/,dt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ft=/\{\n\/\* \[wrapped with (.+)\] \*/,pt=/,? & /,mt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,gt=/\\(\\)?/g,_t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,yt=/^[-+]0x[0-9a-f]+$/i,bt=/^0b[01]+$/i,xt=/^\[object .+?Constructor\]$/,St=/^0o[0-7]+$/i,Ct=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt=/($^)/,Et=/['\n\r\u2028\u2029\\]/g,Dt=`\\ud800-\\udfff`,Ot=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,kt=`\\u2700-\\u27bf`,D=`a-z\\xdf-\\xf6\\xf8-\\xff`,At=`\\xac\\xb1\\xd7\\xf7`,jt=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,O=`\\u2000-\\u206f`,Mt=` \\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`,Nt=`A-Z\\xc0-\\xd6\\xd8-\\xde`,Pt=`\\ufe0e\\ufe0f`,Ft=At+jt+O+Mt,It=`['’]`,k=`[`+Dt+`]`,Lt=`[`+Ft+`]`,Rt=`[`+Ot+`]`,zt=`\\d+`,Bt=`[`+kt+`]`,Vt=`[`+D+`]`,Ht=`[^`+Dt+Ft+zt+kt+D+Nt+`]`,Ut=`\\ud83c[\\udffb-\\udfff]`,Wt=`(?:`+Rt+`|`+Ut+`)`,Gt=`[^`+Dt+`]`,Kt=`(?:\\ud83c[\\udde6-\\uddff]){2}`,qt=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Jt=`[`+Nt+`]`,Yt=`\\u200d`,Xt=`(?:`+Vt+`|`+Ht+`)`,Zt=`(?:`+Jt+`|`+Ht+`)`,Qt=`(?:`+It+`(?:d|ll|m|re|s|t|ve))?`,$t=`(?:`+It+`(?:D|LL|M|RE|S|T|VE))?`,en=Wt+`?`,tn=`[`+Pt+`]?`,nn=`(?:`+Yt+`(?:`+[Gt,Kt,qt].join(`|`)+`)`+tn+en+`)*`,rn=`\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])`,an=`\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])`,on=tn+en+nn,sn=`(?:`+[Bt,Kt,qt].join(`|`)+`)`+on,cn=`(?:`+[Gt+Rt+`?`,Rt,Kt,qt,k].join(`|`)+`)`,ln=RegExp(It,`g`),un=RegExp(Rt,`g`),dn=RegExp(Ut+`(?=`+Ut+`)|`+cn+on,`g`),fn=RegExp([Jt+`?`+Vt+`+`+Qt+`(?=`+[Lt,Jt,`$`].join(`|`)+`)`,Zt+`+`+$t+`(?=`+[Lt,Jt+Xt,`$`].join(`|`)+`)`,Jt+`?`+Xt+`+`+Qt,Jt+`+`+$t,an,rn,zt,sn].join(`|`),`g`),pn=RegExp(`[`+Yt+Dt+Ot+Pt+`]`),A=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,mn=`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`.split(`.`),hn=-1,j={};j[Be]=j[Ve]=j[He]=j[Ue]=j[We]=j[Ge]=j[Ke]=j[qe]=j[Je]=!0,j[ve]=j[ye]=j[Re]=j[xe]=j[ze]=j[Se]=j[we]=j[Te]=j[w]=j[De]=j[ke]=j[Me]=j[T]=j[Ne]=j[Ie]=!1;var M={};M[ve]=M[ye]=M[Re]=M[ze]=M[xe]=M[Se]=M[Be]=M[Ve]=M[He]=M[Ue]=M[We]=M[w]=M[De]=M[ke]=M[Me]=M[T]=M[Ne]=M[Pe]=M[Ge]=M[Ke]=M[qe]=M[Je]=!0,M[we]=M[Te]=M[Ie]=!1;var N={À:`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`},gn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},_n={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`},vn={"\\":`\\`,"'":`'`,"\n":`n`,"\r":`r`,"\u2028":`u2028`,"\u2029":`u2029`},yn=parseFloat,bn=parseInt,xn=typeof global==`object`&&global&&global.Object===Object&&global,Sn=typeof self==`object`&&self&&self.Object===Object&&self,P=xn||Sn||Function(`return this`)(),Cn=typeof e==`object`&&e&&!e.nodeType&&e,wn=Cn&&typeof t==`object`&&t&&!t.nodeType&&t,Tn=wn&&wn.exports===Cn,En=Tn&&xn.process,F=function(){try{return wn&&wn.require&&wn.require(`util`).types||En&&En.binding&&En.binding(`util`)}catch{}}(),Dn=F&&F.isArrayBuffer,On=F&&F.isDate,kn=F&&F.isMap,An=F&&F.isRegExp,jn=F&&F.isSet,Mn=F&&F.isTypedArray;function Nn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pn(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function Fn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function In(e,t){for(var n=e==null?0:e.length;n--&&t(e[n],n,e)!==!1;);return e}function Ln(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Rn(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function zn(e,t){return!!(e!=null&&e.length)&&Xn(e,t,0)>-1}function Bn(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function I(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Vn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Hn(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Un(e,t,n,r){var i=e==null?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Wn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Gn=er(`length`);function Kn(e){return e.split(``)}function qn(e){return e.match(mt)||[]}function Jn(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Yn(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Xn(e,t,n){return t===t?Er(e,t,n):Yn(e,Qn,n)}function Zn(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Qn(e){return e!==e}function $n(e,t){var n=e==null?0:e.length;return n?ir(e,t)/n:pe}function er(e){return function(t){return t==null?n:t[e]}}function tr(e){return function(t){return e==null?n:e[t]}}function nr(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function rr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function ir(e,t){for(var r,i=-1,a=e.length;++i<a;){var o=t(e[i]);o!==n&&(r=r===n?o:r+o)}return r}function ar(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function or(e,t){return I(t,function(t){return[t,e[t]]})}function sr(e){return e&&e.slice(0,Ar(e)+1).replace(ut,``)}function cr(e){return function(t){return e(t)}}function lr(e,t){return I(t,function(t){return e[t]})}function ur(e,t){return e.has(t)}function dr(e,t){for(var n=-1,r=e.length;++n<r&&Xn(t,e[n],0)>-1;);return n}function fr(e,t){for(var n=e.length;n--&&Xn(t,e[n],0)>-1;);return n}function pr(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var mr=tr(N),hr=tr(gn);function gr(e){return`\\`+vn[e]}function _r(e,t){return e==null?n:e[t]}function vr(e){return pn.test(e)}function yr(e){return A.test(e)}function br(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function xr(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Sr(e,t){return function(n){return e(t(n))}}function Cr(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n];(o===t||o===d)&&(e[n]=d,a[i++]=n)}return a}function wr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Tr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Er(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Dr(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}function Or(e){return vr(e)?Mr(e):Gn(e)}function kr(e){return vr(e)?Nr(e):Kn(e)}function Ar(e){for(var t=e.length;t--&&E.test(e.charAt(t)););return t}var jr=tr(_n);function Mr(e){for(var t=dn.lastIndex=0;dn.test(e);)++t;return t}function Nr(e){return e.match(dn)||[]}function Pr(e){return e.match(fn)||[]}var Fr=(function e(t){t=t==null?P:Fr.defaults(P.Object(),t,Fr.pick(P,mn));var E=t.Array,mt=t.Date,Dt=t.Error,Ot=t.Function,kt=t.Math,D=t.Object,At=t.RegExp,jt=t.String,O=t.TypeError,Mt=E.prototype,Nt=Ot.prototype,Pt=D.prototype,Ft=t[`__core-js_shared__`],It=Nt.toString,k=Pt.hasOwnProperty,Lt=0,Rt=function(){var e=/[^.]+$/.exec(Ft&&Ft.keys&&Ft.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),zt=Pt.toString,Bt=It.call(D),Vt=P._,Ht=At(`^`+It.call(k).replace(ct,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ut=Tn?t.Buffer:n,Wt=t.Symbol,Gt=t.Uint8Array,Kt=Ut?Ut.allocUnsafe:n,qt=Sr(D.getPrototypeOf,D),Jt=D.create,Yt=Pt.propertyIsEnumerable,Xt=Mt.splice,Zt=Wt?Wt.isConcatSpreadable:n,Qt=Wt?Wt.iterator:n,$t=Wt?Wt.toStringTag:n,en=function(){try{var e=is(D,`defineProperty`);return e({},``,{}),e}catch{}}(),tn=t.clearTimeout!==P.clearTimeout&&t.clearTimeout,nn=mt&&mt.now!==P.Date.now&&mt.now,rn=t.setTimeout!==P.setTimeout&&t.setTimeout,an=kt.ceil,on=kt.floor,sn=D.getOwnPropertySymbols,cn=Ut?Ut.isBuffer:n,dn=t.isFinite,fn=Mt.join,pn=Sr(D.keys,D),A=kt.max,N=kt.min,gn=mt.now,_n=t.parseInt,vn=kt.random,xn=Mt.reverse,Sn=is(t,`DataView`),Cn=is(t,`Map`),wn=is(t,`Promise`),En=is(t,`Set`),F=is(t,`WeakMap`),Gn=is(D,`create`),Kn=F&&new F,tr={},Er=Vs(Sn),Mr=Vs(Cn),Nr=Vs(wn),Ir=Vs(En),Lr=Vs(F),Rr=Wt?Wt.prototype:n,zr=Rr?Rr.valueOf:n,Br=Rr?Rr.toString:n;function L(e){if(Y(e)&&!K(e)&&!(e instanceof R)){if(e instanceof Ur)return e;if(k.call(e,`__wrapped__`))return Us(e)}return new Ur(e)}var Vr=function(){function e(){}return function(t){if(!J(t))return{};if(Jt)return Jt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Hr(){}function Ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}L.templateSettings={escape:nt,evaluate:rt,interpolate:it,variable:``,imports:{_:L}},L.prototype=Hr.prototype,L.prototype.constructor=L,Ur.prototype=Vr(Hr.prototype),Ur.prototype.constructor=Ur;function R(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=me,this.__views__=[]}function Wr(){var e=new R(this.__wrapped__);return e.__actions__=H(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=H(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=H(this.__views__),e}function Gr(){if(this.__filtered__){var e=new R(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Kr(){var e=this.__wrapped__.value(),t=this.__dir__,n=K(e),r=t<0,i=n?e.length:0,a=cs(0,i,this.__views__),o=a.start,s=a.end,c=s-o,l=r?s:o-1,u=this.__iteratees__,d=u.length,f=0,p=N(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return Za(e,this.__actions__);var m=[];outer:for(;c--&&f<p;){l+=t;for(var h=-1,g=e[l];++h<d;){var _=u[h],v=_.iteratee,y=_.type,b=v(g);if(y==le)g=b;else if(!b){if(y==ce)continue outer;break outer}}m[f++]=g}return m}R.prototype=Vr(Hr.prototype),R.prototype.constructor=R;function qr(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 Jr(){this.__data__=Gn?Gn(null):{},this.size=0}function Yr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Xr(e){var t=this.__data__;if(Gn){var r=t[e];return r===l?n:r}return k.call(t,e)?t[e]:n}function Zr(e){var t=this.__data__;return Gn?t[e]!==n:k.call(t,e)}function Qr(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Gn&&t===n?l:t,this}qr.prototype.clear=Jr,qr.prototype.delete=Yr,qr.prototype.get=Xr,qr.prototype.has=Zr,qr.prototype.set=Qr;function $r(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 ei(){this.__data__=[],this.size=0}function ti(e){var t=this.__data__,n=Ei(t,e);return n<0?!1:(n==t.length-1?t.pop():Xt.call(t,n,1),--this.size,!0)}function ni(e){var t=this.__data__,r=Ei(t,e);return r<0?n:t[r][1]}function ri(e){return Ei(this.__data__,e)>-1}function ii(e,t){var n=this.__data__,r=Ei(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}$r.prototype.clear=ei,$r.prototype.delete=ti,$r.prototype.get=ni,$r.prototype.has=ri,$r.prototype.set=ii;function ai(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 oi(){this.size=0,this.__data__={hash:new qr,map:new(Cn||$r),string:new qr}}function si(e){var t=ns(this,e).delete(e);return this.size-=+!!t,t}function ci(e){return ns(this,e).get(e)}function li(e){return ns(this,e).has(e)}function ui(e,t){var n=ns(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}ai.prototype.clear=oi,ai.prototype.delete=si,ai.prototype.get=ci,ai.prototype.has=li,ai.prototype.set=ui;function di(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new ai;++t<n;)this.add(e[t])}function fi(e){return this.__data__.set(e,l),this}function pi(e){return this.__data__.has(e)}di.prototype.add=di.prototype.push=fi,di.prototype.has=pi;function mi(e){var t=this.__data__=new $r(e);this.size=t.size}function hi(){this.__data__=new $r,this.size=0}function gi(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function _i(e){return this.__data__.get(e)}function vi(e){return this.__data__.has(e)}function yi(e,t){var n=this.__data__;if(n instanceof $r){var r=n.__data__;if(!Cn||r.length<i-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ai(r)}return n.set(e,t),this.size=n.size,this}mi.prototype.clear=hi,mi.prototype.delete=gi,mi.prototype.get=_i,mi.prototype.has=vi,mi.prototype.set=yi;function bi(e,t){var n=K(e),r=!n&&gu(e),i=!n&&!r&&bu(e),a=!n&&!r&&!i&&Gu(e),o=n||r||i||a,s=o?ar(e.length,jt):[],c=s.length;for(var l in e)(t||k.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||gs(l,c)))&&s.push(l);return s}function xi(e){var t=e.length;return t?e[ja(0,t-1)]:n}function Si(e,t){return Rs(H(e),Mi(t,0,e.length))}function Ci(e){return Rs(H(e))}function wi(e,t,r){(r!==n&&!pu(e[t],r)||r===n&&!(t in e))&&Ai(e,t,r)}function Ti(e,t,r){var i=e[t];(!(k.call(e,t)&&pu(i,r))||r===n&&!(t in e))&&Ai(e,t,r)}function Ei(e,t){for(var n=e.length;n--;)if(pu(e[n][0],t))return n;return-1}function Di(e,t,n,r){return Ri(e,function(e,i,a){t(r,e,n(e),a)}),r}function Oi(e,t){return e&&_o(t,Q(t),e)}function ki(e,t){return e&&_o(t,Td(t),e)}function Ai(e,t,n){t==`__proto__`&&en?en(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ji(e,t){for(var r=-1,i=t.length,a=E(i),o=e==null;++r<i;)a[r]=o?n:yd(e,t[r]);return a}function Mi(e,t,r){return e===e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function Ni(e,t,r,i,a,o){var s,c=t&f,l=t&p,u=t&m;if(r&&(s=a?r(e,i,a,o):r(e)),s!==n)return s;if(!J(e))return e;var d=K(e);if(d){if(s=ds(e),!c)return H(e,s)}else{var h=W(e),g=h==Te||h==Ee;if(bu(e))return oo(e,c);if(h==ke||h==ve||g&&!a){if(s=l||g?{}:fs(e),!c)return l?yo(e,ki(s,e)):vo(e,Oi(s,e))}else{if(!M[h])return a?e:{};s=ps(e,h,c)}}o||=new mi;var _=o.get(e);if(_)return _;o.set(e,s),Hu(e)?e.forEach(function(n){s.add(Ni(n,t,r,n,e,o))}):ju(e)&&e.forEach(function(n,i){s.set(i,Ni(n,t,r,i,e,o))});var v=d?n:(u?l?Qo:Zo:l?Td:Q)(e);return Fn(v||e,function(n,i){v&&(i=n,n=e[i]),Ti(s,i,Ni(n,t,r,i,e,o))}),s}function Pi(e){var t=Q(e);return function(n){return Fi(n,e,t)}}function Fi(e,t,r){var i=r.length;if(e==null)return!i;for(e=D(e);i--;){var a=r[i],o=t[a],s=e[a];if(s===n&&!(a in e)||!o(s))return!1}return!0}function Ii(e,t,r){if(typeof e!=`function`)throw new O(o);return Ps(function(){e.apply(n,r)},t)}function Li(e,t,n,r){var a=-1,o=zn,s=!0,c=e.length,l=[],u=t.length;if(!c)return l;n&&(t=I(t,cr(n))),r?(o=Bn,s=!1):t.length>=i&&(o=ur,s=!1,t=new di(t));outer:for(;++a<c;){var d=e[a],f=n==null?d:n(d);if(d=r||d!==0?d:0,s&&f===f){for(var p=u;p--;)if(t[p]===f)continue outer;l.push(d)}else o(t,f,r)||l.push(d)}return l}var Ri=So(Ki),zi=So(qi,!0);function Bi(e,t){var n=!0;return Ri(e,function(e,r,i){return n=!!t(e,r,i),n}),n}function Vi(e,t,r){for(var i=-1,a=e.length;++i<a;){var o=e[i],s=t(o);if(s!=null&&(c===n?s===s&&!Wu(s):r(s,c)))var c=s,l=o}return l}function Hi(e,t,r,i){var a=e.length;for(r=X(r),r<0&&(r=-r>a?0:a+r),i=i===n||i>a?a:X(i),i<0&&(i+=a),i=r>i?0:$u(i);r<i;)e[r++]=t;return e}function Ui(e,t){var n=[];return Ri(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function z(e,t,n,r,i){var a=-1,o=e.length;for(n||=hs,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?z(s,t-1,n,r,i):Vn(i,s):r||(i[i.length]=s)}return i}var Wi=Co(),Gi=Co(!0);function Ki(e,t){return e&&Wi(e,t,Q)}function qi(e,t){return e&&Gi(e,t,Q)}function Ji(e,t){return Rn(t,function(t){return Ou(e[t])})}function Yi(e,t){t=no(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[Bs(t[r++])];return r&&r==i?e:n}function Xi(e,t,n){var r=t(e);return K(e)?r:Vn(r,n(e))}function B(e){return e==null?e===n?Fe:Oe:$t&&$t in D(e)?as(e):Os(e)}function Zi(e,t){return e>t}function Qi(e,t){return e!=null&&k.call(e,t)}function $i(e,t){return e!=null&&t in D(e)}function ea(e,t,n){return e>=N(t,n)&&e<A(t,n)}function ta(e,t,r){for(var i=r?Bn:zn,a=e[0].length,o=e.length,s=o,c=E(o),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=I(d,cr(t))),l=N(d.length,l),c[s]=!r&&(t||a>=120&&d.length>=120)?new di(s&&d):n}d=e[0];var f=-1,p=c[0];outer:for(;++f<a&&u.length<l;){var m=d[f],h=t?t(m):m;if(m=r||m!==0?m:0,!(p?ur(p,h):i(u,h,r))){for(s=o;--s;){var g=c[s];if(!(g?ur(g,h):i(e[s],h,r)))continue outer}p&&p.push(h),u.push(m)}}return u}function na(e,t,n,r){return Ki(e,function(e,i,a){t(r,n(e),i,a)}),r}function ra(e,t,r){t=no(t,e),e=As(e,t);var i=e==null?e:e[Bs(mc(t))];return i==null?n:Nn(i,e,r)}function ia(e){return Y(e)&&B(e)==ve}function aa(e){return Y(e)&&B(e)==Re}function oa(e){return Y(e)&&B(e)==Se}function sa(e,t,n,r,i){return e===t?!0:e==null||t==null||!Y(e)&&!Y(t)?e!==e&&t!==t:ca(e,t,n,r,sa,i)}function ca(e,t,n,r,i,a){var o=K(e),s=K(t),c=o?ye:W(e),l=s?ye:W(t);c=c==ve?ke:c,l=l==ve?ke:l;var u=c==ke,d=l==ke,f=c==l;if(f&&bu(e)){if(!bu(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new mi,o||Gu(e)?qo(e,t,n,r,i,a):Jo(e,t,c,n,r,i,a);if(!(n&h)){var p=u&&k.call(e,`__wrapped__`),m=d&&k.call(t,`__wrapped__`);if(p||m){var g=p?e.value():e,_=m?t.value():t;return a||=new mi,i(g,_,n,r,a)}}return f?(a||=new mi,Yo(e,t,n,r,i,a)):!1}function la(e){return Y(e)&&W(e)==w}function ua(e,t,r,i){var a=r.length,o=a,s=!i;if(e==null)return!o;for(e=D(e);a--;){var c=r[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<o;){c=r[a];var l=c[0],u=e[l],d=c[1];if(s&&c[2]){if(u===n&&!(l in e))return!1}else{var f=new mi;if(i)var p=i(u,d,l,e,t,f);if(!(p===n?sa(d,u,h|g,i,f):p))return!1}}return!0}function da(e){return!J(e)||bs(e)?!1:(Ou(e)?Ht:xt).test(Vs(e))}function fa(e){return Y(e)&&B(e)==Me}function pa(e){return Y(e)&&W(e)==T}function ma(e){return Y(e)&&Au(e.length)&&!!j[B(e)]}function ha(e){return typeof e==`function`?e:e==null?$:typeof e==`object`?K(e)?xa(e[0],e[1]):ba(e):Gf(e)}function ga(e){if(!Ss(e))return pn(e);var t=[];for(var n in D(e))k.call(e,n)&&n!=`constructor`&&t.push(n);return t}function _a(e){if(!J(e))return Ds(e);var t=Ss(e),n=[];for(var r in e)r==`constructor`&&(t||!k.call(e,r))||n.push(r);return n}function va(e,t){return e<t}function ya(e,t){var n=-1,r=vu(e)?E(e.length):[];return Ri(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function ba(e){var t=rs(e);return t.length==1&&t[0][2]?ws(t[0][0],t[0][1]):function(n){return n===e||ua(n,e,t)}}function xa(e,t){return _s(e)&&Cs(t)?ws(Bs(e),t):function(r){var i=yd(r,e);return i===n&&i===t?xd(r,e):sa(t,i,h|g)}}function Sa(e,t,r,i,a){e!==t&&Wi(t,function(o,s){if(a||=new mi,J(o))Ca(e,t,s,r,Sa,i,a);else{var c=i?i(Ms(e,s),o,s+``,e,t,a):n;c===n&&(c=o),wi(e,s,c)}},Td)}function Ca(e,t,r,i,a,o,s){var c=Ms(e,r),l=Ms(t,r),u=s.get(l);if(u){wi(e,r,u);return}var d=o?o(c,l,r+``,e,t,s):n,f=d===n;if(f){var p=K(l),m=!p&&bu(l),h=!p&&!m&&Gu(l);d=l,p||m||h?K(c)?d=c:q(c)?d=H(c):m?(f=!1,d=oo(l,!0)):h?(f=!1,d=fo(l,!0)):d=[]:zu(l)||gu(l)?(d=c,gu(c)?d=td(c):(!J(c)||Ou(c))&&(d=fs(l))):f=!1}f&&(s.set(l,d),a(d,l,i,o,s),s.delete(l)),wi(e,r,d)}function wa(e,t){var r=e.length;if(r)return t+=t<0?r:0,gs(t,r)?e[t]:n}function Ta(e,t,n){t=t.length?I(t,function(e){return K(e)?function(t){return Yi(t,e.length===1?e[0]:e)}:e}):[$];var r=-1;return t=I(t,cr(U())),rr(ya(e,function(e,n,i){return{criteria:I(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return mo(e,t,n)})}function Ea(e,t){return Da(e,t,function(t,n){return xd(e,n)})}function Da(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Yi(e,o);n(s,o)&&Ia(a,no(o,e),s)}return a}function Oa(e){return function(t){return Yi(t,e)}}function ka(e,t,n,r){var i=r?Zn:Xn,a=-1,o=t.length,s=e;for(e===t&&(t=H(t)),n&&(s=I(e,cr(n)));++a<o;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&Xt.call(s,c,1),Xt.call(e,c,1);return e}function Aa(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;gs(i)?Xt.call(e,i,1):Ja(e,i)}}return e}function ja(e,t){return e+on(vn()*(t-e+1))}function Ma(e,t,n,r){for(var i=-1,a=A(an((t-e)/(n||1)),0),o=E(a);a--;)o[r?a:++i]=e,e+=n;return o}function Na(e,t){var n=``;if(!e||t<1||t>de)return n;do t%2&&(n+=e),t=on(t/2),t&&(e+=e);while(t);return n}function V(e,t){return Fs(ks(e,t,$),e+``)}function Pa(e){return xi(Ud(e))}function Fa(e,t){var n=Ud(e);return Rs(n,Mi(t,0,n.length))}function Ia(e,t,r,i){if(!J(e))return e;t=no(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=Bs(t[a]),u=r;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):n,u===n&&(u=J(d)?d:gs(t[a+1])?[]:{})}Ti(c,l,u),c=c[l]}return e}var La=Kn?function(e,t){return Kn.set(e,t),e}:$,Ra=en?function(e,t){return en(e,`toString`,{configurable:!0,enumerable:!1,value:kf(t),writable:!0})}:$;function za(e){return Rs(Ud(e))}function Ba(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=E(i);++r<i;)a[r]=e[r+t];return a}function Va(e,t){var n;return Ri(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function Ha(e,t,n){var r=0,i=e==null?r:e.length;if(typeof t==`number`&&t===t&&i<=ge){for(;r<i;){var a=r+i>>>1,o=e[a];o!==null&&!Wu(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return Ua(e,t,$,n)}function Ua(e,t,r,i){var a=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var s=t!==t,c=t===null,l=Wu(t),u=t===n;a<o;){var d=on((a+o)/2),f=r(e[d]),p=f!==n,m=f===null,h=f===f,g=Wu(f);if(s)var _=i||h;else _=u?h&&(i||p):c?h&&p&&(i||!m):l?h&&p&&!m&&(i||!g):m||g?!1:i?f<=t:f<t;_?a=d+1:o=d}return N(o,he)}function Wa(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!pu(s,c)){var c=s;a[i++]=o===0?0:o}}return a}function Ga(e){return typeof e==`number`?e:Wu(e)?pe:+e}function Ka(e){if(typeof e==`string`)return e;if(K(e))return I(e,Ka)+``;if(Wu(e))return Br?Br.call(e):``;var t=e+``;return t==`0`&&1/e==-C?`-0`:t}function qa(e,t,n){var r=-1,a=zn,o=e.length,s=!0,c=[],l=c;if(n)s=!1,a=Bn;else if(o>=i){var u=t?null:Vo(e);if(u)return wr(u);s=!1,a=ur,l=new di}else l=t?[]:c;outer:for(;++r<o;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,s&&f===f){for(var p=l.length;p--;)if(l[p]===f)continue outer;t&&l.push(f),c.push(d)}else a(l,f,n)||(l!==c&&l.push(f),c.push(d))}return c}function Ja(e,t){t=no(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Bs(t[n]);if(i===`__proto__`&&!k.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=As(e,t);return a==null||delete a[Bs(mc(t))]}function Ya(e,t,n,r){return Ia(e,t,n(Yi(e,t)),r)}function Xa(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?Ba(e,r?0:a,r?a+1:i):Ba(e,r?a+1:0,r?i:a)}function Za(e,t){var n=e;return n instanceof R&&(n=n.value()),Hn(t,function(e,t){return t.func.apply(t.thisArg,Vn([e],t.args))},n)}function Qa(e,t,n){var r=e.length;if(r<2)return r?qa(e[0]):[];for(var i=-1,a=E(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=Li(a[i]||o,e[s],t,n));return qa(z(a,1),t,n)}function $a(e,t,r){for(var i=-1,a=e.length,o=t.length,s={};++i<a;){var c=i<o?t[i]:n;r(s,e[i],c)}return s}function eo(e){return q(e)?e:[]}function to(e){return typeof e==`function`?e:$}function no(e,t){return K(e)?e:_s(e,t)?[e]:zs(Z(e))}var ro=V;function io(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:Ba(e,t,r)}var ao=tn||function(e){return P.clearTimeout(e)};function oo(e,t){if(t)return e.slice();var n=e.length,r=Kt?Kt(n):new e.constructor(n);return e.copy(r),r}function so(e){var t=new e.constructor(e.byteLength);return new Gt(t).set(new Gt(e)),t}function co(e,t){var n=t?so(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function lo(e){var t=new e.constructor(e.source,vt.exec(e));return t.lastIndex=e.lastIndex,t}function uo(e){return zr?D(zr.call(e)):{}}function fo(e,t){var n=t?so(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function po(e,t){if(e!==t){var r=e!==n,i=e===null,a=e===e,o=Wu(e),s=t!==n,c=t===null,l=t===t,u=Wu(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function mo(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=po(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function ho(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=A(a-o,0),u=E(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function go(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=A(a-s,0),d=E(u+l),f=!r;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++o<s;)(f||i<a)&&(d[p+n[o]]=e[i++]);return d}function H(e,t){var n=-1,r=e.length;for(t||=E(r);++n<r;)t[n]=e[n];return t}function _o(e,t,r,i){var a=!r;r||={};for(var o=-1,s=t.length;++o<s;){var c=t[o],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?Ai(r,c,l):Ti(r,c,l)}return r}function vo(e,t){return _o(e,os(e),t)}function yo(e,t){return _o(e,ss(e),t)}function bo(e,t){return function(n,r){var i=K(n)?Pn:Di,a=t?t():{};return i(n,e,U(r,2),a)}}function xo(e){return V(function(t,r){var i=-1,a=r.length,o=a>1?r[a-1]:n,s=a>2?r[2]:n;for(o=e.length>3&&typeof o==`function`?(a--,o):n,s&&G(r[0],r[1],s)&&(o=a<3?n:o,a=1),t=D(t);++i<a;){var c=r[i];c&&e(t,c,i,o)}return t})}function So(e,t){return function(n,r){if(n==null)return n;if(!vu(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=D(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}function Co(e){return function(t,n,r){for(var i=-1,a=D(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function wo(e,t,n){var r=t&_,i=Do(e);function a(){return(this&&this!==P&&this instanceof a?i:e).apply(r?n:this,arguments)}return a}function To(e){return function(t){t=Z(t);var r=vr(t)?kr(t):n,i=r?r[0]:t.charAt(0),a=r?io(r,1).join(``):t.slice(1);return i[e]()+a}}function Eo(e){return function(t){return Hn(wf(Xd(t).replace(ln,``)),e,``)}}function Do(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=Vr(e.prototype),r=e.apply(n,t);return J(r)?r:n}}function Oo(e,t,r){var i=Do(e);function a(){for(var o=arguments.length,s=E(o),c=o,l=ts(a);c--;)s[c]=arguments[c];var u=o<3&&s[0]!==l&&s[o-1]!==l?[]:Cr(s,l);return o-=u.length,o<r?zo(e,t,jo,a.placeholder,n,s,u,n,n,r-o):Nn(this&&this!==P&&this instanceof a?i:e,this,s)}return a}function ko(e){return function(t,r,i){var a=D(t);if(!vu(t)){var o=U(r,3);t=Q(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,i);return s>-1?a[o?t[s]:s]:n}}function Ao(e){return Xo(function(t){var r=t.length,i=r,a=Ur.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if(typeof s!=`function`)throw new O(o);if(a&&!c&&es(s)==`wrapper`)var c=new Ur([],!0)}for(i=c?i:r;++i<r;){s=t[i];var l=es(s),u=l==`wrapper`?$o(s):n;c=u&&ys(u[0])&&u[1]==(te|b|S|ne)&&!u[4].length&&u[9]==1?c[es(u[0])].apply(c,u[3]):s.length==1&&ys(s)?c[l]():c.thru(s)}return function(){var e=arguments,n=e[0];if(c&&e.length==1&&K(n))return c.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}})}function jo(e,t,r,i,a,o,s,c,l,u){var d=t&te,f=t&_,p=t&v,m=t&(b|x),h=t&re,g=p?n:Do(e);function y(){for(var n=arguments.length,_=E(n),v=n;v--;)_[v]=arguments[v];if(m)var b=ts(y),x=pr(_,b);if(i&&(_=ho(_,i,a,m)),o&&(_=go(_,o,s,m)),n-=x,m&&n<u){var S=Cr(_,b);return zo(e,t,jo,y.placeholder,r,_,S,c,l,u-n)}var ee=f?r:this,te=p?ee[e]:e;return n=_.length,c?_=js(_,c):h&&n>1&&_.reverse(),d&&l<n&&(_.length=l),this&&this!==P&&this instanceof y&&(te=g||Do(te)),te.apply(ee,_)}return y}function Mo(e,t){return function(n,r){return na(n,e,t(r),{})}}function No(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;typeof r==`string`||typeof i==`string`?(r=Ka(r),i=Ka(i)):(r=Ga(r),i=Ga(i)),a=e(r,i)}return a}}function Po(e){return Xo(function(t){return t=I(t,cr(U())),V(function(n){var r=this;return e(t,function(e){return Nn(e,r,n)})})})}function Fo(e,t){t=t===n?` `:Ka(t);var r=t.length;if(r<2)return r?Na(t,e):t;var i=Na(t,an(e/Or(t)));return vr(t)?io(kr(i),0,e).join(``):i.slice(0,e)}function Io(e,t,n,r){var i=t&_,a=Do(e);function o(){for(var t=-1,s=arguments.length,c=-1,l=r.length,u=E(l+s),d=this&&this!==P&&this instanceof o?a:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++t];return Nn(d,i?n:this,u)}return o}function Lo(e){return function(t,r,i){return i&&typeof i!=`number`&&G(t,r,i)&&(r=i=n),t=Qu(t),r===n?(r=t,t=0):r=Qu(r),i=i===n?t<r?1:-1:Qu(i),Ma(t,r,i,e)}}function Ro(e){return function(t,n){return typeof t==`string`&&typeof n==`string`||(t=ed(t),n=ed(n)),e(t,n)}}function zo(e,t,r,i,a,o,s,c,l,u){var d=t&b,f=d?s:n,p=d?n:s,m=d?o:n,h=d?n:o;t|=d?S:ee,t&=~(d?ee:S),t&y||(t&=~(_|v));var g=[e,t,a,m,f,h,p,c,l,u],x=r.apply(n,g);return ys(e)&&Ns(x,g),x.placeholder=i,Is(x,e,t)}function Bo(e){var t=kt[e];return function(e,n){if(e=ed(e),n=n==null?0:N(X(n),292),n&&dn(e)){var r=(Z(e)+`e`).split(`e`);return r=(Z(t(r[0]+`e`+(+r[1]+n)))+`e`).split(`e`),+(r[0]+`e`+(+r[1]-n))}return t(e)}}var Vo=En&&1/wr(new En([,-0]))[1]==C?function(e){return new En(e)}:Bf;function Ho(e){return function(t){var n=W(t);return n==w?xr(t):n==T?Tr(t):or(t,e(t))}}function Uo(e,t,r,i,a,s,c,l){var u=t&v;if(!u&&typeof e!=`function`)throw new O(o);var d=i?i.length:0;if(d||(t&=~(S|ee),i=a=n),c=c===n?c:A(X(c),0),l=l===n?l:X(l),d-=a?a.length:0,t&ee){var f=i,p=a;i=a=n}var m=u?n:$o(e),h=[e,t,r,i,a,f,p,s,c,l];if(m&&Es(h,m),e=h[0],t=h[1],r=h[2],i=h[3],a=h[4],l=h[9]=h[9]===n?u?0:e.length:A(h[9]-d,0),!l&&t&(b|x)&&(t&=~(b|x)),!t||t==_)var g=wo(e,t,r);else g=t==b||t==x?Oo(e,t,l):(t==S||t==(_|S))&&!a.length?Io(e,t,r,i):jo.apply(n,h);return Is((m?La:Ns)(g,h),e,t)}function Wo(e,t,r,i){return e===n||pu(e,Pt[r])&&!k.call(i,r)?t:e}function Go(e,t,r,i,a,o){return J(e)&&J(t)&&(o.set(t,e),Sa(e,t,n,Go,o),o.delete(t)),e}function Ko(e){return zu(e)?n:e}function qo(e,t,r,i,a,o){var s=r&h,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,m=r&g?new di:n;for(o.set(e,t),o.set(t,e);++f<c;){var _=e[f],v=t[f];if(i)var y=s?i(v,_,f,t,e,o):i(_,v,f,e,t,o);if(y!==n){if(y)continue;p=!1;break}if(m){if(!Wn(t,function(e,t){if(!ur(m,t)&&(_===e||a(_,e,r,i,o)))return m.push(t)})){p=!1;break}}else if(!(_===v||a(_,v,r,i,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function Jo(e,t,n,r,i,a,o){switch(n){case ze:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Re:return!(e.byteLength!=t.byteLength||!a(new Gt(e),new Gt(t)));case xe:case Se:case De:return pu(+e,+t);case we:return e.name==t.name&&e.message==t.message;case Me:case Ne:return e==t+``;case w:var s=xr;case T:var c=r&h;if(s||=wr,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=g,o.set(e,t);var u=qo(s(e),s(t),r,i,a,o);return o.delete(e),u;case Pe:if(zr)return zr.call(e)==zr.call(t)}return!1}function Yo(e,t,r,i,a,o){var s=r&h,c=Zo(e),l=c.length;if(l!=Zo(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:k.call(t,d)))return!1}var f=o.get(e),p=o.get(t);if(f&&p)return f==t&&p==e;var m=!0;o.set(e,t),o.set(t,e);for(var g=s;++u<l;){d=c[u];var _=e[d],v=t[d];if(i)var y=s?i(v,_,d,t,e,o):i(_,v,d,e,t,o);if(!(y===n?_===v||a(_,v,r,i,o):y)){m=!1;break}g||=d==`constructor`}if(m&&!g){var b=e.constructor,x=t.constructor;b!=x&&`constructor`in e&&`constructor`in t&&!(typeof b==`function`&&b instanceof b&&typeof x==`function`&&x instanceof x)&&(m=!1)}return o.delete(e),o.delete(t),m}function Xo(e){return Fs(ks(e,n,rc),e+``)}function Zo(e){return Xi(e,Q,os)}function Qo(e){return Xi(e,Td,ss)}var $o=Kn?function(e){return Kn.get(e)}:Bf;function es(e){for(var t=e.name+``,n=tr[t],r=k.call(tr,t)?n.length:0;r--;){var i=n[r],a=i.func;if(a==null||a==e)return i.name}return t}function ts(e){return(k.call(L,`placeholder`)?L:e).placeholder}function U(){var e=L.iteratee||Nf;return e=e===Nf?ha:e,arguments.length?e(arguments[0],arguments[1]):e}function ns(e,t){var n=e.__data__;return vs(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function rs(e){for(var t=Q(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Cs(i)]}return t}function is(e,t){var r=_r(e,t);return da(r)?r:n}function as(e){var t=k.call(e,$t),r=e[$t];try{e[$t]=n;var i=!0}catch{}var a=zt.call(e);return i&&(t?e[$t]=r:delete e[$t]),a}var os=sn?function(e){return e==null?[]:(e=D(e),Rn(sn(e),function(t){return Yt.call(e,t)}))}:Yf,ss=sn?function(e){for(var t=[];e;)Vn(t,os(e)),e=qt(e);return t}:Yf,W=B;(Sn&&W(new Sn(new ArrayBuffer(1)))!=ze||Cn&&W(new Cn)!=w||wn&&W(wn.resolve())!=Ae||En&&W(new En)!=T||F&&W(new F)!=Ie)&&(W=function(e){var t=B(e),r=t==ke?e.constructor:n,i=r?Vs(r):``;if(i)switch(i){case Er:return ze;case Mr:return w;case Nr:return Ae;case Ir:return T;case Lr:return Ie}return t});function cs(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],o=a.size;switch(a.type){case`drop`:e+=o;break;case`dropRight`:t-=o;break;case`take`:t=N(t,e+o);break;case`takeRight`:e=A(e,t-o);break}}return{start:e,end:t}}function ls(e){var t=e.match(ft);return t?t[1].split(pt):[]}function us(e,t,n){t=no(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Bs(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Au(i)&&gs(o,i)&&(K(e)||gu(e)))}function ds(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&k.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function fs(e){return typeof e.constructor==`function`&&!Ss(e)?Vr(qt(e)):{}}function ps(e,t,n){var r=e.constructor;switch(t){case Re:return so(e);case xe:case Se:return new r(+e);case ze:return co(e,n);case Be:case Ve:case He:case Ue:case We:case Ge:case Ke:case qe:case Je:return fo(e,n);case w:return new r;case De:case Ne:return new r(e);case Me:return lo(e);case T:return new r;case Pe:return uo(e)}}function ms(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(dt,`{
|
|
3
3
|
/* [wrapped with `+t+`] */
|
|
4
|
-
`)}function hs(e){return K(e)||gu(e)||!!(Xt&&e&&e[Xt])}function gs(e,t){var n=typeof e;return t??=ue,!!t&&(n==`number`||n!=`symbol`&&St.test(e))&&e>-1&&e%1==0&&e<t}function G(e,t,n){if(!J(n))return!1;var r=typeof t;return(r==`number`?vu(n)&&gs(t,n.length):r==`string`&&t in n)?pu(n[t],e):!1}function _s(e,t){if(K(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||Wu(e)?!0:at.test(e)||!it.test(e)||t!=null&&e in O(t)}function vs(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function ys(e){var t=es(e),n=R[t];if(typeof n!=`function`||!(t in z.prototype))return!1;if(e===n)return!0;var r=$o(n);return!!r&&e===r[0]}function bs(e){return!!Lt&&Lt in e}var xs=Pt?Ou:Xf;function Ss(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Nt)}function Cs(e){return e===e&&!J(e)}function ws(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==n||e in O(r))}}function Ts(e){var t=Yl(e,function(e){return n.size===u&&n.clear(),e}),n=t.cache;return t}function Es(e,t){var n=e[1],r=t[1],i=n|r,a=i<(_|v|ee),o=r==ee&&n==b||r==ee&&n==te&&e[7].length<=t[8]||r==(ee|te)&&t[7].length<=t[8]&&n==b;if(!(a||o))return e;r&_&&(e[2]=t[2],i|=n&_?0:y);var s=t[3];if(s){var c=e[3];e[3]=c?mo(c,s,t[4]):s,e[4]=c?Sr(e[3],d):t[4]}return s=t[5],s&&(c=e[5],e[5]=c?ho(c,s,t[6]):s,e[6]=c?Sr(e[5],d):t[6]),s=t[7],s&&(e[7]=s),r&ee&&(e[8]=e[8]==null?t[8]:P(e[8],t[8])),e[9]??=t[9],e[0]=t[0],e[1]=i,e}function Ds(e){var t=[];if(e!=null)for(var n in O(e))t.push(n);return t}function Os(e){return Rt.call(e)}function ks(e,t,r){return t=j(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=j(n.length-t,0),o=D(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=D(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),Mn(e,this,s)}}function As(e,t){return t.length<2?e:Ji(e,za(t,0,-1))}function js(e,t){for(var r=e.length,i=P(t.length,r),a=go(e);i--;){var o=t[i];e[i]=gs(o,r)?a[o]:n}return e}function Ms(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Ns=Ls(Ia),Ps=nn||function(e,t){return F.setTimeout(e,t)},Fs=Ls(La);function Is(e,t,n){var r=t+``;return Fs(e,ms(r,Hs(ls(r),n)))}function Ls(e){var t=0,r=0;return function(){var i=hn(),a=oe-(i-r);if(r=i,a>0){if(++t>=ae)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Rs(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var o=Aa(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var zs=Ts(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(ot,function(e,n,r,i){t.push(r?i.replace(ht,`$1`):n||e)}),t});function Bs(e){if(typeof e==`string`||Wu(e))return e;var t=e+``;return t==`0`&&1/e==-w?`-0`:t}function Vs(e){if(e!=null){try{return Ft.call(e)}catch{}try{return e+``}catch{}}return``}function Hs(e,t){return Pn(ge,function(n){var r=`_.`+n[0];t&n[1]&&!Rn(e,r)&&e.push(r)}),e.sort()}function Us(e){if(e instanceof z)return e.clone();var t=new Hr(e.__wrapped__,e.__chain__);return t.__actions__=go(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Ws(e,t,r){t=(r?G(e,t,r):t===n)?1:j(X(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=D(rn(i/t));a<i;)s[o++]=za(e,a,a+=t);return s}function Gs(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}function Ks(){var e=arguments.length;if(!e)return[];for(var t=D(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Bn(K(n)?go(n):[n],B(t,1))}var qs=H(function(e,t){return q(e)?Ii(e,B(t,1,q,!0)):[]}),Js=H(function(e,t){var r=mc(t);return q(r)&&(r=n),q(e)?Ii(e,B(t,1,q,!0),U(r,2)):[]}),Ys=H(function(e,t){var r=mc(t);return q(r)&&(r=n),q(e)?Ii(e,B(t,1,q,!0),n,r):[]});function Xs(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),za(e,t<0?0:t,i)):[]}function Zs(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),t=i-t,za(e,0,t<0?0:t)):[]}function Qs(e,t){return e&&e.length?Ya(e,U(t,3),!0,!0):[]}function $s(e,t){return e&&e.length?Ya(e,U(t,3),!0):[]}function ec(e,t,n,r){var i=e==null?0:e.length;return i?(n&&typeof n!=`number`&&G(e,t,n)&&(n=0,r=i),Vi(e,t,n,r)):[]}function tc(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:X(n);return i<0&&(i=j(r+i,0)),Jn(e,U(t,3),i)}function nc(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=X(r),a=r<0?j(i+a,0):P(a,i-1)),Jn(e,U(t,3),a,!0)}function rc(e){return e!=null&&e.length?B(e,1):[]}function ic(e){return e!=null&&e.length?B(e,w):[]}function ac(e,t){return e!=null&&e.length?(t=t===n?1:X(t),B(e,t)):[]}function oc(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var i=e[t];ki(r,i[0],i[1])}return r}function sc(e){return e&&e.length?e[0]:n}function cc(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:X(n);return i<0&&(i=j(r+i,0)),Yn(e,t,i)}function lc(e){return e!=null&&e.length?za(e,0,-1):[]}var uc=H(function(e){var t=L(e,$a);return t.length&&t[0]===e[0]?ea(t):[]}),dc=H(function(e){var t=mc(e),r=L(e,$a);return t===mc(r)?t=n:r.pop(),r.length&&r[0]===e[0]?ea(r,U(t,2)):[]}),fc=H(function(e){var t=mc(e),r=L(e,$a);return t=typeof t==`function`?t:n,t&&r.pop(),r.length&&r[0]===e[0]?ea(r,n,t):[]});function pc(e,t){return e==null?``:dn.call(e,t)}function mc(e){var t=e==null?0:e.length;return t?e[t-1]:n}function hc(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=X(r),a=a<0?j(i+a,0):P(a,i-1)),t===t?Er(e,t,a):Jn(e,Zn,a,!0)}function gc(e,t){return e&&e.length?Ca(e,X(t)):n}var _c=H(vc);function vc(e,t){return e&&e.length&&t&&t.length?Oa(e,t):e}function yc(e,t,n){return e&&e.length&&t&&t.length?Oa(e,t,U(n,2)):e}function bc(e,t,r){return e&&e.length&&t&&t.length?Oa(e,t,n,r):e}var xc=Xo(function(e,t){var n=e==null?0:e.length,r=Ai(e,t);return ka(e,L(t,function(e){return gs(e,n)?+e:e}).sort(fo)),r});function Sc(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,i=[],a=e.length;for(t=U(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return ka(e,i),n}function Cc(e){return e==null?e:bn.call(e)}function wc(e,t,r){var i=e==null?0:e.length;return i?(r&&typeof r!=`number`&&G(e,t,r)?(t=0,r=i):(t=t==null?0:X(t),r=r===n?i:X(r)),za(e,t,r)):[]}function Tc(e,t){return Va(e,t)}function Ec(e,t,n){return Ha(e,t,U(n,2))}function Dc(e,t){var n=e==null?0:e.length;if(n){var r=Va(e,t);if(r<n&&pu(e[r],t))return r}return-1}function Oc(e,t){return Va(e,t,!0)}function kc(e,t,n){return Ha(e,t,U(n,2),!0)}function Ac(e,t){if(e!=null&&e.length){var n=Va(e,t,!0)-1;if(pu(e[n],t))return n}return-1}function jc(e){return e&&e.length?Ua(e):[]}function Mc(e,t){return e&&e.length?Ua(e,U(t,2)):[]}function Nc(e){var t=e==null?0:e.length;return t?za(e,1,t):[]}function Pc(e,t,r){return e&&e.length?(t=r||t===n?1:X(t),za(e,0,t<0?0:t)):[]}function Fc(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),t=i-t,za(e,t<0?0:t,i)):[]}function Ic(e,t){return e&&e.length?Ya(e,U(t,3),!1,!0):[]}function Lc(e,t){return e&&e.length?Ya(e,U(t,3)):[]}var Rc=H(function(e){return Ka(B(e,1,q,!0))}),zc=H(function(e){var t=mc(e);return q(t)&&(t=n),Ka(B(e,1,q,!0),U(t,2))}),Bc=H(function(e){var t=mc(e);return t=typeof t==`function`?t:n,Ka(B(e,1,q,!0),n,t)});function Vc(e){return e&&e.length?Ka(e):[]}function Hc(e,t){return e&&e.length?Ka(e,U(t,2)):[]}function Uc(e,t){return t=typeof t==`function`?t:n,e&&e.length?Ka(e,n,t):[]}function Wc(e){if(!(e&&e.length))return[];var t=0;return e=Ln(e,function(e){if(q(e))return t=j(e.length,t),!0}),ir(t,function(t){return L(e,$n(t))})}function Gc(e,t){if(!(e&&e.length))return[];var r=Wc(e);return t==null?r:L(r,function(e){return Mn(t,n,e)})}var Kc=H(function(e,t){return q(e)?Ii(e,t):[]}),qc=H(function(e){return Za(Ln(e,q))}),Jc=H(function(e){var t=mc(e);return q(t)&&(t=n),Za(Ln(e,q),U(t,2))}),Yc=H(function(e){var t=mc(e);return t=typeof t==`function`?t:n,Za(Ln(e,q),n,t)}),Xc=H(Wc);function Zc(e,t){return Qa(e||[],t||[],wi)}function Qc(e,t){return Qa(e||[],t||[],Fa)}var $c=H(function(e){var t=e.length,r=t>1?e[t-1]:n;return r=typeof r==`function`?(e.pop(),r):n,Gc(e,r)});function el(e){var t=R(e);return t.__chain__=!0,t}function tl(e,t){return t(e),e}function nl(e,t){return t(e)}var rl=Xo(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return Ai(t,e)};return t>1||this.__actions__.length||!(i instanceof z)||!gs(r)?this.thru(a):(i=i.slice(r,+r+ +!!t),i.__actions__.push({func:nl,args:[a],thisArg:n}),new Hr(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e}))});function il(){return el(this)}function al(){return new Hr(this.value(),this.__chain__)}function ol(){this.__values__===n&&(this.__values__=Zu(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}}function sl(){return this}function cl(e){for(var t,r=this;r instanceof Vr;){var i=Us(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t}function ll(){var e=this.__wrapped__;if(e instanceof z){var t=e;return this.__actions__.length&&(t=new z(this)),t=t.reverse(),t.__actions__.push({func:nl,args:[Cc],thisArg:n}),new Hr(t,this.__chain__)}return this.thru(Cc)}function ul(){return Xa(this.__wrapped__,this.__actions__)}var dl=bo(function(e,t,n){A.call(e,n)?++e[n]:ki(e,n,1)});function fl(e,t,r){var i=K(e)?In:zi;return r&&G(e,t,r)&&(t=n),i(e,U(t,3))}function pl(e,t){return(K(e)?Ln:Hi)(e,U(t,3))}var ml=ko(tc),hl=ko(nc);function gl(e,t){return B(Tl(e,t),1)}function _l(e,t){return B(Tl(e,t),w)}function vl(e,t,r){return r=r===n?1:X(r),B(Tl(e,t),r)}function yl(e,t){return(K(e)?Pn:Li)(e,U(t,3))}function bl(e,t){return(K(e)?Fn:Ri)(e,U(t,3))}var xl=bo(function(e,t,n){A.call(e,n)?e[n].push(t):ki(e,n,[t])});function Sl(e,t,n,r){e=vu(e)?e:Ud(e),n=n&&!r?X(n):0;var i=e.length;return n<0&&(n=j(i+n,0)),Uu(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Yn(e,t,n)>-1}var Cl=H(function(e,t,n){var r=-1,i=typeof t==`function`,a=vu(e)?D(e.length):[];return Li(e,function(e){a[++r]=i?Mn(t,e,n):na(e,t,n)}),a}),wl=bo(function(e,t,n){ki(e,n,t)});function Tl(e,t){return(K(e)?L:va)(e,U(t,3))}function El(e,t,r,i){return e==null?[]:(K(t)||(t=t==null?[]:[t]),r=i?n:r,K(r)||(r=r==null?[]:[r]),wa(e,t,r))}var Dl=bo(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]});function Ol(e,t,n){var r=K(e)?Vn:tr,i=arguments.length<3;return r(e,U(t,4),n,i,Li)}function kl(e,t,n){var r=K(e)?Hn:tr,i=arguments.length<3;return r(e,U(t,4),n,i,Ri)}function Al(e,t){return(K(e)?Ln:Hi)(e,Xl(U(t,3)))}function jl(e){return(K(e)?bi:Na)(e)}function Ml(e,t,r){return t=(r?G(e,t,r):t===n)?1:X(t),(K(e)?xi:Pa)(e,t)}function Nl(e){return(K(e)?Si:Ra)(e)}function Pl(e){if(e==null)return 0;if(vu(e))return Uu(e)?Dr(e):e.length;var t=W(e);return t==T||t==E?e.size:ha(e).length}function Fl(e,t,r){var i=K(e)?Un:Ba;return r&&G(e,t,r)&&(t=n),i(e,U(t,3))}var Il=H(function(e,t){if(e==null)return[];var n=t.length;return n>1&&G(e,t[0],t[1])?t=[]:n>2&&G(t[0],t[1],t[2])&&(t=[t[0]]),wa(e,B(t,1),[])}),Ll=tn||function(){return F.Date.now()};function Rl(e,t){if(typeof t!=`function`)throw new k(o);return e=X(e),function(){if(--e<1)return t.apply(this,arguments)}}function zl(e,t,r){return t=r?n:t,t=e&&t==null?e.length:t,Uo(e,ee,n,n,n,n,t)}function Bl(e,t){var r;if(typeof t!=`function`)throw new k(o);return e=X(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=n),r}}var Vl=H(function(e,t,n){var r=_;if(n.length){var i=Sr(n,ts(Vl));r|=S}return Uo(e,r,t,n,i)}),Hl=H(function(e,t,n){var r=_|v;if(n.length){var i=Sr(n,ts(Hl));r|=S}return Uo(t,r,e,n,i)});function Ul(e,t,r){t=r?n:t;var i=Uo(e,b,n,n,n,n,n,t);return i.placeholder=Ul.placeholder,i}function Wl(e,t,r){t=r?n:t;var i=Uo(e,x,n,n,n,n,n,t);return i.placeholder=Wl.placeholder,i}function Gl(e,t,r){var i,a,s,c,l,u,d=0,f=!1,p=!1,m=!0;if(typeof e!=`function`)throw new k(o);t=ed(t)||0,J(r)&&(f=!!r.leading,p=`maxWait`in r,s=p?j(ed(r.maxWait)||0,t):s,m=`trailing`in r?!!r.trailing:m);function h(t){var r=i,o=a;return i=a=n,d=t,c=e.apply(o,r),c}function g(e){return d=e,l=Ps(y,t),f?h(e):c}function _(e){var n=e-u,r=e-d,i=t-n;return p?P(i,s-r):i}function v(e){var r=e-u,i=e-d;return u===n||r>=t||r<0||p&&i>=s}function y(){var e=Ll();if(v(e))return b(e);l=Ps(y,_(e))}function b(e){return l=n,m&&i?h(e):(i=a=n,c)}function x(){l!==n&&io(l),d=0,i=u=a=l=n}function S(){return l===n?c:b(Ll())}function C(){var e=Ll(),r=v(e);if(i=arguments,a=this,u=e,r){if(l===n)return g(u);if(p)return io(l),l=Ps(y,t),h(u)}return l===n&&(l=Ps(y,t)),c}return C.cancel=x,C.flush=S,C}var Kl=H(function(e,t){return Fi(e,1,t)}),ql=H(function(e,t,n){return Fi(e,ed(t)||0,n)});function Jl(e){return Uo(e,ne)}function Yl(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw new k(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Yl.Cache||ii),n}Yl.Cache=ii;function Xl(e){if(typeof e!=`function`)throw new k(o);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 Zl(e){return Bl(2,e)}var Ql=no(function(e,t){t=t.length==1&&K(t[0])?L(t[0],sr(U())):L(B(t,1),sr(U()));var n=t.length;return H(function(r){for(var i=-1,a=P(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return Mn(e,this,r)})}),$l=H(function(e,t){return Uo(e,S,n,t,Sr(t,ts($l)))}),eu=H(function(e,t){return Uo(e,C,n,t,Sr(t,ts(eu)))}),tu=Xo(function(e,t){return Uo(e,te,n,n,n,t)});function nu(e,t){if(typeof e!=`function`)throw new k(o);return t=t===n?t:X(t),H(e,t)}function ru(e,t){if(typeof e!=`function`)throw new k(o);return t=t==null?0:j(X(t),0),H(function(n){var r=n[t],i=ro(n,0,t);return r&&Bn(i,r),Mn(e,this,i)})}function iu(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw new k(o);return J(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),Gl(e,t,{leading:r,maxWait:t,trailing:i})}function au(e){return zl(e,1)}function ou(e,t){return $l(eo(t),e)}function su(){if(!arguments.length)return[];var e=arguments[0];return K(e)?e:[e]}function cu(e){return Mi(e,m)}function lu(e,t){return t=typeof t==`function`?t:n,Mi(e,m,t)}function uu(e){return Mi(e,f|m)}function du(e,t){return t=typeof t==`function`?t:n,Mi(e,f|m,t)}function fu(e,t){return t==null||Pi(e,t,Q(t))}function pu(e,t){return e===t||e!==e&&t!==t}var mu=Ro(Xi),hu=Ro(function(e,t){return e>=t}),gu=ra(function(){return arguments}())?ra:function(e){return Y(e)&&A.call(e,`callee`)&&!Jt.call(e,`callee`)},K=D.isArray,_u=En?sr(En):ia;function vu(e){return e!=null&&Au(e.length)&&!Ou(e)}function q(e){return Y(e)&&vu(e)}function yu(e){return e===!0||e===!1||Y(e)&&V(e)==be}var bu=sn||Xf,xu=Dn?sr(Dn):aa;function Su(e){return Y(e)&&e.nodeType===1&&!zu(e)}function Cu(e){if(e==null)return!0;if(vu(e)&&(K(e)||typeof e==`string`||typeof e.splice==`function`||bu(e)||Gu(e)||gu(e)))return!e.length;var t=W(e);if(t==T||t==E)return!e.size;if(Ss(e))return!ha(e).length;for(var n in e)if(A.call(e,n))return!1;return!0}function wu(e,t){return oa(e,t)}function Tu(e,t,r){r=typeof r==`function`?r:n;var i=r?r(e,t):n;return i===n?oa(e,t,n,r):!!i}function Eu(e){if(!Y(e))return!1;var t=V(e);return t==Ce||t==Se||typeof e.message==`string`&&typeof e.name==`string`&&!zu(e)}function Du(e){return typeof e==`number`&&un(e)}function Ou(e){if(!J(e))return!1;var t=V(e);return t==we||t==Te||t==ye||t==Ae}function ku(e){return typeof e==`number`&&e==X(e)}function Au(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=ue}function J(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function Y(e){return typeof e==`object`&&!!e}var ju=On?sr(On):ca;function Mu(e,t){return e===t||la(e,t,rs(t))}function Nu(e,t,r){return r=typeof r==`function`?r:n,la(e,t,rs(t),r)}function Pu(e){return Ru(e)&&e!=+e}function Fu(e){if(xs(e))throw new Et(a);return ua(e)}function Iu(e){return e===null}function Lu(e){return e==null}function Ru(e){return typeof e==`number`||Y(e)&&V(e)==Ee}function zu(e){if(!Y(e)||V(e)!=Oe)return!1;var t=Kt(e);if(t===null)return!0;var n=A.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ft.call(n)==zt}var Bu=kn?sr(kn):da;function Vu(e){return ku(e)&&e>=-ue&&e<=ue}var Hu=An?sr(An):fa;function Uu(e){return typeof e==`string`||!K(e)&&Y(e)&&V(e)==Me}function Wu(e){return typeof e==`symbol`||Y(e)&&V(e)==Ne}var Gu=jn?sr(jn):pa;function Ku(e){return e===n}function qu(e){return Y(e)&&W(e)==Fe}function Ju(e){return Y(e)&&V(e)==Ie}var Yu=Ro(_a),Xu=Ro(function(e,t){return e<=t});function Zu(e){if(!e)return[];if(vu(e))return Uu(e)?Or(e):go(e);if(Zt&&e[Zt])return yr(e[Zt]());var t=W(e);return(t==T?br:t==E?Cr:Ud)(e)}function Qu(e){return e?(e=ed(e),e===w||e===-w?(e<0?-1:1)*de:e===e?e:0):e===0?e:0}function X(e){var t=Qu(e),n=t%1;return t===t?n?t-n:t:0}function $u(e){return e?ji(X(e),0,pe):0}function ed(e){if(typeof e==`number`)return e;if(Wu(e))return fe;if(J(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=J(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=or(e);var n=yt.test(e);return n||xt.test(e)?yn(e.slice(2),n?2:8):vt.test(e)?fe:+e}function td(e){return _o(e,Td(e))}function nd(e){return e?ji(X(e),-ue,ue):e===0?e:0}function Z(e){return e==null?``:Ga(e)}var rd=xo(function(e,t){if(Ss(t)||vu(t)){_o(t,Q(t),e);return}for(var n in t)A.call(t,n)&&wi(e,n,t[n])}),id=xo(function(e,t){_o(t,Td(t),e)}),ad=xo(function(e,t,n,r){_o(t,Td(t),e,r)}),od=xo(function(e,t,n,r){_o(t,Q(t),e,r)}),sd=Xo(Ai);function cd(e,t){var n=Br(e);return t==null?n:Di(n,t)}var ld=H(function(e,t){e=O(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&G(t[0],t[1],a)&&(i=1);++r<i;)for(var o=t[r],s=Td(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===n||pu(d,Nt[u])&&!A.call(e,u))&&(e[u]=o[u])}return e}),ud=H(function(e){return e.push(n,Go),Mn(kd,n,e)});function dd(e,t){return qn(e,U(t,3),Gi)}function fd(e,t){return qn(e,U(t,3),Ki)}function pd(e,t){return e==null?e:Ui(e,U(t,3),Td)}function md(e,t){return e==null?e:Wi(e,U(t,3),Td)}function hd(e,t){return e&&Gi(e,U(t,3))}function gd(e,t){return e&&Ki(e,U(t,3))}function _d(e){return e==null?[]:qi(e,Q(e))}function vd(e){return e==null?[]:qi(e,Td(e))}function yd(e,t,r){var i=e==null?n:Ji(e,t);return i===n?r:i}function bd(e,t){return e!=null&&us(e,t,Zi)}function xd(e,t){return e!=null&&us(e,t,Qi)}var Sd=Mo(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=Rt.call(t)),e[t]=n},kf($)),Cd=Mo(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=Rt.call(t)),A.call(e,t)?e[t].push(n):e[t]=[n]},U),wd=H(na);function Q(e){return vu(e)?yi(e):ha(e)}function Td(e){return vu(e)?yi(e,!0):ga(e)}function Ed(e,t){var n={};return t=U(t,3),Gi(e,function(e,r,i){ki(n,t(e,r,i),e)}),n}function Dd(e,t){var n={};return t=U(t,3),Gi(e,function(e,r,i){ki(n,r,t(e,r,i))}),n}var Od=xo(function(e,t,n){xa(e,t,n)}),kd=xo(function(e,t,n,r){xa(e,t,n,r)}),Ad=Xo(function(e,t){var n={};if(e==null)return n;var r=!1;t=L(t,function(t){return t=to(t,e),r||=t.length>1,t}),_o(e,Qo(e),n),r&&(n=Mi(n,f|p|m,Ko));for(var i=t.length;i--;)qa(n,t[i]);return n});function jd(e,t){return Nd(e,Xl(U(t)))}var Md=Xo(function(e,t){return e==null?{}:Ta(e,t)});function Nd(e,t){if(e==null)return{};var n=L(Qo(e),function(e){return[e]});return t=U(t),Ea(e,n,function(e,n){return t(e,n[0])})}function Pd(e,t,r){t=to(t,e);var i=-1,a=t.length;for(a||(a=1,e=n);++i<a;){var o=e==null?n:e[Bs(t[i])];o===n&&(i=a,o=r),e=Ou(o)?o.call(e):o}return e}function Fd(e,t,n){return e==null?e:Fa(e,t,n)}function Id(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:Fa(e,t,r,i)}var Ld=Ho(Q),Rd=Ho(Td);function zd(e,t,n){var r=K(e),i=r||bu(e)||Gu(e);if(t=U(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:J(e)&&Ou(a)?Br(Kt(e)):{}}return(i?Pn:Gi)(e,function(e,r,i){return t(n,e,r,i)}),n}function Bd(e,t){return e==null?!0:qa(e,t)}function Vd(e,t,n){return e==null?e:Ja(e,t,eo(n))}function Hd(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:Ja(e,t,eo(r),i)}function Ud(e){return e==null?[]:cr(e,Q(e))}function Wd(e){return e==null?[]:cr(e,Td(e))}function Gd(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=ed(r),r=r===r?r:0),t!==n&&(t=ed(t),t=t===t?t:0),ji(ed(e),t,r)}function Kd(e,t,r){return t=Qu(t),r===n?(r=t,t=0):r=Qu(r),e=ed(e),$i(e,t,r)}function qd(e,t,r){if(r&&typeof r!=`boolean`&&G(e,t,r)&&(t=r=n),r===n&&(typeof t==`boolean`?(r=t,t=n):typeof e==`boolean`&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=Qu(e),t===n?(t=e,e=0):t=Qu(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=_n();return P(e+a*(t-e+vn(`1e-`+((a+``).length-1))),t)}return Aa(e,t)}var Jd=Eo(function(e,t,n){return t=t.toLowerCase(),e+(n?Yd(t):t)});function Yd(e){return Cf(Z(e).toLowerCase())}function Xd(e){return e=Z(e),e&&e.replace(Ct,pr).replace(ln,``)}function Zd(e,t,r){e=Z(e),t=Ga(t);var i=e.length;r=r===n?i:ji(X(r),0,i);var a=r;return r-=t.length,r>=0&&e.slice(r,a)==t}function Qd(e){return e=Z(e),e&&et.test(e)?e.replace(Qe,mr):e}function $d(e){return e=Z(e),e&&ct.test(e)?e.replace(st,`\\$&`):e}var ef=Eo(function(e,t,n){return e+(n?`-`:``)+t.toLowerCase()}),tf=Eo(function(e,t,n){return e+(n?` `:``)+t.toLowerCase()}),nf=To(`toLowerCase`);function rf(e,t,n){e=Z(e),t=X(t);var r=t?Dr(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fo(an(i),n)+e+Fo(rn(i),n)}function af(e,t,n){e=Z(e),t=X(t);var r=t?Dr(e):0;return t&&r<t?e+Fo(t-r,n):e}function of(e,t,n){e=Z(e),t=X(t);var r=t?Dr(e):0;return t&&r<t?Fo(t-r,n)+e:e}function sf(e,t,n){return n||t==null?t=0:t&&=+t,gn(Z(e).replace(lt,``),t||0)}function cf(e,t,r){return t=(r?G(e,t,r):t===n)?1:X(t),Ma(Z(e),t)}function lf(){var e=arguments,t=Z(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var uf=Eo(function(e,t,n){return e+(n?`_`:``)+t.toLowerCase()});function df(e,t,r){return r&&typeof r!=`number`&&G(e,t,r)&&(t=r=n),r=r===n?pe:r>>>0,r?(e=Z(e),e&&(typeof t==`string`||t!=null&&!Bu(t))&&(t=Ga(t),!t&&_r(e))?ro(Or(e),0,r):e.split(t,r)):[]}var ff=Eo(function(e,t,n){return e+(n?` `:``)+Cf(t)});function pf(e,t,n){return e=Z(e),n=n==null?0:ji(X(n),0,e.length),t=Ga(t),e.slice(n,n+t.length)==t}function mf(e,t,r){var i=R.templateSettings;r&&G(e,t,r)&&(t=n),e=Z(e),t=od({},t,i,Wo);var a=od({},t.imports,i.imports,Wo),o=Q(a),l=cr(a,o);Pn(o,function(e){if(mt.test(e))throw new Et(c)});var u,d,f=0,p=t.interpolate||wt,m=`__p += '`,h=kt((t.escape||wt).source+`|`+p.source+`|`+(p===rt?gt:wt).source+`|`+(t.evaluate||wt).source+`|$`,`g`),g=`//# sourceURL=`+(A.call(t,`sourceURL`)?(t.sourceURL+``).replace(/\s/g,` `):`lodash.templateSources[`+ ++mn+`]`)+`
|
|
5
|
-
`;e.replace(h,function(t,n,r,i,a,o){return r||=i,m+=e.slice(f,o).replace(
|
|
4
|
+
`)}function hs(e){return K(e)||gu(e)||!!(Zt&&e&&e[Zt])}function gs(e,t){var n=typeof e;return t??=de,!!t&&(n==`number`||n!=`symbol`&&Ct.test(e))&&e>-1&&e%1==0&&e<t}function G(e,t,n){if(!J(n))return!1;var r=typeof t;return(r==`number`?vu(n)&&gs(t,n.length):r==`string`&&t in n)?pu(n[t],e):!1}function _s(e,t){if(K(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||Wu(e)?!0:ot.test(e)||!at.test(e)||t!=null&&e in D(t)}function vs(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function ys(e){var t=es(e),n=L[t];if(typeof n!=`function`||!(t in R.prototype))return!1;if(e===n)return!0;var r=$o(n);return!!r&&e===r[0]}function bs(e){return!!Rt&&Rt in e}var xs=Ft?Ou:Xf;function Ss(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Pt)}function Cs(e){return e===e&&!J(e)}function ws(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==n||e in D(r))}}function Ts(e){var t=Yl(e,function(e){return n.size===u&&n.clear(),e}),n=t.cache;return t}function Es(e,t){var n=e[1],r=t[1],i=n|r,a=i<(_|v|te),o=r==te&&n==b||r==te&&n==ne&&e[7].length<=t[8]||r==(te|ne)&&t[7].length<=t[8]&&n==b;if(!(a||o))return e;r&_&&(e[2]=t[2],i|=n&_?0:y);var s=t[3];if(s){var c=e[3];e[3]=c?ho(c,s,t[4]):s,e[4]=c?Cr(e[3],d):t[4]}return s=t[5],s&&(c=e[5],e[5]=c?go(c,s,t[6]):s,e[6]=c?Cr(e[5],d):t[6]),s=t[7],s&&(e[7]=s),r&te&&(e[8]=e[8]==null?t[8]:N(e[8],t[8])),e[9]??=t[9],e[0]=t[0],e[1]=i,e}function Ds(e){var t=[];if(e!=null)for(var n in D(e))t.push(n);return t}function Os(e){return zt.call(e)}function ks(e,t,r){return t=A(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=A(n.length-t,0),o=E(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=E(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),Nn(e,this,s)}}function As(e,t){return t.length<2?e:Yi(e,Ba(t,0,-1))}function js(e,t){for(var r=e.length,i=N(t.length,r),a=H(e);i--;){var o=t[i];e[i]=gs(o,r)?a[o]:n}return e}function Ms(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Ns=Ls(La),Ps=rn||function(e,t){return P.setTimeout(e,t)},Fs=Ls(Ra);function Is(e,t,n){var r=t+``;return Fs(e,ms(r,Hs(ls(r),n)))}function Ls(e){var t=0,r=0;return function(){var i=gn(),a=se-(i-r);if(r=i,a>0){if(++t>=oe)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Rs(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var o=ja(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var zs=Ts(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(st,function(e,n,r,i){t.push(r?i.replace(gt,`$1`):n||e)}),t});function Bs(e){if(typeof e==`string`||Wu(e))return e;var t=e+``;return t==`0`&&1/e==-C?`-0`:t}function Vs(e){if(e!=null){try{return It.call(e)}catch{}try{return e+``}catch{}}return``}function Hs(e,t){return Fn(_e,function(n){var r=`_.`+n[0];t&n[1]&&!zn(e,r)&&e.push(r)}),e.sort()}function Us(e){if(e instanceof R)return e.clone();var t=new Ur(e.__wrapped__,e.__chain__);return t.__actions__=H(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Ws(e,t,r){t=(r?G(e,t,r):t===n)?1:A(X(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=E(an(i/t));a<i;)s[o++]=Ba(e,a,a+=t);return s}function Gs(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}function Ks(){var e=arguments.length;if(!e)return[];for(var t=E(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Vn(K(n)?H(n):[n],z(t,1))}var qs=V(function(e,t){return q(e)?Li(e,z(t,1,q,!0)):[]}),Js=V(function(e,t){var r=mc(t);return q(r)&&(r=n),q(e)?Li(e,z(t,1,q,!0),U(r,2)):[]}),Ys=V(function(e,t){var r=mc(t);return q(r)&&(r=n),q(e)?Li(e,z(t,1,q,!0),n,r):[]});function Xs(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),Ba(e,t<0?0:t,i)):[]}function Zs(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),t=i-t,Ba(e,0,t<0?0:t)):[]}function Qs(e,t){return e&&e.length?Xa(e,U(t,3),!0,!0):[]}function $s(e,t){return e&&e.length?Xa(e,U(t,3),!0):[]}function ec(e,t,n,r){var i=e==null?0:e.length;return i?(n&&typeof n!=`number`&&G(e,t,n)&&(n=0,r=i),Hi(e,t,n,r)):[]}function tc(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:X(n);return i<0&&(i=A(r+i,0)),Yn(e,U(t,3),i)}function nc(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=X(r),a=r<0?A(i+a,0):N(a,i-1)),Yn(e,U(t,3),a,!0)}function rc(e){return e!=null&&e.length?z(e,1):[]}function ic(e){return e!=null&&e.length?z(e,C):[]}function ac(e,t){return e!=null&&e.length?(t=t===n?1:X(t),z(e,t)):[]}function oc(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var i=e[t];Ai(r,i[0],i[1])}return r}function sc(e){return e&&e.length?e[0]:n}function cc(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:X(n);return i<0&&(i=A(r+i,0)),Xn(e,t,i)}function lc(e){return e!=null&&e.length?Ba(e,0,-1):[]}var uc=V(function(e){var t=I(e,eo);return t.length&&t[0]===e[0]?ta(t):[]}),dc=V(function(e){var t=mc(e),r=I(e,eo);return t===mc(r)?t=n:r.pop(),r.length&&r[0]===e[0]?ta(r,U(t,2)):[]}),fc=V(function(e){var t=mc(e),r=I(e,eo);return t=typeof t==`function`?t:n,t&&r.pop(),r.length&&r[0]===e[0]?ta(r,n,t):[]});function pc(e,t){return e==null?``:fn.call(e,t)}function mc(e){var t=e==null?0:e.length;return t?e[t-1]:n}function hc(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=X(r),a=a<0?A(i+a,0):N(a,i-1)),t===t?Dr(e,t,a):Yn(e,Qn,a,!0)}function gc(e,t){return e&&e.length?wa(e,X(t)):n}var _c=V(vc);function vc(e,t){return e&&e.length&&t&&t.length?ka(e,t):e}function yc(e,t,n){return e&&e.length&&t&&t.length?ka(e,t,U(n,2)):e}function bc(e,t,r){return e&&e.length&&t&&t.length?ka(e,t,n,r):e}var xc=Xo(function(e,t){var n=e==null?0:e.length,r=ji(e,t);return Aa(e,I(t,function(e){return gs(e,n)?+e:e}).sort(po)),r});function Sc(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,i=[],a=e.length;for(t=U(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Aa(e,i),n}function Cc(e){return e==null?e:xn.call(e)}function wc(e,t,r){var i=e==null?0:e.length;return i?(r&&typeof r!=`number`&&G(e,t,r)?(t=0,r=i):(t=t==null?0:X(t),r=r===n?i:X(r)),Ba(e,t,r)):[]}function Tc(e,t){return Ha(e,t)}function Ec(e,t,n){return Ua(e,t,U(n,2))}function Dc(e,t){var n=e==null?0:e.length;if(n){var r=Ha(e,t);if(r<n&&pu(e[r],t))return r}return-1}function Oc(e,t){return Ha(e,t,!0)}function kc(e,t,n){return Ua(e,t,U(n,2),!0)}function Ac(e,t){if(e!=null&&e.length){var n=Ha(e,t,!0)-1;if(pu(e[n],t))return n}return-1}function jc(e){return e&&e.length?Wa(e):[]}function Mc(e,t){return e&&e.length?Wa(e,U(t,2)):[]}function Nc(e){var t=e==null?0:e.length;return t?Ba(e,1,t):[]}function Pc(e,t,r){return e&&e.length?(t=r||t===n?1:X(t),Ba(e,0,t<0?0:t)):[]}function Fc(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:X(t),t=i-t,Ba(e,t<0?0:t,i)):[]}function Ic(e,t){return e&&e.length?Xa(e,U(t,3),!1,!0):[]}function Lc(e,t){return e&&e.length?Xa(e,U(t,3)):[]}var Rc=V(function(e){return qa(z(e,1,q,!0))}),zc=V(function(e){var t=mc(e);return q(t)&&(t=n),qa(z(e,1,q,!0),U(t,2))}),Bc=V(function(e){var t=mc(e);return t=typeof t==`function`?t:n,qa(z(e,1,q,!0),n,t)});function Vc(e){return e&&e.length?qa(e):[]}function Hc(e,t){return e&&e.length?qa(e,U(t,2)):[]}function Uc(e,t){return t=typeof t==`function`?t:n,e&&e.length?qa(e,n,t):[]}function Wc(e){if(!(e&&e.length))return[];var t=0;return e=Rn(e,function(e){if(q(e))return t=A(e.length,t),!0}),ar(t,function(t){return I(e,er(t))})}function Gc(e,t){if(!(e&&e.length))return[];var r=Wc(e);return t==null?r:I(r,function(e){return Nn(t,n,e)})}var Kc=V(function(e,t){return q(e)?Li(e,t):[]}),qc=V(function(e){return Qa(Rn(e,q))}),Jc=V(function(e){var t=mc(e);return q(t)&&(t=n),Qa(Rn(e,q),U(t,2))}),Yc=V(function(e){var t=mc(e);return t=typeof t==`function`?t:n,Qa(Rn(e,q),n,t)}),Xc=V(Wc);function Zc(e,t){return $a(e||[],t||[],Ti)}function Qc(e,t){return $a(e||[],t||[],Ia)}var $c=V(function(e){var t=e.length,r=t>1?e[t-1]:n;return r=typeof r==`function`?(e.pop(),r):n,Gc(e,r)});function el(e){var t=L(e);return t.__chain__=!0,t}function tl(e,t){return t(e),e}function nl(e,t){return t(e)}var rl=Xo(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return ji(t,e)};return t>1||this.__actions__.length||!(i instanceof R)||!gs(r)?this.thru(a):(i=i.slice(r,+r+ +!!t),i.__actions__.push({func:nl,args:[a],thisArg:n}),new Ur(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e}))});function il(){return el(this)}function al(){return new Ur(this.value(),this.__chain__)}function ol(){this.__values__===n&&(this.__values__=Zu(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}}function sl(){return this}function cl(e){for(var t,r=this;r instanceof Hr;){var i=Us(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t}function ll(){var e=this.__wrapped__;if(e instanceof R){var t=e;return this.__actions__.length&&(t=new R(this)),t=t.reverse(),t.__actions__.push({func:nl,args:[Cc],thisArg:n}),new Ur(t,this.__chain__)}return this.thru(Cc)}function ul(){return Za(this.__wrapped__,this.__actions__)}var dl=bo(function(e,t,n){k.call(e,n)?++e[n]:Ai(e,n,1)});function fl(e,t,r){var i=K(e)?Ln:Bi;return r&&G(e,t,r)&&(t=n),i(e,U(t,3))}function pl(e,t){return(K(e)?Rn:Ui)(e,U(t,3))}var ml=ko(tc),hl=ko(nc);function gl(e,t){return z(Tl(e,t),1)}function _l(e,t){return z(Tl(e,t),C)}function vl(e,t,r){return r=r===n?1:X(r),z(Tl(e,t),r)}function yl(e,t){return(K(e)?Fn:Ri)(e,U(t,3))}function bl(e,t){return(K(e)?In:zi)(e,U(t,3))}var xl=bo(function(e,t,n){k.call(e,n)?e[n].push(t):Ai(e,n,[t])});function Sl(e,t,n,r){e=vu(e)?e:Ud(e),n=n&&!r?X(n):0;var i=e.length;return n<0&&(n=A(i+n,0)),Uu(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Xn(e,t,n)>-1}var Cl=V(function(e,t,n){var r=-1,i=typeof t==`function`,a=vu(e)?E(e.length):[];return Ri(e,function(e){a[++r]=i?Nn(t,e,n):ra(e,t,n)}),a}),wl=bo(function(e,t,n){Ai(e,n,t)});function Tl(e,t){return(K(e)?I:ya)(e,U(t,3))}function El(e,t,r,i){return e==null?[]:(K(t)||(t=t==null?[]:[t]),r=i?n:r,K(r)||(r=r==null?[]:[r]),Ta(e,t,r))}var Dl=bo(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]});function Ol(e,t,n){var r=K(e)?Hn:nr,i=arguments.length<3;return r(e,U(t,4),n,i,Ri)}function kl(e,t,n){var r=K(e)?Un:nr,i=arguments.length<3;return r(e,U(t,4),n,i,zi)}function Al(e,t){return(K(e)?Rn:Ui)(e,Xl(U(t,3)))}function jl(e){return(K(e)?xi:Pa)(e)}function Ml(e,t,r){return t=(r?G(e,t,r):t===n)?1:X(t),(K(e)?Si:Fa)(e,t)}function Nl(e){return(K(e)?Ci:za)(e)}function Pl(e){if(e==null)return 0;if(vu(e))return Uu(e)?Or(e):e.length;var t=W(e);return t==w||t==T?e.size:ga(e).length}function Fl(e,t,r){var i=K(e)?Wn:Va;return r&&G(e,t,r)&&(t=n),i(e,U(t,3))}var Il=V(function(e,t){if(e==null)return[];var n=t.length;return n>1&&G(e,t[0],t[1])?t=[]:n>2&&G(t[0],t[1],t[2])&&(t=[t[0]]),Ta(e,z(t,1),[])}),Ll=nn||function(){return P.Date.now()};function Rl(e,t){if(typeof t!=`function`)throw new O(o);return e=X(e),function(){if(--e<1)return t.apply(this,arguments)}}function zl(e,t,r){return t=r?n:t,t=e&&t==null?e.length:t,Uo(e,te,n,n,n,n,t)}function Bl(e,t){var r;if(typeof t!=`function`)throw new O(o);return e=X(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=n),r}}var Vl=V(function(e,t,n){var r=_;if(n.length){var i=Cr(n,ts(Vl));r|=S}return Uo(e,r,t,n,i)}),Hl=V(function(e,t,n){var r=_|v;if(n.length){var i=Cr(n,ts(Hl));r|=S}return Uo(t,r,e,n,i)});function Ul(e,t,r){t=r?n:t;var i=Uo(e,b,n,n,n,n,n,t);return i.placeholder=Ul.placeholder,i}function Wl(e,t,r){t=r?n:t;var i=Uo(e,x,n,n,n,n,n,t);return i.placeholder=Wl.placeholder,i}function Gl(e,t,r){var i,a,s,c,l,u,d=0,f=!1,p=!1,m=!0;if(typeof e!=`function`)throw new O(o);t=ed(t)||0,J(r)&&(f=!!r.leading,p=`maxWait`in r,s=p?A(ed(r.maxWait)||0,t):s,m=`trailing`in r?!!r.trailing:m);function h(t){var r=i,o=a;return i=a=n,d=t,c=e.apply(o,r),c}function g(e){return d=e,l=Ps(y,t),f?h(e):c}function _(e){var n=e-u,r=e-d,i=t-n;return p?N(i,s-r):i}function v(e){var r=e-u,i=e-d;return u===n||r>=t||r<0||p&&i>=s}function y(){var e=Ll();if(v(e))return b(e);l=Ps(y,_(e))}function b(e){return l=n,m&&i?h(e):(i=a=n,c)}function x(){l!==n&&ao(l),d=0,i=u=a=l=n}function S(){return l===n?c:b(Ll())}function ee(){var e=Ll(),r=v(e);if(i=arguments,a=this,u=e,r){if(l===n)return g(u);if(p)return ao(l),l=Ps(y,t),h(u)}return l===n&&(l=Ps(y,t)),c}return ee.cancel=x,ee.flush=S,ee}var Kl=V(function(e,t){return Ii(e,1,t)}),ql=V(function(e,t,n){return Ii(e,ed(t)||0,n)});function Jl(e){return Uo(e,re)}function Yl(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw new O(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Yl.Cache||ai),n}Yl.Cache=ai;function Xl(e){if(typeof e!=`function`)throw new O(o);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 Zl(e){return Bl(2,e)}var Ql=ro(function(e,t){t=t.length==1&&K(t[0])?I(t[0],cr(U())):I(z(t,1),cr(U()));var n=t.length;return V(function(r){for(var i=-1,a=N(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return Nn(e,this,r)})}),$l=V(function(e,t){return Uo(e,S,n,t,Cr(t,ts($l)))}),eu=V(function(e,t){return Uo(e,ee,n,t,Cr(t,ts(eu)))}),tu=Xo(function(e,t){return Uo(e,ne,n,n,n,t)});function nu(e,t){if(typeof e!=`function`)throw new O(o);return t=t===n?t:X(t),V(e,t)}function ru(e,t){if(typeof e!=`function`)throw new O(o);return t=t==null?0:A(X(t),0),V(function(n){var r=n[t],i=io(n,0,t);return r&&Vn(i,r),Nn(e,this,i)})}function iu(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw new O(o);return J(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),Gl(e,t,{leading:r,maxWait:t,trailing:i})}function au(e){return zl(e,1)}function ou(e,t){return $l(to(t),e)}function su(){if(!arguments.length)return[];var e=arguments[0];return K(e)?e:[e]}function cu(e){return Ni(e,m)}function lu(e,t){return t=typeof t==`function`?t:n,Ni(e,m,t)}function uu(e){return Ni(e,f|m)}function du(e,t){return t=typeof t==`function`?t:n,Ni(e,f|m,t)}function fu(e,t){return t==null||Fi(e,t,Q(t))}function pu(e,t){return e===t||e!==e&&t!==t}var mu=Ro(Zi),hu=Ro(function(e,t){return e>=t}),gu=ia(function(){return arguments}())?ia:function(e){return Y(e)&&k.call(e,`callee`)&&!Yt.call(e,`callee`)},K=E.isArray,_u=Dn?cr(Dn):aa;function vu(e){return e!=null&&Au(e.length)&&!Ou(e)}function q(e){return Y(e)&&vu(e)}function yu(e){return e===!0||e===!1||Y(e)&&B(e)==xe}var bu=cn||Xf,xu=On?cr(On):oa;function Su(e){return Y(e)&&e.nodeType===1&&!zu(e)}function Cu(e){if(e==null)return!0;if(vu(e)&&(K(e)||typeof e==`string`||typeof e.splice==`function`||bu(e)||Gu(e)||gu(e)))return!e.length;var t=W(e);if(t==w||t==T)return!e.size;if(Ss(e))return!ga(e).length;for(var n in e)if(k.call(e,n))return!1;return!0}function wu(e,t){return sa(e,t)}function Tu(e,t,r){r=typeof r==`function`?r:n;var i=r?r(e,t):n;return i===n?sa(e,t,n,r):!!i}function Eu(e){if(!Y(e))return!1;var t=B(e);return t==we||t==Ce||typeof e.message==`string`&&typeof e.name==`string`&&!zu(e)}function Du(e){return typeof e==`number`&&dn(e)}function Ou(e){if(!J(e))return!1;var t=B(e);return t==Te||t==Ee||t==be||t==je}function ku(e){return typeof e==`number`&&e==X(e)}function Au(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=de}function J(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function Y(e){return typeof e==`object`&&!!e}var ju=kn?cr(kn):la;function Mu(e,t){return e===t||ua(e,t,rs(t))}function Nu(e,t,r){return r=typeof r==`function`?r:n,ua(e,t,rs(t),r)}function Pu(e){return Ru(e)&&e!=+e}function Fu(e){if(xs(e))throw new Dt(a);return da(e)}function Iu(e){return e===null}function Lu(e){return e==null}function Ru(e){return typeof e==`number`||Y(e)&&B(e)==De}function zu(e){if(!Y(e)||B(e)!=ke)return!1;var t=qt(e);if(t===null)return!0;var n=k.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&It.call(n)==Bt}var Bu=An?cr(An):fa;function Vu(e){return ku(e)&&e>=-de&&e<=de}var Hu=jn?cr(jn):pa;function Uu(e){return typeof e==`string`||!K(e)&&Y(e)&&B(e)==Ne}function Wu(e){return typeof e==`symbol`||Y(e)&&B(e)==Pe}var Gu=Mn?cr(Mn):ma;function Ku(e){return e===n}function qu(e){return Y(e)&&W(e)==Ie}function Ju(e){return Y(e)&&B(e)==Le}var Yu=Ro(va),Xu=Ro(function(e,t){return e<=t});function Zu(e){if(!e)return[];if(vu(e))return Uu(e)?kr(e):H(e);if(Qt&&e[Qt])return br(e[Qt]());var t=W(e);return(t==w?xr:t==T?wr:Ud)(e)}function Qu(e){return e?(e=ed(e),e===C||e===-C?(e<0?-1:1)*fe:e===e?e:0):e===0?e:0}function X(e){var t=Qu(e),n=t%1;return t===t?n?t-n:t:0}function $u(e){return e?Mi(X(e),0,me):0}function ed(e){if(typeof e==`number`)return e;if(Wu(e))return pe;if(J(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=J(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=sr(e);var n=bt.test(e);return n||St.test(e)?bn(e.slice(2),n?2:8):yt.test(e)?pe:+e}function td(e){return _o(e,Td(e))}function nd(e){return e?Mi(X(e),-de,de):e===0?e:0}function Z(e){return e==null?``:Ka(e)}var rd=xo(function(e,t){if(Ss(t)||vu(t)){_o(t,Q(t),e);return}for(var n in t)k.call(t,n)&&Ti(e,n,t[n])}),id=xo(function(e,t){_o(t,Td(t),e)}),ad=xo(function(e,t,n,r){_o(t,Td(t),e,r)}),od=xo(function(e,t,n,r){_o(t,Q(t),e,r)}),sd=Xo(ji);function cd(e,t){var n=Vr(e);return t==null?n:Oi(n,t)}var ld=V(function(e,t){e=D(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&G(t[0],t[1],a)&&(i=1);++r<i;)for(var o=t[r],s=Td(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===n||pu(d,Pt[u])&&!k.call(e,u))&&(e[u]=o[u])}return e}),ud=V(function(e){return e.push(n,Go),Nn(kd,n,e)});function dd(e,t){return Jn(e,U(t,3),Ki)}function fd(e,t){return Jn(e,U(t,3),qi)}function pd(e,t){return e==null?e:Wi(e,U(t,3),Td)}function md(e,t){return e==null?e:Gi(e,U(t,3),Td)}function hd(e,t){return e&&Ki(e,U(t,3))}function gd(e,t){return e&&qi(e,U(t,3))}function _d(e){return e==null?[]:Ji(e,Q(e))}function vd(e){return e==null?[]:Ji(e,Td(e))}function yd(e,t,r){var i=e==null?n:Yi(e,t);return i===n?r:i}function bd(e,t){return e!=null&&us(e,t,Qi)}function xd(e,t){return e!=null&&us(e,t,$i)}var Sd=Mo(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=zt.call(t)),e[t]=n},kf($)),Cd=Mo(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=zt.call(t)),k.call(e,t)?e[t].push(n):e[t]=[n]},U),wd=V(ra);function Q(e){return vu(e)?bi(e):ga(e)}function Td(e){return vu(e)?bi(e,!0):_a(e)}function Ed(e,t){var n={};return t=U(t,3),Ki(e,function(e,r,i){Ai(n,t(e,r,i),e)}),n}function Dd(e,t){var n={};return t=U(t,3),Ki(e,function(e,r,i){Ai(n,r,t(e,r,i))}),n}var Od=xo(function(e,t,n){Sa(e,t,n)}),kd=xo(function(e,t,n,r){Sa(e,t,n,r)}),Ad=Xo(function(e,t){var n={};if(e==null)return n;var r=!1;t=I(t,function(t){return t=no(t,e),r||=t.length>1,t}),_o(e,Qo(e),n),r&&(n=Ni(n,f|p|m,Ko));for(var i=t.length;i--;)Ja(n,t[i]);return n});function jd(e,t){return Nd(e,Xl(U(t)))}var Md=Xo(function(e,t){return e==null?{}:Ea(e,t)});function Nd(e,t){if(e==null)return{};var n=I(Qo(e),function(e){return[e]});return t=U(t),Da(e,n,function(e,n){return t(e,n[0])})}function Pd(e,t,r){t=no(t,e);var i=-1,a=t.length;for(a||(a=1,e=n);++i<a;){var o=e==null?n:e[Bs(t[i])];o===n&&(i=a,o=r),e=Ou(o)?o.call(e):o}return e}function Fd(e,t,n){return e==null?e:Ia(e,t,n)}function Id(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:Ia(e,t,r,i)}var Ld=Ho(Q),Rd=Ho(Td);function zd(e,t,n){var r=K(e),i=r||bu(e)||Gu(e);if(t=U(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:J(e)&&Ou(a)?Vr(qt(e)):{}}return(i?Fn:Ki)(e,function(e,r,i){return t(n,e,r,i)}),n}function Bd(e,t){return e==null?!0:Ja(e,t)}function Vd(e,t,n){return e==null?e:Ya(e,t,to(n))}function Hd(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:Ya(e,t,to(r),i)}function Ud(e){return e==null?[]:lr(e,Q(e))}function Wd(e){return e==null?[]:lr(e,Td(e))}function Gd(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=ed(r),r=r===r?r:0),t!==n&&(t=ed(t),t=t===t?t:0),Mi(ed(e),t,r)}function Kd(e,t,r){return t=Qu(t),r===n?(r=t,t=0):r=Qu(r),e=ed(e),ea(e,t,r)}function qd(e,t,r){if(r&&typeof r!=`boolean`&&G(e,t,r)&&(t=r=n),r===n&&(typeof t==`boolean`?(r=t,t=n):typeof e==`boolean`&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=Qu(e),t===n?(t=e,e=0):t=Qu(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=vn();return N(e+a*(t-e+yn(`1e-`+((a+``).length-1))),t)}return ja(e,t)}var Jd=Eo(function(e,t,n){return t=t.toLowerCase(),e+(n?Yd(t):t)});function Yd(e){return Cf(Z(e).toLowerCase())}function Xd(e){return e=Z(e),e&&e.replace(wt,mr).replace(un,``)}function Zd(e,t,r){e=Z(e),t=Ka(t);var i=e.length;r=r===n?i:Mi(X(r),0,i);var a=r;return r-=t.length,r>=0&&e.slice(r,a)==t}function Qd(e){return e=Z(e),e&&tt.test(e)?e.replace($e,hr):e}function $d(e){return e=Z(e),e&<.test(e)?e.replace(ct,`\\$&`):e}var ef=Eo(function(e,t,n){return e+(n?`-`:``)+t.toLowerCase()}),tf=Eo(function(e,t,n){return e+(n?` `:``)+t.toLowerCase()}),nf=To(`toLowerCase`);function rf(e,t,n){e=Z(e),t=X(t);var r=t?Or(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fo(on(i),n)+e+Fo(an(i),n)}function af(e,t,n){e=Z(e),t=X(t);var r=t?Or(e):0;return t&&r<t?e+Fo(t-r,n):e}function of(e,t,n){e=Z(e),t=X(t);var r=t?Or(e):0;return t&&r<t?Fo(t-r,n)+e:e}function sf(e,t,n){return n||t==null?t=0:t&&=+t,_n(Z(e).replace(ut,``),t||0)}function cf(e,t,r){return t=(r?G(e,t,r):t===n)?1:X(t),Na(Z(e),t)}function lf(){var e=arguments,t=Z(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var uf=Eo(function(e,t,n){return e+(n?`_`:``)+t.toLowerCase()});function df(e,t,r){return r&&typeof r!=`number`&&G(e,t,r)&&(t=r=n),r=r===n?me:r>>>0,r?(e=Z(e),e&&(typeof t==`string`||t!=null&&!Bu(t))&&(t=Ka(t),!t&&vr(e))?io(kr(e),0,r):e.split(t,r)):[]}var ff=Eo(function(e,t,n){return e+(n?` `:``)+Cf(t)});function pf(e,t,n){return e=Z(e),n=n==null?0:Mi(X(n),0,e.length),t=Ka(t),e.slice(n,n+t.length)==t}function mf(e,t,r){var i=L.templateSettings;r&&G(e,t,r)&&(t=n),e=Z(e),t=od({},t,i,Wo);var a=od({},t.imports,i.imports,Wo),o=Q(a),l=lr(a,o);Fn(o,function(e){if(ht.test(e))throw new Dt(c)});var u,d,f=0,p=t.interpolate||Tt,m=`__p += '`,h=At((t.escape||Tt).source+`|`+p.source+`|`+(p===it?_t:Tt).source+`|`+(t.evaluate||Tt).source+`|$`,`g`),g=`//# sourceURL=`+(k.call(t,`sourceURL`)?(t.sourceURL+``).replace(/\s/g,` `):`lodash.templateSources[`+ ++hn+`]`)+`
|
|
5
|
+
`;e.replace(h,function(t,n,r,i,a,o){return r||=i,m+=e.slice(f,o).replace(Et,gr),n&&(u=!0,m+=`' +
|
|
6
6
|
__e(`+n+`) +
|
|
7
7
|
'`),a&&(d=!0,m+=`';
|
|
8
8
|
`+a+`;
|
|
9
9
|
__p += '`),r&&(m+=`' +
|
|
10
10
|
((__t = (`+r+`)) == null ? '' : __t) +
|
|
11
11
|
'`),f=o+t.length,t}),m+=`';
|
|
12
|
-
`;var _=
|
|
12
|
+
`;var _=k.call(t,`variable`)&&t.variable;if(!_)m=`with (obj) {
|
|
13
13
|
`+m+`
|
|
14
14
|
}
|
|
15
|
-
`;else if(
|
|
15
|
+
`;else if(ht.test(_))throw new Dt(s);m=(d?m.replace(Ye,``):m).replace(Xe,`$1`).replace(Ze,`$1;`),m=`function(`+(_||`obj`)+`) {
|
|
16
16
|
`+(_?``:`obj || (obj = {});
|
|
17
17
|
`)+`var __t, __p = ''`+(u?`, __e = _.escape`:``)+(d?`, __j = Array.prototype.join;
|
|
18
18
|
function print() { __p += __j.call(arguments, '') }
|
|
19
19
|
`:`;
|
|
20
20
|
`)+m+`return __p
|
|
21
|
-
}`;var v=Tf(function(){return Dt(o,g+`return `+m).apply(n,l)});if(v.source=m,Eu(v))throw v;return v}function hf(e){return Z(e).toLowerCase()}function gf(e){return Z(e).toUpperCase()}function _f(e,t,r){if(e=Z(e),e&&(r||t===n))return or(e);if(!e||!(t=Ga(t)))return e;var i=Or(e),a=Or(t);return ro(i,ur(i,a),dr(i,a)+1).join(``)}function vf(e,t,r){if(e=Z(e),e&&(r||t===n))return e.slice(0,kr(e)+1);if(!e||!(t=Ga(t)))return e;var i=Or(e);return ro(i,0,dr(i,Or(t))+1).join(``)}function yf(e,t,r){if(e=Z(e),e&&(r||t===n))return e.replace(lt,``);if(!e||!(t=Ga(t)))return e;var i=Or(e);return ro(i,ur(i,Or(t))).join(``)}function bf(e,t){var r=re,i=ie;if(J(t)){var a=`separator`in t?t.separator:a;r=`length`in t?X(t.length):r,i=`omission`in t?Ga(t.omission):i}e=Z(e);var o=e.length;if(_r(e)){var s=Or(e);o=s.length}if(r>=o)return e;var c=r-Dr(i);if(c<1)return i;var l=s?ro(s,0,c).join(``):e.slice(0,c);if(a===n)return l+i;if(s&&(c+=l.length-c),Bu(a)){if(e.slice(c).search(a)){var u,d=l;for(a.global||(a=kt(a.source,Z(_t.exec(a))+`g`)),a.lastIndex=0;u=a.exec(d);)var f=u.index;l=l.slice(0,f===n?c:f)}}else if(e.indexOf(Ga(a),c)!=c){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i}function xf(e){return e=Z(e),e&&$e.test(e)?e.replace(Ze,Ar):e}var Sf=Eo(function(e,t,n){return e+(n?` `:``)+t.toUpperCase()}),Cf=To(`toUpperCase`);function wf(e,t,r){return e=Z(e),t=r?n:t,t===n?vr(e)?Nr(e):Kn(e):e.match(t)||[]}var Tf=H(function(e,t){try{return Mn(e,n,t)}catch(e){return Eu(e)?e:new Et(e)}}),Ef=Xo(function(e,t){return Pn(t,function(t){t=Bs(t),ki(e,t,Vl(e[t],e))}),e});function Df(e){var t=e==null?0:e.length,n=U();return e=t?L(e,function(e){if(typeof e[1]!=`function`)throw new k(o);return[n(e[0]),e[1]]}):[],H(function(n){for(var r=-1;++r<t;){var i=e[r];if(Mn(i[0],this,n))return Mn(i[1],this,n)}})}function Of(e){return Ni(Mi(e,f))}function kf(e){return function(){return e}}function Af(e,t){return e==null||e!==e?t:e}var jf=Ao(),Mf=Ao(!0);function $(e){return e}function Nf(e){return ma(typeof e==`function`?e:Mi(e,f))}function Pf(e){return ya(Mi(e,f))}function Ff(e,t){return ba(e,Mi(t,f))}var If=H(function(e,t){return function(n){return na(n,e,t)}}),Lf=H(function(e,t){return function(n){return na(e,n,t)}});function Rf(e,t,n){var r=Q(t),i=qi(t,r);n==null&&!(J(t)&&(i.length||!r.length))&&(n=t,t=e,e=this,i=qi(t,Q(t)));var a=!(J(n)&&`chain`in n)||!!n.chain,o=Ou(e);return Pn(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=go(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Bn([this.value()],arguments))})}),e}function zf(){return F._===this&&(F._=Bt),this}function Bf(){}function Vf(e){return e=X(e),H(function(t){return Ca(t,e)})}var Hf=Po(L),Uf=Po(In),Wf=Po(Un);function Gf(e){return _s(e)?$n(Bs(e)):Da(e)}function Kf(e){return function(t){return e==null?n:Ji(e,t)}}var qf=Lo(),Jf=Lo(!0);function Yf(){return[]}function Xf(){return!1}function Zf(){return{}}function Qf(){return``}function $f(){return!0}function ep(e,t){if(e=X(e),e<1||e>ue)return[];var n=pe,r=P(e,pe);t=U(t),e-=pe;for(var i=ir(r,t);++n<e;)t(n);return i}function tp(e){return K(e)?L(e,Bs):Wu(e)?[e]:go(zs(Z(e)))}function np(e){var t=++It;return Z(e)+t}var rp=No(function(e,t){return e+t},0),ip=Bo(`ceil`),ap=No(function(e,t){return e/t},1),op=Bo(`floor`);function sp(e){return e&&e.length?Bi(e,$,Xi):n}function cp(e,t){return e&&e.length?Bi(e,U(t,2),Xi):n}function lp(e){return Qn(e,$)}function up(e,t){return Qn(e,U(t,2))}function dp(e){return e&&e.length?Bi(e,$,_a):n}function fp(e,t){return e&&e.length?Bi(e,U(t,2),_a):n}var pp=No(function(e,t){return e*t},1),mp=Bo(`round`),hp=No(function(e,t){return e-t},0);function gp(e){return e&&e.length?rr(e,$):0}function _p(e,t){return e&&e.length?rr(e,U(t,2)):0}return R.after=Rl,R.ary=zl,R.assign=rd,R.assignIn=id,R.assignInWith=ad,R.assignWith=od,R.at=sd,R.before=Bl,R.bind=Vl,R.bindAll=Ef,R.bindKey=Hl,R.castArray=su,R.chain=el,R.chunk=Ws,R.compact=Gs,R.concat=Ks,R.cond=Df,R.conforms=Of,R.constant=kf,R.countBy=dl,R.create=cd,R.curry=Ul,R.curryRight=Wl,R.debounce=Gl,R.defaults=ld,R.defaultsDeep=ud,R.defer=Kl,R.delay=ql,R.difference=qs,R.differenceBy=Js,R.differenceWith=Ys,R.drop=Xs,R.dropRight=Zs,R.dropRightWhile=Qs,R.dropWhile=$s,R.fill=ec,R.filter=pl,R.flatMap=gl,R.flatMapDeep=_l,R.flatMapDepth=vl,R.flatten=rc,R.flattenDeep=ic,R.flattenDepth=ac,R.flip=Jl,R.flow=jf,R.flowRight=Mf,R.fromPairs=oc,R.functions=_d,R.functionsIn=vd,R.groupBy=xl,R.initial=lc,R.intersection=uc,R.intersectionBy=dc,R.intersectionWith=fc,R.invert=Sd,R.invertBy=Cd,R.invokeMap=Cl,R.iteratee=Nf,R.keyBy=wl,R.keys=Q,R.keysIn=Td,R.map=Tl,R.mapKeys=Ed,R.mapValues=Dd,R.matches=Pf,R.matchesProperty=Ff,R.memoize=Yl,R.merge=Od,R.mergeWith=kd,R.method=If,R.methodOf=Lf,R.mixin=Rf,R.negate=Xl,R.nthArg=Vf,R.omit=Ad,R.omitBy=jd,R.once=Zl,R.orderBy=El,R.over=Hf,R.overArgs=Ql,R.overEvery=Uf,R.overSome=Wf,R.partial=$l,R.partialRight=eu,R.partition=Dl,R.pick=Md,R.pickBy=Nd,R.property=Gf,R.propertyOf=Kf,R.pull=_c,R.pullAll=vc,R.pullAllBy=yc,R.pullAllWith=bc,R.pullAt=xc,R.range=qf,R.rangeRight=Jf,R.rearg=tu,R.reject=Al,R.remove=Sc,R.rest=nu,R.reverse=Cc,R.sampleSize=Ml,R.set=Fd,R.setWith=Id,R.shuffle=Nl,R.slice=wc,R.sortBy=Il,R.sortedUniq=jc,R.sortedUniqBy=Mc,R.split=df,R.spread=ru,R.tail=Nc,R.take=Pc,R.takeRight=Fc,R.takeRightWhile=Ic,R.takeWhile=Lc,R.tap=tl,R.throttle=iu,R.thru=nl,R.toArray=Zu,R.toPairs=Ld,R.toPairsIn=Rd,R.toPath=tp,R.toPlainObject=td,R.transform=zd,R.unary=au,R.union=Rc,R.unionBy=zc,R.unionWith=Bc,R.uniq=Vc,R.uniqBy=Hc,R.uniqWith=Uc,R.unset=Bd,R.unzip=Wc,R.unzipWith=Gc,R.update=Vd,R.updateWith=Hd,R.values=Ud,R.valuesIn=Wd,R.without=Kc,R.words=wf,R.wrap=ou,R.xor=qc,R.xorBy=Jc,R.xorWith=Yc,R.zip=Xc,R.zipObject=Zc,R.zipObjectDeep=Qc,R.zipWith=$c,R.entries=Ld,R.entriesIn=Rd,R.extend=id,R.extendWith=ad,Rf(R,R),R.add=rp,R.attempt=Tf,R.camelCase=Jd,R.capitalize=Yd,R.ceil=ip,R.clamp=Gd,R.clone=cu,R.cloneDeep=uu,R.cloneDeepWith=du,R.cloneWith=lu,R.conformsTo=fu,R.deburr=Xd,R.defaultTo=Af,R.divide=ap,R.endsWith=Zd,R.eq=pu,R.escape=Qd,R.escapeRegExp=$d,R.every=fl,R.find=ml,R.findIndex=tc,R.findKey=dd,R.findLast=hl,R.findLastIndex=nc,R.findLastKey=fd,R.floor=op,R.forEach=yl,R.forEachRight=bl,R.forIn=pd,R.forInRight=md,R.forOwn=hd,R.forOwnRight=gd,R.get=yd,R.gt=mu,R.gte=hu,R.has=bd,R.hasIn=xd,R.head=sc,R.identity=$,R.includes=Sl,R.indexOf=cc,R.inRange=Kd,R.invoke=wd,R.isArguments=gu,R.isArray=K,R.isArrayBuffer=_u,R.isArrayLike=vu,R.isArrayLikeObject=q,R.isBoolean=yu,R.isBuffer=bu,R.isDate=xu,R.isElement=Su,R.isEmpty=Cu,R.isEqual=wu,R.isEqualWith=Tu,R.isError=Eu,R.isFinite=Du,R.isFunction=Ou,R.isInteger=ku,R.isLength=Au,R.isMap=ju,R.isMatch=Mu,R.isMatchWith=Nu,R.isNaN=Pu,R.isNative=Fu,R.isNil=Lu,R.isNull=Iu,R.isNumber=Ru,R.isObject=J,R.isObjectLike=Y,R.isPlainObject=zu,R.isRegExp=Bu,R.isSafeInteger=Vu,R.isSet=Hu,R.isString=Uu,R.isSymbol=Wu,R.isTypedArray=Gu,R.isUndefined=Ku,R.isWeakMap=qu,R.isWeakSet=Ju,R.join=pc,R.kebabCase=ef,R.last=mc,R.lastIndexOf=hc,R.lowerCase=tf,R.lowerFirst=nf,R.lt=Yu,R.lte=Xu,R.max=sp,R.maxBy=cp,R.mean=lp,R.meanBy=up,R.min=dp,R.minBy=fp,R.stubArray=Yf,R.stubFalse=Xf,R.stubObject=Zf,R.stubString=Qf,R.stubTrue=$f,R.multiply=pp,R.nth=gc,R.noConflict=zf,R.noop=Bf,R.now=Ll,R.pad=rf,R.padEnd=af,R.padStart=of,R.parseInt=sf,R.random=qd,R.reduce=Ol,R.reduceRight=kl,R.repeat=cf,R.replace=lf,R.result=Pd,R.round=mp,R.runInContext=e,R.sample=jl,R.size=Pl,R.snakeCase=uf,R.some=Fl,R.sortedIndex=Tc,R.sortedIndexBy=Ec,R.sortedIndexOf=Dc,R.sortedLastIndex=Oc,R.sortedLastIndexBy=kc,R.sortedLastIndexOf=Ac,R.startCase=ff,R.startsWith=pf,R.subtract=hp,R.sum=gp,R.sumBy=_p,R.template=mf,R.times=ep,R.toFinite=Qu,R.toInteger=X,R.toLength=$u,R.toLower=hf,R.toNumber=ed,R.toSafeInteger=nd,R.toString=Z,R.toUpper=gf,R.trim=_f,R.trimEnd=vf,R.trimStart=yf,R.truncate=bf,R.unescape=xf,R.uniqueId=np,R.upperCase=Sf,R.upperFirst=Cf,R.each=yl,R.eachRight=bl,R.first=sc,Rf(R,function(){var e={};return Gi(R,function(t,n){A.call(R.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),R.VERSION=r,Pn([`bind`,`bindKey`,`curry`,`curryRight`,`partial`,`partialRight`],function(e){R[e].placeholder=R}),Pn([`drop`,`take`],function(e,t){z.prototype[e]=function(r){r=r===n?1:j(X(r),0);var i=this.__filtered__&&!t?new z(this):this.clone();return i.__filtered__?i.__takeCount__=P(r,i.__takeCount__):i.__views__.push({size:P(r,pe),type:e+(i.__dir__<0?`Right`:``)}),i},z.prototype[e+`Right`]=function(t){return this.reverse()[e](t).reverse()}}),Pn([`filter`,`map`,`takeWhile`],function(e,t){var n=t+1,r=n==se||n==le;z.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:U(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Pn([`head`,`last`],function(e,t){var n=`take`+(t?`Right`:``);z.prototype[e]=function(){return this[n](1).value()[0]}}),Pn([`initial`,`tail`],function(e,t){var n=`drop`+(t?``:`Right`);z.prototype[e]=function(){return this.__filtered__?new z(this):this[n](1)}}),z.prototype.compact=function(){return this.filter($)},z.prototype.find=function(e){return this.filter(e).head()},z.prototype.findLast=function(e){return this.reverse().find(e)},z.prototype.invokeMap=H(function(e,t){return typeof e==`function`?new z(this):this.map(function(n){return na(n,e,t)})}),z.prototype.reject=function(e){return this.filter(Xl(U(e)))},z.prototype.slice=function(e,t){e=X(e);var r=this;return r.__filtered__&&(e>0||t<0)?new z(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(t=X(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},z.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},z.prototype.toArray=function(){return this.take(pe)},Gi(z.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=R[i?`take`+(t==`last`?`Right`:``):t],o=i||/^find/.test(t);a&&(R.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof z,l=s[0],u=c||K(t),d=function(e){var t=a.apply(R,Bn([e],s));return i&&f?t[0]:t};u&&r&&typeof l==`function`&&l.length!=1&&(c=u=!1);var f=this.__chain__,p=!!this.__actions__.length,m=o&&!f,h=c&&!p;if(!o&&u){t=h?t:new z(this);var g=e.apply(t,s);return g.__actions__.push({func:nl,args:[d],thisArg:n}),new Hr(g,f)}return m&&h?e.apply(this,s):(g=this.thru(d),m?i?g.value()[0]:g.value():g)})}),Pn([`pop`,`push`,`shift`,`sort`,`splice`,`unshift`],function(e){var t=jt[e],n=/^(?:push|sort|unshift)$/.test(e)?`tap`:`thru`,r=/^(?:pop|shift)$/.test(e);R.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(K(i)?i:[],e)}return this[n](function(n){return t.apply(K(n)?n:[],e)})}}),Gi(z.prototype,function(e,t){var n=R[t];if(n){var r=n.name+``;A.call(er,r)||(er[r]=[]),er[r].push({name:t,func:n})}}),er[jo(n,v).name]=[{name:`wrapper`,func:n}],z.prototype.clone=Ur,z.prototype.reverse=Wr,z.prototype.value=Gr,R.prototype.at=rl,R.prototype.chain=il,R.prototype.commit=al,R.prototype.next=ol,R.prototype.plant=cl,R.prototype.reverse=ll,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=ul,R.prototype.first=R.prototype.head,Zt&&(R.prototype[Zt]=sl),R})();typeof define==`function`&&typeof define.amd==`object`&&define.amd?(F._=Pr,define(function(){return Pr})):Cn?((Cn.exports=Pr)._=Pr,Sn._=Pr):F._=Pr}).call(e)}))(),te=e=>{let t=(0,ee.startCase)(e).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},ne=[`src/application.config.ts`,`src/application-config.ts`,`src/applicationConfig.ts`],re=/serverVariables\s*:\s*\{/,ie=/defineApplication\s*\(\s*\{/,ae=async({projectRoot:e,variables:t})=>{let n=await oe(e);if(n===null)return{status:`skipped-no-config`};let r=await(0,i.readFile)(n,`utf8`),a=t.filter(e=>!RegExp(`\\b${e.name}\\s*:`).test(r));if(a.length===0)return{status:`skipped-existing`};let o=se(a);if(re.test(r))return await(0,i.writeFile)(n,r.replace(re,e=>`${e}\n${o}`),`utf8`),{status:`appended`,file:n};if(!ie.test(r))return{status:`skipped-no-app-call`};let s=r.replace(/\n(\s*)\}\s*\)\s*;?\s*$/,(e,t)=>`\n${t}${ce(a,t)}\n${t}});\n`);return s===r?{status:`skipped-no-app-call`}:(await(0,i.writeFile)(n,s,`utf8`),{status:`created`,file:n})},oe=async e=>{for(let n of ne){let r=`${e}/${n}`;if(await t.at(r))return r}return null},se=e=>e.map(({name:e,description:t,isSecret:n})=>` ${e}: {\n description: ${JSON.stringify(t)},\n isSecret: ${n},\n isRequired: true,\n },`).join(`
|
|
22
|
-
`),
|
|
23
|
-
`)}\n${t}},`,
|
|
21
|
+
}`;var v=Tf(function(){return Ot(o,g+`return `+m).apply(n,l)});if(v.source=m,Eu(v))throw v;return v}function hf(e){return Z(e).toLowerCase()}function gf(e){return Z(e).toUpperCase()}function _f(e,t,r){if(e=Z(e),e&&(r||t===n))return sr(e);if(!e||!(t=Ka(t)))return e;var i=kr(e),a=kr(t);return io(i,dr(i,a),fr(i,a)+1).join(``)}function vf(e,t,r){if(e=Z(e),e&&(r||t===n))return e.slice(0,Ar(e)+1);if(!e||!(t=Ka(t)))return e;var i=kr(e);return io(i,0,fr(i,kr(t))+1).join(``)}function yf(e,t,r){if(e=Z(e),e&&(r||t===n))return e.replace(ut,``);if(!e||!(t=Ka(t)))return e;var i=kr(e);return io(i,dr(i,kr(t))).join(``)}function bf(e,t){var r=ie,i=ae;if(J(t)){var a=`separator`in t?t.separator:a;r=`length`in t?X(t.length):r,i=`omission`in t?Ka(t.omission):i}e=Z(e);var o=e.length;if(vr(e)){var s=kr(e);o=s.length}if(r>=o)return e;var c=r-Or(i);if(c<1)return i;var l=s?io(s,0,c).join(``):e.slice(0,c);if(a===n)return l+i;if(s&&(c+=l.length-c),Bu(a)){if(e.slice(c).search(a)){var u,d=l;for(a.global||(a=At(a.source,Z(vt.exec(a))+`g`)),a.lastIndex=0;u=a.exec(d);)var f=u.index;l=l.slice(0,f===n?c:f)}}else if(e.indexOf(Ka(a),c)!=c){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i}function xf(e){return e=Z(e),e&&et.test(e)?e.replace(Qe,jr):e}var Sf=Eo(function(e,t,n){return e+(n?` `:``)+t.toUpperCase()}),Cf=To(`toUpperCase`);function wf(e,t,r){return e=Z(e),t=r?n:t,t===n?yr(e)?Pr(e):qn(e):e.match(t)||[]}var Tf=V(function(e,t){try{return Nn(e,n,t)}catch(e){return Eu(e)?e:new Dt(e)}}),Ef=Xo(function(e,t){return Fn(t,function(t){t=Bs(t),Ai(e,t,Vl(e[t],e))}),e});function Df(e){var t=e==null?0:e.length,n=U();return e=t?I(e,function(e){if(typeof e[1]!=`function`)throw new O(o);return[n(e[0]),e[1]]}):[],V(function(n){for(var r=-1;++r<t;){var i=e[r];if(Nn(i[0],this,n))return Nn(i[1],this,n)}})}function Of(e){return Pi(Ni(e,f))}function kf(e){return function(){return e}}function Af(e,t){return e==null||e!==e?t:e}var jf=Ao(),Mf=Ao(!0);function $(e){return e}function Nf(e){return ha(typeof e==`function`?e:Ni(e,f))}function Pf(e){return ba(Ni(e,f))}function Ff(e,t){return xa(e,Ni(t,f))}var If=V(function(e,t){return function(n){return ra(n,e,t)}}),Lf=V(function(e,t){return function(n){return ra(e,n,t)}});function Rf(e,t,n){var r=Q(t),i=Ji(t,r);n==null&&!(J(t)&&(i.length||!r.length))&&(n=t,t=e,e=this,i=Ji(t,Q(t)));var a=!(J(n)&&`chain`in n)||!!n.chain,o=Ou(e);return Fn(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=H(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Vn([this.value()],arguments))})}),e}function zf(){return P._===this&&(P._=Vt),this}function Bf(){}function Vf(e){return e=X(e),V(function(t){return wa(t,e)})}var Hf=Po(I),Uf=Po(Ln),Wf=Po(Wn);function Gf(e){return _s(e)?er(Bs(e)):Oa(e)}function Kf(e){return function(t){return e==null?n:Yi(e,t)}}var qf=Lo(),Jf=Lo(!0);function Yf(){return[]}function Xf(){return!1}function Zf(){return{}}function Qf(){return``}function $f(){return!0}function ep(e,t){if(e=X(e),e<1||e>de)return[];var n=me,r=N(e,me);t=U(t),e-=me;for(var i=ar(r,t);++n<e;)t(n);return i}function tp(e){return K(e)?I(e,Bs):Wu(e)?[e]:H(zs(Z(e)))}function np(e){var t=++Lt;return Z(e)+t}var rp=No(function(e,t){return e+t},0),ip=Bo(`ceil`),ap=No(function(e,t){return e/t},1),op=Bo(`floor`);function sp(e){return e&&e.length?Vi(e,$,Zi):n}function cp(e,t){return e&&e.length?Vi(e,U(t,2),Zi):n}function lp(e){return $n(e,$)}function up(e,t){return $n(e,U(t,2))}function dp(e){return e&&e.length?Vi(e,$,va):n}function fp(e,t){return e&&e.length?Vi(e,U(t,2),va):n}var pp=No(function(e,t){return e*t},1),mp=Bo(`round`),hp=No(function(e,t){return e-t},0);function gp(e){return e&&e.length?ir(e,$):0}function _p(e,t){return e&&e.length?ir(e,U(t,2)):0}return L.after=Rl,L.ary=zl,L.assign=rd,L.assignIn=id,L.assignInWith=ad,L.assignWith=od,L.at=sd,L.before=Bl,L.bind=Vl,L.bindAll=Ef,L.bindKey=Hl,L.castArray=su,L.chain=el,L.chunk=Ws,L.compact=Gs,L.concat=Ks,L.cond=Df,L.conforms=Of,L.constant=kf,L.countBy=dl,L.create=cd,L.curry=Ul,L.curryRight=Wl,L.debounce=Gl,L.defaults=ld,L.defaultsDeep=ud,L.defer=Kl,L.delay=ql,L.difference=qs,L.differenceBy=Js,L.differenceWith=Ys,L.drop=Xs,L.dropRight=Zs,L.dropRightWhile=Qs,L.dropWhile=$s,L.fill=ec,L.filter=pl,L.flatMap=gl,L.flatMapDeep=_l,L.flatMapDepth=vl,L.flatten=rc,L.flattenDeep=ic,L.flattenDepth=ac,L.flip=Jl,L.flow=jf,L.flowRight=Mf,L.fromPairs=oc,L.functions=_d,L.functionsIn=vd,L.groupBy=xl,L.initial=lc,L.intersection=uc,L.intersectionBy=dc,L.intersectionWith=fc,L.invert=Sd,L.invertBy=Cd,L.invokeMap=Cl,L.iteratee=Nf,L.keyBy=wl,L.keys=Q,L.keysIn=Td,L.map=Tl,L.mapKeys=Ed,L.mapValues=Dd,L.matches=Pf,L.matchesProperty=Ff,L.memoize=Yl,L.merge=Od,L.mergeWith=kd,L.method=If,L.methodOf=Lf,L.mixin=Rf,L.negate=Xl,L.nthArg=Vf,L.omit=Ad,L.omitBy=jd,L.once=Zl,L.orderBy=El,L.over=Hf,L.overArgs=Ql,L.overEvery=Uf,L.overSome=Wf,L.partial=$l,L.partialRight=eu,L.partition=Dl,L.pick=Md,L.pickBy=Nd,L.property=Gf,L.propertyOf=Kf,L.pull=_c,L.pullAll=vc,L.pullAllBy=yc,L.pullAllWith=bc,L.pullAt=xc,L.range=qf,L.rangeRight=Jf,L.rearg=tu,L.reject=Al,L.remove=Sc,L.rest=nu,L.reverse=Cc,L.sampleSize=Ml,L.set=Fd,L.setWith=Id,L.shuffle=Nl,L.slice=wc,L.sortBy=Il,L.sortedUniq=jc,L.sortedUniqBy=Mc,L.split=df,L.spread=ru,L.tail=Nc,L.take=Pc,L.takeRight=Fc,L.takeRightWhile=Ic,L.takeWhile=Lc,L.tap=tl,L.throttle=iu,L.thru=nl,L.toArray=Zu,L.toPairs=Ld,L.toPairsIn=Rd,L.toPath=tp,L.toPlainObject=td,L.transform=zd,L.unary=au,L.union=Rc,L.unionBy=zc,L.unionWith=Bc,L.uniq=Vc,L.uniqBy=Hc,L.uniqWith=Uc,L.unset=Bd,L.unzip=Wc,L.unzipWith=Gc,L.update=Vd,L.updateWith=Hd,L.values=Ud,L.valuesIn=Wd,L.without=Kc,L.words=wf,L.wrap=ou,L.xor=qc,L.xorBy=Jc,L.xorWith=Yc,L.zip=Xc,L.zipObject=Zc,L.zipObjectDeep=Qc,L.zipWith=$c,L.entries=Ld,L.entriesIn=Rd,L.extend=id,L.extendWith=ad,Rf(L,L),L.add=rp,L.attempt=Tf,L.camelCase=Jd,L.capitalize=Yd,L.ceil=ip,L.clamp=Gd,L.clone=cu,L.cloneDeep=uu,L.cloneDeepWith=du,L.cloneWith=lu,L.conformsTo=fu,L.deburr=Xd,L.defaultTo=Af,L.divide=ap,L.endsWith=Zd,L.eq=pu,L.escape=Qd,L.escapeRegExp=$d,L.every=fl,L.find=ml,L.findIndex=tc,L.findKey=dd,L.findLast=hl,L.findLastIndex=nc,L.findLastKey=fd,L.floor=op,L.forEach=yl,L.forEachRight=bl,L.forIn=pd,L.forInRight=md,L.forOwn=hd,L.forOwnRight=gd,L.get=yd,L.gt=mu,L.gte=hu,L.has=bd,L.hasIn=xd,L.head=sc,L.identity=$,L.includes=Sl,L.indexOf=cc,L.inRange=Kd,L.invoke=wd,L.isArguments=gu,L.isArray=K,L.isArrayBuffer=_u,L.isArrayLike=vu,L.isArrayLikeObject=q,L.isBoolean=yu,L.isBuffer=bu,L.isDate=xu,L.isElement=Su,L.isEmpty=Cu,L.isEqual=wu,L.isEqualWith=Tu,L.isError=Eu,L.isFinite=Du,L.isFunction=Ou,L.isInteger=ku,L.isLength=Au,L.isMap=ju,L.isMatch=Mu,L.isMatchWith=Nu,L.isNaN=Pu,L.isNative=Fu,L.isNil=Lu,L.isNull=Iu,L.isNumber=Ru,L.isObject=J,L.isObjectLike=Y,L.isPlainObject=zu,L.isRegExp=Bu,L.isSafeInteger=Vu,L.isSet=Hu,L.isString=Uu,L.isSymbol=Wu,L.isTypedArray=Gu,L.isUndefined=Ku,L.isWeakMap=qu,L.isWeakSet=Ju,L.join=pc,L.kebabCase=ef,L.last=mc,L.lastIndexOf=hc,L.lowerCase=tf,L.lowerFirst=nf,L.lt=Yu,L.lte=Xu,L.max=sp,L.maxBy=cp,L.mean=lp,L.meanBy=up,L.min=dp,L.minBy=fp,L.stubArray=Yf,L.stubFalse=Xf,L.stubObject=Zf,L.stubString=Qf,L.stubTrue=$f,L.multiply=pp,L.nth=gc,L.noConflict=zf,L.noop=Bf,L.now=Ll,L.pad=rf,L.padEnd=af,L.padStart=of,L.parseInt=sf,L.random=qd,L.reduce=Ol,L.reduceRight=kl,L.repeat=cf,L.replace=lf,L.result=Pd,L.round=mp,L.runInContext=e,L.sample=jl,L.size=Pl,L.snakeCase=uf,L.some=Fl,L.sortedIndex=Tc,L.sortedIndexBy=Ec,L.sortedIndexOf=Dc,L.sortedLastIndex=Oc,L.sortedLastIndexBy=kc,L.sortedLastIndexOf=Ac,L.startCase=ff,L.startsWith=pf,L.subtract=hp,L.sum=gp,L.sumBy=_p,L.template=mf,L.times=ep,L.toFinite=Qu,L.toInteger=X,L.toLength=$u,L.toLower=hf,L.toNumber=ed,L.toSafeInteger=nd,L.toString=Z,L.toUpper=gf,L.trim=_f,L.trimEnd=vf,L.trimStart=yf,L.truncate=bf,L.unescape=xf,L.uniqueId=np,L.upperCase=Sf,L.upperFirst=Cf,L.each=yl,L.eachRight=bl,L.first=sc,Rf(L,function(){var e={};return Ki(L,function(t,n){k.call(L.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),L.VERSION=r,Fn([`bind`,`bindKey`,`curry`,`curryRight`,`partial`,`partialRight`],function(e){L[e].placeholder=L}),Fn([`drop`,`take`],function(e,t){R.prototype[e]=function(r){r=r===n?1:A(X(r),0);var i=this.__filtered__&&!t?new R(this):this.clone();return i.__filtered__?i.__takeCount__=N(r,i.__takeCount__):i.__views__.push({size:N(r,me),type:e+(i.__dir__<0?`Right`:``)}),i},R.prototype[e+`Right`]=function(t){return this.reverse()[e](t).reverse()}}),Fn([`filter`,`map`,`takeWhile`],function(e,t){var n=t+1,r=n==ce||n==ue;R.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:U(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Fn([`head`,`last`],function(e,t){var n=`take`+(t?`Right`:``);R.prototype[e]=function(){return this[n](1).value()[0]}}),Fn([`initial`,`tail`],function(e,t){var n=`drop`+(t?``:`Right`);R.prototype[e]=function(){return this.__filtered__?new R(this):this[n](1)}}),R.prototype.compact=function(){return this.filter($)},R.prototype.find=function(e){return this.filter(e).head()},R.prototype.findLast=function(e){return this.reverse().find(e)},R.prototype.invokeMap=V(function(e,t){return typeof e==`function`?new R(this):this.map(function(n){return ra(n,e,t)})}),R.prototype.reject=function(e){return this.filter(Xl(U(e)))},R.prototype.slice=function(e,t){e=X(e);var r=this;return r.__filtered__&&(e>0||t<0)?new R(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(t=X(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},R.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},R.prototype.toArray=function(){return this.take(me)},Ki(R.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=L[i?`take`+(t==`last`?`Right`:``):t],o=i||/^find/.test(t);a&&(L.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof R,l=s[0],u=c||K(t),d=function(e){var t=a.apply(L,Vn([e],s));return i&&f?t[0]:t};u&&r&&typeof l==`function`&&l.length!=1&&(c=u=!1);var f=this.__chain__,p=!!this.__actions__.length,m=o&&!f,h=c&&!p;if(!o&&u){t=h?t:new R(this);var g=e.apply(t,s);return g.__actions__.push({func:nl,args:[d],thisArg:n}),new Ur(g,f)}return m&&h?e.apply(this,s):(g=this.thru(d),m?i?g.value()[0]:g.value():g)})}),Fn([`pop`,`push`,`shift`,`sort`,`splice`,`unshift`],function(e){var t=Mt[e],n=/^(?:push|sort|unshift)$/.test(e)?`tap`:`thru`,r=/^(?:pop|shift)$/.test(e);L.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(K(i)?i:[],e)}return this[n](function(n){return t.apply(K(n)?n:[],e)})}}),Ki(R.prototype,function(e,t){var n=L[t];if(n){var r=n.name+``;k.call(tr,r)||(tr[r]=[]),tr[r].push({name:t,func:n})}}),tr[jo(n,v).name]=[{name:`wrapper`,func:n}],R.prototype.clone=Wr,R.prototype.reverse=Gr,R.prototype.value=Kr,L.prototype.at=rl,L.prototype.chain=il,L.prototype.commit=al,L.prototype.next=ol,L.prototype.plant=cl,L.prototype.reverse=ll,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=ul,L.prototype.first=L.prototype.head,Qt&&(L.prototype[Qt]=sl),L})();typeof define==`function`&&typeof define.amd==`object`&&define.amd?(P._=Fr,define(function(){return Fr})):wn?((wn.exports=Fr)._=Fr,Cn._=Fr):P._=Fr}).call(e)}))(),ne=e=>{let t=(0,te.startCase)(e).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},re=[`src/application.config.ts`,`src/application-config.ts`,`src/applicationConfig.ts`],ie=/serverVariables\s*:\s*\{/,ae=/defineApplication\s*\(\s*\{/,oe=async({projectRoot:e,variables:t})=>{let n=await se(e);if(n===null)return{status:`skipped-no-config`};let r=await(0,i.readFile)(n,`utf8`),a=t.filter(e=>!RegExp(`\\b${e.name}\\s*:`).test(r));if(a.length===0)return{status:`skipped-existing`};let o=ce(a);if(ie.test(r))return await(0,i.writeFile)(n,r.replace(ie,e=>`${e}\n${o}`),`utf8`),{status:`appended`,file:n};if(!ae.test(r))return{status:`skipped-no-app-call`};let s=r.replace(/\n(\s*)\}\s*\)\s*;?\s*$/,(e,t)=>`\n${t}${le(a,t)}\n${t}});\n`);return s===r?{status:`skipped-no-app-call`}:(await(0,i.writeFile)(n,s,`utf8`),{status:`created`,file:n})},se=async e=>{for(let n of re){let r=`${e}/${n}`;if(await t.at(r))return r}return null},ce=e=>e.map(({name:e,description:t,isSecret:n})=>` ${e}: {\n description: ${JSON.stringify(t)},\n isSecret: ${n},\n isRequired: true,\n },`).join(`
|
|
22
|
+
`),le=(e,t)=>`serverVariables: {\n${e.map(({name:e,description:n,isSecret:r})=>`${t} ${e}: {\n${t} description: ${JSON.stringify(n)},\n${t} isSecret: ${r},\n${t} isRequired: true,\n${t} },`).join(`
|
|
23
|
+
`)}\n${t}},`,ue=({data:e})=>{let n=(0,a.v4)(),r=e.description?`\n description: '${e.description}',`:``;if(e.type===t.ht.RELATION||e.type===t.ht.MORPH_RELATION){let i=e.onDelete&&e.onDelete!==`None`,o=`import { defineField, FieldType, RelationType${i?`, OnDeleteAction`:``} } from 'twenty-sdk/define';`,s=i?`, onDelete: OnDeleteAction.${e.onDelete}`:``,c=e.type===t.ht.MORPH_RELATION?`\n morphId: '${(0,a.v4)()}',`:``;return`${o}
|
|
24
24
|
|
|
25
25
|
export default defineField({
|
|
26
26
|
universalIdentifier: '${n}',
|
|
@@ -41,7 +41,7 @@ export default defineField({
|
|
|
41
41
|
type: FieldType.${e.type},
|
|
42
42
|
objectUniversalIdentifier: '${e.objectUniversalIdentifier}',${r}
|
|
43
43
|
});
|
|
44
|
-
`},
|
|
44
|
+
`},C=e=>e.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(),de=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e);return`import { defineFrontComponent } from 'twenty-sdk/define';
|
|
45
45
|
|
|
46
46
|
// React component - implement your UI here
|
|
47
47
|
const Component = () => {
|
|
@@ -59,7 +59,7 @@ export default defineFrontComponent({
|
|
|
59
59
|
description: 'Add a description for your front component',
|
|
60
60
|
component: Component,
|
|
61
61
|
});
|
|
62
|
-
`},
|
|
62
|
+
`},fe=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e);return`import { defineLogicFunction } from 'twenty-sdk/define';
|
|
63
63
|
|
|
64
64
|
// Logic function handler - rename and implement your logic
|
|
65
65
|
const handler = async (params: {
|
|
@@ -96,7 +96,7 @@ export default defineLogicFunction({
|
|
|
96
96
|
// eventName: 'objectName.created',
|
|
97
97
|
// },
|
|
98
98
|
});
|
|
99
|
-
`},
|
|
99
|
+
`},pe=({name:e,universalIdentifier:t=(0,a.v4)(),type:n,viewUniversalIdentifier:r,targetObjectUniversalIdentifier:i})=>{let o=C(e),s;return s=n===`OBJECT`&&i?` type: NavigationMenuItemType.OBJECT,
|
|
100
100
|
targetObjectUniversalIdentifier: '${i}',`:n===`VIEW`&&r?` type: NavigationMenuItemType.VIEW,
|
|
101
101
|
viewUniversalIdentifier: '${r}',`:n===`LINK`?` type: NavigationMenuItemType.LINK,
|
|
102
102
|
link: 'https://example.com',`:n===`FOLDER`?` type: NavigationMenuItemType.FOLDER,`:` type: NavigationMenuItemType.VIEW,
|
|
@@ -109,7 +109,7 @@ export default defineNavigationMenuItem({
|
|
|
109
109
|
position: 0,
|
|
110
110
|
${s}
|
|
111
111
|
});
|
|
112
|
-
`},
|
|
112
|
+
`},me=({data:e,universalIdentifier:t=(0,a.v4)(),nameFieldUniversalIdentifier:n=(0,a.v4)()})=>`import { defineObject, FieldType } from 'twenty-sdk/define';
|
|
113
113
|
|
|
114
114
|
export const NAME_FIELD_UNIVERSAL_IDENTIFIER =
|
|
115
115
|
'${n}';
|
|
@@ -133,7 +133,7 @@ export default defineObject({
|
|
|
133
133
|
},
|
|
134
134
|
],
|
|
135
135
|
});
|
|
136
|
-
`,
|
|
136
|
+
`,he=({name:e})=>`import { defineCommandMenuItem } from 'twenty-sdk/define';
|
|
137
137
|
|
|
138
138
|
export default defineCommandMenuItem({
|
|
139
139
|
universalIdentifier: '${(0,a.v4)()}',
|
|
@@ -142,7 +142,7 @@ export default defineCommandMenuItem({
|
|
|
142
142
|
label: '${e}',
|
|
143
143
|
availabilityType: 'GLOBAL',
|
|
144
144
|
});
|
|
145
|
-
`,
|
|
145
|
+
`,ge=({name:e})=>`import { definePageLayout } from 'twenty-sdk/define';
|
|
146
146
|
|
|
147
147
|
export default definePageLayout({
|
|
148
148
|
universalIdentifier: '${(0,a.v4)()}',
|
|
@@ -155,7 +155,7 @@ export default definePageLayout({
|
|
|
155
155
|
},
|
|
156
156
|
],
|
|
157
157
|
});
|
|
158
|
-
`,
|
|
158
|
+
`,_e=({name:e})=>`import { definePageLayoutTab, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
|
|
159
159
|
|
|
160
160
|
export default definePageLayoutTab({
|
|
161
161
|
universalIdentifier: '${(0,a.v4)()}',
|
|
@@ -166,7 +166,7 @@ export default definePageLayoutTab({
|
|
|
166
166
|
layoutMode: PageLayoutTabLayoutMode.CANVAS,
|
|
167
167
|
widgets: [],
|
|
168
168
|
});
|
|
169
|
-
`,
|
|
169
|
+
`,ve=({objectLabelSingular:e,objectUniversalIdentifier:t,fieldsWidgetViewUniversalIdentifier:n})=>`import { definePageLayout, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
|
|
170
170
|
|
|
171
171
|
export default definePageLayout({
|
|
172
172
|
universalIdentifier: '${(0,a.v4)()}',
|
|
@@ -211,7 +211,7 @@ export default definePageLayout({
|
|
|
211
211
|
},
|
|
212
212
|
],
|
|
213
213
|
});
|
|
214
|
-
`,
|
|
214
|
+
`,ye=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e);return`import { defineRole } from 'twenty-sdk/define';
|
|
215
215
|
|
|
216
216
|
export const ${n.toUpperCase().replace(/-/g,`_`)}_ROLE_UNIVERSAL_IDENTIFIER =
|
|
217
217
|
'${t}';
|
|
@@ -225,7 +225,7 @@ export default defineRole({
|
|
|
225
225
|
canSoftDeleteAllObjectRecords: true,
|
|
226
226
|
canDestroyAllObjectRecords: false,
|
|
227
227
|
});
|
|
228
|
-
`},
|
|
228
|
+
`},be=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e);return`import { defineAgent } from 'twenty-sdk/define';
|
|
229
229
|
|
|
230
230
|
export const ${n.toUpperCase().replace(/-/g,`_`)}_AGENT_UNIVERSAL_IDENTIFIER =
|
|
231
231
|
'${t}';
|
|
@@ -238,7 +238,7 @@ export default defineAgent({
|
|
|
238
238
|
prompt: 'Add the agent system prompt here',
|
|
239
239
|
responseFormat: {type: 'text'},
|
|
240
240
|
});
|
|
241
|
-
`},
|
|
241
|
+
`},xe=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e),r=n.toUpperCase().replace(/-/g,`_`);return`import { defineConnectionProvider } from 'twenty-sdk/define';
|
|
242
242
|
|
|
243
243
|
export const ${r}_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER =
|
|
244
244
|
'${t}';
|
|
@@ -258,7 +258,7 @@ export default defineConnectionProvider({
|
|
|
258
258
|
clientSecretVariable: '${r}_CLIENT_SECRET',
|
|
259
259
|
},
|
|
260
260
|
});
|
|
261
|
-
`},
|
|
261
|
+
`},Se=({name:e,universalIdentifier:t=(0,a.v4)()})=>{let n=C(e);return`import { defineSkill } from 'twenty-sdk/define';
|
|
262
262
|
|
|
263
263
|
export const ${n.toUpperCase().replace(/-/g,`_`)}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
264
264
|
'${t}';
|
|
@@ -270,7 +270,7 @@ export default defineSkill({
|
|
|
270
270
|
description: 'Add a description for your skill',
|
|
271
271
|
content: 'Add the skill content here',
|
|
272
272
|
});
|
|
273
|
-
`},
|
|
273
|
+
`},Ce=({field:e,index:t,objectUniversalIdentifier:n})=>{let r=e.universalIdentifier??(0,a.v4)(),i=e.position??t,o=e.isVisible??!0,s=e.size??200;return` {
|
|
274
274
|
universalIdentifier: '${r}',
|
|
275
275
|
${`defaultFieldName`in e?` fieldMetadataUniversalIdentifier: generateDefaultFieldUniversalIdentifier({
|
|
276
276
|
objectUniversalIdentifier: '${n}',
|
|
@@ -279,8 +279,8 @@ ${`defaultFieldName`in e?` fieldMetadataUniversalIdentifier: generateDefaultF
|
|
|
279
279
|
position: ${i},
|
|
280
280
|
isVisible: ${o},
|
|
281
281
|
size: ${s},
|
|
282
|
-
}`},
|
|
283
|
-
${r.map((e,t)=>
|
|
282
|
+
}`},we=({name:e,universalIdentifier:t=(0,a.v4)(),objectUniversalIdentifier:n=`fill-later`,fields:r=[],type:i})=>{let o=C(e),s=r.some(e=>`defaultFieldName`in e),c=r.length>0?` fields: [
|
|
283
|
+
${r.map((e,t)=>Ce({field:e,index:t,objectUniversalIdentifier:n})).join(`,
|
|
284
284
|
`)},
|
|
285
285
|
],`:` // fields: [
|
|
286
286
|
// {
|
|
@@ -317,7 +317,7 @@ ${c}
|
|
|
317
317
|
// },
|
|
318
318
|
// ],
|
|
319
319
|
});
|
|
320
|
-
`},
|
|
320
|
+
`},Te=({universalIdentifier:e=(0,a.v4)()})=>`import {
|
|
321
321
|
defineViewField,
|
|
322
322
|
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
|
323
323
|
} from 'twenty-sdk/define';
|
|
@@ -332,10 +332,10 @@ export default defineViewField({
|
|
|
332
332
|
isVisible: true,
|
|
333
333
|
size: 150,
|
|
334
334
|
});
|
|
335
|
-
`,
|
|
336
|
-
`)));break}}buildRecordPageFieldsViewFields(e){let t=[`createdAt`,`updatedAt`,`createdBy`,`updatedBy`].map(e=>({defaultFieldName:e,isVisible:!0,size:200}));return(e?[{fieldMetadataUniversalIdentifier:e,isVisible:!0,size:200},...t]:t).map((e,t)=>({...e,position:t}))}async getEntity(){let{entity:e}=await
|
|
337
|
-
`);let e=
|
|
338
|
-
`,
|
|
335
|
+
`,Ee=`src/application.config.ts`,w=`src`,De=class{async execute(e,n){try{let a=e??await this.getEntity(),o=this.getFolderName(a),s=n?(0,r.join)(t.vt,n):(0,r.join)(t.vt,w,o);await t.it(s);let{name:c,file:l}=await this.getEntityData(a),d=(0,r.join)(s,this.getFileName(c,a));if(await t.at(d)){let{overwrite:e}=await this.handleFileExist();if(!e)return}await(0,i.writeFile)(d,l),console.log(u.default.green(`✓ Created ${o}:`),u.default.cyan((0,r.relative)(t.vt,d))),a===t.ct.Object&&await this.promptAndCreateObjectCompanions(c,n),a===t.ct.ConnectionProvider&&await this.registerConnectionProviderServerVariables(c)}catch(e){console.error(u.default.red(`Add new entity failed:`),e instanceof Error?e.message:e),process.exit(1)}}async getEntityData(e){switch(e){case t.ct.Object:{let e=await this.getObjectData(),t=e.nameSingular,n=(0,a.v4)(),r=(0,a.v4)();return this.lastObjectUniversalIdentifier=n,this.lastNameFieldUniversalIdentifier=r,this.lastObjectLabelSingular=e.labelSingular,{name:t,file:me({data:e,name:t,universalIdentifier:n,nameFieldUniversalIdentifier:r})}}case t.ct.Field:{let e=await this.getFieldData(),t=e.name;return{name:t,file:ue({data:e,name:t})}}case t.ct.LogicFunction:{let t=await this.getEntityName(e);return{name:t,file:fe({name:t})}}case t.ct.FrontComponent:{let t=await this.getEntityName(e);return{name:t,file:de({name:t})}}case t.ct.Role:{let t=await this.getEntityName(e);return{name:t,file:ye({name:t})}}case t.ct.Skill:{let t=await this.getEntityName(e);return{name:t,file:Se({name:t})}}case t.ct.Agent:{let t=await this.getEntityName(e);return{name:t,file:be({name:t})}}case t.ct.ConnectionProvider:{let t=await this.getEntityName(e);return{name:t,file:xe({name:t})}}case t.ct.View:{let e=(await this.getViewData()).name;return{name:e,file:we({name:e})}}case t.ct.ViewField:return{name:await this.getEntityName(e),file:Te({})};case t.ct.NavigationMenuItem:{let t=await this.getEntityName(e);return{name:t,file:pe({name:t})}}case t.ct.PageLayout:{let t=await this.getEntityName(e);return{name:t,file:ge({name:t})}}case t.ct.PageLayoutTab:{let t=await this.getEntityName(e);return{name:t,file:_e({name:t})}}case t.ct.CommandMenuItem:{let t=await this.getEntityName(e);return{name:t,file:he({name:t})}}default:t.dt(e)}}async promptAndCreateObjectCompanions(e,n){let{createCompanions:o}=await d.default.prompt([{type:`confirm`,name:`createCompanions`,message:`Also create a view, navigation menu item, and record page layout for this object? (recommended)`,default:!0}]);if(!o||!this.lastObjectUniversalIdentifier)return;let s=(0,a.v4)(),c=(0,a.v4)(),l=we({name:`all-${C(e)}`,universalIdentifier:s,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),f=n?(0,r.join)(t.vt,n):(0,r.join)(t.vt,w,this.getFolderName(t.ct.View));await t.it(f);let p=(0,r.join)(f,`all-${C(e)}.ts`);if(await t.at(p)){let{overwrite:e}=await this.handleFileExist();if(!e)return}await(0,i.writeFile)(p,l),console.log(u.default.green(`✓ Created view:`),u.default.cyan((0,r.relative)(t.vt,p)));let m=this.buildRecordPageFieldsViewFields(this.lastNameFieldUniversalIdentifier),h=we({name:`${C(e)}-record-page-fields`,universalIdentifier:c,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,type:t.pt.FIELDS_WIDGET,fields:m}),g=(0,r.join)(f,`${C(e)}-record-page-fields.ts`);if(await t.at(g)){let{overwrite:e}=await this.handleFileExist();if(!e)return}await(0,i.writeFile)(g,h),console.log(u.default.green(`✓ Created record-page-fields view:`),u.default.cyan((0,r.relative)(t.vt,g)));let _=pe({name:e,type:`OBJECT`,targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),v=n?(0,r.join)(t.vt,n):(0,r.join)(t.vt,w,this.getFolderName(t.ct.NavigationMenuItem));await t.it(v);let y=(0,r.join)(v,`${C(e)}.ts`);if(await t.at(y)){let{overwrite:e}=await this.handleFileExist();if(!e)return}await(0,i.writeFile)(y,_),console.log(u.default.green(`✓ Created navigation menu item:`),u.default.cyan((0,r.relative)(t.vt,y)));let b=ve({objectLabelSingular:this.lastObjectLabelSingular??e,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fieldsWidgetViewUniversalIdentifier:c}),x=n?(0,r.join)(t.vt,n):(0,r.join)(t.vt,w,this.getFolderName(t.ct.PageLayout));await t.it(x);let S=(0,r.join)(x,`${C(e)}-record-page-layout.ts`);if(await t.at(S)){let{overwrite:e}=await this.handleFileExist();if(!e)return}await(0,i.writeFile)(S,b),console.log(u.default.green(`✓ Created record page layout:`),u.default.cyan((0,r.relative)(t.vt,S)))}async registerConnectionProviderServerVariables(e){let n=C(e).toUpperCase().replace(/-/g,`_`),i=[{name:`${n}_CLIENT_ID`,description:`OAuth client ID issued by the third-party provider. Filled in once by the server admin on the application registration.`,isSecret:!1},{name:`${n}_CLIENT_SECRET`,description:`OAuth client secret issued by the third-party provider. Stored encrypted; never echoed in API responses.`,isSecret:!0}],a=await oe({projectRoot:t.vt,variables:i});switch(a.status){case`appended`:case`created`:console.log(u.default.green(`✓ Added ${i.map(e=>e.name).join(` + `)} to defineApplication.serverVariables:`),u.default.cyan((0,r.relative)(t.vt,a.file)));break;case`skipped-existing`:console.log(u.default.dim(` (${i.map(e=>e.name).join(` / `)} already declared on defineApplication.serverVariables)`));break;case`skipped-no-config`:case`skipped-no-app-call`:console.log(u.default.yellow(`! Couldn't auto-update ${Ee}. Add these manually to defineApplication.serverVariables:\n`+i.map(e=>` ${e.name}: { description: '...', isSecret: ${e.isSecret}, isRequired: true },`).join(`
|
|
336
|
+
`)));break}}buildRecordPageFieldsViewFields(e){let t=[`createdAt`,`updatedAt`,`createdBy`,`updatedBy`].map(e=>({defaultFieldName:e,isVisible:!0,size:200}));return(e?[{fieldMetadataUniversalIdentifier:e,isVisible:!0,size:200},...t]:t).map((e,t)=>({...e,position:t}))}async getEntity(){let{entity:e}=await d.default.prompt([{type:`select`,name:`entity`,message:`What entity do you want to create?`,default:``,choices:Object.values(t.ct)}]);return e}async handleFileExist(){return await d.default.prompt([{type:`confirm`,name:`overwrite`,message:`File already exists. Do you want to overwrite it?`,default:!1}])}async getEntityName(e){let{name:t}=await d.default.prompt([{type:`input`,name:`name`,message:`Enter a name for your new ${e}:`,default:``,validate:t=>t.length===0?`${e} name is required`:!0}]);return t}async getFieldData(){let e=e=>e===t.ht.RELATION||e===t.ht.MORPH_RELATION;return d.default.prompt([{type:`input`,name:`name`,message:`Enter a name for your field:`,default:``,validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`input`,name:`label`,message:`Enter a label for your field:`,default:e=>ne(e.name),validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`select`,name:`type`,message:`Select the field type:`,choices:Object.values(t.ht),default:t.ht.TEXT},{type:`input`,name:`objectUniversalIdentifier`,message:`Enter the universalIdentifier of the object this field belongs to:`,default:`fill-later`,validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`input`,name:`description`,message:`Enter a description for your field (optional):`,default:``},{type:`input`,name:`relationTargetObjectMetadataUniversalIdentifier`,message:`Enter the universalIdentifier of the target object of the relation:`,default:`fill-later`,when:t=>e(t.type),validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`input`,name:`relationTargetFieldMetadataUniversalIdentifier`,message:`Enter the universalIdentifier of the target field on the related object:`,default:`fill-later`,when:t=>e(t.type),validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`select`,name:`relationType`,message:`Select the relation type:`,choices:Object.values(t._t),default:t._t.ONE_TO_MANY,when:t=>e(t.type)},{type:`select`,name:`onDelete`,message:`Select the onDelete behavior:`,choices:Object.values(t.gt),default:t.gt.CASCADE,when:t=>e(t.type)}])}async getObjectData(){return d.default.prompt([{type:`input`,name:`nameSingular`,message:`Enter a name singular for your object (eg: company):`,default:``,validate:e=>!e||e.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:(e,t)=>e.trim()===t?.nameSingular.trim()?`Name plural must be different from name singular`:!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`input`,name:`labelSingular`,message:`Enter a label singular for your object:`,default:e=>ne(e.nameSingular),validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0},{type:`input`,name:`labelPlural`,message:`Enter a label plural for your object:`,default:e=>ne(e.namePlural),validate:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0}])}async getViewData(){return d.default.prompt([{type:`input`,name:`name`,message:`Enter a name for your view:`,default:``,validate:e=>!e||e.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:e=>!e||e.trim().length===0?`Please enter a non empty string`:!0}])}getFolderName(e){return`${C(e)}s`}getFileName(e,n){switch(n){case t.ct.FrontComponent:return`${C(e)}.tsx`;default:return`${C(e)}.ts`}}},Oe=class{async execute(e){let n=e.appPath??t.vt;await y(n),console.log(u.default.blue(`Building application...`)),console.log(u.default.gray(`App path: ${n}\n`));let r=await t.U({appPath:n,tarball:e.tarball,onProgress:e=>console.log(u.default.gray(e))});r.success||(console.error(u.default.red(r.error.message)),process.exit(1)),console.log(u.default.green(`✓ Build succeeded (${r.data.fileCount} file${r.data.fileCount===1?``:`s`})`)),console.log(u.default.gray(`Output: ${r.data.outputDir}`)),r.data.tarballPath&&console.log(u.default.gray(`Tarball: ${r.data.tarballPath}`))}},ke=class{async execute({appPath:e=t.vt,postInstall:r=!1,preInstall:i=!1,functionUniversalIdentifier:a,functionName:o,payload:s=`{}`}){let c;try{c=JSON.parse(s)}catch{console.error(u.default.red(`Invalid JSON payload. Please provide valid JSON.`)),process.exit(1)}let l=r?`post install`:i?`pre install`:a??o,d=t.V.getActiveRemote();console.log(u.default.blue(`🚀 Executing function "${l}" on ${d}...`)),console.log(u.default.gray(` Payload: ${JSON.stringify(c)}\n`));let f=await t.h(r?{appPath:e,postInstall:!0,payload:c}:i?{appPath:e,preInstall:!0,payload:c}:a?{appPath:e,functionUniversalIdentifier:a,payload:c}:{appPath:e,functionName:o,payload:c});if(!f.success){switch(f.error.code){case t.W.MANIFEST_NOT_FOUND:console.error(u.default.red(`Failed to build manifest.`));break;case t.K.FETCH_FUNCTIONS_FAILED:console.error(u.default.red(`Failed to fetch functions:`),f.error.message);break;case t.K.FUNCTION_NOT_FOUND:{console.error(u.default.red(f.error.message),`
|
|
337
|
+
`);let e=f.error.details?.availableFunctions??[];e.length>0?(console.log(u.default.cyan(`Available functions:`)),e.forEach(e=>{console.log(` - ${u.default.white(e.name)} (${e.universalIdentifier})`)})):console.log(u.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case t.K.EXECUTION_FAILED:console.error(u.default.red(`Execution failed:`),f.error.message);break;default:console.error(u.default.red(f.error.message))}process.exit(1)}let p=f.data;console.log(u.default.cyan(`─`.repeat(60))),console.log(u.default.cyan(`Execution Result`)),console.log(u.default.cyan(`─`.repeat(60)));let m=p.status===`SUCCESS`?u.default.green:u.default.red;console.log(`${u.default.bold(`Status:`)} ${m(p.status)}`),console.log(`${u.default.bold(`Duration:`)} ${p.duration}ms\n`),n.t(p.data)&&(console.log(u.default.bold(`Data:`)),console.log(u.default.white(JSON.stringify(p.data,null,2)))),p.error&&(console.log(u.default.bold.red(`Error:`)),console.log(u.default.red(` Type: ${p.error.errorType}`)),console.log(u.default.red(` Message: ${p.error.errorMessage}\n`)),p.error.stackTrace&&(console.log(u.default.gray(`Stack trace:`)),console.log(u.default.gray(p.error.stackTrace)))),p.logs&&(console.log(u.default.bold(`Logs:`)),console.log(u.default.gray(p.logs))),console.log(u.default.cyan(`─`.repeat(60))),p.status!==`SUCCESS`&&process.exit(1)}},Ae=class{constructor(){this.apiService=new t.L}async execute({appPath:e=t.vt,functionUniversalIdentifier:n,functionName:r}){try{let i=await t.N(e);i||process.exit(1),this.logWatchInfo({appName:i.application.displayName,functionUniversalIdentifier:n,functionName:r}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:i.application.universalIdentifier,functionUniversalIdentifier:n,functionName:r})}catch(e){console.error(u.default.red(`Watch logs failed:`),e instanceof Error?e.message:e),process.exit(1)}}logWatchInfo({appName:e,functionUniversalIdentifier:n,functionName:r}){let i=e??`Twenty Application`,a=n||r?`function "${n||r}"`:`functions`,o=t.V.getActiveRemote();console.log(u.default.blue(`🚀 Watching ${i} ${a} logs on ${o}:\n`))}},je=e=>`${u.default.cyan(e.file)}:${u.default.yellow(String(e.line))}:${u.default.yellow(String(e.column+1))} - ${u.default.red(`error`)} ${e.text}`,Me=class{async execute(e){let n=e.appPath??t.vt;console.log(u.default.blue(`Running type check...`)),console.log(u.default.gray(`App path: ${n}\n`));let r=await t.tt(n);r.length===0&&(console.log(u.default.green(`✓ No type errors found`)),process.exit(0));for(let e of r)console.log(je(e));console.log(`
|
|
338
|
+
`,u.default.red(`✗ Found ${r.length} type error${r.length===1?``:`s`}`)),process.exit(1)}},T=(e,t)=>console.warn(u.default.yellow(`⚠ \`twenty ${e}\` is deprecated. Use \`twenty ${t}\` instead.`)),Ne=e=>{let t=new Oe,n=new Me,r=new Ae,i=new ke,a=new De,o=new b,s=new x,c=new S;e.command(`build [appPath]`,{hidden:!0}).option(`--tarball`,`Also pack into a .tgz tarball`).action(async(e,n)=>{T(`build`,`dev:build`),await t.execute({appPath:g(e),tarball:n.tarball})}),e.command(`typecheck [appPath]`,{hidden:!0}).action(async e=>{T(`typecheck`,`dev:typecheck`),await n.execute({appPath:g(e)})}),e.command(`logs [appPath]`,{hidden:!0}).option(`-u, --functionUniversalIdentifier <functionUniversalIdentifier>`,`Only show logs for the function with this universal ID`).option(`-n, --functionName <functionName>`,`Only show logs for the function with this name`).action(async(e,t)=>{T(`logs`,`dev:function:logs`),await r.execute({...t,appPath:g(e)})}),e.command(`exec [appPath]`,{hidden:!0}).option(`--postInstall`,`Execute post-install logic function if defined`).option(`--preInstall`,`Execute pre-install logic function if defined`).option(`-p, --payload <payload>`,`JSON payload to send to the function`,`{}`).option(`-u, --functionUniversalIdentifier <functionUniversalIdentifier>`,`Universal ID of the function to execute`).option(`-n, --functionName <functionName>`,`Name of the function to execute`).action(async(e,t)=>{T(`exec`,`dev:function:exec`),!t?.postInstall&&!t?.preInstall&&!t?.functionUniversalIdentifier&&!t?.functionName&&(console.error(u.default.red(`Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.`)),process.exit(1)),await i.execute({...t,payload:t?.payload??`{}`,appPath:g(e)})}),e.command(`add [entityType]`,{hidden:!0}).option(`--path <path>`,`Path in which the entity should be created.`).action(async(e,t)=>{T(`add`,`dev:add`),await a.execute(e,t?.path)}),e.command(`publish [appPath]`,{hidden:!0}).option(`--tag <tag>`,`npm dist-tag (e.g. beta, next)`).action(async(e,t)=>{T(`publish`,`app:publish`),await o.execute({appPath:g(e),tag:t.tag})}),e.command(`deploy [appPath]`,{hidden:!0}).option(`-r, --remote <name>`,`Deploy to a specific remote`).action(async(e,t)=>{T(`deploy`,`app:publish --private`),await o.execute({appPath:g(e),private:!0,remote:t.remote})}),e.command(`install [appPath]`,{hidden:!0}).option(`-r, --remote <name>`,`Install on a specific remote`).action(async(e,t)=>{T(`install`,`app:install`),await s.execute({appPath:g(e),remote:t.remote})}),e.command(`uninstall [appPath]`,{hidden:!0}).option(`-y, --yes`,`Skip confirmation prompt`).action(async(e,t)=>{T(`uninstall`,`app:uninstall`);try{let n=await c.execute({appPath:g(e),askForConfirmation:!t?.yes});process.exit(+!n.success)}catch{process.exit(1)}}),e.command(`catalog-sync`,{hidden:!0}).option(`-r, --remote <name>`,`Sync on a specific remote`).action(async e=>{T(`catalog-sync`,`dev:catalog-sync`);let{CatalogSyncCommand:t}=await Promise.resolve().then(()=>require("./catalog-sync-w6yKppKP.js"));await new t().execute({remote:e.remote})})},Pe=class{constructor({state:e,notify:t}){this.state=e,this.notify=t}async execute(e){let n=this.state.steps.buildManifest;n.status=`in_progress`,this.state.updatePipeline({status:`building`});let r=[{message:`Building manifest`,status:`info`}],i=await t.Z(e.appPath);if(!i.success){for(let e of i.errors)r.push({message:e,status:`error`});return n.output={result:null},n.status=`error`,this.state.updatePipeline({status:`error`}),this.state.applyStepEvents(r),null}if(i.warnings.length>0)for(let e of i.warnings)r.push({message:`⚠ ${e}`,status:`warning`});r.push({message:`Successfully built manifest`,status:`success`});let a={manifest:i.manifest,filePaths:i.filePaths};return n.output={result:a},n.status=`done`,this.state.updatePipeline({appName:i.manifest.application.displayName}),this.state.updateEntitiesFromManifest(i.filePaths),this.state.applyStepEvents(r),a}},Fe=class{constructor({apiService:e,state:t,notify:n}){this.hasRetried=!1,this.apiService=e,this.state=t,this.notify=n}async execute(){let e=this.state.steps.checkServer,r=await this.apiService.validateAuth();if(!r.serverUp){let n=await t.p();return n&&!this.hasRetried?(this.hasRetried=!0,await new t.V().setConfig({apiUrl:n}),this.execute()):(e.output.errorLogged||(e.output={isReady:!1,errorLogged:!0},e.status=`error`,this.state.applyStepEvents([{message:`Cannot reach Twenty server.
|
|
339
339
|
|
|
340
340
|
Start a local server:
|
|
341
341
|
yarn twenty docker:start
|
|
@@ -343,11 +343,11 @@ export default defineViewField({
|
|
|
343
343
|
Check server status:
|
|
344
344
|
yarn twenty docker:status
|
|
345
345
|
|
|
346
|
-
Waiting for server...`,status:`error`}]),this.state.updatePipeline({status:`error`})),!1)}if(!
|
|
347
|
-
`);this.buffer=t.pop()??``;for(let e of t)this.processLine(e)}processLine(e){if(e.includes(`Starting compilation in watch mode...`)||e.includes(`Starting incremental compilation...`)){this.pendingErrors=[];return}if(e.includes(`Watching for file changes.`)){let e=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||e)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}let n=t.Z(e);n&&this.pendingErrors.push(n)}},ze=new Set([`node_modules`,`dist`,`.twenty`]),Be=class{constructor(e){this.watcher=null,this.appPath=e.appPath,this.handleChangeDetected=e.handleChangeDetected,this.verbose=e.verbose??!1}async start(){let e=this.appPath;this.watcher=d.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:t=>{let r=(0,n.relative)(e,t);if(r===``)return!1;let i=r.split(n.default.sep)[0];return ze.has(i)||i.startsWith(`.`)},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on(`all`,(e,r)=>{if(e===`addDir`||e===`unlinkDir`)return;let i=(0,n.relative)(this.appPath,r),a=i.startsWith(t.pt),o=[`package.json`,`yarn.lock`].includes(i);!(i.endsWith(`.ts`)||i.endsWith(`.tsx`))&&!a&&!o||this.handleChangeDetected(i,e)})}async close(){await this.watcher?.close()}},Ve=class{constructor(e){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=e.state,this.scheduleSync=e.scheduleSync,this.notify=e.notify,this.onFileBuilt=e.onFileBuilt,this.shouldSkipTypecheck=e.shouldSkipTypecheck,this.verbose=e.verbose??!1}async start(){this.state.steps.startWatchers.status=`in_progress`,this.notify(),this.manifestWatcher=new Be({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(e){let{logicFunctions:t,frontComponents:n}=e.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status=`done`,await this.startFileWatchers(t,n);return}this.logicFunctionsWatcher?.shouldRestart(t)&&await this.logicFunctionsWatcher.restart(t),this.frontComponentsWatcher?.shouldRestart(n)&&await this.frontComponentsWatcher.restart(n)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(e,t){this.state.addEvent({message:`Change detected: ${e}`,status:`info`,spacingBefore:!0}),t===`unlink`?this.state.removeEntity(e):this.state.updateEntityStatus(e,`building`),this.notify(),this.scheduleSync()}handleFileBuildError(e){this.state.addEvent({message:`Build failed:`,status:`error`});for(let t of e)this.state.addEvent({message:t.error,status:`error`});this.notify()}handleFileBuilt(e){this.verbose&&this.state.addEvent({message:`Successfully built ${e.builtPath}`,status:`success`}),this.state.steps.uploadFiles.output.builtFileInfos.set(e.builtPath,{checksum:e.checksum,builtPath:e.builtPath,sourcePath:e.sourcePath,fileFolder:e.fileFolder,usesSdkClient:e.usesSdkClient}),this.onFileBuilt(e),this.notify(),this.scheduleSync()}async startFileWatchers(e,t){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(e),this.startFrontComponentsWatcher(t),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(e){this.logicFunctionsWatcher=t.X({appPath:this.state.appPath,sourcePaths:e,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(e){this.frontComponentsWatcher=t.Y({appPath:this.state.appPath,sourcePaths:e,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Le({appPath:this.state.appPath,fileFolder:t.ct.PublicAsset,watchPaths:[t.pt],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Le({appPath:this.state.appPath,fileFolder:t.ct.Dependencies,watchPaths:[`package.json`,`yarn.lock`],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new Re({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(e){e.length===0?this.state.addEvent({message:`Typecheck passed`,status:`success`}):this.state.applyStepEvents(e.map(e=>({message:`Type error in ${e.file}(${e.line},${e.column}): ${e.text}`,status:`error`}))),this.notify()}},He=class{constructor({apiService:e,state:t,notify:n,verbose:r}){this.apiService=e,this.state=t,this.notify=n,this.verbose=r??!1}async execute(e){let n=this.state.steps.syncApplication;n.status=`in_progress`,this.state.updatePipeline({status:`syncing`});let r=[],i=t.q({manifest:e.manifest,builtFileInfos:e.builtFileInfos});r.push({message:`Manifest checksums set`,status:`info`}),await t.K(e.appPath,i),r.push({message:`Manifest saved to output directory`,status:`info`}),r.push({message:`Syncing manifest`,status:`info`});let a=await this.apiService.syncApplication(i);if(a.success){let e=a.data;r.push(...t.c(e.actions)),r.push({message:`✓ Synced`,status:`success`}),n.output={syncStatus:`synced`,error:null},n.status=`done`,this.state.updatePipeline({status:`synced`,error:null}),this.state.updateAllEntitiesStatus(`success`),this.state.applyStepEvents(r);return}let o=this.verbose?null:t.j(a.error);o?(r.push(...o),r.push({message:`Add --verbose to see full error log`,status:`info`})):r.push({message:`Sync failed with error: ${a.message??`Sync failed`}`,status:`error`});let s=t.s(a.message);s&&r.push({message:s,status:`info`});let c=o?o[0].message:`Sync failed`;n.output={syncStatus:`error`,error:c},n.status=`error`,this.state.updatePipeline({status:`error`,error:c}),this.state.updateAllEntitiesStatus(`error`),this.state.applyStepEvents(r)}},Ue=class{constructor({state:e,notify:t,verbose:n}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=e,this.notify=t,this.verbose=n??!1}get isInitialized(){return t.tt(this.state.steps.uploadFiles.output.fileUploader)}initialize(e){let n=this.state.steps.uploadFiles;n.output={...n.output,fileUploader:new t.o({appPath:e.appPath,applicationUniversalIdentifier:e.universalIdentifier})},n.status=`in_progress`,this.notify(),this.uploadPendingFiles()}uploadFile(e,t,n){let r=this.state.steps.uploadFiles;if(!r.output.fileUploader)return;r.status=`in_progress`,this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${e}`,status:`info`}),this.state.updateEntityStatus(t,`uploading`),this.notify();let i=r.output.fileUploader.uploadFile({builtPath:e,fileFolder:n}).then(n=>{n.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${e}`,status:`success`}),this.state.updateEntityStatus(t,`success`)):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${e}: ${n.error}`,status:`error`}))}).catch(t=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${e}: ${t}`,status:`error`})}).finally(()=>{r.output.activeUploads.delete(i),r.output.activeUploads.size===0&&(this.logUploadSummary(),r.status=`done`,this.notify())});r.output.activeUploads.add(i)}async waitForUploads(){let e=this.state.steps.uploadFiles;for(;e.output.activeUploads.size>0;)await Promise.all(e.output.activeUploads);e.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(let[e,{fileFolder:t,sourcePath:n}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(e,n,t)}},We=class{constructor(e){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=e.debounceMs??1e3,this.state=e.state,this.verbose=e.verbose??!1,this.apiService=new t.I({disableInterceptors:!0});let n=this.apiService,r=new t.R;this.clientService=new t.p;let i={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Pe({...i,apiService:n}),this.buildManifestStep=new Ne(i),this.registerAppStep=new Ie({...i,apiService:n,configService:r}),this.uploadFilesStep=new Ue({...i,verbose:this.verbose}),this.generateApiClientStep=new Fe({...i,clientService:this.clientService,configService:r}),this.syncApplicationStep=new He({...i,apiService:n,verbose:this.verbose}),this.startWatchersStep=new Ve({...i,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){let e=n.default.join(this.state.appPath,t.ht);await t.it(e),await t.rt(e),this.state.addEvent({message:`Using remote "${t.R.getActiveRemote()}"`,status:`info`}),this.verbose||this.state.addEvent({message:`Add --verbose to see fully detailed logs`,status:`info`}),this.state.notify(),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(e){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(e.builtPath,e.sourcePath,e.fileFolder)}async checkServerHealth(){let e=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!e&&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(e){this.state.addEvent({message:`Sync failed with error: ${t.L(e)}`,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`;let e=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!e||(await this.startWatchersStep.handleWatcherRestarts(e),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(e.manifest)))return;let t=this.state.hasObjectsOrFieldsChanged(e.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:e.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!==`error`&&t&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(e){await this.registerAppStep.execute({manifest:e});let t=await this.apiService.createDevelopmentApplication({universalIdentifier:e.application.universalIdentifier,name:e.application.displayName});return!t.success||!t.data?(this.state.applyStepEvents([{message:`Failed to install development application`,status:`error`},{message:JSON.stringify(t,null,2),status:`error`}]),this.state.updatePipeline({status:`error`}),!1):(this.state.steps.resolveApplication.output={applicationId:t.data.id,universalIdentifier:t.data.universalIdentifier},this.state.steps.resolveApplication.status=`done`,this.state.applyStepEvents([{message:`Application installed`,status:`success`}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:e.application.universalIdentifier}),!0)}},Ge={objects:t.mt.Object,fields:t.mt.Field,logicFunctions:t.mt.LogicFunction,frontComponents:t.mt.FrontComponent,roles:t.mt.Role,skills:t.mt.Skill,connectionProviders:t.mt.ConnectionProvider,views:t.mt.View,viewFields:t.mt.ViewField,navigationMenuItems:t.mt.NavigationMenuItem,pageLayouts:t.mt.PageLayout,pageLayoutTabs:t.mt.PageLayoutTab,commandMenuItems:t.mt.CommandMenuItem},Ke=200,qe={pending:[`building`,`uploading`,`success`,`error`],building:[`pending`,`uploading`,`success`,`error`],uploading:[`pending`,`success`,`error`],success:[`pending`,`building`,`uploading`,`error`],error:[`pending`,`building`,`uploading`,`success`]},Je=class{constructor(e){this.eventIdCounter=0,this.appPath=e.appPath,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:`idle`},ensureValidTokens:{output:{},status:`idle`},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:`idle`},buildManifest:{output:{result:null},status:`idle`},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:`idle`},generateApiClient:{output:{},status:`idle`},syncApplication:{output:{syncStatus:`idle`,error:null},status:`idle`},startWatchers:{output:{watchersStarted:!1},status:`idle`}},this.pipeline={status:`idle`,isSyncing:!1,error:null,appName:null},this.versionInfo=null,this.entities=new Map,this.events=[]}setVersionInfo(e){this.versionInfo=e,this.notify()}notify(){this.onChange?.()}updatePipeline(e){Object.assign(this.pipeline,e),this.notify()}applyStepEvents(e){let t=e.map(e=>(this.eventIdCounter+=1,{...e,id:this.eventIdCounter,timestamp:new Date,message:e.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Ke-t.length)),...t]}addEvent(e){this.applyStepEvents([e])}updateEntityStatus(e,t){let n=new Map(this.entities),r=n.get(e);r?.status&&!qe[r.status].includes(t)||(n.set(e,r?{...r,status:t}:{name:e,path:e,status:t}),this.entities=n)}removeEntity(e){let t=new Map(this.entities);t.delete(e),this.entities=t}updateAllEntitiesStatus(e){let t=new Map(this.entities);for(let[n,r]of t)t.set(n,{...r,status:e});this.entities=t}updateEntitiesFromManifest(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=Ge[n];if(e)for(let n of r)t.set(n,e)}let n=new Map(this.entities);for(let[e,r]of n)n.set(e,{...r,type:t.get(e)});for(let[e,r]of t)n.has(e)||n.set(e,{name:e,path:e,type:r,status:`pending`});this.entities=n}hasObjectsOrFieldsChanged(e){let t=JSON.stringify({objects:e.objects,fields:e.fields}),n=t!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=t,n}},Ye={idle:{color:`gray`,icon:`○`},in_progress:{color:`yellow`,icon:`spinner`},uploading:{color:`cyan`,icon:`upload`},done:{color:`green`,icon:`✓`},error:{color:`red`,icon:`✗`}},Xe=e=>({idle:`idle`,in_progress:`in_progress`,done:`done`,error:`error`})[e],Ze=e=>({pending:`idle`,building:`in_progress`,uploading:`uploading`,success:`done`,error:`error`})[e],Qe=e=>({idle:`idle`,building:`in_progress`,syncing:`in_progress`,synced:`done`,error:`error`})[e],$e={idle:`Idle`,building:`Building...`,syncing:`Syncing...`,synced:`Synced`,error:`Error`},et=[`◐`,`◓`,`◑`,`◒`],tt=[`↑`,`⇡`,`↑`,`⇡`],nt={[t.mt.Object]:`Objects`,[t.mt.Field]:`Fields`,[t.mt.LogicFunction]:`Logic functions`,[t.mt.FrontComponent]:`Front components`,[t.mt.CommandMenuItem]:`Command menu items`,[t.mt.Role]:`Roles`,[t.mt.Skill]:`Skills`,[t.mt.View]:`Views`,[t.mt.ViewField]:`View fields`,[t.mt.NavigationMenuItem]:`Navigation menu items`,[t.mt.PageLayout]:`Page layouts`,[t.mt.PageLayoutTab]:`Page layout tabs`,[t.mt.Agent]:`Agents`,[t.mt.ConnectionProvider]:`Connection providers`},rt=Object.keys(nt),it={info:`gray`,success:`green`,error:`red`,warning:`yellow`},at=e=>e.toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),ot=(e,t=40)=>{if(e.length<=t)return e;let n=e.split(`/`);return n.length<=2?e:`.../${n.slice(-2).join(`/`)}`},st=e=>{let t=new Map;for(let e of rt)t.set(e,[]);for(let n of e.values()){if(!n.type)continue;let e=t.get(n.type)??[];e.push(n),t.set(n.type,e)}return t},ct=[{status:`success`,label:`synced`},{status:`building`,label:`building`},{status:`uploading`,label:`uploading`},{status:`pending`,label:`pending`},{status:`error`,label:`error`}],lt=e=>{let t={pending:0,building:0,uploading:0,success:0,error:0};for(let n of e)t[n.status]+=1;return ct.filter(({status:e})=>t[e]>0).map(({status:e,label:n})=>({status:e,count:t[e],label:n}))},D=e=>{let n=e.steps.resolveApplication.output.applicationId;return!t.tt(e.frontendUrl)||!t.tt(n)?null:`${e.frontendUrl}/settings/applications/${n}`},ut=e=>e.some(e=>e===`error`)?`error`:e.some(e=>e===`in_progress`)?`in_progress`:e.every(e=>e===`done`)?`done`:`idle`,dt=e=>{let t=[...e.entities.values()],n=t.some(e=>e.status===`error`),r=t.some(e=>e.status===`building`),i=t.length>0&&t.every(e=>e.status===`uploading`||e.status===`success`),a=n?`error`:r?`in_progress`:i?`done`:`idle`;return[{label:`Application Initialization`,status:ut([e.steps.checkServer.status,e.steps.ensureValidTokens.status,e.steps.resolveApplication.status])},{label:`Resources Build`,status:a},{label:`Resources Upload`,status:e.steps.uploadFiles.status},{label:`Manifest Build`,status:e.steps.buildManifest.status},{label:`Application Synchronization`,status:e.steps.syncApplication.status},{label:`Api Client Generation`,status:e.steps.generateApiClient.status}]},ft=120,pt=Math.round(200/ft),mt=()=>{let e=Math.floor(Date.now()/ft);return{spinnerFrame:et[e%et.length],uploadFrame:tt[Math.floor(e/pt)%tt.length]}},ht=e=>{let t=Ye[e];return t.icon===`spinner`?mt().spinnerFrame:t.icon===`upload`?mt().uploadFrame:t.icon},gt=s.default.createContext(null),_t=gt.Provider,vt=()=>{let e=s.default.useContext(gt);if(!e)throw Error(`useInk must be used within InkProvider`);return e},yt=({uiStatus:e})=>{let{Text:t}=vt(),n=ht(e),r=Ye[e];return(0,f.jsxs)(t,{color:r.color,children:[n,` `]})},bt=({entity:e})=>{let{Box:t,Text:n}=vt();return(0,f.jsxs)(t,{children:[(0,f.jsx)(yt,{uiStatus:Ze(e.status)}),(0,f.jsx)(n,{children:e.name}),e.path!==e.name&&(0,f.jsxs)(n,{dimColor:!0,children:[` (`,ot(e.path),`)`]})]})},xt=({type:e,entities:t})=>{let{Box:n,Text:r}=vt();return t.length===0?null:(0,f.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,f.jsx)(r,{bold:!0,dimColor:!0,children:nt[e]}),t.map(e=>(0,f.jsx)(bt,{entity:e},e.path))]})},St=({entities:e})=>{let{Box:t,Text:n}=vt();if(e.length===0)return null;let r=lt(e);return(0,f.jsxs)(t,{marginTop:1,children:[(0,f.jsxs)(n,{bold:!0,dimColor:!0,children:[`Entities`,` `]}),r.map((e,r)=>(0,f.jsxs)(t,{children:[r>0&&(0,f.jsx)(n,{dimColor:!0,children:` · `}),(0,f.jsx)(yt,{uiStatus:Ze(e.status)}),(0,f.jsxs)(n,{children:[e.count,` `,e.label]})]},e.status))]})},Ct=()=>{let{Box:e,Text:t}=vt();return(0,f.jsx)(e,{marginTop:1,children:(0,f.jsxs)(t,{dimColor:!0,children:[(0,f.jsx)(t,{color:Ye.idle.color,children:Ye.idle.icon}),` `,`pending`,` `,(0,f.jsx)(t,{color:Ye.in_progress.color,children:et[0]}),` `,`building`,` `,(0,f.jsx)(t,{color:Ye.uploading.color,children:tt[0]}),` `,`uploading`,` `,(0,f.jsx)(t,{color:Ye.done.color,children:Ye.done.icon}),` `,`success`,` `,(0,f.jsx)(t,{color:Ye.error.color,children:Ye.error.icon}),` `,`error`]})})},wt=7,Tt=({versionInfo:e})=>{let{Box:t,Text:n}=vt();if(e===null)return null;let{cliVersion:r,localServerVersion:i,latestServerVersion:a,isMinorOrMajorBehind:o,daysBehind:s}=e,c=o&&s!==null&&s>wt;return(0,f.jsxs)(t,{children:[(0,f.jsx)(n,{dimColor:!0,children:`Versions: `}),(0,f.jsx)(n,{dimColor:!0,children:`CLI `}),(0,f.jsxs)(n,{children:[`v`,r]}),i!==null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n,{dimColor:!0,children:` • Server `}),(0,f.jsxs)(n,{color:c?`yellow`:void 0,children:[`v`,i]}),i!==null&&a!==null&&i===a&&(0,f.jsx)(n,{color:`green`,children:` ✓ latest`}),c&&a!==null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n,{color:`yellow`,children:[` → v`,a]}),s!==null&&(0,f.jsxs)(n,{dimColor:!0,children:[` (`,s,`d behind)`]})]})]})]})},Et=({state:e})=>{let{Text:t}=vt(),n=Qe(e.pipeline.status),r=ht(n),i=Ye[n],a=$e[e.pipeline.status];return(0,f.jsxs)(t,{color:i.color,children:[r,` `,a]})},Dt=({label:e,status:t})=>{let{Box:n,Text:r}=vt(),i=Xe(t),a=ht(i),o=Ye[i];return(0,f.jsxs)(n,{children:[(0,f.jsxs)(r,{dimColor:!0,children:[e,`: `]}),(0,f.jsxs)(r,{color:o.color,children:[a,` `,t.replace(`_`,` `)]})]})},Ot=({state:e,verbose:t=!1})=>{let{Box:n,Text:r}=vt(),i=st(e.entities),a=D(e);return(0,f.jsxs)(n,{flexDirection:`column`,borderStyle:`classic`,borderColor:`gray`,paddingX:1,children:[(0,f.jsx)(r,{bold:!0,color:`cyan`,children:`Application`}),(0,f.jsxs)(n,{marginLeft:2,flexDirection:`column`,children:[(0,f.jsxs)(n,{children:[(0,f.jsx)(r,{dimColor:!0,children:`Name: `}),(0,f.jsx)(r,{bold:!0,children:e.pipeline.appName??`Loading...`})]}),(0,f.jsxs)(n,{children:[(0,f.jsx)(r,{dimColor:!0,children:`Overall Status: `}),(0,f.jsx)(Et,{state:e})]}),a&&(0,f.jsxs)(n,{children:[(0,f.jsx)(r,{dimColor:!0,children:`Open:`}),(0,f.jsxs)(r,{bold:!0,color:`cyan`,children:[` `,a]})]}),(0,f.jsx)(Tt,{versionInfo:e.versionInfo})]}),(0,f.jsx)(n,{marginLeft:2,flexDirection:`column`,marginTop:1,children:dt(e).map(e=>(0,f.jsx)(Dt,{label:e.label,status:e.status},e.label))}),(0,f.jsx)(n,{marginLeft:2,flexDirection:`column`,children:t?rt.map(e=>(0,f.jsx)(xt,{type:e,entities:i.get(e)??[]},e)):(0,f.jsx)(St,{entities:Array.from(e.entities.values())})})]})},O=({event:e})=>{let{Box:t,Text:n}=vt(),r=it[e.status],i=at(e.timestamp);return(0,f.jsxs)(t,{marginTop:+!!e.spacingBefore,children:[(0,f.jsxs)(n,{dimColor:!0,children:[i,` `]}),(0,f.jsx)(n,{color:r,children:e.message})]})},kt=new Set([`building`,`syncing`]),At=120,k=80,jt=({uiStateManager:e,verbose:t})=>{let{Box:n,Static:r}=vt(),[,i]=(0,s.useReducer)(e=>e+1,0),a=(0,s.useRef)(null),o=(0,s.useRef)(0),c=(0,s.useCallback)(()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,o.current=Date.now(),i()},k)},[]);(0,s.useEffect)(()=>e.subscribe(()=>{c()}),[e,c]),(0,s.useEffect)(()=>{let t=setInterval(()=>{let t=e.getSnapshot();kt.has(t.pipeline.status)&&(Date.now()-o.current<At||i())},At);return()=>clearInterval(t)},[e]),(0,s.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let l=e.getSnapshot();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r,{items:l.events,children:e=>(0,f.jsx)(O,{event:e},e.id)}),(0,f.jsxs)(n,{marginTop:1,flexDirection:`column`,children:[(0,f.jsx)(Ot,{state:l,verbose:t}),t&&(0,f.jsx)(Ct,{})]})]})},Mt=async(e,t=!1)=>{let{render:n,Box:r,Text:i,Static:a}=await import(`ink`),{unmount:o}=n((0,f.jsx)(_t,{value:{Box:r,Text:i,Static:a},children:(0,f.jsx)(jt,{uiStateManager:e,verbose:t})}));return{unmount:o}},Nt=class{constructor(e){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=e}getSnapshot(){return this.orchestratorState}subscribe(e){return this.listeners.add(e),e(this.orchestratorState),()=>this.listeners.delete(e)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(let e of this.listeners)e(this.orchestratorState)}))}},Pt=class{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(e){let n=e.appPath??h;await y(n),e.headless&&await t.g();let r=new Je({appPath:n});if(!e.headless){let n=new Nt(r);r.onChange=()=>n.notify();let{unmount:i}=await Mt(n,e.verbose);this.unmountUI=i,t._().then(e=>r.setVersionInfo(e))}this.orchestrator=new We({state:r,verbose:e.verbose,debounceMs:e.debounceMs}),await this.orchestrator.start(),e.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){let e=()=>void this.close().then(()=>process.exit(0));process.on(`SIGINT`,e),process.on(`SIGTERM`,e)}},Ft=class{async execute(e){let n=e.appPath??h;await y(n);let r=t.R.getActiveRemote();console.log(l.default.blue(`${e.dryRun?`Previewing application diff`:`Syncing application`} on ${r}...`)),console.log(l.default.gray(`App path: ${n}\n`));let i=await t.a({appPath:n,verbose:e.verbose,dryRun:e.dryRun,onProgress:e=>console.log(l.default.gray(e))});if(i.success||(console.error(l.default.red(i.error.message)),process.exit(1)),e.dryRun){console.log(l.default.green(`\n✓ Dry run complete for ${i.data.applicationDisplayName} — no changes were applied`));return}console.log(l.default.green(`\n✓ Synced ${i.data.applicationDisplayName} (${i.data.fileCount} file${i.data.fileCount===1?``:`s`})`)),console.log(l.default.gray(`Output: ${i.data.outputDir}`))}},A=class{async execute(e){let r=e.appPath??h,i=(0,n.join)(r,`node_modules`,`twenty-client-sdk`);await t.at(i)||(console.error(l.default.red(`Cannot find twenty-client-sdk in ${r}.\n\n Install it first:
|
|
348
|
-
yarn add twenty-client-sdk`)),process.exit(1));let a=await new t.
|
|
346
|
+
Waiting for server...`,status:`error`}]),this.state.updatePipeline({status:`error`})),!1)}if(!r.authValid)return e.output.errorLogged||(e.output={isReady:!1,errorLogged:!0},e.status=`error`,this.state.applyStepEvents([{message:"Authentication failed. Run `yarn twenty remote:add` to authenticate.",status:`error`}]),this.state.updatePipeline({status:`error`})),!1;let i=e.output.isReady;if(e.output={isReady:!0,errorLogged:!1},e.status=`done`,!n.t(this.state.frontendUrl)){let e=await this.apiService.getWorkspaceFrontendUrl();n.t(e)&&(this.state.frontendUrl=e)}return i||this.notify(),!0}},Ie=class{constructor({clientService:e,configService:t,state:n,notify:r}){this.clientService=e,this.configService=t,this.state=n,this.notify=r}async execute(e){let n=this.state.steps.generateApiClient;n.status=`in_progress`,this.notify();try{let r=await t.d(this.configService,e.credentials);await this.clientService.generateCoreClient({appPath:e.appPath,appAccessToken:r}),n.status=`done`}catch(e){this.state.applyStepEvents([{message:`Failed to generate API client: ${e instanceof Error?e.message:String(e)}`,status:`error`}]),n.status=`error`}this.notify()}},Le=class{constructor({apiService:e,configService:t,state:n,notify:r}){this.apiService=e,this.configService=t,this.state=n,this.notify=r}async execute(e){try{let n=await t.u(this.apiService,this.configService,{name:e.manifest.application.displayName,universalIdentifier:e.manifest.application.universalIdentifier});this.registrationCredentials={clientId:n.clientId,clientSecret:n.clientSecret},this.state.applyStepEvents([{message:n.isNewRegistration?`App registration created: ${e.manifest.application.displayName}`:`Existing app registration found`,status:n.isNewRegistration?`success`:`info`},...n.isNewRegistration?[{message:`Credentials saved to config.`,status:`info`}]:[]])}catch(e){throw this.state.applyStepEvents([{message:`Failed to register app: ${e instanceof Error?e.message:String(e)}`,status:`error`}]),e}this.notify()}},Re=class{constructor(e){this.watcher=null,this.appPath=e.appPath,this.fileFolder=e.fileFolder,this.watchPaths=e.watchPaths,this.handleFileBuilt=e.handleFileBuilt}async start(){let e=(await Promise.all(this.watchPaths.map(async e=>{let n=(0,r.join)(this.appPath,e);return await t.at(n)?n:null}))).filter(e=>e!==null);e.length!==0&&(this.watcher=f.default.watch(e,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on(`all`,(e,t)=>{e===`addDir`||e===`unlinkDir`||((e===`add`||e===`change`)&&this.copyAndNotify(t),e===`unlink`&&this.handleUnlink(t))}))}async close(){await this.watcher?.close()}async copyAndNotify(e){let n=(0,r.relative)(this.appPath,e),a=(0,r.join)(t.lt,n),o=(0,r.join)(this.appPath,a);await t.it((0,r.dirname)(o)),await t.nt(e,o);let s=await(0,i.readFile)(o),l=c.default.createHash(`md5`).update(s).digest(`hex`);this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:a,sourcePath:n,checksum:l})}async handleUnlink(e){let n=(0,r.join)(t.lt,(0,r.relative)(this.appPath,e));await t.st((0,r.join)(this.appPath,n))}},ze=class{constructor(e){this.process=null,this.pendingErrors=[],this.buffer=``,this.hasErrors=!1,this.appPath=e.appPath,this.onErrors=e.onErrors}async start(){let e=s.default.join(this.appPath,`node_modules`,`.bin`,`tsc`);if(!await t.at(e))return;let n=s.default.join(this.appPath,`tsconfig.json`);this.process=(0,l.spawn)(e,[`--watch`,`--noEmit`,`--pretty`,`false`,`-p`,n],{cwd:this.appPath,stdio:[`ignore`,`pipe`,`pipe`]}),this.process.on(`error`,()=>{this.process=null}),this.process.stdout?.on(`data`,e=>{this.handleOutput(e.toString())}),this.process.stderr?.on(`data`,e=>{this.handleOutput(e.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(e){this.buffer+=e;let t=this.buffer.split(`
|
|
347
|
+
`);this.buffer=t.pop()??``;for(let e of t)this.processLine(e)}processLine(e){if(e.includes(`Starting compilation in watch mode...`)||e.includes(`Starting incremental compilation...`)){this.pendingErrors=[];return}if(e.includes(`Watching for file changes.`)){let e=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||e)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}let n=t.et(e);n&&this.pendingErrors.push(n)}},Be=new Set([`node_modules`,`dist`,`.twenty`]),Ve=class{constructor(e){this.watcher=null,this.appPath=e.appPath,this.handleChangeDetected=e.handleChangeDetected,this.verbose=e.verbose??!1}async start(){let e=this.appPath;this.watcher=f.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:t=>{let n=(0,r.relative)(e,t);if(n===``)return!1;let i=n.split(r.default.sep)[0];return Be.has(i)||i.startsWith(`.`)},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on(`all`,(e,n)=>{if(e===`addDir`||e===`unlinkDir`)return;let i=(0,r.relative)(this.appPath,n),a=i.startsWith(t.ut),o=[`package.json`,`yarn.lock`].includes(i);!(i.endsWith(`.ts`)||i.endsWith(`.tsx`))&&!a&&!o||this.handleChangeDetected(i,e)})}async close(){await this.watcher?.close()}},He=class{constructor(e){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=e.state,this.scheduleSync=e.scheduleSync,this.notify=e.notify,this.onFileBuilt=e.onFileBuilt,this.shouldSkipTypecheck=e.shouldSkipTypecheck,this.verbose=e.verbose??!1}async start(){this.state.steps.startWatchers.status=`in_progress`,this.notify(),this.manifestWatcher=new Ve({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(e){let{logicFunctions:t,frontComponents:n}=e.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status=`done`,await this.startFileWatchers(t,n);return}this.logicFunctionsWatcher?.shouldRestart(t)&&await this.logicFunctionsWatcher.restart(t),this.frontComponentsWatcher?.shouldRestart(n)&&await this.frontComponentsWatcher.restart(n)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(e,t){this.state.addEvent({message:`Change detected: ${e}`,status:`info`,spacingBefore:!0}),t===`unlink`?this.state.removeEntity(e):this.state.updateEntityStatus(e,`building`),this.notify(),this.scheduleSync()}handleFileBuildError(e){this.state.addEvent({message:`Build failed:`,status:`error`});for(let t of e)this.state.addEvent({message:t.error,status:`error`});this.notify()}handleFileBuilt(e){this.verbose&&this.state.addEvent({message:`Successfully built ${e.builtPath}`,status:`success`}),this.state.steps.uploadFiles.output.builtFileInfos.set(e.builtPath,{checksum:e.checksum,builtPath:e.builtPath,sourcePath:e.sourcePath,fileFolder:e.fileFolder,usesSdkClient:e.usesSdkClient}),this.onFileBuilt(e),this.notify(),this.scheduleSync()}async startFileWatchers(e,t){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(e),this.startFrontComponentsWatcher(t),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(e){this.logicFunctionsWatcher=t.$({appPath:this.state.appPath,sourcePaths:e,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(e){this.frontComponentsWatcher=t.Q({appPath:this.state.appPath,sourcePaths:e,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Re({appPath:this.state.appPath,fileFolder:t.mt.PublicAsset,watchPaths:[t.ut],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Re({appPath:this.state.appPath,fileFolder:t.mt.Dependencies,watchPaths:[`package.json`,`yarn.lock`],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new ze({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(e){e.length===0?this.state.addEvent({message:`Typecheck passed`,status:`success`}):this.state.applyStepEvents(e.map(e=>({message:`Type error in ${e.file}(${e.line},${e.column}): ${e.text}`,status:`error`}))),this.notify()}},Ue=class{constructor({apiService:e,state:t,notify:n,verbose:r}){this.apiService=e,this.state=t,this.notify=n,this.verbose=r??!1}async execute(e){let n=this.state.steps.syncApplication;n.status=`in_progress`,this.state.updatePipeline({status:`syncing`});let r=[],i=t.X({manifest:e.manifest,builtFileInfos:e.builtFileInfos});r.push({message:`Manifest checksums set`,status:`info`}),await t.Y(e.appPath,i),r.push({message:`Manifest saved to output directory`,status:`info`}),r.push({message:`Syncing manifest`,status:`info`});let a=await this.apiService.syncApplication(i);if(a.success){let e=a.data;r.push(...t.l(e.actions)),r.push({message:`✓ Synced`,status:`success`}),n.output={syncStatus:`synced`,error:null},n.status=`done`,this.state.updatePipeline({status:`synced`,error:null}),this.state.updateAllEntitiesStatus(`success`),this.state.applyStepEvents(r);return}let o=this.verbose?null:t.M(a.error);o?(r.push(...o),r.push({message:`Add --verbose to see full error log`,status:`info`})):r.push({message:`Sync failed with error: ${a.message??`Sync failed`}`,status:`error`});let s=t.c(a.message);s&&r.push({message:s,status:`info`});let c=o?o[0].message:`Sync failed`;n.output={syncStatus:`error`,error:c},n.status=`error`,this.state.updatePipeline({status:`error`,error:c}),this.state.updateAllEntitiesStatus(`error`),this.state.applyStepEvents(r)}},We=class{constructor({state:e,notify:t,verbose:n}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=e,this.notify=t,this.verbose=n??!1}get isInitialized(){return n.t(this.state.steps.uploadFiles.output.fileUploader)}initialize(e){let n=this.state.steps.uploadFiles;n.output={...n.output,fileUploader:new t.s({appPath:e.appPath,applicationUniversalIdentifier:e.universalIdentifier})},n.status=`in_progress`,this.notify(),this.uploadPendingFiles()}uploadFile(e,t,n){let r=this.state.steps.uploadFiles;if(!r.output.fileUploader)return;r.status=`in_progress`,this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${e}`,status:`info`}),this.state.updateEntityStatus(t,`uploading`),this.notify();let i=r.output.fileUploader.uploadFile({builtPath:e,fileFolder:n}).then(n=>{n.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${e}`,status:`success`}),this.state.updateEntityStatus(t,`success`)):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${e}: ${n.error}`,status:`error`}))}).catch(t=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${e}: ${t}`,status:`error`})}).finally(()=>{r.output.activeUploads.delete(i),r.output.activeUploads.size===0&&(this.logUploadSummary(),r.status=`done`,this.notify())});r.output.activeUploads.add(i)}async waitForUploads(){let e=this.state.steps.uploadFiles;for(;e.output.activeUploads.size>0;)await Promise.all(e.output.activeUploads);e.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(let[e,{fileFolder:t,sourcePath:n}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(e,n,t)}},Ge=class{constructor(e){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=e.debounceMs??1e3,this.state=e.state,this.verbose=e.verbose??!1,this.apiService=new t.L({disableInterceptors:!0});let n=this.apiService,r=new t.V;this.clientService=new t.m;let i={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Fe({...i,apiService:n}),this.buildManifestStep=new Pe(i),this.registerAppStep=new Le({...i,apiService:n,configService:r}),this.uploadFilesStep=new We({...i,verbose:this.verbose}),this.generateApiClientStep=new Ie({...i,clientService:this.clientService,configService:r}),this.syncApplicationStep=new Ue({...i,apiService:n,verbose:this.verbose}),this.startWatchersStep=new He({...i,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){let e=r.default.join(this.state.appPath,t.lt);await t.it(e),await t.rt(e),this.state.addEvent({message:`Using remote "${t.V.getActiveRemote()}"`,status:`info`}),this.verbose||this.state.addEvent({message:`Add --verbose to see fully detailed logs`,status:`info`}),this.state.notify(),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(e){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(e.builtPath,e.sourcePath,e.fileFolder)}async checkServerHealth(){let e=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!e&&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(e){this.state.addEvent({message:`Sync failed with error: ${t.R(e)}`,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`;let e=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!e||(await this.startWatchersStep.handleWatcherRestarts(e),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(e.manifest)))return;let t=this.state.hasObjectsOrFieldsChanged(e.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:e.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!==`error`&&t&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(e){await this.registerAppStep.execute({manifest:e});let t=await this.apiService.createDevelopmentApplication({universalIdentifier:e.application.universalIdentifier,name:e.application.displayName});return!t.success||!t.data?(this.state.applyStepEvents([{message:`Failed to install development application`,status:`error`},{message:JSON.stringify(t,null,2),status:`error`}]),this.state.updatePipeline({status:`error`}),!1):(this.state.steps.resolveApplication.output={applicationId:t.data.id,universalIdentifier:t.data.universalIdentifier},this.state.steps.resolveApplication.status=`done`,this.state.applyStepEvents([{message:`Application installed`,status:`success`}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:e.application.universalIdentifier}),!0)}},Ke={objects:t.ct.Object,fields:t.ct.Field,logicFunctions:t.ct.LogicFunction,frontComponents:t.ct.FrontComponent,roles:t.ct.Role,skills:t.ct.Skill,connectionProviders:t.ct.ConnectionProvider,views:t.ct.View,viewFields:t.ct.ViewField,navigationMenuItems:t.ct.NavigationMenuItem,pageLayouts:t.ct.PageLayout,pageLayoutTabs:t.ct.PageLayoutTab,commandMenuItems:t.ct.CommandMenuItem},qe=200,Je={pending:[`building`,`uploading`,`success`,`error`],building:[`pending`,`uploading`,`success`,`error`],uploading:[`pending`,`success`,`error`],success:[`pending`,`building`,`uploading`,`error`],error:[`pending`,`building`,`uploading`,`success`]},Ye=class{constructor(e){this.eventIdCounter=0,this.appPath=e.appPath,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:`idle`},ensureValidTokens:{output:{},status:`idle`},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:`idle`},buildManifest:{output:{result:null},status:`idle`},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:`idle`},generateApiClient:{output:{},status:`idle`},syncApplication:{output:{syncStatus:`idle`,error:null},status:`idle`},startWatchers:{output:{watchersStarted:!1},status:`idle`}},this.pipeline={status:`idle`,isSyncing:!1,error:null,appName:null},this.versionInfo=null,this.entities=new Map,this.events=[]}setVersionInfo(e){this.versionInfo=e,this.notify()}notify(){this.onChange?.()}updatePipeline(e){Object.assign(this.pipeline,e),this.notify()}applyStepEvents(e){let t=e.map(e=>(this.eventIdCounter+=1,{...e,id:this.eventIdCounter,timestamp:new Date,message:e.message.slice(0,5e3)}));this.events=[...this.events.slice(-(qe-t.length)),...t]}addEvent(e){this.applyStepEvents([e])}updateEntityStatus(e,t){let n=new Map(this.entities),r=n.get(e);r?.status&&!Je[r.status].includes(t)||(n.set(e,r?{...r,status:t}:{name:e,path:e,status:t}),this.entities=n)}removeEntity(e){let t=new Map(this.entities);t.delete(e),this.entities=t}updateAllEntitiesStatus(e){let t=new Map(this.entities);for(let[n,r]of t)t.set(n,{...r,status:e});this.entities=t}updateEntitiesFromManifest(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=Ke[n];if(e)for(let n of r)t.set(n,e)}let n=new Map(this.entities);for(let[e,r]of n)n.set(e,{...r,type:t.get(e)});for(let[e,r]of t)n.has(e)||n.set(e,{name:e,path:e,type:r,status:`pending`});this.entities=n}hasObjectsOrFieldsChanged(e){let t=JSON.stringify({objects:e.objects,fields:e.fields}),n=t!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=t,n}},Xe={idle:{color:`gray`,icon:`○`},in_progress:{color:`yellow`,icon:`spinner`},uploading:{color:`cyan`,icon:`upload`},done:{color:`green`,icon:`✓`},error:{color:`red`,icon:`✗`}},Ze=e=>({idle:`idle`,in_progress:`in_progress`,done:`done`,error:`error`})[e],Qe=e=>({pending:`idle`,building:`in_progress`,uploading:`uploading`,success:`done`,error:`error`})[e],$e=e=>({idle:`idle`,building:`in_progress`,syncing:`in_progress`,synced:`done`,error:`error`})[e],et={idle:`Idle`,building:`Building...`,syncing:`Syncing...`,synced:`Synced`,error:`Error`},tt=[`◐`,`◓`,`◑`,`◒`],nt=[`↑`,`⇡`,`↑`,`⇡`],rt={[t.ct.Object]:`Objects`,[t.ct.Field]:`Fields`,[t.ct.LogicFunction]:`Logic functions`,[t.ct.FrontComponent]:`Front components`,[t.ct.CommandMenuItem]:`Command menu items`,[t.ct.Role]:`Roles`,[t.ct.Skill]:`Skills`,[t.ct.View]:`Views`,[t.ct.ViewField]:`View fields`,[t.ct.NavigationMenuItem]:`Navigation menu items`,[t.ct.PageLayout]:`Page layouts`,[t.ct.PageLayoutTab]:`Page layout tabs`,[t.ct.Agent]:`Agents`,[t.ct.ConnectionProvider]:`Connection providers`},it=Object.keys(rt),at={info:`gray`,success:`green`,error:`red`,warning:`yellow`},ot=e=>e.toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),st=(e,t=40)=>{if(e.length<=t)return e;let n=e.split(`/`);return n.length<=2?e:`.../${n.slice(-2).join(`/`)}`},ct=e=>{let t=new Map;for(let e of it)t.set(e,[]);for(let n of e.values()){if(!n.type)continue;let e=t.get(n.type)??[];e.push(n),t.set(n.type,e)}return t},lt=[{status:`success`,label:`synced`},{status:`building`,label:`building`},{status:`uploading`,label:`uploading`},{status:`pending`,label:`pending`},{status:`error`,label:`error`}],ut=e=>{let t={pending:0,building:0,uploading:0,success:0,error:0};for(let n of e)t[n.status]+=1;return lt.filter(({status:e})=>t[e]>0).map(({status:e,label:n})=>({status:e,count:t[e],label:n}))},E=e=>{let t=e.steps.resolveApplication.output.applicationId;return!n.t(e.frontendUrl)||!n.t(t)?null:`${e.frontendUrl}/settings/applications/${t}`},dt=e=>e.some(e=>e===`error`)?`error`:e.some(e=>e===`in_progress`)?`in_progress`:e.every(e=>e===`done`)?`done`:`idle`,ft=e=>{let t=[...e.entities.values()],n=t.some(e=>e.status===`error`),r=t.some(e=>e.status===`building`),i=t.length>0&&t.every(e=>e.status===`uploading`||e.status===`success`),a=n?`error`:r?`in_progress`:i?`done`:`idle`;return[{label:`Application Initialization`,status:dt([e.steps.checkServer.status,e.steps.ensureValidTokens.status,e.steps.resolveApplication.status])},{label:`Resources Build`,status:a},{label:`Resources Upload`,status:e.steps.uploadFiles.status},{label:`Manifest Build`,status:e.steps.buildManifest.status},{label:`Application Synchronization`,status:e.steps.syncApplication.status},{label:`Api Client Generation`,status:e.steps.generateApiClient.status}]},pt=120,mt=Math.round(200/pt),ht=()=>{let e=Math.floor(Date.now()/pt);return{spinnerFrame:tt[e%tt.length],uploadFrame:nt[Math.floor(e/mt)%nt.length]}},gt=e=>{let t=Xe[e];return t.icon===`spinner`?ht().spinnerFrame:t.icon===`upload`?ht().uploadFrame:t.icon},_t=o.default.createContext(null),vt=_t.Provider,yt=()=>{let e=o.default.useContext(_t);if(!e)throw Error(`useInk must be used within InkProvider`);return e},bt=({uiStatus:e})=>{let{Text:t}=yt(),n=gt(e),r=Xe[e];return(0,p.jsxs)(t,{color:r.color,children:[n,` `]})},xt=({entity:e})=>{let{Box:t,Text:n}=yt();return(0,p.jsxs)(t,{children:[(0,p.jsx)(bt,{uiStatus:Qe(e.status)}),(0,p.jsx)(n,{children:e.name}),e.path!==e.name&&(0,p.jsxs)(n,{dimColor:!0,children:[` (`,st(e.path),`)`]})]})},St=({type:e,entities:t})=>{let{Box:n,Text:r}=yt();return t.length===0?null:(0,p.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,p.jsx)(r,{bold:!0,dimColor:!0,children:rt[e]}),t.map(e=>(0,p.jsx)(xt,{entity:e},e.path))]})},Ct=({entities:e})=>{let{Box:t,Text:n}=yt();if(e.length===0)return null;let r=ut(e);return(0,p.jsxs)(t,{marginTop:1,children:[(0,p.jsxs)(n,{bold:!0,dimColor:!0,children:[`Entities`,` `]}),r.map((e,r)=>(0,p.jsxs)(t,{children:[r>0&&(0,p.jsx)(n,{dimColor:!0,children:` · `}),(0,p.jsx)(bt,{uiStatus:Qe(e.status)}),(0,p.jsxs)(n,{children:[e.count,` `,e.label]})]},e.status))]})},wt=()=>{let{Box:e,Text:t}=yt();return(0,p.jsx)(e,{marginTop:1,children:(0,p.jsxs)(t,{dimColor:!0,children:[(0,p.jsx)(t,{color:Xe.idle.color,children:Xe.idle.icon}),` `,`pending`,` `,(0,p.jsx)(t,{color:Xe.in_progress.color,children:tt[0]}),` `,`building`,` `,(0,p.jsx)(t,{color:Xe.uploading.color,children:nt[0]}),` `,`uploading`,` `,(0,p.jsx)(t,{color:Xe.done.color,children:Xe.done.icon}),` `,`success`,` `,(0,p.jsx)(t,{color:Xe.error.color,children:Xe.error.icon}),` `,`error`]})})},Tt=7,Et=({versionInfo:e})=>{let{Box:t,Text:n}=yt();if(e===null)return null;let{cliVersion:r,localServerVersion:i,latestServerVersion:a,isMinorOrMajorBehind:o,daysBehind:s}=e,c=o&&s!==null&&s>Tt;return(0,p.jsxs)(t,{children:[(0,p.jsx)(n,{dimColor:!0,children:`Versions: `}),(0,p.jsx)(n,{dimColor:!0,children:`CLI `}),(0,p.jsxs)(n,{children:[`v`,r]}),i!==null&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n,{dimColor:!0,children:` • Server `}),(0,p.jsxs)(n,{color:c?`yellow`:void 0,children:[`v`,i]}),i!==null&&a!==null&&i===a&&(0,p.jsx)(n,{color:`green`,children:` ✓ latest`}),c&&a!==null&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(n,{color:`yellow`,children:[` → v`,a]}),s!==null&&(0,p.jsxs)(n,{dimColor:!0,children:[` (`,s,`d behind)`]})]})]})]})},Dt=({state:e})=>{let{Text:t}=yt(),n=$e(e.pipeline.status),r=gt(n),i=Xe[n],a=et[e.pipeline.status];return(0,p.jsxs)(t,{color:i.color,children:[r,` `,a]})},Ot=({label:e,status:t})=>{let{Box:n,Text:r}=yt(),i=Ze(t),a=gt(i),o=Xe[i];return(0,p.jsxs)(n,{children:[(0,p.jsxs)(r,{dimColor:!0,children:[e,`: `]}),(0,p.jsxs)(r,{color:o.color,children:[a,` `,t.replace(`_`,` `)]})]})},kt=({state:e,verbose:t=!1})=>{let{Box:n,Text:r}=yt(),i=ct(e.entities),a=E(e);return(0,p.jsxs)(n,{flexDirection:`column`,borderStyle:`classic`,borderColor:`gray`,paddingX:1,children:[(0,p.jsx)(r,{bold:!0,color:`cyan`,children:`Application`}),(0,p.jsxs)(n,{marginLeft:2,flexDirection:`column`,children:[(0,p.jsxs)(n,{children:[(0,p.jsx)(r,{dimColor:!0,children:`Name: `}),(0,p.jsx)(r,{bold:!0,children:e.pipeline.appName??`Loading...`})]}),(0,p.jsxs)(n,{children:[(0,p.jsx)(r,{dimColor:!0,children:`Overall Status: `}),(0,p.jsx)(Dt,{state:e})]}),a&&(0,p.jsxs)(n,{children:[(0,p.jsx)(r,{dimColor:!0,children:`Open:`}),(0,p.jsxs)(r,{bold:!0,color:`cyan`,children:[` `,a]})]}),(0,p.jsx)(Et,{versionInfo:e.versionInfo})]}),(0,p.jsx)(n,{marginLeft:2,flexDirection:`column`,marginTop:1,children:ft(e).map(e=>(0,p.jsx)(Ot,{label:e.label,status:e.status},e.label))}),(0,p.jsx)(n,{marginLeft:2,flexDirection:`column`,children:t?it.map(e=>(0,p.jsx)(St,{type:e,entities:i.get(e)??[]},e)):(0,p.jsx)(Ct,{entities:Array.from(e.entities.values())})})]})},D=({event:e})=>{let{Box:t,Text:n}=yt(),r=at[e.status],i=ot(e.timestamp);return(0,p.jsxs)(t,{marginTop:+!!e.spacingBefore,children:[(0,p.jsxs)(n,{dimColor:!0,children:[i,` `]}),(0,p.jsx)(n,{color:r,children:e.message})]})},At=new Set([`building`,`syncing`]),jt=120,O=80,Mt=({uiStateManager:e,verbose:t})=>{let{Box:n,Static:r}=yt(),[,i]=(0,o.useReducer)(e=>e+1,0),a=(0,o.useRef)(null),s=(0,o.useRef)(0),c=(0,o.useCallback)(()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,s.current=Date.now(),i()},O)},[]);(0,o.useEffect)(()=>e.subscribe(()=>{c()}),[e,c]),(0,o.useEffect)(()=>{let t=setInterval(()=>{let t=e.getSnapshot();At.has(t.pipeline.status)&&(Date.now()-s.current<jt||i())},jt);return()=>clearInterval(t)},[e]),(0,o.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let l=e.getSnapshot();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r,{items:l.events,children:e=>(0,p.jsx)(D,{event:e},e.id)}),(0,p.jsxs)(n,{marginTop:1,flexDirection:`column`,children:[(0,p.jsx)(kt,{state:l,verbose:t}),t&&(0,p.jsx)(wt,{})]})]})},Nt=async(e,t=!1)=>{let{render:n,Box:r,Text:i,Static:a}=await import(`ink`),{unmount:o}=n((0,p.jsx)(vt,{value:{Box:r,Text:i,Static:a},children:(0,p.jsx)(Mt,{uiStateManager:e,verbose:t})}));return{unmount:o}},Pt=class{constructor(e){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=e}getSnapshot(){return this.orchestratorState}subscribe(e){return this.listeners.add(e),e(this.orchestratorState),()=>this.listeners.delete(e)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(let e of this.listeners)e(this.orchestratorState)}))}},Ft=class{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async ensureAuthenticatedBeforeLaunch(){let{serverUp:e,authValid:n}=await new t.L({disableInterceptors:!0}).validateAuth();e&&!n&&await t.z(t.V.getActiveRemote())}async execute(e){let n=e.appPath??t.vt;await y(n),e.headless&&await t._(),await this.ensureAuthenticatedBeforeLaunch();let r=new Ye({appPath:n});if(!e.headless){let n=new Pt(r);r.onChange=()=>n.notify();let{unmount:i}=await Nt(n,e.verbose);this.unmountUI=i,t.v().then(e=>r.setVersionInfo(e))}this.orchestrator=new Ge({state:r,verbose:e.verbose,debounceMs:e.debounceMs}),await this.orchestrator.start(),e.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){let e=()=>void this.close().then(()=>process.exit(0));process.on(`SIGINT`,e),process.on(`SIGTERM`,e)}},It=class{async execute(e){let n=e.appPath??t.vt;await y(n);let r=t.V.getActiveRemote();console.log(u.default.blue(`${e.dryRun?`Previewing application diff`:`Syncing application`} on ${r}...`)),console.log(u.default.gray(`App path: ${n}\n`));let i=await t.o({appPath:n,verbose:e.verbose,dryRun:e.dryRun,onProgress:e=>console.log(u.default.gray(e))});if(i.success||(console.error(u.default.red(i.error.message)),process.exit(1)),e.dryRun){console.log(u.default.green(`\n✓ Dry run complete for ${i.data.applicationDisplayName} — no changes were applied`));return}console.log(u.default.green(`\n✓ Synced ${i.data.applicationDisplayName} (${i.data.fileCount} file${i.data.fileCount===1?``:`s`})`)),console.log(u.default.gray(`Output: ${i.data.outputDir}`))}},k=class{async execute(e){let n=e.appPath??t.vt,i=(0,r.join)(n,`node_modules`,`twenty-client-sdk`);await t.at(i)||(console.error(u.default.red(`Cannot find twenty-client-sdk in ${n}.\n\n Install it first:
|
|
348
|
+
yarn add twenty-client-sdk`)),process.exit(1));let a=await new t.L({disableInterceptors:!0}).validateAuth();a.serverUp||(console.error(u.default.red(`Cannot reach Twenty server.
|
|
349
349
|
|
|
350
350
|
Check your remotes:
|
|
351
|
-
yarn twenty remote:status`)),process.exit(1)),a.authValid||(console.error(
|
|
352
|
-
Start one with: yarn twenty docker:start`)),process.exit(1)),console.log(
|
|
353
|
-
`,
|
|
351
|
+
yarn twenty remote:status`)),process.exit(1)),a.authValid||(console.error(u.default.red("Authentication failed. Run `yarn twenty remote:add` to authenticate.")),process.exit(1)),console.log(u.default.blue(`Generating API client...`));try{await new t.m({skipAuth:!1}).generateCoreClient({appPath:n})}catch(e){console.error(u.default.red(`Failed to generate API client: ${t.R(e)}`)),process.exit(1)}console.log(u.default.green(`✓ API client generated`)),console.log(u.default.gray(`Output: ${(0,r.join)(i,`dist`,`core`,`generated`)}`))}},Lt=e=>{let t=new Ae,n=new ke;e.command(`dev:function:logs [appPath]`).description(`Stream logic function logs`).option(`-u, --functionUniversalIdentifier <functionUniversalIdentifier>`,`Only show logs for the function with this universal ID`).option(`-n, --functionName <functionName>`,`Only show logs for the function with this name`).action(async(e,n)=>{await t.execute({...n,appPath:g(e)})}),e.command(`dev:function:exec [appPath]`).description(`Execute a logic function`).option(`--postInstall`,`Execute post-install logic function if defined`).option(`--preInstall`,`Execute pre-install logic function if defined`).option(`-p, --payload <payload>`,`JSON payload to send to the function`,`{}`).option(`-u, --functionUniversalIdentifier <functionUniversalIdentifier>`,`Universal ID of the function to execute`).option(`-n, --functionName <functionName>`,`Name of the function to execute`).action(async(e,t)=>{!t?.postInstall&&!t?.preInstall&&!t?.functionUniversalIdentifier&&!t?.functionName&&(console.error(u.default.red(`Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.`)),process.exit(1)),await n.execute({...t,payload:t?.payload??`{}`,appPath:g(e)})})},Rt=e=>{let n=new Oe,r=new Ft,i=new It,a=new Me,o=new De,s=new k;e.command(`dev [appPath]`).description(`Build and sync local changes`).option(`-o, --once`,`Build and sync once, then exit (useful for CI, scripts, and pre-commit hooks)`).option(`--dry-run`,`Preview the metadata changes without applying them (requires --once)`).option(`--debounceMs <ms>`,`Debounce in ms (default: 1 000)`).option(`-v, --verbose`,`Show detailed logs`).option(`-d, --debug`,`Show detailed logs (alias for --verbose)`).action(async(e,t)=>{t.dryRun&&!t.once&&console.warn(u.default.yellow("--dry-run only applies with --once. Ignoring it; run `yarn twenty dev --once --dry-run` to preview changes."));let n={appPath:g(e),verbose:t.verbose||t.debug,debounceMs:t.debounceMs?parseInt(t.debounceMs,10):void 0};if(t.once){await i.execute({...n,dryRun:t.dryRun});return}await r.execute(n)}),e.command(`dev:build [appPath]`).description(`Build and generate API client`).option(`--tarball`,`Also pack into a .tgz tarball`).action(async(e,t)=>{await n.execute({appPath:g(e),tarball:t.tarball})}),e.command(`dev:typecheck [appPath]`).description(`Run TypeScript type checking`).action(async e=>{await a.execute({appPath:g(e)})}),e.command(`dev:add [entityType]`).description(`Scaffold a new entity (${Object.values(t.ct).join(`|`)})`).option(`--path <path>`,`Path in which the entity should be created.`).action(async(e,t)=>{await o.execute(e,t?.path)}),e.command(`dev:catalog-sync`).description(`Trigger marketplace catalog sync`).option(`-r, --remote <name>`,`Sync on a specific remote`).action(async e=>{let{CatalogSyncCommand:t}=await Promise.resolve().then(()=>require("./catalog-sync-w6yKppKP.js"));await new t().execute({remote:e.remote})}),e.command(`dev:generate-client [appPath]`).description(`Generate the typed API client from the active remote (no app definition required)`).action(async e=>{await s.execute({appPath:g(e)})}),Lt(e)},zt=async(e,n)=>{let r=n.test?t.x:t.b,i=n.port?parseInt(n.port,10):r;(isNaN(i)||i<1||i>65535)&&(console.error(u.default.red(`Invalid port number.`)),process.exit(1));let a=await t.n({port:i,test:n.test,version:e,onProgress:e=>console.log(u.default.gray(e))});a.success||(console.error(u.default.red(a.error.message)),process.exit(1))},Bt=e=>{let n=e.test?t.S:t.y;if(!t.w(n)){console.log(u.default.yellow(`No Twenty server container found.`));return}(0,l.execSync)(`docker stop ${n}`,{stdio:`ignore`}),console.log(u.default.green(`Twenty server stopped.`))},Vt=e=>{let n=e.test?t.S:t.y;if(!t.w(n)){console.log(u.default.yellow(`No Twenty server container found.`));return}try{(0,l.spawnSync)(`docker`,[`logs`,`-f`,`--tail`,e.lines,n],{stdio:`inherit`})}catch{}},Ht=async e=>{let n=e.test?t.S:t.y,r=e.test?t.x:t.b;if(!t.w(n)){console.log(` Status: ${u.default.gray(`not created`)}`),console.log(u.default.gray(` Run 'yarn twenty docker:start${e.test?` --test`:``}' to create one.`));return}let i=t.A(n),a=i?t.D(n):r,o=i?await t.f(a):!1,s=o?u.default.green(`running (healthy)`):i?u.default.yellow(`running (starting...)`):u.default.gray(`stopped`),c=t.E(`APP_VERSION`,n);console.log(` Status: ${s}`),console.log(` URL: http://localhost:${a}`),c&&console.log(` Version: ${u.default.gray(c)}`),o&&console.log(u.default.gray(` Login: tim@apple.dev / tim@apple.dev`))},Ut=e=>{let n=e.test?t.S:t.y,r=e.test?`twenty-app-dev-test-data`:`twenty-app-dev-data`,i=e.test?`twenty-app-dev-test-storage`:`twenty-app-dev-storage`;t.w(n)&&(0,l.execSync)(`docker rm -f ${n}`,{stdio:`ignore`});try{(0,l.execSync)(`docker volume rm ${r} ${i}`,{stdio:`ignore`})}catch{}console.log(u.default.green(`Twenty server data reset.`)),console.log(u.default.gray(`Run 'yarn twenty docker:start${e.test?` --test`:``}' to start a fresh instance.`))},Wt=async(e,n)=>{let r=await t.a({version:e??`latest`,test:n.test,onProgress:e=>console.log(u.default.gray(e))});r.success||(console.error(u.default.red(r.error.message)),process.exit(1));let{data:i}=r;if(!i.imageUpdated){console.log(u.default.green(` Already up to date (${i.image}).`));return}console.log(u.default.green(` Upgraded to: ${i.image}`)),i.containerRecreated&&console.log(u.default.gray(` Run 'yarn twenty docker:start${n.test?` --test`:``}' to wait for the server to be ready.`))},Gt=e=>{e.command(`docker:start [version]`).description("Start the local Twenty container (version defaults to the app `engines.twenty` range, then `latest`)").option(`-p, --port <port>`,`HTTP port`).option(`--test`,`Start a separate test instance (port 2021)`).action(zt),e.command(`docker:stop`).description(`Stop the local Twenty container`).option(`--test`,`Stop the test instance`).action(Bt),e.command(`docker:logs`).description(`Stream container logs`).option(`-n, --lines <lines>`,`Number of lines to show`,`50`).option(`--test`,`Show logs for the test instance`).action(Vt),e.command(`docker:status`).description(`Show container status`).option(`--test`,`Show status of the test instance`).action(Ht),e.command(`docker:reset`).description(`Delete all data and start fresh`).option(`--test`,`Reset the test instance`).action(Ut),e.command(`docker:upgrade [version]`).description(`Upgrade the Docker image`).option(`--test`,`Upgrade the test instance`).action(Wt);let t=e.command(`server`,{hidden:!0}).description(`Manage a Twenty server (local instance and server-side actions)`),n=(e,t)=>console.warn(u.default.yellow(`⚠ \`twenty server ${e}\` is deprecated. Use \`twenty ${t}\` instead.`));t.command(`start [version]`).option(`-p, --port <port>`,`HTTP port`).option(`--test`,`Start a separate test instance (port 2021)`).action(async(e,t)=>{n(`start`,`docker:start`),await zt(e,t)}),t.command(`stop`).option(`--test`,`Stop the test instance`).action(e=>{n(`stop`,`docker:stop`),Bt(e)}),t.command(`logs`).option(`-n, --lines <lines>`,`Number of lines to show`,`50`).option(`--test`,`Show logs for the test instance`).action(e=>{n(`logs`,`docker:logs`),Vt(e)}),t.command(`status`).option(`--test`,`Show status of the test instance`).action(async e=>{n(`status`,`docker:status`),await Ht(e)}),t.command(`reset`).option(`--test`,`Reset the test instance`).action(e=>{n(`reset`,`docker:reset`),Ut(e)}),t.command(`upgrade [version]`).option(`--test`,`Upgrade the test instance`).action(async(e,t)=>{n(`upgrade`,`docker:upgrade`),await Wt(e,t)}),t.command(`catalog-sync`).option(`-r, --remote <name>`,`Sync on a specific remote`).action(async e=>{n(`catalog-sync`,`dev:catalog-sync`);let{CatalogSyncCommand:t}=await Promise.resolve().then(()=>require("./catalog-sync-w6yKppKP.js"));await new t().execute({remote:e.remote})})},Kt=e=>{try{return new URL(e).hostname.replace(/\./g,`-`)}catch{return`remote`}},qt=async(e,n)=>n?((await t.t({apiKey:n,apiUrl:e})).success||(console.error(u.default.red(`✗ Authentication failed.`)),process.exit(1)),`API key`):Jt(e),Jt=async e=>{console.log(u.default.gray(`Opening browser for authentication...`));let n=await t.B({apiUrl:e});return n.success?`OAuth`:(console.log(u.default.yellow(n.error.message)),(await t.t({apiKey:(await d.default.prompt([{type:`password`,name:`apiKey`,message:`API Key:`,mask:`*`,validate:e=>e.length>0||`API key is required`}])).apiKey,apiUrl:e})).success||(console.error(u.default.red(`✗ Authentication failed.`)),process.exit(1)),`API key`)},Yt=async e=>{e.apiUrl&&console.warn(u.default.yellow(`⚠ --api-url is deprecated. Use --url instead.`));let n=e.test?t.H(!0):void 0,r=new t.V(n?{configPath:n}:void 0),i=await r.getRemotes();if(e.as!==void 0&&i.includes(e.as)){let n=await r.getConfigForRemote(e.as);t.V.setActiveRemote(e.as);let i=await qt(n.apiUrl,e.apiKey);console.log(u.default.green(`✓ Re-authenticated "${e.as}" via ${i}.`)),await r.setDefaultRemote(e.as),console.log(u.default.green(`✓ Default remote set to "${e.as}".`));return}let a=e.url??e.apiUrl;if(a)a=t.ft(a);else{let n=await t.p();e.local?(n||(console.error(u.default.red(`No local Twenty server found.
|
|
352
|
+
Start one with: yarn twenty docker:start`)),process.exit(1)),console.log(u.default.gray(`Found local server at ${n}`)),a=n):a=t.ft((await d.default.prompt([{type:`input`,name:`serverUrl`,message:`Twenty server URL:`,validate:e=>{try{return new URL(e),!0}catch{return`Please enter a valid URL`}}}])).serverUrl)}let o=e.as??Kt(a);t.V.setActiveRemote(o);let s=await qt(a,e.apiKey);console.log(u.default.green(`✓ Remote "${o}" added (${a}) via ${s}.`)),await r.setDefaultRemote(o),console.log(u.default.green(`✓ Default remote set to "${o}".`))},Xt=async()=>{let e=new t.V,n=await e.getRemotes(),r=await e.getDefaultRemote();if(n.length===0){console.log(`No remotes configured.`),console.log(`Use 'twenty remote:add' to add one.`);return}console.log(``);for(let t of n){let n=await e.getConfigForRemote(t),i=n.twentyCLIAccessToken?`oauth`:n.apiKey?`api-key`:`none`,a=t===r,o=a?`* `:` `,s=a?u.default.bold(t):t;console.log(`${o}${s} ${u.default.gray(n.apiUrl)} [${i}]`)}console.log(`
|
|
353
|
+
`,u.default.gray(`Use 'twenty remote:use <name>' to change default`))},Zt=async e=>{let n=new t.V,r=e??(await d.default.prompt([{type:`select`,name:`remote`,message:`Select default remote:`,choices:await n.getRemotes()}])).remote;(await n.getRemotes()).includes(r)||(console.error(u.default.red(`Remote "${r}" not found.`)),process.exit(1)),await n.setDefaultRemote(r),console.log(u.default.green(`✓ Default remote set to "${r}".`))},Qt=async()=>{let e=new t.V,n=new t.L,r=t.V.getActiveRemote(),i=await e.getConfig(),a=i.twentyCLIAccessToken?`oauth`:i.apiKey?`api-key`:`none`;if(console.log(` Remote: ${u.default.bold(r)}`),console.log(` Server: ${i.apiUrl}`),a===`none`){console.log(` Auth: ${u.default.yellow(`not configured`)}`);return}let{authValid:o}=await n.validateAuth(),s=o?u.default.green(`${a} (valid)`):u.default.red(`${a} (invalid)`);console.log(` Auth: ${s}`)},$t=async e=>{let n=new t.V;(await n.getRemotes()).includes(e)||(console.error(u.default.red(`Remote "${e}" not found.`)),process.exit(1)),t.V.setActiveRemote(e),await n.clearConfig(),console.log(u.default.green(`✓ Remote "${e}" removed.`))},en=e=>{e.command(`remote:add`).description(`Add or re-authenticate a remote`).option(`--as <name>`,`Name for this remote`).option(`--api-key <apiKey>`,`API key for non-interactive auth`).option(`--url <url>`,`Server URL`).option(`--api-url <apiUrl>`,`[deprecated: use --url]`).option(`--local`,`Connect to a local Twenty server (auto-detect)`).option(`--test`,`Write to config.test.json (for integration tests)`).action(Yt),e.command(`remote:list`).description(`List all configured remotes`).action(Xt),e.command(`remote:use [name]`).description(`Set the default remote`).action(Zt),e.command(`remote:status`).description(`Show active remote auth status`).action(Qt),e.command(`remote:remove <name>`).description(`Remove a remote`).action($t);let t=e.command(`remote`,{hidden:!0}).description(`Manage remote Twenty servers`),n=(e,t)=>console.warn(u.default.yellow(`⚠ \`twenty remote ${e}\` is deprecated. Use \`twenty ${t}\` instead.`));t.command(`add`).option(`--as <name>`,`Name for this remote`).option(`--api-key <apiKey>`,`API key for non-interactive auth`).option(`--url <url>`,`Server URL`).option(`--api-url <apiUrl>`,`[deprecated: use --url]`).option(`--local`,`Connect to a local Twenty server (auto-detect)`).option(`--test`,`Write to config.test.json (for integration tests)`).action(async e=>{n(`add`,`remote:add`),await Yt(e)}),t.command(`list`).action(async()=>{n(`list`,`remote:list`),await Xt()}),t.command(`switch [name]`).action(async e=>{n(`switch`,`remote:use`),await Zt(e)}),t.command(`status`).action(async()=>{n(`status`,`remote:status`),await Qt()}),t.command(`remove <name>`).action(async e=>{n(`remove`,`remote:remove`),await $t(e)})},tn=e=>{Rt(e),ee(e),Gt(e),en(e),Ne(e)};h.inspect.defaultOptions.depth=10;var nn=new m.Command;nn.name(`twenty`).description(`CLI for Twenty application development`).version(t.P.version),nn.option(`-r, --remote <name>`,`Use a specific remote (overrides the default set by remote:use)`),nn.hook(`preAction`,async e=>{let n=(e.optsWithGlobals?e.optsWithGlobals():e.opts()).remote;n?console.log(u.default.gray(`Using remote: ${n}`)):n=await new t.V().getDefaultRemote(),t.V.setActiveRemote(n)}),tn(nn),nn.exitOverride();try{nn.parse()}catch(e){e instanceof m.CommanderError&&process.exit(e.exitCode),e instanceof Error&&(console.error(u.default.red(`Error:`),e.message),process.exit(1))}
|