twenty-sdk 0.6.1 → 0.6.3-alpha
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 +5 -1
- package/dist/{HtmlTagToRemoteComponent-DvFlyCDv.js → HtmlTagToRemoteComponent-CgtwxDeH.js} +1 -1
- package/dist/{HtmlTagToRemoteComponent-CALlgbCB.mjs → HtmlTagToRemoteComponent-D_EW5OLu.mjs} +1498 -1447
- package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +2 -0
- package/dist/cli/utilities/client/client-service.d.ts +0 -1
- package/dist/cli/utilities/client/twenty-client-template.d.ts +42 -0
- package/dist/cli.cjs +138 -89
- package/dist/cli.mjs +2570 -2490
- package/dist/front-component-renderer/index.cjs +8 -8
- package/dist/front-component-renderer/index.mjs +588 -479
- package/dist/front-component-renderer/remote/generated/remote-components.d.ts +42 -2
- package/dist/front-component-renderer/remote/generated/remote-elements.d.ts +52 -2
- package/dist/front-component-renderer/types/FrontComponentExecutionContext.d.ts +1 -0
- package/dist/front-component-renderer/types/FrontComponentHostCommunicationApi.d.ts +2 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-CzwPUwwE.js → get-function-input-schema-BZ7_XyUh-CCSi0u_q.js} +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-C9RBS5oC.mjs → get-function-input-schema-BZ7_XyUh-DAPandzB.mjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +164 -124
- 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 +57 -6
- 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/functions/openAskAIWithPrompt.d.ts +2 -0
- package/dist/sdk/front-component-api/functions/openAskAIWithPrompt.js +12 -0
- package/dist/sdk/front-component-api/functions/openAskAIWithPrompt.js.map +1 -0
- package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.d.ts +4 -0
- package/dist/sdk/front-component-api/globals/frontComponentHostCommunicationApi.js.map +1 -1
- package/dist/sdk/front-component-api/hooks/useRecordId.d.ts +1 -0
- package/dist/sdk/front-component-api/hooks/useRecordId.js +6 -0
- package/dist/sdk/front-component-api/hooks/useRecordId.js.map +1 -0
- package/dist/sdk/front-component-api/index.d.ts +2 -0
- package/dist/sdk/front-component-api/types/FrontComponentExecutionContext.d.ts +1 -0
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/index.js +75 -67
- 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/package.json +1 -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
|
|
@@ -53,11 +53,11 @@ const require = __createRequire(import.meta.url);`},Qe=".twenty/output";var J=(o
|
|
|
53
53
|
actions
|
|
54
54
|
}
|
|
55
55
|
}
|
|
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(
|
|
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},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(
|
|
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,57 +76,81 @@ const require = __createRequire(import.meta.url);`},Qe=".twenty/output";var J=(o
|
|
|
76
76
|
error
|
|
77
77
|
}
|
|
78
78
|
}
|
|
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=
|
|
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
|
-
`,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
};
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
type Client = {
|
|
108
|
+
query: (
|
|
109
|
+
request: QueryGenqlSelection & { __name?: string },
|
|
110
|
+
) => Promise<unknown>;
|
|
111
|
+
mutation: (
|
|
112
|
+
request: MutationGenqlSelection & { __name?: string },
|
|
113
|
+
) => Promise<unknown>;
|
|
114
|
+
};
|
|
99
115
|
|
|
100
|
-
|
|
101
|
-
|
|
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__
|
|
102
122
|
|
|
103
|
-
|
|
123
|
+
const APP_ACCESS_TOKEN_ENV_KEY = 'TWENTY_APP_ACCESS_TOKEN';
|
|
124
|
+
const API_KEY_ENV_KEY = 'TWENTY_API_KEY';
|
|
104
125
|
|
|
105
|
-
type
|
|
126
|
+
type TwentyGeneratedClientOptions = ClientOptions;
|
|
106
127
|
|
|
107
|
-
type
|
|
128
|
+
type ProcessEnvironment = Record<string, string | undefined>;
|
|
129
|
+
|
|
130
|
+
type GraphqlErrorPayloadEntry = {
|
|
108
131
|
message?: string;
|
|
109
132
|
extensions?: { code?: string };
|
|
110
|
-
}
|
|
133
|
+
};
|
|
111
134
|
|
|
112
135
|
type GraphqlResponsePayload = {
|
|
113
|
-
data?: Record<string, unknown
|
|
114
|
-
errors?:
|
|
115
|
-
}
|
|
136
|
+
data?: Record<string, unknown>;
|
|
137
|
+
errors?: GraphqlErrorPayloadEntry[];
|
|
138
|
+
};
|
|
116
139
|
|
|
117
140
|
type GraphqlResponse = {
|
|
118
141
|
status: number;
|
|
119
142
|
statusText: string;
|
|
120
143
|
payload: GraphqlResponsePayload | null;
|
|
121
144
|
rawBody: string;
|
|
122
|
-
}
|
|
145
|
+
};
|
|
123
146
|
|
|
124
147
|
const getProcessEnvironment = (): ProcessEnvironment => {
|
|
125
|
-
const processObject = (
|
|
126
|
-
|
|
148
|
+
const processObject = (
|
|
149
|
+
globalThis as { process?: { env?: ProcessEnvironment } }
|
|
150
|
+
).process;
|
|
127
151
|
|
|
128
152
|
return processObject?.env ?? {};
|
|
129
|
-
}
|
|
153
|
+
};
|
|
130
154
|
|
|
131
155
|
const getTokenFromAuthorizationHeader = (
|
|
132
156
|
authorizationHeader: string | undefined,
|
|
@@ -150,15 +174,19 @@ const getTokenFromAuthorizationHeader = (
|
|
|
150
174
|
}
|
|
151
175
|
|
|
152
176
|
return trimmedAuthorizationHeader;
|
|
153
|
-
}
|
|
177
|
+
};
|
|
154
178
|
|
|
155
|
-
const getTokenFromHeaders = (
|
|
179
|
+
const getTokenFromHeaders = (
|
|
180
|
+
headers: HeadersInit | undefined,
|
|
181
|
+
): string | null => {
|
|
156
182
|
if (!headers) {
|
|
157
183
|
return null;
|
|
158
184
|
}
|
|
159
185
|
|
|
160
186
|
if (headers instanceof Headers) {
|
|
161
|
-
return getTokenFromAuthorizationHeader(
|
|
187
|
+
return getTokenFromAuthorizationHeader(
|
|
188
|
+
headers.get('Authorization') ?? undefined,
|
|
189
|
+
);
|
|
162
190
|
}
|
|
163
191
|
|
|
164
192
|
if (Array.isArray(headers)) {
|
|
@@ -174,7 +202,7 @@ const getTokenFromHeaders = (headers: HeadersInit | undefined): string | null =>
|
|
|
174
202
|
return getTokenFromAuthorizationHeader(
|
|
175
203
|
headersRecord.Authorization ?? headersRecord.authorization,
|
|
176
204
|
);
|
|
177
|
-
}
|
|
205
|
+
};
|
|
178
206
|
|
|
179
207
|
const hasAuthenticationErrorInGraphqlPayload = (
|
|
180
208
|
payload: GraphqlResponsePayload | null,
|
|
@@ -183,22 +211,22 @@ const hasAuthenticationErrorInGraphqlPayload = (
|
|
|
183
211
|
return false;
|
|
184
212
|
}
|
|
185
213
|
|
|
186
|
-
return payload.errors.some((
|
|
214
|
+
return payload.errors.some((graphqlError) => {
|
|
187
215
|
return (
|
|
188
|
-
|
|
189
|
-
|
|
216
|
+
graphqlError.extensions?.code === 'UNAUTHENTICATED' ||
|
|
217
|
+
graphqlError.message?.toLowerCase() === 'unauthorized'
|
|
190
218
|
);
|
|
191
219
|
});
|
|
192
|
-
}
|
|
220
|
+
};
|
|
193
221
|
|
|
194
|
-
const defaultOptions:
|
|
195
|
-
url:
|
|
222
|
+
const defaultOptions: TwentyGeneratedClientOptions = {
|
|
223
|
+
url: '__TWENTY_DEFAULT_URL__',
|
|
196
224
|
headers: {
|
|
197
225
|
'Content-Type': 'application/json',
|
|
198
226
|
},
|
|
199
|
-
}
|
|
227
|
+
};
|
|
200
228
|
|
|
201
|
-
export class
|
|
229
|
+
export class TwentyGeneratedClient {
|
|
202
230
|
private client: Client;
|
|
203
231
|
private url: string;
|
|
204
232
|
private requestOptions: RequestInit;
|
|
@@ -207,11 +235,11 @@ export class ${r} {
|
|
|
207
235
|
private authorizationToken: string | null;
|
|
208
236
|
private refreshAccessTokenPromise: Promise<string | null> | null = null;
|
|
209
237
|
|
|
210
|
-
constructor(options?:
|
|
211
|
-
const merged:
|
|
238
|
+
constructor(options?: TwentyGeneratedClientOptions) {
|
|
239
|
+
const merged: TwentyGeneratedClientOptions = {
|
|
212
240
|
...defaultOptions,
|
|
213
241
|
...options,
|
|
214
|
-
}
|
|
242
|
+
};
|
|
215
243
|
|
|
216
244
|
const {
|
|
217
245
|
url,
|
|
@@ -225,14 +253,15 @@ export class ${r} {
|
|
|
225
253
|
this.url = url ?? '';
|
|
226
254
|
this.requestOptions = requestOptions;
|
|
227
255
|
this.headers = headers ?? {};
|
|
228
|
-
this.fetchImplementation =
|
|
256
|
+
this.fetchImplementation =
|
|
257
|
+
customFetchImplementation ?? globalThis.fetch ?? null;
|
|
229
258
|
|
|
230
259
|
const processEnvironment = getProcessEnvironment();
|
|
231
260
|
const tokenFromHeaders = getTokenFromHeaders(
|
|
232
261
|
typeof headers === 'function' ? undefined : headers,
|
|
233
262
|
);
|
|
234
263
|
|
|
235
|
-
// Priority: explicit header >
|
|
264
|
+
// Priority: explicit header > app access token > api key (legacy).
|
|
236
265
|
this.authorizationToken =
|
|
237
266
|
tokenFromHeaders ??
|
|
238
267
|
processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] ??
|
|
@@ -256,7 +285,8 @@ export class ${r} {
|
|
|
256
285
|
mutation<R extends MutationGenqlSelection>(request: R & { __name?: string }) {
|
|
257
286
|
return this.client.mutation(request);
|
|
258
287
|
}
|
|
259
|
-
|
|
288
|
+
|
|
289
|
+
// __UPLOAD_FILE_START__
|
|
260
290
|
async uploadFile(
|
|
261
291
|
fileBuffer: Buffer,
|
|
262
292
|
filename: string,
|
|
@@ -277,11 +307,18 @@ ${f?`
|
|
|
277
307
|
query: \`mutation UploadFilesFieldFileByUniversalIdentifier($file: Upload!, $fieldMetadataUniversalIdentifier: String!) {
|
|
278
308
|
uploadFilesFieldFileByUniversalIdentifier(file: $file, fieldMetadataUniversalIdentifier: $fieldMetadataUniversalIdentifier) { id path size createdAt url }
|
|
279
309
|
}\`,
|
|
280
|
-
variables: {
|
|
310
|
+
variables: {
|
|
311
|
+
file: null,
|
|
312
|
+
fieldMetadataUniversalIdentifier,
|
|
313
|
+
},
|
|
281
314
|
}),
|
|
282
315
|
);
|
|
283
316
|
form.append('map', JSON.stringify({ '0': ['variables.file'] }));
|
|
284
|
-
form.append(
|
|
317
|
+
form.append(
|
|
318
|
+
'0',
|
|
319
|
+
new Blob([fileBuffer as BlobPart], { type: contentType }),
|
|
320
|
+
filename,
|
|
321
|
+
);
|
|
285
322
|
|
|
286
323
|
const result = await this.executeGraphqlRequestWithOptionalRefresh({
|
|
287
324
|
operation: form,
|
|
@@ -303,9 +340,10 @@ ${f?`
|
|
|
303
340
|
size: number;
|
|
304
341
|
createdAt: string;
|
|
305
342
|
url: string;
|
|
306
|
-
}
|
|
343
|
+
};
|
|
307
344
|
}
|
|
308
|
-
|
|
345
|
+
// __UPLOAD_FILE_END__
|
|
346
|
+
|
|
309
347
|
private async executeGraphqlRequestWithOptionalRefresh({
|
|
310
348
|
operation,
|
|
311
349
|
headers,
|
|
@@ -353,7 +391,8 @@ ${f?`
|
|
|
353
391
|
}): Promise<GraphqlResponse> {
|
|
354
392
|
if (!this.fetchImplementation) {
|
|
355
393
|
throw new Error(
|
|
356
|
-
'Global \`fetch\` function is not available,
|
|
394
|
+
'Global \`fetch\` function is not available, ' +
|
|
395
|
+
'pass a fetch implementation to the Twenty client',
|
|
357
396
|
);
|
|
358
397
|
}
|
|
359
398
|
|
|
@@ -361,7 +400,9 @@ ${f?`
|
|
|
361
400
|
const requestHeaders = new Headers(resolvedHeaders);
|
|
362
401
|
|
|
363
402
|
if (headers) {
|
|
364
|
-
new Headers(headers).forEach((value, key) =>
|
|
403
|
+
new Headers(headers).forEach((value, key) =>
|
|
404
|
+
requestHeaders.set(key, value),
|
|
405
|
+
);
|
|
365
406
|
}
|
|
366
407
|
|
|
367
408
|
if (operation instanceof FormData) {
|
|
@@ -381,7 +422,8 @@ ${f?`
|
|
|
381
422
|
...requestInit,
|
|
382
423
|
method: requestInit?.method ?? 'POST',
|
|
383
424
|
headers: requestHeaders,
|
|
384
|
-
body:
|
|
425
|
+
body:
|
|
426
|
+
operation instanceof FormData ? operation : JSON.stringify(operation),
|
|
385
427
|
});
|
|
386
428
|
|
|
387
429
|
const rawBody = await response.text();
|
|
@@ -400,7 +442,7 @@ ${f?`
|
|
|
400
442
|
statusText: response.statusText,
|
|
401
443
|
payload,
|
|
402
444
|
rawBody,
|
|
403
|
-
}
|
|
445
|
+
};
|
|
404
446
|
}
|
|
405
447
|
|
|
406
448
|
private async resolveHeaders(): Promise<HeadersInit> {
|
|
@@ -435,8 +477,8 @@ ${f?`
|
|
|
435
477
|
const refreshAccessTokenFunction = (
|
|
436
478
|
globalThis as {
|
|
437
479
|
frontComponentHostCommunicationApi?: {
|
|
438
|
-
requestAccessTokenRefresh?: () => Promise<string
|
|
439
|
-
}
|
|
480
|
+
requestAccessTokenRefresh?: () => Promise<string>;
|
|
481
|
+
};
|
|
440
482
|
}
|
|
441
483
|
).frontComponentHostCommunicationApi?.requestAccessTokenRefresh;
|
|
442
484
|
|
|
@@ -458,8 +500,8 @@ ${f?`
|
|
|
458
500
|
|
|
459
501
|
return refreshedAccessToken;
|
|
460
502
|
})
|
|
461
|
-
.catch((
|
|
462
|
-
console.error('Twenty client: token refresh failed',
|
|
503
|
+
.catch((refreshError: unknown) => {
|
|
504
|
+
console.error('Twenty client: token refresh failed', refreshError);
|
|
463
505
|
|
|
464
506
|
return null;
|
|
465
507
|
})
|
|
@@ -477,11 +519,18 @@ ${f?`
|
|
|
477
519
|
const processEnvironment = getProcessEnvironment();
|
|
478
520
|
|
|
479
521
|
processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] = token;
|
|
480
|
-
processEnvironment[API_KEY_ENV_KEY] = token;
|
|
481
522
|
}
|
|
482
523
|
}
|
|
483
|
-
|
|
484
|
-
`}}var Tl=(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))(Tl||{}),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 xv={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},Av=o=>{if(!gn.isCallExpression(o))return;const s=o.expression;if(gn.isIdentifier(s)&&Object.values(Tl).includes(s.text))return s.text},Sv=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 f=Av(l.expression);if(f)return f}},Iv=["twenty-sdk/ui"],Tv={name:"manifest-mock",setup:o=>{const s=new RegExp(`^(${Iv.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 Ev({filePath:o,appPath:s});return Fv(r,o)},Ev=async({filePath:o,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),l=await C.pathExists(r),f=Um.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 b=(await yl.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:[Tv],logLevel:"silent"})).outputFiles[0].text,M=await C.mkdtemp(Y.default.join(ms.default.tmpdir(),"twenty-manifest-")),H=Y.default.join(M,"module.cjs");try{return await C.writeFile(H,b),require(H)}finally{await C.remove(M)}},Fv=(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`)},bv={type:"object",properties:{}},Cv=async o=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-CzwPUwwE.js")),r=s(o)[0];return r?.type==="object"&&k.o(r.properties)?{type:"object",properties:r.properties}:bv},Pv="142046f0-4d80-48b5-ad56-26ad410e895c",at=({objectConfig:o,fieldName:s})=>{const r=`${o.universalIdentifier}-${s}`;return $e.v5(r,Pv)},Rv=o=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:k.R.UUID,universalIdentifier:at({objectConfig:o,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:k.R.TEXT,universalIdentifier:at({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:at({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:at({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: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:k.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:k.R.ACTOR,universalIdentifier:at({objectConfig:o,fieldName:"updatedBy"})},b={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:k.R.POSITION,universalIdentifier:at({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:at({objectConfig:o,fieldName:"searchVector"})};return[s,r,l,f,m,v,E,b,M]},qn={targetFieldName:o=>`target${k.cs(o.nameSingular)}`,targetLabel:o=>k.cs(o.nameSingular),icon:"IconBuildingSkyscraper"},kv=[{...qn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:k.y.timelineActivity.morphIds.targetMorphId.morphId},{...qn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:k.R.RELATION,standardObjectKey:"favorite"},{...qn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:k.y.attachment.morphIds.targetMorphId.morphId},{...qn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:k.y.noteTarget.morphIds.targetMorphId.morphId},{...qn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:k.y.taskTarget.morphIds.targetMorphId.morphId}],Ov=({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}},Lv=o=>{const s=[],r=[];for(const l of kv){const f=k.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:k.R.RELATION,universalSettings:{relationType:k.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:f.universalIdentifier},b=Ov({config:l,objectConfig:o,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(b)}return{objectFields:s,fields:r}},Nv=o=>{const s=Rv(o),{objectFields:r,fields:l}=Lv(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}},Uv=async o=>await hl.glob(["**/*.ts","**/*.tsx"],{cwd:o,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),Dv=async o=>await hl.glob([`${vs}/**/*`],{cwd:o,onlyFiles:!0}),El=async o=>{const s=await Uv(o),r=[];let l;const f=[],m=[],v=[],E=[],b=[],M=[],H=[],X=[],U=[],V=[],ie=[],lt=[],Te=[],dt=[],vn=[],We=[],bt=[],Me=[],Ct=[],Be=[],Pt=[];for(const le of s){const zn=await dl.readFile(le,"utf-8"),Pe=R.relative(o,le),Kn=Sv(zn);if(!Kn)continue;switch(xv[Kn]){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}=Nv(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};f.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),Te.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=R.relative(o,le),ve=ht.toolInputSchema??await Cv(zn),_n={...ht,toolInputSchema:ve,handlerName:"default.config.handler",sourceHandlerPath:Re,builtHandlerPath:Re.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};b.push(_n),We.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=R.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});U.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:k.dt()}}const yn=await Dv(o);for(const le of yn)H.push({filePath:le,fileName:R.basename(le),fileType:R.extname(le).replace(/^\./,""),checksum:null}),Me.push(R.relative(o,le));return l||r.push("Cannot build application, please export default defineApplication() to define an application"),{manifest:l?{application:l,objects:f,fields:m,roles:v,skills:E,logicFunctions:b,frontComponents:M,publicAssets:H,views:X,navigationMenuItems:U,pageLayouts:V}:null,filePaths:{application:ie,objects:lt,fields:Te,roles:dt,skills:vn,logicFunctions:We,frontComponents:bt,publicAssets:Me,views:Ct,navigationMenuItems:Be,pageLayouts:Pt},errors:r}},$v=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},Wv=o=>{const s=[],r=[],l=$v(Fl(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 Mv{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 El(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=Wv(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 Bv{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 qv{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 Hv{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 Gv=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),b=`${E}.map`;await C.remove(E),await C.remove(b)}},zv=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),b=Y.default.relative(s,E),M=o.metafile?.outputs?.[v]?.entryPoint||"",H=Y.default.relative(s,M),X=await C.readFile(E),U=Hr.default.createHash("md5").update(X).digest("hex");l.get(b)!==U&&(l.set(b,U),f&&await f({fileFolder:r,builtPath:b,sourcePath:H,checksum:U}))}},Kv=[],Jv=`
|
|
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:!0}),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=`
|
|
485
534
|
export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};
|
|
486
535
|
|
|
487
536
|
var _injectedStyleKeys = {};
|
|
@@ -558,7 +607,7 @@ export function makeEventRef(events, userRef) {
|
|
|
558
607
|
else if (userRef != null && typeof userRef === 'object') userRef.current = el;
|
|
559
608
|
};
|
|
560
609
|
}
|
|
561
|
-
`.trim(),
|
|
610
|
+
`.trim(),ey=`
|
|
562
611
|
import {
|
|
563
612
|
jsx as _originalJsx,
|
|
564
613
|
jsxs as _originalJsxs,
|
|
@@ -603,7 +652,7 @@ function _wrapJsxFactory(originalFactory) {
|
|
|
603
652
|
export var jsx = _wrapJsxFactory(_originalJsx);
|
|
604
653
|
export var jsxs = _wrapJsxFactory(_originalJsxs);
|
|
605
654
|
export { Fragment };
|
|
606
|
-
`.trim(),
|
|
655
|
+
`.trim(),ty=`
|
|
607
656
|
export * from '__real_react__';
|
|
608
657
|
import _React from '__real_react__';
|
|
609
658
|
|
|
@@ -652,12 +701,12 @@ function createElement(type) {
|
|
|
652
701
|
|
|
653
702
|
export { createElement };
|
|
654
703
|
export default Object.assign({}, _React, { createElement: createElement });
|
|
655
|
-
`.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';
|
|
656
705
|
import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
|
|
657
|
-
`+s,s=s.replace(
|
|
658
|
-
`)){const l=
|
|
659
|
-
`);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=bl(s);r&&this.pendingErrors.push(r)}}const fy=new Set(["node_modules",Gr,"dist",".twenty"]);class py{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=_l.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 fy.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(vs),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 dy{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 py({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=ly({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=uy({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 ul({appPath:this.state.appPath,fileFolder:k.U.PublicAsset,watchPaths:[vs],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new ul({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 cy({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 hy=({manifest:o,builtFileInfos:s})=>{let r=structuredClone(o);for(const[f,{fileFolder:m,checksum:v}]of s.entries()){const E=R.relative(Qe,f);if(m===k.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===k.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===k.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===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(Qe,f);if(m===k.U.Dependencies&&v.startsWith(`${Br}/`)){const E=s.get(f);E&&l.push(E.checksum)}}return l.length>0&&(r.application.apiClientChecksum=Hr.default.createHash("md5").update(l.sort().join("")).digest("hex")),r},gy=async(o,s)=>{const r=Y.default.join(o,Qe);await C.ensureDir(r);const l=Y.default.join(r,"manifest.json");return await C.writeJSON(l,s,{spaces:2}),l},Ol=o=>{if(typeof o=="string")return o;if(hn.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 my{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=hy({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await gy(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: ${Ol(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 vy{constructor(s){this.apiService=new Ft,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const l=R.relative(Qe,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:l,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const yy=["core/types.ts","core/schema.ts","metadata/types.ts","metadata/schema.ts"];class _y{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 vy({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",Gr);if(!await C.pathExists(r))return;const l=R.join(s,Qe,Br);await C.ensureDir(l);for(const f of yy){const m=R.join(r,f);if(!await C.pathExists(m))continue;await C.copy(m,R.join(l,f));const v=await C.readFile(m),E=Hr.default.createHash("md5").update(v).digest("hex"),b=R.join(Qe,Br,f),M=R.join(Br,f);this.state.steps.uploadFiles.output.builtFileInfos.set(b,{checksum:E,builtPath:b,sourcePath:M,fileFolder:k.U.Dependencies}),this.uploadFile(b,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 wy{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Ft({disableInterceptors:!0}),l=new we;this.clientService=new wv;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Bv({...f,apiService:r}),this.ensureValidTokensStep=new jv({...f,apiService:r,configService:l}),this.buildManifestStep=new Mv(f),this.resolveApplicationStep=new Hv({...f,apiService:r}),this.uploadFilesStep=new _y(f),this.generateApiClientStep=new qv({...f,clientService:this.clientService,configService:l}),this.syncApplicationStep=new my({...f,apiService:r}),this.startWatchersStep=new dy({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck})}async start(){const s=Y.default.join(this.state.appPath,Qe);await C.ensureDir(s),await C.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: ${Ol(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 xy={objects:J.Object,fields:J.Field,logicFunctions:J.LogicFunction,frontComponents:J.FrontComponent,roles:J.Role,skills:J.Skill,views:J.View,navigationMenuItems:J.NavigationMenuItem,pageLayouts:J.PageLayout},Ay=200,Sy={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 Iy{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(-(Ay-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),f=l.get(s);f?.status&&!Sy[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=xy[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 Ty{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 Iy({appPath:r,frontendUrl:process.env.FRONTEND_URL}),f=new vv(l);l.onChange=()=>f.notify();const{unmount:m}=await mv(f);this.unmountUI=m,this.orchestrator=new wy({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 Ey=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 Fy{async execute(s){const r=s.appPath??Ie;console.log(S.default.blue("Running type check...")),console.log(S.default.gray(`App path: ${r}`)),console.log("");const l=await Cl(r);l.length===0&&(console.log(S.default.green("✓ No type errors found")),process.exit(0));for(const f of l)console.log(Ey(f));console.log(""),console.log(S.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 C.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await C.pathExists(r)){const{manifest:l}=await El(o);return l}return await C.readJson(r)};class by{constructor(){this.apiService=new Ft}async execute({appPath:s=Ie,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 _s(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 ot.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Cy{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(S.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(S.default.blue(`Available workspaces:
|
|
660
|
-
`));for(const l of s){const f=await this.configService.getConfigForWorkspace(l),m=!!f.apiKey,E=l===r?S.default.green(" (default)"):"",
|
|
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';
|
|
661
710
|
|
|
662
711
|
// React component - implement your UI here
|
|
663
712
|
const Component = () => {
|
|
@@ -675,7 +724,7 @@ export default defineFrontComponent({
|
|
|
675
724
|
description: 'Add a description for your front component',
|
|
676
725
|
component: Component,
|
|
677
726
|
});
|
|
678
|
-
`},
|
|
727
|
+
`},jy=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineLogicFunction } from 'twenty-sdk';
|
|
679
728
|
|
|
680
729
|
// Logic function handler - rename and implement your logic
|
|
681
730
|
const handler = async (params: {
|
|
@@ -712,7 +761,7 @@ export default defineLogicFunction({
|
|
|
712
761
|
// eventName: 'objectName.created',
|
|
713
762
|
// },
|
|
714
763
|
});
|
|
715
|
-
`},
|
|
764
|
+
`},ml=({name:o,universalIdentifier:s=Ue.v4(),viewUniversalIdentifier:r})=>{const l=Qe.default(o),f=r?` viewUniversalIdentifier: '${r}',`:` // Link to a view:
|
|
716
765
|
// viewUniversalIdentifier: '...',
|
|
717
766
|
// Or link to an object:
|
|
718
767
|
// targetObjectUniversalIdentifier: '...',
|
|
@@ -726,33 +775,33 @@ export default defineNavigationMenuItem({
|
|
|
726
775
|
position: 0,
|
|
727
776
|
${f}
|
|
728
777
|
});
|
|
729
|
-
`};var
|
|
778
|
+
`};var Jn={exports:{}};/**
|
|
730
779
|
* @license
|
|
731
780
|
* Lodash <https://lodash.com/>
|
|
732
781
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
733
782
|
* Released under MIT license <https://lodash.com/license>
|
|
734
783
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
735
784
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
736
|
-
*/var $y=Hn.exports,fl;function Wy(){return fl||(fl=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`",b="__lodash_hash_undefined__",M=500,H="__lodash_placeholder__",X=1,U=2,V=4,ie=1,lt=2,Te=1,dt=2,vn=4,We=8,bt=16,Me=32,Ct=64,Be=128,Pt=256,yn=512,ws=30,xs="...",le=800,zn=16,Pe=1,Kn=2,As=3,B=1/0,de=9007199254740991,ht=17976931348623157e292,Re=NaN,ve=4294967295,_n=ve-1,Ll=ve>>>1,Nl=[["ary",Be],["bind",Te],["bindKey",dt],["curry",We],["curryRight",bt],["flip",yn],["partial",Me],["partialRight",Ct],["rearg",Pt]],Xt="[object Arguments]",Jn="[object Array]",Ul="[object AsyncFunction]",wn="[object Boolean]",xn="[object Date]",Dl="[object DOMException]",Vn="[object Error]",Yn="[object Function]",Ss="[object GeneratorFunction]",et="[object Map]",An="[object Number]",$l="[object Null]",gt="[object Object]",Is="[object Promise]",Wl="[object Proxy]",Sn="[object RegExp]",tt="[object Set]",In="[object String]",Xn="[object Symbol]",Ml="[object Undefined]",Tn="[object WeakMap]",Bl="[object WeakSet]",En="[object ArrayBuffer]",Zt="[object DataView]",zr="[object Float32Array]",Kr="[object Float64Array]",Jr="[object Int8Array]",Vr="[object Int16Array]",Yr="[object Int32Array]",Xr="[object Uint8Array]",Zr="[object Uint8ClampedArray]",Qr="[object Uint16Array]",ei="[object Uint32Array]",jl=/\b__p \+= '';/g,ql=/\b(__p \+=) '' \+/g,Hl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ts=/&(?:amp|lt|gt|quot|#39);/g,Es=/[&<>"']/g,Gl=RegExp(Ts.source),zl=RegExp(Es.source),Kl=/<%-([\s\S]+?)%>/g,Jl=/<%([\s\S]+?)%>/g,Fs=/<%=([\s\S]+?)%>/g,Vl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yl=/^\w*$/,Xl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ti=/[\\^$.*+?()[\]{}|]/g,Zl=RegExp(ti.source),ni=/^\s+/,Ql=/\s/,eu=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,tu=/\{\n\/\* \[wrapped with (.+)\] \*/,nu=/,? & /,ru=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,iu=/[()=,{}\[\]\/\s]/,su=/\\(\\)?/g,au=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bs=/\w*$/,ou=/^[-+]0x[0-9a-f]+$/i,lu=/^0b[01]+$/i,uu=/^\[object .+?Constructor\]$/,cu=/^0o[0-7]+$/i,fu=/^(?:0|[1-9]\d*)$/,pu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zn=/($^)/,du=/['\n\r\u2028\u2029\\]/g,Qn="\\ud800-\\udfff",hu="\\u0300-\\u036f",gu="\\ufe20-\\ufe2f",mu="\\u20d0-\\u20ff",Cs=hu+gu+mu,Ps="\\u2700-\\u27bf",Rs="a-z\\xdf-\\xf6\\xf8-\\xff",vu="\\xac\\xb1\\xd7\\xf7",yu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_u="\\u2000-\\u206f",wu=" \\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",ks="A-Z\\xc0-\\xd6\\xd8-\\xde",Os="\\ufe0e\\ufe0f",Ls=vu+yu+_u+wu,ri="['’]",xu="["+Qn+"]",Ns="["+Ls+"]",er="["+Cs+"]",Us="\\d+",Au="["+Ps+"]",Ds="["+Rs+"]",$s="[^"+Qn+Ls+Us+Ps+Rs+ks+"]",ii="\\ud83c[\\udffb-\\udfff]",Su="(?:"+er+"|"+ii+")",Ws="[^"+Qn+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",ai="[\\ud800-\\udbff][\\udc00-\\udfff]",Qt="["+ks+"]",Ms="\\u200d",Bs="(?:"+Ds+"|"+$s+")",Iu="(?:"+Qt+"|"+$s+")",js="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",qs="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",Hs=Su+"?",Gs="["+Os+"]?",Tu="(?:"+Ms+"(?:"+[Ws,si,ai].join("|")+")"+Gs+Hs+")*",Eu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zs=Gs+Hs+Tu,bu="(?:"+[Au,si,ai].join("|")+")"+zs,Cu="(?:"+[Ws+er+"?",er,si,ai,xu].join("|")+")",Pu=RegExp(ri,"g"),Ru=RegExp(er,"g"),oi=RegExp(ii+"(?="+ii+")|"+Cu+zs,"g"),ku=RegExp([Qt+"?"+Ds+"+"+js+"(?="+[Ns,Qt,"$"].join("|")+")",Iu+"+"+qs+"(?="+[Ns,Qt+Bs,"$"].join("|")+")",Qt+"?"+Bs+"+"+js,Qt+"+"+qs,Fu,Eu,Us,bu].join("|"),"g"),Ou=RegExp("["+Ms+Qn+Cs+Os+"]"),Lu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Nu=["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"],Uu=-1,re={};re[zr]=re[Kr]=re[Jr]=re[Vr]=re[Yr]=re[Xr]=re[Zr]=re[Qr]=re[ei]=!0,re[Xt]=re[Jn]=re[En]=re[wn]=re[Zt]=re[xn]=re[Vn]=re[Yn]=re[et]=re[An]=re[gt]=re[Sn]=re[tt]=re[In]=re[Tn]=!1;var ne={};ne[Xt]=ne[Jn]=ne[En]=ne[Zt]=ne[wn]=ne[xn]=ne[zr]=ne[Kr]=ne[Jr]=ne[Vr]=ne[Yr]=ne[et]=ne[An]=ne[gt]=ne[Sn]=ne[tt]=ne[In]=ne[Xn]=ne[Xr]=ne[Zr]=ne[Qr]=ne[ei]=!0,ne[Vn]=ne[Yn]=ne[Tn]=!1;var Du={À:"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"},$u={"&":"&","<":"<",">":">",'"':""","'":"'"},Wu={"&":"&","<":"<",">":">",""":'"',"'":"'"},Mu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bu=parseFloat,ju=parseInt,Ks=typeof Mr=="object"&&Mr&&Mr.Object===Object&&Mr,qu=typeof self=="object"&&self&&self.Object===Object&&self,ge=Ks||qu||Function("return this")(),li=s&&!s.nodeType&&s,jt=li&&!0&&o&&!o.nodeType&&o,Js=jt&&jt.exports===li,ui=Js&&Ks.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 ke(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 Hu(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 qe(h,_){for(var y=-1,T=h==null?0:h.length;++y<T&&_(h[y],y,h)!==!1;);return h}function Gu(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function ta(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(!_(h[y],y,h))return!1;return!0}function Rt(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 tr(h,_){var y=h==null?0:h.length;return!!y&&en(h,_,0)>-1}function ci(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 kt(h,_){for(var y=-1,T=_.length,D=h.length;++y<T;)h[D+y]=_[y];return h}function fi(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 zu(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 pi(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(_(h[y],y,h))return!0;return!1}var Ku=di("length");function Ju(h){return h.split("")}function Vu(h){return h.match(ru)||[]}function na(h,_,y){var T;return y(h,function(D,Z,fe){if(_(D,Z,fe))return T=Z,!1}),T}function nr(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 en(h,_,y){return _===_?oc(h,_,y):nr(h,ra,y)}function Yu(h,_,y,T){for(var D=y-1,Z=h.length;++D<Z;)if(T(h[D],_))return D;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,T,D){return D(h,function(Z,fe,te){y=T?(T=!1,Z):_(y,Z,fe,te)}),y}function Xu(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function gi(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 mi(h,_){for(var y=-1,T=Array(h);++y<h;)T[y]=_(y);return T}function Zu(h,_){return se(_,function(y){return[y,h[y]]})}function aa(h){return h&&h.slice(0,ca(h)+1).replace(ni,"")}function Oe(h){return function(_){return h(_)}}function vi(h,_){return se(_,function(y){return h[y]})}function Fn(h,_){return h.has(_)}function oa(h,_){for(var y=-1,T=h.length;++y<T&&en(_,h[y],0)>-1;);return y}function la(h,_){for(var y=h.length;y--&&en(_,h[y],0)>-1;);return y}function Qu(h,_){for(var y=h.length,T=0;y--;)h[y]===_&&++T;return T}var ec=hi(Du),tc=hi($u);function nc(h){return"\\"+Mu[h]}function rc(h,_){return h==null?r:h[_]}function tn(h){return Ou.test(h)}function ic(h){return Lu.test(h)}function sc(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(T,D){y[++_]=[D,T]}),y}function ua(h,_){return function(y){return h(_(y))}}function Ot(h,_){for(var y=-1,T=h.length,D=0,Z=[];++y<T;){var fe=h[y];(fe===_||fe===H)&&(h[y]=H,Z[D++]=y)}return Z}function rr(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=T}),y}function ac(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=[T,T]}),y}function oc(h,_,y){for(var T=y-1,D=h.length;++T<D;)if(h[T]===_)return T;return-1}function lc(h,_,y){for(var T=y+1;T--;)if(h[T]===_)return T;return T}function nn(h){return tn(h)?cc(h):Ku(h)}function nt(h){return tn(h)?fc(h):Ju(h)}function ca(h){for(var _=h.length;_--&&Ql.test(h.charAt(_)););return _}var uc=hi(Wu);function cc(h){for(var _=oi.lastIndex=0;oi.test(h);)++_;return _}function fc(h){return h.match(oi)||[]}function pc(h){return h.match(ku)||[]}var dc=function h(_){_=_==null?ge:rn.defaults(ge.Object(),_,rn.pick(ge,Nu));var y=_.Array,T=_.Date,D=_.Error,Z=_.Function,fe=_.Math,te=_.Object,_i=_.RegExp,hc=_.String,He=_.TypeError,ir=y.prototype,gc=Z.prototype,sn=te.prototype,sr=_["__core-js_shared__"],ar=gc.toString,ee=sn.hasOwnProperty,mc=0,fa=function(){var e=/[^.]+$/.exec(sr&&sr.keys&&sr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),or=sn.toString,vc=ar.call(te),yc=ge._,_c=_i("^"+ar.call(ee).replace(ti,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lr=Js?_.Buffer:r,Lt=_.Symbol,ur=_.Uint8Array,pa=lr?lr.allocUnsafe:r,cr=ua(te.getPrototypeOf,te),da=te.create,ha=sn.propertyIsEnumerable,fr=ir.splice,ga=Lt?Lt.isConcatSpreadable:r,bn=Lt?Lt.iterator:r,qt=Lt?Lt.toStringTag:r,pr=function(){try{var e=Jt(te,"defineProperty");return e({},"",{}),e}catch{}}(),wc=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,xc=T&&T.now!==ge.Date.now&&T.now,Ac=_.setTimeout!==ge.setTimeout&&_.setTimeout,dr=fe.ceil,hr=fe.floor,wi=te.getOwnPropertySymbols,Sc=lr?lr.isBuffer:r,ma=_.isFinite,Ic=ir.join,Tc=ua(te.keys,te),pe=fe.max,ye=fe.min,Ec=T.now,Fc=_.parseInt,va=fe.random,bc=ir.reverse,xi=Jt(_,"DataView"),Cn=Jt(_,"Map"),Ai=Jt(_,"Promise"),an=Jt(_,"Set"),Pn=Jt(_,"WeakMap"),Rn=Jt(te,"create"),gr=Pn&&new Pn,on={},Cc=Vt(xi),Pc=Vt(Cn),Rc=Vt(Ai),kc=Vt(an),Oc=Vt(Pn),mr=Lt?Lt.prototype:r,kn=mr?mr.valueOf:r,ya=mr?mr.toString:r;function u(e){if(oe(e)&&!$(e)&&!(e instanceof z)){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:Kl,evaluate:Jl,interpolate:Fs,variable:"",imports:{_:u}},u.prototype=vr.prototype,u.prototype.constructor=u,Ge.prototype=ln(vr.prototype),Ge.prototype.constructor=Ge;function z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ve,this.__views__=[]}function Lc(){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 Nc(){if(this.__filtered__){var e=new z(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Uc(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),i=t<0,a=n?e.length:0,c=Vf(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=ye(g,this.__takeCount__);if(!n||!i&&a==g&&F==g)return ja(e,this.__actions__);var O=[];e:for(;g--&&I<F;){w+=t;for(var j=-1,L=e[w];++j<A;){var G=x[j],K=G.iteratee,Ue=G.type,Se=K(L);if(Ue==Kn)L=Se;else if(!Se){if(Ue==Pe)continue e;break e}}O[I++]=L}return O}z.prototype=ln(vr.prototype),z.prototype.constructor=z;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 Dc(){this.__data__=Rn?Rn(null):{},this.size=0}function $c(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Wc(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 Mc(e){var t=this.__data__;return Rn?t[e]!==r:ee.call(t,e)}function Bc(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=Dc,Ht.prototype.delete=$c,Ht.prototype.get=Wc,Ht.prototype.has=Mc,Ht.prototype.set=Bc;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 jc(){this.__data__=[],this.size=0}function qc(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 Hc(e){var t=this.__data__,n=yr(t,e);return n<0?r:t[n][1]}function Gc(e){return yr(this.__data__,e)>-1}function zc(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=jc,mt.prototype.delete=qc,mt.prototype.get=Hc,mt.prototype.has=Gc,mt.prototype.set=zc;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 Kc(){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 Vc(e){return Pr(this,e).get(e)}function Yc(e){return Pr(this,e).has(e)}function Xc(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=Kc,vt.prototype.delete=Jc,vt.prototype.get=Vc,vt.prototype.has=Yc,vt.prototype.set=Xc;function Gt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new vt;++t<n;)this.add(e[t])}function Zc(e){return this.__data__.set(e,b),this}function Qc(e){return this.__data__.has(e)}Gt.prototype.add=Gt.prototype.push=Zc,Gt.prototype.has=Qc;function rt(e){var t=this.__data__=new mt(e);this.size=t.size}function ef(){this.__data__=new mt,this.size=0}function tf(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function nf(e){return this.__data__.get(e)}function rf(e){return this.__data__.has(e)}function sf(e,t){var n=this.__data__;if(n instanceof mt){var i=n.__data__;if(!Cn||i.length<f-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=ef,rt.prototype.delete=tf,rt.prototype.get=nf,rt.prototype.has=rf,rt.prototype.set=sf;function _a(e,t){var n=$(e),i=!n&&Yt(e),a=!n&&!i&&Wt(e),c=!n&&!i&&!a&&pn(e),p=n||i||a||c,d=p?mi(e.length,hc):[],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")||xt(w,g)))&&d.push(w);return d}function wa(e){var t=e.length;return t?e[Oi(0,t-1)]:r}function af(e,t){return Rr(Ee(e),zt(t,0,e.length))}function of(e){return Rr(Ee(e))}function Si(e,t,n){(n!==r&&!it(e[t],n)||n===r&&!(t in e))&&yt(e,t,n)}function On(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 lf(e,t,n,i){return Nt(e,function(a,c,p){t(i,a,n(a),p)}),i}function xa(e,t){return e&&ct(t,he(t),e)}function uf(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 zt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function ze(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=Xf(e),!d)return Ee(e,p)}else{var A=_e(e),I=A==Yn||A==Ss;if(Wt(e))return Ga(e,d);if(A==gt||A==Xt||I&&!a){if(p=g||I?{}:co(e),!d)return g?Mf(e,uf(p,e)):Wf(e,xa(p,e))}else{if(!ne[A])return a?e:{};p=Zf(e,A,d)}}c||(c=new rt);var F=c.get(e);if(F)return F;c.set(e,p),Mo(e)?e.forEach(function(L){p.add(ze(L,t,n,L,e,c))}):$o(e)&&e.forEach(function(L,G){p.set(G,ze(L,t,n,G,e,c))});var O=w?g?Hi:qi:g?be:he,j=x?r:O(e);return qe(j||e,function(L,G){j&&(G=L,L=e[G]),On(p,G,ze(L,t,n,G,e,c))}),p}function cf(e){var t=he(e);return function(n){return Aa(n,e,t)}}function Aa(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 Sa(e,t,n){if(typeof e!="function")throw new He(v);return Mn(function(){e.apply(r,n)},t)}function Ln(e,t,n,i){var a=-1,c=tr,p=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,Oe(n))),i?(c=ci,p=!1):t.length>=f&&(c=Fn,p=!1,t=new Gt(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 Nt=Ya(ut),Ia=Ya(Ei,!0);function ff(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],p=t(c);if(p!=null&&(d===r?p===p&&!Ne(p):n(p,d)))var d=p,g=c}return g}function pf(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 Ta(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,p=e.length;for(n||(n=ep),a||(a=[]);++c<p;){var d=e[c];t>0&&n(d)?t>1?me(d,t-1,n,i,a):kt(a,d):i||(a[a.length]=d)}return a}var Ti=Xa(),Ea=Xa(!0);function ut(e,t){return e&&Ti(e,t,he)}function Ei(e,t){return e&&Ea(e,t,he)}function wr(e,t){return Rt(t,function(n){return At(e[n])})}function Kt(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 Fa(e,t,n){var i=t(e);return $(e)?i:kt(i,n(e))}function xe(e){return e==null?e===r?Ml:$l:qt&&qt in te(e)?Jf(e):op(e)}function Fi(e,t){return e>t}function df(e,t){return e!=null&&ee.call(e,t)}function hf(e,t){return e!=null&&t in te(e)}function gf(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,p=c,d=y(c),g=1/0,w=[];p--;){var x=e[p];p&&t&&(x=se(x,Oe(t))),g=ye(x.length,g),d[p]=!n&&(t||a>=120&&x.length>=120)?new Gt(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?Fn(I,O):i(w,O,n))){for(p=c;--p;){var j=d[p];if(!(j?Fn(j,O):i(e[p],O,n)))continue e}I&&I.push(O),w.push(F)}}return w}function mf(e,t,n,i){return ut(e,function(a,c,p){t(i,n(a),c,p)}),i}function Nn(e,t,n){t=Dt(t,e),e=go(e,t);var i=e==null?e:e[ft(Je(t))];return i==null?r:ke(i,e,n)}function ba(e){return oe(e)&&xe(e)==Xt}function vf(e){return oe(e)&&xe(e)==En}function yf(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:_f(e,t,n,i,Un,a)}function _f(e,t,n,i,a,c){var p=$(e),d=$(t),g=p?Jn:_e(e),w=d?Jn:_e(t);g=g==Xt?gt:g,w=w==Xt?gt:w;var x=g==gt,A=w==gt,I=g==w;if(I&&Wt(e)){if(!Wt(t))return!1;p=!0,x=!1}if(I&&!x)return c||(c=new rt),p||pn(e)?oo(e,t,n,i,a,c):zf(e,t,g,n,i,a,c);if(!(n&ie)){var F=x&&ee.call(e,"__wrapped__"),O=A&&ee.call(t,"__wrapped__");if(F||O){var j=F?e.value():e,L=O?t.value():t;return c||(c=new rt),a(j,L,n,i,c)}}return I?(c||(c=new rt),Kf(e,t,n,i,a,c)):!1}function wf(e){return oe(e)&&_e(e)==et}function Ci(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 rt;if(i)var I=i(w,x,g,e,t,A);if(!(I===r?Un(x,w,ie|lt,i,A):I))return!1}}return!0}function Ca(e){if(!ae(e)||np(e))return!1;var t=At(e)?_c:uu;return t.test(Vt(e))}function xf(e){return oe(e)&&xe(e)==Sn}function Af(e){return oe(e)&&_e(e)==tt}function Sf(e){return oe(e)&&Dr(e.length)&&!!re[xe(e)]}function Pa(e){return typeof e=="function"?e:e==null?Ce:typeof e=="object"?$(e)?Oa(e[0],e[1]):ka(e):Qo(e)}function Pi(e){if(!Wn(e))return Tc(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function If(e){if(!ae(e))return ap(e);var t=Wn(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=Fe(e)?y(e.length):[];return Nt(e,function(a,c,p){i[++n]=t(a,c,p)}),i}function ka(e){var t=zi(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 Oa(e,t){return Ji(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&&Ti(t,function(c,p){if(a||(a=new rt),ae(c))Tf(e,t,p,n,xr,i,a);else{var d=i?i(Yi(e,p),c,p+"",e,t,a):r;d===r&&(d=c),Si(e,p,d)}},be)}function Tf(e,t,n,i,a,c,p){var d=Yi(e,n),g=Yi(t,n),w=p.get(g);if(w){Si(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&&Wt(g),O=!I&&!F&&pn(g);x=g,I||F||O?$(d)?x=d:ue(d)?x=Ee(d):F?(A=!1,x=Ga(g,!0)):O?(A=!1,x=za(g,!0)):x=[]:Bn(g)||Yt(g)?(x=d,Yt(d)?x=qo(d):(!ae(d)||At(d))&&(x=co(g))):A=!1}A&&(p.set(g,x),a(x,g,i,c,p),p.delete(g)),Si(e,n,x)}function La(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 $(c)?function(p){return Kt(p,c.length===1?c[0]:c)}:c}):t=[Ce];var i=-1;t=se(t,Oe(P()));var a=Ra(e,function(c,p,d){var g=se(t,function(w){return w(c)});return{criteria:g,index:++i,value:c}});return Xu(a,function(c,p){return $f(c,p,n)})}function Ef(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 p=t[i],d=Kt(e,p);n(d,p)&&Dn(c,Dt(p,e),d)}return c}function Ff(e){return function(t){return Kt(t,e)}}function ki(e,t,n,i){var a=i?Yu:en,c=-1,p=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,Oe(n)));++c<p;)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 Oi(e,t){return e+hr(va()*(t-e+1))}function bf(e,t,n,i){for(var a=-1,c=pe(dr((t-e)/(n||1)),0),p=y(c);c--;)p[i?c:++a]=e,e+=n;return p}function Li(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 Cf(e){return wa(dn(e))}function Pf(e,t){var n=dn(e);return Rr(n,zt(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,p=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!=p){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:xt(t[a+1])?[]:{})}On(d,g,w),d=d[g]}return e}var $a=gr?function(e,t){return gr.set(e,t),e}:Ce,Rf=pr?function(e,t){return pr(e,"toString",{configurable:!0,enumerable:!1,value:os(t),writable:!0})}:Ce;function kf(e){return Rr(dn(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 Of(e,t){var n;return Nt(e,function(i,a,c){return n=t(i,a,c),!n}),!!n}function Ar(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=Ll){for(;i<a;){var c=i+a>>>1,p=e[c];p!==null&&!Ne(p)&&(n?p<=t:p<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 p=t!==t,d=t===null,g=Ne(t),w=t===r;a<c;){var x=hr((a+c)/2),A=n(e[x]),I=A!==r,F=A===null,O=A===A,j=Ne(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||!j):F||j?L=!1:L=i?A<=t:A<t;L?a=x+1:c=x}return ye(c,_n)}function Wa(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||!it(d,g)){var g=d;c[a++]=p===0?0:p}}return c}function Ma(e){return typeof e=="number"?e:Ne(e)?Re:+e}function Le(e){if(typeof e=="string")return e;if($(e))return se(e,Le)+"";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,p=!0,d=[],g=d;if(n)p=!1,a=ci;else if(c>=f){var w=t?null:Hf(e);if(w)return rr(w);p=!1,a=Fn,g=new Gt}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 Ui(e,t){return t=Dt(t,e),e=go(e,t),e==null||delete e[ft(Je(t))]}function Ba(e,t,n,i){return Dn(e,t,n(Kt(e,t)),i)}function Sr(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 ja(e,t){var n=e;return n instanceof z&&(n=n.value()),fi(t,function(i,a){return a.func.apply(a.thisArg,kt([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 p=e[a],d=-1;++d<i;)d!=a&&(c[a]=Ln(c[a]||p,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,p={};++i<a;){var d=i<c?t[i]:r;n(p,e[i],d)}return p}function $i(e){return ue(e)?e:[]}function Wi(e){return typeof e=="function"?e:Ce}function Dt(e,t){return $(e)?e:Ji(e,t)?[e]:_o(Q(e))}var Lf=q;function $t(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Ke(e,t,n)}var Ha=wc||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 Nf(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Uf(e){var t=new e.constructor(e.source,bs.exec(e));return t.lastIndex=e.lastIndex,t}function Df(e){return kn?te(kn.call(e)):{}}function za(e,t){var n=t?Mi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ka(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,c=Ne(e),p=t!==r,d=t===null,g=t===t,w=Ne(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 $f(e,t,n){for(var i=-1,a=e.criteria,c=t.criteria,p=a.length,d=n.length;++i<p;){var g=Ka(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 Ja(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 Va(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 ct(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?yt(n,d,g):On(n,d,g)}return n}function Wf(e,t){return ct(e,Ki(e),t)}function Mf(e,t){return ct(e,lo(e),t)}function Ir(e,t){return function(n,i){var a=$(n)?Hu:lf,c=t?t():{};return a(n,e,P(i,2),c)}}function un(e){return q(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&&Ae(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 Ya(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 Xa(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 Bf(e,t,n){var i=t&Te,a=$n(e);function c(){var p=this&&this!==ge&&this instanceof c?a:e;return p.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?$t(n,1).join(""):t.slice(1);return i[e]()+a}}function cn(e){return function(t){return fi(Xo(Yo(t).replace(Pu,"")),e,"")}}function $n(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 jf(e,t,n){var i=$n(e);function a(){for(var c=arguments.length,p=y(c),d=c,g=fn(a);d--;)p[d]=arguments[d];var w=c<3&&p[0]!==g&&p[c-1]!==g?[]:Ot(p,g);if(c-=w.length,c<n)return ro(e,t,Tr,a.placeholder,r,p,w,r,r,n-c);var x=this&&this!==ge&&this instanceof a?i:e;return ke(x,this,p)}return a}function Qa(e){return function(t,n,i){var a=te(t);if(!Fe(t)){var c=P(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 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&&!p&&Cr(c)=="wrapper")var p=new Ge([],!0)}for(i=p?i:n;++i<n;){c=t[i];var d=Cr(c),g=d=="wrapper"?Gi(c):r;g&&Vi(g[0])&&g[1]==(Be|We|Me|Pt)&&!g[4].length&&g[9]==1?p=p[Cr(g[0])].apply(p,g[3]):p=c.length==1&&Vi(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 Tr(e,t,n,i,a,c,p,d,g,w){var x=t&Be,A=t&Te,I=t&dt,F=t&(We|bt),O=t&yn,j=I?r:$n(e);function L(){for(var G=arguments.length,K=y(G),Ue=G;Ue--;)K[Ue]=arguments[Ue];if(F)var Se=fn(L),De=Qu(K,Se);if(i&&(K=Ja(K,i,a,F)),c&&(K=Va(K,c,p,F)),G-=De,F&&G<w){var ce=Ot(K,Se);return ro(e,t,Tr,L.placeholder,n,K,ce,d,g,w-G)}var st=A?n:this,It=I?st[e]:e;return G=K.length,d?K=lp(K,d):O&&G>1&&K.reverse(),x&&g<G&&(K.length=g),this&&this!==ge&&this instanceof L&&(It=j||$n(It)),It.apply(st,K)}return L}function to(e,t){return function(n,i){return mf(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=Le(n),i=Le(i)):(n=Ma(n),i=Ma(i)),a=e(n,i)}return a}}function Bi(e){return wt(function(t){return t=se(t,Oe(P())),q(function(n){var i=this;return e(t,function(a){return ke(a,i,n)})})})}function Fr(e,t){t=t===r?" ":Le(t);var n=t.length;if(n<2)return n?Li(t,e):t;var i=Li(t,dr(e/nn(t)));return tn(t)?$t(nt(i),0,e).join(""):i.slice(0,e)}function qf(e,t,n,i){var a=t&Te,c=$n(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 ke(I,a?n:this,A)}return p}function no(e){return function(t,n,i){return i&&typeof i!="number"&&Ae(t,n,i)&&(n=i=r),t=St(t),n===r?(n=t,t=0):n=St(n),i=i===r?t<n?1:-1:St(i),bf(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,p,d,g,w){var x=t&We,A=x?p:r,I=x?r:p,F=x?c:r,O=x?r:c;t|=x?Me:Ct,t&=~(x?Ct:Me),t&vn||(t&=-4);var j=[e,t,a,F,A,O,I,d,g,w],L=n.apply(r,j);return Vi(e)&&mo(L,j),L.placeholder=i,vo(L,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 Hf=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?ac(t):Zu(t,e(t))}}function _t(e,t,n,i,a,c,p,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),p=p===r?p:pe(W(p),0),d=d===r?d:W(d),w-=a?a.length:0,t&Ct){var x=i,A=a;i=a=r}var I=g?r:Gi(e),F=[e,t,n,i,a,x,A,c,p,d];if(I&&sp(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&(We|bt)&&(t&=-25),!t||t==Te)var O=Bf(e,t,n);else t==We||t==bt?O=jf(e,t,d):(t==Me||t==(Te|Me))&&!a.length?O=qf(e,t,n,i):O=Tr.apply(r,F);var j=I?$a:mo;return vo(j(O,F),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 Gf(e){return Bn(e)?r:e}function oo(e,t,n,i,a,c){var p=n&ie,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<?new Gt:r;for(c.set(e,t),c.set(t,e);++A<d;){var O=e[A],j=t[A];if(i)var L=p?i(j,O,A,t,e,c):i(O,j,A,e,t,c);if(L!==r){if(L)continue;I=!1;break}if(F){if(!pi(t,function(G,K){if(!Fn(F,K)&&(O===G||a(O,G,n,i,c)))return F.push(K)})){I=!1;break}}else if(!(O===j||a(O,j,n,i,c))){I=!1;break}}return c.delete(e),c.delete(t),I}function zf(e,t,n,i,a,c,p){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 An:return it(+e,+t);case Vn:return e.name==t.name&&e.message==t.message;case Sn: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=p.get(e);if(w)return w==t;i|=lt,p.set(e,t);var x=oo(d(e),d(t),i,a,c,p);return p.delete(e),x;case Xn:if(kn)return kn.call(e)==kn.call(t)}return!1}function Kf(e,t,n,i,a,c){var p=n&ie,d=qi(e),g=d.length,w=qi(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 j=!0;c.set(e,t),c.set(t,e);for(var L=p;++A<g;){I=d[A];var G=e[I],K=t[I];if(i)var Ue=p?i(K,G,I,t,e,c):i(G,K,I,e,t,c);if(!(Ue===r?G===K||a(G,K,n,i,c):Ue)){j=!1;break}L||(L=I=="constructor")}if(j&&!L){var Se=e.constructor,De=t.constructor;Se!=De&&"constructor"in e&&"constructor"in t&&!(typeof Se=="function"&&Se instanceof Se&&typeof De=="function"&&De instanceof De)&&(j=!1)}return c.delete(e),c.delete(t),j}function wt(e){return Xi(ho(e,r,So),e+"")}function qi(e){return Fa(e,he,Ki)}function Hi(e){return Fa(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 P(){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 tp(t)?n[typeof t=="string"?"string":"hash"]:n.map}function zi(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 Jt(e,t){var n=rc(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 Ki=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;)kt(t,Ki(e)),e=cr(e);return t}:fs,_e=xe;(xi&&_e(new xi(new ArrayBuffer(1)))!=Zt||Cn&&_e(new Cn)!=et||Ai&&_e(Ai.resolve())!=Is||an&&_e(new an)!=tt||Pn&&_e(new Pn)!=Tn)&&(_e=function(e){var t=xe(e),n=t==gt?e.constructor:r,i=n?Vt(n):"";if(i)switch(i){case Cc:return Zt;case Pc:return et;case Rc:return Is;case kc:return tt;case Oc:return Tn}return t});function Vf(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=ye(t,e+p);break;case"takeRight":e=pe(e,t-p);break}}return{start:e,end:t}}function Yf(e){var t=e.match(tu);return t?t[1].split(nu):[]}function uo(e,t,n){t=Dt(t,e);for(var i=-1,a=t.length,c=!1;++i<a;){var p=ft(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&&Dr(a)&&xt(p,a)&&($(e)||Yt(e)))}function Xf(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"&&!Wn(e)?ln(cr(e)):{}}function Zf(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 Nf(e,n);case zr:case Kr:case Jr:case Vr:case Yr:case Xr:case Zr:case Qr:case ei:return za(e,n);case et:return new i;case An:case In:return new i(e);case Sn:return Uf(e);case tt:return new i;case Xn:return Df(e)}}function Qf(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(eu,`{
|
|
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,`{
|
|
737
786
|
/* [wrapped with `+t+`] */
|
|
738
|
-
`)}function ep(e){return $(e)||Yt(e)||!!(ga&&e&&e[ga])}function xt(e,t){var n=typeof e;return t=t??de,!!t&&(n=="number"||n!="symbol"&&fu.test(e))&&e>-1&&e%1==0&&e<t}function Ae(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Fe(n)&&xt(t,n.length):i=="string"&&t in n)?it(n[t],e):!1}function Ji(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ne(e)?!0:Yl.test(e)||!Vl.test(e)||t!=null&&e in te(t)}function tp(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 z.prototype))return!1;if(e===n)return!0;var i=Gi(n);return!!i&&e===i[0]}function np(e){return!!fa&&fa in e}var rp=sr?At:ps;function Wn(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 ip(e){var t=Nr(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function sp(e,t){var n=e[1],i=t[1],a=n|i,c=a<(Te|dt|Be),p=i==Be&&n==We||i==Be&&n==Pt&&e[7].length<=t[8]||i==(Be|Pt)&&t[7].length<=t[8]&&n==We;if(!(c||p))return e;i&Te&&(e[2]=t[2],a|=n&Te?0:vn);var d=t[3];if(d){var g=e[3];e[3]=g?Ja(g,d,t[4]):d,e[4]=g?Ot(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?Ot(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 ap(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function op(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),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),ke(e,this,d)}}function go(e,t){return t.length<2?e:Kt(e,Ke(t,0,-1))}function lp(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($a),Mn=Ac||function(e,t){return ge.setTimeout(e,t)},Xi=yo(Rf);function vo(e,t,n){var i=t+"";return Xi(e,Qf(i,up(Yf(i),n)))}function yo(e){var t=0,n=0;return function(){var i=Ec(),a=zn-(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=Oi(n,a),p=e[c];e[c]=e[n],e[n]=p}return e.length=t,e}var _o=ip(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Xl,function(n,i,a,c){t.push(a?c.replace(su,"$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 up(e,t){return qe(Nl,function(n){var i="_."+n[0];t&n[1]&&!tr(e,i)&&e.push(i)}),e.sort()}function wo(e){if(e instanceof z)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 cp(e,t,n){(n?Ae(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(dr(i/t));a<i;)p[c++]=Ke(e,a,a+=t);return p}function fp(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 pp(){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 kt($(n)?Ee(n):[n],me(t,1))}var dp=q(function(e,t){return ue(e)?Ln(e,me(t,1,ue,!0)):[]}),hp=q(function(e,t){var n=Je(t);return ue(n)&&(n=r),ue(e)?Ln(e,me(t,1,ue,!0),P(n,2)):[]}),gp=q(function(e,t){var n=Je(t);return ue(n)&&(n=r),ue(e)?Ln(e,me(t,1,ue,!0),r,n):[]});function mp(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 vp(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 yp(e,t){return e&&e.length?Sr(e,P(t,3),!0,!0):[]}function _p(e,t){return e&&e.length?Sr(e,P(t,3),!0):[]}function wp(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&Ae(e,t,n)&&(n=0,i=a),pf(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,P(t,3),a)}function Ao(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,P(t,3),a,!0)}function So(e){var t=e==null?0:e.length;return t?me(e,1):[]}function xp(e){var t=e==null?0:e.length;return t?me(e,B):[]}function Ap(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function Sp(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 Ip(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 Tp(e){var t=e==null?0:e.length;return t?Ke(e,0,-1):[]}var Ep=q(function(e){var t=se(e,$i);return t.length&&t[0]===e[0]?bi(t):[]}),Fp=q(function(e){var t=Je(e),n=se(e,$i);return t===Je(n)?t=r:n.pop(),n.length&&n[0]===e[0]?bi(n,P(t,2)):[]}),bp=q(function(e){var t=Je(e),n=se(e,$i);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?bi(n,r,t):[]});function Cp(e,t){return e==null?"":Ic.call(e,t)}function Je(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Pp(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?lc(e,t,a):nr(e,ra,a,!0)}function Rp(e,t){return e&&e.length?La(e,W(t)):r}var kp=q(To);function To(e,t){return e&&e.length&&t&&t.length?ki(e,t):e}function Op(e,t,n){return e&&e.length&&t&&t.length?ki(e,t,P(n,2)):e}function Lp(e,t,n){return e&&e.length&&t&&t.length?ki(e,t,r,n):e}var Np=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(Ka)),i});function Up(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],c=e.length;for(t=P(t,3);++i<c;){var p=e[i];t(p,i,e)&&(n.push(p),a.push(i))}return Da(e,a),n}function Zi(e){return e==null?e:bc.call(e)}function Dp(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&Ae(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),Ke(e,t,n)):[]}function $p(e,t){return Ar(e,t)}function Wp(e,t,n){return Ni(e,t,P(n,2))}function Mp(e,t){var n=e==null?0:e.length;if(n){var i=Ar(e,t);if(i<n&&it(e[i],t))return i}return-1}function Bp(e,t){return Ar(e,t,!0)}function jp(e,t,n){return Ni(e,t,P(n,2),!0)}function qp(e,t){var n=e==null?0:e.length;if(n){var i=Ar(e,t,!0)-1;if(it(e[i],t))return i}return-1}function Hp(e){return e&&e.length?Wa(e):[]}function Gp(e,t){return e&&e.length?Wa(e,P(t,2)):[]}function zp(e){var t=e==null?0:e.length;return t?Ke(e,1,t):[]}function Kp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),Ke(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,Ke(e,t<0?0:t,i)):[]}function Vp(e,t){return e&&e.length?Sr(e,P(t,3),!1,!0):[]}function Yp(e,t){return e&&e.length?Sr(e,P(t,3)):[]}var Xp=q(function(e){return Ut(me(e,1,ue,!0))}),Zp=q(function(e){var t=Je(e);return ue(t)&&(t=r),Ut(me(e,1,ue,!0),P(t,2))}),Qp=q(function(e){var t=Je(e);return t=typeof t=="function"?t:r,Ut(me(e,1,ue,!0),r,t)});function ed(e){return e&&e.length?Ut(e):[]}function td(e,t){return e&&e.length?Ut(e,P(t,2)):[]}function nd(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 ke(t,r,i)})}var rd=q(function(e,t){return ue(e)?Ln(e,t):[]}),id=q(function(e){return Di(Rt(e,ue))}),sd=q(function(e){var t=Je(e);return ue(t)&&(t=r),Di(Rt(e,ue),P(t,2))}),ad=q(function(e){var t=Je(e);return t=typeof t=="function"?t:r,Di(Rt(e,ue),r,t)}),od=q(Qi);function ld(e,t){return qa(e||[],t||[],On)}function ud(e,t){return qa(e||[],t||[],Dn)}var cd=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 Fo(e){var t=u(e);return t.__chain__=!0,t}function fd(e,t){return t(e),e}function kr(e,t){return t(e)}var pd=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 z)||!xt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:kr,args:[a],thisArg:r}),new Ge(i,this.__chain__).thru(function(c){return t&&!c.length&&c.push(r),c}))});function dd(){return Fo(this)}function hd(){return new Ge(this.value(),this.__chain__)}function gd(){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 md(){return this}function vd(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 yd(){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:kr,args:[Zi],thisArg:r}),new Ge(t,this.__chain__)}return this.thru(Zi)}function _d(){return ja(this.__wrapped__,this.__actions__)}var wd=Ir(function(e,t,n){ee.call(e,n)?++e[n]:yt(e,n,1)});function xd(e,t,n){var i=$(e)?ta:ff;return n&&Ae(e,t,n)&&(t=r),i(e,P(t,3))}function Ad(e,t){var n=$(e)?Rt:Ta;return n(e,P(t,3))}var Sd=Qa(xo),Id=Qa(Ao);function Td(e,t){return me(Or(e,t),1)}function Ed(e,t){return me(Or(e,t),B)}function Fd(e,t,n){return n=n===r?1:W(n),me(Or(e,t),n)}function bo(e,t){var n=$(e)?qe:Nt;return n(e,P(t,3))}function Co(e,t){var n=$(e)?Gu:Ia;return n(e,P(t,3))}var bd=Ir(function(e,t,n){ee.call(e,n)?e[n].push(t):yt(e,n,[t])});function Cd(e,t,n,i){e=Fe(e)?e:dn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),$r(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&en(e,t,n)>-1}var Pd=q(function(e,t,n){var i=-1,a=typeof t=="function",c=Fe(e)?y(e.length):[];return Nt(e,function(p){c[++i]=a?ke(t,p,n):Nn(p,t,n)}),c}),Rd=Ir(function(e,t,n){yt(e,n,t)});function Or(e,t){var n=$(e)?se:Ra;return n(e,P(t,3))}function kd(e,t,n,i){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=i?r:n,$(n)||(n=n==null?[]:[n]),Na(e,t,n))}var Od=Ir(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Ld(e,t,n){var i=$(e)?fi:sa,a=arguments.length<3;return i(e,P(t,4),n,a,Nt)}function Nd(e,t,n){var i=$(e)?zu:sa,a=arguments.length<3;return i(e,P(t,4),n,a,Ia)}function Ud(e,t){var n=$(e)?Rt:Ta;return n(e,Ur(P(t,3)))}function Dd(e){var t=$(e)?wa:Cf;return t(e)}function $d(e,t,n){(n?Ae(e,t,n):t===r)?t=1:t=W(t);var i=$(e)?af:Pf;return i(e,t)}function Wd(e){var t=$(e)?of:kf;return t(e)}function Md(e){if(e==null)return 0;if(Fe(e))return $r(e)?nn(e):e.length;var t=_e(e);return t==et||t==tt?e.size:Pi(e).length}function Bd(e,t,n){var i=$(e)?pi:Of;return n&&Ae(e,t,n)&&(t=r),i(e,P(t,3))}var jd=q(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Ae(e,t[0],t[1])?t=[]:n>2&&Ae(t[0],t[1],t[2])&&(t=[t[0]]),Na(e,me(t,1),[])}),Lr=xc||function(){return ge.Date.now()};function qd(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=Te;if(n.length){var a=Ot(n,fn(es));i|=Me}return _t(e,i,t,n,a)}),ko=q(function(e,t,n){var i=Te|dt;if(n.length){var a=Ot(n,fn(ko));i|=Me}return _t(t,i,e,n,a)});function Oo(e,t,n){t=n?r:t;var i=_t(e,We,r,r,r,r,r,t);return i.placeholder=Oo.placeholder,i}function Lo(e,t,n){t=n?r:t;var i=_t(e,bt,r,r,r,r,r,t);return i.placeholder=Lo.placeholder,i}function No(e,t,n){var i,a,c,p,d,g,w=0,x=!1,A=!1,I=!0;if(typeof e!="function")throw new He(v);t=Ve(t)||0,ae(n)&&(x=!!n.leading,A="maxWait"in n,c=A?pe(Ve(n.maxWait)||0,t):c,I="trailing"in n?!!n.trailing:I);function F(ce){var st=i,It=a;return i=a=r,w=ce,p=e.apply(It,st),p}function O(ce){return w=ce,d=Mn(G,t),x?F(ce):p}function j(ce){var st=ce-g,It=ce-w,el=t-st;return A?ye(el,c-It):el}function L(ce){var st=ce-g,It=ce-w;return g===r||st>=t||st<0||A&&It>=c}function G(){var ce=Lr();if(L(ce))return K(ce);d=Mn(G,j(ce))}function K(ce){return d=r,I&&i?F(ce):(i=a=r,p)}function Ue(){d!==r&&Ha(d),w=0,i=g=a=d=r}function Se(){return d===r?p:K(Lr())}function De(){var ce=Lr(),st=L(ce);if(i=arguments,a=this,g=ce,st){if(d===r)return O(g);if(A)return Ha(d),d=Mn(G,t),F(g)}return d===r&&(d=Mn(G,t)),p}return De.cancel=Ue,De.flush=Se,De}var Hd=q(function(e,t){return Sa(e,1,t)}),Gd=q(function(e,t,n){return Sa(e,Ve(t)||0,n)});function zd(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 p=e.apply(this,i);return n.cache=c.set(a,p)||c,p};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 Kd(e){return Ro(2,e)}var Jd=Lf(function(e,t){t=t.length==1&&$(t[0])?se(t[0],Oe(P())):se(me(t,1),Oe(P()));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 ke(e,this,i)})}),ts=q(function(e,t){var n=Ot(t,fn(ts));return _t(e,Me,r,t,n)}),Uo=q(function(e,t){var n=Ot(t,fn(Uo));return _t(e,Ct,r,t,n)}),Vd=wt(function(e,t){return _t(e,Pt,r,r,r,t)});function Yd(e,t){if(typeof e!="function")throw new He(v);return t=t===r?t:W(t),q(e,t)}function Xd(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=$t(n,0,t);return i&&kt(a,i),ke(e,this,a)})}function Zd(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 Qd(e){return Po(e,1)}function eh(e,t){return ts(Wi(t),e)}function th(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function nh(e){return ze(e,V)}function rh(e,t){return t=typeof t=="function"?t:r,ze(e,V,t)}function ih(e){return ze(e,X|V)}function sh(e,t){return t=typeof t=="function"?t:r,ze(e,X|V,t)}function ah(e,t){return t==null||Aa(e,t,he(t))}function it(e,t){return e===t||e!==e&&t!==t}var oh=br(Fi),lh=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")},$=y.isArray,uh=Vs?Oe(Vs):vf;function Fe(e){return e!=null&&Dr(e.length)&&!At(e)}function ue(e){return oe(e)&&Fe(e)}function ch(e){return e===!0||e===!1||oe(e)&&xe(e)==wn}var Wt=Sc||ps,fh=Ys?Oe(Ys):yf;function ph(e){return oe(e)&&e.nodeType===1&&!Bn(e)}function dh(e){if(e==null)return!0;if(Fe(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||Wt(e)||pn(e)||Yt(e)))return!e.length;var t=_e(e);if(t==et||t==tt)return!e.size;if(Wn(e))return!Pi(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function hh(e,t){return Un(e,t)}function gh(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==Dl||typeof e.message=="string"&&typeof e.name=="string"&&!Bn(e)}function mh(e){return typeof e=="number"&&ma(e)}function At(e){if(!ae(e))return!1;var t=xe(e);return t==Yn||t==Ss||t==Ul||t==Wl}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 $o=Xs?Oe(Xs):wf;function vh(e,t){return e===t||Ci(e,t,zi(t))}function yh(e,t,n){return n=typeof n=="function"?n:r,Ci(e,t,zi(t),n)}function _h(e){return Wo(e)&&e!=+e}function wh(e){if(rp(e))throw new D(m);return Ca(e)}function xh(e){return e===null}function Ah(e){return e==null}function Wo(e){return typeof e=="number"||oe(e)&&xe(e)==An}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)==vc}var rs=Zs?Oe(Zs):xf;function Sh(e){return Do(e)&&e>=-de&&e<=de}var Mo=Qs?Oe(Qs):Af;function $r(e){return typeof e=="string"||!$(e)&&oe(e)&&xe(e)==In}function Ne(e){return typeof e=="symbol"||oe(e)&&xe(e)==Xn}var pn=ea?Oe(ea):Sf;function Ih(e){return e===r}function Th(e){return oe(e)&&_e(e)==Tn}function Eh(e){return oe(e)&&xe(e)==Bl}var Fh=br(Ri),bh=br(function(e,t){return e<=t});function Bo(e){if(!e)return[];if(Fe(e))return $r(e)?nt(e):Ee(e);if(bn&&e[bn])return sc(e[bn]());var t=_e(e),n=t==et?yi:t==tt?rr:dn;return n(e)}function St(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=St(e),n=t%1;return t===t?n?t-n:t:0}function jo(e){return e?zt(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=lu.test(e);return n||cu.test(e)?ju(e.slice(2),n?2:8):ou.test(e)?Re:+e}function qo(e){return ct(e,be(e))}function Ch(e){return e?zt(W(e),-de,de):e===0?e:0}function Q(e){return e==null?"":Le(e)}var Ph=un(function(e,t){if(Wn(t)||Fe(t)){ct(t,he(t),e);return}for(var n in t)ee.call(t,n)&&On(e,n,t[n])}),Ho=un(function(e,t){ct(t,be(t),e)}),Wr=un(function(e,t,n,i){ct(t,be(t),e,i)}),Rh=un(function(e,t,n,i){ct(t,he(t),e,i)}),kh=wt(Ii);function Oh(e,t){var n=ln(e);return t==null?n:xa(n,t)}var Lh=q(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Ae(t[0],t[1],a)&&(i=1);++n<i;)for(var c=t[n],p=be(c),d=-1,g=p.length;++d<g;){var w=p[d],x=e[w];(x===r||it(x,sn[w])&&!ee.call(e,w))&&(e[w]=c[w])}return e}),Nh=q(function(e){return e.push(r,ao),ke(Go,r,e)});function Uh(e,t){return na(e,P(t,3),ut)}function Dh(e,t){return na(e,P(t,3),Ei)}function $h(e,t){return e==null?e:Ti(e,P(t,3),be)}function Wh(e,t){return e==null?e:Ea(e,P(t,3),be)}function Mh(e,t){return e&&ut(e,P(t,3))}function Bh(e,t){return e&&Ei(e,P(t,3))}function jh(e){return e==null?[]:wr(e,he(e))}function qh(e){return e==null?[]:wr(e,be(e))}function is(e,t,n){var i=e==null?r:Kt(e,t);return i===r?n:i}function Hh(e,t){return e!=null&&uo(e,t,df)}function ss(e,t){return e!=null&&uo(e,t,hf)}var Gh=to(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=or.call(t)),e[t]=n},os(Ce)),zh=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]},P),Kh=q(Nn);function he(e){return Fe(e)?_a(e):Pi(e)}function be(e){return Fe(e)?_a(e,!0):If(e)}function Jh(e,t){var n={};return t=P(t,3),ut(e,function(i,a,c){yt(n,t(i,a,c),i)}),n}function Vh(e,t){var n={};return t=P(t,3),ut(e,function(i,a,c){yt(n,a,t(i,a,c))}),n}var Yh=un(function(e,t,n){xr(e,t,n)}),Go=un(function(e,t,n,i){xr(e,t,n,i)}),Xh=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=ze(n,X|U|V,Gf));for(var a=t.length;a--;)Ui(n,t[a]);return n});function Zh(e,t){return zo(e,Ur(P(t)))}var Qh=wt(function(e,t){return e==null?{}:Ef(e,t)});function zo(e,t){if(e==null)return{};var n=se(Hi(e),function(i){return[i]});return t=P(t),Ua(e,n,function(i,a){return t(i,a[0])})}function eg(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=At(c)?c.call(e):c}return e}function tg(e,t,n){return e==null?e:Dn(e,t,n)}function ng(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Dn(e,t,n,i)}var Ko=io(he),Jo=io(be);function rg(e,t,n){var i=$(e),a=i||Wt(e)||pn(e);if(t=P(t,4),n==null){var c=e&&e.constructor;a?n=i?new c:[]:ae(e)?n=At(c)?ln(cr(e)):{}:n={}}return(a?qe:ut)(e,function(p,d,g){return t(n,p,d,g)}),n}function ig(e,t){return e==null?!0:Ui(e,t)}function sg(e,t,n){return e==null?e:Ba(e,t,Wi(n))}function ag(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ba(e,t,Wi(n),i)}function dn(e){return e==null?[]:vi(e,he(e))}function og(e){return e==null?[]:vi(e,be(e))}function lg(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),zt(Ve(e),t,n)}function ug(e,t,n){return t=St(t),n===r?(n=t,t=0):n=St(n),e=Ve(e),gf(e,t,n)}function cg(e,t,n){if(n&&typeof n!="boolean"&&Ae(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=St(e),t===r?(t=e,e=0):t=St(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+Bu("1e-"+((a+"").length-1))),t)}return Oi(e,t)}var fg=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(pu,ec).replace(Ru,"")}function pg(e,t,n){e=Q(e),t=Le(t);var i=e.length;n=n===r?i:zt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function dg(e){return e=Q(e),e&&zl.test(e)?e.replace(Es,tc):e}function hg(e){return e=Q(e),e&&Zl.test(e)?e.replace(ti,"\\$&"):e}var gg=cn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),mg=cn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),vg=Za("toLowerCase");function yg(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 Fr(hr(a),n)+e+Fr(dr(a),n)}function _g(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?e+Fr(t-i,n):e}function wg(e,t,n){e=Q(e),t=W(t);var i=t?nn(e):0;return t&&i<t?Fr(t-i,n)+e:e}function xg(e,t,n){return n||t==null?t=0:t&&(t=+t),Fc(Q(e).replace(ni,""),t||0)}function Ag(e,t,n){return(n?Ae(e,t,n):t===r)?t=1:t=W(t),Li(Q(e),t)}function Sg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Ig=cn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Tg(e,t,n){return n&&typeof n!="number"&&Ae(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=Le(t),!t&&tn(e))?$t(nt(e),0,n):e.split(t,n)):[]}var Eg=cn(function(e,t,n){return e+(n?" ":"")+as(t)});function Fg(e,t,n){return e=Q(e),n=n==null?0:zt(W(n),0,e.length),t=Le(t),e.slice(n,n+t.length)==t}function bg(e,t,n){var i=u.templateSettings;n&&Ae(e,t,n)&&(t=r),e=Q(e),t=Wr({},t,i,so);var a=Wr({},t.imports,i.imports,so),c=he(a),p=vi(a,c),d,g,w=0,x=t.interpolate||Zn,A="__p += '",I=_i((t.escape||Zn).source+"|"+x.source+"|"+(x===Fs?au:Zn).source+"|"+(t.evaluate||Zn).source+"|$","g"),F="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Uu+"]")+`
|
|
739
|
-
`;e.replace(I,function(L,
|
|
740
|
-
__e(`+
|
|
741
|
-
'`),
|
|
742
|
-
`+
|
|
743
|
-
__p += '`),
|
|
744
|
-
((__t = (`+
|
|
745
|
-
'`),w=
|
|
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+=`';
|
|
791
|
+
`+Ae+`;
|
|
792
|
+
__p += '`),J&&(A+=`' +
|
|
793
|
+
((__t = (`+J+`)) == null ? '' : __t) +
|
|
794
|
+
'`),w=Ne+L.length,L}),A+=`';
|
|
746
795
|
`;var O=ee.call(t,"variable")&&t.variable;if(!O)A=`with (obj) {
|
|
747
796
|
`+A+`
|
|
748
797
|
}
|
|
749
|
-
`;else if(
|
|
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")+`) {
|
|
750
799
|
`+(O?"":`obj || (obj = {});
|
|
751
800
|
`)+"var __t, __p = ''"+(d?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
|
|
752
801
|
function print() { __p += __j.call(arguments, '') }
|
|
753
802
|
`:`;
|
|
754
803
|
`)+A+`return __p
|
|
755
|
-
}`;var j=Zo(function(){return Z(c,F+"return "+A).apply(r,p)});if(j.source=A,ns(j))throw j;return j}function Cg(e){return Q(e).toLowerCase()}function Pg(e){return Q(e).toUpperCase()}function Rg(e,t,n){if(e=Q(e),e&&(n||t===r))return aa(e);if(!e||!(t=Le(t)))return e;var i=nt(e),a=nt(t),c=oa(i,a),p=la(i,a)+1;return $t(i,c,p).join("")}function kg(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ca(e)+1);if(!e||!(t=Le(t)))return e;var i=nt(e),a=la(i,nt(t))+1;return $t(i,0,a).join("")}function Og(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(ni,"");if(!e||!(t=Le(t)))return e;var i=nt(e),a=oa(i,nt(t));return $t(i,a).join("")}function Lg(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?Le(t.omission):i}e=Q(e);var c=e.length;if(tn(e)){var p=nt(e);c=p.length}if(n>=c)return e;var d=n-nn(i);if(d<1)return i;var g=p?$t(p,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(p&&(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 A=w.index;g=g.slice(0,A===r?d:A)}}else if(e.indexOf(Le(a),d)!=d){var I=g.lastIndexOf(a);I>-1&&(g=g.slice(0,I))}return g+i}function Ng(e){return e=Q(e),e&&Gl.test(e)?e.replace(Ts,uc):e}var Ug=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?ic(e)?pc(e):Vu(e):e.match(t)||[]}var Zo=q(function(e,t){try{return ke(e,r,t)}catch(n){return ns(n)?n:new D(n)}}),Dg=wt(function(e,t){return qe(t,function(n){n=ft(n),yt(e,n,es(e[n],e))}),e});function $g(e){var t=e==null?0:e.length,n=P();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(ke(c[0],this,i))return ke(c[1],this,i)}})}function Wg(e){return cf(ze(e,X))}function os(e){return function(){return e}}function Mg(e,t){return e==null||e!==e?t:e}var Bg=eo(),jg=eo(!0);function Ce(e){return e}function ls(e){return Pa(typeof e=="function"?e:ze(e,X))}function qg(e){return ka(ze(e,X))}function Hg(e,t){return Oa(e,ze(t,X))}var Gg=q(function(e,t){return function(n){return Nn(n,e,t)}}),zg=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,p=At(e);return qe(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,kt([this.value()],arguments))})}),e}function Kg(){return ge._===this&&(ge._=yc),this}function cs(){}function Jg(e){return e=W(e),q(function(t){return La(t,e)})}var Vg=Bi(se),Yg=Bi(ta),Xg=Bi(pi);function Qo(e){return Ji(e)?di(ft(e)):Ff(e)}function Zg(e){return function(t){return e==null?r:Kt(e,t)}}var Qg=no(),em=no(!0);function fs(){return[]}function ps(){return!1}function tm(){return{}}function nm(){return""}function rm(){return!0}function im(e,t){if(e=W(e),e<1||e>de)return[];var n=ve,i=ye(e,ve);t=P(t),e-=ve;for(var a=mi(i,t);++n<e;)t(n);return a}function sm(e){return $(e)?se(e,ft):Ne(e)?[e]:Ee(_o(Q(e)))}function am(e){var t=++mc;return Q(e)+t}var om=Er(function(e,t){return e+t},0),lm=ji("ceil"),um=Er(function(e,t){return e/t},1),cm=ji("floor");function fm(e){return e&&e.length?_r(e,Ce,Fi):r}function pm(e,t){return e&&e.length?_r(e,P(t,2),Fi):r}function dm(e){return ia(e,Ce)}function hm(e,t){return ia(e,P(t,2))}function gm(e){return e&&e.length?_r(e,Ce,Ri):r}function mm(e,t){return e&&e.length?_r(e,P(t,2),Ri):r}var vm=Er(function(e,t){return e*t},1),ym=ji("round"),_m=Er(function(e,t){return e-t},0);function wm(e){return e&&e.length?gi(e,Ce):0}function xm(e,t){return e&&e.length?gi(e,P(t,2)):0}return u.after=qd,u.ary=Po,u.assign=Ph,u.assignIn=Ho,u.assignInWith=Wr,u.assignWith=Rh,u.at=kh,u.before=Ro,u.bind=es,u.bindAll=Dg,u.bindKey=ko,u.castArray=th,u.chain=Fo,u.chunk=cp,u.compact=fp,u.concat=pp,u.cond=$g,u.conforms=Wg,u.constant=os,u.countBy=wd,u.create=Oh,u.curry=Oo,u.curryRight=Lo,u.debounce=No,u.defaults=Lh,u.defaultsDeep=Nh,u.defer=Hd,u.delay=Gd,u.difference=dp,u.differenceBy=hp,u.differenceWith=gp,u.drop=mp,u.dropRight=vp,u.dropRightWhile=yp,u.dropWhile=_p,u.fill=wp,u.filter=Ad,u.flatMap=Td,u.flatMapDeep=Ed,u.flatMapDepth=Fd,u.flatten=So,u.flattenDeep=xp,u.flattenDepth=Ap,u.flip=zd,u.flow=Bg,u.flowRight=jg,u.fromPairs=Sp,u.functions=jh,u.functionsIn=qh,u.groupBy=bd,u.initial=Tp,u.intersection=Ep,u.intersectionBy=Fp,u.intersectionWith=bp,u.invert=Gh,u.invertBy=zh,u.invokeMap=Pd,u.iteratee=ls,u.keyBy=Rd,u.keys=he,u.keysIn=be,u.map=Or,u.mapKeys=Jh,u.mapValues=Vh,u.matches=qg,u.matchesProperty=Hg,u.memoize=Nr,u.merge=Yh,u.mergeWith=Go,u.method=Gg,u.methodOf=zg,u.mixin=us,u.negate=Ur,u.nthArg=Jg,u.omit=Xh,u.omitBy=Zh,u.once=Kd,u.orderBy=kd,u.over=Vg,u.overArgs=Jd,u.overEvery=Yg,u.overSome=Xg,u.partial=ts,u.partialRight=Uo,u.partition=Od,u.pick=Qh,u.pickBy=zo,u.property=Qo,u.propertyOf=Zg,u.pull=kp,u.pullAll=To,u.pullAllBy=Op,u.pullAllWith=Lp,u.pullAt=Np,u.range=Qg,u.rangeRight=em,u.rearg=Vd,u.reject=Ud,u.remove=Up,u.rest=Yd,u.reverse=Zi,u.sampleSize=$d,u.set=tg,u.setWith=ng,u.shuffle=Wd,u.slice=Dp,u.sortBy=jd,u.sortedUniq=Hp,u.sortedUniqBy=Gp,u.split=Tg,u.spread=Xd,u.tail=zp,u.take=Kp,u.takeRight=Jp,u.takeRightWhile=Vp,u.takeWhile=Yp,u.tap=fd,u.throttle=Zd,u.thru=kr,u.toArray=Bo,u.toPairs=Ko,u.toPairsIn=Jo,u.toPath=sm,u.toPlainObject=qo,u.transform=rg,u.unary=Qd,u.union=Xp,u.unionBy=Zp,u.unionWith=Qp,u.uniq=ed,u.uniqBy=td,u.uniqWith=nd,u.unset=ig,u.unzip=Qi,u.unzipWith=Eo,u.update=sg,u.updateWith=ag,u.values=dn,u.valuesIn=og,u.without=rd,u.words=Xo,u.wrap=eh,u.xor=id,u.xorBy=sd,u.xorWith=ad,u.zip=od,u.zipObject=ld,u.zipObjectDeep=ud,u.zipWith=cd,u.entries=Ko,u.entriesIn=Jo,u.extend=Ho,u.extendWith=Wr,us(u,u),u.add=om,u.attempt=Zo,u.camelCase=fg,u.capitalize=Vo,u.ceil=lm,u.clamp=lg,u.clone=nh,u.cloneDeep=ih,u.cloneDeepWith=sh,u.cloneWith=rh,u.conformsTo=ah,u.deburr=Yo,u.defaultTo=Mg,u.divide=um,u.endsWith=pg,u.eq=it,u.escape=dg,u.escapeRegExp=hg,u.every=xd,u.find=Sd,u.findIndex=xo,u.findKey=Uh,u.findLast=Id,u.findLastIndex=Ao,u.findLastKey=Dh,u.floor=cm,u.forEach=bo,u.forEachRight=Co,u.forIn=$h,u.forInRight=Wh,u.forOwn=Mh,u.forOwnRight=Bh,u.get=is,u.gt=oh,u.gte=lh,u.has=Hh,u.hasIn=ss,u.head=Io,u.identity=Ce,u.includes=Cd,u.indexOf=Ip,u.inRange=ug,u.invoke=Kh,u.isArguments=Yt,u.isArray=$,u.isArrayBuffer=uh,u.isArrayLike=Fe,u.isArrayLikeObject=ue,u.isBoolean=ch,u.isBuffer=Wt,u.isDate=fh,u.isElement=ph,u.isEmpty=dh,u.isEqual=hh,u.isEqualWith=gh,u.isError=ns,u.isFinite=mh,u.isFunction=At,u.isInteger=Do,u.isLength=Dr,u.isMap=$o,u.isMatch=vh,u.isMatchWith=yh,u.isNaN=_h,u.isNative=wh,u.isNil=Ah,u.isNull=xh,u.isNumber=Wo,u.isObject=ae,u.isObjectLike=oe,u.isPlainObject=Bn,u.isRegExp=rs,u.isSafeInteger=Sh,u.isSet=Mo,u.isString=$r,u.isSymbol=Ne,u.isTypedArray=pn,u.isUndefined=Ih,u.isWeakMap=Th,u.isWeakSet=Eh,u.join=Cp,u.kebabCase=gg,u.last=Je,u.lastIndexOf=Pp,u.lowerCase=mg,u.lowerFirst=vg,u.lt=Fh,u.lte=bh,u.max=fm,u.maxBy=pm,u.mean=dm,u.meanBy=hm,u.min=gm,u.minBy=mm,u.stubArray=fs,u.stubFalse=ps,u.stubObject=tm,u.stubString=nm,u.stubTrue=rm,u.multiply=vm,u.nth=Rp,u.noConflict=Kg,u.noop=cs,u.now=Lr,u.pad=yg,u.padEnd=_g,u.padStart=wg,u.parseInt=xg,u.random=cg,u.reduce=Ld,u.reduceRight=Nd,u.repeat=Ag,u.replace=Sg,u.result=eg,u.round=ym,u.runInContext=h,u.sample=Dd,u.size=Md,u.snakeCase=Ig,u.some=Bd,u.sortedIndex=$p,u.sortedIndexBy=Wp,u.sortedIndexOf=Mp,u.sortedLastIndex=Bp,u.sortedLastIndexBy=jp,u.sortedLastIndexOf=qp,u.startCase=Eg,u.startsWith=Fg,u.subtract=_m,u.sum=wm,u.sumBy=xm,u.template=bg,u.times=im,u.toFinite=St,u.toInteger=W,u.toLength=jo,u.toLower=Cg,u.toNumber=Ve,u.toSafeInteger=Ch,u.toString=Q,u.toUpper=Pg,u.trim=Rg,u.trimEnd=kg,u.trimStart=Og,u.truncate=Lg,u.unescape=Ng,u.uniqueId=am,u.upperCase=Ug,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){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__=ye(n,i.__takeCount__):i.__views__.push({size:ye(n,ve),type:e+(i.__dir__<0?"Right":"")}),i},z.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==As;z.prototype[e]=function(a){var c=this.clone();return c.__iteratees__.push({iteratee:P(a,3),type:n}),c.__filtered__=c.__filtered__||i,c}}),qe(["head","last"],function(e,t){var n="take"+(t?"Right":"");z.prototype[e]=function(){return this[n](1).value()[0]}}),qe(["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(Ce)},z.prototype.find=function(e){return this.filter(e).head()},z.prototype.findLast=function(e){return this.reverse().find(e)},z.prototype.invokeMap=q(function(e,t){return typeof e=="function"?new z(this):this.map(function(n){return Nn(n,e,t)})}),z.prototype.reject=function(e){return this.filter(Ur(P(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(ve)},ut(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(G){var K=a.apply(u,kt([G],d));return i&&I?K[0]:K};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var I=this.__chain__,F=!!this.__actions__.length,O=c&&!I,j=g&&!F;if(!c&&x){p=j?p:new z(this);var L=e.apply(p,d);return L.__actions__.push({func:kr,args:[A],thisArg:r}),new Ge(L,I)}return O&&j?e.apply(this,d):(L=this.thru(A),O?i?L.value()[0]:L.value():L)})}),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($(c)?c:[],a)}return this[n](function(p){return t.apply($(p)?p:[],a)})}}),ut(z.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[Tr(r,dt).name]=[{name:"wrapper",func:r}],z.prototype.clone=Lc,z.prototype.reverse=Nc,z.prototype.value=Uc,u.prototype.at=pd,u.prototype.chain=dd,u.prototype.commit=hd,u.prototype.next=gd,u.prototype.plant=vd,u.prototype.reverse=yd,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=_d,u.prototype.first=u.prototype.head,bn&&(u.prototype[bn]=md),u},rn=dc();jt?((jt.exports=rn)._=rn,li._=rn):ge._=rn}).call($y)}(Hn,Hn.exports)),Hn.exports}var My=Wy();const hs=o=>{const s=My.startCase(o).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},By=({data:o,universalIdentifier:s=$e.v4()})=>`import { defineObject } from 'twenty-sdk';
|
|
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';
|
|
756
805
|
|
|
757
806
|
export default defineObject({
|
|
758
807
|
universalIdentifier: '${s}',
|
|
@@ -772,20 +821,20 @@ export default defineObject({
|
|
|
772
821
|
// },
|
|
773
822
|
],
|
|
774
823
|
});
|
|
775
|
-
`,
|
|
824
|
+
`,Jy=({name:o})=>`import { definePageLayout } from 'twenty-sdk';
|
|
776
825
|
|
|
777
826
|
export default definePageLayout({
|
|
778
|
-
universalIdentifier: '${
|
|
827
|
+
universalIdentifier: '${Ue.v4()}',
|
|
779
828
|
name: '${o}',
|
|
780
829
|
tabs: [
|
|
781
830
|
{
|
|
782
|
-
universalIdentifier: '${
|
|
831
|
+
universalIdentifier: '${Ue.v4()}',
|
|
783
832
|
title: 'Overview',
|
|
784
833
|
widgets: [],
|
|
785
834
|
},
|
|
786
835
|
],
|
|
787
836
|
});
|
|
788
|
-
`,
|
|
837
|
+
`,Ky=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineRole } from 'twenty-sdk';
|
|
789
838
|
|
|
790
839
|
export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
|
|
791
840
|
'${s}';
|
|
@@ -799,7 +848,7 @@ export default defineRole({
|
|
|
799
848
|
canSoftDeleteAllObjectRecords: true,
|
|
800
849
|
canDestroyAllObjectRecords: false,
|
|
801
850
|
});
|
|
802
|
-
`},
|
|
851
|
+
`},Vy=({name:o,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(o);return`import { defineSkill } from 'twenty-sdk';
|
|
803
852
|
|
|
804
853
|
export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
805
854
|
'${s}';
|
|
@@ -811,7 +860,7 @@ export default defineSkill({
|
|
|
811
860
|
description: 'Add a description for your skill',
|
|
812
861
|
content: 'Add the skill content here',
|
|
813
862
|
});
|
|
814
|
-
`},
|
|
863
|
+
`},yl=({name:o,universalIdentifier:s=Ue.v4(),objectUniversalIdentifier:r="fill-later"})=>{const l=Qe.default(o);return`import { defineView } from 'twenty-sdk';
|
|
815
864
|
|
|
816
865
|
export default defineView({
|
|
817
866
|
universalIdentifier: '${s}',
|
|
@@ -836,7 +885,7 @@ export default defineView({
|
|
|
836
885
|
// },
|
|
837
886
|
// ],
|
|
838
887
|
});
|
|
839
|
-
`},
|
|
888
|
+
`},Yy=({data:o})=>{const s=Ue.v4(),r=o.description?`
|
|
840
889
|
description: '${o.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
|
|
841
890
|
|
|
842
891
|
export default defineField({
|
|
@@ -846,4 +895,4 @@ export default defineField({
|
|
|
846
895
|
type: FieldMetadataType.${o.type},
|
|
847
896
|
objectUniversalIdentifier: '${o.objectUniversalIdentifier}',${r}
|
|
848
897
|
});
|
|
849
|
-
`},
|
|
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))}
|