twenty-sdk 0.6.0 → 0.6.2
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 +6 -2
- package/dist/{HtmlTagToRemoteComponent-DzQ2I9Lz.js → HtmlTagToRemoteComponent-CgtwxDeH.js} +11 -11
- package/dist/{HtmlTagToRemoteComponent-DBOkvIRB.mjs → HtmlTagToRemoteComponent-D_EW5OLu.mjs} +1743 -1640
- package/dist/cli/utilities/api/api-service.d.ts +4 -0
- package/dist/cli/utilities/build/common/esbuild-watcher.d.ts +5 -2
- package/dist/cli/utilities/build/common/typecheck-plugin.d.ts +1 -1
- package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +2 -0
- package/dist/cli/utilities/client/client-service.d.ts +5 -1
- package/dist/cli/utilities/client/twenty-client-template.d.ts +42 -0
- package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator.d.ts +2 -0
- package/dist/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.d.ts +2 -0
- package/dist/cli.cjs +430 -75
- package/dist/cli.mjs +3175 -2725
- package/dist/front-component-renderer/index.cjs +11 -11
- package/dist/front-component-renderer/index.d.ts +3 -3
- package/dist/front-component-renderer/index.mjs +2186 -1906
- package/dist/front-component-renderer/remote/generated/remote-components.d.ts +44 -0
- package/dist/front-component-renderer/remote/generated/remote-elements.d.ts +93 -0
- package/dist/front-component-renderer/types/FrontComponentHostCommunicationApi.d.ts +2 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-GxSybvDe.js → get-function-input-schema-BZ7_XyUh-CCSi0u_q.js} +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-By3UDh4s.mjs → get-function-input-schema-BZ7_XyUh-DAPandzB.mjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +122 -89
- package/dist/sdk/application/application-config.d.ts +1 -1
- package/dist/sdk/front-component-api/constants/AllowedHtmlElements.d.ts +1 -0
- package/dist/sdk/front-component-api/constants/AllowedHtmlElements.js +104 -1
- package/dist/sdk/front-component-api/constants/AllowedHtmlElements.js.map +1 -1
- package/dist/sdk/front-component-api/constants/EventToReact.js +22 -3
- package/dist/sdk/front-component-api/constants/EventToReact.js.map +1 -1
- package/dist/sdk/front-component-api/constants/SerializedEventData.d.ts +7 -0
- package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.d.ts +2 -0
- package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.js.map +1 -1
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.js +70 -66
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/logic-functions/define-post-install-logic-function.d.ts +6 -0
- package/dist/sdk/logic-functions/define-post-install-logic-function.js +12 -0
- package/dist/sdk/logic-functions/define-post-install-logic-function.js.map +1 -0
- package/dist/sdk/logic-functions/define-pre-install-logic-function.d.ts +6 -0
- package/dist/sdk/logic-functions/define-pre-install-logic-function.js +12 -0
- package/dist/sdk/logic-functions/define-pre-install-logic-function.js.map +1 -0
- package/dist/sdk/logic-functions/install-logic-function-payload-type.d.ts +4 -0
- package/generated/core/index.ts +406 -0
- package/generated/core/runtime/batcher.ts +265 -0
- package/generated/core/runtime/createClient.ts +68 -0
- package/generated/core/runtime/error.ts +29 -0
- package/generated/core/runtime/fetcher.ts +98 -0
- package/generated/core/runtime/generateGraphqlOperation.ts +225 -0
- package/generated/core/runtime/index.ts +13 -0
- package/generated/core/runtime/linkTypeMap.ts +139 -0
- package/generated/core/runtime/typeSelection.ts +98 -0
- package/generated/core/runtime/types.ts +69 -0
- package/generated/core/schema.graphql +36745 -0
- package/generated/core/schema.ts +39341 -0
- package/generated/core/types.ts +45860 -0
- package/generated/index.ts +2 -0
- package/generated/metadata/index.ts +469 -0
- package/generated/metadata/runtime/batcher.ts +265 -0
- package/generated/metadata/runtime/createClient.ts +68 -0
- package/generated/metadata/runtime/error.ts +29 -0
- package/generated/metadata/runtime/fetcher.ts +98 -0
- package/generated/metadata/runtime/generateGraphqlOperation.ts +225 -0
- package/generated/metadata/runtime/index.ts +13 -0
- package/generated/metadata/runtime/linkTypeMap.ts +139 -0
- package/generated/metadata/runtime/typeSelection.ts +98 -0
- package/generated/metadata/runtime/types.ts +69 -0
- package/generated/metadata/schema.graphql +3971 -0
- package/generated/metadata/schema.ts +8357 -0
- package/generated/metadata/types.ts +10044 -0
- package/package.json +17 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
const require = __createRequire(import.meta.url);`},
|
|
2
|
+
"use strict";var Tm=Object.create;var sl=Object.defineProperty;var Em=Object.getOwnPropertyDescriptor;var Fm=Object.getOwnPropertyNames;var Cm=Object.getPrototypeOf,Pm=Object.prototype.hasOwnProperty;var bm=(o,s,r,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of Fm(s))!Pm.call(o,f)&&f!==r&&sl(o,f,{get:()=>s[f],enumerable:!(l=Em(s,f))||l.enumerable});return o};var Rm=(o,s,r)=>(r=o!=null?Tm(Cm(o)):{},bm(s||!o||!o.__esModule?sl(r,"default",{value:o,enumerable:!0}):r,o));const R=require("path"),km=require("chalk"),N=require("react/jsx-runtime"),Kn=require("react"),_l=require("fs-extra"),Om=require("os"),Lm=require("axios"),Nm=require("fs"),Um=require("graphql-sse"),ys=require("graphql"),k=require("./HtmlTagToRemoteComponent-CgtwxDeH.js"),al=require("@genql/cli"),Dm=require("typescript"),$m=require("esbuild"),Wm=require("module"),wl=require("fast-glob");require("@sniptt/guards");const Ue=require("uuid"),Mm=require("crypto"),Bm=require("node:fs/promises"),jm=require("fs/promises"),xl=require("node:child_process"),qm=require("node:path"),Hm=require("chokidar"),Gm=require("inquirer"),zm=require("lodash.kebabcase"),Al=require("commander"),Jm=require("util"),Bt=o=>o&&o.__esModule?o:{default:o};function jt(o){if(o&&o.__esModule)return o;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(s,r,l.get?l:{enumerable:!0,get:()=>o[r]})}}return s.default=o,Object.freeze(s)}const Y=jt(R),S=Bt(km),Sl=Bt(Kn),P=jt(_l),xs=jt(Om),yn=Bt(Lm),ol=jt(Nm),_n=jt(Dm),Il=jt($m),Kr=Bt(Mm),Km=jt(Bm),ll=jt(jm),Gr=Bt(qm),Tl=Bt(Hm),lt=Bt(Gm),Qe=Bt(zm);var qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const Se=process.env.INIT_CWD||process.cwd(),Gn=o=>o&&!o?.startsWith("/")?R.join(Se,o):o,Hr="api-client",As="public",ul="TWENTY_API_URL",Vr="generated",Vm={js:`import { createRequire as __createRequire } from 'module';
|
|
3
|
+
const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(o=>(o.Object="object",o.Field="field",o.LogicFunction="logicFunction",o.FrontComponent="frontComponent",o.Role="role",o.Skill="skill",o.View="view",o.NavigationMenuItem="navigationMenuItem",o.PageLayout="pageLayout",o))(K||{});const Ze={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},Ym=o=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[o],Xm=o=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[o],Zm=o=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[o],Qm={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},El=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Fl=["↑","⇡","↟","⤒"],Cl={[K.Object]:"Objects",[K.Field]:"Fields",[K.LogicFunction]:"Logic functions",[K.FrontComponent]:"Front components",[K.Role]:"Roles",[K.Skill]:"Skills",[K.View]:"Views",[K.NavigationMenuItem]:"Navigation menu items",[K.PageLayout]:"Page layouts"},Pl=Object.keys(Cl),ev={info:"gray",success:"green",error:"red",warning:"yellow"},tv=o=>o.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),nv=(o,s=40)=>{if(o.length<=s)return o;const r=o.split("/");return r.length<=2?o:`.../${r.slice(-2).join("/")}`},rv=o=>{const s=new Map;for(const r of Pl)s.set(r,[]);for(const r of o.values()){if(!r.type)continue;const l=s.get(r.type)??[];l.push(r),s.set(r.type,l)}return s},iv=o=>!o.frontendUrl||!o.steps.resolveApplication.output.universalIdentifier?null:`${o.frontendUrl}/settings/applications`,sv=o=>o.some(s=>s==="error")?"error":o.some(s=>s==="in_progress")?"in_progress":o.every(s=>s==="done")?"done":"idle",av=o=>{const s=[...o.entities.values()],r=s.some(v=>v.status==="error"),l=s.some(v=>v.status==="building"),f=s.length>0&&s.every(v=>v.status==="uploading"||v.status==="success"),m=r?"error":l?"in_progress":f?"done":"idle";return[{label:"Application Initialization",status:sv([o.steps.checkServer.status,o.steps.ensureValidTokens.status,o.steps.resolveApplication.status])},{label:"Resources Build",status:m},{label:"Resources Upload",status:o.steps.uploadFiles.status},{label:"Manifest Build",status:o.steps.buildManifest.status},{label:"Application Synchronization",status:o.steps.syncApplication.status},{label:"Api Client Generation",status:o.steps.generateApiClient.status}]},cl=(o,s=80,r=!0)=>{const[l,f]=Kn.useState(0);return Kn.useEffect(()=>{if(!r)return;const m=setInterval(()=>{f(v=>(v+1)%o.length)},s);return()=>clearInterval(m)},[o,s,r]),o[l]},Ss=o=>{const s=Ze[o],r=cl(El,80,s.icon==="spinner"),l=cl(Fl,200,s.icon==="upload");return s.icon==="spinner"?r:s.icon==="upload"?l:s.icon},bl=Sl.default.createContext(null),ov=bl.Provider,Ft=()=>{const o=Sl.default.useContext(bl);if(!o)throw new Error("useInk must be used within InkProvider");return o},lv=({uiStatus:o})=>{const{Text:s}=Ft(),r=Ss(o),l=Ze[o];return N.jsxs(s,{color:l.color,children:[r," "]})},uv=({entity:o})=>{const{Box:s,Text:r}=Ft();return N.jsxs(s,{children:[N.jsx(lv,{uiStatus:Xm(o.status)}),N.jsx(r,{children:o.name}),o.path!==o.name&&N.jsxs(r,{dimColor:!0,children:[" (",nv(o.path),")"]})]})},cv=({type:o,entities:s})=>{const{Box:r,Text:l}=Ft();return s.length===0?null:N.jsxs(r,{flexDirection:"column",marginTop:1,children:[N.jsx(l,{bold:!0,dimColor:!0,children:Cl[o]}),s.map(f=>N.jsx(uv,{entity:f},f.path))]})},fv=()=>{const{Box:o,Text:s}=Ft();return N.jsx(o,{marginTop:1,children:N.jsxs(s,{dimColor:!0,children:[N.jsx(s,{color:Ze.idle.color,children:Ze.idle.icon})," ","pending"," ",N.jsx(s,{color:Ze.in_progress.color,children:El[0]})," ","building"," ",N.jsx(s,{color:Ze.uploading.color,children:Fl[0]})," ","uploading"," ",N.jsx(s,{color:Ze.done.color,children:Ze.done.icon})," ","success"," ",N.jsx(s,{color:Ze.error.color,children:Ze.error.icon})," ","error"]})})},pv=({state:o})=>{const{Text:s}=Ft(),r=Zm(o.pipeline.status),l=Ss(r),f=Ze[r],m=Qm[o.pipeline.status];return N.jsxs(s,{color:f.color,children:[l," ",m,o.pipeline.error&&`: ${o.pipeline.error}`]})},dv=({label:o,status:s})=>{const{Box:r,Text:l}=Ft(),f=Ym(s),m=Ss(f),v=Ze[f];return N.jsxs(r,{children:[N.jsxs(l,{dimColor:!0,children:[o,": "]}),N.jsxs(l,{color:v.color,children:[m," ",s.replace("_"," ")]})]})},hv=({state:o})=>{const{Box:s,Text:r}=Ft(),l=rv(o.entities),f=iv(o);return N.jsxs(s,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[N.jsx(r,{bold:!0,color:"cyan",children:"Application"}),N.jsxs(s,{marginLeft:2,flexDirection:"column",children:[N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Name: "}),N.jsx(r,{bold:!0,children:o.pipeline.appName??"Loading..."})]}),N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Overall Status: "}),N.jsx(pv,{state:o})]}),f&&N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Open:"}),N.jsxs(r,{bold:!0,color:"cyan",children:[" ",f]})]})]}),N.jsx(s,{marginLeft:2,flexDirection:"column",marginTop:1,children:av(o).map(m=>N.jsx(dv,{label:m.label,status:m.status},m.label))}),N.jsx(s,{marginLeft:2,flexDirection:"column",children:Pl.map(m=>{const v=l.get(m)??[];return N.jsx(cv,{type:m,entities:v},m)})})]})},gv=({event:o})=>{const{Box:s,Text:r}=Ft(),l=ev[o.status],f=tv(o.timestamp);return N.jsxs(s,{children:[N.jsxs(r,{dimColor:!0,children:[f," "]}),N.jsx(r,{color:l,children:o.message})]})},mv=({uiStateManager:o})=>{const{Box:s,Static:r}=Ft(),[,l]=Kn.useReducer(m=>m+1,0);Kn.useEffect(()=>o.subscribe(()=>l()),[o]);const f=o.getSnapshot();return N.jsxs(N.Fragment,{children:[N.jsx(r,{items:f.events,children:m=>N.jsx(gv,{event:m},m.id)}),N.jsxs(s,{marginTop:1,flexDirection:"column",children:[N.jsx(hv,{state:f}),N.jsx(fv,{})]})]})},vv=async o=>{const s=await import("ink"),{render:r,Box:l,Text:f,Static:m}=s,{unmount:v}=r(N.jsx(ov,{value:{Box:l,Text:f,Static:m},children:N.jsx(mv,{uiStateManager:o})}));return{unmount:v}};class yv{constructor(s){this.listeners=new Set,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){for(const s of this.listeners)s(this.orchestratorState)}}const _v=Y.join(xs.tmpdir(),".twenty-sdk-test"),wv=()=>process.env.NODE_ENV==="test"?Y.join(_v,"config.json"):Y.join(xs.homedir(),".twenty","config.json"),Et="default",Jr=class Jr{constructor(){this.configPath=wv()}static setActiveWorkspace(s){this.activeWorkspace=s??Et}static getActiveWorkspace(){return this.activeWorkspace}getActiveWorkspaceName(){return Jr.getActiveWorkspace()}async readRawConfig(){await P.ensureFile(this.configPath);const s=await P.readFile(this.configPath,"utf8");return JSON.parse(s||"{}")}async getConfig(){return this.getConfigForWorkspace(this.getActiveWorkspaceName())}async getConfigForWorkspace(s){const r=this.getDefaultConfig();try{const l=await this.readRawConfig(),f=s===Et&&!l.profiles?.[Et]?l:l.profiles?.[s],m=f?.apiUrl??r.apiUrl,v=f?.apiKey,E=f?.applicationAccessToken,C=f?.applicationRefreshToken;return{apiUrl:m,apiKey:v,applicationAccessToken:E,applicationRefreshToken:C}}catch{return r}}async setConfig(s){const r=await this.readRawConfig(),l=this.getActiveWorkspaceName();r.profiles||(r.profiles={});const f=r.profiles[l]||{apiUrl:""};r.profiles[l]={...f,...s},await P.ensureDir(Y.dirname(this.configPath)),await P.writeFile(this.configPath,JSON.stringify(r,null,2))}async clearConfig(){const s=await this.readRawConfig(),r=this.getActiveWorkspaceName();if(s.profiles||(s.profiles={}),s.profiles[r]&&delete s.profiles[r],r===Et){const l=this.getDefaultConfig();delete s.apiKey,s.apiUrl=l.apiUrl}await P.ensureDir(Y.dirname(this.configPath)),await P.writeFile(this.configPath,JSON.stringify(s,null,2))}getDefaultConfig(){return{apiUrl:"http://localhost:3000"}}async getAvailableWorkspaces(){try{const s=await this.readRawConfig(),r=new Set;return r.add(Et),s.profiles&&Object.keys(s.profiles).forEach(l=>r.add(l)),Array.from(r).sort()}catch{return[Et]}}async getDefaultWorkspace(){try{return(await this.readRawConfig()).defaultWorkspace??Et}catch{return Et}}async setDefaultWorkspace(s){const r=await this.readRawConfig();r.defaultWorkspace=s,await P.ensureDir(Y.dirname(this.configPath)),await P.writeFile(this.configPath,JSON.stringify(r,null,2))}};Jr.activeWorkspace=Et;let _e=Jr;class Ct{constructor(s){const{disableInterceptors:r=!1}=s||{};this.configService=new _e,this.client=yn.default.create(),this.client.interceptors.request.use(async l=>{const f=await this.configService.getConfig();return l.baseURL=f.apiUrl,!l.headers.Authorization&&f.apiKey&&(l.headers.Authorization=`Bearer ${f.apiKey}`),l}),!r&&this.client.interceptors.response.use(l=>l,l=>{throw l.response?.status===401?console.error(S.default.red("Authentication failed. Please run `twenty auth:login` first.")):l.response?.status===403?console.error(S.default.red("Access denied. Check your API key and workspace permissions.")):l.code==="ECONNREFUSED"&&console.error(S.default.red("Cannot connect to Twenty server. Is it running?")),l})}async validateAuth(){try{const r=await this.client.post("/metadata",{query:`
|
|
4
4
|
query CurrentWorkspace {
|
|
5
5
|
currentWorkspace {
|
|
6
6
|
id
|
|
@@ -46,18 +46,18 @@ const require = __createRequire(import.meta.url);`},Qe=".twenty/output";var K=(o
|
|
|
46
46
|
universalIdentifier
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`,l={input:{universalIdentifier:s.application.universalIdentifier,name:s.application.displayName,version:"0.0.1",sourcePath:"cli-sync"}},
|
|
49
|
+
`,l={input:{universalIdentifier:s.application.universalIdentifier,name:s.application.displayName,version:"0.0.1",sourcePath:"cli-sync"}},f=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]}:{success:!0,data:f.data.data.createOneApplication,message:`Successfully create application: ${s.application.displayName}`}}catch(r){return{success:!1,error:r}}}async syncApplication(s){try{const r=`
|
|
50
50
|
mutation SyncApplication($manifest: JSON!) {
|
|
51
51
|
syncApplication(manifest: $manifest) {
|
|
52
52
|
applicationUniversalIdentifier
|
|
53
53
|
actions
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
`,l={manifest:s},
|
|
56
|
+
`,l={manifest:s},f=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]}:{success:!0,data:f.data.data.syncApplication,message:`Successfully synced application: ${s.application.displayName}`}}catch(r){if(yn.default.isAxiosError(r)&&r.response){const l=r.response.data?.errors;return Array.isArray(l)&&l.length>0?{success:!1,error:l[0]?.message||r.message}:{success:!1,error:r.response.data?.message||`HTTP ${r.response.status}: ${r.message}`}}return{success:!1,error:r instanceof Error?r.message:r}}}async uninstallApplication(s){try{const r=`
|
|
57
57
|
mutation UninstallApplication($universalIdentifier: String!) {
|
|
58
58
|
uninstallApplication(universalIdentifier: $universalIdentifier)
|
|
59
59
|
}
|
|
60
|
-
`,l={universalIdentifier:s},
|
|
60
|
+
`,l={universalIdentifier:s},f=await this.client.post("/metadata",{query:r,variables:l},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]?.message||"Failed to delete application"}:{success:!0,data:f.data.data.uninstallApplication,message:"Successfully uninstalled application"}}catch(r){if(yn.default.isAxiosError(r)&&r.response)return{success:!1,error:r.response.data?.errors?.[0]?.message||r.message};throw r}}async getSchema(s){return this.introspectEndpoint("/graphql",s)}async getMetadataSchema(s){return this.introspectEndpoint("/metadata",s)}async introspectEndpoint(s,r){try{const l=ys.getIntrospectionQuery(),f={"Content-Type":"application/json",Accept:"*/*"};r?.authToken&&(f.Authorization=`Bearer ${r.authToken}`);const m=await this.client.post(s,{query:l},{headers:f});if(m.data.errors)return{success:!1,error:`GraphQL introspection errors: ${JSON.stringify(m.data.errors)}`};const v=ys.buildClientSchema(m.data.data);return{success:!0,data:ys.printSchema(v),message:`Successfully loaded schema from ${s}`}}catch(l){if(yn.default.isAxiosError(l)&&l.response)return{success:!1,error:l.response.data.errors[0]?.message||`Failed to load schema from ${s}`};throw l}}async findLogicFunctions(){try{const r=await this.client.post("/metadata",{query:`
|
|
61
61
|
query FindManyLogicFunctions {
|
|
62
62
|
findManyLogicFunctions {
|
|
63
63
|
id
|
|
@@ -76,51 +76,206 @@ const require = __createRequire(import.meta.url);`},Qe=".twenty/output";var K=(o
|
|
|
76
76
|
error
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
`,
|
|
79
|
+
`,f={input:{id:s,payload:r}},m=await this.client.post("/metadata",{query:l,variables:f},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return m.data.errors?{success:!1,error:m.data.errors[0]?.message||"Failed to execute logic function"}:{success:!0,data:m.data.data.executeOneLogicFunction}}catch(l){return{success:!1,error:l}}}async subscribeToLogs({applicationUniversalIdentifier:s,functionUniversalIdentifier:r,functionName:l}){const f=await this.configService.getConfig(),m=Um.createClient({url:f.apiUrl+"/metadata",headers:{Authorization:`Bearer ${f.apiKey}`,"Content-Type":"application/json",Accept:"text/event-stream"}}),v=`
|
|
80
80
|
subscription SubscribeToLogs($input: LogicFunctionLogsInput!) {
|
|
81
81
|
logicFunctionLogs(input: $input) {
|
|
82
82
|
logs
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
`,E={input:{applicationUniversalIdentifier:s,universalIdentifier:r,name:l}};m.subscribe({query:v,variables:E},{next:({data:
|
|
85
|
+
`,E={input:{applicationUniversalIdentifier:s,universalIdentifier:r,name:l}};m.subscribe({query:v,variables:E},{next:({data:C})=>console.log(C?.logicFunctionLogs.logs),error:C=>console.error(C),complete:()=>console.log("Completed")})}async uploadFile({filePath:s,builtHandlerPath:r,fileFolder:l,applicationUniversalIdentifier:f}){try{const m=Y.resolve(s);if(!ol.existsSync(m))return{success:!1,error:`File not found: ${m}`};const v=Y.basename(m),E=ol.readFileSync(m),C=this.getMimeType(v),M=`
|
|
86
86
|
mutation UploadApplicationFile($file: Upload!, $applicationUniversalIdentifier: String!, $fileFolder: FileFolder!, $filePath: String!) {
|
|
87
87
|
uploadApplicationFile(file: $file, applicationUniversalIdentifier: $applicationUniversalIdentifier, fileFolder: $fileFolder, filePath: $filePath)
|
|
88
88
|
{ path }
|
|
89
89
|
}
|
|
90
|
-
`,
|
|
90
|
+
`,q=k.AO(l),X=JSON.stringify({query:M,variables:{file:null,applicationUniversalIdentifier:f,filePath:r,fileFolder:q}}),U=JSON.stringify({0:["variables.file"]}),V=new FormData;V.append("operations",X),V.append("map",U),V.append("0",new Blob([new Uint8Array(E)],{type:C}),v);const ne=await this.client.post("/metadata",V);return ne.data.errors?{success:!1,error:ne.data.errors[0]?.message||"Failed to upload file"}:{success:!0,data:ne.data.data.uploadApplicationFile,message:`Successfully uploaded ${v}`}}catch(m){return yn.default.isAxiosError(m)&&m.response?{success:!1,error:m.response.data?.errors?.[0]?.message||m.message}:{success:!1,error:m}}}getMimeType(s){const r=Y.extname(s).toLowerCase();return{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".bmp":"image/bmp",".ico":"image/x-icon",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".txt":"text/plain",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".mp3":"audio/mpeg",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".js":"application/javascript",".ts":"application/typescript",".jsx":"application/javascript",".tsx":"application/typescript",".html":"text/html",".css":"text/css"}[r]||"application/octet-stream"}}const xv=`// Ambient type stubs for the genql-generated code this template gets
|
|
91
|
+
// injected into. They enable full typecheck/lint on this file.
|
|
92
|
+
// __STRIPPED_DURING_INJECTION_START__
|
|
93
|
+
type QueryGenqlSelection = Record<string, unknown>;
|
|
94
|
+
type MutationGenqlSelection = Record<string, unknown>;
|
|
95
|
+
type GraphqlOperation = Record<string, unknown>;
|
|
96
|
+
|
|
97
|
+
type ClientOptions = {
|
|
98
|
+
url?: string;
|
|
99
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
100
|
+
fetcher?: (
|
|
101
|
+
operation: GraphqlOperation | GraphqlOperation[],
|
|
102
|
+
) => Promise<unknown>;
|
|
103
|
+
fetch?: typeof globalThis.fetch;
|
|
104
|
+
batch?: unknown;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type Client = {
|
|
108
|
+
query: (
|
|
109
|
+
request: QueryGenqlSelection & { __name?: string },
|
|
110
|
+
) => Promise<unknown>;
|
|
111
|
+
mutation: (
|
|
112
|
+
request: MutationGenqlSelection & { __name?: string },
|
|
113
|
+
) => Promise<unknown>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare function createClient(options: ClientOptions): Client;
|
|
117
|
+
|
|
118
|
+
declare class GenqlError extends Error {
|
|
119
|
+
constructor(errors: unknown, data: unknown);
|
|
120
|
+
}
|
|
121
|
+
// __STRIPPED_DURING_INJECTION_END__
|
|
122
|
+
|
|
123
|
+
const APP_ACCESS_TOKEN_ENV_KEY = 'TWENTY_APP_ACCESS_TOKEN';
|
|
124
|
+
const API_KEY_ENV_KEY = 'TWENTY_API_KEY';
|
|
125
|
+
|
|
126
|
+
type TwentyGeneratedClientOptions = ClientOptions;
|
|
127
|
+
|
|
128
|
+
type ProcessEnvironment = Record<string, string | undefined>;
|
|
129
|
+
|
|
130
|
+
type GraphqlErrorPayloadEntry = {
|
|
131
|
+
message?: string;
|
|
132
|
+
extensions?: { code?: string };
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type GraphqlResponsePayload = {
|
|
136
|
+
data?: Record<string, unknown>;
|
|
137
|
+
errors?: GraphqlErrorPayloadEntry[];
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type GraphqlResponse = {
|
|
141
|
+
status: number;
|
|
142
|
+
statusText: string;
|
|
143
|
+
payload: GraphqlResponsePayload | null;
|
|
144
|
+
rawBody: string;
|
|
145
|
+
};
|
|
91
146
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
147
|
+
const getProcessEnvironment = (): ProcessEnvironment => {
|
|
148
|
+
const processObject = (
|
|
149
|
+
globalThis as { process?: { env?: ProcessEnvironment } }
|
|
150
|
+
).process;
|
|
151
|
+
|
|
152
|
+
return processObject?.env ?? {};
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const getTokenFromAuthorizationHeader = (
|
|
156
|
+
authorizationHeader: string | undefined,
|
|
157
|
+
): string | null => {
|
|
158
|
+
if (typeof authorizationHeader !== 'string') {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const trimmedAuthorizationHeader = authorizationHeader.trim();
|
|
163
|
+
|
|
164
|
+
if (trimmedAuthorizationHeader.length === 0) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (trimmedAuthorizationHeader === 'Bearer') {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (trimmedAuthorizationHeader.startsWith('Bearer ')) {
|
|
173
|
+
return trimmedAuthorizationHeader.slice('Bearer '.length).trim();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return trimmedAuthorizationHeader;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const getTokenFromHeaders = (
|
|
180
|
+
headers: HeadersInit | undefined,
|
|
181
|
+
): string | null => {
|
|
182
|
+
if (!headers) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
95
185
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
186
|
+
if (headers instanceof Headers) {
|
|
187
|
+
return getTokenFromAuthorizationHeader(
|
|
188
|
+
headers.get('Authorization') ?? undefined,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (Array.isArray(headers)) {
|
|
193
|
+
const matchedAuthorizationHeader = headers.find(
|
|
194
|
+
([headerName]) => headerName.toLowerCase() === 'authorization',
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
return getTokenFromAuthorizationHeader(matchedAuthorizationHeader?.[1]);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const headersRecord = headers as Record<string, string | undefined>;
|
|
201
|
+
|
|
202
|
+
return getTokenFromAuthorizationHeader(
|
|
203
|
+
headersRecord.Authorization ?? headersRecord.authorization,
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const hasAuthenticationErrorInGraphqlPayload = (
|
|
208
|
+
payload: GraphqlResponsePayload | null,
|
|
209
|
+
): boolean => {
|
|
210
|
+
if (!payload?.errors) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return payload.errors.some((graphqlError) => {
|
|
215
|
+
return (
|
|
216
|
+
graphqlError.extensions?.code === 'UNAUTHENTICATED' ||
|
|
217
|
+
graphqlError.message?.toLowerCase() === 'unauthorized'
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const defaultOptions: TwentyGeneratedClientOptions = {
|
|
223
|
+
url: '__TWENTY_DEFAULT_URL__',
|
|
99
224
|
headers: {
|
|
100
225
|
'Content-Type': 'application/json',
|
|
101
|
-
Authorization: \`Bearer \${process.env.${Gm}}\`,
|
|
102
226
|
},
|
|
103
|
-
}
|
|
227
|
+
};
|
|
104
228
|
|
|
105
|
-
export
|
|
229
|
+
export class TwentyGeneratedClient {
|
|
106
230
|
private client: Client;
|
|
107
231
|
private url: string;
|
|
108
|
-
private
|
|
109
|
-
private
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
232
|
+
private requestOptions: RequestInit;
|
|
233
|
+
private headers: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
234
|
+
private fetchImplementation: typeof globalThis.fetch | null;
|
|
235
|
+
private authorizationToken: string | null;
|
|
236
|
+
private refreshAccessTokenPromise: Promise<string | null> | null = null;
|
|
237
|
+
|
|
238
|
+
constructor(options?: TwentyGeneratedClientOptions) {
|
|
239
|
+
const merged: TwentyGeneratedClientOptions = {
|
|
113
240
|
...defaultOptions,
|
|
114
241
|
...options,
|
|
115
|
-
headers: {
|
|
116
|
-
...defaultOptions.headers,
|
|
117
|
-
...(options?.headers ?? {}),
|
|
118
|
-
},
|
|
119
242
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
243
|
+
|
|
244
|
+
const {
|
|
245
|
+
url,
|
|
246
|
+
headers,
|
|
247
|
+
fetch: customFetchImplementation,
|
|
248
|
+
fetcher: _fetcher,
|
|
249
|
+
batch: _batch,
|
|
250
|
+
...requestOptions
|
|
251
|
+
} = merged;
|
|
252
|
+
|
|
253
|
+
this.url = url ?? '';
|
|
254
|
+
this.requestOptions = requestOptions;
|
|
255
|
+
this.headers = headers ?? {};
|
|
256
|
+
this.fetchImplementation =
|
|
257
|
+
customFetchImplementation ?? globalThis.fetch ?? null;
|
|
258
|
+
|
|
259
|
+
const processEnvironment = getProcessEnvironment();
|
|
260
|
+
const tokenFromHeaders = getTokenFromHeaders(
|
|
261
|
+
typeof headers === 'function' ? undefined : headers,
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
// Priority: explicit header > app access token > api key (legacy).
|
|
265
|
+
this.authorizationToken =
|
|
266
|
+
tokenFromHeaders ??
|
|
267
|
+
processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] ??
|
|
268
|
+
processEnvironment[API_KEY_ENV_KEY] ??
|
|
269
|
+
null;
|
|
270
|
+
|
|
271
|
+
this.client = createClient({
|
|
272
|
+
...merged,
|
|
273
|
+
headers: undefined,
|
|
274
|
+
fetcher: async (operation) =>
|
|
275
|
+
this.executeGraphqlRequestWithOptionalRefresh({
|
|
276
|
+
operation,
|
|
277
|
+
}),
|
|
278
|
+
});
|
|
124
279
|
}
|
|
125
280
|
|
|
126
281
|
query<R extends QueryGenqlSelection>(request: R & { __name?: string }) {
|
|
@@ -131,6 +286,7 @@ export default class Twenty {
|
|
|
131
286
|
return this.client.mutation(request);
|
|
132
287
|
}
|
|
133
288
|
|
|
289
|
+
// __UPLOAD_FILE_START__
|
|
134
290
|
async uploadFile(
|
|
135
291
|
fileBuffer: Buffer,
|
|
136
292
|
filename: string,
|
|
@@ -151,31 +307,230 @@ export default class Twenty {
|
|
|
151
307
|
query: \`mutation UploadFilesFieldFileByUniversalIdentifier($file: Upload!, $fieldMetadataUniversalIdentifier: String!) {
|
|
152
308
|
uploadFilesFieldFileByUniversalIdentifier(file: $file, fieldMetadataUniversalIdentifier: $fieldMetadataUniversalIdentifier) { id path size createdAt url }
|
|
153
309
|
}\`,
|
|
154
|
-
variables: {
|
|
310
|
+
variables: {
|
|
311
|
+
file: null,
|
|
312
|
+
fieldMetadataUniversalIdentifier,
|
|
313
|
+
},
|
|
155
314
|
}),
|
|
156
315
|
);
|
|
157
316
|
form.append('map', JSON.stringify({ '0': ['variables.file'] }));
|
|
158
|
-
form.append(
|
|
317
|
+
form.append(
|
|
318
|
+
'0',
|
|
319
|
+
new Blob([fileBuffer as BlobPart], { type: contentType }),
|
|
320
|
+
filename,
|
|
321
|
+
);
|
|
159
322
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
headers: {
|
|
163
|
-
|
|
323
|
+
const result = await this.executeGraphqlRequestWithOptionalRefresh({
|
|
324
|
+
operation: form,
|
|
325
|
+
headers: {},
|
|
326
|
+
requestInit: {
|
|
327
|
+
method: 'POST',
|
|
164
328
|
},
|
|
165
|
-
body: form,
|
|
166
329
|
});
|
|
167
330
|
|
|
168
|
-
const result = await response.json();
|
|
169
|
-
|
|
170
331
|
if (result.errors) {
|
|
171
332
|
throw new GenqlError(result.errors, result.data);
|
|
172
333
|
}
|
|
173
334
|
|
|
174
|
-
|
|
335
|
+
const data = result.data as Record<string, unknown>;
|
|
336
|
+
|
|
337
|
+
return data.uploadFilesFieldFileByUniversalIdentifier as {
|
|
338
|
+
id: string;
|
|
339
|
+
path: string;
|
|
340
|
+
size: number;
|
|
341
|
+
createdAt: string;
|
|
342
|
+
url: string;
|
|
343
|
+
};
|
|
175
344
|
}
|
|
176
|
-
|
|
345
|
+
// __UPLOAD_FILE_END__
|
|
346
|
+
|
|
347
|
+
private async executeGraphqlRequestWithOptionalRefresh({
|
|
348
|
+
operation,
|
|
349
|
+
headers,
|
|
350
|
+
requestInit,
|
|
351
|
+
}: {
|
|
352
|
+
operation: GraphqlOperation | GraphqlOperation[] | FormData;
|
|
353
|
+
headers?: HeadersInit;
|
|
354
|
+
requestInit?: RequestInit;
|
|
355
|
+
}) {
|
|
356
|
+
const firstResponse = await this.executeGraphqlRequest({
|
|
357
|
+
operation,
|
|
358
|
+
headers,
|
|
359
|
+
requestInit,
|
|
360
|
+
token: this.authorizationToken,
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
if (this.shouldRefreshToken(firstResponse)) {
|
|
364
|
+
const refreshedAccessToken = await this.requestRefreshedAccessToken();
|
|
365
|
+
|
|
366
|
+
if (refreshedAccessToken) {
|
|
367
|
+
const retryResponse = await this.executeGraphqlRequest({
|
|
368
|
+
operation,
|
|
369
|
+
headers,
|
|
370
|
+
requestInit,
|
|
371
|
+
token: refreshedAccessToken,
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
return this.assertResponseIsSuccessful(retryResponse);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return this.assertResponseIsSuccessful(firstResponse);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
private async executeGraphqlRequest({
|
|
382
|
+
operation,
|
|
383
|
+
headers,
|
|
384
|
+
requestInit,
|
|
385
|
+
token,
|
|
386
|
+
}: {
|
|
387
|
+
operation: GraphqlOperation | GraphqlOperation[] | FormData;
|
|
388
|
+
headers?: HeadersInit;
|
|
389
|
+
requestInit?: RequestInit;
|
|
390
|
+
token: string | null;
|
|
391
|
+
}): Promise<GraphqlResponse> {
|
|
392
|
+
if (!this.fetchImplementation) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
'Global \`fetch\` function is not available, ' +
|
|
395
|
+
'pass a fetch implementation to the Twenty client',
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const resolvedHeaders = await this.resolveHeaders();
|
|
400
|
+
const requestHeaders = new Headers(resolvedHeaders);
|
|
401
|
+
|
|
402
|
+
if (headers) {
|
|
403
|
+
new Headers(headers).forEach((value, key) =>
|
|
404
|
+
requestHeaders.set(key, value),
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (operation instanceof FormData) {
|
|
409
|
+
requestHeaders.delete('Content-Type');
|
|
410
|
+
} else {
|
|
411
|
+
requestHeaders.set('Content-Type', 'application/json');
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (token) {
|
|
415
|
+
requestHeaders.set('Authorization', \`Bearer \${token}\`);
|
|
416
|
+
} else {
|
|
417
|
+
requestHeaders.delete('Authorization');
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const response = await this.fetchImplementation.call(globalThis, this.url, {
|
|
421
|
+
...this.requestOptions,
|
|
422
|
+
...requestInit,
|
|
423
|
+
method: requestInit?.method ?? 'POST',
|
|
424
|
+
headers: requestHeaders,
|
|
425
|
+
body:
|
|
426
|
+
operation instanceof FormData ? operation : JSON.stringify(operation),
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
const rawBody = await response.text();
|
|
430
|
+
let payload: GraphqlResponsePayload | null = null;
|
|
431
|
+
|
|
432
|
+
if (rawBody.trim().length > 0) {
|
|
433
|
+
try {
|
|
434
|
+
payload = JSON.parse(rawBody) as GraphqlResponsePayload;
|
|
435
|
+
} catch {
|
|
436
|
+
payload = null;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
status: response.status,
|
|
442
|
+
statusText: response.statusText,
|
|
443
|
+
payload,
|
|
444
|
+
rawBody,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
private async resolveHeaders(): Promise<HeadersInit> {
|
|
449
|
+
if (typeof this.headers === 'function') {
|
|
450
|
+
return (await this.headers()) ?? {};
|
|
451
|
+
}
|
|
177
452
|
|
|
178
|
-
`;await k.appendFile($.join(s,"index.ts"),r)}}var Al=(o=>(o.DefineApplication="defineApplication",o.DefineField="defineField",o.DefineLogicFunction="defineLogicFunction",o.DefineObject="defineObject",o.DefineRole="defineRole",o.DefineSkill="defineSkill",o.DefineFrontComponent="defineFrontComponent",o.DefineView="defineView",o.DefineNavigationMenuItem="defineNavigationMenuItem",o.DefinePageLayout="definePageLayout",o))(Al||{}),Ye=(o=>(o.Application="application",o.Fields="fields",o.LogicFunctions="logicFunctions",o.Objects="objects",o.Roles="roles",o.Skills="skills",o.FrontComponents="frontComponents",o.PublicAssets="publicAssets",o.Views="views",o.NavigationMenuItems="navigationMenuItems",o.PageLayouts="pageLayouts",o))(Ye||{});const _v={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},wv=o=>{if(!gn.isCallExpression(o))return;const s=o.expression;if(gn.isIdentifier(s)&&Object.values(Al).includes(s.text))return s.text},xv=o=>{const s=gn.createSourceFile("temp.ts",o,gn.ScriptTarget.Latest,!0),r=[];gn.forEachChild(s,l=>{r.push(l)});for(const l of r)if(gn.isExportAssignment(l)){if(l.isExportEquals||!l.expression)return;const p=wv(l.expression);if(p)return p}},Sv=["twenty-sdk/ui"],Av={name:"manifest-mock",setup:o=>{const s=new RegExp(`^(${Sv.map(r=>r.replace("/","\\/")).join("|")})$`);o.onResolve({filter:s},({path:r})=>({path:r,namespace:"manifest-mock"})),o.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},pt=async({filePath:o,appPath:s})=>{const r=await Iv({filePath:o,appPath:s});return Fv(r,o)},Iv=async({filePath:o,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),l=await k.pathExists(r),p=Nm.createRequire(Y.default.join(s,"package.json"));let m,v;try{m=Y.default.dirname(p.resolve("react/package.json")),v=Y.default.dirname(p.resolve("react-dom/package.json"))}catch{}const b=(await ml.build({entryPoints:[o],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:l?r:void 0,alias:{...m&&{react:m},...v&&{"react-dom":v}},plugins:[Av],logLevel:"silent"})).outputFiles[0].text,M=await k.mkdtemp(Y.default.join(ms.default.tmpdir(),"twenty-manifest-")),H=Y.default.join(M,"module.cjs");try{return await k.writeFile(H,b),require(H)}finally{await k.remove(M)}},Fv=(o,s)=>{if(P.o(o.default)&&P.AN(o.default))return o.default;throw new Error(`Config file ${s} must export a config object default export`)},Ev={type:"object",properties:{}},Tv=async o=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-GxSybvDe.js")),r=s(o)[0];return r?.type==="object"&&P.o(r.properties)?{type:"object",properties:r.properties}:Ev},bv="142046f0-4d80-48b5-ad56-26ad410e895c",at=({objectConfig:o,fieldName:s})=>{const r=`${o.universalIdentifier}-${s}`;return We.v5(r,bv)},Cv=o=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:P.R.UUID,universalIdentifier:at({objectConfig:o,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:P.R.TEXT,universalIdentifier:at({objectConfig:o,fieldName:"name"})},l={name:"createdAt",label:"Creation date",description:"Creation date",icon:"IconCalendar",isNullable:!1,defaultValue:"now",type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"createdAt"})},p={name:"updatedAt",label:"Last update",description:"Last time the record was changed",icon:"IconCalendarClock",isNullable:!1,defaultValue:"now",type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"updatedAt"})},m={name:"deletedAt",label:"Deleted at",description:"Deletion date",icon:"IconCalendarClock",isNullable:!0,defaultValue:null,type:P.R.DATE_TIME,universalIdentifier:at({objectConfig:o,fieldName:"deletedAt"})},v={name:"createdBy",label:"Created by",description:"The creator of the record",icon:"IconCreativeCommonsSa",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:P.R.ACTOR,universalIdentifier:at({objectConfig:o,fieldName:"createdBy"})},E={name:"updatedBy",label:"Updated by",description:"The workspace member who last updated the record",icon:"IconUserCircle",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:P.R.ACTOR,universalIdentifier:at({objectConfig:o,fieldName:"updatedBy"})},b={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:P.R.POSITION,universalIdentifier:at({objectConfig:o,fieldName:"position"})},M={name:"searchVector",label:"Search vector",icon:"IconSearch",description:"Search vector",isNullable:!0,defaultValue:null,type:P.R.TS_VECTOR,universalIdentifier:at({objectConfig:o,fieldName:"searchVector"})};return[s,r,l,p,m,v,E,b,M]},qn={targetFieldName:o=>`target${P.cs(o.nameSingular)}`,targetLabel:o=>P.cs(o.nameSingular),icon:"IconBuildingSkyscraper"},Pv=[{...qn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:P.y.timelineActivity.morphIds.targetMorphId.morphId},{...qn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:P.R.RELATION,standardObjectKey:"favorite"},{...qn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:P.y.attachment.morphIds.targetMorphId.morphId},{...qn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:P.y.noteTarget.morphIds.targetMorphId.morphId},{...qn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:P.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:P.y.taskTarget.morphIds.targetMorphId.morphId}],Rv=({config:o,forwardFieldUniversalIdentifier:s,objectConfig:r,universalIdentifier:l})=>{const p=P.y[o.standardObjectKey],m={name:o.targetFieldName(r),label:o.targetLabel(r),description:`${o.targetLabel(r)} ${r.labelSingular}`,icon:o.targetIcon,isNullable:!0,universalSettings:{relationType:P.V.MANY_TO_ONE,onDelete:P.W.SET_NULL,joinColumnName:`target${P.cs(r.nameSingular)}Id`},universalIdentifier:l,objectUniversalIdentifier:p.universalIdentifier,relationTargetFieldMetadataUniversalIdentifier:s,relationTargetObjectMetadataUniversalIdentifier:r.universalIdentifier};return o.targetFieldType===P.R.MORPH_RELATION?{...m,type:o.targetFieldType,morphId:o.morphId}:{...m,type:o.targetFieldType}},Ov=o=>{const s=[],r=[];for(const l of Pv){const p=P.y[l.standardObjectKey],m=at({objectConfig:o,fieldName:l.fieldName}),v=at({objectConfig:o,fieldName:`${l.fieldName}Inverse`}),E={name:l.fieldName,label:l.label,description:`${o.labelPlural} tied to the ${l.targetLabel(o)}`,icon:l.icon,isNullable:!1,type:P.R.RELATION,universalSettings:{relationType:P.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:p.universalIdentifier},b=Rv({config:l,objectConfig:o,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(b)}return{objectFields:s,fields:r}},Lv=o=>{const s=Cv(o),{objectFields:r,fields:l}=Ov(o),p=(o.fields??[]).map(v=>v.name),m=[...o.fields];for(const v of s)p.includes(v.name)||m.push(v);for(const v of r)p.includes(v.name)||m.push(v);return{objectFields:m,fields:l}},kv=async o=>await pl.glob(["**/*.ts","**/*.tsx"],{cwd:o,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),Nv=async o=>await pl.glob([`${vs}/**/*`],{cwd:o,onlyFiles:!0}),Il=async o=>{const s=await kv(o),r=[];let l;const p=[],m=[],v=[],E=[],b=[],M=[],H=[],X=[],N=[],V=[],ie=[],lt=[],Fe=[],dt=[],vn=[],$e=[],bt=[],Me=[],Ct=[],Be=[],Pt=[];for(const le of s){const Jn=await fl.readFile(le,"utf-8"),Pe=$.relative(o,le),zn=xv(Jn);if(!zn)continue;switch(_v[zn]){case Ye.Application:{const B=await pt({appPath:o,filePath:le});l={...B.config,yarnLockChecksum:null,packageJsonChecksum:null,apiClientChecksum:null},r.push(...B.errors),ie.push(Pe);break}case Ye.Objects:{const B=await pt({appPath:o,filePath:le}),{objectFields:de,fields:ht}=Lv(B.config),Re=B.config.labelIdentifierFieldMetadataUniversalIdentifier??de.find(_n=>_n.name==="name")?.universalIdentifier;if(!Re){r.push(`No label identifier field found for object ${B.config.nameSingular}. Please add a field with name "name" to your object.`);break}const ve={...B.config,fields:de,labelIdentifierFieldMetadataUniversalIdentifier:Re};p.push(ve),m.push(...ht),r.push(...B.errors),lt.push(Pe);break}case Ye.Fields:{const B=await pt({appPath:o,filePath:le});m.push(B.config),r.push(...B.errors),Fe.push(Pe);break}case Ye.Roles:{const B=await pt({appPath:o,filePath:le});v.push(B.config),r.push(...B.errors),dt.push(Pe);break}case Ye.Skills:{const B=await pt({appPath:o,filePath:le});E.push(B.config),r.push(...B.errors),vn.push(Pe);break}case Ye.LogicFunctions:{const B=await pt({appPath:o,filePath:le});r.push(...B.errors);const{handler:de,...ht}=B.config,Re=$.relative(o,le),ve=ht.toolInputSchema??await Tv(Jn),_n={...ht,toolInputSchema:ve,handlerName:"default.config.handler",sourceHandlerPath:Re,builtHandlerPath:Re.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};b.push(_n),$e.push(Pe);break}case Ye.FrontComponents:{const B=await pt({appPath:o,filePath:le});r.push(...B.errors);const{component:de,...ht}=B.config,Re=$.relative(o,le),ve={...ht,componentName:de.name,sourceComponentPath:Re,builtComponentPath:Re.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:"",isHeadless:ht.isHeadless??!1};M.push(ve),bt.push(Pe);break}case Ye.Views:{const B=await pt({appPath:o,filePath:le}),de={...B.config};X.push(de),r.push(...B.errors),Ct.push(Pe);break}case Ye.NavigationMenuItems:{const B=await pt({appPath:o,filePath:le});N.push(B.config),r.push(...B.errors),Be.push(Pe);break}case Ye.PageLayouts:{const B=await pt({appPath:o,filePath:le}),de={...B.config};V.push(de),r.push(...B.errors),Pt.push(Pe);break}case Ye.PublicAssets:break;default:P.dt()}}const yn=await Nv(o);for(const le of yn)H.push({filePath:le,fileName:$.basename(le),fileType:$.extname(le).replace(/^\./,""),checksum:null}),Me.push($.relative(o,le));return l||r.push("Cannot build application, please export default defineApplication() to define an application"),{manifest:l?{application:l,objects:p,fields:m,roles:v,skills:E,logicFunctions:b,frontComponents:M,publicAssets:H,views:X,navigationMenuItems:N,pageLayouts:V}:null,filePaths:{application:ie,objects:lt,fields:Fe,roles:dt,skills:vn,logicFunctions:$e,frontComponents:bt,publicAssets:Me,views:Ct,navigationMenuItems:Be,pageLayouts:Pt},errors:r}},Uv=o=>{const s=new Set,r=new Set;for(const l of o)s.has(l)?r.add(l):s.add(l);return Array.from(r)},Fl=o=>{const s=[];if(!o)return[];for(const[r,l]of Object.entries(o))r==="universalIdentifier"&&typeof l=="string"&&s.push(l),typeof l=="object"&&s.push(...Fl(l));return s},Dv=o=>{const s=[],r=[],l=Uv(Fl(o));return l.length>0&&s.push(`Duplicate universal identifiers: ${l.join(", ")}`),P.na(o.objects)||r.push("No object defined"),P.na(o.logicFunctions)||r.push("No logic function defined"),P.na(o.frontComponents)||r.push("No front component defined"),{errors:s,warnings:r,isValid:s.length===0}};class Wv{constructor({state:s,notify:r}){this.state=s,this.notify=r}async execute(s){const r=this.state.steps.buildManifest;r.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],p=await Il(s.appPath);if(p.errors.length>0||!p.manifest){for(const v of p.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}const m=Dv(p.manifest);if(!m.isValid){for(const v of m.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(m.warnings.length>0)for(const v of m.warnings)l.push({message:`⚠ ${v}`,status:"warning"});return l.push({message:"Successfully built manifest",status:"success"}),r.output={result:p},r.status="done",this.state.updatePipeline({appName:p.manifest.application.displayName}),this.state.updateEntitiesFromManifest(p.filePaths),this.state.applyStepEvents(l),p}}class $v{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();return r.serverUp?r.authValid?(s.output={isReady:!0,errorLogged:!1},s.status="done",this.notify(),!0):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed",status:"error"}]),this.state.updatePipeline({status:"error"})),!1):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Cannot reach server",status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}}class Mv{constructor({apiService:s,configService:r,state:l,notify:p}){this.apiService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){if(!s.applicationId)return;const r=this.state.steps.ensureValidTokens;r.status="in_progress",this.notify();const l=await this.configService.getConfig();if(l.applicationAccessToken&&!this.isTokenExpired(l.applicationAccessToken)){r.status="done",this.notify();return}if(l.applicationRefreshToken&&!this.isTokenExpired(l.applicationRefreshToken)){const p=await this.apiService.renewApplicationToken(l.applicationRefreshToken);if(p.success){await this.configService.setConfig({applicationAccessToken:p.data.applicationAccessToken.token,applicationRefreshToken:p.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:"Application tokens renewed",status:"success"}]),r.status="done",this.notify();return}this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:`Failed to renew application tokens: ${JSON.stringify(p.error,null,2)}`,status:"error"}]),await this.exchangeTokens({applicationId:s.applicationId});return}await this.exchangeTokens({applicationId:s.applicationId})}async exchangeTokens(s){const r=await this.apiService.generateApplicationToken(s.applicationId);if(!r.success){this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:`Failed to generate application tokens: ${JSON.stringify(r.error,null,2)}`,status:"error"}]),this.state.steps.ensureValidTokens.status="error",this.notify();return}await this.configService.setConfig({applicationAccessToken:r.data.applicationAccessToken.token,applicationRefreshToken:r.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:"Application tokens stored in config",status:"success"}]),this.state.steps.ensureValidTokens.status="done",this.notify()}isTokenExpired(s){try{const r=JSON.parse(Buffer.from(s.split(".")[1],"base64").toString());return Date.now()>=r.exp*1e3-6e4}catch{return!0}}}class Bv{constructor({clientService:s,configService:r,state:l,notify:p}){this.clientService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generate({appPath:s.appPath,authToken:l.applicationAccessToken}),r.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),r.status="error"}this.notify()}}class jv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.resolveApplication;r.status="in_progress",this.notify();const l=s.manifest.application.universalIdentifier,p=await this.apiService.findOneApplication(l);if(!p.success)return this.state.applyStepEvents([{message:`Failed to find application ${l}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output;if(p.data)return r.output={applicationId:p.data.id,universalIdentifier:p.data.universalIdentifier},r.status="done",this.notify(),r.output;const m=await this.apiService.createApplication(s.manifest);return m.success?(r.output={applicationId:m.data.id,universalIdentifier:m.data.universalIdentifier},this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:"Application created",status:"success"}]),r.status="done",this.notify(),r.output):(this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:`Application creation failed with error ${JSON.stringify(m.error,null,2)}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output)}}const qv=async(o,s,r)=>{const l=new Set(r),p=s.filter(m=>!l.has(m));for(const m of p){const v=m.replace(/\.tsx?$/,".mjs"),E=Y.default.join(o,v),b=`${E}.map`;await k.remove(E),await k.remove(b)}},Hv=async({result:o,appPath:s,fileFolder:r,lastChecksums:l,onFileBuilt:p})=>{const m=Object.keys(o.metafile?.outputs??{}).filter(v=>v.endsWith(".mjs"));for(const v of m){const E=Y.default.resolve(v),b=Y.default.relative(s,E),M=o.metafile?.outputs?.[v]?.entryPoint||"",H=Y.default.relative(s,M),X=await k.readFile(E),N=Hr.default.createHash("md5").update(X).digest("hex");l.get(b)!==N&&(l.set(b,N),p&&await p({fileFolder:r,builtPath:b,sourcePath:H,checksum:N}))}},Gv=[],Jv=`
|
|
453
|
+
return this.headers ?? {};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
private shouldRefreshToken(response: GraphqlResponse): boolean {
|
|
457
|
+
if (response.status === 401) {
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return hasAuthenticationErrorInGraphqlPayload(response.payload);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
private assertResponseIsSuccessful(response: GraphqlResponse) {
|
|
465
|
+
if (response.status < 200 || response.status >= 300) {
|
|
466
|
+
throw new Error(\`\${response.statusText}: \${response.rawBody}\`);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (response.payload === null) {
|
|
470
|
+
throw new Error('Invalid JSON response');
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return response.payload;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
private async requestRefreshedAccessToken(): Promise<string | null> {
|
|
477
|
+
const refreshAccessTokenFunction = (
|
|
478
|
+
globalThis as {
|
|
479
|
+
frontComponentHostCommunicationApi?: {
|
|
480
|
+
requestAccessTokenRefresh?: () => Promise<string>;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
).frontComponentHostCommunicationApi?.requestAccessTokenRefresh;
|
|
484
|
+
|
|
485
|
+
if (typeof refreshAccessTokenFunction !== 'function') {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (!this.refreshAccessTokenPromise) {
|
|
490
|
+
this.refreshAccessTokenPromise = refreshAccessTokenFunction()
|
|
491
|
+
.then((refreshedAccessToken) => {
|
|
492
|
+
if (
|
|
493
|
+
typeof refreshedAccessToken !== 'string' ||
|
|
494
|
+
refreshedAccessToken.length === 0
|
|
495
|
+
) {
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
this.setAuthorizationToken(refreshedAccessToken);
|
|
500
|
+
|
|
501
|
+
return refreshedAccessToken;
|
|
502
|
+
})
|
|
503
|
+
.catch((refreshError: unknown) => {
|
|
504
|
+
console.error('Twenty client: token refresh failed', refreshError);
|
|
505
|
+
|
|
506
|
+
return null;
|
|
507
|
+
})
|
|
508
|
+
.finally(() => {
|
|
509
|
+
this.refreshAccessTokenPromise = null;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return this.refreshAccessTokenPromise;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
private setAuthorizationToken(token: string) {
|
|
517
|
+
this.authorizationToken = token;
|
|
518
|
+
|
|
519
|
+
const processEnvironment = getProcessEnvironment();
|
|
520
|
+
|
|
521
|
+
processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] = token;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
`,fl={DateTime:"string",JSON:"Record<string, unknown>",UUID:"string"},Av="// __STRIPPED_DURING_INJECTION_START__",Sv="// __STRIPPED_DURING_INJECTION_END__",pl="// __UPLOAD_FILE_START__",dl="// __UPLOAD_FILE_END__",Iv=o=>{let s=xv;return s=s.replace(new RegExp(`${vn(Av)}[\\s\\S]*?${vn(Sv)}\\n?`),""),s=s.replace("'__TWENTY_DEFAULT_URL__'",o.defaultUrl),s=s.replace(/TwentyGeneratedClient/g,o.apiClientName),o.includeUploadFile?(s=s.replace(new RegExp(`\\s*${vn(pl)}\\n`),`
|
|
525
|
+
`),s=s.replace(new RegExp(`\\s*${vn(dl)}\\n`),`
|
|
526
|
+
`)):s=s.replace(new RegExp(`\\s*${vn(pl)}[\\s\\S]*?${vn(dl)}\\n?`),`
|
|
527
|
+
`),`
|
|
528
|
+
// ${o.apiClientName} (auto-injected by twenty-sdk)
|
|
529
|
+
${s}`},vn=o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");class Tv{constructor(){this.apiService=new Ct({disableInterceptors:!0})}async generate({appPath:s,authToken:r}){const l=this.resolveGeneratedPath(s),f=`${l}.tmp`,[m,v]=await Promise.all([this.apiService.getSchema({authToken:r}),this.apiService.getMetadataSchema({authToken:r})]);if(!m.success)throw new Error(`Failed to introspect core schema: ${JSON.stringify(m.error)}`);if(!v.success)throw new Error(`Failed to introspect metadata schema: ${JSON.stringify(v.error)}`);await P.ensureDir(f),await P.emptyDir(f),await Promise.all([al.generate({schema:m.data,output:R.join(f,"core"),scalarTypes:fl}),al.generate({schema:v.data,output:R.join(f,"metadata"),scalarTypes:{...fl,Upload:"File"}})]),await this.injectClientWrapper(R.join(f,"core"),{apiClientName:"CoreApiClient",defaultUrl:`\`\${process.env.${ul}}/graphql\``,includeUploadFile:!1}),await this.injectClientWrapper(R.join(f,"metadata"),{apiClientName:"MetadataApiClient",defaultUrl:`\`\${process.env.${ul}}/metadata\``,includeUploadFile:!0}),await this.writeBarrelIndex(f),await P.remove(l),await P.move(f,l)}async ensureGeneratedClientStub({appPath:s}){const r=this.resolveGeneratedPath(s);await P.pathExists(R.join(r,"index.ts"))||(await P.ensureDir(R.join(r,"core")),await P.ensureDir(R.join(r,"metadata")),await P.writeFile(R.join(r,"core","index.ts"),`export class CoreApiClient {}
|
|
530
|
+
`),await P.writeFile(R.join(r,"metadata","index.ts"),`export class MetadataApiClient {}
|
|
531
|
+
`),await this.writeBarrelIndex(r))}resolveGeneratedPath(s){return R.join(s,"node_modules","twenty-sdk",Vr)}async writeBarrelIndex(s){await P.writeFile(R.join(s,"index.ts"),`export { CoreApiClient } from './core/index';
|
|
532
|
+
export { MetadataApiClient } from './metadata/index';
|
|
533
|
+
`)}async injectClientWrapper(s,r){const l=Iv(r);await P.appendFile(R.join(s,"index.ts"),l)}}var zr=(o=>(o.DefineApplication="defineApplication",o.DefineField="defineField",o.DefineLogicFunction="defineLogicFunction",o.DefinePreInstallLogicFunction="definePreInstallLogicFunction",o.DefinePostInstallLogicFunction="definePostInstallLogicFunction",o.DefineObject="defineObject",o.DefineRole="defineRole",o.DefineSkill="defineSkill",o.DefineFrontComponent="defineFrontComponent",o.DefineView="defineView",o.DefineNavigationMenuItem="defineNavigationMenuItem",o.DefinePageLayout="definePageLayout",o))(zr||{}),Xe=(o=>(o.Application="application",o.Fields="fields",o.LogicFunctions="logicFunctions",o.Objects="objects",o.Roles="roles",o.Skills="skills",o.FrontComponents="frontComponents",o.PublicAssets="publicAssets",o.Views="views",o.NavigationMenuItems="navigationMenuItems",o.PageLayouts="pageLayouts",o))(Xe||{});const Ev={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",definePreInstallLogicFunction:"logicFunctions",definePostInstallLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},Fv=o=>{if(!_n.isCallExpression(o))return;const s=o.expression;if(_n.isIdentifier(s)&&Object.values(zr).includes(s.text))return s.text},Cv=o=>{const s=_n.createSourceFile("temp.ts",o,_n.ScriptTarget.Latest,!0),r=[];_n.forEachChild(s,l=>{r.push(l)});for(const l of r)if(_n.isExportAssignment(l)){if(l.isExportEquals||!l.expression)return;const f=Fv(l.expression);if(f)return f}},Pv=["twenty-sdk/ui"],bv={name:"manifest-mock",setup:o=>{const s=new RegExp(`^(${Pv.map(r=>r.replace("/","\\/")).join("|")})$`);o.onResolve({filter:s},({path:r})=>({path:r,namespace:"manifest-mock"})),o.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},dt=async({filePath:o,appPath:s})=>{const r=await Rv({filePath:o,appPath:s});return kv(r,o)},Rv=async({filePath:o,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),l=await P.pathExists(r),f=Wm.createRequire(Y.default.join(s,"package.json"));let m,v;try{m=Y.default.dirname(f.resolve("react/package.json")),v=Y.default.dirname(f.resolve("react-dom/package.json"))}catch{}const C=(await Il.build({entryPoints:[o],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:l?r:void 0,alias:{...m&&{react:m},...v&&{"react-dom":v}},plugins:[bv],logLevel:"silent"})).outputFiles[0].text,M=await P.mkdtemp(Y.default.join(xs.default.tmpdir(),"twenty-manifest-")),q=Y.default.join(M,"module.cjs");try{return await P.writeFile(q,C),require(q)}finally{await P.remove(M)}},kv=(o,s)=>{if(k.o(o.default)&&k.AN(o.default))return o.default;throw new Error(`Config file ${s} must export a config object default export`)},Ov={type:"object",properties:{}},Lv=async o=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-CCSi0u_q.js")),r=s(o)[0];return r?.type==="object"&&k.o(r.properties)?{type:"object",properties:r.properties}:Ov},Nv="142046f0-4d80-48b5-ad56-26ad410e895c",ot=({objectConfig:o,fieldName:s})=>{const r=`${o.universalIdentifier}-${s}`;return Ue.v5(r,Nv)},Uv=o=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:k.R.UUID,universalIdentifier:ot({objectConfig:o,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:k.R.TEXT,universalIdentifier:ot({objectConfig:o,fieldName:"name"})},l={name:"createdAt",label:"Creation date",description:"Creation date",icon:"IconCalendar",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"createdAt"})},f={name:"updatedAt",label:"Last update",description:"Last time the record was changed",icon:"IconCalendarClock",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"updatedAt"})},m={name:"deletedAt",label:"Deleted at",description:"Deletion date",icon:"IconCalendarClock",isNullable:!0,defaultValue:null,type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"deletedAt"})},v={name:"createdBy",label:"Created by",description:"The creator of the record",icon:"IconCreativeCommonsSa",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:o,fieldName:"createdBy"})},E={name:"updatedBy",label:"Updated by",description:"The workspace member who last updated the record",icon:"IconUserCircle",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:o,fieldName:"updatedBy"})},C={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:k.R.POSITION,universalIdentifier:ot({objectConfig:o,fieldName:"position"})},M={name:"searchVector",label:"Search vector",icon:"IconSearch",description:"Search vector",isNullable:!0,defaultValue:null,type:k.R.TS_VECTOR,universalIdentifier:ot({objectConfig:o,fieldName:"searchVector"})};return[s,r,l,f,m,v,E,C,M]},zn={targetFieldName:o=>`target${k.cs(o.nameSingular)}`,targetLabel:o=>k.cs(o.nameSingular),icon:"IconBuildingSkyscraper"},Dv=[{...zn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:k.y.timelineActivity.morphIds.targetMorphId.morphId},{...zn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:k.R.RELATION,standardObjectKey:"favorite"},{...zn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:k.y.attachment.morphIds.targetMorphId.morphId},{...zn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:k.y.noteTarget.morphIds.targetMorphId.morphId},{...zn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:k.y.taskTarget.morphIds.targetMorphId.morphId}],$v=({config:o,forwardFieldUniversalIdentifier:s,objectConfig:r,universalIdentifier:l})=>{const f=k.y[o.standardObjectKey],m={name:o.targetFieldName(r),label:o.targetLabel(r),description:`${o.targetLabel(r)} ${r.labelSingular}`,icon:o.targetIcon,isNullable:!0,universalSettings:{relationType:k.V.MANY_TO_ONE,onDelete:k.W.SET_NULL,joinColumnName:`target${k.cs(r.nameSingular)}Id`},universalIdentifier:l,objectUniversalIdentifier:f.universalIdentifier,relationTargetFieldMetadataUniversalIdentifier:s,relationTargetObjectMetadataUniversalIdentifier:r.universalIdentifier};return o.targetFieldType===k.R.MORPH_RELATION?{...m,type:o.targetFieldType,morphId:o.morphId}:{...m,type:o.targetFieldType}},Wv=o=>{const s=[],r=[];for(const l of Dv){const f=k.y[l.standardObjectKey],m=ot({objectConfig:o,fieldName:l.fieldName}),v=ot({objectConfig:o,fieldName:`${l.fieldName}Inverse`}),E={name:l.fieldName,label:l.label,description:`${o.labelPlural} tied to the ${l.targetLabel(o)}`,icon:l.icon,isNullable:!1,type:k.R.RELATION,universalSettings:{relationType:k.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:f.universalIdentifier},C=$v({config:l,objectConfig:o,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(C)}return{objectFields:s,fields:r}},Mv=o=>{const s=Uv(o),{objectFields:r,fields:l}=Wv(o),f=(o.fields??[]).map(v=>v.name),m=[...o.fields];for(const v of s)f.includes(v.name)||m.push(v);for(const v of r)f.includes(v.name)||m.push(v);return{objectFields:m,fields:l}},Bv=async o=>await wl.glob(["**/*.ts","**/*.tsx"],{cwd:o,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),jv=async o=>await wl.glob([`${As}/**/*`],{cwd:o,onlyFiles:!0}),Rl=async o=>{const s=await Bv(o),r=[];let l;const f=[],m=[],v=[],E=[],C=[],M=[],q=[],X=[],U=[],V=[],ne=[],De=[],Ie=[],ht=[],xn=[],$e=[],Pt=[],We=[],bt=[],Me=[],Rt=[],Qt=[],Vn=[];for(const oe of s){const Yn=await _l.readFile(oe,"utf-8"),Be=R.relative(o,oe),je=Cv(Yn);if(!je)continue;switch(Ev[je]){case Xe.Application:{const G=await dt({appPath:o,filePath:oe});l={...G.config,yarnLockChecksum:null,packageJsonChecksum:null,apiClientChecksum:null},r.push(...G.errors),Ie.push(Be);break}case Xe.Objects:{const G=await dt({appPath:o,filePath:oe}),{objectFields:Te,fields:de}=Mv(G.config),ut=G.config.labelIdentifierFieldMetadataUniversalIdentifier??Te.find(An=>An.name==="name")?.universalIdentifier;if(!ut){r.push(`No label identifier field found for object ${G.config.nameSingular}. Please add a field with name "name" to your object.`);break}const qt={...G.config,fields:Te,labelIdentifierFieldMetadataUniversalIdentifier:ut};f.push(qt),m.push(...de),r.push(...G.errors),ht.push(Be);break}case Xe.Fields:{const G=await dt({appPath:o,filePath:oe});m.push(G.config),r.push(...G.errors),xn.push(Be);break}case Xe.Roles:{const G=await dt({appPath:o,filePath:oe});v.push(G.config),r.push(...G.errors),$e.push(Be);break}case Xe.Skills:{const G=await dt({appPath:o,filePath:oe});E.push(G.config),r.push(...G.errors),Pt.push(Be);break}case Xe.LogicFunctions:{const G=await dt({appPath:o,filePath:oe});r.push(...G.errors);const{handler:Te,...de}=G.config,ut=R.relative(o,oe),qt=de.toolInputSchema??await Lv(Yn),An={...de,toolInputSchema:qt,handlerName:"default.config.handler",sourceHandlerPath:ut,builtHandlerPath:ut.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};C.push(An),We.push(Be),je===zr.DefinePreInstallLogicFunction&&ne.push(G.config.universalIdentifier),je===zr.DefinePostInstallLogicFunction&&De.push(G.config.universalIdentifier);break}case Xe.FrontComponents:{const G=await dt({appPath:o,filePath:oe});r.push(...G.errors);const{component:Te,...de}=G.config,ut=R.relative(o,oe),qt={...de,componentName:Te.name,sourceComponentPath:ut,builtComponentPath:ut.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:"",isHeadless:de.isHeadless??!1};M.push(qt),bt.push(Be);break}case Xe.Views:{const G=await dt({appPath:o,filePath:oe}),Te={...G.config};X.push(Te),r.push(...G.errors),Rt.push(Be);break}case Xe.NavigationMenuItems:{const G=await dt({appPath:o,filePath:oe});U.push(G.config),r.push(...G.errors),Qt.push(Be);break}case Xe.PageLayouts:{const G=await dt({appPath:o,filePath:oe}),Te={...G.config};V.push(Te),r.push(...G.errors),Vn.push(Be);break}case Xe.PublicAssets:break;default:k.dt()}}const Yr=await jv(o);for(const oe of Yr)q.push({filePath:oe,fileName:R.basename(oe),fileType:R.extname(oe).replace(/^\./,""),checksum:null}),Me.push(R.relative(o,oe));return l||r.push("Cannot build application, please export default defineApplication() to define an application"),ne.length>1&&r.push("Only one pre install logic function is allowed per application"),De.length>1&&r.push("Only one post install logic function is allowed per application"),l&&ne.length>=1&&(l={...l,preInstallLogicFunctionUniversalIdentifier:ne[0]}),l&&De.length>=1&&(l={...l,postInstallLogicFunctionUniversalIdentifier:De[0]}),{manifest:l?{application:l,objects:f,fields:m,roles:v,skills:E,logicFunctions:C,frontComponents:M,publicAssets:q,views:X,navigationMenuItems:U,pageLayouts:V}:null,filePaths:{application:Ie,objects:ht,fields:xn,roles:$e,skills:Pt,logicFunctions:We,frontComponents:bt,publicAssets:Me,views:Rt,navigationMenuItems:Qt,pageLayouts:Vn},errors:r}},qv=o=>{const s=new Set,r=new Set;for(const l of o)s.has(l)?r.add(l):s.add(l);return Array.from(r)},kl=o=>{const s=[];if(!o)return[];for(const[r,l]of Object.entries(o))r==="universalIdentifier"&&typeof l=="string"&&s.push(l),typeof l=="object"&&s.push(...kl(l));return s},Hv=o=>{const s=[],r=[],l=qv(kl(o));return l.length>0&&s.push(`Duplicate universal identifiers: ${l.join(", ")}`),k.na(o.objects)||r.push("No object defined"),k.na(o.logicFunctions)||r.push("No logic function defined"),k.na(o.frontComponents)||r.push("No front component defined"),{errors:s,warnings:r,isValid:s.length===0}};class Gv{constructor({state:s,notify:r}){this.state=s,this.notify=r}async execute(s){const r=this.state.steps.buildManifest;r.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],f=await Rl(s.appPath);if(f.errors.length>0||!f.manifest){for(const v of f.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}const m=Hv(f.manifest);if(!m.isValid){for(const v of m.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(m.warnings.length>0)for(const v of m.warnings)l.push({message:`⚠ ${v}`,status:"warning"});return l.push({message:"Successfully built manifest",status:"success"}),r.output={result:f},r.status="done",this.state.updatePipeline({appName:f.manifest.application.displayName}),this.state.updateEntitiesFromManifest(f.filePaths),this.state.applyStepEvents(l),f}}class zv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();return r.serverUp?r.authValid?(s.output={isReady:!0,errorLogged:!1},s.status="done",this.notify(),!0):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed",status:"error"}]),this.state.updatePipeline({status:"error"})),!1):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Cannot reach server",status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}}class Jv{constructor({apiService:s,configService:r,state:l,notify:f}){this.apiService=s,this.configService=r,this.state=l,this.notify=f}async execute(s){if(!s.applicationId)return;const r=this.state.steps.ensureValidTokens;r.status="in_progress",this.notify();const l=await this.configService.getConfig();if(l.applicationAccessToken&&!this.isTokenExpired(l.applicationAccessToken)){r.status="done",this.notify();return}if(l.applicationRefreshToken&&!this.isTokenExpired(l.applicationRefreshToken)){const f=await this.apiService.renewApplicationToken(l.applicationRefreshToken);if(f.success){await this.configService.setConfig({applicationAccessToken:f.data.applicationAccessToken.token,applicationRefreshToken:f.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:"Application tokens renewed",status:"success"}]),r.status="done",this.notify();return}this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:`Failed to renew application tokens: ${JSON.stringify(f.error,null,2)}`,status:"error"}]),await this.exchangeTokens({applicationId:s.applicationId});return}await this.exchangeTokens({applicationId:s.applicationId})}async exchangeTokens(s){const r=await this.apiService.generateApplicationToken(s.applicationId);if(!r.success){this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:`Failed to generate application tokens: ${JSON.stringify(r.error,null,2)}`,status:"error"}]),this.state.steps.ensureValidTokens.status="error",this.notify();return}await this.configService.setConfig({applicationAccessToken:r.data.applicationAccessToken.token,applicationRefreshToken:r.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:"Application tokens stored in config",status:"success"}]),this.state.steps.ensureValidTokens.status="done",this.notify()}isTokenExpired(s){try{const r=JSON.parse(Buffer.from(s.split(".")[1],"base64").toString());return Date.now()>=r.exp*1e3-6e4}catch{return!0}}}class Kv{constructor({clientService:s,configService:r,state:l,notify:f}){this.clientService=s,this.configService=r,this.state=l,this.notify=f}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generate({appPath:s.appPath,authToken:l.applicationAccessToken}),r.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),r.status="error"}this.notify()}}class Vv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.resolveApplication;r.status="in_progress",this.notify();const l=s.manifest.application.universalIdentifier,f=await this.apiService.findOneApplication(l);if(!f.success)return this.state.applyStepEvents([{message:`Failed to find application ${l}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output;if(f.data)return r.output={applicationId:f.data.id,universalIdentifier:f.data.universalIdentifier},r.status="done",this.notify(),r.output;const m=await this.apiService.createApplication(s.manifest);return m.success?(r.output={applicationId:m.data.id,universalIdentifier:m.data.universalIdentifier},this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:"Application created",status:"success"}]),r.status="done",this.notify(),r.output):(this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:`Application creation failed with error ${JSON.stringify(m.error,null,2)}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output)}}const Yv=async(o,s,r)=>{const l=new Set(r),f=s.filter(m=>!l.has(m));for(const m of f){const v=m.replace(/\.tsx?$/,".mjs"),E=Y.default.join(o,v),C=`${E}.map`;await P.remove(E),await P.remove(C)}},Xv=async({result:o,appPath:s,fileFolder:r,lastChecksums:l,onFileBuilt:f})=>{const m=Object.keys(o.metafile?.outputs??{}).filter(v=>v.endsWith(".mjs"));for(const v of m){const E=Y.default.resolve(v),C=Y.default.relative(s,E),M=o.metafile?.outputs?.[v]?.entryPoint||"",q=Y.default.relative(s,M),X=await P.readFile(E),U=Kr.default.createHash("md5").update(X).digest("hex");l.get(C)!==U&&(l.set(C,U),f&&await f({fileFolder:r,builtPath:C,sourcePath:q,checksum:U}))}},Zv=[],Qv=`
|
|
179
534
|
export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};
|
|
180
535
|
|
|
181
536
|
var _injectedStyleKeys = {};
|
|
@@ -252,7 +607,7 @@ export function makeEventRef(events, userRef) {
|
|
|
252
607
|
else if (userRef != null && typeof userRef === 'object') userRef.current = el;
|
|
253
608
|
};
|
|
254
609
|
}
|
|
255
|
-
`.trim(),
|
|
610
|
+
`.trim(),ey=`
|
|
256
611
|
import {
|
|
257
612
|
jsx as _originalJsx,
|
|
258
613
|
jsxs as _originalJsxs,
|
|
@@ -297,7 +652,7 @@ function _wrapJsxFactory(originalFactory) {
|
|
|
297
652
|
export var jsx = _wrapJsxFactory(_originalJsx);
|
|
298
653
|
export var jsxs = _wrapJsxFactory(_originalJsxs);
|
|
299
654
|
export { Fragment };
|
|
300
|
-
`.trim(),
|
|
655
|
+
`.trim(),ty=`
|
|
301
656
|
export * from '__real_react__';
|
|
302
657
|
import _React from '__real_react__';
|
|
303
658
|
|
|
@@ -346,12 +701,12 @@ function createElement(type) {
|
|
|
346
701
|
|
|
347
702
|
export { createElement };
|
|
348
703
|
export default Object.assign({}, _React, { createElement: createElement });
|
|
349
|
-
`.trim(),
|
|
704
|
+
`.trim(),ny=o=>{const s="react/jsx-runtime",r="react";return{name:"jsx-runtime-remote-wrapper",setup:l=>{let f,m;l.onResolve({filter:/^__jsx_shared_helpers__$/},()=>({path:"__jsx_shared_helpers__",namespace:"jsx-shared-helpers"})),l.onLoad({filter:/.*/,namespace:"jsx-shared-helpers"},()=>({contents:Qv,loader:"js"})),l.onResolve({filter:/^react\/jsx-runtime$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return f||(f=(await l.resolve(s,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react/jsx-runtime",namespace:"jsx-runtime-wrapper"}}),l.onResolve({filter:/^__real_react_jsx_runtime__$/},()=>{if(!f)throw new Error("jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet");return{path:f}}),l.onLoad({filter:/.*/,namespace:"jsx-runtime-wrapper"},()=>({contents:ey,loader:"js"})),l.onResolve({filter:/^react$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return m||(m=(await l.resolve(r,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react",namespace:"react-wrapper"}}),l.onResolve({filter:/^__real_react__$/},()=>{if(!m)throw new Error("jsx-runtime-remote-wrapper: real react path not resolved yet");return{path:m}}),l.onLoad({filter:/.*/,namespace:"react-wrapper"},()=>({contents:ty,loader:"js"}))}}},ry=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,hl=/export\s+default\s+defineFrontComponent\s*\(\s*\{[\s\S]*?component\s*:\s*(\w+)[\s\S]*?\}\s*\)\s*;?/s,iy=o=>{let s=o.replace(ry,"");const r=s.match(hl);if(r){const l=r[1],f=new RegExp(`export\\s+(const|function)\\s+${l}\\b`);s=s.replace(f,`$1 ${l}`),s=`import { createRoot as __createRoot } from 'react-dom/client';
|
|
350
705
|
import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
|
|
351
|
-
`+s,s=s.replace(
|
|
352
|
-
`)){const l=
|
|
353
|
-
`);this.buffer=r.pop()??"";for(const l of r)this.processLine(l)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=El(s);r&&this.pendingErrors.push(r)}}const uy=new Set(["node_modules",Gr,"dist",".twenty"]);class cy{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=vl.default.watch(this.appPath,{ignored:r=>{const l=$.relative(s,r);if(l==="")return!1;const p=l.split(Y.default.sep)[0];return uy.has(p)||p.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{if(r==="addDir"||r==="unlinkDir")return;const p=$.relative(this.appPath,l),m=p.startsWith(vs),v=["package.json","yarn.lock"].includes(p);!(p.endsWith(".ts")||p.endsWith(".tsx"))&&!m&&!v||this.handleChangeDetected(p,r)})}async close(){await this.watcher?.close()}}class fy{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new cy({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this)}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:l}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,l);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info"}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=ay({appPath:this.state.appPath,sourcePaths:s,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=oy({appPath:this.state.appPath,sourcePaths:s,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new ol({appPath:this.state.appPath,fileFolder:P.U.PublicAsset,watchPaths:[vs],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new ol({appPath:this.state.appPath,fileFolder:P.U.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new ly({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}const py=({manifest:o,builtFileInfos:s})=>{let r=structuredClone(o);for(const[p,{fileFolder:m,checksum:v}]of s.entries()){const E=$.relative(Qe,p);if(m===P.U.BuiltLogicFunction){const b=r.logicFunctions,M=b.findIndex(H=>H.builtHandlerPath===E);if(M===-1)continue;r={...r,logicFunctions:b.map((H,X)=>X===M?{...H,builtHandlerChecksum:v}:H)}}if(m===P.U.PublicAsset){const b=r.publicAssets,M=b.findIndex(H=>H.filePath===E);if(M===-1)continue;r={...r,publicAssets:b.map((H,X)=>X===M?{...H,checksum:v}:H)};continue}if(m===P.U.BuiltFrontComponent){const b=r.frontComponents,M=b.findIndex(H=>H.builtComponentPath===E)??-1;if(M===-1)continue;r={...r,frontComponents:b.map((H,X)=>X===M?{...H,builtComponentChecksum:v}:H)}}m===P.U.Dependencies&&(E==="package.json"&&(r.application.packageJsonChecksum=v),E==="yarn.lock"&&(r.application.yarnLockChecksum=v))}const l=[];for(const[p,{fileFolder:m}]of s.entries()){const v=$.relative(Qe,p);if(m===P.U.Dependencies&&v.startsWith(`${Br}/`)){const E=s.get(p);E&&l.push(E.checksum)}}return l.length>0&&(r.application.apiClientChecksum=Hr.default.createHash("md5").update(l.sort().join("")).digest("hex")),r},dy=async(o,s)=>{const r=Y.default.join(o,Qe);await k.ensureDir(r);const l=Y.default.join(r,"manifest.json");return await k.writeJSON(l,s,{spaces:2}),l},Rl=o=>{if(typeof o=="string")return o;if(hn.default.isAxiosError(o)){const r=[],l=o.response?.status,p=o.response?.statusText;l&&r.push(`HTTP ${l}${p?` ${p}`:""}`);const m=o.response?.data?.errors;if(Array.isArray(m)&&m.length>0){const v=m.map(E=>E.message??"Unknown GraphQL error").join("; ");r.push(v)}else o.response?.data?.message?r.push(o.response.data.message):o.message&&r.push(o.message);return o.code&&r.push(`(${o.code})`),r.join(" - ")||"Unknown Axios error"}if(o instanceof Error)return o.message||o.toString();const s=JSON.stringify(o,null,2);return s==="{}"||s===void 0?String(o):s};class hy{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],p=py({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await dy(s.appPath,p),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const m=await this.apiService.syncApplication(p);if(m.success){l.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const v=`Sync failed with error: ${Rl(m.error)}`;l.push({message:v,status:"error"}),r.output={syncStatus:"error",error:v},r.status="error",this.state.updatePipeline({status:"error",error:v}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class gy{constructor(s){this.apiService=new Tt,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const l=$.relative(Qe,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:l,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const my=["types.ts","schema.ts"];class vy{constructor({state:s,notify:r}){this.state=s,this.notify=r}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new gy({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,l){const p=this.state.steps.uploadFiles;if(!p.output.fileUploader)return;this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading");const m=p.output.fileUploader.uploadFile({builtPath:s,fileFolder:l}).then(v=>{v.success?(this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):this.state.addEvent({message:`Failed to upload ${s}: ${v.error}`,status:"error"})}).catch(v=>{this.state.addEvent({message:`Upload failed for ${s}: ${v}`,status:"error"})}).finally(()=>{p.output.activeUploads.delete(m)});p.output.activeUploads.add(m)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}async copyAndUploadApiClientFiles(s){const r=$.join(s,"node_modules","twenty-sdk",Gr);if(!await k.pathExists(r))return;const l=$.join(s,Qe,Br);await k.ensureDir(l);for(const p of my){const m=$.join(r,p);if(!await k.pathExists(m))continue;await k.copy(m,$.join(l,p));const v=await k.readFile(m),E=Hr.default.createHash("md5").update(v).digest("hex"),b=$.join(Qe,Br,p),M=$.join(Br,p);this.state.steps.uploadFiles.output.builtFileInfos.set(b,{checksum:E,builtPath:b,sourcePath:M,fileFolder:P.U.Dependencies}),this.uploadFile(b,M,P.U.Dependencies)}}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,l,r)}}class yy{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Tt({disableInterceptors:!0}),l=new we,p=new yv,m={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new $v({...m,apiService:r}),this.ensureValidTokensStep=new Mv({...m,apiService:r,configService:l}),this.buildManifestStep=new Wv(m),this.resolveApplicationStep=new jv({...m,apiService:r}),this.uploadFilesStep=new vy(m),this.generateApiClientStep=new Bv({...m,clientService:p,configService:l}),this.syncApplicationStep=new hy({...m,apiService:r}),this.startWatchersStep=new fy({...m,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this)})}async start(){const s=Y.default.join(this.state.appPath,Qe);await k.ensureDir(s),await k.emptyDir(s),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${Rl(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;await this.ensureValidTokensStep.execute({applicationId:this.state.steps.resolveApplication.output.applicationId});const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),await this.uploadFilesStep.copyAndUploadApiClientFiles(this.state.appPath))}async initializePipeline(s){const r=await this.resolveApplicationStep.execute({manifest:s});return r.applicationId?(await this.ensureValidTokensStep.exchangeTokens({applicationId:r.applicationId}),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0):!1}}const _y={objects:K.Object,fields:K.Field,logicFunctions:K.LogicFunction,frontComponents:K.FrontComponent,roles:K.Role,skills:K.Skill,views:K.View,navigationMenuItems:K.NavigationMenuItem,pageLayouts:K.PageLayout},wy=200,xy={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class Sy{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.frontendUrl=s.frontendUrl,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(wy-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),p=l.get(s);p?.status&&!xy[p.status].includes(r)||(l.set(s,p?{...p,status:r}:{name:s,path:s,status:r}),this.entities=l)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[l,p]of r)r.set(l,{...p,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[p,m]of Object.entries(s)){const v=_y[p];if(v)for(const E of m)r.set(E,v)}const l=new Map(this.entities);for(const[p,m]of l)l.set(p,{...m,type:r.get(p)});this.entities=l}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),l=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,l}}class Ay{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}async execute(s){const r=s.appPath??Ie,l=new Sy({appPath:r,frontendUrl:process.env.FRONTEND_URL}),p=new gv(l);l.onChange=()=>p.notify();const{unmount:m}=await hv(p);this.unmountUI=m,this.orchestrator=new yy({state:l}),await this.orchestrator.start(),this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",s),process.on("SIGTERM",s)}}const Iy=o=>`${A.default.cyan(o.file)}:${A.default.yellow(String(o.line))}:${A.default.yellow(String(o.column+1))} - ${A.default.red("error")} ${o.text}`;class Fy{async execute(s){const r=s.appPath??Ie;console.log(A.default.blue("Running type check...")),console.log(A.default.gray(`App path: ${r}`)),console.log("");const l=await Tl(r);l.length===0&&(console.log(A.default.green("✓ No type errors found")),process.exit(0));for(const p of l)console.log(Iy(p));console.log(""),console.log(A.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}const _s=async o=>{const s=Y.default.join(o,Qe);await k.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await k.pathExists(r)){const{manifest:l}=await Il(o);return l}return await k.readJson(r)};class Ey{constructor(){this.apiService=new Tt}async execute({appPath:s=Ie,askForConfirmation:r}){try{console.log(A.default.blue("🚀 Uninstall Twenty Application")),console.log(A.default.gray(`📁 App Path: ${s}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error(A.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await _s(s);if(!l)return{success:!1,error:"Build failed"};const p=await this.apiService.uninstallApplication(l.application.universalIdentifier);return p.success===!1?console.error(A.default.red("❌ Uninstall failed:"),p.error):console.log(A.default.green("✅ Application uninstalled successfully")),p}catch(l){throw console.error(A.default.red("Uninstall failed:"),l instanceof Error?l.message:l),l}}async confirmationPrompt(){const{confirmation:s}=await ot.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Ty{constructor(){this.configService=new we}async execute(){try{const s=await this.configService.getAvailableWorkspaces(),r=await this.configService.getDefaultWorkspace();if(s.length===0){console.log(A.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(A.default.blue(`Available workspaces:
|
|
354
|
-
`));for(const l of s){const
|
|
706
|
+
`+s,s=s.replace(hl,`export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${l}, {})); }`)}return s},sy={name:"jsx-transform-to-remote-dom-worker-format-plugin",setup:o=>{o.onLoad({filter:/\.tsx$/},async({path:s})=>{try{const r=await Km.readFile(s,"utf8");return{contents:iy(r),loader:"tsx"}}catch(r){return{errors:[{text:`Failed to transform front component: ${r instanceof Error?r.message:String(r)}`,location:{file:s}}]}}})}},ay=/^\/\/.*$\n/gm,oy={name:"strip-comments",setup:o=>{o.onEnd(async s=>{if(s.errors.length>0)return;const r=Object.keys(s.metafile?.outputs??{}).filter(l=>l.endsWith(".mjs"));for(const l of r){const f=Y.default.resolve(l),m=await ll.readFile(f,"utf-8"),v=m.replace(ay,"");v!==m&&await ll.writeFile(f,v,"utf-8")}})}},ly=o=>[ny(),sy,oy],uy=/^(.+)\((\d+),(\d+)\): error TS\d+: (.+)$/,Ol=o=>{const s=o.match(uy);if(!s)return null;const[,r,l,f,m]=s;return{text:m,file:r,line:Number(l),column:Number(f)-1}},cy=o=>{const s=[];for(const r of o.split(`
|
|
707
|
+
`)){const l=Ol(r);l&&s.push(l)}return s},Ll=o=>{const s=Gr.default.join(o,"tsconfig.json"),r=Gr.default.join(o,"node_modules",".bin","tsc");return new Promise(l=>{xl.execFile(r,["--noEmit","--pretty","false","-p",s],{cwd:o},(f,m,v)=>{l(cy(v||m))})})},fy=o=>o.map(s=>({text:s.text,location:{file:s.file,line:s.line,column:s.column,lineText:"",length:0,namespace:"",suggestion:""}})),Nl=(o,s)=>({name:"typecheck",setup:r=>{r.onStart(async()=>{if(s())return;const l=await Ll(o);return{errors:fy(l)}})}}),py=["path","fs","crypto","stream","util","os","url","http","https","events","buffer","querystring","assert","zlib","net","tls","child_process","worker_threads","twenty-sdk","twenty-sdk/*","twenty-shared","twenty-shared/*"];class Ul{constructor(s){this.esBuildContext=null,this.isRestarting=!1,this.lastChecksums=new Map,this.buildCompletePromise=Promise.resolve(),this.resolveBuildComplete=null,this.appPath=s.appPath,this.sourcePaths=s.sourcePaths,this.watchMode=s.watch??!0,this.onFileBuilt=s.handleFileBuilt,this.onBuildError=s.handleBuildError,this.config=s.config}shouldRestart(s){const r=this.sourcePaths.sort().join(","),l=[...s].sort().join(",");return r!==l}async start(){this.sourcePaths.length>0&&await this.createContext()}async close(){await this.esBuildContext?.dispose(),this.esBuildContext=null}async restart(s){if(!this.isRestarting){this.isRestarting=!0;try{await this.close();const r=Y.default.join(this.appPath,et);await Yv(r,this.sourcePaths,s),this.sourcePaths=s,this.lastChecksums.clear(),this.sourcePaths.length>0&&await this.createContext()}finally{this.isRestarting=!1}}}async createContext(){const s=Y.default.join(this.appPath,et),r={};for(const m of this.sourcePaths){const v=m.replace(/\.tsx?$/,"");r[v]=Y.default.join(this.appPath,m)}const l=this,f=[...this.config.extraPlugins??[],{name:"build-notifications",setup:m=>{m.onEnd(async v=>{try{if(v.errors.length>0){v.errors[0].text.includes("Could not resolve")||await this.onBuildError?.(v.errors.map(E=>({error:E.text,location:E.location})));return}await Xv({result:v,appPath:this.appPath,fileFolder:this.config.fileFolder,lastChecksums:l.lastChecksums,onFileBuilt:l.onFileBuilt})}finally{l.resolveBuildComplete?.()}})}}];this.esBuildContext=await Il.context({entryPoints:r,bundle:!0,splitting:!1,format:"esm",platform:this.config.platform,outdir:s,outExtension:{".js":".mjs"},external:this.config.externalModules,tsconfig:Y.default.join(this.appPath,"tsconfig.json"),jsx:this.config.jsx,sourcemap:!0,metafile:!0,logLevel:"silent",minify:this.config.minify,banner:this.config.banner,plugins:f}),this.buildCompletePromise=new Promise(m=>{this.resolveBuildComplete=m}),await this.esBuildContext.rebuild(),await this.buildCompletePromise,this.watchMode&&await this.esBuildContext.watch()}}const Dl=o=>({name:"sdk-generated-resolver",setup:s=>{s.onResolve({filter:/^twenty-sdk\/generated/},()=>({path:Y.default.join(o,"node_modules","twenty-sdk",Vr,"index.ts")}))}}),dy=o=>new Ul({...o,config:{externalModules:py,fileFolder:k.U.BuiltLogicFunction,platform:"node",extraPlugins:[Nl(o.appPath,o.shouldSkipTypecheck),Dl(o.appPath)],banner:Vm}}),hy=o=>new Ul({...o,config:{externalModules:Zv,fileFolder:k.U.BuiltFrontComponent,jsx:"automatic",extraPlugins:[Nl(o.appPath,o.shouldSkipTypecheck),Dl(o.appPath),...ly()]}});class gl{constructor(s){this.watcher=null,this.appPath=s.appPath,this.fileFolder=s.fileFolder,this.watchPaths=s.watchPaths,this.handleFileBuilt=s.handleFileBuilt}async start(){const s=this.watchPaths.map(r=>R.join(this.appPath,r));for(const r of s)if(!await P.pathExists(r))return;this.watcher=Tl.default.watch(s,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{r==="addDir"||r==="unlinkDir"||((r==="add"||r==="change")&&this.copyAndNotify(l),r==="unlink"&&this.handleUnlink(l))})}async close(){await this.watcher?.close()}async copyAndNotify(s){const r=R.relative(this.appPath,s),l=R.join(et,r),f=R.join(this.appPath,l);await P.ensureDir(R.dirname(f)),await P.copy(s,f);const m=await P.readFile(f),v=Kr.default.createHash("md5").update(m).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:r,checksum:v})}async handleUnlink(s){const r=R.relative(this.appPath,s),l=R.join(et,r),f=R.join(this.appPath,l);await P.remove(f)}}class gy{constructor(s){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=s.appPath,this.onErrors=s.onErrors}async start(){const s=Gr.default.join(this.appPath,"node_modules",".bin","tsc");if(!await P.pathExists(s))return;const r=Gr.default.join(this.appPath,"tsconfig.json");this.process=xl.spawn(s,["--watch","--noEmit","--pretty","false","-p",r],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(s){this.buffer+=s;const r=this.buffer.split(`
|
|
708
|
+
`);this.buffer=r.pop()??"";for(const l of r)this.processLine(l)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=Ol(s);r&&this.pendingErrors.push(r)}}const my=new Set(["node_modules",Vr,"dist",".twenty"]);class vy{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=Tl.default.watch(this.appPath,{ignored:r=>{const l=R.relative(s,r);if(l==="")return!1;const f=l.split(Y.default.sep)[0];return my.has(f)||f.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{if(r==="addDir"||r==="unlinkDir")return;const f=R.relative(this.appPath,l),m=f.startsWith(As),v=["package.json","yarn.lock"].includes(f);!(f.endsWith(".ts")||f.endsWith(".tsx"))&&!m&&!v||this.handleChangeDetected(f,r)})}async close(){await this.watcher?.close()}}class yy{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt,this.shouldSkipTypecheck=s.shouldSkipTypecheck}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new vy({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this)}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:l}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,l);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info"}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=dy({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=hy({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new gl({appPath:this.state.appPath,fileFolder:k.U.PublicAsset,watchPaths:[As],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new gl({appPath:this.state.appPath,fileFolder:k.U.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new gy({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}const _y=({manifest:o,builtFileInfos:s})=>{let r=structuredClone(o);for(const[f,{fileFolder:m,checksum:v}]of s.entries()){const E=R.relative(et,f);if(m===k.U.BuiltLogicFunction){const C=r.logicFunctions,M=C.findIndex(q=>q.builtHandlerPath===E);if(M===-1)continue;r={...r,logicFunctions:C.map((q,X)=>X===M?{...q,builtHandlerChecksum:v}:q)}}if(m===k.U.PublicAsset){const C=r.publicAssets,M=C.findIndex(q=>q.filePath===E);if(M===-1)continue;r={...r,publicAssets:C.map((q,X)=>X===M?{...q,checksum:v}:q)};continue}if(m===k.U.BuiltFrontComponent){const C=r.frontComponents,M=C.findIndex(q=>q.builtComponentPath===E)??-1;if(M===-1)continue;r={...r,frontComponents:C.map((q,X)=>X===M?{...q,builtComponentChecksum:v}:q)}}m===k.U.Dependencies&&(E==="package.json"&&(r.application.packageJsonChecksum=v),E==="yarn.lock"&&(r.application.yarnLockChecksum=v))}const l=[];for(const[f,{fileFolder:m}]of s.entries()){const v=R.relative(et,f);if(m===k.U.Dependencies&&v.startsWith(`${Hr}/`)){const E=s.get(f);E&&l.push(E.checksum)}}return l.length>0&&(r.application.apiClientChecksum=Kr.default.createHash("md5").update(l.sort().join("")).digest("hex")),r},wy=async(o,s)=>{const r=Y.default.join(o,et);await P.ensureDir(r);const l=Y.default.join(r,"manifest.json");return await P.writeJSON(l,s,{spaces:2}),l},$l=o=>{if(typeof o=="string")return o;if(yn.default.isAxiosError(o)){const r=[],l=o.response?.status,f=o.response?.statusText;l&&r.push(`HTTP ${l}${f?` ${f}`:""}`);const m=o.response?.data?.errors;if(Array.isArray(m)&&m.length>0){const v=m.map(E=>E.message??"Unknown GraphQL error").join("; ");r.push(v)}else o.response?.data?.message?r.push(o.response.data.message):o.message&&r.push(o.message);return o.code&&r.push(`(${o.code})`),r.join(" - ")||"Unknown Axios error"}if(o instanceof Error)return o.message||o.toString();const s=JSON.stringify(o,null,2);return s==="{}"||s===void 0?String(o):s};class xy{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],f=_y({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await wy(s.appPath,f),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const m=await this.apiService.syncApplication(f);if(m.success){l.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const v=`Sync failed with error: ${$l(m.error)}`;l.push({message:v,status:"error"}),r.output={syncStatus:"error",error:v},r.status="error",this.state.updatePipeline({status:"error",error:v}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Ay{constructor(s){this.apiService=new Ct,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const l=R.relative(et,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:l,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const Sy=["core/types.ts","core/schema.ts","metadata/types.ts","metadata/schema.ts"];class Iy{constructor({state:s,notify:r}){this.state=s,this.notify=r}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new Ay({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,l){const f=this.state.steps.uploadFiles;if(!f.output.fileUploader)return;this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading");const m=f.output.fileUploader.uploadFile({builtPath:s,fileFolder:l}).then(v=>{v.success?(this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):this.state.addEvent({message:`Failed to upload ${s}: ${v.error}`,status:"error"})}).catch(v=>{this.state.addEvent({message:`Upload failed for ${s}: ${v}`,status:"error"})}).finally(()=>{f.output.activeUploads.delete(m)});f.output.activeUploads.add(m)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}async copyAndUploadApiClientFiles(s){const r=R.join(s,"node_modules","twenty-sdk",Vr);if(!await P.pathExists(r))return;const l=R.join(s,et,Hr);await P.ensureDir(l);for(const f of Sy){const m=R.join(r,f);if(!await P.pathExists(m))continue;await P.copy(m,R.join(l,f));const v=await P.readFile(m),E=Kr.default.createHash("md5").update(v).digest("hex"),C=R.join(et,Hr,f),M=R.join(Hr,f);this.state.steps.uploadFiles.output.builtFileInfos.set(C,{checksum:E,builtPath:C,sourcePath:M,fileFolder:k.U.Dependencies}),this.uploadFile(C,M,k.U.Dependencies)}}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,l,r)}}class Ty{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Ct({disableInterceptors:!0}),l=new _e;this.clientService=new Tv;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new zv({...f,apiService:r}),this.ensureValidTokensStep=new Jv({...f,apiService:r,configService:l}),this.buildManifestStep=new Gv(f),this.resolveApplicationStep=new Vv({...f,apiService:r}),this.uploadFilesStep=new Iy(f),this.generateApiClientStep=new Kv({...f,clientService:this.clientService,configService:l}),this.syncApplicationStep=new xy({...f,apiService:r}),this.startWatchersStep=new yy({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck})}async start(){const s=Y.default.join(this.state.appPath,et);await P.ensureDir(s),await P.emptyDir(s),await this.clientService.ensureGeneratedClientStub({appPath:this.state.appPath}),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${$l(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;await this.ensureValidTokensStep.execute({applicationId:this.state.steps.resolveApplication.output.applicationId});const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),this.skipTypecheck=!1,await this.uploadFilesStep.copyAndUploadApiClientFiles(this.state.appPath))}async initializePipeline(s){const r=await this.resolveApplicationStep.execute({manifest:s});return r.applicationId?(await this.ensureValidTokensStep.exchangeTokens({applicationId:r.applicationId}),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0):!1}}const Ey={objects:K.Object,fields:K.Field,logicFunctions:K.LogicFunction,frontComponents:K.FrontComponent,roles:K.Role,skills:K.Skill,views:K.View,navigationMenuItems:K.NavigationMenuItem,pageLayouts:K.PageLayout},Fy=200,Cy={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class Py{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.frontendUrl=s.frontendUrl,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Fy-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),f=l.get(s);f?.status&&!Cy[f.status].includes(r)||(l.set(s,f?{...f,status:r}:{name:s,path:s,status:r}),this.entities=l)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[l,f]of r)r.set(l,{...f,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[f,m]of Object.entries(s)){const v=Ey[f];if(v)for(const E of m)r.set(E,v)}const l=new Map(this.entities);for(const[f,m]of l)l.set(f,{...m,type:r.get(f)});this.entities=l}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),l=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,l}}class by{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}async execute(s){const r=s.appPath??Se,l=new Py({appPath:r,frontendUrl:process.env.FRONTEND_URL}),f=new yv(l);l.onChange=()=>f.notify();const{unmount:m}=await vv(f);this.unmountUI=m,this.orchestrator=new Ty({state:l}),await this.orchestrator.start(),this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",s),process.on("SIGTERM",s)}}const Ry=o=>`${S.default.cyan(o.file)}:${S.default.yellow(String(o.line))}:${S.default.yellow(String(o.column+1))} - ${S.default.red("error")} ${o.text}`;class ky{async execute(s){const r=s.appPath??Se;console.log(S.default.blue("Running type check...")),console.log(S.default.gray(`App path: ${r}`)),console.log("");const l=await Ll(r);l.length===0&&(console.log(S.default.green("✓ No type errors found")),process.exit(0));for(const f of l)console.log(Ry(f));console.log(""),console.log(S.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}const Is=async o=>{const s=Y.default.join(o,et);await P.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await P.pathExists(r)){const{manifest:l}=await Rl(o);return l}return await P.readJson(r)};class Oy{constructor(){this.apiService=new Ct}async execute({appPath:s=Se,askForConfirmation:r}){try{console.log(S.default.blue("🚀 Uninstall Twenty Application")),console.log(S.default.gray(`📁 App Path: ${s}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error(S.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await Is(s);if(!l)return{success:!1,error:"Build failed"};const f=await this.apiService.uninstallApplication(l.application.universalIdentifier);return f.success===!1?console.error(S.default.red("❌ Uninstall failed:"),f.error):console.log(S.default.green("✅ Application uninstalled successfully")),f}catch(l){throw console.error(S.default.red("Uninstall failed:"),l instanceof Error?l.message:l),l}}async confirmationPrompt(){const{confirmation:s}=await lt.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Ly{constructor(){this.configService=new _e}async execute(){try{const s=await this.configService.getAvailableWorkspaces(),r=await this.configService.getDefaultWorkspace();if(s.length===0){console.log(S.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(S.default.blue(`Available workspaces:
|
|
709
|
+
`));for(const l of s){const f=await this.configService.getConfigForWorkspace(l),m=!!f.apiKey,E=l===r?S.default.green(" (default)"):"",C=m?S.default.green("●"):S.default.gray("○");console.log(` ${C} ${l}${E}`),console.log(S.default.gray(` API URL: ${f.apiUrl}`))}console.log(""),console.log(S.default.gray("● = authenticated, ○ = no credentials")),console.log(S.default.gray("Use `twenty auth:switch <workspace>` to change default"))}catch(s){console.error(S.default.red("List failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Ny{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(s){try{let{apiKey:r,apiUrl:l}=s;const f=await this.configService.getConfig();if(l||(l=(await lt.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:f.apiUrl,validate:E=>{try{return new URL(E),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),r||(r=(await lt.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:E=>E.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:l,apiKey:r}),(await this.apiService.validateAuth()).authValid){const v=_e.getActiveWorkspace();console.log(S.default.green(`✓ Successfully authenticated with Twenty (workspace: ${v})`))}else console.log(S.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(r){console.error(S.default.red("Login failed:"),r instanceof Error?r.message:r),process.exit(1)}}}class Uy{constructor(){this.configService=new _e}async execute(){try{await this.configService.clearConfig();const s=_e.getActiveWorkspace();console.log(S.default.green(`✓ Successfully logged out (workspace: ${s})`))}catch(s){console.error(S.default.red("Logout failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Dy{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(){try{const s=_e.getActiveWorkspace(),r=await this.configService.getConfig();if(console.log(S.default.blue("Authentication Status:")),console.log(`Workspace: ${s}`),console.log(`API URL: ${r.apiUrl}`),console.log(`API Key: ${r.apiKey?"***"+r.apiKey.slice(-4):"Not set"}`),r.apiKey){const l=await this.apiService.validateAuth();console.log(`Status: ${l.authValid?S.default.green("✓ Valid"):S.default.red("✗ Invalid")}`)}else console.log(`Status: ${S.default.yellow("⚠ Not authenticated")}`)}catch(s){console.error(S.default.red("Status check failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class $y{constructor(){this.apiService=new Ct}async execute({appPath:s=Se,postInstall:r=!1,functionUniversalIdentifier:l,functionName:f,payload:m="{}"}){try{let v;try{v=JSON.parse(m)}catch{console.error(S.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const E=await Is(s);E||(console.error(S.default.red("Failed to build manifest.")),process.exit(1));const C=await this.apiService.findLogicFunctions();C.success||(console.error(S.default.red("Failed to fetch functions:"),C.error instanceof Error?C.error.message:C.error),process.exit(1));const M=C.data.filter(ne=>ne.universalIdentifier&&this.belongsToApplication(ne,E)),q=M.find(ne=>r?ne.universalIdentifier===E.application.postInstallLogicFunctionUniversalIdentifier:l?ne.universalIdentifier===l:f?ne.name===f:!1);if(!q){const ne=r?"post install":l||f;console.error(S.default.red(`Function "${ne}" not found in application.`)),console.log(""),M.length>0?(console.log(S.default.cyan("Available functions:")),M.forEach(De=>{console.log(` - ${S.default.white(De.name)} (${De.universalIdentifier})`)})):console.log(S.default.yellow("No functions found for this application. Have you synced your app with `yarn app:dev`?")),process.exit(1)}console.log(S.default.blue(`🚀 Executing function "${q.name}"...`)),console.log(S.default.gray(` Payload: ${JSON.stringify(v)}`)),console.log("");const X=await this.apiService.executeLogicFunction({functionId:q.id,payload:v});X.success||(console.error(S.default.red("Execution failed:"),X.error instanceof Error?X.error.message:X.error),process.exit(1));const U=X.data;console.log(S.default.cyan("─".repeat(60))),console.log(S.default.cyan("Execution Result")),console.log(S.default.cyan("─".repeat(60)));const V=U.status==="SUCCESS"?S.default.green:S.default.red;console.log(`${S.default.bold("Status:")} ${V(U.status)}`),console.log(`${S.default.bold("Duration:")} ${U.duration}ms`),k.o(U.data)&&(console.log(""),console.log(S.default.bold("Data:")),console.log(S.default.white(JSON.stringify(U.data,null,2)))),U.error&&(console.log(""),console.log(S.default.bold.red("Error:")),console.log(S.default.red(` Type: ${U.error.errorType}`)),console.log(S.default.red(` Message: ${U.error.errorMessage}`)),U.error.stackTrace&&(console.log(""),console.log(S.default.gray("Stack trace:")),console.log(S.default.gray(U.error.stackTrace)))),U.logs&&(console.log(""),console.log(S.default.bold("Logs:")),console.log(S.default.gray(U.logs))),console.log(S.default.cyan("─".repeat(60))),U.status!=="SUCCESS"&&process.exit(1)}catch(v){console.error(S.default.red("Execution failed:"),v instanceof Error?v.message:v),process.exit(1)}}belongsToApplication(s,r){return r.logicFunctions.some(l=>l.universalIdentifier===s.universalIdentifier)}}class Wy{constructor(){this.apiService=new Ct}async execute({appPath:s=Se,functionUniversalIdentifier:r,functionName:l}){try{const f=await Is(s);f||process.exit(1),this.logWatchInfo({appName:f.application.displayName,functionUniversalIdentifier:r,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:f.application.universalIdentifier,functionUniversalIdentifier:r,functionName:l})}catch(f){console.error(S.default.red("Watch logs failed:"),f instanceof Error?f.message:f),process.exit(1)}}logWatchInfo({appName:s,functionUniversalIdentifier:r,functionName:l}){const f=s??"Twenty Application",m=r||l?`function "${r||l}"`:"functions";console.log(S.default.blue(`🚀 Watching ${f} ${m} logs:`)),console.log("")}}class My{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(s){try{let{workspace:r}=s;const l=await this.configService.getAvailableWorkspaces(),f=await this.configService.getDefaultWorkspace();if(l.length===0){console.log(S.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}if(!r){const E=l.map(M=>({name:M===f?`${M} (current default)`:M,value:M}));r=(await lt.default.prompt([{type:"list",name:"workspace",message:"Select a workspace to set as default:",choices:E,default:f}])).workspace}if(l.includes(r)||(console.log(S.default.red(`✗ Workspace "${r}" not found. Available workspaces: ${l.join(", ")}`)),process.exit(1)),r===f){console.log(S.default.blue(`ℹ "${r}" is already the default workspace.`));return}await this.configService.setDefaultWorkspace(r),_e.setActiveWorkspace(r);const v=!!(await this.configService.getConfig()).apiKey;console.log(S.default.green(`✓ Switched default workspace to "${r}"`)),v?(await this.apiService.validateAuth()).authValid?console.log(S.default.green("✓ Authentication is valid")):console.log(S.default.yellow("⚠ Authentication credentials exist but are invalid. Run `twenty auth:login` to re-authenticate.")):console.log(S.default.yellow("⚠ No credentials configured for this workspace. Run `twenty auth:login` to authenticate."))}catch(r){console.error(S.default.red("Switch failed:"),r instanceof Error?r.message:r),process.exit(1)}}}const By=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineFrontComponent } from 'twenty-sdk';
|
|
355
710
|
|
|
356
711
|
// React component - implement your UI here
|
|
357
712
|
const Component = () => {
|
|
@@ -369,7 +724,7 @@ export default defineFrontComponent({
|
|
|
369
724
|
description: 'Add a description for your front component',
|
|
370
725
|
component: Component,
|
|
371
726
|
});
|
|
372
|
-
`},
|
|
727
|
+
`},jy=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineLogicFunction } from 'twenty-sdk';
|
|
373
728
|
|
|
374
729
|
// Logic function handler - rename and implement your logic
|
|
375
730
|
const handler = async (params: {
|
|
@@ -406,7 +761,7 @@ export default defineLogicFunction({
|
|
|
406
761
|
// eventName: 'objectName.created',
|
|
407
762
|
// },
|
|
408
763
|
});
|
|
409
|
-
`},
|
|
764
|
+
`},ml=({name:o,universalIdentifier:s=Ue.v4(),viewUniversalIdentifier:r})=>{const l=Qe.default(o),f=r?` viewUniversalIdentifier: '${r}',`:` // Link to a view:
|
|
410
765
|
// viewUniversalIdentifier: '...',
|
|
411
766
|
// Or link to an object:
|
|
412
767
|
// targetObjectUniversalIdentifier: '...',
|
|
@@ -418,35 +773,35 @@ export default defineNavigationMenuItem({
|
|
|
418
773
|
name: '${l}',
|
|
419
774
|
icon: 'IconList',
|
|
420
775
|
position: 0,
|
|
421
|
-
${
|
|
776
|
+
${f}
|
|
422
777
|
});
|
|
423
|
-
`};var
|
|
778
|
+
`};var Jn={exports:{}};/**
|
|
424
779
|
* @license
|
|
425
780
|
* Lodash <https://lodash.com/>
|
|
426
781
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
427
782
|
* Released under MIT license <https://lodash.com/license>
|
|
428
783
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
429
784
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
430
|
-
*/var Uy=Hn.exports,ul;function Dy(){return ul||(ul=1,function(o,s){(function(){var r,l="4.17.21",p=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",v="Expected a function",E="Invalid `variable` option passed into `_.template`",b="__lodash_hash_undefined__",M=500,H="__lodash_placeholder__",X=1,N=2,V=4,ie=1,lt=2,Fe=1,dt=2,vn=4,$e=8,bt=16,Me=32,Ct=64,Be=128,Pt=256,yn=512,ws=30,xs="...",le=800,Jn=16,Pe=1,zn=2,Ss=3,B=1/0,de=9007199254740991,ht=17976931348623157e292,Re=NaN,ve=4294967295,_n=ve-1,Ol=ve>>>1,Ll=[["ary",Be],["bind",Fe],["bindKey",dt],["curry",$e],["curryRight",bt],["flip",yn],["partial",Me],["partialRight",Ct],["rearg",Pt]],Xt="[object Arguments]",Kn="[object Array]",kl="[object AsyncFunction]",wn="[object Boolean]",xn="[object Date]",Nl="[object DOMException]",Vn="[object Error]",Yn="[object Function]",As="[object GeneratorFunction]",et="[object Map]",Sn="[object Number]",Ul="[object Null]",gt="[object Object]",Is="[object Promise]",Dl="[object Proxy]",An="[object RegExp]",tt="[object Set]",In="[object String]",Xn="[object Symbol]",Wl="[object Undefined]",Fn="[object WeakMap]",$l="[object WeakSet]",En="[object ArrayBuffer]",Zt="[object DataView]",Jr="[object Float32Array]",zr="[object Float64Array]",Kr="[object Int8Array]",Vr="[object Int16Array]",Yr="[object Int32Array]",Xr="[object Uint8Array]",Zr="[object Uint8ClampedArray]",Qr="[object Uint16Array]",ei="[object Uint32Array]",Ml=/\b__p \+= '';/g,Bl=/\b(__p \+=) '' \+/g,jl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fs=/&(?:amp|lt|gt|quot|#39);/g,Es=/[&<>"']/g,ql=RegExp(Fs.source),Hl=RegExp(Es.source),Gl=/<%-([\s\S]+?)%>/g,Jl=/<%([\s\S]+?)%>/g,Ts=/<%=([\s\S]+?)%>/g,zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kl=/^\w*$/,Vl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ti=/[\\^$.*+?()[\]{}|]/g,Yl=RegExp(ti.source),ni=/^\s+/,Xl=/\s/,Zl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ql=/\{\n\/\* \[wrapped with (.+)\] \*/,eu=/,? & /,tu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,nu=/[()=,{}\[\]\/\s]/,ru=/\\(\\)?/g,iu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bs=/\w*$/,su=/^[-+]0x[0-9a-f]+$/i,au=/^0b[01]+$/i,ou=/^\[object .+?Constructor\]$/,lu=/^0o[0-7]+$/i,uu=/^(?:0|[1-9]\d*)$/,cu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zn=/($^)/,fu=/['\n\r\u2028\u2029\\]/g,Qn="\\ud800-\\udfff",pu="\\u0300-\\u036f",du="\\ufe20-\\ufe2f",hu="\\u20d0-\\u20ff",Cs=pu+du+hu,Ps="\\u2700-\\u27bf",Rs="a-z\\xdf-\\xf6\\xf8-\\xff",gu="\\xac\\xb1\\xd7\\xf7",mu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vu="\\u2000-\\u206f",yu=" \\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",Os="A-Z\\xc0-\\xd6\\xd8-\\xde",Ls="\\ufe0e\\ufe0f",ks=gu+mu+vu+yu,ri="['’]",_u="["+Qn+"]",Ns="["+ks+"]",er="["+Cs+"]",Us="\\d+",wu="["+Ps+"]",Ds="["+Rs+"]",Ws="[^"+Qn+ks+Us+Ps+Rs+Os+"]",ii="\\ud83c[\\udffb-\\udfff]",xu="(?:"+er+"|"+ii+")",$s="[^"+Qn+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",ai="[\\ud800-\\udbff][\\udc00-\\udfff]",Qt="["+Os+"]",Ms="\\u200d",Bs="(?:"+Ds+"|"+Ws+")",Su="(?:"+Qt+"|"+Ws+")",js="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",qs="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",Hs=xu+"?",Gs="["+Ls+"]?",Au="(?:"+Ms+"(?:"+[$s,si,ai].join("|")+")"+Gs+Hs+")*",Iu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Js=Gs+Hs+Au,Eu="(?:"+[wu,si,ai].join("|")+")"+Js,Tu="(?:"+[$s+er+"?",er,si,ai,_u].join("|")+")",bu=RegExp(ri,"g"),Cu=RegExp(er,"g"),oi=RegExp(ii+"(?="+ii+")|"+Tu+Js,"g"),Pu=RegExp([Qt+"?"+Ds+"+"+js+"(?="+[Ns,Qt,"$"].join("|")+")",Su+"+"+qs+"(?="+[Ns,Qt+Bs,"$"].join("|")+")",Qt+"?"+Bs+"+"+js,Qt+"+"+qs,Fu,Iu,Us,Eu].join("|"),"g"),Ru=RegExp("["+Ms+Qn+Cs+Ls+"]"),Ou=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lu=["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"],ku=-1,re={};re[Jr]=re[zr]=re[Kr]=re[Vr]=re[Yr]=re[Xr]=re[Zr]=re[Qr]=re[ei]=!0,re[Xt]=re[Kn]=re[En]=re[wn]=re[Zt]=re[xn]=re[Vn]=re[Yn]=re[et]=re[Sn]=re[gt]=re[An]=re[tt]=re[In]=re[Fn]=!1;var ne={};ne[Xt]=ne[Kn]=ne[En]=ne[Zt]=ne[wn]=ne[xn]=ne[Jr]=ne[zr]=ne[Kr]=ne[Vr]=ne[Yr]=ne[et]=ne[Sn]=ne[gt]=ne[An]=ne[tt]=ne[In]=ne[Xn]=ne[Xr]=ne[Zr]=ne[Qr]=ne[ei]=!0,ne[Vn]=ne[Yn]=ne[Fn]=!1;var Nu={À:"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"},Uu={"&":"&","<":"<",">":">",'"':""","'":"'"},Du={"&":"&","<":"<",">":">",""":'"',"'":"'"},Wu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$u=parseFloat,Mu=parseInt,zs=typeof Mr=="object"&&Mr&&Mr.Object===Object&&Mr,Bu=typeof self=="object"&&self&&self.Object===Object&&self,ge=zs||Bu||Function("return this")(),li=s&&!s.nodeType&&s,jt=li&&!0&&o&&!o.nodeType&&o,Ks=jt&&jt.exports===li,ui=Ks&&zs.process,je=function(){try{var h=jt&&jt.require&&jt.require("util").types;return h||ui&&ui.binding&&ui.binding("util")}catch{}}(),Vs=je&&je.isArrayBuffer,Ys=je&&je.isDate,Xs=je&&je.isMap,Zs=je&&je.isRegExp,Qs=je&&je.isSet,ea=je&&je.isTypedArray;function Oe(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function ju(h,_,y,F){for(var U=-1,Z=h==null?0:h.length;++U<Z;){var fe=h[U];_(F,fe,y(fe),h)}return F}function qe(h,_){for(var y=-1,F=h==null?0:h.length;++y<F&&_(h[y],y,h)!==!1;);return h}function qu(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function ta(h,_){for(var y=-1,F=h==null?0:h.length;++y<F;)if(!_(h[y],y,h))return!1;return!0}function Rt(h,_){for(var y=-1,F=h==null?0:h.length,U=0,Z=[];++y<F;){var fe=h[y];_(fe,y,h)&&(Z[U++]=fe)}return Z}function tr(h,_){var y=h==null?0:h.length;return!!y&&en(h,_,0)>-1}function ci(h,_,y){for(var F=-1,U=h==null?0:h.length;++F<U;)if(y(_,h[F]))return!0;return!1}function se(h,_){for(var y=-1,F=h==null?0:h.length,U=Array(F);++y<F;)U[y]=_(h[y],y,h);return U}function Ot(h,_){for(var y=-1,F=_.length,U=h.length;++y<F;)h[U+y]=_[y];return h}function fi(h,_,y,F){var U=-1,Z=h==null?0:h.length;for(F&&Z&&(y=h[++U]);++U<Z;)y=_(y,h[U],U,h);return y}function Hu(h,_,y,F){var U=h==null?0:h.length;for(F&&U&&(y=h[--U]);U--;)y=_(y,h[U],U,h);return y}function pi(h,_){for(var y=-1,F=h==null?0:h.length;++y<F;)if(_(h[y],y,h))return!0;return!1}var Gu=di("length");function Ju(h){return h.split("")}function zu(h){return h.match(tu)||[]}function na(h,_,y){var F;return y(h,function(U,Z,fe){if(_(U,Z,fe))return F=Z,!1}),F}function nr(h,_,y,F){for(var U=h.length,Z=y+(F?1:-1);F?Z--:++Z<U;)if(_(h[Z],Z,h))return Z;return-1}function en(h,_,y){return _===_?sc(h,_,y):nr(h,ra,y)}function Ku(h,_,y,F){for(var U=y-1,Z=h.length;++U<Z;)if(F(h[U],_))return U;return-1}function ra(h){return h!==h}function ia(h,_){var y=h==null?0:h.length;return y?gi(h,_)/y:Re}function di(h){return function(_){return _==null?r:_[h]}}function hi(h){return function(_){return h==null?r:h[_]}}function sa(h,_,y,F,U){return U(h,function(Z,fe,te){y=F?(F=!1,Z):_(y,Z,fe,te)}),y}function Vu(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function gi(h,_){for(var y,F=-1,U=h.length;++F<U;){var Z=_(h[F]);Z!==r&&(y=y===r?Z:y+Z)}return y}function mi(h,_){for(var y=-1,F=Array(h);++y<h;)F[y]=_(y);return F}function Yu(h,_){return se(_,function(y){return[y,h[y]]})}function aa(h){return h&&h.slice(0,ca(h)+1).replace(ni,"")}function Le(h){return function(_){return h(_)}}function vi(h,_){return se(_,function(y){return h[y]})}function Tn(h,_){return h.has(_)}function oa(h,_){for(var y=-1,F=h.length;++y<F&&en(_,h[y],0)>-1;);return y}function la(h,_){for(var y=h.length;y--&&en(_,h[y],0)>-1;);return y}function Xu(h,_){for(var y=h.length,F=0;y--;)h[y]===_&&++F;return F}var Zu=hi(Nu),Qu=hi(Uu);function ec(h){return"\\"+Wu[h]}function tc(h,_){return h==null?r:h[_]}function tn(h){return Ru.test(h)}function nc(h){return Ou.test(h)}function rc(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function yi(h){var _=-1,y=Array(h.size);return h.forEach(function(F,U){y[++_]=[U,F]}),y}function ua(h,_){return function(y){return h(_(y))}}function Lt(h,_){for(var y=-1,F=h.length,U=0,Z=[];++y<F;){var fe=h[y];(fe===_||fe===H)&&(h[y]=H,Z[U++]=y)}return Z}function rr(h){var _=-1,y=Array(h.size);return h.forEach(function(F){y[++_]=F}),y}function ic(h){var _=-1,y=Array(h.size);return h.forEach(function(F){y[++_]=[F,F]}),y}function sc(h,_,y){for(var F=y-1,U=h.length;++F<U;)if(h[F]===_)return F;return-1}function ac(h,_,y){for(var F=y+1;F--;)if(h[F]===_)return F;return F}function nn(h){return tn(h)?lc(h):Gu(h)}function nt(h){return tn(h)?uc(h):Ju(h)}function ca(h){for(var _=h.length;_--&&Xl.test(h.charAt(_)););return _}var oc=hi(Du);function lc(h){for(var _=oi.lastIndex=0;oi.test(h);)++_;return _}function uc(h){return h.match(oi)||[]}function cc(h){return h.match(Pu)||[]}var fc=function h(_){_=_==null?ge:rn.defaults(ge.Object(),_,rn.pick(ge,Lu));var y=_.Array,F=_.Date,U=_.Error,Z=_.Function,fe=_.Math,te=_.Object,_i=_.RegExp,pc=_.String,He=_.TypeError,ir=y.prototype,dc=Z.prototype,sn=te.prototype,sr=_["__core-js_shared__"],ar=dc.toString,ee=sn.hasOwnProperty,hc=0,fa=function(){var e=/[^.]+$/.exec(sr&&sr.keys&&sr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),or=sn.toString,gc=ar.call(te),mc=ge._,vc=_i("^"+ar.call(ee).replace(ti,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lr=Ks?_.Buffer:r,kt=_.Symbol,ur=_.Uint8Array,pa=lr?lr.allocUnsafe:r,cr=ua(te.getPrototypeOf,te),da=te.create,ha=sn.propertyIsEnumerable,fr=ir.splice,ga=kt?kt.isConcatSpreadable:r,bn=kt?kt.iterator:r,qt=kt?kt.toStringTag:r,pr=function(){try{var e=Kt(te,"defineProperty");return e({},"",{}),e}catch{}}(),yc=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,_c=F&&F.now!==ge.Date.now&&F.now,wc=_.setTimeout!==ge.setTimeout&&_.setTimeout,dr=fe.ceil,hr=fe.floor,wi=te.getOwnPropertySymbols,xc=lr?lr.isBuffer:r,ma=_.isFinite,Sc=ir.join,Ac=ua(te.keys,te),pe=fe.max,ye=fe.min,Ic=F.now,Fc=_.parseInt,va=fe.random,Ec=ir.reverse,xi=Kt(_,"DataView"),Cn=Kt(_,"Map"),Si=Kt(_,"Promise"),an=Kt(_,"Set"),Pn=Kt(_,"WeakMap"),Rn=Kt(te,"create"),gr=Pn&&new Pn,on={},Tc=Vt(xi),bc=Vt(Cn),Cc=Vt(Si),Pc=Vt(an),Rc=Vt(Pn),mr=kt?kt.prototype:r,On=mr?mr.valueOf:r,ya=mr?mr.toString:r;function u(e){if(oe(e)&&!D(e)&&!(e instanceof J)){if(e instanceof Ge)return e;if(ee.call(e,"__wrapped__"))return wo(e)}return new Ge(e)}var ln=function(){function e(){}return function(t){if(!ae(t))return{};if(da)return da(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function Ge(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}u.templateSettings={escape:Gl,evaluate:Jl,interpolate:Ts,variable:"",imports:{_:u}},u.prototype=vr.prototype,u.prototype.constructor=u,Ge.prototype=ln(vr.prototype),Ge.prototype.constructor=Ge;function J(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ve,this.__views__=[]}function Oc(){var e=new J(this.__wrapped__);return e.__actions__=Ee(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ee(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ee(this.__views__),e}function Lc(){if(this.__filtered__){var e=new J(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function kc(){var e=this.__wrapped__.value(),t=this.__dir__,n=D(e),i=t<0,a=n?e.length:0,c=zf(0,a,this.__views__),f=c.start,d=c.end,g=d-f,w=i?d:f-1,x=this.__iteratees__,S=x.length,I=0,T=ye(g,this.__takeCount__);if(!n||!i&&a==g&&T==g)return ja(e,this.__actions__);var R=[];e:for(;g--&&I<T;){w+=t;for(var j=-1,O=e[w];++j<S;){var G=x[j],z=G.iteratee,Ue=G.type,Ae=z(O);if(Ue==zn)O=Ae;else if(!Ae){if(Ue==Pe)continue e;break e}}R[I++]=O}return R}J.prototype=ln(vr.prototype),J.prototype.constructor=J;function Ht(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Nc(){this.__data__=Rn?Rn(null):{},this.size=0}function Uc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Dc(e){var t=this.__data__;if(Rn){var n=t[e];return n===b?r:n}return ee.call(t,e)?t[e]:r}function Wc(e){var t=this.__data__;return Rn?t[e]!==r:ee.call(t,e)}function $c(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===r?b:t,this}Ht.prototype.clear=Nc,Ht.prototype.delete=Uc,Ht.prototype.get=Dc,Ht.prototype.has=Wc,Ht.prototype.set=$c;function mt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Mc(){this.__data__=[],this.size=0}function Bc(e){var t=this.__data__,n=yr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():fr.call(t,n,1),--this.size,!0}function jc(e){var t=this.__data__,n=yr(t,e);return n<0?r:t[n][1]}function qc(e){return yr(this.__data__,e)>-1}function Hc(e,t){var n=this.__data__,i=yr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}mt.prototype.clear=Mc,mt.prototype.delete=Bc,mt.prototype.get=jc,mt.prototype.has=qc,mt.prototype.set=Hc;function vt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Gc(){this.size=0,this.__data__={hash:new Ht,map:new(Cn||mt),string:new Ht}}function Jc(e){var t=Pr(this,e).delete(e);return this.size-=t?1:0,t}function zc(e){return Pr(this,e).get(e)}function Kc(e){return Pr(this,e).has(e)}function Vc(e,t){var n=Pr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}vt.prototype.clear=Gc,vt.prototype.delete=Jc,vt.prototype.get=zc,vt.prototype.has=Kc,vt.prototype.set=Vc;function Gt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new vt;++t<n;)this.add(e[t])}function Yc(e){return this.__data__.set(e,b),this}function Xc(e){return this.__data__.has(e)}Gt.prototype.add=Gt.prototype.push=Yc,Gt.prototype.has=Xc;function rt(e){var t=this.__data__=new mt(e);this.size=t.size}function Zc(){this.__data__=new mt,this.size=0}function Qc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ef(e){return this.__data__.get(e)}function tf(e){return this.__data__.has(e)}function nf(e,t){var n=this.__data__;if(n instanceof mt){var i=n.__data__;if(!Cn||i.length<p-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new vt(i)}return n.set(e,t),this.size=n.size,this}rt.prototype.clear=Zc,rt.prototype.delete=Qc,rt.prototype.get=ef,rt.prototype.has=tf,rt.prototype.set=nf;function _a(e,t){var n=D(e),i=!n&&Yt(e),a=!n&&!i&&$t(e),c=!n&&!i&&!a&&pn(e),f=n||i||a||c,d=f?mi(e.length,pc):[],g=d.length;for(var w in e)(t||ee.call(e,w))&&!(f&&(w=="length"||a&&(w=="offset"||w=="parent")||c&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||xt(w,g)))&&d.push(w);return d}function wa(e){var t=e.length;return t?e[Li(0,t-1)]:r}function rf(e,t){return Rr(Ee(e),Jt(t,0,e.length))}function sf(e){return Rr(Ee(e))}function Ai(e,t,n){(n!==r&&!it(e[t],n)||n===r&&!(t in e))&&yt(e,t,n)}function Ln(e,t,n){var i=e[t];(!(ee.call(e,t)&&it(i,n))||n===r&&!(t in e))&&yt(e,t,n)}function yr(e,t){for(var n=e.length;n--;)if(it(e[n][0],t))return n;return-1}function af(e,t,n,i){return Nt(e,function(a,c,f){t(i,a,n(a),f)}),i}function xa(e,t){return e&&ct(t,he(t),e)}function of(e,t){return e&&ct(t,be(t),e)}function yt(e,t,n){t=="__proto__"&&pr?pr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ii(e,t){for(var n=-1,i=t.length,a=y(i),c=e==null;++n<i;)a[n]=c?r:is(e,t[n]);return a}function Jt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Je(e,t,n,i,a,c){var f,d=t&X,g=t&N,w=t&V;if(n&&(f=a?n(e,i,a,c):n(e)),f!==r)return f;if(!ae(e))return e;var x=D(e);if(x){if(f=Vf(e),!d)return Ee(e,f)}else{var S=_e(e),I=S==Yn||S==As;if($t(e))return Ga(e,d);if(S==gt||S==Xt||I&&!a){if(f=g||I?{}:co(e),!d)return g?Wf(e,of(f,e)):Df(e,xa(f,e))}else{if(!ne[S])return a?e:{};f=Yf(e,S,d)}}c||(c=new rt);var T=c.get(e);if(T)return T;c.set(e,f),Mo(e)?e.forEach(function(O){f.add(Je(O,t,n,O,e,c))}):Wo(e)&&e.forEach(function(O,G){f.set(G,Je(O,t,n,G,e,c))});var R=w?g?Hi:qi:g?be:he,j=x?r:R(e);return qe(j||e,function(O,G){j&&(G=O,O=e[G]),Ln(f,G,Je(O,t,n,G,e,c))}),f}function lf(e){var t=he(e);return function(n){return Sa(n,e,t)}}function Sa(e,t,n){var i=n.length;if(e==null)return!i;for(e=te(e);i--;){var a=n[i],c=t[a],f=e[a];if(f===r&&!(a in e)||!c(f))return!1}return!0}function Aa(e,t,n){if(typeof e!="function")throw new He(v);return Mn(function(){e.apply(r,n)},t)}function kn(e,t,n,i){var a=-1,c=tr,f=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,Le(n))),i?(c=ci,f=!1):t.length>=p&&(c=Tn,f=!1,t=new Gt(t));e:for(;++a<d;){var x=e[a],S=n==null?x:n(x);if(x=i||x!==0?x:0,f&&S===S){for(var I=w;I--;)if(t[I]===S)continue e;g.push(x)}else c(t,S,i)||g.push(x)}return g}var Nt=Ya(ut),Ia=Ya(Ei,!0);function uf(e,t){var n=!0;return Nt(e,function(i,a,c){return n=!!t(i,a,c),n}),n}function _r(e,t,n){for(var i=-1,a=e.length;++i<a;){var c=e[i],f=t(c);if(f!=null&&(d===r?f===f&&!Ne(f):n(f,d)))var d=f,g=c}return g}function cf(e,t,n,i){var a=e.length;for(n=W(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:W(i),i<0&&(i+=a),i=n>i?0:jo(i);n<i;)e[n++]=t;return e}function Fa(e,t){var n=[];return Nt(e,function(i,a,c){t(i,a,c)&&n.push(i)}),n}function me(e,t,n,i,a){var c=-1,f=e.length;for(n||(n=Zf),a||(a=[]);++c<f;){var d=e[c];t>0&&n(d)?t>1?me(d,t-1,n,i,a):Ot(a,d):i||(a[a.length]=d)}return a}var Fi=Xa(),Ea=Xa(!0);function ut(e,t){return e&&Fi(e,t,he)}function Ei(e,t){return e&&Ea(e,t,he)}function wr(e,t){return Rt(t,function(n){return St(e[n])})}function zt(e,t){t=Dt(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[ft(t[n++])];return n&&n==i?e:r}function Ta(e,t,n){var i=t(e);return D(e)?i:Ot(i,n(e))}function xe(e){return e==null?e===r?Wl:Ul:qt&&qt in te(e)?Jf(e):sp(e)}function Ti(e,t){return e>t}function ff(e,t){return e!=null&&ee.call(e,t)}function pf(e,t){return e!=null&&t in te(e)}function df(e,t,n){return e>=ye(t,n)&&e<pe(t,n)}function bi(e,t,n){for(var i=n?ci:tr,a=e[0].length,c=e.length,f=c,d=y(c),g=1/0,w=[];f--;){var x=e[f];f&&t&&(x=se(x,Le(t))),g=ye(x.length,g),d[f]=!n&&(t||a>=120&&x.length>=120)?new Gt(f&&x):r}x=e[0];var S=-1,I=d[0];e:for(;++S<a&&w.length<g;){var T=x[S],R=t?t(T):T;if(T=n||T!==0?T:0,!(I?Tn(I,R):i(w,R,n))){for(f=c;--f;){var j=d[f];if(!(j?Tn(j,R):i(e[f],R,n)))continue e}I&&I.push(R),w.push(T)}}return w}function hf(e,t,n,i){return ut(e,function(a,c,f){t(i,n(a),c,f)}),i}function Nn(e,t,n){t=Dt(t,e),e=go(e,t);var i=e==null?e:e[ft(Ke(t))];return i==null?r:Oe(i,e,n)}function ba(e){return oe(e)&&xe(e)==Xt}function gf(e){return oe(e)&&xe(e)==En}function mf(e){return oe(e)&&xe(e)==xn}function Un(e,t,n,i,a){return e===t?!0:e==null||t==null||!oe(e)&&!oe(t)?e!==e&&t!==t:vf(e,t,n,i,Un,a)}function vf(e,t,n,i,a,c){var f=D(e),d=D(t),g=f?Kn:_e(e),w=d?Kn:_e(t);g=g==Xt?gt:g,w=w==Xt?gt:w;var x=g==gt,S=w==gt,I=g==w;if(I&&$t(e)){if(!$t(t))return!1;f=!0,x=!1}if(I&&!x)return c||(c=new rt),f||pn(e)?oo(e,t,n,i,a,c):Hf(e,t,g,n,i,a,c);if(!(n&ie)){var T=x&&ee.call(e,"__wrapped__"),R=S&&ee.call(t,"__wrapped__");if(T||R){var j=T?e.value():e,O=R?t.value():t;return c||(c=new rt),a(j,O,n,i,c)}}return I?(c||(c=new rt),Gf(e,t,n,i,a,c)):!1}function yf(e){return oe(e)&&_e(e)==et}function Ci(e,t,n,i){var a=n.length,c=a,f=!i;if(e==null)return!c;for(e=te(e);a--;){var d=n[a];if(f&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++a<c;){d=n[a];var g=d[0],w=e[g],x=d[1];if(f&&d[2]){if(w===r&&!(g in e))return!1}else{var S=new rt;if(i)var I=i(w,x,g,e,t,S);if(!(I===r?Un(x,w,ie|lt,i,S):I))return!1}}return!0}function Ca(e){if(!ae(e)||ep(e))return!1;var t=St(e)?vc:ou;return t.test(Vt(e))}function _f(e){return oe(e)&&xe(e)==An}function wf(e){return oe(e)&&_e(e)==tt}function xf(e){return oe(e)&&Dr(e.length)&&!!re[xe(e)]}function Pa(e){return typeof e=="function"?e:e==null?Ce:typeof e=="object"?D(e)?La(e[0],e[1]):Oa(e):Qo(e)}function Pi(e){if(!$n(e))return Ac(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function Sf(e){if(!ae(e))return ip(e);var t=$n(e),n=[];for(var i in e)i=="constructor"&&(t||!ee.call(e,i))||n.push(i);return n}function Ri(e,t){return e<t}function Ra(e,t){var n=-1,i=Te(e)?y(e.length):[];return Nt(e,function(a,c,f){i[++n]=t(a,c,f)}),i}function Oa(e){var t=Ji(e);return t.length==1&&t[0][2]?po(t[0][0],t[0][1]):function(n){return n===e||Ci(n,e,t)}}function La(e,t){return Ki(e)&&fo(t)?po(ft(e),t):function(n){var i=is(n,e);return i===r&&i===t?ss(n,e):Un(t,i,ie|lt)}}function xr(e,t,n,i,a){e!==t&&Fi(t,function(c,f){if(a||(a=new rt),ae(c))Af(e,t,f,n,xr,i,a);else{var d=i?i(Yi(e,f),c,f+"",e,t,a):r;d===r&&(d=c),Ai(e,f,d)}},be)}function Af(e,t,n,i,a,c,f){var d=Yi(e,n),g=Yi(t,n),w=f.get(g);if(w){Ai(e,n,w);return}var x=c?c(d,g,n+"",e,t,f):r,S=x===r;if(S){var I=D(g),T=!I&&$t(g),R=!I&&!T&&pn(g);x=g,I||T||R?D(d)?x=d:ue(d)?x=Ee(d):T?(S=!1,x=Ga(g,!0)):R?(S=!1,x=Ja(g,!0)):x=[]:Bn(g)||Yt(g)?(x=d,Yt(d)?x=qo(d):(!ae(d)||St(d))&&(x=co(g))):S=!1}S&&(f.set(g,x),a(x,g,i,c,f),f.delete(g)),Ai(e,n,x)}function ka(e,t){var n=e.length;if(n)return t+=t<0?n:0,xt(t,n)?e[t]:r}function Na(e,t,n){t.length?t=se(t,function(c){return D(c)?function(f){return zt(f,c.length===1?c[0]:c)}:c}):t=[Ce];var i=-1;t=se(t,Le(C()));var a=Ra(e,function(c,f,d){var g=se(t,function(w){return w(c)});return{criteria:g,index:++i,value:c}});return Vu(a,function(c,f){return Uf(c,f,n)})}function If(e,t){return Ua(e,t,function(n,i){return ss(e,i)})}function Ua(e,t,n){for(var i=-1,a=t.length,c={};++i<a;){var f=t[i],d=zt(e,f);n(d,f)&&Dn(c,Dt(f,e),d)}return c}function Ff(e){return function(t){return zt(t,e)}}function Oi(e,t,n,i){var a=i?Ku:en,c=-1,f=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,Le(n)));++c<f;)for(var g=0,w=t[c],x=n?n(w):w;(g=a(d,x,g,i))>-1;)d!==e&&fr.call(d,g,1),fr.call(e,g,1);return e}function Da(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==c){var c=a;xt(a)?fr.call(e,a,1):Ui(e,a)}}return e}function Li(e,t){return e+hr(va()*(t-e+1))}function Ef(e,t,n,i){for(var a=-1,c=pe(dr((t-e)/(n||1)),0),f=y(c);c--;)f[i?c:++a]=e,e+=n;return f}function ki(e,t){var n="";if(!e||t<1||t>de)return n;do t%2&&(n+=e),t=hr(t/2),t&&(e+=e);while(t);return n}function q(e,t){return Xi(ho(e,t,Ce),e+"")}function Tf(e){return wa(dn(e))}function bf(e,t){var n=dn(e);return Rr(n,Jt(t,0,n.length))}function Dn(e,t,n,i){if(!ae(e))return e;t=Dt(t,e);for(var a=-1,c=t.length,f=c-1,d=e;d!=null&&++a<c;){var g=ft(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=f){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:xt(t[a+1])?[]:{})}Ln(d,g,w),d=d[g]}return e}var Wa=gr?function(e,t){return gr.set(e,t),e}:Ce,Cf=pr?function(e,t){return pr(e,"toString",{configurable:!0,enumerable:!1,value:os(t),writable:!0})}:Ce;function Pf(e){return Rr(dn(e))}function ze(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var c=y(a);++i<a;)c[i]=e[i+t];return c}function Rf(e,t){var n;return Nt(e,function(i,a,c){return n=t(i,a,c),!n}),!!n}function Sr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=Ol){for(;i<a;){var c=i+a>>>1,f=e[c];f!==null&&!Ne(f)&&(n?f<=t:f<t)?i=c+1:a=c}return a}return Ni(e,t,Ce,n)}function Ni(e,t,n,i){var a=0,c=e==null?0:e.length;if(c===0)return 0;t=n(t);for(var f=t!==t,d=t===null,g=Ne(t),w=t===r;a<c;){var x=hr((a+c)/2),S=n(e[x]),I=S!==r,T=S===null,R=S===S,j=Ne(S);if(f)var O=i||R;else w?O=R&&(i||I):d?O=R&&I&&(i||!T):g?O=R&&I&&!T&&(i||!j):T||j?O=!1:O=i?S<=t:S<t;O?a=x+1:c=x}return ye(c,_n)}function $a(e,t){for(var n=-1,i=e.length,a=0,c=[];++n<i;){var f=e[n],d=t?t(f):f;if(!n||!it(d,g)){var g=d;c[a++]=f===0?0:f}}return c}function Ma(e){return typeof e=="number"?e:Ne(e)?Re:+e}function ke(e){if(typeof e=="string")return e;if(D(e))return se(e,ke)+"";if(Ne(e))return ya?ya.call(e):"";var t=e+"";return t=="0"&&1/e==-B?"-0":t}function Ut(e,t,n){var i=-1,a=tr,c=e.length,f=!0,d=[],g=d;if(n)f=!1,a=ci;else if(c>=p){var w=t?null:jf(e);if(w)return rr(w);f=!1,a=Tn,g=new Gt}else g=t?[]:d;e:for(;++i<c;){var x=e[i],S=t?t(x):x;if(x=n||x!==0?x:0,f&&S===S){for(var I=g.length;I--;)if(g[I]===S)continue e;t&&g.push(S),d.push(x)}else a(g,S,n)||(g!==d&&g.push(S),d.push(x))}return d}function Ui(e,t){return t=Dt(t,e),e=go(e,t),e==null||delete e[ft(Ke(t))]}function Ba(e,t,n,i){return Dn(e,t,n(zt(e,t)),i)}function Ar(e,t,n,i){for(var a=e.length,c=i?a:-1;(i?c--:++c<a)&&t(e[c],c,e););return n?ze(e,i?0:c,i?c+1:a):ze(e,i?c+1:0,i?a:c)}function ja(e,t){var n=e;return n instanceof J&&(n=n.value()),fi(t,function(i,a){return a.func.apply(a.thisArg,Ot([i],a.args))},n)}function Di(e,t,n){var i=e.length;if(i<2)return i?Ut(e[0]):[];for(var a=-1,c=y(i);++a<i;)for(var f=e[a],d=-1;++d<i;)d!=a&&(c[a]=kn(c[a]||f,e[d],t,n));return Ut(me(c,1),t,n)}function qa(e,t,n){for(var i=-1,a=e.length,c=t.length,f={};++i<a;){var d=i<c?t[i]:r;n(f,e[i],d)}return f}function Wi(e){return ue(e)?e:[]}function $i(e){return typeof e=="function"?e:Ce}function Dt(e,t){return D(e)?e:Ki(e,t)?[e]:_o(Q(e))}var Of=q;function Wt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ze(e,t,n)}var Ha=yc||function(e){return ge.clearTimeout(e)};function Ga(e,t){if(t)return e.slice();var n=e.length,i=pa?pa(n):new e.constructor(n);return e.copy(i),i}function Mi(e){var t=new e.constructor(e.byteLength);return new ur(t).set(new ur(e)),t}function Lf(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function kf(e){var t=new e.constructor(e.source,bs.exec(e));return t.lastIndex=e.lastIndex,t}function Nf(e){return On?te(On.call(e)):{}}function Ja(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function za(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,c=Ne(e),f=t!==r,d=t===null,g=t===t,w=Ne(t);if(!d&&!w&&!c&&e>t||c&&f&&g&&!d&&!w||i&&f&&g||!n&&g||!a)return 1;if(!i&&!c&&!w&&e<t||w&&n&&a&&!i&&!c||d&&n&&a||!f&&a||!g)return-1}return 0}function Uf(e,t,n){for(var i=-1,a=e.criteria,c=t.criteria,f=a.length,d=n.length;++i<f;){var g=za(a[i],c[i]);if(g){if(i>=d)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function Ka(e,t,n,i){for(var a=-1,c=e.length,f=n.length,d=-1,g=t.length,w=pe(c-f,0),x=y(g+w),S=!i;++d<g;)x[d]=t[d];for(;++a<f;)(S||a<c)&&(x[n[a]]=e[a]);for(;w--;)x[d++]=e[a++];return x}function Va(e,t,n,i){for(var a=-1,c=e.length,f=-1,d=n.length,g=-1,w=t.length,x=pe(c-d,0),S=y(x+w),I=!i;++a<x;)S[a]=e[a];for(var T=a;++g<w;)S[T+g]=t[g];for(;++f<d;)(I||a<c)&&(S[T+n[f]]=e[a++]);return S}function Ee(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function ct(e,t,n,i){var a=!n;n||(n={});for(var c=-1,f=t.length;++c<f;){var d=t[c],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?yt(n,d,g):Ln(n,d,g)}return n}function Df(e,t){return ct(e,zi(e),t)}function Wf(e,t){return ct(e,lo(e),t)}function Ir(e,t){return function(n,i){var a=D(n)?ju:af,c=t?t():{};return a(n,e,C(i,2),c)}}function un(e){return q(function(t,n){var i=-1,a=n.length,c=a>1?n[a-1]:r,f=a>2?n[2]:r;for(c=e.length>3&&typeof c=="function"?(a--,c):r,f&&Se(n[0],n[1],f)&&(c=a<3?r:c,a=1),t=te(t);++i<a;){var d=n[i];d&&e(t,d,i,c)}return t})}function Ya(e,t){return function(n,i){if(n==null)return n;if(!Te(n))return e(n,i);for(var a=n.length,c=t?a:-1,f=te(n);(t?c--:++c<a)&&i(f[c],c,f)!==!1;);return n}}function Xa(e){return function(t,n,i){for(var a=-1,c=te(t),f=i(t),d=f.length;d--;){var g=f[e?d:++a];if(n(c[g],g,c)===!1)break}return t}}function $f(e,t,n){var i=t&Fe,a=Wn(e);function c(){var f=this&&this!==ge&&this instanceof c?a:e;return f.apply(i?n:this,arguments)}return c}function Za(e){return function(t){t=Q(t);var n=tn(t)?nt(t):r,i=n?n[0]:t.charAt(0),a=n?Wt(n,1).join(""):t.slice(1);return i[e]()+a}}function cn(e){return function(t){return fi(Xo(Yo(t).replace(bu,"")),e,"")}}function Wn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=ln(e.prototype),i=e.apply(n,t);return ae(i)?i:n}}function Mf(e,t,n){var i=Wn(e);function a(){for(var c=arguments.length,f=y(c),d=c,g=fn(a);d--;)f[d]=arguments[d];var w=c<3&&f[0]!==g&&f[c-1]!==g?[]:Lt(f,g);if(c-=w.length,c<n)return ro(e,t,Fr,a.placeholder,r,f,w,r,r,n-c);var x=this&&this!==ge&&this instanceof a?i:e;return Oe(x,this,f)}return a}function Qa(e){return function(t,n,i){var a=te(t);if(!Te(t)){var c=C(n,3);t=he(t),n=function(d){return c(a[d],d,a)}}var f=e(t,n,i);return f>-1?a[c?t[f]:f]:r}}function eo(e){return wt(function(t){var n=t.length,i=n,a=Ge.prototype.thru;for(e&&t.reverse();i--;){var c=t[i];if(typeof c!="function")throw new He(v);if(a&&!f&&Cr(c)=="wrapper")var f=new Ge([],!0)}for(i=f?i:n;++i<n;){c=t[i];var d=Cr(c),g=d=="wrapper"?Gi(c):r;g&&Vi(g[0])&&g[1]==(Be|$e|Me|Pt)&&!g[4].length&&g[9]==1?f=f[Cr(g[0])].apply(f,g[3]):f=c.length==1&&Vi(c)?f[d]():f.thru(c)}return function(){var w=arguments,x=w[0];if(f&&w.length==1&&D(x))return f.plant(x).value();for(var S=0,I=n?t[S].apply(this,w):x;++S<n;)I=t[S].call(this,I);return I}})}function Fr(e,t,n,i,a,c,f,d,g,w){var x=t&Be,S=t&Fe,I=t&dt,T=t&($e|bt),R=t&yn,j=I?r:Wn(e);function O(){for(var G=arguments.length,z=y(G),Ue=G;Ue--;)z[Ue]=arguments[Ue];if(T)var Ae=fn(O),De=Xu(z,Ae);if(i&&(z=Ka(z,i,a,T)),c&&(z=Va(z,c,f,T)),G-=De,T&&G<w){var ce=Lt(z,Ae);return ro(e,t,Fr,O.placeholder,n,z,ce,d,g,w-G)}var st=S?n:this,It=I?st[e]:e;return G=z.length,d?z=ap(z,d):R&&G>1&&z.reverse(),x&&g<G&&(z.length=g),this&&this!==ge&&this instanceof O&&(It=j||Wn(It)),It.apply(st,z)}return O}function to(e,t){return function(n,i){return hf(n,e,t(i),{})}}function Er(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=ke(n),i=ke(i)):(n=Ma(n),i=Ma(i)),a=e(n,i)}return a}}function Bi(e){return wt(function(t){return t=se(t,Le(C())),q(function(n){var i=this;return e(t,function(a){return Oe(a,i,n)})})})}function Tr(e,t){t=t===r?" ":ke(t);var n=t.length;if(n<2)return n?ki(t,e):t;var i=ki(t,dr(e/nn(t)));return tn(t)?Wt(nt(i),0,e).join(""):i.slice(0,e)}function Bf(e,t,n,i){var a=t&Fe,c=Wn(e);function f(){for(var d=-1,g=arguments.length,w=-1,x=i.length,S=y(x+g),I=this&&this!==ge&&this instanceof f?c:e;++w<x;)S[w]=i[w];for(;g--;)S[w++]=arguments[++d];return Oe(I,a?n:this,S)}return f}function no(e){return function(t,n,i){return i&&typeof i!="number"&&Se(t,n,i)&&(n=i=r),t=At(t),n===r?(n=t,t=0):n=At(n),i=i===r?t<n?1:-1:At(i),Ef(t,n,i,e)}}function br(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ve(t),n=Ve(n)),e(t,n)}}function ro(e,t,n,i,a,c,f,d,g,w){var x=t&$e,S=x?f:r,I=x?r:f,T=x?c:r,R=x?r:c;t|=x?Me:Ct,t&=~(x?Ct:Me),t&vn||(t&=-4);var j=[e,t,a,T,S,R,I,d,g,w],O=n.apply(r,j);return Vi(e)&&mo(O,j),O.placeholder=i,vo(O,e,t)}function ji(e){var t=fe[e];return function(n,i){if(n=Ve(n),i=i==null?0:ye(W(i),292),i&&ma(n)){var a=(Q(n)+"e").split("e"),c=t(a[0]+"e"+(+a[1]+i));return a=(Q(c)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var jf=an&&1/rr(new an([,-0]))[1]==B?function(e){return new an(e)}:cs;function io(e){return function(t){var n=_e(t);return n==et?yi(t):n==tt?ic(t):Yu(t,e(t))}}function _t(e,t,n,i,a,c,f,d){var g=t&dt;if(!g&&typeof e!="function")throw new He(v);var w=i?i.length:0;if(w||(t&=-97,i=a=r),f=f===r?f:pe(W(f),0),d=d===r?d:W(d),w-=a?a.length:0,t&Ct){var x=i,S=a;i=a=r}var I=g?r:Gi(e),T=[e,t,n,i,a,x,S,c,f,d];if(I&&rp(T,I),e=T[0],t=T[1],n=T[2],i=T[3],a=T[4],d=T[9]=T[9]===r?g?0:e.length:pe(T[9]-w,0),!d&&t&($e|bt)&&(t&=-25),!t||t==Fe)var R=$f(e,t,n);else t==$e||t==bt?R=Mf(e,t,d):(t==Me||t==(Fe|Me))&&!a.length?R=Bf(e,t,n,i):R=Fr.apply(r,T);var j=I?Wa:mo;return vo(j(R,T),e,t)}function so(e,t,n,i){return e===r||it(e,sn[n])&&!ee.call(i,n)?t:e}function ao(e,t,n,i,a,c){return ae(e)&&ae(t)&&(c.set(t,e),xr(e,t,r,ao,c),c.delete(t)),e}function qf(e){return Bn(e)?r:e}function oo(e,t,n,i,a,c){var f=n&ie,d=e.length,g=t.length;if(d!=g&&!(f&&g>d))return!1;var w=c.get(e),x=c.get(t);if(w&&x)return w==t&&x==e;var S=-1,I=!0,T=n<?new Gt:r;for(c.set(e,t),c.set(t,e);++S<d;){var R=e[S],j=t[S];if(i)var O=f?i(j,R,S,t,e,c):i(R,j,S,e,t,c);if(O!==r){if(O)continue;I=!1;break}if(T){if(!pi(t,function(G,z){if(!Tn(T,z)&&(R===G||a(R,G,n,i,c)))return T.push(z)})){I=!1;break}}else if(!(R===j||a(R,j,n,i,c))){I=!1;break}}return c.delete(e),c.delete(t),I}function Hf(e,t,n,i,a,c,f){switch(n){case Zt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case En:return!(e.byteLength!=t.byteLength||!c(new ur(e),new ur(t)));case wn:case xn:case Sn:return it(+e,+t);case Vn:return e.name==t.name&&e.message==t.message;case An:case In:return e==t+"";case et:var d=yi;case tt:var g=i&ie;if(d||(d=rr),e.size!=t.size&&!g)return!1;var w=f.get(e);if(w)return w==t;i|=lt,f.set(e,t);var x=oo(d(e),d(t),i,a,c,f);return f.delete(e),x;case Xn:if(On)return On.call(e)==On.call(t)}return!1}function Gf(e,t,n,i,a,c){var f=n&ie,d=qi(e),g=d.length,w=qi(t),x=w.length;if(g!=x&&!f)return!1;for(var S=g;S--;){var I=d[S];if(!(f?I in t:ee.call(t,I)))return!1}var T=c.get(e),R=c.get(t);if(T&&R)return T==t&&R==e;var j=!0;c.set(e,t),c.set(t,e);for(var O=f;++S<g;){I=d[S];var G=e[I],z=t[I];if(i)var Ue=f?i(z,G,I,t,e,c):i(G,z,I,e,t,c);if(!(Ue===r?G===z||a(G,z,n,i,c):Ue)){j=!1;break}O||(O=I=="constructor")}if(j&&!O){var Ae=e.constructor,De=t.constructor;Ae!=De&&"constructor"in e&&"constructor"in t&&!(typeof Ae=="function"&&Ae instanceof Ae&&typeof De=="function"&&De instanceof De)&&(j=!1)}return c.delete(e),c.delete(t),j}function wt(e){return Xi(ho(e,r,Ao),e+"")}function qi(e){return Ta(e,he,zi)}function Hi(e){return Ta(e,be,lo)}var Gi=gr?function(e){return gr.get(e)}:cs;function Cr(e){for(var t=e.name+"",n=on[t],i=ee.call(on,t)?n.length:0;i--;){var a=n[i],c=a.func;if(c==null||c==e)return a.name}return t}function fn(e){var t=ee.call(u,"placeholder")?u:e;return t.placeholder}function C(){var e=u.iteratee||ls;return e=e===ls?Pa:e,arguments.length?e(arguments[0],arguments[1]):e}function Pr(e,t){var n=e.__data__;return Qf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ji(e){for(var t=he(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,fo(a)]}return t}function Kt(e,t){var n=tc(e,t);return Ca(n)?n:r}function Jf(e){var t=ee.call(e,qt),n=e[qt];try{e[qt]=r;var i=!0}catch{}var a=or.call(e);return i&&(t?e[qt]=n:delete e[qt]),a}var zi=wi?function(e){return e==null?[]:(e=te(e),Rt(wi(e),function(t){return ha.call(e,t)}))}:fs,lo=wi?function(e){for(var t=[];e;)Ot(t,zi(e)),e=cr(e);return t}:fs,_e=xe;(xi&&_e(new xi(new ArrayBuffer(1)))!=Zt||Cn&&_e(new Cn)!=et||Si&&_e(Si.resolve())!=Is||an&&_e(new an)!=tt||Pn&&_e(new Pn)!=Fn)&&(_e=function(e){var t=xe(e),n=t==gt?e.constructor:r,i=n?Vt(n):"";if(i)switch(i){case Tc:return Zt;case bc:return et;case Cc:return Is;case Pc:return tt;case Rc:return Fn}return t});function zf(e,t,n){for(var i=-1,a=n.length;++i<a;){var c=n[i],f=c.size;switch(c.type){case"drop":e+=f;break;case"dropRight":t-=f;break;case"take":t=ye(t,e+f);break;case"takeRight":e=pe(e,t-f);break}}return{start:e,end:t}}function Kf(e){var t=e.match(Ql);return t?t[1].split(eu):[]}function uo(e,t,n){t=Dt(t,e);for(var i=-1,a=t.length,c=!1;++i<a;){var f=ft(t[i]);if(!(c=e!=null&&n(e,f)))break;e=e[f]}return c||++i!=a?c:(a=e==null?0:e.length,!!a&&Dr(a)&&xt(f,a)&&(D(e)||Yt(e)))}function Vf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function co(e){return typeof e.constructor=="function"&&!$n(e)?ln(cr(e)):{}}function Yf(e,t,n){var i=e.constructor;switch(t){case En:return Mi(e);case wn:case xn:return new i(+e);case Zt:return Lf(e,n);case Jr:case zr:case Kr:case Vr:case Yr:case Xr:case Zr:case Qr:case ei:return Ja(e,n);case et:return new i;case Sn:case In:return new i(e);case An:return kf(e);case tt:return new i;case Xn:return Nf(e)}}function Xf(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(Zl,`{
|
|
785
|
+
*/var qy=Jn.exports,vl;function Hy(){return vl||(vl=1,function(o,s){(function(){var r,l="4.17.21",f=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",v="Expected a function",E="Invalid `variable` option passed into `_.template`",C="__lodash_hash_undefined__",M=500,q="__lodash_placeholder__",X=1,U=2,V=4,ne=1,De=2,Ie=1,ht=2,xn=4,$e=8,Pt=16,We=32,bt=64,Me=128,Rt=256,Qt=512,Vn=30,Yr="...",Ts=800,Es=16,oe=1,Yn=2,Be=3,je=1/0,gt=9007199254740991,G=17976931348623157e292,Te=NaN,de=4294967295,ut=de-1,qt=de>>>1,An=[["ary",Me],["bind",Ie],["bindKey",ht],["curry",$e],["curryRight",Pt],["flip",Qt],["partial",We],["partialRight",bt],["rearg",Rt]],en="[object Arguments]",Xn="[object Array]",Wl="[object AsyncFunction]",Sn="[object Boolean]",In="[object Date]",Ml="[object DOMException]",Zn="[object Error]",Qn="[object Function]",Fs="[object GeneratorFunction]",tt="[object Map]",Tn="[object Number]",Bl="[object Null]",mt="[object Object]",Cs="[object Promise]",jl="[object Proxy]",En="[object RegExp]",nt="[object Set]",Fn="[object String]",er="[object Symbol]",ql="[object Undefined]",Cn="[object WeakMap]",Hl="[object WeakSet]",Pn="[object ArrayBuffer]",tn="[object DataView]",Xr="[object Float32Array]",Zr="[object Float64Array]",Qr="[object Int8Array]",ei="[object Int16Array]",ti="[object Int32Array]",ni="[object Uint8Array]",ri="[object Uint8ClampedArray]",ii="[object Uint16Array]",si="[object Uint32Array]",Gl=/\b__p \+= '';/g,zl=/\b(__p \+=) '' \+/g,Jl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ps=/&(?:amp|lt|gt|quot|#39);/g,bs=/[&<>"']/g,Kl=RegExp(Ps.source),Vl=RegExp(bs.source),Yl=/<%-([\s\S]+?)%>/g,Xl=/<%([\s\S]+?)%>/g,Rs=/<%=([\s\S]+?)%>/g,Zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ql=/^\w*$/,eu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ai=/[\\^$.*+?()[\]{}|]/g,tu=RegExp(ai.source),oi=/^\s+/,nu=/\s/,ru=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,iu=/\{\n\/\* \[wrapped with (.+)\] \*/,su=/,? & /,au=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ou=/[()=,{}\[\]\/\s]/,lu=/\\(\\)?/g,uu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ks=/\w*$/,cu=/^[-+]0x[0-9a-f]+$/i,fu=/^0b[01]+$/i,pu=/^\[object .+?Constructor\]$/,du=/^0o[0-7]+$/i,hu=/^(?:0|[1-9]\d*)$/,gu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,tr=/($^)/,mu=/['\n\r\u2028\u2029\\]/g,nr="\\ud800-\\udfff",vu="\\u0300-\\u036f",yu="\\ufe20-\\ufe2f",_u="\\u20d0-\\u20ff",Os=vu+yu+_u,Ls="\\u2700-\\u27bf",Ns="a-z\\xdf-\\xf6\\xf8-\\xff",wu="\\xac\\xb1\\xd7\\xf7",xu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Au="\\u2000-\\u206f",Su=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Us="A-Z\\xc0-\\xd6\\xd8-\\xde",Ds="\\ufe0e\\ufe0f",$s=wu+xu+Au+Su,li="['’]",Iu="["+nr+"]",Ws="["+$s+"]",rr="["+Os+"]",Ms="\\d+",Tu="["+Ls+"]",Bs="["+Ns+"]",js="[^"+nr+$s+Ms+Ls+Ns+Us+"]",ui="\\ud83c[\\udffb-\\udfff]",Eu="(?:"+rr+"|"+ui+")",qs="[^"+nr+"]",ci="(?:\\ud83c[\\udde6-\\uddff]){2}",fi="[\\ud800-\\udbff][\\udc00-\\udfff]",nn="["+Us+"]",Hs="\\u200d",Gs="(?:"+Bs+"|"+js+")",Fu="(?:"+nn+"|"+js+")",zs="(?:"+li+"(?:d|ll|m|re|s|t|ve))?",Js="(?:"+li+"(?:D|LL|M|RE|S|T|VE))?",Ks=Eu+"?",Vs="["+Ds+"]?",Cu="(?:"+Hs+"(?:"+[qs,ci,fi].join("|")+")"+Vs+Ks+")*",Pu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ys=Vs+Ks+Cu,Ru="(?:"+[Tu,ci,fi].join("|")+")"+Ys,ku="(?:"+[qs+rr+"?",rr,ci,fi,Iu].join("|")+")",Ou=RegExp(li,"g"),Lu=RegExp(rr,"g"),pi=RegExp(ui+"(?="+ui+")|"+ku+Ys,"g"),Nu=RegExp([nn+"?"+Bs+"+"+zs+"(?="+[Ws,nn,"$"].join("|")+")",Fu+"+"+Js+"(?="+[Ws,nn+Gs,"$"].join("|")+")",nn+"?"+Gs+"+"+zs,nn+"+"+Js,bu,Pu,Ms,Ru].join("|"),"g"),Uu=RegExp("["+Hs+nr+Os+Ds+"]"),Du=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$u=["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"],Wu=-1,ie={};ie[Xr]=ie[Zr]=ie[Qr]=ie[ei]=ie[ti]=ie[ni]=ie[ri]=ie[ii]=ie[si]=!0,ie[en]=ie[Xn]=ie[Pn]=ie[Sn]=ie[tn]=ie[In]=ie[Zn]=ie[Qn]=ie[tt]=ie[Tn]=ie[mt]=ie[En]=ie[nt]=ie[Fn]=ie[Cn]=!1;var re={};re[en]=re[Xn]=re[Pn]=re[tn]=re[Sn]=re[In]=re[Xr]=re[Zr]=re[Qr]=re[ei]=re[ti]=re[tt]=re[Tn]=re[mt]=re[En]=re[nt]=re[Fn]=re[er]=re[ni]=re[ri]=re[ii]=re[si]=!0,re[Zn]=re[Qn]=re[Cn]=!1;var Mu={À:"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"},Bu={"&":"&","<":"<",">":">",'"':""","'":"'"},ju={"&":"&","<":"<",">":">",""":'"',"'":"'"},qu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Hu=parseFloat,Gu=parseInt,Xs=typeof qr=="object"&&qr&&qr.Object===Object&&qr,zu=typeof self=="object"&&self&&self.Object===Object&&self,ge=Xs||zu||Function("return this")(),di=s&&!s.nodeType&&s,Ht=di&&!0&&o&&!o.nodeType&&o,Zs=Ht&&Ht.exports===di,hi=Zs&&Xs.process,qe=function(){try{var h=Ht&&Ht.require&&Ht.require("util").types;return h||hi&&hi.binding&&hi.binding("util")}catch{}}(),Qs=qe&&qe.isArrayBuffer,ea=qe&&qe.isDate,ta=qe&&qe.isMap,na=qe&&qe.isRegExp,ra=qe&&qe.isSet,ia=qe&&qe.isTypedArray;function be(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function Ju(h,_,y,T){for(var D=-1,Z=h==null?0:h.length;++D<Z;){var fe=h[D];_(T,fe,y(fe),h)}return T}function He(h,_){for(var y=-1,T=h==null?0:h.length;++y<T&&_(h[y],y,h)!==!1;);return h}function Ku(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function sa(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(!_(h[y],y,h))return!1;return!0}function kt(h,_){for(var y=-1,T=h==null?0:h.length,D=0,Z=[];++y<T;){var fe=h[y];_(fe,y,h)&&(Z[D++]=fe)}return Z}function ir(h,_){var y=h==null?0:h.length;return!!y&&rn(h,_,0)>-1}function gi(h,_,y){for(var T=-1,D=h==null?0:h.length;++T<D;)if(y(_,h[T]))return!0;return!1}function se(h,_){for(var y=-1,T=h==null?0:h.length,D=Array(T);++y<T;)D[y]=_(h[y],y,h);return D}function Ot(h,_){for(var y=-1,T=_.length,D=h.length;++y<T;)h[D+y]=_[y];return h}function mi(h,_,y,T){var D=-1,Z=h==null?0:h.length;for(T&&Z&&(y=h[++D]);++D<Z;)y=_(y,h[D],D,h);return y}function Vu(h,_,y,T){var D=h==null?0:h.length;for(T&&D&&(y=h[--D]);D--;)y=_(y,h[D],D,h);return y}function vi(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(_(h[y],y,h))return!0;return!1}var Yu=yi("length");function Xu(h){return h.split("")}function Zu(h){return h.match(au)||[]}function aa(h,_,y){var T;return y(h,function(D,Z,fe){if(_(D,Z,fe))return T=Z,!1}),T}function sr(h,_,y,T){for(var D=h.length,Z=y+(T?1:-1);T?Z--:++Z<D;)if(_(h[Z],Z,h))return Z;return-1}function rn(h,_,y){return _===_?cc(h,_,y):sr(h,oa,y)}function Qu(h,_,y,T){for(var D=y-1,Z=h.length;++D<Z;)if(T(h[D],_))return D;return-1}function oa(h){return h!==h}function la(h,_){var y=h==null?0:h.length;return y?wi(h,_)/y:Te}function yi(h){return function(_){return _==null?r:_[h]}}function _i(h){return function(_){return h==null?r:h[_]}}function ua(h,_,y,T,D){return D(h,function(Z,fe,te){y=T?(T=!1,Z):_(y,Z,fe,te)}),y}function ec(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function wi(h,_){for(var y,T=-1,D=h.length;++T<D;){var Z=_(h[T]);Z!==r&&(y=y===r?Z:y+Z)}return y}function xi(h,_){for(var y=-1,T=Array(h);++y<h;)T[y]=_(y);return T}function tc(h,_){return se(_,function(y){return[y,h[y]]})}function ca(h){return h&&h.slice(0,ha(h)+1).replace(oi,"")}function Re(h){return function(_){return h(_)}}function Ai(h,_){return se(_,function(y){return h[y]})}function bn(h,_){return h.has(_)}function fa(h,_){for(var y=-1,T=h.length;++y<T&&rn(_,h[y],0)>-1;);return y}function pa(h,_){for(var y=h.length;y--&&rn(_,h[y],0)>-1;);return y}function nc(h,_){for(var y=h.length,T=0;y--;)h[y]===_&&++T;return T}var rc=_i(Mu),ic=_i(Bu);function sc(h){return"\\"+qu[h]}function ac(h,_){return h==null?r:h[_]}function sn(h){return Uu.test(h)}function oc(h){return Du.test(h)}function lc(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function Si(h){var _=-1,y=Array(h.size);return h.forEach(function(T,D){y[++_]=[D,T]}),y}function da(h,_){return function(y){return h(_(y))}}function Lt(h,_){for(var y=-1,T=h.length,D=0,Z=[];++y<T;){var fe=h[y];(fe===_||fe===q)&&(h[y]=q,Z[D++]=y)}return Z}function ar(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=T}),y}function uc(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=[T,T]}),y}function cc(h,_,y){for(var T=y-1,D=h.length;++T<D;)if(h[T]===_)return T;return-1}function fc(h,_,y){for(var T=y+1;T--;)if(h[T]===_)return T;return T}function an(h){return sn(h)?dc(h):Yu(h)}function rt(h){return sn(h)?hc(h):Xu(h)}function ha(h){for(var _=h.length;_--&&nu.test(h.charAt(_)););return _}var pc=_i(ju);function dc(h){for(var _=pi.lastIndex=0;pi.test(h);)++_;return _}function hc(h){return h.match(pi)||[]}function gc(h){return h.match(Nu)||[]}var mc=function h(_){_=_==null?ge:on.defaults(ge.Object(),_,on.pick(ge,$u));var y=_.Array,T=_.Date,D=_.Error,Z=_.Function,fe=_.Math,te=_.Object,Ii=_.RegExp,vc=_.String,Ge=_.TypeError,or=y.prototype,yc=Z.prototype,ln=te.prototype,lr=_["__core-js_shared__"],ur=yc.toString,ee=ln.hasOwnProperty,_c=0,ga=function(){var e=/[^.]+$/.exec(lr&&lr.keys&&lr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),cr=ln.toString,wc=ur.call(te),xc=ge._,Ac=Ii("^"+ur.call(ee).replace(ai,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fr=Zs?_.Buffer:r,Nt=_.Symbol,pr=_.Uint8Array,ma=fr?fr.allocUnsafe:r,dr=da(te.getPrototypeOf,te),va=te.create,ya=ln.propertyIsEnumerable,hr=or.splice,_a=Nt?Nt.isConcatSpreadable:r,Rn=Nt?Nt.iterator:r,Gt=Nt?Nt.toStringTag:r,gr=function(){try{var e=Yt(te,"defineProperty");return e({},"",{}),e}catch{}}(),Sc=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,Ic=T&&T.now!==ge.Date.now&&T.now,Tc=_.setTimeout!==ge.setTimeout&&_.setTimeout,mr=fe.ceil,vr=fe.floor,Ti=te.getOwnPropertySymbols,Ec=fr?fr.isBuffer:r,wa=_.isFinite,Fc=or.join,Cc=da(te.keys,te),pe=fe.max,ve=fe.min,Pc=T.now,bc=_.parseInt,xa=fe.random,Rc=or.reverse,Ei=Yt(_,"DataView"),kn=Yt(_,"Map"),Fi=Yt(_,"Promise"),un=Yt(_,"Set"),On=Yt(_,"WeakMap"),Ln=Yt(te,"create"),yr=On&&new On,cn={},kc=Xt(Ei),Oc=Xt(kn),Lc=Xt(Fi),Nc=Xt(un),Uc=Xt(On),_r=Nt?Nt.prototype:r,Nn=_r?_r.valueOf:r,Aa=_r?_r.toString:r;function u(e){if(le(e)&&!$(e)&&!(e instanceof z)){if(e instanceof ze)return e;if(ee.call(e,"__wrapped__"))return Io(e)}return new ze(e)}var fn=function(){function e(){}return function(t){if(!ae(t))return{};if(va)return va(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function wr(){}function ze(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}u.templateSettings={escape:Yl,evaluate:Xl,interpolate:Rs,variable:"",imports:{_:u}},u.prototype=wr.prototype,u.prototype.constructor=u,ze.prototype=fn(wr.prototype),ze.prototype.constructor=ze;function z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=de,this.__views__=[]}function Dc(){var e=new z(this.__wrapped__);return e.__actions__=Ee(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ee(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ee(this.__views__),e}function $c(){if(this.__filtered__){var e=new z(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Wc(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),i=t<0,a=n?e.length:0,c=Zf(0,a,this.__views__),p=c.start,d=c.end,g=d-p,w=i?d:p-1,x=this.__iteratees__,A=x.length,I=0,F=ve(g,this.__takeCount__);if(!n||!i&&a==g&&F==g)return za(e,this.__actions__);var O=[];e:for(;g--&&I<F;){w+=t;for(var B=-1,L=e[w];++B<A;){var H=x[B],J=H.iteratee,Le=H.type,Ae=J(L);if(Le==Yn)L=Ae;else if(!Ae){if(Le==oe)continue e;break e}}O[I++]=L}return O}z.prototype=fn(wr.prototype),z.prototype.constructor=z;function zt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Mc(){this.__data__=Ln?Ln(null):{},this.size=0}function Bc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function jc(e){var t=this.__data__;if(Ln){var n=t[e];return n===C?r:n}return ee.call(t,e)?t[e]:r}function qc(e){var t=this.__data__;return Ln?t[e]!==r:ee.call(t,e)}function Hc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ln&&t===r?C:t,this}zt.prototype.clear=Mc,zt.prototype.delete=Bc,zt.prototype.get=jc,zt.prototype.has=qc,zt.prototype.set=Hc;function vt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Gc(){this.__data__=[],this.size=0}function zc(e){var t=this.__data__,n=xr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():hr.call(t,n,1),--this.size,!0}function Jc(e){var t=this.__data__,n=xr(t,e);return n<0?r:t[n][1]}function Kc(e){return xr(this.__data__,e)>-1}function Vc(e,t){var n=this.__data__,i=xr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}vt.prototype.clear=Gc,vt.prototype.delete=zc,vt.prototype.get=Jc,vt.prototype.has=Kc,vt.prototype.set=Vc;function yt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Yc(){this.size=0,this.__data__={hash:new zt,map:new(kn||vt),string:new zt}}function Xc(e){var t=Or(this,e).delete(e);return this.size-=t?1:0,t}function Zc(e){return Or(this,e).get(e)}function Qc(e){return Or(this,e).has(e)}function ef(e,t){var n=Or(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}yt.prototype.clear=Yc,yt.prototype.delete=Xc,yt.prototype.get=Zc,yt.prototype.has=Qc,yt.prototype.set=ef;function Jt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new yt;++t<n;)this.add(e[t])}function tf(e){return this.__data__.set(e,C),this}function nf(e){return this.__data__.has(e)}Jt.prototype.add=Jt.prototype.push=tf,Jt.prototype.has=nf;function it(e){var t=this.__data__=new vt(e);this.size=t.size}function rf(){this.__data__=new vt,this.size=0}function sf(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function af(e){return this.__data__.get(e)}function of(e){return this.__data__.has(e)}function lf(e,t){var n=this.__data__;if(n instanceof vt){var i=n.__data__;if(!kn||i.length<f-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new yt(i)}return n.set(e,t),this.size=n.size,this}it.prototype.clear=rf,it.prototype.delete=sf,it.prototype.get=af,it.prototype.has=of,it.prototype.set=lf;function Sa(e,t){var n=$(e),i=!n&&Zt(e),a=!n&&!i&&Mt(e),c=!n&&!i&&!a&&gn(e),p=n||i||a||c,d=p?xi(e.length,vc):[],g=d.length;for(var w in e)(t||ee.call(e,w))&&!(p&&(w=="length"||a&&(w=="offset"||w=="parent")||c&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||At(w,g)))&&d.push(w);return d}function Ia(e){var t=e.length;return t?e[$i(0,t-1)]:r}function uf(e,t){return Lr(Ee(e),Kt(t,0,e.length))}function cf(e){return Lr(Ee(e))}function Ci(e,t,n){(n!==r&&!st(e[t],n)||n===r&&!(t in e))&&_t(e,t,n)}function Un(e,t,n){var i=e[t];(!(ee.call(e,t)&&st(i,n))||n===r&&!(t in e))&&_t(e,t,n)}function xr(e,t){for(var n=e.length;n--;)if(st(e[n][0],t))return n;return-1}function ff(e,t,n,i){return Ut(e,function(a,c,p){t(i,a,n(a),p)}),i}function Ta(e,t){return e&&ft(t,he(t),e)}function pf(e,t){return e&&ft(t,Ce(t),e)}function _t(e,t,n){t=="__proto__"&&gr?gr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Pi(e,t){for(var n=-1,i=t.length,a=y(i),c=e==null;++n<i;)a[n]=c?r:us(e,t[n]);return a}function Kt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Je(e,t,n,i,a,c){var p,d=t&X,g=t&U,w=t&V;if(n&&(p=a?n(e,i,a,c):n(e)),p!==r)return p;if(!ae(e))return e;var x=$(e);if(x){if(p=ep(e),!d)return Ee(e,p)}else{var A=ye(e),I=A==Qn||A==Fs;if(Mt(e))return Va(e,d);if(A==mt||A==en||I&&!a){if(p=g||I?{}:go(e),!d)return g?qf(e,pf(p,e)):jf(e,Ta(p,e))}else{if(!re[A])return a?e:{};p=tp(e,A,d)}}c||(c=new it);var F=c.get(e);if(F)return F;c.set(e,p),Ho(e)?e.forEach(function(L){p.add(Je(L,t,n,L,e,c))}):jo(e)&&e.forEach(function(L,H){p.set(H,Je(L,t,n,H,e,c))});var O=w?g?Vi:Ki:g?Ce:he,B=x?r:O(e);return He(B||e,function(L,H){B&&(H=L,L=e[H]),Un(p,H,Je(L,t,n,H,e,c))}),p}function df(e){var t=he(e);return function(n){return Ea(n,e,t)}}function Ea(e,t,n){var i=n.length;if(e==null)return!i;for(e=te(e);i--;){var a=n[i],c=t[a],p=e[a];if(p===r&&!(a in e)||!c(p))return!1}return!0}function Fa(e,t,n){if(typeof e!="function")throw new Ge(v);return qn(function(){e.apply(r,n)},t)}function Dn(e,t,n,i){var a=-1,c=ir,p=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,Re(n))),i?(c=gi,p=!1):t.length>=f&&(c=bn,p=!1,t=new Jt(t));e:for(;++a<d;){var x=e[a],A=n==null?x:n(x);if(x=i||x!==0?x:0,p&&A===A){for(var I=w;I--;)if(t[I]===A)continue e;g.push(x)}else c(t,A,i)||g.push(x)}return g}var Ut=eo(ct),Ca=eo(Ri,!0);function hf(e,t){var n=!0;return Ut(e,function(i,a,c){return n=!!t(i,a,c),n}),n}function Ar(e,t,n){for(var i=-1,a=e.length;++i<a;){var c=e[i],p=t(c);if(p!=null&&(d===r?p===p&&!Oe(p):n(p,d)))var d=p,g=c}return g}function gf(e,t,n,i){var a=e.length;for(n=W(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:W(i),i<0&&(i+=a),i=n>i?0:zo(i);n<i;)e[n++]=t;return e}function Pa(e,t){var n=[];return Ut(e,function(i,a,c){t(i,a,c)&&n.push(i)}),n}function me(e,t,n,i,a){var c=-1,p=e.length;for(n||(n=rp),a||(a=[]);++c<p;){var d=e[c];t>0&&n(d)?t>1?me(d,t-1,n,i,a):Ot(a,d):i||(a[a.length]=d)}return a}var bi=to(),ba=to(!0);function ct(e,t){return e&&bi(e,t,he)}function Ri(e,t){return e&&ba(e,t,he)}function Sr(e,t){return kt(t,function(n){return St(e[n])})}function Vt(e,t){t=$t(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[pt(t[n++])];return n&&n==i?e:r}function Ra(e,t,n){var i=t(e);return $(e)?i:Ot(i,n(e))}function we(e){return e==null?e===r?ql:Bl:Gt&&Gt in te(e)?Xf(e):cp(e)}function ki(e,t){return e>t}function mf(e,t){return e!=null&&ee.call(e,t)}function vf(e,t){return e!=null&&t in te(e)}function yf(e,t,n){return e>=ve(t,n)&&e<pe(t,n)}function Oi(e,t,n){for(var i=n?gi:ir,a=e[0].length,c=e.length,p=c,d=y(c),g=1/0,w=[];p--;){var x=e[p];p&&t&&(x=se(x,Re(t))),g=ve(x.length,g),d[p]=!n&&(t||a>=120&&x.length>=120)?new Jt(p&&x):r}x=e[0];var A=-1,I=d[0];e:for(;++A<a&&w.length<g;){var F=x[A],O=t?t(F):F;if(F=n||F!==0?F:0,!(I?bn(I,O):i(w,O,n))){for(p=c;--p;){var B=d[p];if(!(B?bn(B,O):i(e[p],O,n)))continue e}I&&I.push(O),w.push(F)}}return w}function _f(e,t,n,i){return ct(e,function(a,c,p){t(i,n(a),c,p)}),i}function $n(e,t,n){t=$t(t,e),e=_o(e,t);var i=e==null?e:e[pt(Ve(t))];return i==null?r:be(i,e,n)}function ka(e){return le(e)&&we(e)==en}function wf(e){return le(e)&&we(e)==Pn}function xf(e){return le(e)&&we(e)==In}function Wn(e,t,n,i,a){return e===t?!0:e==null||t==null||!le(e)&&!le(t)?e!==e&&t!==t:Af(e,t,n,i,Wn,a)}function Af(e,t,n,i,a,c){var p=$(e),d=$(t),g=p?Xn:ye(e),w=d?Xn:ye(t);g=g==en?mt:g,w=w==en?mt:w;var x=g==mt,A=w==mt,I=g==w;if(I&&Mt(e)){if(!Mt(t))return!1;p=!0,x=!1}if(I&&!x)return c||(c=new it),p||gn(e)?fo(e,t,n,i,a,c):Vf(e,t,g,n,i,a,c);if(!(n&ne)){var F=x&&ee.call(e,"__wrapped__"),O=A&&ee.call(t,"__wrapped__");if(F||O){var B=F?e.value():e,L=O?t.value():t;return c||(c=new it),a(B,L,n,i,c)}}return I?(c||(c=new it),Yf(e,t,n,i,a,c)):!1}function Sf(e){return le(e)&&ye(e)==tt}function Li(e,t,n,i){var a=n.length,c=a,p=!i;if(e==null)return!c;for(e=te(e);a--;){var d=n[a];if(p&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++a<c;){d=n[a];var g=d[0],w=e[g],x=d[1];if(p&&d[2]){if(w===r&&!(g in e))return!1}else{var A=new it;if(i)var I=i(w,x,g,e,t,A);if(!(I===r?Wn(x,w,ne|De,i,A):I))return!1}}return!0}function Oa(e){if(!ae(e)||sp(e))return!1;var t=St(e)?Ac:pu;return t.test(Xt(e))}function If(e){return le(e)&&we(e)==En}function Tf(e){return le(e)&&ye(e)==nt}function Ef(e){return le(e)&&Mr(e.length)&&!!ie[we(e)]}function La(e){return typeof e=="function"?e:e==null?Pe:typeof e=="object"?$(e)?Da(e[0],e[1]):Ua(e):rl(e)}function Ni(e){if(!jn(e))return Cc(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function Ff(e){if(!ae(e))return up(e);var t=jn(e),n=[];for(var i in e)i=="constructor"&&(t||!ee.call(e,i))||n.push(i);return n}function Ui(e,t){return e<t}function Na(e,t){var n=-1,i=Fe(e)?y(e.length):[];return Ut(e,function(a,c,p){i[++n]=t(a,c,p)}),i}function Ua(e){var t=Xi(e);return t.length==1&&t[0][2]?vo(t[0][0],t[0][1]):function(n){return n===e||Li(n,e,t)}}function Da(e,t){return Qi(e)&&mo(t)?vo(pt(e),t):function(n){var i=us(n,e);return i===r&&i===t?cs(n,e):Wn(t,i,ne|De)}}function Ir(e,t,n,i,a){e!==t&&bi(t,function(c,p){if(a||(a=new it),ae(c))Cf(e,t,p,n,Ir,i,a);else{var d=i?i(ts(e,p),c,p+"",e,t,a):r;d===r&&(d=c),Ci(e,p,d)}},Ce)}function Cf(e,t,n,i,a,c,p){var d=ts(e,n),g=ts(t,n),w=p.get(g);if(w){Ci(e,n,w);return}var x=c?c(d,g,n+"",e,t,p):r,A=x===r;if(A){var I=$(g),F=!I&&Mt(g),O=!I&&!F&&gn(g);x=g,I||F||O?$(d)?x=d:ue(d)?x=Ee(d):F?(A=!1,x=Va(g,!0)):O?(A=!1,x=Ya(g,!0)):x=[]:Hn(g)||Zt(g)?(x=d,Zt(d)?x=Jo(d):(!ae(d)||St(d))&&(x=go(g))):A=!1}A&&(p.set(g,x),a(x,g,i,c,p),p.delete(g)),Ci(e,n,x)}function $a(e,t){var n=e.length;if(n)return t+=t<0?n:0,At(t,n)?e[t]:r}function Wa(e,t,n){t.length?t=se(t,function(c){return $(c)?function(p){return Vt(p,c.length===1?c[0]:c)}:c}):t=[Pe];var i=-1;t=se(t,Re(b()));var a=Na(e,function(c,p,d){var g=se(t,function(w){return w(c)});return{criteria:g,index:++i,value:c}});return ec(a,function(c,p){return Bf(c,p,n)})}function Pf(e,t){return Ma(e,t,function(n,i){return cs(e,i)})}function Ma(e,t,n){for(var i=-1,a=t.length,c={};++i<a;){var p=t[i],d=Vt(e,p);n(d,p)&&Mn(c,$t(p,e),d)}return c}function bf(e){return function(t){return Vt(t,e)}}function Di(e,t,n,i){var a=i?Qu:rn,c=-1,p=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,Re(n)));++c<p;)for(var g=0,w=t[c],x=n?n(w):w;(g=a(d,x,g,i))>-1;)d!==e&&hr.call(d,g,1),hr.call(e,g,1);return e}function Ba(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==c){var c=a;At(a)?hr.call(e,a,1):Bi(e,a)}}return e}function $i(e,t){return e+vr(xa()*(t-e+1))}function Rf(e,t,n,i){for(var a=-1,c=pe(mr((t-e)/(n||1)),0),p=y(c);c--;)p[i?c:++a]=e,e+=n;return p}function Wi(e,t){var n="";if(!e||t<1||t>gt)return n;do t%2&&(n+=e),t=vr(t/2),t&&(e+=e);while(t);return n}function j(e,t){return ns(yo(e,t,Pe),e+"")}function kf(e){return Ia(mn(e))}function Of(e,t){var n=mn(e);return Lr(n,Kt(t,0,n.length))}function Mn(e,t,n,i){if(!ae(e))return e;t=$t(t,e);for(var a=-1,c=t.length,p=c-1,d=e;d!=null&&++a<c;){var g=pt(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=p){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:At(t[a+1])?[]:{})}Un(d,g,w),d=d[g]}return e}var ja=yr?function(e,t){return yr.set(e,t),e}:Pe,Lf=gr?function(e,t){return gr(e,"toString",{configurable:!0,enumerable:!1,value:ps(t),writable:!0})}:Pe;function Nf(e){return Lr(mn(e))}function Ke(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var c=y(a);++i<a;)c[i]=e[i+t];return c}function Uf(e,t){var n;return Ut(e,function(i,a,c){return n=t(i,a,c),!n}),!!n}function Tr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=qt){for(;i<a;){var c=i+a>>>1,p=e[c];p!==null&&!Oe(p)&&(n?p<=t:p<t)?i=c+1:a=c}return a}return Mi(e,t,Pe,n)}function Mi(e,t,n,i){var a=0,c=e==null?0:e.length;if(c===0)return 0;t=n(t);for(var p=t!==t,d=t===null,g=Oe(t),w=t===r;a<c;){var x=vr((a+c)/2),A=n(e[x]),I=A!==r,F=A===null,O=A===A,B=Oe(A);if(p)var L=i||O;else w?L=O&&(i||I):d?L=O&&I&&(i||!F):g?L=O&&I&&!F&&(i||!B):F||B?L=!1:L=i?A<=t:A<t;L?a=x+1:c=x}return ve(c,ut)}function qa(e,t){for(var n=-1,i=e.length,a=0,c=[];++n<i;){var p=e[n],d=t?t(p):p;if(!n||!st(d,g)){var g=d;c[a++]=p===0?0:p}}return c}function Ha(e){return typeof e=="number"?e:Oe(e)?Te:+e}function ke(e){if(typeof e=="string")return e;if($(e))return se(e,ke)+"";if(Oe(e))return Aa?Aa.call(e):"";var t=e+"";return t=="0"&&1/e==-je?"-0":t}function Dt(e,t,n){var i=-1,a=ir,c=e.length,p=!0,d=[],g=d;if(n)p=!1,a=gi;else if(c>=f){var w=t?null:Jf(e);if(w)return ar(w);p=!1,a=bn,g=new Jt}else g=t?[]:d;e:for(;++i<c;){var x=e[i],A=t?t(x):x;if(x=n||x!==0?x:0,p&&A===A){for(var I=g.length;I--;)if(g[I]===A)continue e;t&&g.push(A),d.push(x)}else a(g,A,n)||(g!==d&&g.push(A),d.push(x))}return d}function Bi(e,t){return t=$t(t,e),e=_o(e,t),e==null||delete e[pt(Ve(t))]}function Ga(e,t,n,i){return Mn(e,t,n(Vt(e,t)),i)}function Er(e,t,n,i){for(var a=e.length,c=i?a:-1;(i?c--:++c<a)&&t(e[c],c,e););return n?Ke(e,i?0:c,i?c+1:a):Ke(e,i?c+1:0,i?a:c)}function za(e,t){var n=e;return n instanceof z&&(n=n.value()),mi(t,function(i,a){return a.func.apply(a.thisArg,Ot([i],a.args))},n)}function ji(e,t,n){var i=e.length;if(i<2)return i?Dt(e[0]):[];for(var a=-1,c=y(i);++a<i;)for(var p=e[a],d=-1;++d<i;)d!=a&&(c[a]=Dn(c[a]||p,e[d],t,n));return Dt(me(c,1),t,n)}function Ja(e,t,n){for(var i=-1,a=e.length,c=t.length,p={};++i<a;){var d=i<c?t[i]:r;n(p,e[i],d)}return p}function qi(e){return ue(e)?e:[]}function Hi(e){return typeof e=="function"?e:Pe}function $t(e,t){return $(e)?e:Qi(e,t)?[e]:So(Q(e))}var Df=j;function Wt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Ke(e,t,n)}var Ka=Sc||function(e){return ge.clearTimeout(e)};function Va(e,t){if(t)return e.slice();var n=e.length,i=ma?ma(n):new e.constructor(n);return e.copy(i),i}function Gi(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}function $f(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Wf(e){var t=new e.constructor(e.source,ks.exec(e));return t.lastIndex=e.lastIndex,t}function Mf(e){return Nn?te(Nn.call(e)):{}}function Ya(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Xa(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,c=Oe(e),p=t!==r,d=t===null,g=t===t,w=Oe(t);if(!d&&!w&&!c&&e>t||c&&p&&g&&!d&&!w||i&&p&&g||!n&&g||!a)return 1;if(!i&&!c&&!w&&e<t||w&&n&&a&&!i&&!c||d&&n&&a||!p&&a||!g)return-1}return 0}function Bf(e,t,n){for(var i=-1,a=e.criteria,c=t.criteria,p=a.length,d=n.length;++i<p;){var g=Xa(a[i],c[i]);if(g){if(i>=d)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function Za(e,t,n,i){for(var a=-1,c=e.length,p=n.length,d=-1,g=t.length,w=pe(c-p,0),x=y(g+w),A=!i;++d<g;)x[d]=t[d];for(;++a<p;)(A||a<c)&&(x[n[a]]=e[a]);for(;w--;)x[d++]=e[a++];return x}function Qa(e,t,n,i){for(var a=-1,c=e.length,p=-1,d=n.length,g=-1,w=t.length,x=pe(c-d,0),A=y(x+w),I=!i;++a<x;)A[a]=e[a];for(var F=a;++g<w;)A[F+g]=t[g];for(;++p<d;)(I||a<c)&&(A[F+n[p]]=e[a++]);return A}function Ee(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function ft(e,t,n,i){var a=!n;n||(n={});for(var c=-1,p=t.length;++c<p;){var d=t[c],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?_t(n,d,g):Un(n,d,g)}return n}function jf(e,t){return ft(e,Zi(e),t)}function qf(e,t){return ft(e,po(e),t)}function Fr(e,t){return function(n,i){var a=$(n)?Ju:ff,c=t?t():{};return a(n,e,b(i,2),c)}}function pn(e){return j(function(t,n){var i=-1,a=n.length,c=a>1?n[a-1]:r,p=a>2?n[2]:r;for(c=e.length>3&&typeof c=="function"?(a--,c):r,p&&xe(n[0],n[1],p)&&(c=a<3?r:c,a=1),t=te(t);++i<a;){var d=n[i];d&&e(t,d,i,c)}return t})}function eo(e,t){return function(n,i){if(n==null)return n;if(!Fe(n))return e(n,i);for(var a=n.length,c=t?a:-1,p=te(n);(t?c--:++c<a)&&i(p[c],c,p)!==!1;);return n}}function to(e){return function(t,n,i){for(var a=-1,c=te(t),p=i(t),d=p.length;d--;){var g=p[e?d:++a];if(n(c[g],g,c)===!1)break}return t}}function Hf(e,t,n){var i=t&Ie,a=Bn(e);function c(){var p=this&&this!==ge&&this instanceof c?a:e;return p.apply(i?n:this,arguments)}return c}function no(e){return function(t){t=Q(t);var n=sn(t)?rt(t):r,i=n?n[0]:t.charAt(0),a=n?Wt(n,1).join(""):t.slice(1);return i[e]()+a}}function dn(e){return function(t){return mi(tl(el(t).replace(Ou,"")),e,"")}}function Bn(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=fn(e.prototype),i=e.apply(n,t);return ae(i)?i:n}}function Gf(e,t,n){var i=Bn(e);function a(){for(var c=arguments.length,p=y(c),d=c,g=hn(a);d--;)p[d]=arguments[d];var w=c<3&&p[0]!==g&&p[c-1]!==g?[]:Lt(p,g);if(c-=w.length,c<n)return oo(e,t,Cr,a.placeholder,r,p,w,r,r,n-c);var x=this&&this!==ge&&this instanceof a?i:e;return be(x,this,p)}return a}function ro(e){return function(t,n,i){var a=te(t);if(!Fe(t)){var c=b(n,3);t=he(t),n=function(d){return c(a[d],d,a)}}var p=e(t,n,i);return p>-1?a[c?t[p]:p]:r}}function io(e){return xt(function(t){var n=t.length,i=n,a=ze.prototype.thru;for(e&&t.reverse();i--;){var c=t[i];if(typeof c!="function")throw new Ge(v);if(a&&!p&&kr(c)=="wrapper")var p=new ze([],!0)}for(i=p?i:n;++i<n;){c=t[i];var d=kr(c),g=d=="wrapper"?Yi(c):r;g&&es(g[0])&&g[1]==(Me|$e|We|Rt)&&!g[4].length&&g[9]==1?p=p[kr(g[0])].apply(p,g[3]):p=c.length==1&&es(c)?p[d]():p.thru(c)}return function(){var w=arguments,x=w[0];if(p&&w.length==1&&$(x))return p.plant(x).value();for(var A=0,I=n?t[A].apply(this,w):x;++A<n;)I=t[A].call(this,I);return I}})}function Cr(e,t,n,i,a,c,p,d,g,w){var x=t&Me,A=t&Ie,I=t&ht,F=t&($e|Pt),O=t&Qt,B=I?r:Bn(e);function L(){for(var H=arguments.length,J=y(H),Le=H;Le--;)J[Le]=arguments[Le];if(F)var Ae=hn(L),Ne=nc(J,Ae);if(i&&(J=Za(J,i,a,F)),c&&(J=Qa(J,c,p,F)),H-=Ne,F&&H<w){var ce=Lt(J,Ae);return oo(e,t,Cr,L.placeholder,n,J,ce,d,g,w-H)}var at=A?n:this,Tt=I?at[e]:e;return H=J.length,d?J=fp(J,d):O&&H>1&&J.reverse(),x&&g<H&&(J.length=g),this&&this!==ge&&this instanceof L&&(Tt=B||Bn(Tt)),Tt.apply(at,J)}return L}function so(e,t){return function(n,i){return _f(n,e,t(i),{})}}function Pr(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=ke(n),i=ke(i)):(n=Ha(n),i=Ha(i)),a=e(n,i)}return a}}function zi(e){return xt(function(t){return t=se(t,Re(b())),j(function(n){var i=this;return e(t,function(a){return be(a,i,n)})})})}function br(e,t){t=t===r?" ":ke(t);var n=t.length;if(n<2)return n?Wi(t,e):t;var i=Wi(t,mr(e/an(t)));return sn(t)?Wt(rt(i),0,e).join(""):i.slice(0,e)}function zf(e,t,n,i){var a=t&Ie,c=Bn(e);function p(){for(var d=-1,g=arguments.length,w=-1,x=i.length,A=y(x+g),I=this&&this!==ge&&this instanceof p?c:e;++w<x;)A[w]=i[w];for(;g--;)A[w++]=arguments[++d];return be(I,a?n:this,A)}return p}function ao(e){return function(t,n,i){return i&&typeof i!="number"&&xe(t,n,i)&&(n=i=r),t=It(t),n===r?(n=t,t=0):n=It(n),i=i===r?t<n?1:-1:It(i),Rf(t,n,i,e)}}function Rr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ye(t),n=Ye(n)),e(t,n)}}function oo(e,t,n,i,a,c,p,d,g,w){var x=t&$e,A=x?p:r,I=x?r:p,F=x?c:r,O=x?r:c;t|=x?We:bt,t&=~(x?bt:We),t&xn||(t&=-4);var B=[e,t,a,F,A,O,I,d,g,w],L=n.apply(r,B);return es(e)&&wo(L,B),L.placeholder=i,xo(L,e,t)}function Ji(e){var t=fe[e];return function(n,i){if(n=Ye(n),i=i==null?0:ve(W(i),292),i&&wa(n)){var a=(Q(n)+"e").split("e"),c=t(a[0]+"e"+(+a[1]+i));return a=(Q(c)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var Jf=un&&1/ar(new un([,-0]))[1]==je?function(e){return new un(e)}:gs;function lo(e){return function(t){var n=ye(t);return n==tt?Si(t):n==nt?uc(t):tc(t,e(t))}}function wt(e,t,n,i,a,c,p,d){var g=t&ht;if(!g&&typeof e!="function")throw new Ge(v);var w=i?i.length:0;if(w||(t&=-97,i=a=r),p=p===r?p:pe(W(p),0),d=d===r?d:W(d),w-=a?a.length:0,t&bt){var x=i,A=a;i=a=r}var I=g?r:Yi(e),F=[e,t,n,i,a,x,A,c,p,d];if(I&&lp(F,I),e=F[0],t=F[1],n=F[2],i=F[3],a=F[4],d=F[9]=F[9]===r?g?0:e.length:pe(F[9]-w,0),!d&&t&($e|Pt)&&(t&=-25),!t||t==Ie)var O=Hf(e,t,n);else t==$e||t==Pt?O=Gf(e,t,d):(t==We||t==(Ie|We))&&!a.length?O=zf(e,t,n,i):O=Cr.apply(r,F);var B=I?ja:wo;return xo(B(O,F),e,t)}function uo(e,t,n,i){return e===r||st(e,ln[n])&&!ee.call(i,n)?t:e}function co(e,t,n,i,a,c){return ae(e)&&ae(t)&&(c.set(t,e),Ir(e,t,r,co,c),c.delete(t)),e}function Kf(e){return Hn(e)?r:e}function fo(e,t,n,i,a,c){var p=n&ne,d=e.length,g=t.length;if(d!=g&&!(p&&g>d))return!1;var w=c.get(e),x=c.get(t);if(w&&x)return w==t&&x==e;var A=-1,I=!0,F=n&De?new Jt:r;for(c.set(e,t),c.set(t,e);++A<d;){var O=e[A],B=t[A];if(i)var L=p?i(B,O,A,t,e,c):i(O,B,A,e,t,c);if(L!==r){if(L)continue;I=!1;break}if(F){if(!vi(t,function(H,J){if(!bn(F,J)&&(O===H||a(O,H,n,i,c)))return F.push(J)})){I=!1;break}}else if(!(O===B||a(O,B,n,i,c))){I=!1;break}}return c.delete(e),c.delete(t),I}function Vf(e,t,n,i,a,c,p){switch(n){case tn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Pn:return!(e.byteLength!=t.byteLength||!c(new pr(e),new pr(t)));case Sn:case In:case Tn:return st(+e,+t);case Zn:return e.name==t.name&&e.message==t.message;case En:case Fn:return e==t+"";case tt:var d=Si;case nt:var g=i≠if(d||(d=ar),e.size!=t.size&&!g)return!1;var w=p.get(e);if(w)return w==t;i|=De,p.set(e,t);var x=fo(d(e),d(t),i,a,c,p);return p.delete(e),x;case er:if(Nn)return Nn.call(e)==Nn.call(t)}return!1}function Yf(e,t,n,i,a,c){var p=n&ne,d=Ki(e),g=d.length,w=Ki(t),x=w.length;if(g!=x&&!p)return!1;for(var A=g;A--;){var I=d[A];if(!(p?I in t:ee.call(t,I)))return!1}var F=c.get(e),O=c.get(t);if(F&&O)return F==t&&O==e;var B=!0;c.set(e,t),c.set(t,e);for(var L=p;++A<g;){I=d[A];var H=e[I],J=t[I];if(i)var Le=p?i(J,H,I,t,e,c):i(H,J,I,e,t,c);if(!(Le===r?H===J||a(H,J,n,i,c):Le)){B=!1;break}L||(L=I=="constructor")}if(B&&!L){var Ae=e.constructor,Ne=t.constructor;Ae!=Ne&&"constructor"in e&&"constructor"in t&&!(typeof Ae=="function"&&Ae instanceof Ae&&typeof Ne=="function"&&Ne instanceof Ne)&&(B=!1)}return c.delete(e),c.delete(t),B}function xt(e){return ns(yo(e,r,Fo),e+"")}function Ki(e){return Ra(e,he,Zi)}function Vi(e){return Ra(e,Ce,po)}var Yi=yr?function(e){return yr.get(e)}:gs;function kr(e){for(var t=e.name+"",n=cn[t],i=ee.call(cn,t)?n.length:0;i--;){var a=n[i],c=a.func;if(c==null||c==e)return a.name}return t}function hn(e){var t=ee.call(u,"placeholder")?u:e;return t.placeholder}function b(){var e=u.iteratee||ds;return e=e===ds?La:e,arguments.length?e(arguments[0],arguments[1]):e}function Or(e,t){var n=e.__data__;return ip(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Xi(e){for(var t=he(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,mo(a)]}return t}function Yt(e,t){var n=ac(e,t);return Oa(n)?n:r}function Xf(e){var t=ee.call(e,Gt),n=e[Gt];try{e[Gt]=r;var i=!0}catch{}var a=cr.call(e);return i&&(t?e[Gt]=n:delete e[Gt]),a}var Zi=Ti?function(e){return e==null?[]:(e=te(e),kt(Ti(e),function(t){return ya.call(e,t)}))}:ms,po=Ti?function(e){for(var t=[];e;)Ot(t,Zi(e)),e=dr(e);return t}:ms,ye=we;(Ei&&ye(new Ei(new ArrayBuffer(1)))!=tn||kn&&ye(new kn)!=tt||Fi&&ye(Fi.resolve())!=Cs||un&&ye(new un)!=nt||On&&ye(new On)!=Cn)&&(ye=function(e){var t=we(e),n=t==mt?e.constructor:r,i=n?Xt(n):"";if(i)switch(i){case kc:return tn;case Oc:return tt;case Lc:return Cs;case Nc:return nt;case Uc:return Cn}return t});function Zf(e,t,n){for(var i=-1,a=n.length;++i<a;){var c=n[i],p=c.size;switch(c.type){case"drop":e+=p;break;case"dropRight":t-=p;break;case"take":t=ve(t,e+p);break;case"takeRight":e=pe(e,t-p);break}}return{start:e,end:t}}function Qf(e){var t=e.match(iu);return t?t[1].split(su):[]}function ho(e,t,n){t=$t(t,e);for(var i=-1,a=t.length,c=!1;++i<a;){var p=pt(t[i]);if(!(c=e!=null&&n(e,p)))break;e=e[p]}return c||++i!=a?c:(a=e==null?0:e.length,!!a&&Mr(a)&&At(p,a)&&($(e)||Zt(e)))}function ep(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function go(e){return typeof e.constructor=="function"&&!jn(e)?fn(dr(e)):{}}function tp(e,t,n){var i=e.constructor;switch(t){case Pn:return Gi(e);case Sn:case In:return new i(+e);case tn:return $f(e,n);case Xr:case Zr:case Qr:case ei:case ti:case ni:case ri:case ii:case si:return Ya(e,n);case tt:return new i;case Tn:case Fn:return new i(e);case En:return Wf(e);case nt:return new i;case er:return Mf(e)}}function np(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(ru,`{
|
|
431
786
|
/* [wrapped with `+t+`] */
|
|
432
|
-
`)}function Zf(e){return D(e)||Yt(e)||!!(ga&&e&&e[ga])}function xt(e,t){var n=typeof e;return t=t??de,!!t&&(n=="number"||n!="symbol"&&uu.test(e))&&e>-1&&e%1==0&&e<t}function Se(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Te(n)&&xt(t,n.length):i=="string"&&t in n)?it(n[t],e):!1}function Ki(e,t){if(D(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ne(e)?!0:Kl.test(e)||!zl.test(e)||t!=null&&e in te(t)}function Qf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vi(e){var t=Cr(e),n=u[t];if(typeof n!="function"||!(t in J.prototype))return!1;if(e===n)return!0;var i=Gi(n);return!!i&&e===i[0]}function ep(e){return!!fa&&fa in e}var tp=sr?St:ps;function $n(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||sn;return e===n}function fo(e){return e===e&&!ae(e)}function po(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in te(n))}}function np(e){var t=Nr(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function rp(e,t){var n=e[1],i=t[1],a=n|i,c=a<(Fe|dt|Be),f=i==Be&&n==$e||i==Be&&n==Pt&&e[7].length<=t[8]||i==(Be|Pt)&&t[7].length<=t[8]&&n==$e;if(!(c||f))return e;i&Fe&&(e[2]=t[2],a|=n&Fe?0:vn);var d=t[3];if(d){var g=e[3];e[3]=g?Ka(g,d,t[4]):d,e[4]=g?Lt(e[3],H):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Va(g,d,t[6]):d,e[6]=g?Lt(e[5],H):t[6]),d=t[7],d&&(e[7]=d),i&Be&&(e[8]=e[8]==null?t[8]:ye(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function ip(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function sp(e){return or.call(e)}function ho(e,t,n){return t=pe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,c=pe(i.length-t,0),f=y(c);++a<c;)f[a]=i[t+a];a=-1;for(var d=y(t+1);++a<t;)d[a]=i[a];return d[t]=n(f),Oe(e,this,d)}}function go(e,t){return t.length<2?e:zt(e,ze(t,0,-1))}function ap(e,t){for(var n=e.length,i=ye(t.length,n),a=Ee(e);i--;){var c=t[i];e[i]=xt(c,n)?a[c]:r}return e}function Yi(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var mo=yo(Wa),Mn=wc||function(e,t){return ge.setTimeout(e,t)},Xi=yo(Cf);function vo(e,t,n){var i=t+"";return Xi(e,Xf(i,op(Kf(i),n)))}function yo(e){var t=0,n=0;return function(){var i=Ic(),a=Jn-(i-n);if(n=i,a>0){if(++t>=le)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Rr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var c=Li(n,a),f=e[c];e[c]=e[n],e[n]=f}return e.length=t,e}var _o=np(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vl,function(n,i,a,c){t.push(a?c.replace(ru,"$1"):i||n)}),t});function ft(e){if(typeof e=="string"||Ne(e))return e;var t=e+"";return t=="0"&&1/e==-B?"-0":t}function Vt(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}function op(e,t){return qe(Ll,function(n){var i="_."+n[0];t&n[1]&&!tr(e,i)&&e.push(i)}),e.sort()}function wo(e){if(e instanceof J)return e.clone();var t=new Ge(e.__wrapped__,e.__chain__);return t.__actions__=Ee(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function lp(e,t,n){(n?Se(e,t,n):t===r)?t=1:t=pe(W(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,c=0,f=y(dr(i/t));a<i;)f[c++]=ze(e,a,a+=t);return f}function up(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var c=e[t];c&&(a[i++]=c)}return a}function cp(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ot(D(n)?Ee(n):[n],me(t,1))}var fp=q(function(e,t){return ue(e)?kn(e,me(t,1,ue,!0)):[]}),pp=q(function(e,t){var n=Ke(t);return ue(n)&&(n=r),ue(e)?kn(e,me(t,1,ue,!0),C(n,2)):[]}),dp=q(function(e,t){var n=Ke(t);return ue(n)&&(n=r),ue(e)?kn(e,me(t,1,ue,!0),r,n):[]});function hp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),ze(e,t<0?0:t,i)):[]}function gp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,ze(e,0,t<0?0:t)):[]}function mp(e,t){return e&&e.length?Ar(e,C(t,3),!0,!0):[]}function vp(e,t){return e&&e.length?Ar(e,C(t,3),!0):[]}function yp(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&Se(e,t,n)&&(n=0,i=a),cf(e,t,n,i)):[]}function xo(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),nr(e,C(t,3),a)}function So(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=W(n),a=n<0?pe(i+a,0):ye(a,i-1)),nr(e,C(t,3),a,!0)}function Ao(e){var t=e==null?0:e.length;return t?me(e,1):[]}function _p(e){var t=e==null?0:e.length;return t?me(e,B):[]}function wp(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function xp(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];i[a[0]]=a[1]}return i}function Io(e){return e&&e.length?e[0]:r}function Sp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),en(e,t,a)}function Ap(e){var t=e==null?0:e.length;return t?ze(e,0,-1):[]}var Ip=q(function(e){var t=se(e,Wi);return t.length&&t[0]===e[0]?bi(t):[]}),Fp=q(function(e){var t=Ke(e),n=se(e,Wi);return t===Ke(n)?t=r:n.pop(),n.length&&n[0]===e[0]?bi(n,C(t,2)):[]}),Ep=q(function(e){var t=Ke(e),n=se(e,Wi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?bi(n,r,t):[]});function Tp(e,t){return e==null?"":Sc.call(e,t)}function Ke(e){var t=e==null?0:e.length;return t?e[t-1]:r}function bp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=W(n),a=a<0?pe(i+a,0):ye(a,i-1)),t===t?ac(e,t,a):nr(e,ra,a,!0)}function Cp(e,t){return e&&e.length?ka(e,W(t)):r}var Pp=q(Fo);function Fo(e,t){return e&&e.length&&t&&t.length?Oi(e,t):e}function Rp(e,t,n){return e&&e.length&&t&&t.length?Oi(e,t,C(n,2)):e}function Op(e,t,n){return e&&e.length&&t&&t.length?Oi(e,t,r,n):e}var Lp=wt(function(e,t){var n=e==null?0:e.length,i=Ii(e,t);return Da(e,se(t,function(a){return xt(a,n)?+a:a}).sort(za)),i});function kp(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],c=e.length;for(t=C(t,3);++i<c;){var f=e[i];t(f,i,e)&&(n.push(f),a.push(i))}return Da(e,a),n}function Zi(e){return e==null?e:Ec.call(e)}function Np(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&Se(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),ze(e,t,n)):[]}function Up(e,t){return Sr(e,t)}function Dp(e,t,n){return Ni(e,t,C(n,2))}function Wp(e,t){var n=e==null?0:e.length;if(n){var i=Sr(e,t);if(i<n&&it(e[i],t))return i}return-1}function $p(e,t){return Sr(e,t,!0)}function Mp(e,t,n){return Ni(e,t,C(n,2),!0)}function Bp(e,t){var n=e==null?0:e.length;if(n){var i=Sr(e,t,!0)-1;if(it(e[i],t))return i}return-1}function jp(e){return e&&e.length?$a(e):[]}function qp(e,t){return e&&e.length?$a(e,C(t,2)):[]}function Hp(e){var t=e==null?0:e.length;return t?ze(e,1,t):[]}function Gp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),ze(e,0,t<0?0:t)):[]}function Jp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,ze(e,t<0?0:t,i)):[]}function zp(e,t){return e&&e.length?Ar(e,C(t,3),!1,!0):[]}function Kp(e,t){return e&&e.length?Ar(e,C(t,3)):[]}var Vp=q(function(e){return Ut(me(e,1,ue,!0))}),Yp=q(function(e){var t=Ke(e);return ue(t)&&(t=r),Ut(me(e,1,ue,!0),C(t,2))}),Xp=q(function(e){var t=Ke(e);return t=typeof t=="function"?t:r,Ut(me(e,1,ue,!0),r,t)});function Zp(e){return e&&e.length?Ut(e):[]}function Qp(e,t){return e&&e.length?Ut(e,C(t,2)):[]}function ed(e,t){return t=typeof t=="function"?t:r,e&&e.length?Ut(e,r,t):[]}function Qi(e){if(!(e&&e.length))return[];var t=0;return e=Rt(e,function(n){if(ue(n))return t=pe(n.length,t),!0}),mi(t,function(n){return se(e,di(n))})}function Eo(e,t){if(!(e&&e.length))return[];var n=Qi(e);return t==null?n:se(n,function(i){return Oe(t,r,i)})}var td=q(function(e,t){return ue(e)?kn(e,t):[]}),nd=q(function(e){return Di(Rt(e,ue))}),rd=q(function(e){var t=Ke(e);return ue(t)&&(t=r),Di(Rt(e,ue),C(t,2))}),id=q(function(e){var t=Ke(e);return t=typeof t=="function"?t:r,Di(Rt(e,ue),r,t)}),sd=q(Qi);function ad(e,t){return qa(e||[],t||[],Ln)}function od(e,t){return qa(e||[],t||[],Dn)}var ld=q(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,Eo(e,n)});function To(e){var t=u(e);return t.__chain__=!0,t}function ud(e,t){return t(e),e}function Or(e,t){return t(e)}var cd=wt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(c){return Ii(c,e)};return t>1||this.__actions__.length||!(i instanceof J)||!xt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:Or,args:[a],thisArg:r}),new Ge(i,this.__chain__).thru(function(c){return t&&!c.length&&c.push(r),c}))});function fd(){return To(this)}function pd(){return new Ge(this.value(),this.__chain__)}function dd(){this.__values__===r&&(this.__values__=Bo(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function hd(){return this}function gd(e){for(var t,n=this;n instanceof vr;){var i=wo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function md(){var e=this.__wrapped__;if(e instanceof J){var t=e;return this.__actions__.length&&(t=new J(this)),t=t.reverse(),t.__actions__.push({func:Or,args:[Zi],thisArg:r}),new Ge(t,this.__chain__)}return this.thru(Zi)}function vd(){return ja(this.__wrapped__,this.__actions__)}var yd=Ir(function(e,t,n){ee.call(e,n)?++e[n]:yt(e,n,1)});function _d(e,t,n){var i=D(e)?ta:uf;return n&&Se(e,t,n)&&(t=r),i(e,C(t,3))}function wd(e,t){var n=D(e)?Rt:Fa;return n(e,C(t,3))}var xd=Qa(xo),Sd=Qa(So);function Ad(e,t){return me(Lr(e,t),1)}function Id(e,t){return me(Lr(e,t),B)}function Fd(e,t,n){return n=n===r?1:W(n),me(Lr(e,t),n)}function bo(e,t){var n=D(e)?qe:Nt;return n(e,C(t,3))}function Co(e,t){var n=D(e)?qu:Ia;return n(e,C(t,3))}var Ed=Ir(function(e,t,n){ee.call(e,n)?e[n].push(t):yt(e,n,[t])});function Td(e,t,n,i){e=Te(e)?e:dn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),Wr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&en(e,t,n)>-1}var bd=q(function(e,t,n){var i=-1,a=typeof t=="function",c=Te(e)?y(e.length):[];return Nt(e,function(f){c[++i]=a?Oe(t,f,n):Nn(f,t,n)}),c}),Cd=Ir(function(e,t,n){yt(e,n,t)});function Lr(e,t){var n=D(e)?se:Ra;return n(e,C(t,3))}function Pd(e,t,n,i){return e==null?[]:(D(t)||(t=t==null?[]:[t]),n=i?r:n,D(n)||(n=n==null?[]:[n]),Na(e,t,n))}var Rd=Ir(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Od(e,t,n){var i=D(e)?fi:sa,a=arguments.length<3;return i(e,C(t,4),n,a,Nt)}function Ld(e,t,n){var i=D(e)?Hu:sa,a=arguments.length<3;return i(e,C(t,4),n,a,Ia)}function kd(e,t){var n=D(e)?Rt:Fa;return n(e,Ur(C(t,3)))}function Nd(e){var t=D(e)?wa:Tf;return t(e)}function Ud(e,t,n){(n?Se(e,t,n):t===r)?t=1:t=W(t);var i=D(e)?rf:bf;return i(e,t)}function Dd(e){var t=D(e)?sf:Pf;return t(e)}function Wd(e){if(e==null)return 0;if(Te(e))return Wr(e)?nn(e):e.length;var t=_e(e);return t==et||t==tt?e.size:Pi(e).length}function $d(e,t,n){var i=D(e)?pi:Rf;return n&&Se(e,t,n)&&(t=r),i(e,C(t,3))}var Md=q(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Se(e,t[0],t[1])?t=[]:n>2&&Se(t[0],t[1],t[2])&&(t=[t[0]]),Na(e,me(t,1),[])}),kr=_c||function(){return ge.Date.now()};function Bd(e,t){if(typeof t!="function")throw new He(v);return e=W(e),function(){if(--e<1)return t.apply(this,arguments)}}function Po(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,_t(e,Be,r,r,r,r,t)}function Ro(e,t){var n;if(typeof t!="function")throw new He(v);return e=W(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var es=q(function(e,t,n){var i=Fe;if(n.length){var a=Lt(n,fn(es));i|=Me}return _t(e,i,t,n,a)}),Oo=q(function(e,t,n){var i=Fe|dt;if(n.length){var a=Lt(n,fn(Oo));i|=Me}return _t(t,i,e,n,a)});function Lo(e,t,n){t=n?r:t;var i=_t(e,$e,r,r,r,r,r,t);return i.placeholder=Lo.placeholder,i}function ko(e,t,n){t=n?r:t;var i=_t(e,bt,r,r,r,r,r,t);return i.placeholder=ko.placeholder,i}function No(e,t,n){var i,a,c,f,d,g,w=0,x=!1,S=!1,I=!0;if(typeof e!="function")throw new He(v);t=Ve(t)||0,ae(n)&&(x=!!n.leading,S="maxWait"in n,c=S?pe(Ve(n.maxWait)||0,t):c,I="trailing"in n?!!n.trailing:I);function T(ce){var st=i,It=a;return i=a=r,w=ce,f=e.apply(It,st),f}function R(ce){return w=ce,d=Mn(G,t),x?T(ce):f}function j(ce){var st=ce-g,It=ce-w,el=t-st;return S?ye(el,c-It):el}function O(ce){var st=ce-g,It=ce-w;return g===r||st>=t||st<0||S&&It>=c}function G(){var ce=kr();if(O(ce))return z(ce);d=Mn(G,j(ce))}function z(ce){return d=r,I&&i?T(ce):(i=a=r,f)}function Ue(){d!==r&&Ha(d),w=0,i=g=a=d=r}function Ae(){return d===r?f:z(kr())}function De(){var ce=kr(),st=O(ce);if(i=arguments,a=this,g=ce,st){if(d===r)return R(g);if(S)return Ha(d),d=Mn(G,t),T(g)}return d===r&&(d=Mn(G,t)),f}return De.cancel=Ue,De.flush=Ae,De}var jd=q(function(e,t){return Aa(e,1,t)}),qd=q(function(e,t,n){return Aa(e,Ve(t)||0,n)});function Hd(e){return _t(e,yn)}function Nr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new He(v);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],c=n.cache;if(c.has(a))return c.get(a);var f=e.apply(this,i);return n.cache=c.set(a,f)||c,f};return n.cache=new(Nr.Cache||vt),n}Nr.Cache=vt;function Ur(e){if(typeof e!="function")throw new He(v);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 Gd(e){return Ro(2,e)}var Jd=Of(function(e,t){t=t.length==1&&D(t[0])?se(t[0],Le(C())):se(me(t,1),Le(C()));var n=t.length;return q(function(i){for(var a=-1,c=ye(i.length,n);++a<c;)i[a]=t[a].call(this,i[a]);return Oe(e,this,i)})}),ts=q(function(e,t){var n=Lt(t,fn(ts));return _t(e,Me,r,t,n)}),Uo=q(function(e,t){var n=Lt(t,fn(Uo));return _t(e,Ct,r,t,n)}),zd=wt(function(e,t){return _t(e,Pt,r,r,r,t)});function Kd(e,t){if(typeof e!="function")throw new He(v);return t=t===r?t:W(t),q(e,t)}function Vd(e,t){if(typeof e!="function")throw new He(v);return t=t==null?0:pe(W(t),0),q(function(n){var i=n[t],a=Wt(n,0,t);return i&&Ot(a,i),Oe(e,this,a)})}function Yd(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new He(v);return ae(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),No(e,t,{leading:i,maxWait:t,trailing:a})}function Xd(e){return Po(e,1)}function Zd(e,t){return ts($i(t),e)}function Qd(){if(!arguments.length)return[];var e=arguments[0];return D(e)?e:[e]}function eh(e){return Je(e,V)}function th(e,t){return t=typeof t=="function"?t:r,Je(e,V,t)}function nh(e){return Je(e,X|V)}function rh(e,t){return t=typeof t=="function"?t:r,Je(e,X|V,t)}function ih(e,t){return t==null||Sa(e,t,he(t))}function it(e,t){return e===t||e!==e&&t!==t}var sh=br(Ti),ah=br(function(e,t){return e>=t}),Yt=ba(function(){return arguments}())?ba:function(e){return oe(e)&&ee.call(e,"callee")&&!ha.call(e,"callee")},D=y.isArray,oh=Vs?Le(Vs):gf;function Te(e){return e!=null&&Dr(e.length)&&!St(e)}function ue(e){return oe(e)&&Te(e)}function lh(e){return e===!0||e===!1||oe(e)&&xe(e)==wn}var $t=xc||ps,uh=Ys?Le(Ys):mf;function ch(e){return oe(e)&&e.nodeType===1&&!Bn(e)}function fh(e){if(e==null)return!0;if(Te(e)&&(D(e)||typeof e=="string"||typeof e.splice=="function"||$t(e)||pn(e)||Yt(e)))return!e.length;var t=_e(e);if(t==et||t==tt)return!e.size;if($n(e))return!Pi(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function ph(e,t){return Un(e,t)}function dh(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?Un(e,t,r,n):!!i}function ns(e){if(!oe(e))return!1;var t=xe(e);return t==Vn||t==Nl||typeof e.message=="string"&&typeof e.name=="string"&&!Bn(e)}function hh(e){return typeof e=="number"&&ma(e)}function St(e){if(!ae(e))return!1;var t=xe(e);return t==Yn||t==As||t==kl||t==Dl}function Do(e){return typeof e=="number"&&e==W(e)}function Dr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=de}function ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function oe(e){return e!=null&&typeof e=="object"}var Wo=Xs?Le(Xs):yf;function gh(e,t){return e===t||Ci(e,t,Ji(t))}function mh(e,t,n){return n=typeof n=="function"?n:r,Ci(e,t,Ji(t),n)}function vh(e){return $o(e)&&e!=+e}function yh(e){if(tp(e))throw new U(m);return Ca(e)}function _h(e){return e===null}function wh(e){return e==null}function $o(e){return typeof e=="number"||oe(e)&&xe(e)==Sn}function Bn(e){if(!oe(e)||xe(e)!=gt)return!1;var t=cr(e);if(t===null)return!0;var n=ee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ar.call(n)==gc}var rs=Zs?Le(Zs):_f;function xh(e){return Do(e)&&e>=-de&&e<=de}var Mo=Qs?Le(Qs):wf;function Wr(e){return typeof e=="string"||!D(e)&&oe(e)&&xe(e)==In}function Ne(e){return typeof e=="symbol"||oe(e)&&xe(e)==Xn}var pn=ea?Le(ea):xf;function Sh(e){return e===r}function Ah(e){return oe(e)&&_e(e)==Fn}function Ih(e){return oe(e)&&xe(e)==$l}var Fh=br(Ri),Eh=br(function(e,t){return e<=t});function Bo(e){if(!e)return[];if(Te(e))return Wr(e)?nt(e):Ee(e);if(bn&&e[bn])return rc(e[bn]());var t=_e(e),n=t==et?yi:t==tt?rr:dn;return n(e)}function At(e){if(!e)return e===0?e:0;if(e=Ve(e),e===B||e===-B){var t=e<0?-1:1;return t*ht}return e===e?e:0}function W(e){var t=At(e),n=t%1;return t===t?n?t-n:t:0}function jo(e){return e?Jt(W(e),0,ve):0}function Ve(e){if(typeof e=="number")return e;if(Ne(e))return Re;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=aa(e);var n=au.test(e);return n||lu.test(e)?Mu(e.slice(2),n?2:8):su.test(e)?Re:+e}function qo(e){return ct(e,be(e))}function Th(e){return e?Jt(W(e),-de,de):e===0?e:0}function Q(e){return e==null?"":ke(e)}var bh=un(function(e,t){if($n(t)||Te(t)){ct(t,he(t),e);return}for(var n in t)ee.call(t,n)&&Ln(e,n,t[n])}),Ho=un(function(e,t){ct(t,be(t),e)}),$r=un(function(e,t,n,i){ct(t,be(t),e,i)}),Ch=un(function(e,t,n,i){ct(t,he(t),e,i)}),Ph=wt(Ii);function Rh(e,t){var n=ln(e);return t==null?n:xa(n,t)}var Oh=q(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Se(t[0],t[1],a)&&(i=1);++n<i;)for(var c=t[n],f=be(c),d=-1,g=f.length;++d<g;){var w=f[d],x=e[w];(x===r||it(x,sn[w])&&!ee.call(e,w))&&(e[w]=c[w])}return e}),Lh=q(function(e){return e.push(r,ao),Oe(Go,r,e)});function kh(e,t){return na(e,C(t,3),ut)}function Nh(e,t){return na(e,C(t,3),Ei)}function Uh(e,t){return e==null?e:Fi(e,C(t,3),be)}function Dh(e,t){return e==null?e:Ea(e,C(t,3),be)}function Wh(e,t){return e&&ut(e,C(t,3))}function $h(e,t){return e&&Ei(e,C(t,3))}function Mh(e){return e==null?[]:wr(e,he(e))}function Bh(e){return e==null?[]:wr(e,be(e))}function is(e,t,n){var i=e==null?r:zt(e,t);return i===r?n:i}function jh(e,t){return e!=null&&uo(e,t,ff)}function ss(e,t){return e!=null&&uo(e,t,pf)}var qh=to(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=or.call(t)),e[t]=n},os(Ce)),Hh=to(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=or.call(t)),ee.call(e,t)?e[t].push(n):e[t]=[n]},C),Gh=q(Nn);function he(e){return Te(e)?_a(e):Pi(e)}function be(e){return Te(e)?_a(e,!0):Sf(e)}function Jh(e,t){var n={};return t=C(t,3),ut(e,function(i,a,c){yt(n,t(i,a,c),i)}),n}function zh(e,t){var n={};return t=C(t,3),ut(e,function(i,a,c){yt(n,a,t(i,a,c))}),n}var Kh=un(function(e,t,n){xr(e,t,n)}),Go=un(function(e,t,n,i){xr(e,t,n,i)}),Vh=wt(function(e,t){var n={};if(e==null)return n;var i=!1;t=se(t,function(c){return c=Dt(c,e),i||(i=c.length>1),c}),ct(e,Hi(e),n),i&&(n=Je(n,X|N|V,qf));for(var a=t.length;a--;)Ui(n,t[a]);return n});function Yh(e,t){return Jo(e,Ur(C(t)))}var Xh=wt(function(e,t){return e==null?{}:If(e,t)});function Jo(e,t){if(e==null)return{};var n=se(Hi(e),function(i){return[i]});return t=C(t),Ua(e,n,function(i,a){return t(i,a[0])})}function Zh(e,t,n){t=Dt(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var c=e==null?r:e[ft(t[i])];c===r&&(i=a,c=n),e=St(c)?c.call(e):c}return e}function Qh(e,t,n){return e==null?e:Dn(e,t,n)}function eg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Dn(e,t,n,i)}var zo=io(he),Ko=io(be);function tg(e,t,n){var i=D(e),a=i||$t(e)||pn(e);if(t=C(t,4),n==null){var c=e&&e.constructor;a?n=i?new c:[]:ae(e)?n=St(c)?ln(cr(e)):{}:n={}}return(a?qe:ut)(e,function(f,d,g){return t(n,f,d,g)}),n}function ng(e,t){return e==null?!0:Ui(e,t)}function rg(e,t,n){return e==null?e:Ba(e,t,$i(n))}function ig(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ba(e,t,$i(n),i)}function dn(e){return e==null?[]:vi(e,he(e))}function sg(e){return e==null?[]:vi(e,be(e))}function ag(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Ve(n),n=n===n?n:0),t!==r&&(t=Ve(t),t=t===t?t:0),Jt(Ve(e),t,n)}function og(e,t,n){return t=At(t),n===r?(n=t,t=0):n=At(n),e=Ve(e),df(e,t,n)}function lg(e,t,n){if(n&&typeof n!="boolean"&&Se(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=At(e),t===r?(t=e,e=0):t=At(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=va();return ye(e+a*(t-e+$u("1e-"+((a+"").length-1))),t)}return Li(e,t)}var ug=cn(function(e,t,n){return t=t.toLowerCase(),e+(n?Vo(t):t)});function Vo(e){return as(Q(e).toLowerCase())}function Yo(e){return e=Q(e),e&&e.replace(cu,Zu).replace(Cu,"")}function cg(e,t,n){e=Q(e),t=ke(t);var i=e.length;n=n===r?i:Jt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function fg(e){return e=Q(e),e&&Hl.test(e)?e.replace(Es,Qu):e}function pg(e){return e=Q(e),e&&Yl.test(e)?e.replace(ti,"\\$&"):e}var dg=cn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),hg=cn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),gg=Za("toLowerCase");function mg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return Tr(hr(a),n)+e+Tr(dr(a),n)}function vg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?e+Tr(t-i,n):e}function yg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?Tr(t-i,n)+e:e}function _g(e,t,n){return n||t==null?t=0:t&&(t=+t),Fc(Q(e).replace(ni,""),t||0)}function wg(e,t,n){return(n?Se(e,t,n):t===r)?t=1:t=W(t),ki(Q(e),t)}function xg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Sg=cn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Ag(e,t,n){return n&&typeof n!="number"&&Se(e,t,n)&&(t=n=r),n=n===r?ve:n>>>0,n?(e=Q(e),e&&(typeof t=="string"||t!=null&&!rs(t))&&(t=ke(t),!t&&tn(e))?Wt(nt(e),0,n):e.split(t,n)):[]}var Ig=cn(function(e,t,n){return e+(n?" ":"")+as(t)});function Fg(e,t,n){return e=Q(e),n=n==null?0:Jt(W(n),0,e.length),t=ke(t),e.slice(n,n+t.length)==t}function Eg(e,t,n){var i=u.templateSettings;n&&Se(e,t,n)&&(t=r),e=Q(e),t=$r({},t,i,so);var a=$r({},t.imports,i.imports,so),c=he(a),f=vi(a,c),d,g,w=0,x=t.interpolate||Zn,S="__p += '",I=_i((t.escape||Zn).source+"|"+x.source+"|"+(x===Ts?iu:Zn).source+"|"+(t.evaluate||Zn).source+"|$","g"),T="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ku+"]")+`
|
|
433
|
-
`;e.replace(I,function(
|
|
434
|
-
__e(`+
|
|
435
|
-
'`),Ae&&(g=!0,
|
|
787
|
+
`)}function rp(e){return $(e)||Zt(e)||!!(_a&&e&&e[_a])}function At(e,t){var n=typeof e;return t=t??gt,!!t&&(n=="number"||n!="symbol"&&hu.test(e))&&e>-1&&e%1==0&&e<t}function xe(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Fe(n)&&At(t,n.length):i=="string"&&t in n)?st(n[t],e):!1}function Qi(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Oe(e)?!0:Ql.test(e)||!Zl.test(e)||t!=null&&e in te(t)}function ip(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function es(e){var t=kr(e),n=u[t];if(typeof n!="function"||!(t in z.prototype))return!1;if(e===n)return!0;var i=Yi(n);return!!i&&e===i[0]}function sp(e){return!!ga&&ga in e}var ap=lr?St:vs;function jn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ln;return e===n}function mo(e){return e===e&&!ae(e)}function vo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in te(n))}}function op(e){var t=$r(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function lp(e,t){var n=e[1],i=t[1],a=n|i,c=a<(Ie|ht|Me),p=i==Me&&n==$e||i==Me&&n==Rt&&e[7].length<=t[8]||i==(Me|Rt)&&t[7].length<=t[8]&&n==$e;if(!(c||p))return e;i&Ie&&(e[2]=t[2],a|=n&Ie?0:xn);var d=t[3];if(d){var g=e[3];e[3]=g?Za(g,d,t[4]):d,e[4]=g?Lt(e[3],q):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Qa(g,d,t[6]):d,e[6]=g?Lt(e[5],q):t[6]),d=t[7],d&&(e[7]=d),i&Me&&(e[8]=e[8]==null?t[8]:ve(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function up(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function cp(e){return cr.call(e)}function yo(e,t,n){return t=pe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,c=pe(i.length-t,0),p=y(c);++a<c;)p[a]=i[t+a];a=-1;for(var d=y(t+1);++a<t;)d[a]=i[a];return d[t]=n(p),be(e,this,d)}}function _o(e,t){return t.length<2?e:Vt(e,Ke(t,0,-1))}function fp(e,t){for(var n=e.length,i=ve(t.length,n),a=Ee(e);i--;){var c=t[i];e[i]=At(c,n)?a[c]:r}return e}function ts(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var wo=Ao(ja),qn=Tc||function(e,t){return ge.setTimeout(e,t)},ns=Ao(Lf);function xo(e,t,n){var i=t+"";return ns(e,np(i,pp(Qf(i),n)))}function Ao(e){var t=0,n=0;return function(){var i=Pc(),a=Es-(i-n);if(n=i,a>0){if(++t>=Ts)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Lr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var c=$i(n,a),p=e[c];e[c]=e[n],e[n]=p}return e.length=t,e}var So=op(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(eu,function(n,i,a,c){t.push(a?c.replace(lu,"$1"):i||n)}),t});function pt(e){if(typeof e=="string"||Oe(e))return e;var t=e+"";return t=="0"&&1/e==-je?"-0":t}function Xt(e){if(e!=null){try{return ur.call(e)}catch{}try{return e+""}catch{}}return""}function pp(e,t){return He(An,function(n){var i="_."+n[0];t&n[1]&&!ir(e,i)&&e.push(i)}),e.sort()}function Io(e){if(e instanceof z)return e.clone();var t=new ze(e.__wrapped__,e.__chain__);return t.__actions__=Ee(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function dp(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=pe(W(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,c=0,p=y(mr(i/t));a<i;)p[c++]=Ke(e,a,a+=t);return p}function hp(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var c=e[t];c&&(a[i++]=c)}return a}function gp(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ot($(n)?Ee(n):[n],me(t,1))}var mp=j(function(e,t){return ue(e)?Dn(e,me(t,1,ue,!0)):[]}),vp=j(function(e,t){var n=Ve(t);return ue(n)&&(n=r),ue(e)?Dn(e,me(t,1,ue,!0),b(n,2)):[]}),yp=j(function(e,t){var n=Ve(t);return ue(n)&&(n=r),ue(e)?Dn(e,me(t,1,ue,!0),r,n):[]});function _p(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),Ke(e,t<0?0:t,i)):[]}function wp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,0,t<0?0:t)):[]}function xp(e,t){return e&&e.length?Er(e,b(t,3),!0,!0):[]}function Ap(e,t){return e&&e.length?Er(e,b(t,3),!0):[]}function Sp(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&xe(e,t,n)&&(n=0,i=a),gf(e,t,n,i)):[]}function To(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),sr(e,b(t,3),a)}function Eo(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=W(n),a=n<0?pe(i+a,0):ve(a,i-1)),sr(e,b(t,3),a,!0)}function Fo(e){var t=e==null?0:e.length;return t?me(e,1):[]}function Ip(e){var t=e==null?0:e.length;return t?me(e,je):[]}function Tp(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function Ep(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];i[a[0]]=a[1]}return i}function Co(e){return e&&e.length?e[0]:r}function Fp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),rn(e,t,a)}function Cp(e){var t=e==null?0:e.length;return t?Ke(e,0,-1):[]}var Pp=j(function(e){var t=se(e,qi);return t.length&&t[0]===e[0]?Oi(t):[]}),bp=j(function(e){var t=Ve(e),n=se(e,qi);return t===Ve(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Oi(n,b(t,2)):[]}),Rp=j(function(e){var t=Ve(e),n=se(e,qi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?Oi(n,r,t):[]});function kp(e,t){return e==null?"":Fc.call(e,t)}function Ve(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Op(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=W(n),a=a<0?pe(i+a,0):ve(a,i-1)),t===t?fc(e,t,a):sr(e,oa,a,!0)}function Lp(e,t){return e&&e.length?$a(e,W(t)):r}var Np=j(Po);function Po(e,t){return e&&e.length&&t&&t.length?Di(e,t):e}function Up(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,b(n,2)):e}function Dp(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,r,n):e}var $p=xt(function(e,t){var n=e==null?0:e.length,i=Pi(e,t);return Ba(e,se(t,function(a){return At(a,n)?+a:a}).sort(Xa)),i});function Wp(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],c=e.length;for(t=b(t,3);++i<c;){var p=e[i];t(p,i,e)&&(n.push(p),a.push(i))}return Ba(e,a),n}function rs(e){return e==null?e:Rc.call(e)}function Mp(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&xe(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),Ke(e,t,n)):[]}function Bp(e,t){return Tr(e,t)}function jp(e,t,n){return Mi(e,t,b(n,2))}function qp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t);if(i<n&&st(e[i],t))return i}return-1}function Hp(e,t){return Tr(e,t,!0)}function Gp(e,t,n){return Mi(e,t,b(n,2),!0)}function zp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t,!0)-1;if(st(e[i],t))return i}return-1}function Jp(e){return e&&e.length?qa(e):[]}function Kp(e,t){return e&&e.length?qa(e,b(t,2)):[]}function Vp(e){var t=e==null?0:e.length;return t?Ke(e,1,t):[]}function Yp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),Ke(e,0,t<0?0:t)):[]}function Xp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,t<0?0:t,i)):[]}function Zp(e,t){return e&&e.length?Er(e,b(t,3),!1,!0):[]}function Qp(e,t){return e&&e.length?Er(e,b(t,3)):[]}var ed=j(function(e){return Dt(me(e,1,ue,!0))}),td=j(function(e){var t=Ve(e);return ue(t)&&(t=r),Dt(me(e,1,ue,!0),b(t,2))}),nd=j(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,Dt(me(e,1,ue,!0),r,t)});function rd(e){return e&&e.length?Dt(e):[]}function id(e,t){return e&&e.length?Dt(e,b(t,2)):[]}function sd(e,t){return t=typeof t=="function"?t:r,e&&e.length?Dt(e,r,t):[]}function is(e){if(!(e&&e.length))return[];var t=0;return e=kt(e,function(n){if(ue(n))return t=pe(n.length,t),!0}),xi(t,function(n){return se(e,yi(n))})}function bo(e,t){if(!(e&&e.length))return[];var n=is(e);return t==null?n:se(n,function(i){return be(t,r,i)})}var ad=j(function(e,t){return ue(e)?Dn(e,t):[]}),od=j(function(e){return ji(kt(e,ue))}),ld=j(function(e){var t=Ve(e);return ue(t)&&(t=r),ji(kt(e,ue),b(t,2))}),ud=j(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,ji(kt(e,ue),r,t)}),cd=j(is);function fd(e,t){return Ja(e||[],t||[],Un)}function pd(e,t){return Ja(e||[],t||[],Mn)}var dd=j(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,bo(e,n)});function Ro(e){var t=u(e);return t.__chain__=!0,t}function hd(e,t){return t(e),e}function Nr(e,t){return t(e)}var gd=xt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(c){return Pi(c,e)};return t>1||this.__actions__.length||!(i instanceof z)||!At(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:Nr,args:[a],thisArg:r}),new ze(i,this.__chain__).thru(function(c){return t&&!c.length&&c.push(r),c}))});function md(){return Ro(this)}function vd(){return new ze(this.value(),this.__chain__)}function yd(){this.__values__===r&&(this.__values__=Go(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function _d(){return this}function wd(e){for(var t,n=this;n instanceof wr;){var i=Io(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function xd(){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:Nr,args:[rs],thisArg:r}),new ze(t,this.__chain__)}return this.thru(rs)}function Ad(){return za(this.__wrapped__,this.__actions__)}var Sd=Fr(function(e,t,n){ee.call(e,n)?++e[n]:_t(e,n,1)});function Id(e,t,n){var i=$(e)?sa:hf;return n&&xe(e,t,n)&&(t=r),i(e,b(t,3))}function Td(e,t){var n=$(e)?kt:Pa;return n(e,b(t,3))}var Ed=ro(To),Fd=ro(Eo);function Cd(e,t){return me(Ur(e,t),1)}function Pd(e,t){return me(Ur(e,t),je)}function bd(e,t,n){return n=n===r?1:W(n),me(Ur(e,t),n)}function ko(e,t){var n=$(e)?He:Ut;return n(e,b(t,3))}function Oo(e,t){var n=$(e)?Ku:Ca;return n(e,b(t,3))}var Rd=Fr(function(e,t,n){ee.call(e,n)?e[n].push(t):_t(e,n,[t])});function kd(e,t,n,i){e=Fe(e)?e:mn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),Br(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&rn(e,t,n)>-1}var Od=j(function(e,t,n){var i=-1,a=typeof t=="function",c=Fe(e)?y(e.length):[];return Ut(e,function(p){c[++i]=a?be(t,p,n):$n(p,t,n)}),c}),Ld=Fr(function(e,t,n){_t(e,n,t)});function Ur(e,t){var n=$(e)?se:Na;return n(e,b(t,3))}function Nd(e,t,n,i){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=i?r:n,$(n)||(n=n==null?[]:[n]),Wa(e,t,n))}var Ud=Fr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Dd(e,t,n){var i=$(e)?mi:ua,a=arguments.length<3;return i(e,b(t,4),n,a,Ut)}function $d(e,t,n){var i=$(e)?Vu:ua,a=arguments.length<3;return i(e,b(t,4),n,a,Ca)}function Wd(e,t){var n=$(e)?kt:Pa;return n(e,Wr(b(t,3)))}function Md(e){var t=$(e)?Ia:kf;return t(e)}function Bd(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=W(t);var i=$(e)?uf:Of;return i(e,t)}function jd(e){var t=$(e)?cf:Nf;return t(e)}function qd(e){if(e==null)return 0;if(Fe(e))return Br(e)?an(e):e.length;var t=ye(e);return t==tt||t==nt?e.size:Ni(e).length}function Hd(e,t,n){var i=$(e)?vi:Uf;return n&&xe(e,t,n)&&(t=r),i(e,b(t,3))}var Gd=j(function(e,t){if(e==null)return[];var n=t.length;return n>1&&xe(e,t[0],t[1])?t=[]:n>2&&xe(t[0],t[1],t[2])&&(t=[t[0]]),Wa(e,me(t,1),[])}),Dr=Ic||function(){return ge.Date.now()};function zd(e,t){if(typeof t!="function")throw new Ge(v);return e=W(e),function(){if(--e<1)return t.apply(this,arguments)}}function Lo(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,wt(e,Me,r,r,r,r,t)}function No(e,t){var n;if(typeof t!="function")throw new Ge(v);return e=W(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ss=j(function(e,t,n){var i=Ie;if(n.length){var a=Lt(n,hn(ss));i|=We}return wt(e,i,t,n,a)}),Uo=j(function(e,t,n){var i=Ie|ht;if(n.length){var a=Lt(n,hn(Uo));i|=We}return wt(t,i,e,n,a)});function Do(e,t,n){t=n?r:t;var i=wt(e,$e,r,r,r,r,r,t);return i.placeholder=Do.placeholder,i}function $o(e,t,n){t=n?r:t;var i=wt(e,Pt,r,r,r,r,r,t);return i.placeholder=$o.placeholder,i}function Wo(e,t,n){var i,a,c,p,d,g,w=0,x=!1,A=!1,I=!0;if(typeof e!="function")throw new Ge(v);t=Ye(t)||0,ae(n)&&(x=!!n.leading,A="maxWait"in n,c=A?pe(Ye(n.maxWait)||0,t):c,I="trailing"in n?!!n.trailing:I);function F(ce){var at=i,Tt=a;return i=a=r,w=ce,p=e.apply(Tt,at),p}function O(ce){return w=ce,d=qn(H,t),x?F(ce):p}function B(ce){var at=ce-g,Tt=ce-w,il=t-at;return A?ve(il,c-Tt):il}function L(ce){var at=ce-g,Tt=ce-w;return g===r||at>=t||at<0||A&&Tt>=c}function H(){var ce=Dr();if(L(ce))return J(ce);d=qn(H,B(ce))}function J(ce){return d=r,I&&i?F(ce):(i=a=r,p)}function Le(){d!==r&&Ka(d),w=0,i=g=a=d=r}function Ae(){return d===r?p:J(Dr())}function Ne(){var ce=Dr(),at=L(ce);if(i=arguments,a=this,g=ce,at){if(d===r)return O(g);if(A)return Ka(d),d=qn(H,t),F(g)}return d===r&&(d=qn(H,t)),p}return Ne.cancel=Le,Ne.flush=Ae,Ne}var Jd=j(function(e,t){return Fa(e,1,t)}),Kd=j(function(e,t,n){return Fa(e,Ye(t)||0,n)});function Vd(e){return wt(e,Qt)}function $r(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ge(v);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],c=n.cache;if(c.has(a))return c.get(a);var p=e.apply(this,i);return n.cache=c.set(a,p)||c,p};return n.cache=new($r.Cache||yt),n}$r.Cache=yt;function Wr(e){if(typeof e!="function")throw new Ge(v);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 Yd(e){return No(2,e)}var Xd=Df(function(e,t){t=t.length==1&&$(t[0])?se(t[0],Re(b())):se(me(t,1),Re(b()));var n=t.length;return j(function(i){for(var a=-1,c=ve(i.length,n);++a<c;)i[a]=t[a].call(this,i[a]);return be(e,this,i)})}),as=j(function(e,t){var n=Lt(t,hn(as));return wt(e,We,r,t,n)}),Mo=j(function(e,t){var n=Lt(t,hn(Mo));return wt(e,bt,r,t,n)}),Zd=xt(function(e,t){return wt(e,Rt,r,r,r,t)});function Qd(e,t){if(typeof e!="function")throw new Ge(v);return t=t===r?t:W(t),j(e,t)}function eh(e,t){if(typeof e!="function")throw new Ge(v);return t=t==null?0:pe(W(t),0),j(function(n){var i=n[t],a=Wt(n,0,t);return i&&Ot(a,i),be(e,this,a)})}function th(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new Ge(v);return ae(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Wo(e,t,{leading:i,maxWait:t,trailing:a})}function nh(e){return Lo(e,1)}function rh(e,t){return as(Hi(t),e)}function ih(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function sh(e){return Je(e,V)}function ah(e,t){return t=typeof t=="function"?t:r,Je(e,V,t)}function oh(e){return Je(e,X|V)}function lh(e,t){return t=typeof t=="function"?t:r,Je(e,X|V,t)}function uh(e,t){return t==null||Ea(e,t,he(t))}function st(e,t){return e===t||e!==e&&t!==t}var ch=Rr(ki),fh=Rr(function(e,t){return e>=t}),Zt=ka(function(){return arguments}())?ka:function(e){return le(e)&&ee.call(e,"callee")&&!ya.call(e,"callee")},$=y.isArray,ph=Qs?Re(Qs):wf;function Fe(e){return e!=null&&Mr(e.length)&&!St(e)}function ue(e){return le(e)&&Fe(e)}function dh(e){return e===!0||e===!1||le(e)&&we(e)==Sn}var Mt=Ec||vs,hh=ea?Re(ea):xf;function gh(e){return le(e)&&e.nodeType===1&&!Hn(e)}function mh(e){if(e==null)return!0;if(Fe(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||Mt(e)||gn(e)||Zt(e)))return!e.length;var t=ye(e);if(t==tt||t==nt)return!e.size;if(jn(e))return!Ni(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function vh(e,t){return Wn(e,t)}function yh(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?Wn(e,t,r,n):!!i}function os(e){if(!le(e))return!1;var t=we(e);return t==Zn||t==Ml||typeof e.message=="string"&&typeof e.name=="string"&&!Hn(e)}function _h(e){return typeof e=="number"&&wa(e)}function St(e){if(!ae(e))return!1;var t=we(e);return t==Qn||t==Fs||t==Wl||t==jl}function Bo(e){return typeof e=="number"&&e==W(e)}function Mr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gt}function ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function le(e){return e!=null&&typeof e=="object"}var jo=ta?Re(ta):Sf;function wh(e,t){return e===t||Li(e,t,Xi(t))}function xh(e,t,n){return n=typeof n=="function"?n:r,Li(e,t,Xi(t),n)}function Ah(e){return qo(e)&&e!=+e}function Sh(e){if(ap(e))throw new D(m);return Oa(e)}function Ih(e){return e===null}function Th(e){return e==null}function qo(e){return typeof e=="number"||le(e)&&we(e)==Tn}function Hn(e){if(!le(e)||we(e)!=mt)return!1;var t=dr(e);if(t===null)return!0;var n=ee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ur.call(n)==wc}var ls=na?Re(na):If;function Eh(e){return Bo(e)&&e>=-gt&&e<=gt}var Ho=ra?Re(ra):Tf;function Br(e){return typeof e=="string"||!$(e)&&le(e)&&we(e)==Fn}function Oe(e){return typeof e=="symbol"||le(e)&&we(e)==er}var gn=ia?Re(ia):Ef;function Fh(e){return e===r}function Ch(e){return le(e)&&ye(e)==Cn}function Ph(e){return le(e)&&we(e)==Hl}var bh=Rr(Ui),Rh=Rr(function(e,t){return e<=t});function Go(e){if(!e)return[];if(Fe(e))return Br(e)?rt(e):Ee(e);if(Rn&&e[Rn])return lc(e[Rn]());var t=ye(e),n=t==tt?Si:t==nt?ar:mn;return n(e)}function It(e){if(!e)return e===0?e:0;if(e=Ye(e),e===je||e===-je){var t=e<0?-1:1;return t*G}return e===e?e:0}function W(e){var t=It(e),n=t%1;return t===t?n?t-n:t:0}function zo(e){return e?Kt(W(e),0,de):0}function Ye(e){if(typeof e=="number")return e;if(Oe(e))return Te;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ca(e);var n=fu.test(e);return n||du.test(e)?Gu(e.slice(2),n?2:8):cu.test(e)?Te:+e}function Jo(e){return ft(e,Ce(e))}function kh(e){return e?Kt(W(e),-gt,gt):e===0?e:0}function Q(e){return e==null?"":ke(e)}var Oh=pn(function(e,t){if(jn(t)||Fe(t)){ft(t,he(t),e);return}for(var n in t)ee.call(t,n)&&Un(e,n,t[n])}),Ko=pn(function(e,t){ft(t,Ce(t),e)}),jr=pn(function(e,t,n,i){ft(t,Ce(t),e,i)}),Lh=pn(function(e,t,n,i){ft(t,he(t),e,i)}),Nh=xt(Pi);function Uh(e,t){var n=fn(e);return t==null?n:Ta(n,t)}var Dh=j(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&xe(t[0],t[1],a)&&(i=1);++n<i;)for(var c=t[n],p=Ce(c),d=-1,g=p.length;++d<g;){var w=p[d],x=e[w];(x===r||st(x,ln[w])&&!ee.call(e,w))&&(e[w]=c[w])}return e}),$h=j(function(e){return e.push(r,co),be(Vo,r,e)});function Wh(e,t){return aa(e,b(t,3),ct)}function Mh(e,t){return aa(e,b(t,3),Ri)}function Bh(e,t){return e==null?e:bi(e,b(t,3),Ce)}function jh(e,t){return e==null?e:ba(e,b(t,3),Ce)}function qh(e,t){return e&&ct(e,b(t,3))}function Hh(e,t){return e&&Ri(e,b(t,3))}function Gh(e){return e==null?[]:Sr(e,he(e))}function zh(e){return e==null?[]:Sr(e,Ce(e))}function us(e,t,n){var i=e==null?r:Vt(e,t);return i===r?n:i}function Jh(e,t){return e!=null&&ho(e,t,mf)}function cs(e,t){return e!=null&&ho(e,t,vf)}var Kh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=cr.call(t)),e[t]=n},ps(Pe)),Vh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=cr.call(t)),ee.call(e,t)?e[t].push(n):e[t]=[n]},b),Yh=j($n);function he(e){return Fe(e)?Sa(e):Ni(e)}function Ce(e){return Fe(e)?Sa(e,!0):Ff(e)}function Xh(e,t){var n={};return t=b(t,3),ct(e,function(i,a,c){_t(n,t(i,a,c),i)}),n}function Zh(e,t){var n={};return t=b(t,3),ct(e,function(i,a,c){_t(n,a,t(i,a,c))}),n}var Qh=pn(function(e,t,n){Ir(e,t,n)}),Vo=pn(function(e,t,n,i){Ir(e,t,n,i)}),eg=xt(function(e,t){var n={};if(e==null)return n;var i=!1;t=se(t,function(c){return c=$t(c,e),i||(i=c.length>1),c}),ft(e,Vi(e),n),i&&(n=Je(n,X|U|V,Kf));for(var a=t.length;a--;)Bi(n,t[a]);return n});function tg(e,t){return Yo(e,Wr(b(t)))}var ng=xt(function(e,t){return e==null?{}:Pf(e,t)});function Yo(e,t){if(e==null)return{};var n=se(Vi(e),function(i){return[i]});return t=b(t),Ma(e,n,function(i,a){return t(i,a[0])})}function rg(e,t,n){t=$t(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var c=e==null?r:e[pt(t[i])];c===r&&(i=a,c=n),e=St(c)?c.call(e):c}return e}function ig(e,t,n){return e==null?e:Mn(e,t,n)}function sg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Mn(e,t,n,i)}var Xo=lo(he),Zo=lo(Ce);function ag(e,t,n){var i=$(e),a=i||Mt(e)||gn(e);if(t=b(t,4),n==null){var c=e&&e.constructor;a?n=i?new c:[]:ae(e)?n=St(c)?fn(dr(e)):{}:n={}}return(a?He:ct)(e,function(p,d,g){return t(n,p,d,g)}),n}function og(e,t){return e==null?!0:Bi(e,t)}function lg(e,t,n){return e==null?e:Ga(e,t,Hi(n))}function ug(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ga(e,t,Hi(n),i)}function mn(e){return e==null?[]:Ai(e,he(e))}function cg(e){return e==null?[]:Ai(e,Ce(e))}function fg(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Ye(n),n=n===n?n:0),t!==r&&(t=Ye(t),t=t===t?t:0),Kt(Ye(e),t,n)}function pg(e,t,n){return t=It(t),n===r?(n=t,t=0):n=It(n),e=Ye(e),yf(e,t,n)}function dg(e,t,n){if(n&&typeof n!="boolean"&&xe(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=It(e),t===r?(t=e,e=0):t=It(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=xa();return ve(e+a*(t-e+Hu("1e-"+((a+"").length-1))),t)}return $i(e,t)}var hg=dn(function(e,t,n){return t=t.toLowerCase(),e+(n?Qo(t):t)});function Qo(e){return fs(Q(e).toLowerCase())}function el(e){return e=Q(e),e&&e.replace(gu,rc).replace(Lu,"")}function gg(e,t,n){e=Q(e),t=ke(t);var i=e.length;n=n===r?i:Kt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function mg(e){return e=Q(e),e&&Vl.test(e)?e.replace(bs,ic):e}function vg(e){return e=Q(e),e&&tu.test(e)?e.replace(ai,"\\$&"):e}var yg=dn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_g=dn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wg=no("toLowerCase");function xg(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return br(vr(a),n)+e+br(mr(a),n)}function Ag(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?e+br(t-i,n):e}function Sg(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?br(t-i,n)+e:e}function Ig(e,t,n){return n||t==null?t=0:t&&(t=+t),bc(Q(e).replace(oi,""),t||0)}function Tg(e,t,n){return(n?xe(e,t,n):t===r)?t=1:t=W(t),Wi(Q(e),t)}function Eg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Fg=dn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Cg(e,t,n){return n&&typeof n!="number"&&xe(e,t,n)&&(t=n=r),n=n===r?de:n>>>0,n?(e=Q(e),e&&(typeof t=="string"||t!=null&&!ls(t))&&(t=ke(t),!t&&sn(e))?Wt(rt(e),0,n):e.split(t,n)):[]}var Pg=dn(function(e,t,n){return e+(n?" ":"")+fs(t)});function bg(e,t,n){return e=Q(e),n=n==null?0:Kt(W(n),0,e.length),t=ke(t),e.slice(n,n+t.length)==t}function Rg(e,t,n){var i=u.templateSettings;n&&xe(e,t,n)&&(t=r),e=Q(e),t=jr({},t,i,uo);var a=jr({},t.imports,i.imports,uo),c=he(a),p=Ai(a,c),d,g,w=0,x=t.interpolate||tr,A="__p += '",I=Ii((t.escape||tr).source+"|"+x.source+"|"+(x===Rs?uu:tr).source+"|"+(t.evaluate||tr).source+"|$","g"),F="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wu+"]")+`
|
|
788
|
+
`;e.replace(I,function(L,H,J,Le,Ae,Ne){return J||(J=Le),A+=e.slice(w,Ne).replace(mu,sc),H&&(d=!0,A+=`' +
|
|
789
|
+
__e(`+H+`) +
|
|
790
|
+
'`),Ae&&(g=!0,A+=`';
|
|
436
791
|
`+Ae+`;
|
|
437
|
-
__p += '`),
|
|
438
|
-
((__t = (`+
|
|
439
|
-
'`),w=
|
|
440
|
-
`;var
|
|
441
|
-
`+
|
|
792
|
+
__p += '`),J&&(A+=`' +
|
|
793
|
+
((__t = (`+J+`)) == null ? '' : __t) +
|
|
794
|
+
'`),w=Ne+L.length,L}),A+=`';
|
|
795
|
+
`;var O=ee.call(t,"variable")&&t.variable;if(!O)A=`with (obj) {
|
|
796
|
+
`+A+`
|
|
442
797
|
}
|
|
443
|
-
`;else if(
|
|
444
|
-
`+(
|
|
798
|
+
`;else if(ou.test(O))throw new D(E);A=(g?A.replace(Gl,""):A).replace(zl,"$1").replace(Jl,"$1;"),A="function("+(O||"obj")+`) {
|
|
799
|
+
`+(O?"":`obj || (obj = {});
|
|
445
800
|
`)+"var __t, __p = ''"+(d?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
|
|
446
801
|
function print() { __p += __j.call(arguments, '') }
|
|
447
802
|
`:`;
|
|
448
|
-
`)+
|
|
449
|
-
}`;var j=Zo(function(){return Z(c,T+"return "+S).apply(r,f)});if(j.source=S,ns(j))throw j;return j}function Tg(e){return Q(e).toLowerCase()}function bg(e){return Q(e).toUpperCase()}function Cg(e,t,n){if(e=Q(e),e&&(n||t===r))return aa(e);if(!e||!(t=ke(t)))return e;var i=nt(e),a=nt(t),c=oa(i,a),f=la(i,a)+1;return Wt(i,c,f).join("")}function Pg(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ca(e)+1);if(!e||!(t=ke(t)))return e;var i=nt(e),a=la(i,nt(t))+1;return Wt(i,0,a).join("")}function Rg(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(ni,"");if(!e||!(t=ke(t)))return e;var i=nt(e),a=oa(i,nt(t));return Wt(i,a).join("")}function Og(e,t){var n=ws,i=xs;if(ae(t)){var a="separator"in t?t.separator:a;n="length"in t?W(t.length):n,i="omission"in t?ke(t.omission):i}e=Q(e);var c=e.length;if(tn(e)){var f=nt(e);c=f.length}if(n>=c)return e;var d=n-nn(i);if(d<1)return i;var g=f?Wt(f,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(f&&(d+=g.length-d),rs(a)){if(e.slice(d).search(a)){var w,x=g;for(a.global||(a=_i(a.source,Q(bs.exec(a))+"g")),a.lastIndex=0;w=a.exec(x);)var S=w.index;g=g.slice(0,S===r?d:S)}}else if(e.indexOf(ke(a),d)!=d){var I=g.lastIndexOf(a);I>-1&&(g=g.slice(0,I))}return g+i}function Lg(e){return e=Q(e),e&&ql.test(e)?e.replace(Fs,oc):e}var kg=cn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),as=Za("toUpperCase");function Xo(e,t,n){return e=Q(e),t=n?r:t,t===r?nc(e)?cc(e):zu(e):e.match(t)||[]}var Zo=q(function(e,t){try{return Oe(e,r,t)}catch(n){return ns(n)?n:new U(n)}}),Ng=wt(function(e,t){return qe(t,function(n){n=ft(n),yt(e,n,es(e[n],e))}),e});function Ug(e){var t=e==null?0:e.length,n=C();return e=t?se(e,function(i){if(typeof i[1]!="function")throw new He(v);return[n(i[0]),i[1]]}):[],q(function(i){for(var a=-1;++a<t;){var c=e[a];if(Oe(c[0],this,i))return Oe(c[1],this,i)}})}function Dg(e){return lf(Je(e,X))}function os(e){return function(){return e}}function Wg(e,t){return e==null||e!==e?t:e}var $g=eo(),Mg=eo(!0);function Ce(e){return e}function ls(e){return Pa(typeof e=="function"?e:Je(e,X))}function Bg(e){return Oa(Je(e,X))}function jg(e,t){return La(e,Je(t,X))}var qg=q(function(e,t){return function(n){return Nn(n,e,t)}}),Hg=q(function(e,t){return function(n){return Nn(e,n,t)}});function us(e,t,n){var i=he(t),a=wr(t,i);n==null&&!(ae(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=wr(t,he(t)));var c=!(ae(n)&&"chain"in n)||!!n.chain,f=St(e);return qe(a,function(d){var g=t[d];e[d]=g,f&&(e.prototype[d]=function(){var w=this.__chain__;if(c||w){var x=e(this.__wrapped__),S=x.__actions__=Ee(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),x.__chain__=w,x}return g.apply(e,Ot([this.value()],arguments))})}),e}function Gg(){return ge._===this&&(ge._=mc),this}function cs(){}function Jg(e){return e=W(e),q(function(t){return ka(t,e)})}var zg=Bi(se),Kg=Bi(ta),Vg=Bi(pi);function Qo(e){return Ki(e)?di(ft(e)):Ff(e)}function Yg(e){return function(t){return e==null?r:zt(e,t)}}var Xg=no(),Zg=no(!0);function fs(){return[]}function ps(){return!1}function Qg(){return{}}function em(){return""}function tm(){return!0}function nm(e,t){if(e=W(e),e<1||e>de)return[];var n=ve,i=ye(e,ve);t=C(t),e-=ve;for(var a=mi(i,t);++n<e;)t(n);return a}function rm(e){return D(e)?se(e,ft):Ne(e)?[e]:Ee(_o(Q(e)))}function im(e){var t=++hc;return Q(e)+t}var sm=Er(function(e,t){return e+t},0),am=ji("ceil"),om=Er(function(e,t){return e/t},1),lm=ji("floor");function um(e){return e&&e.length?_r(e,Ce,Ti):r}function cm(e,t){return e&&e.length?_r(e,C(t,2),Ti):r}function fm(e){return ia(e,Ce)}function pm(e,t){return ia(e,C(t,2))}function dm(e){return e&&e.length?_r(e,Ce,Ri):r}function hm(e,t){return e&&e.length?_r(e,C(t,2),Ri):r}var gm=Er(function(e,t){return e*t},1),mm=ji("round"),vm=Er(function(e,t){return e-t},0);function ym(e){return e&&e.length?gi(e,Ce):0}function _m(e,t){return e&&e.length?gi(e,C(t,2)):0}return u.after=Bd,u.ary=Po,u.assign=bh,u.assignIn=Ho,u.assignInWith=$r,u.assignWith=Ch,u.at=Ph,u.before=Ro,u.bind=es,u.bindAll=Ng,u.bindKey=Oo,u.castArray=Qd,u.chain=To,u.chunk=lp,u.compact=up,u.concat=cp,u.cond=Ug,u.conforms=Dg,u.constant=os,u.countBy=yd,u.create=Rh,u.curry=Lo,u.curryRight=ko,u.debounce=No,u.defaults=Oh,u.defaultsDeep=Lh,u.defer=jd,u.delay=qd,u.difference=fp,u.differenceBy=pp,u.differenceWith=dp,u.drop=hp,u.dropRight=gp,u.dropRightWhile=mp,u.dropWhile=vp,u.fill=yp,u.filter=wd,u.flatMap=Ad,u.flatMapDeep=Id,u.flatMapDepth=Fd,u.flatten=Ao,u.flattenDeep=_p,u.flattenDepth=wp,u.flip=Hd,u.flow=$g,u.flowRight=Mg,u.fromPairs=xp,u.functions=Mh,u.functionsIn=Bh,u.groupBy=Ed,u.initial=Ap,u.intersection=Ip,u.intersectionBy=Fp,u.intersectionWith=Ep,u.invert=qh,u.invertBy=Hh,u.invokeMap=bd,u.iteratee=ls,u.keyBy=Cd,u.keys=he,u.keysIn=be,u.map=Lr,u.mapKeys=Jh,u.mapValues=zh,u.matches=Bg,u.matchesProperty=jg,u.memoize=Nr,u.merge=Kh,u.mergeWith=Go,u.method=qg,u.methodOf=Hg,u.mixin=us,u.negate=Ur,u.nthArg=Jg,u.omit=Vh,u.omitBy=Yh,u.once=Gd,u.orderBy=Pd,u.over=zg,u.overArgs=Jd,u.overEvery=Kg,u.overSome=Vg,u.partial=ts,u.partialRight=Uo,u.partition=Rd,u.pick=Xh,u.pickBy=Jo,u.property=Qo,u.propertyOf=Yg,u.pull=Pp,u.pullAll=Fo,u.pullAllBy=Rp,u.pullAllWith=Op,u.pullAt=Lp,u.range=Xg,u.rangeRight=Zg,u.rearg=zd,u.reject=kd,u.remove=kp,u.rest=Kd,u.reverse=Zi,u.sampleSize=Ud,u.set=Qh,u.setWith=eg,u.shuffle=Dd,u.slice=Np,u.sortBy=Md,u.sortedUniq=jp,u.sortedUniqBy=qp,u.split=Ag,u.spread=Vd,u.tail=Hp,u.take=Gp,u.takeRight=Jp,u.takeRightWhile=zp,u.takeWhile=Kp,u.tap=ud,u.throttle=Yd,u.thru=Or,u.toArray=Bo,u.toPairs=zo,u.toPairsIn=Ko,u.toPath=rm,u.toPlainObject=qo,u.transform=tg,u.unary=Xd,u.union=Vp,u.unionBy=Yp,u.unionWith=Xp,u.uniq=Zp,u.uniqBy=Qp,u.uniqWith=ed,u.unset=ng,u.unzip=Qi,u.unzipWith=Eo,u.update=rg,u.updateWith=ig,u.values=dn,u.valuesIn=sg,u.without=td,u.words=Xo,u.wrap=Zd,u.xor=nd,u.xorBy=rd,u.xorWith=id,u.zip=sd,u.zipObject=ad,u.zipObjectDeep=od,u.zipWith=ld,u.entries=zo,u.entriesIn=Ko,u.extend=Ho,u.extendWith=$r,us(u,u),u.add=sm,u.attempt=Zo,u.camelCase=ug,u.capitalize=Vo,u.ceil=am,u.clamp=ag,u.clone=eh,u.cloneDeep=nh,u.cloneDeepWith=rh,u.cloneWith=th,u.conformsTo=ih,u.deburr=Yo,u.defaultTo=Wg,u.divide=om,u.endsWith=cg,u.eq=it,u.escape=fg,u.escapeRegExp=pg,u.every=_d,u.find=xd,u.findIndex=xo,u.findKey=kh,u.findLast=Sd,u.findLastIndex=So,u.findLastKey=Nh,u.floor=lm,u.forEach=bo,u.forEachRight=Co,u.forIn=Uh,u.forInRight=Dh,u.forOwn=Wh,u.forOwnRight=$h,u.get=is,u.gt=sh,u.gte=ah,u.has=jh,u.hasIn=ss,u.head=Io,u.identity=Ce,u.includes=Td,u.indexOf=Sp,u.inRange=og,u.invoke=Gh,u.isArguments=Yt,u.isArray=D,u.isArrayBuffer=oh,u.isArrayLike=Te,u.isArrayLikeObject=ue,u.isBoolean=lh,u.isBuffer=$t,u.isDate=uh,u.isElement=ch,u.isEmpty=fh,u.isEqual=ph,u.isEqualWith=dh,u.isError=ns,u.isFinite=hh,u.isFunction=St,u.isInteger=Do,u.isLength=Dr,u.isMap=Wo,u.isMatch=gh,u.isMatchWith=mh,u.isNaN=vh,u.isNative=yh,u.isNil=wh,u.isNull=_h,u.isNumber=$o,u.isObject=ae,u.isObjectLike=oe,u.isPlainObject=Bn,u.isRegExp=rs,u.isSafeInteger=xh,u.isSet=Mo,u.isString=Wr,u.isSymbol=Ne,u.isTypedArray=pn,u.isUndefined=Sh,u.isWeakMap=Ah,u.isWeakSet=Ih,u.join=Tp,u.kebabCase=dg,u.last=Ke,u.lastIndexOf=bp,u.lowerCase=hg,u.lowerFirst=gg,u.lt=Fh,u.lte=Eh,u.max=um,u.maxBy=cm,u.mean=fm,u.meanBy=pm,u.min=dm,u.minBy=hm,u.stubArray=fs,u.stubFalse=ps,u.stubObject=Qg,u.stubString=em,u.stubTrue=tm,u.multiply=gm,u.nth=Cp,u.noConflict=Gg,u.noop=cs,u.now=kr,u.pad=mg,u.padEnd=vg,u.padStart=yg,u.parseInt=_g,u.random=lg,u.reduce=Od,u.reduceRight=Ld,u.repeat=wg,u.replace=xg,u.result=Zh,u.round=mm,u.runInContext=h,u.sample=Nd,u.size=Wd,u.snakeCase=Sg,u.some=$d,u.sortedIndex=Up,u.sortedIndexBy=Dp,u.sortedIndexOf=Wp,u.sortedLastIndex=$p,u.sortedLastIndexBy=Mp,u.sortedLastIndexOf=Bp,u.startCase=Ig,u.startsWith=Fg,u.subtract=vm,u.sum=ym,u.sumBy=_m,u.template=Eg,u.times=nm,u.toFinite=At,u.toInteger=W,u.toLength=jo,u.toLower=Tg,u.toNumber=Ve,u.toSafeInteger=Th,u.toString=Q,u.toUpper=bg,u.trim=Cg,u.trimEnd=Pg,u.trimStart=Rg,u.truncate=Og,u.unescape=Lg,u.uniqueId=im,u.upperCase=kg,u.upperFirst=as,u.each=bo,u.eachRight=Co,u.first=Io,us(u,function(){var e={};return ut(u,function(t,n){ee.call(u.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),u.VERSION=l,qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){u[e].placeholder=u}),qe(["drop","take"],function(e,t){J.prototype[e]=function(n){n=n===r?1:pe(W(n),0);var i=this.__filtered__&&!t?new J(this):this.clone();return i.__filtered__?i.__takeCount__=ye(n,i.__takeCount__):i.__views__.push({size:ye(n,ve),type:e+(i.__dir__<0?"Right":"")}),i},J.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),qe(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==Pe||n==Ss;J.prototype[e]=function(a){var c=this.clone();return c.__iteratees__.push({iteratee:C(a,3),type:n}),c.__filtered__=c.__filtered__||i,c}}),qe(["head","last"],function(e,t){var n="take"+(t?"Right":"");J.prototype[e]=function(){return this[n](1).value()[0]}}),qe(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");J.prototype[e]=function(){return this.__filtered__?new J(this):this[n](1)}}),J.prototype.compact=function(){return this.filter(Ce)},J.prototype.find=function(e){return this.filter(e).head()},J.prototype.findLast=function(e){return this.reverse().find(e)},J.prototype.invokeMap=q(function(e,t){return typeof e=="function"?new J(this):this.map(function(n){return Nn(n,e,t)})}),J.prototype.reject=function(e){return this.filter(Ur(C(e)))},J.prototype.slice=function(e,t){e=W(e);var n=this;return n.__filtered__&&(e>0||t<0)?new J(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=W(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},J.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},J.prototype.toArray=function(){return this.take(ve)},ut(J.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=u[i?"take"+(t=="last"?"Right":""):t],c=i||/^find/.test(t);a&&(u.prototype[t]=function(){var f=this.__wrapped__,d=i?[1]:arguments,g=f instanceof J,w=d[0],x=g||D(f),S=function(G){var z=a.apply(u,Ot([G],d));return i&&I?z[0]:z};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var I=this.__chain__,T=!!this.__actions__.length,R=c&&!I,j=g&&!T;if(!c&&x){f=j?f:new J(this);var O=e.apply(f,d);return O.__actions__.push({func:Or,args:[S],thisArg:r}),new Ge(O,I)}return R&&j?e.apply(this,d):(O=this.thru(S),R?i?O.value()[0]:O.value():O)})}),qe(["pop","push","shift","sort","splice","unshift"],function(e){var t=ir[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var c=this.value();return t.apply(D(c)?c:[],a)}return this[n](function(f){return t.apply(D(f)?f:[],a)})}}),ut(J.prototype,function(e,t){var n=u[t];if(n){var i=n.name+"";ee.call(on,i)||(on[i]=[]),on[i].push({name:t,func:n})}}),on[Fr(r,dt).name]=[{name:"wrapper",func:r}],J.prototype.clone=Oc,J.prototype.reverse=Lc,J.prototype.value=kc,u.prototype.at=cd,u.prototype.chain=fd,u.prototype.commit=pd,u.prototype.next=dd,u.prototype.plant=gd,u.prototype.reverse=md,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=vd,u.prototype.first=u.prototype.head,bn&&(u.prototype[bn]=hd),u},rn=fc();jt?((jt.exports=rn)._=rn,li._=rn):ge._=rn}).call(Uy)}(Hn,Hn.exports)),Hn.exports}var Wy=Dy();const hs=o=>{const s=Wy.startCase(o).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},$y=({data:o,universalIdentifier:s=We.v4()})=>`import { defineObject } from 'twenty-sdk';
|
|
803
|
+
`)+A+`return __p
|
|
804
|
+
}`;var B=nl(function(){return Z(c,F+"return "+A).apply(r,p)});if(B.source=A,os(B))throw B;return B}function kg(e){return Q(e).toLowerCase()}function Og(e){return Q(e).toUpperCase()}function Lg(e,t,n){if(e=Q(e),e&&(n||t===r))return ca(e);if(!e||!(t=ke(t)))return e;var i=rt(e),a=rt(t),c=fa(i,a),p=pa(i,a)+1;return Wt(i,c,p).join("")}function Ng(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ha(e)+1);if(!e||!(t=ke(t)))return e;var i=rt(e),a=pa(i,rt(t))+1;return Wt(i,0,a).join("")}function Ug(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(oi,"");if(!e||!(t=ke(t)))return e;var i=rt(e),a=fa(i,rt(t));return Wt(i,a).join("")}function Dg(e,t){var n=Vn,i=Yr;if(ae(t)){var a="separator"in t?t.separator:a;n="length"in t?W(t.length):n,i="omission"in t?ke(t.omission):i}e=Q(e);var c=e.length;if(sn(e)){var p=rt(e);c=p.length}if(n>=c)return e;var d=n-an(i);if(d<1)return i;var g=p?Wt(p,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(p&&(d+=g.length-d),ls(a)){if(e.slice(d).search(a)){var w,x=g;for(a.global||(a=Ii(a.source,Q(ks.exec(a))+"g")),a.lastIndex=0;w=a.exec(x);)var A=w.index;g=g.slice(0,A===r?d:A)}}else if(e.indexOf(ke(a),d)!=d){var I=g.lastIndexOf(a);I>-1&&(g=g.slice(0,I))}return g+i}function $g(e){return e=Q(e),e&&Kl.test(e)?e.replace(Ps,pc):e}var Wg=dn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),fs=no("toUpperCase");function tl(e,t,n){return e=Q(e),t=n?r:t,t===r?oc(e)?gc(e):Zu(e):e.match(t)||[]}var nl=j(function(e,t){try{return be(e,r,t)}catch(n){return os(n)?n:new D(n)}}),Mg=xt(function(e,t){return He(t,function(n){n=pt(n),_t(e,n,ss(e[n],e))}),e});function Bg(e){var t=e==null?0:e.length,n=b();return e=t?se(e,function(i){if(typeof i[1]!="function")throw new Ge(v);return[n(i[0]),i[1]]}):[],j(function(i){for(var a=-1;++a<t;){var c=e[a];if(be(c[0],this,i))return be(c[1],this,i)}})}function jg(e){return df(Je(e,X))}function ps(e){return function(){return e}}function qg(e,t){return e==null||e!==e?t:e}var Hg=io(),Gg=io(!0);function Pe(e){return e}function ds(e){return La(typeof e=="function"?e:Je(e,X))}function zg(e){return Ua(Je(e,X))}function Jg(e,t){return Da(e,Je(t,X))}var Kg=j(function(e,t){return function(n){return $n(n,e,t)}}),Vg=j(function(e,t){return function(n){return $n(e,n,t)}});function hs(e,t,n){var i=he(t),a=Sr(t,i);n==null&&!(ae(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=Sr(t,he(t)));var c=!(ae(n)&&"chain"in n)||!!n.chain,p=St(e);return He(a,function(d){var g=t[d];e[d]=g,p&&(e.prototype[d]=function(){var w=this.__chain__;if(c||w){var x=e(this.__wrapped__),A=x.__actions__=Ee(this.__actions__);return A.push({func:g,args:arguments,thisArg:e}),x.__chain__=w,x}return g.apply(e,Ot([this.value()],arguments))})}),e}function Yg(){return ge._===this&&(ge._=xc),this}function gs(){}function Xg(e){return e=W(e),j(function(t){return $a(t,e)})}var Zg=zi(se),Qg=zi(sa),em=zi(vi);function rl(e){return Qi(e)?yi(pt(e)):bf(e)}function tm(e){return function(t){return e==null?r:Vt(e,t)}}var nm=ao(),rm=ao(!0);function ms(){return[]}function vs(){return!1}function im(){return{}}function sm(){return""}function am(){return!0}function om(e,t){if(e=W(e),e<1||e>gt)return[];var n=de,i=ve(e,de);t=b(t),e-=de;for(var a=xi(i,t);++n<e;)t(n);return a}function lm(e){return $(e)?se(e,pt):Oe(e)?[e]:Ee(So(Q(e)))}function um(e){var t=++_c;return Q(e)+t}var cm=Pr(function(e,t){return e+t},0),fm=Ji("ceil"),pm=Pr(function(e,t){return e/t},1),dm=Ji("floor");function hm(e){return e&&e.length?Ar(e,Pe,ki):r}function gm(e,t){return e&&e.length?Ar(e,b(t,2),ki):r}function mm(e){return la(e,Pe)}function vm(e,t){return la(e,b(t,2))}function ym(e){return e&&e.length?Ar(e,Pe,Ui):r}function _m(e,t){return e&&e.length?Ar(e,b(t,2),Ui):r}var wm=Pr(function(e,t){return e*t},1),xm=Ji("round"),Am=Pr(function(e,t){return e-t},0);function Sm(e){return e&&e.length?wi(e,Pe):0}function Im(e,t){return e&&e.length?wi(e,b(t,2)):0}return u.after=zd,u.ary=Lo,u.assign=Oh,u.assignIn=Ko,u.assignInWith=jr,u.assignWith=Lh,u.at=Nh,u.before=No,u.bind=ss,u.bindAll=Mg,u.bindKey=Uo,u.castArray=ih,u.chain=Ro,u.chunk=dp,u.compact=hp,u.concat=gp,u.cond=Bg,u.conforms=jg,u.constant=ps,u.countBy=Sd,u.create=Uh,u.curry=Do,u.curryRight=$o,u.debounce=Wo,u.defaults=Dh,u.defaultsDeep=$h,u.defer=Jd,u.delay=Kd,u.difference=mp,u.differenceBy=vp,u.differenceWith=yp,u.drop=_p,u.dropRight=wp,u.dropRightWhile=xp,u.dropWhile=Ap,u.fill=Sp,u.filter=Td,u.flatMap=Cd,u.flatMapDeep=Pd,u.flatMapDepth=bd,u.flatten=Fo,u.flattenDeep=Ip,u.flattenDepth=Tp,u.flip=Vd,u.flow=Hg,u.flowRight=Gg,u.fromPairs=Ep,u.functions=Gh,u.functionsIn=zh,u.groupBy=Rd,u.initial=Cp,u.intersection=Pp,u.intersectionBy=bp,u.intersectionWith=Rp,u.invert=Kh,u.invertBy=Vh,u.invokeMap=Od,u.iteratee=ds,u.keyBy=Ld,u.keys=he,u.keysIn=Ce,u.map=Ur,u.mapKeys=Xh,u.mapValues=Zh,u.matches=zg,u.matchesProperty=Jg,u.memoize=$r,u.merge=Qh,u.mergeWith=Vo,u.method=Kg,u.methodOf=Vg,u.mixin=hs,u.negate=Wr,u.nthArg=Xg,u.omit=eg,u.omitBy=tg,u.once=Yd,u.orderBy=Nd,u.over=Zg,u.overArgs=Xd,u.overEvery=Qg,u.overSome=em,u.partial=as,u.partialRight=Mo,u.partition=Ud,u.pick=ng,u.pickBy=Yo,u.property=rl,u.propertyOf=tm,u.pull=Np,u.pullAll=Po,u.pullAllBy=Up,u.pullAllWith=Dp,u.pullAt=$p,u.range=nm,u.rangeRight=rm,u.rearg=Zd,u.reject=Wd,u.remove=Wp,u.rest=Qd,u.reverse=rs,u.sampleSize=Bd,u.set=ig,u.setWith=sg,u.shuffle=jd,u.slice=Mp,u.sortBy=Gd,u.sortedUniq=Jp,u.sortedUniqBy=Kp,u.split=Cg,u.spread=eh,u.tail=Vp,u.take=Yp,u.takeRight=Xp,u.takeRightWhile=Zp,u.takeWhile=Qp,u.tap=hd,u.throttle=th,u.thru=Nr,u.toArray=Go,u.toPairs=Xo,u.toPairsIn=Zo,u.toPath=lm,u.toPlainObject=Jo,u.transform=ag,u.unary=nh,u.union=ed,u.unionBy=td,u.unionWith=nd,u.uniq=rd,u.uniqBy=id,u.uniqWith=sd,u.unset=og,u.unzip=is,u.unzipWith=bo,u.update=lg,u.updateWith=ug,u.values=mn,u.valuesIn=cg,u.without=ad,u.words=tl,u.wrap=rh,u.xor=od,u.xorBy=ld,u.xorWith=ud,u.zip=cd,u.zipObject=fd,u.zipObjectDeep=pd,u.zipWith=dd,u.entries=Xo,u.entriesIn=Zo,u.extend=Ko,u.extendWith=jr,hs(u,u),u.add=cm,u.attempt=nl,u.camelCase=hg,u.capitalize=Qo,u.ceil=fm,u.clamp=fg,u.clone=sh,u.cloneDeep=oh,u.cloneDeepWith=lh,u.cloneWith=ah,u.conformsTo=uh,u.deburr=el,u.defaultTo=qg,u.divide=pm,u.endsWith=gg,u.eq=st,u.escape=mg,u.escapeRegExp=vg,u.every=Id,u.find=Ed,u.findIndex=To,u.findKey=Wh,u.findLast=Fd,u.findLastIndex=Eo,u.findLastKey=Mh,u.floor=dm,u.forEach=ko,u.forEachRight=Oo,u.forIn=Bh,u.forInRight=jh,u.forOwn=qh,u.forOwnRight=Hh,u.get=us,u.gt=ch,u.gte=fh,u.has=Jh,u.hasIn=cs,u.head=Co,u.identity=Pe,u.includes=kd,u.indexOf=Fp,u.inRange=pg,u.invoke=Yh,u.isArguments=Zt,u.isArray=$,u.isArrayBuffer=ph,u.isArrayLike=Fe,u.isArrayLikeObject=ue,u.isBoolean=dh,u.isBuffer=Mt,u.isDate=hh,u.isElement=gh,u.isEmpty=mh,u.isEqual=vh,u.isEqualWith=yh,u.isError=os,u.isFinite=_h,u.isFunction=St,u.isInteger=Bo,u.isLength=Mr,u.isMap=jo,u.isMatch=wh,u.isMatchWith=xh,u.isNaN=Ah,u.isNative=Sh,u.isNil=Th,u.isNull=Ih,u.isNumber=qo,u.isObject=ae,u.isObjectLike=le,u.isPlainObject=Hn,u.isRegExp=ls,u.isSafeInteger=Eh,u.isSet=Ho,u.isString=Br,u.isSymbol=Oe,u.isTypedArray=gn,u.isUndefined=Fh,u.isWeakMap=Ch,u.isWeakSet=Ph,u.join=kp,u.kebabCase=yg,u.last=Ve,u.lastIndexOf=Op,u.lowerCase=_g,u.lowerFirst=wg,u.lt=bh,u.lte=Rh,u.max=hm,u.maxBy=gm,u.mean=mm,u.meanBy=vm,u.min=ym,u.minBy=_m,u.stubArray=ms,u.stubFalse=vs,u.stubObject=im,u.stubString=sm,u.stubTrue=am,u.multiply=wm,u.nth=Lp,u.noConflict=Yg,u.noop=gs,u.now=Dr,u.pad=xg,u.padEnd=Ag,u.padStart=Sg,u.parseInt=Ig,u.random=dg,u.reduce=Dd,u.reduceRight=$d,u.repeat=Tg,u.replace=Eg,u.result=rg,u.round=xm,u.runInContext=h,u.sample=Md,u.size=qd,u.snakeCase=Fg,u.some=Hd,u.sortedIndex=Bp,u.sortedIndexBy=jp,u.sortedIndexOf=qp,u.sortedLastIndex=Hp,u.sortedLastIndexBy=Gp,u.sortedLastIndexOf=zp,u.startCase=Pg,u.startsWith=bg,u.subtract=Am,u.sum=Sm,u.sumBy=Im,u.template=Rg,u.times=om,u.toFinite=It,u.toInteger=W,u.toLength=zo,u.toLower=kg,u.toNumber=Ye,u.toSafeInteger=kh,u.toString=Q,u.toUpper=Og,u.trim=Lg,u.trimEnd=Ng,u.trimStart=Ug,u.truncate=Dg,u.unescape=$g,u.uniqueId=um,u.upperCase=Wg,u.upperFirst=fs,u.each=ko,u.eachRight=Oo,u.first=Co,hs(u,function(){var e={};return ct(u,function(t,n){ee.call(u.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),u.VERSION=l,He(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){u[e].placeholder=u}),He(["drop","take"],function(e,t){z.prototype[e]=function(n){n=n===r?1:pe(W(n),0);var i=this.__filtered__&&!t?new z(this):this.clone();return i.__filtered__?i.__takeCount__=ve(n,i.__takeCount__):i.__views__.push({size:ve(n,de),type:e+(i.__dir__<0?"Right":"")}),i},z.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),He(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==oe||n==Be;z.prototype[e]=function(a){var c=this.clone();return c.__iteratees__.push({iteratee:b(a,3),type:n}),c.__filtered__=c.__filtered__||i,c}}),He(["head","last"],function(e,t){var n="take"+(t?"Right":"");z.prototype[e]=function(){return this[n](1).value()[0]}}),He(["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(Pe)},z.prototype.find=function(e){return this.filter(e).head()},z.prototype.findLast=function(e){return this.reverse().find(e)},z.prototype.invokeMap=j(function(e,t){return typeof e=="function"?new z(this):this.map(function(n){return $n(n,e,t)})}),z.prototype.reject=function(e){return this.filter(Wr(b(e)))},z.prototype.slice=function(e,t){e=W(e);var n=this;return n.__filtered__&&(e>0||t<0)?new z(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=W(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},z.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},z.prototype.toArray=function(){return this.take(de)},ct(z.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=u[i?"take"+(t=="last"?"Right":""):t],c=i||/^find/.test(t);a&&(u.prototype[t]=function(){var p=this.__wrapped__,d=i?[1]:arguments,g=p instanceof z,w=d[0],x=g||$(p),A=function(H){var J=a.apply(u,Ot([H],d));return i&&I?J[0]:J};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var I=this.__chain__,F=!!this.__actions__.length,O=c&&!I,B=g&&!F;if(!c&&x){p=B?p:new z(this);var L=e.apply(p,d);return L.__actions__.push({func:Nr,args:[A],thisArg:r}),new ze(L,I)}return O&&B?e.apply(this,d):(L=this.thru(A),O?i?L.value()[0]:L.value():L)})}),He(["pop","push","shift","sort","splice","unshift"],function(e){var t=or[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var c=this.value();return t.apply($(c)?c:[],a)}return this[n](function(p){return t.apply($(p)?p:[],a)})}}),ct(z.prototype,function(e,t){var n=u[t];if(n){var i=n.name+"";ee.call(cn,i)||(cn[i]=[]),cn[i].push({name:t,func:n})}}),cn[Cr(r,ht).name]=[{name:"wrapper",func:r}],z.prototype.clone=Dc,z.prototype.reverse=$c,z.prototype.value=Wc,u.prototype.at=gd,u.prototype.chain=md,u.prototype.commit=vd,u.prototype.next=yd,u.prototype.plant=wd,u.prototype.reverse=xd,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=Ad,u.prototype.first=u.prototype.head,Rn&&(u.prototype[Rn]=_d),u},on=mc();Ht?((Ht.exports=on)._=on,di._=on):ge._=on}).call(qy)}(Jn,Jn.exports)),Jn.exports}var Gy=Hy();const _s=o=>{const s=Gy.startCase(o).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},zy=({data:o,universalIdentifier:s=Ue.v4()})=>`import { defineObject } from 'twenty-sdk';
|
|
450
805
|
|
|
451
806
|
export default defineObject({
|
|
452
807
|
universalIdentifier: '${s}',
|
|
@@ -466,20 +821,20 @@ export default defineObject({
|
|
|
466
821
|
// },
|
|
467
822
|
],
|
|
468
823
|
});
|
|
469
|
-
`,
|
|
824
|
+
`,Jy=({name:o})=>`import { definePageLayout } from 'twenty-sdk';
|
|
470
825
|
|
|
471
826
|
export default definePageLayout({
|
|
472
|
-
universalIdentifier: '${
|
|
827
|
+
universalIdentifier: '${Ue.v4()}',
|
|
473
828
|
name: '${o}',
|
|
474
829
|
tabs: [
|
|
475
830
|
{
|
|
476
|
-
universalIdentifier: '${
|
|
831
|
+
universalIdentifier: '${Ue.v4()}',
|
|
477
832
|
title: 'Overview',
|
|
478
833
|
widgets: [],
|
|
479
834
|
},
|
|
480
835
|
],
|
|
481
836
|
});
|
|
482
|
-
`,
|
|
837
|
+
`,Ky=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineRole } from 'twenty-sdk';
|
|
483
838
|
|
|
484
839
|
export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
|
|
485
840
|
'${s}';
|
|
@@ -493,7 +848,7 @@ export default defineRole({
|
|
|
493
848
|
canSoftDeleteAllObjectRecords: true,
|
|
494
849
|
canDestroyAllObjectRecords: false,
|
|
495
850
|
});
|
|
496
|
-
`},
|
|
851
|
+
`},Vy=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineSkill } from 'twenty-sdk';
|
|
497
852
|
|
|
498
853
|
export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
499
854
|
'${s}';
|
|
@@ -505,7 +860,7 @@ export default defineSkill({
|
|
|
505
860
|
description: 'Add a description for your skill',
|
|
506
861
|
content: 'Add the skill content here',
|
|
507
862
|
});
|
|
508
|
-
`},
|
|
863
|
+
`},yl=({name:o,universalIdentifier:s=Ue.v4(),objectUniversalIdentifier:r="fill-later"})=>{const l=Qe.default(o);return`import { defineView } from 'twenty-sdk';
|
|
509
864
|
|
|
510
865
|
export default defineView({
|
|
511
866
|
universalIdentifier: '${s}',
|
|
@@ -530,7 +885,7 @@ export default defineView({
|
|
|
530
885
|
// },
|
|
531
886
|
// ],
|
|
532
887
|
});
|
|
533
|
-
`},
|
|
888
|
+
`},Yy=({data:o})=>{const s=Ue.v4(),r=o.description?`
|
|
534
889
|
description: '${o.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
|
|
535
890
|
|
|
536
891
|
export default defineField({
|
|
@@ -540,4 +895,4 @@ export default defineField({
|
|
|
540
895
|
type: FieldMetadataType.${o.type},
|
|
541
896
|
objectUniversalIdentifier: '${o.objectUniversalIdentifier}',${r}
|
|
542
897
|
});
|
|
543
|
-
`},
|
|
898
|
+
`},ws="src";class Xy{async execute(s,r){try{const l=s??await this.getEntity(),f=this.getFolderName(l),m=r?R.join(Se,r):R.join(Se,ws,f);await P.ensureDir(m);const{name:v,file:E}=await this.getEntityData(l),C=R.join(m,this.getFileName(v,l));if(await P.pathExists(C)){const{overwrite:M}=await this.handleFileExist();if(!M)return}await P.writeFile(C,E),console.log(S.default.green(`✓ Created ${f}:`),S.default.cyan(R.relative(Se,C))),l===K.Object&&await this.promptAndCreateViewAndNavigationMenuItem(v,r)}catch(l){console.error(S.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(s){switch(s){case K.Object:{const r=await this.getObjectData(),l=r.nameSingular,f=Ue.v4();this.lastObjectUniversalIdentifier=f;const m=zy({data:r,universalIdentifier:f});return{name:l,file:m}}case K.Field:{const r=await this.getFieldData(),l=r.name,f=Yy({data:r});return{name:l,file:f}}case K.LogicFunction:{const r=await this.getEntityName(s),l=jy({name:r});return{name:r,file:l}}case K.FrontComponent:{const r=await this.getEntityName(s),l=By({name:r});return{name:r,file:l}}case K.Role:{const r=await this.getEntityName(s),l=Ky({name:r});return{name:r,file:l}}case K.Skill:{const r=await this.getEntityName(s),l=Vy({name:r});return{name:r,file:l}}case K.View:{const l=(await this.getViewData()).name,f=yl({name:l});return{name:l,file:f}}case K.NavigationMenuItem:{const r=await this.getEntityName(s),l=ml({name:r});return{name:r,file:l}}case K.PageLayout:{const r=await this.getEntityName(s),l=Jy({name:r});return{name:r,file:l}}default:k.dt()}}async promptAndCreateViewAndNavigationMenuItem(s,r){const{createViewAndNavItem:l}=await lt.default.prompt([{type:"confirm",name:"createViewAndNavItem",message:"Also create a view and navigation menu item for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const f=Ue.v4(),m=yl({name:`all-${Qe.default(s)}`,universalIdentifier:f,objectUniversalIdentifier:this.lastObjectUniversalIdentifier}),v=r?R.join(Se,r):R.join(Se,ws,this.getFolderName(K.View));await P.ensureDir(v);const E=`all-${Qe.default(s)}.ts`,C=R.join(v,E);if(await P.pathExists(C)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await P.writeFile(C,m),console.log(S.default.green("✓ Created view:"),S.default.cyan(R.relative(Se,C)));const M=ml({name:s,viewUniversalIdentifier:f}),q=r?R.join(Se,r):R.join(Se,ws,this.getFolderName(K.NavigationMenuItem));await P.ensureDir(q);const X=`${Qe.default(s)}.ts`,U=R.join(q,X);if(await P.pathExists(U)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await P.writeFile(U,M),console.log(S.default.green("✓ Created navigation menu item:"),S.default.cyan(R.relative(Se,U)))}async getEntity(){const{entity:s}=await lt.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(K)}]);return s}async handleFileExist(){return await lt.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(s){const{name:r}=await lt.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${s}:`,default:"",validate:l=>l.length===0?`${s} name is required`:!0}]);return r}async getFieldData(){return lt.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:s=>_s(s.name),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(k.R),default:k.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return lt.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(s,r)=>s.trim()===r?.nameSingular.trim()?"Name plural must be different from name singular":!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:s=>_s(s.nameSingular),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:s=>_s(s.namePlural),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return lt.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this view belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(s){return`${Qe.default(s)}s`}getFileName(s,r){switch(r){case K.FrontComponent:return`${Qe.default(s)}.tsx`;default:return`${Qe.default(s)}.ts`}}}const Zy=o=>{const s=new Ly,r=new Ny,l=new Uy,f=new Dy,m=new My;o.command("auth:login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async U=>{await r.execute(U)}),o.command("auth:logout").description("Remove authentication credentials").action(async()=>{await l.execute()}),o.command("auth:status").description("Check authentication status").action(async()=>{await f.execute()}),o.command("auth:switch [workspace]").description("Switch the default workspace for authentication").action(async U=>{await m.execute({workspace:U})}),o.command("auth:list").description("List all configured workspaces").action(async()=>{await s.execute()});const v=new by,E=new ky,C=new Oy,M=new Xy,q=new Wy,X=new $y;o.command("app:dev [appPath]").description("Watch and sync local application changes").action(async U=>{await v.execute({appPath:Gn(U)})}),o.command("app:typecheck [appPath]").description("Run TypeScript type checking on the application").action(async U=>{await E.execute({appPath:Gn(U)})}),o.command("app:uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(U,V)=>{try{const ne=await C.execute({appPath:Gn(U),askForConfirmation:!V?.yes});process.exit(ne.success?0:1)}catch{process.exit(1)}}),o.command("entity:add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(K).join("|")})`).action(async(U,V)=>{await M.execute(U,V?.path)}),o.command("function:logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(U,V)=>{await q.execute({...V,appPath:Gn(U)})}),o.command("function:execute [appPath]").option("--postInstall","Execute post-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").description("Execute a logic function with a JSON payload").action(async(U,V)=>{!V?.postInstall&&!V?.functionUniversalIdentifier&&!V?.functionName&&(console.error(S.default.red("Error: Either --postInstall or --functionName (-n) or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await X.execute({...V,payload:V?.payload??"{}",appPath:Gn(U)})})},Qy="0.6.2",e_={version:Qy};Jm.inspect.defaultOptions.depth=10;const wn=new Al.Command;wn.name("twenty").description("CLI for Twenty application development").version(e_.version);wn.option("--workspace <name>","Use a specific workspace configuration (overrides the default set by auth:switch)");wn.hook("preAction",async o=>{let r=(o.optsWithGlobals?o.optsWithGlobals():o.opts()).workspace;r||(r=await new _e().getDefaultWorkspace()),_e.setActiveWorkspace(r),console.log(S.default.gray(`👩💻 Workspace - ${_e.getActiveWorkspace()}`))});Zy(wn);wn.exitOverride();try{wn.parse()}catch(o){o instanceof Al.CommanderError&&process.exit(o.exitCode),o instanceof Error&&(console.error(S.default.red("Error:"),o.message),process.exit(1))}
|