import{r as l,b as u,a8 as y}from"./jwt-decode.esm-C7p7KYmD.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="9f2a99f4-321f-4698-a7b4-e2005c1368d2",e._sentryDebugIdIdentifier="sentry-dbid-9f2a99f4-321f-4698-a7b4-e2005c1368d2")}catch{}})();function b({api:e,fetchTasks:s}){const a=l({state:"idle"}),n=()=>{a.value={state:"idle"}},d=()=>{a.value={state:"creating",name:"My task",payloadCode:`{
    "key": "value"
  }`}},c=async r=>{const t=a.value;if(t.state!=="creating")throw new Error("Payload is required to create a task");if(!o.value)return;const i=JSON.parse(t.payloadCode),f=await e.createTask(t.name,r,i);return await s(),n(),f},o=u(()=>{const r=a.value;if(r.state!=="creating")return!1;try{const t=JSON.parse(r.payloadCode);return y.isObject(t)}catch{return!1}});return{createTask:c,creatingTaskState:a,cancelCreatingTask:n,startCreatingTask:d,isPayloadValid:o}}export{b as T};
//# sourceMappingURL=taskCreator-pcS1n6ma.js.map
