jplan-pack 0.6.642 → 0.6.643

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("vuetify/lib/components/VBtn/index.mjs"),l=require("./index-CK1Qc84f.js"),r={class:"overlay d-flex flex-column align-center justify-center"},c=e.defineComponent({__name:"AuthFailRoute",setup(s){const o=()=>{const n=window.location.pathname.replace("/jplan-auth","");window.location.replace(n)};return(n,t)=>(e.openBlock(),e.createElementBlock("div",r,[t[1]||(t[1]=e.createElementVNode("div",{class:"w-100 text-h5 text-center mb-4"},"Unable to Access. Please allow pop-ups and try again.",-1)),e.createElementVNode("div",null,[e.createVNode(a.VBtn,{variant:"flat",color:"secondary",onClick:o},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode("Login")])),_:1})])]))}}),i=l._export_sfc(c,[["__scopeId","data-v-2004772e"]]);exports.default=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("vuetify/lib/components/VBtn/index.mjs"),l=require("./index-CqH8CLfH.js"),r={class:"overlay d-flex flex-column align-center justify-center"},c=e.defineComponent({__name:"AuthFailRoute",setup(s){const o=()=>{const n=window.location.pathname.replace("/jplan-auth","");window.location.replace(n)};return(n,t)=>(e.openBlock(),e.createElementBlock("div",r,[t[1]||(t[1]=e.createElementVNode("div",{class:"w-100 text-h5 text-center mb-4"},"Unable to Access. Please allow pop-ups and try again.",-1)),e.createElementVNode("div",null,[e.createVNode(a.VBtn,{variant:"flat",color:"secondary",onClick:o},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode("Login")])),_:1})])]))}}),i=l._export_sfc(c,[["__scopeId","data-v-2004772e"]]);exports.default=i;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as a, openBlock as l, createElementBlock as r, createElementVNode as o, createVNode as c, withCtx as s, createTextVNode as i } from "vue";
2
2
  import { VBtn as d } from "vuetify/lib/components/VBtn/index.mjs";
3
- import { _ as p } from "./index-BR15WIpi.mjs";
3
+ import { _ as p } from "./index-rEtGavjD.mjs";
4
4
  const m = { class: "overlay d-flex flex-column align-center justify-center" }, u = /* @__PURE__ */ a({
5
5
  __name: "AuthFailRoute",
6
6
  setup(f) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("@vueuse/core");require("vuetify/lib/components/VBtn/index.mjs");require("vuetify/components");require("vuetify/lib/components/VIcon/index.mjs");const t=require("./index-CK1Qc84f.js");require("vuetify/lib/components/VCard/index.mjs");require("vuetify/lib/components/VDialog/index.mjs");require("vuetify/lib/components/VDivider/index.mjs");require("vuetify/lib/components/VGrid/index.mjs");require("vuetify/lib/components/VAvatar/index.mjs");require("vuetify/lib/components/VImg/index.mjs");require("vuetify/lib/components/VList/index.mjs");require("vuetify/lib/components/VMenu/index.mjs");require("vuetify/lib/components/VDataTable/index.mjs");require("vuetify/lib/components/VTextField/index.mjs");require("vuetify/lib/components/VSelect/index.mjs");require("vuetify/lib/components/VCheckbox/index.mjs");require("vuetify/lib/components/VChip/index.mjs");require("vuetify/lib/components/VLabel/index.mjs");require("vuetify/lib/components/VTextarea/index.mjs");require("vuetify/lib/components/VBtnToggle/index.mjs");const c={class:"overlay"},l={class:"text-white"},d={class:"text-white"},q=e.defineComponent({__name:"AuthRoute",setup(p){const s=r=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:window.location.href,extraQueryParameters:r}),i=e.ref(!1);async function u(){t.msal.getAllAccounts().length===0&&(i.value=!0);const r=await t.msal.handleRedirectPromise();if(!r){await t.msal.initialize();const n=s();await t.msal.loginRedirect(n);return}t.msal.setActiveAccount(r.account)}e.onMounted(async()=>{await t.msal.initialize(),await u()});const o=[{title:"Authenticating...",subtitle:"Please wait."},{title:"Authorized",subtitle:"If this window don't closed automatically, you can close it now."}],a=e.computed(()=>i.value?o[0]:o[1]);return(r,n)=>(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("h3",l,e.toDisplayString(a.value.title),1),e.createVNode(e.unref(t.SpinnerLoader)),e.createElementVNode("p",d,e.toDisplayString(a.value.subtitle),1)]))}}),m=t._export_sfc(q,[["__scopeId","data-v-b7679fd7"]]);exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("@vueuse/core");require("vuetify/lib/components/VBtn/index.mjs");require("vuetify/components");require("vuetify/lib/components/VIcon/index.mjs");const t=require("./index-CqH8CLfH.js");require("vuetify/lib/components/VCard/index.mjs");require("vuetify/lib/components/VDialog/index.mjs");require("vuetify/lib/components/VDivider/index.mjs");require("vuetify/lib/components/VGrid/index.mjs");require("vuetify/lib/components/VAvatar/index.mjs");require("vuetify/lib/components/VImg/index.mjs");require("vuetify/lib/components/VList/index.mjs");require("vuetify/lib/components/VMenu/index.mjs");require("vuetify/lib/components/VDataTable/index.mjs");require("vuetify/lib/components/VTextField/index.mjs");require("vuetify/lib/components/VSelect/index.mjs");require("vuetify/lib/components/VCheckbox/index.mjs");require("vuetify/lib/components/VChip/index.mjs");require("vuetify/lib/components/VLabel/index.mjs");require("vuetify/lib/components/VTextarea/index.mjs");require("vuetify/lib/components/VBtnToggle/index.mjs");const c={class:"overlay"},l={class:"text-white"},d={class:"text-white"},q=e.defineComponent({__name:"AuthRoute",setup(p){const s=r=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:window.location.href,extraQueryParameters:r}),i=e.ref(!1);async function u(){t.msal.getAllAccounts().length===0&&(i.value=!0);const r=await t.msal.handleRedirectPromise();if(!r){await t.msal.initialize();const n=s();await t.msal.loginRedirect(n);return}t.msal.setActiveAccount(r.account)}e.onMounted(async()=>{await t.msal.initialize(),await u()});const o=[{title:"Authenticating...",subtitle:"Please wait."},{title:"Authorized",subtitle:"If this window don't closed automatically, you can close it now."}],a=e.computed(()=>i.value?o[0]:o[1]);return(r,n)=>(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("h3",l,e.toDisplayString(a.value.title),1),e.createVNode(e.unref(t.SpinnerLoader)),e.createElementVNode("p",d,e.toDisplayString(a.value.subtitle),1)]))}}),m=t._export_sfc(q,[["__scopeId","data-v-b7679fd7"]]);exports.default=m;
@@ -3,7 +3,7 @@ import "@vueuse/core";
3
3
  import "vuetify/lib/components/VBtn/index.mjs";
4
4
  import "vuetify/components";
5
5
  import "vuetify/lib/components/VIcon/index.mjs";
6
- import { m as t, S as g, _ as v } from "./index-BR15WIpi.mjs";
6
+ import { m as t, S as g, _ as v } from "./index-rEtGavjD.mjs";
7
7
  import "vuetify/lib/components/VCard/index.mjs";
8
8
  import "vuetify/lib/components/VDialog/index.mjs";
9
9
  import "vuetify/lib/components/VDivider/index.mjs";
@@ -63,7 +63,7 @@ ${l}`);return}throw pp(e.error,e.error_description,e.suberror)?new Vn(e.error,e.
63
63
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[Dp]=this[Dp]={accessors:{}}).accessors,i=this.prototype;function s(l){const d=ji(l);n[d]||(_B(i,l),n[d]=!0)}return O.isArray(e)?e.forEach(s):s(e),this}}Ht.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);O.reduceDescriptors(Ht.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}});O.freezeMethods(Ht);function Ku(r,e){const t=this||ka,n=e||t,i=Ht.from(n.headers);let s=n.data;return O.forEach(r,function(d){s=d.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Sw(r){return!!(r&&r.__CANCEL__)}function _i(r,e,t){ue.call(this,r??"canceled",ue.ERR_CANCELED,e,t),this.name="CanceledError"}O.inherits(_i,ue,{__CANCEL__:!0});function Aw(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new ue("Request failed with status code "+t.status,[ue.ERR_BAD_REQUEST,ue.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function TB(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function EB(r,e){r=r||10;const t=new Array(r),n=new Array(r);let i=0,s=0,l;return e=e!==void 0?e:1e3,function(f){const g=Date.now(),m=n[s];l||(l=g),t[i]=f,n[i]=g;let w=s,v=0;for(;w!==i;)v+=t[w++],w=w%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),g-l<e)return;const E=m&&g-m;return E?Math.round(v*1e3/E):void 0}}function SB(r,e){let t=0,n=1e3/e,i,s;const l=(g,m=Date.now())=>{t=m,i=null,s&&(clearTimeout(s),s=null),r.apply(null,g)};return[(...g)=>{const m=Date.now(),w=m-t;w>=n?l(g,m):(i=g,s||(s=setTimeout(()=>{s=null,l(i)},n-w)))},()=>i&&l(i)]}const yc=(r,e,t=3)=>{let n=0;const i=EB(50,250);return SB(s=>{const l=s.loaded,d=s.lengthComputable?s.total:void 0,f=l-n,g=i(f),m=l<=d;n=l;const w={loaded:l,total:d,progress:d?l/d:void 0,bytes:f,rate:g||void 0,estimated:g&&d&&m?(d-l)/g:void 0,event:s,lengthComputable:d!=null,[e?"download":"upload"]:!0};r(w)},t)},Lp=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Bp=r=>(...e)=>O.asap(()=>r(...e)),AB=kt.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,kt.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(kt.origin),kt.navigator&&/(msie|trident)/i.test(kt.navigator.userAgent)):()=>!0,bB=kt.hasStandardBrowserEnv?{write(r,e,t,n,i,s){const l=[r+"="+encodeURIComponent(e)];O.isNumber(t)&&l.push("expires="+new Date(t).toGMTString()),O.isString(n)&&l.push("path="+n),O.isString(i)&&l.push("domain="+i),s===!0&&l.push("secure"),document.cookie=l.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function IB(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function kB(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function bw(r,e){return r&&!IB(e)?kB(r,e):e}const Up=r=>r instanceof Ht?{...r}:r;function Co(r,e){e=e||{};const t={};function n(g,m,w,v){return O.isPlainObject(g)&&O.isPlainObject(m)?O.merge.call({caseless:v},g,m):O.isPlainObject(m)?O.merge({},m):O.isArray(m)?m.slice():m}function i(g,m,w,v){if(O.isUndefined(m)){if(!O.isUndefined(g))return n(void 0,g,w,v)}else return n(g,m,w,v)}function s(g,m){if(!O.isUndefined(m))return n(void 0,m)}function l(g,m){if(O.isUndefined(m)){if(!O.isUndefined(g))return n(void 0,g)}else return n(void 0,m)}function d(g,m,w){if(w in e)return n(g,m);if(w in r)return n(void 0,g)}const f={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:d,headers:(g,m,w)=>i(Up(g),Up(m),w,!0)};return O.forEach(Object.keys(Object.assign({},r,e)),function(m){const w=f[m]||i,v=w(r[m],e[m],m);O.isUndefined(v)&&w!==d||(t[m]=v)}),t}const Iw=r=>{const e=Co({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:l,auth:d}=e;e.headers=l=Ht.from(l),e.url=_w(bw(e.baseURL,e.url),r.params,r.paramsSerializer),d&&l.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let f;if(O.isFormData(t)){if(kt.hasStandardBrowserEnv||kt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if((f=l.getContentType())!==!1){const[g,...m]=f?f.split(";").map(w=>w.trim()).filter(Boolean):[];l.setContentType([g||"multipart/form-data",...m].join("; "))}}if(kt.hasStandardBrowserEnv&&(n&&O.isFunction(n)&&(n=n(e)),n||n!==!1&&AB(e.url))){const g=i&&s&&bB.read(s);g&&l.set(i,g)}return e},RB=typeof XMLHttpRequest<"u",NB=RB&&function(r){return new Promise(function(t,n){const i=Iw(r);let s=i.data;const l=Ht.from(i.headers).normalize();let{responseType:d,onUploadProgress:f,onDownloadProgress:g}=i,m,w,v,E,_;function A(){E&&E(),_&&_(),i.cancelToken&&i.cancelToken.unsubscribe(m),i.signal&&i.signal.removeEventListener("abort",m)}let R=new XMLHttpRequest;R.open(i.method.toUpperCase(),i.url,!0),R.timeout=i.timeout;function $(){if(!R)return;const U=Ht.from("getAllResponseHeaders"in R&&R.getAllResponseHeaders()),se={data:!d||d==="text"||d==="json"?R.responseText:R.response,status:R.status,statusText:R.statusText,headers:U,config:r,request:R};Aw(function(z){t(z),A()},function(z){n(z),A()},se),R=null}"onloadend"in R?R.onloadend=$:R.onreadystatechange=function(){!R||R.readyState!==4||R.status===0&&!(R.responseURL&&R.responseURL.indexOf("file:")===0)||setTimeout($)},R.onabort=function(){R&&(n(new ue("Request aborted",ue.ECONNABORTED,r,R)),R=null)},R.onerror=function(){n(new ue("Network Error",ue.ERR_NETWORK,r,R)),R=null},R.ontimeout=function(){let J=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const se=i.transitional||Tw;i.timeoutErrorMessage&&(J=i.timeoutErrorMessage),n(new ue(J,se.clarifyTimeoutError?ue.ETIMEDOUT:ue.ECONNABORTED,r,R)),R=null},s===void 0&&l.setContentType(null),"setRequestHeader"in R&&O.forEach(l.toJSON(),function(J,se){R.setRequestHeader(se,J)}),O.isUndefined(i.withCredentials)||(R.withCredentials=!!i.withCredentials),d&&d!=="json"&&(R.responseType=i.responseType),g&&([v,_]=yc(g,!0),R.addEventListener("progress",v)),f&&R.upload&&([w,E]=yc(f),R.upload.addEventListener("progress",w),R.upload.addEventListener("loadend",E)),(i.cancelToken||i.signal)&&(m=U=>{R&&(n(!U||U.type?new _i(null,r,R):U),R.abort(),R=null)},i.cancelToken&&i.cancelToken.subscribe(m),i.signal&&(i.signal.aborted?m():i.signal.addEventListener("abort",m)));const V=TB(i.url);if(V&&kt.protocols.indexOf(V)===-1){n(new ue("Unsupported protocol "+V+":",ue.ERR_BAD_REQUEST,r));return}R.send(s||null)})},OB=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,i;const s=function(g){if(!i){i=!0,d();const m=g instanceof Error?g:this.reason;n.abort(m instanceof ue?m:new _i(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,s(new ue(`timeout ${e} of ms exceeded`,ue.ETIMEDOUT))},e);const d=()=>{r&&(l&&clearTimeout(l),l=null,r.forEach(g=>{g.unsubscribe?g.unsubscribe(s):g.removeEventListener("abort",s)}),r=null)};r.forEach(g=>g.addEventListener("abort",s));const{signal:f}=n;return f.unsubscribe=()=>O.asap(d),f}},PB=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,i;for(;n<t;)i=n+e,yield r.slice(n,i),n=i},MB=async function*(r,e){for await(const t of xB(r))yield*PB(t,e)},xB=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Vp=(r,e,t,n)=>{const i=MB(r,e);let s=0,l,d=f=>{l||(l=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:g,value:m}=await i.next();if(g){d(),f.close();return}let w=m.byteLength;if(t){let v=s+=w;t(v)}f.enqueue(new Uint8Array(m))}catch(g){throw d(g),g}},cancel(f){return d(f),i.return()}},{highWaterMark:2})},jc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",kw=jc&&typeof ReadableStream=="function",DB=jc&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),Rw=(r,...e)=>{try{return!!r(...e)}catch{return!1}},LB=kw&&Rw(()=>{let r=!1;const e=new Request(kt.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),Fp=64*1024,Pd=kw&&Rw(()=>O.isReadableStream(new Response("").body)),Cc={stream:Pd&&(r=>r.body)};jc&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Cc[e]&&(Cc[e]=O.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new ue(`Response type '${e}' is not supported`,ue.ERR_NOT_SUPPORT,n)})})})(new Response);const BB=async r=>{if(r==null)return 0;if(O.isBlob(r))return r.size;if(O.isSpecCompliantForm(r))return(await new Request(kt.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(O.isArrayBufferView(r)||O.isArrayBuffer(r))return r.byteLength;if(O.isURLSearchParams(r)&&(r=r+""),O.isString(r))return(await DB(r)).byteLength},UB=async(r,e)=>{const t=O.toFiniteNumber(r.getContentLength());return t??BB(e)},VB=jc&&(async r=>{let{url:e,method:t,data:n,signal:i,cancelToken:s,timeout:l,onDownloadProgress:d,onUploadProgress:f,responseType:g,headers:m,withCredentials:w="same-origin",fetchOptions:v}=Iw(r);g=g?(g+"").toLowerCase():"text";let E=OB([i,s&&s.toAbortSignal()],l),_;const A=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let R;try{if(f&&LB&&t!=="get"&&t!=="head"&&(R=await UB(m,n))!==0){let se=new Request(e,{method:"POST",body:n,duplex:"half"}),we;if(O.isFormData(n)&&(we=se.headers.get("content-type"))&&m.setContentType(we),se.body){const[z,tt]=Lp(R,yc(Bp(f)));n=Vp(se.body,Fp,z,tt)}}O.isString(w)||(w=w?"include":"omit");const $="credentials"in Request.prototype;_=new Request(e,{...v,signal:E,method:t.toUpperCase(),headers:m.normalize().toJSON(),body:n,duplex:"half",credentials:$?w:void 0});let V=await fetch(_);const U=Pd&&(g==="stream"||g==="response");if(Pd&&(d||U&&A)){const se={};["status","statusText","headers"].forEach(_e=>{se[_e]=V[_e]});const we=O.toFiniteNumber(V.headers.get("content-length")),[z,tt]=d&&Lp(we,yc(Bp(d),!0))||[];V=new Response(Vp(V.body,Fp,z,()=>{tt&&tt(),A&&A()}),se)}g=g||"text";let J=await Cc[O.findKey(Cc,g)||"text"](V,r);return!U&&A&&A(),await new Promise((se,we)=>{Aw(se,we,{data:J,headers:Ht.from(V.headers),status:V.status,statusText:V.statusText,config:r,request:_})})}catch($){throw A&&A(),$&&$.name==="TypeError"&&/fetch/i.test($.message)?Object.assign(new ue("Network Error",ue.ERR_NETWORK,r,_),{cause:$.cause||$}):ue.from($,$&&$.code,r,_)}}),Md={http:eB,xhr:NB,fetch:VB};O.forEach(Md,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const Hp=r=>`- ${r}`,FB=r=>O.isFunction(r)||r===null||r===!1,Nw={getAdapter:r=>{r=O.isArray(r)?r:[r];const{length:e}=r;let t,n;const i={};for(let s=0;s<e;s++){t=r[s];let l;if(n=t,!FB(t)&&(n=Md[(l=String(t)).toLowerCase()],n===void 0))throw new ue(`Unknown adapter '${l}'`);if(n)break;i[l||"#"+s]=n}if(!n){const s=Object.entries(i).map(([d,f])=>`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let l=e?s.length>1?`since :
64
64
  `+s.map(Hp).join(`
65
65
  `):" "+Hp(s[0]):"as no adapter specified";throw new ue("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return n},adapters:Md};function zu(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new _i(null,r)}function $p(r){return zu(r),r.headers=Ht.from(r.headers),r.data=Ku.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Nw.getAdapter(r.adapter||ka.adapter)(r).then(function(n){return zu(r),n.data=Ku.call(r,r.transformResponse,n),n.headers=Ht.from(n.headers),n},function(n){return Sw(n)||(zu(r),n&&n.response&&(n.response.data=Ku.call(r,r.transformResponse,n.response),n.response.headers=Ht.from(n.response.headers))),Promise.reject(n)})}const Ow="1.7.9",Yc={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Yc[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const Kp={};Yc.transitional=function(e,t,n){function i(s,l){return"[Axios v"+Ow+"] Transitional option '"+s+"'"+l+(n?". "+n:"")}return(s,l,d)=>{if(e===!1)throw new ue(i(l," has been removed"+(t?" in "+t:"")),ue.ERR_DEPRECATED);return t&&!Kp[l]&&(Kp[l]=!0,console.warn(i(l," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,l,d):!0}};Yc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function HB(r,e,t){if(typeof r!="object")throw new ue("options must be an object",ue.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let i=n.length;for(;i-- >0;){const s=n[i],l=e[s];if(l){const d=r[s],f=d===void 0||l(d,s,r);if(f!==!0)throw new ue("option "+s+" must be "+f,ue.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new ue("Unknown option "+s,ue.ERR_BAD_OPTION)}}const Qs={assertOptions:HB,validators:Yc},Gn=Qs.validators;class go{constructor(e){this.defaults=e,this.interceptors={request:new xp,response:new xp}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
66
- `+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Co(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;n!==void 0&&Qs.assertOptions(n,{silentJSONParsing:Gn.transitional(Gn.boolean),forcedJSONParsing:Gn.transitional(Gn.boolean),clarifyTimeoutError:Gn.transitional(Gn.boolean)},!1),i!=null&&(O.isFunction(i)?t.paramsSerializer={serialize:i}:Qs.assertOptions(i,{encode:Gn.function,serialize:Gn.function},!0)),Qs.assertOptions(t,{baseUrl:Gn.spelling("baseURL"),withXsrfToken:Gn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let l=s&&O.merge(s.common,s[t.method]);s&&O.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),t.headers=Ht.concat(l,s);const d=[];let f=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(t)===!1||(f=f&&A.synchronous,d.unshift(A.fulfilled,A.rejected))});const g=[];this.interceptors.response.forEach(function(A){g.push(A.fulfilled,A.rejected)});let m,w=0,v;if(!f){const _=[$p.bind(this),void 0];for(_.unshift.apply(_,d),_.push.apply(_,g),v=_.length,m=Promise.resolve(t);w<v;)m=m.then(_[w++],_[w++]);return m}v=d.length;let E=t;for(w=0;w<v;){const _=d[w++],A=d[w++];try{E=_(E)}catch(R){A.call(this,R);break}}try{m=$p.call(this,E)}catch(_){return Promise.reject(_)}for(w=0,v=g.length;w<v;)m=m.then(g[w++],g[w++]);return m}getUri(e){e=Co(this.defaults,e);const t=bw(e.baseURL,e.url);return _w(t,e.params,e.paramsSerializer)}}O.forEach(["delete","get","head","options"],function(e){go.prototype[e]=function(t,n){return this.request(Co(n||{},{method:e,url:t,data:(n||{}).data}))}});O.forEach(["post","put","patch"],function(e){function t(n){return function(s,l,d){return this.request(Co(d||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:l}))}}go.prototype[e]=t(),go.prototype[e+"Form"]=t(!0)});class Uh{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const l=new Promise(d=>{n.subscribe(d),s=d}).then(i);return l.cancel=function(){n.unsubscribe(s)},l},e(function(s,l,d){n.reason||(n.reason=new _i(s,l,d),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Uh(function(i){e=i}),cancel:e}}}function $B(r){return function(t){return r.apply(null,t)}}function KB(r){return O.isObject(r)&&r.isAxiosError===!0}const xd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xd).forEach(([r,e])=>{xd[e]=r});function Pw(r){const e=new go(r),t=lw(go.prototype.request,e);return O.extend(t,go.prototype,e,{allOwnKeys:!0}),O.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Pw(Co(r,i))},t}const Ke=Pw(ka);Ke.Axios=go;Ke.CanceledError=_i;Ke.CancelToken=Uh;Ke.isCancel=Sw;Ke.VERSION=Ow;Ke.toFormData=Gc;Ke.AxiosError=ue;Ke.Cancel=Ke.CanceledError;Ke.all=function(e){return Promise.all(e)};Ke.spread=$B;Ke.isAxiosError=KB;Ke.mergeConfig=Co;Ke.AxiosHeaders=Ht;Ke.formToJSON=r=>Ew(O.isHTMLForm(r)?new FormData(r):r);Ke.getAdapter=Nw.getAdapter;Ke.HttpStatusCode=xd;Ke.default=Ke;const{jToken:zp}=sw(),Vh=()=>{const r=Ke.create({headers:{"Content-Type":"application/json"}});c.watch(zp,i=>{r.interceptors.request.use(s=>(i&&(s.headers.Authorization=`Bearer ${i}`),s))},{immediate:!0});let e=1;r.interceptors.response.use(async i=>i,async i=>{var s;if(i.config&&i.config.headers){const l=i.config;if(((s=i.response)==null?void 0:s.status)===401&&e>0){e--;try{return l.headers.Authorization=`Bearer ${zp.value}`,await r(l)}catch(d){return Promise.reject(d)}}}return Promise.reject(i)});async function t({url:i,method:s,header:l={},body:d,baseURL:f}){try{return f&&(r.defaults.baseURL=f),(await r({url:i,method:s,headers:l,data:d})).data}catch(g){if(console.error(`Request error [${s} ${i}]:`,g),Ke.isAxiosError(g)){const{response:m,message:w}=g;throw new Error(`Axios error: ${w}, Status: ${m==null?void 0:m.status}, URL: ${i}`)}throw g}}async function n({url:i,method:s,header:l,body:d,baseURL:f}){try{f&&(r.defaults.baseURL=f);const g=await r({url:i,method:s,headers:l,data:d});return{status:g.status,header:g.headers,body:g.data}}catch(g){if(Ke.isAxiosError(g)){const{response:m,message:w}=g;console.error(`Raw Request Error: ${w}, Status: ${m==null?void 0:m.status}`)}return Promise.reject(g)}}return Object.assign(r,{_request:t,rawRequest:n})},{request:Wp}=Vh(),qp=c.ref(null),Gp=c.ref("default"),Wu=c.ref(null),qu=c.ref({scope_type:"org"});function Jc(){var v,E;const{handleRedirect:r,account:e,logout:t}=xh(),n=(E=(v=e.value)==null?void 0:v.idTokenClaims)==null?void 0:E.domain,i=c.computed(()=>({domain:n,environment:Gp.value,...qu.value})),s=c.computed(()=>qu.value);async function l(){var _;(!e.value||!((_=e.value.idTokenClaims)!=null&&_.email))&&await r();try{await d(),await f()}catch{}}async function d(){var _,A;try{const R=(A=(_=e.value)==null?void 0:_.idTokenClaims)==null?void 0:A.email;if(!R)throw new Error("Email is undefined");const $=await Wp({url:`https://api.jplan.com.br/platform/user/profile/?email=${R}`,method:"GET"});Wu.value=$.data??null}catch(R){console.error("Failed to fetch user profile:",R)}}async function f(){var _;try{if(!((_=Wu.value)!=null&&_.email))throw new Error("User email is undefined");const A=await Wp({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});qp.value=A.data??[]}catch(A){console.error("Failed to fetch user domains:",A)}}function g(_){qu.value=_}function m(_){Gp.value=_,g(i.value)}async function w(_,A){const R=aw(_,{request_domain:A});await yt.loginRedirect(R)}return{__init__:l,user:Wu,userDomains:qp,setEnv:m,setScope:g,changeDomain:w,session:i,scope:s,logout:t}}var xs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zB(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ea={exports:{}};/**
66
+ `+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Co(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;n!==void 0&&Qs.assertOptions(n,{silentJSONParsing:Gn.transitional(Gn.boolean),forcedJSONParsing:Gn.transitional(Gn.boolean),clarifyTimeoutError:Gn.transitional(Gn.boolean)},!1),i!=null&&(O.isFunction(i)?t.paramsSerializer={serialize:i}:Qs.assertOptions(i,{encode:Gn.function,serialize:Gn.function},!0)),Qs.assertOptions(t,{baseUrl:Gn.spelling("baseURL"),withXsrfToken:Gn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let l=s&&O.merge(s.common,s[t.method]);s&&O.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),t.headers=Ht.concat(l,s);const d=[];let f=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(t)===!1||(f=f&&A.synchronous,d.unshift(A.fulfilled,A.rejected))});const g=[];this.interceptors.response.forEach(function(A){g.push(A.fulfilled,A.rejected)});let m,w=0,v;if(!f){const _=[$p.bind(this),void 0];for(_.unshift.apply(_,d),_.push.apply(_,g),v=_.length,m=Promise.resolve(t);w<v;)m=m.then(_[w++],_[w++]);return m}v=d.length;let E=t;for(w=0;w<v;){const _=d[w++],A=d[w++];try{E=_(E)}catch(R){A.call(this,R);break}}try{m=$p.call(this,E)}catch(_){return Promise.reject(_)}for(w=0,v=g.length;w<v;)m=m.then(g[w++],g[w++]);return m}getUri(e){e=Co(this.defaults,e);const t=bw(e.baseURL,e.url);return _w(t,e.params,e.paramsSerializer)}}O.forEach(["delete","get","head","options"],function(e){go.prototype[e]=function(t,n){return this.request(Co(n||{},{method:e,url:t,data:(n||{}).data}))}});O.forEach(["post","put","patch"],function(e){function t(n){return function(s,l,d){return this.request(Co(d||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:l}))}}go.prototype[e]=t(),go.prototype[e+"Form"]=t(!0)});class Uh{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const l=new Promise(d=>{n.subscribe(d),s=d}).then(i);return l.cancel=function(){n.unsubscribe(s)},l},e(function(s,l,d){n.reason||(n.reason=new _i(s,l,d),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Uh(function(i){e=i}),cancel:e}}}function $B(r){return function(t){return r.apply(null,t)}}function KB(r){return O.isObject(r)&&r.isAxiosError===!0}const xd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xd).forEach(([r,e])=>{xd[e]=r});function Pw(r){const e=new go(r),t=lw(go.prototype.request,e);return O.extend(t,go.prototype,e,{allOwnKeys:!0}),O.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Pw(Co(r,i))},t}const Ke=Pw(ka);Ke.Axios=go;Ke.CanceledError=_i;Ke.CancelToken=Uh;Ke.isCancel=Sw;Ke.VERSION=Ow;Ke.toFormData=Gc;Ke.AxiosError=ue;Ke.Cancel=Ke.CanceledError;Ke.all=function(e){return Promise.all(e)};Ke.spread=$B;Ke.isAxiosError=KB;Ke.mergeConfig=Co;Ke.AxiosHeaders=Ht;Ke.formToJSON=r=>Ew(O.isHTMLForm(r)?new FormData(r):r);Ke.getAdapter=Nw.getAdapter;Ke.HttpStatusCode=xd;Ke.default=Ke;const{jToken:zp}=sw(),Vh=()=>{const r=Ke.create({headers:{"Content-Type":"application/json"}});c.watch(zp,i=>{r.interceptors.request.use(s=>(i&&(s.headers.Authorization=`Bearer ${i}`),s))},{immediate:!0});let e=1;r.interceptors.response.use(async i=>i,async i=>{var s;if(i.config&&i.config.headers){const l=i.config;if(((s=i.response)==null?void 0:s.status)===401&&e>0){e--;try{return l.headers.Authorization=`Bearer ${zp.value}`,await r(l)}catch(d){return Promise.reject(d)}}}return Promise.reject(i)});async function t({url:i,method:s,header:l={},body:d,baseURL:f}){try{return f&&(r.defaults.baseURL=f),(await r({url:i,method:s,headers:l,data:d})).data}catch(g){if(console.error(`Request error [${s} ${i}]:`,g),Ke.isAxiosError(g)){const{response:m,message:w}=g;throw new Error(`Axios error: ${w}, Status: ${m==null?void 0:m.status}, URL: ${i}`)}throw g}}async function n({url:i,method:s,header:l,body:d,baseURL:f}){try{f&&(r.defaults.baseURL=f);const g=await r({url:i,method:s,headers:l,data:d});return{status:g.status,header:g.headers,body:g.data}}catch(g){if(Ke.isAxiosError(g)){const{response:m,message:w}=g;console.error(`Raw Request Error: ${w}, Status: ${m==null?void 0:m.status}`)}return Promise.reject(g)}}return Object.assign(r,{_request:t,rawRequest:n})},{request:Wp}=Vh(),qp=c.ref(null),Gp=c.ref("default"),Wu=c.ref(null),qu=c.ref({scope_type:"org"});function Jc(){var v,E;const{handleRedirect:r,account:e,logout:t}=xh(),n=(E=(v=e.value)==null?void 0:v.idTokenClaims)==null?void 0:E.domain,i=c.computed(()=>({domain:n,environment:Gp.value,...qu.value})),s=c.computed(()=>qu.value);async function l(){var _;(!e.value||!((_=e.value.idTokenClaims)!=null&&_.email))&&await r();try{await d(),await f()}catch{}}async function d(){var _,A;try{const R=(A=(_=e.value)==null?void 0:_.idTokenClaims)==null?void 0:A.email;if(!R)throw new Error("Email is undefined");const $=await Wp({url:`https://api.jplan.com.br/platform/user/profile/?email=${R}`,method:"GET"});Wu.value=$.data??null}catch(R){console.error("Failed to fetch user profile:",R)}}async function f(){var _;try{if(!((_=Wu.value)!=null&&_.email))throw new Error("User email is undefined");const A=await Wp({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});qp.value=A.data.data??[]}catch(A){console.error("Failed to fetch user domains:",A)}}function g(_){qu.value=_}function m(_){Gp.value=_,g(i.value)}async function w(_,A){const R=aw(_,{request_domain:A});await yt.loginRedirect(R)}return{__init__:l,user:Wu,userDomains:qp,setEnv:m,setScope:g,changeDomain:w,session:i,scope:s,logout:t}}var xs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zB(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ea={exports:{}};/**
67
67
  * @license
68
68
  * Lodash <https://lodash.com/>
69
69
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -89,4 +89,4 @@ __p += '`),ve&&(L+=`' +
89
89
  function print() { __p += __j.call(arguments, '') }
90
90
  `:`;
91
91
  `)+L+`return __p
92
- }`;var he=mm(function(){return Ee(C,Y+"return "+L).apply(t,T)});if(he.source=L,cu(he))throw he;return he}function MI(o){return Ae(o).toLowerCase()}function xI(o){return Ae(o).toUpperCase()}function DI(o,a,u){if(o=Ae(o),o&&(u||a===t))return Sf(o);if(!o||!(a=Wt(a)))return o;var h=kn(o),p=kn(a),C=Af(h,p),T=bf(h,p)+1;return Pr(h,C,T).join("")}function LI(o,a,u){if(o=Ae(o),o&&(u||a===t))return o.slice(0,kf(o)+1);if(!o||!(a=Wt(a)))return o;var h=kn(o),p=bf(h,kn(a))+1;return Pr(h,0,p).join("")}function BI(o,a,u){if(o=Ae(o),o&&(u||a===t))return o.replace(cl,"");if(!o||!(a=Wt(a)))return o;var h=kn(o),p=Af(h,kn(a));return Pr(h,p).join("")}function UI(o,a){var u=j,h=q;if($e(a)){var p="separator"in a?a.separator:p;u="length"in a?de(a.length):u,h="omission"in a?Wt(a.omission):h}o=Ae(o);var C=o.length;if(bo(o)){var T=kn(o);C=T.length}if(u>=C)return o;var S=u-Io(h);if(S<1)return h;var I=T?Pr(T,0,S).join(""):o.slice(0,S);if(p===t)return I+h;if(T&&(S+=I.length-S),lu(p)){if(o.slice(S).search(p)){var x,D=I;for(p.global||(p=Al(p.source,Ae(Wh.exec(p))+"g")),p.lastIndex=0;x=p.exec(D);)var L=x.index;I=I.slice(0,L===t?S:L)}}else if(o.indexOf(Wt(p),S)!=S){var K=I.lastIndexOf(p);K>-1&&(I=I.slice(0,K))}return I+h}function VI(o){return o=Ae(o),o&&Jw.test(o)?o.replace($h,gT):o}var FI=xo(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),hu=pg("toUpperCase");function gm(o,a,u){return o=Ae(o),a=u?t:a,a===t?lT(o)?vT(o):eT(o):o.match(a)||[]}var mm=fe(function(o,a){try{return Kt(o,t,a)}catch(u){return cu(u)?u:new ae(u)}}),HI=lr(function(o,a){return cn(a,function(u){u=Wn(u),sr(o,u,au(o[u],o))}),o});function $I(o){var a=o==null?0:o.length,u=X();return o=a?Ve(o,function(h){if(typeof h[1]!="function")throw new ln(l);return[u(h[0]),h[1]]}):[],fe(function(h){for(var p=-1;++p<a;){var C=o[p];if(Kt(C[0],this,h))return Kt(C[1],this,h)}})}function KI(o){return gE(dn(o,w))}function fu(o){return function(){return o}}function zI(o,a){return o==null||o!==o?a:o}var WI=yg(),qI=yg(!0);function Ut(o){return o}function gu(o){return jf(typeof o=="function"?o:dn(o,w))}function GI(o){return Jf(dn(o,w))}function jI(o,a){return Qf(o,dn(a,w))}var YI=fe(function(o,a){return function(u){return Hi(u,o,a)}}),JI=fe(function(o,a){return function(u){return Hi(o,u,a)}});function mu(o,a,u){var h=st(a),p=ts(a,h);u==null&&!($e(a)&&(p.length||!h.length))&&(u=a,a=o,o=this,p=ts(a,st(a)));var C=!($e(u)&&"chain"in u)||!!u.chain,T=dr(o);return cn(p,function(S){var I=a[S];o[S]=I,T&&(o.prototype[S]=function(){var x=this.__chain__;if(C||x){var D=o(this.__wrapped__),L=D.__actions__=Dt(this.__actions__);return L.push({func:I,args:arguments,thisArg:o}),D.__chain__=x,D}return I.apply(o,br([this.value()],arguments))})}),o}function QI(){return ht._===this&&(ht._=ET),this}function pu(){}function XI(o){return o=de(o),fe(function(a){return Xf(a,o)})}var ZI=Gl(Ve),ek=Gl(Cf),tk=Gl(yl);function pm(o){return eu(o)?Cl(Wn(o)):OE(o)}function nk(o){return function(a){return o==null?t:Zr(o,a)}}var rk=wg(),ok=wg(!0);function vu(){return[]}function yu(){return!1}function ik(){return{}}function ak(){return""}function sk(){return!0}function ck(o,a){if(o=de(o),o<1||o>Qe)return[];var u=$t,h=_t(o,$t);a=X(a),o-=$t;for(var p=Tl(h,a);++u<o;)a(u);return p}function lk(o){return ce(o)?Ve(o,Wn):qt(o)?[o]:Dt(Lg(Ae(o)))}function uk(o){var a=++_T;return Ae(o)+a}var dk=ss(function(o,a){return o+a},0),hk=jl("ceil"),fk=ss(function(o,a){return o/a},1),gk=jl("floor");function mk(o){return o&&o.length?es(o,Ut,Ml):t}function pk(o,a){return o&&o.length?es(o,X(a,2),Ml):t}function vk(o){return Tf(o,Ut)}function yk(o,a){return Tf(o,X(a,2))}function Ck(o){return o&&o.length?es(o,Ut,Bl):t}function wk(o,a){return o&&o.length?es(o,X(a,2),Bl):t}var _k=ss(function(o,a){return o*a},1),Tk=jl("round"),Ek=ss(function(o,a){return o-a},0);function Sk(o){return o&&o.length?_l(o,Ut):0}function Ak(o,a){return o&&o.length?_l(o,X(a,2)):0}return y.after=GA,y.ary=Gg,y.assign=xb,y.assignIn=sm,y.assignInWith=ws,y.assignWith=Db,y.at=Lb,y.before=jg,y.bind=au,y.bindAll=HI,y.bindKey=Yg,y.castArray=ib,y.chain=zg,y.chunk=gS,y.compact=mS,y.concat=pS,y.cond=$I,y.conforms=KI,y.constant=fu,y.countBy=SA,y.create=Bb,y.curry=Jg,y.curryRight=Qg,y.debounce=Xg,y.defaults=Ub,y.defaultsDeep=Vb,y.defer=jA,y.delay=YA,y.difference=vS,y.differenceBy=yS,y.differenceWith=CS,y.drop=wS,y.dropRight=_S,y.dropRightWhile=TS,y.dropWhile=ES,y.fill=SS,y.filter=bA,y.flatMap=RA,y.flatMapDeep=NA,y.flatMapDepth=OA,y.flatten=Fg,y.flattenDeep=AS,y.flattenDepth=bS,y.flip=JA,y.flow=WI,y.flowRight=qI,y.fromPairs=IS,y.functions=qb,y.functionsIn=Gb,y.groupBy=PA,y.initial=RS,y.intersection=NS,y.intersectionBy=OS,y.intersectionWith=PS,y.invert=Yb,y.invertBy=Jb,y.invokeMap=xA,y.iteratee=gu,y.keyBy=DA,y.keys=st,y.keysIn=Bt,y.map=gs,y.mapKeys=Xb,y.mapValues=Zb,y.matches=GI,y.matchesProperty=jI,y.memoize=ps,y.merge=eI,y.mergeWith=cm,y.method=YI,y.methodOf=JI,y.mixin=mu,y.negate=vs,y.nthArg=XI,y.omit=tI,y.omitBy=nI,y.once=QA,y.orderBy=LA,y.over=ZI,y.overArgs=XA,y.overEvery=ek,y.overSome=tk,y.partial=su,y.partialRight=Zg,y.partition=BA,y.pick=rI,y.pickBy=lm,y.property=pm,y.propertyOf=nk,y.pull=LS,y.pullAll=$g,y.pullAllBy=BS,y.pullAllWith=US,y.pullAt=VS,y.range=rk,y.rangeRight=ok,y.rearg=ZA,y.reject=FA,y.remove=FS,y.rest=eb,y.reverse=ou,y.sampleSize=$A,y.set=iI,y.setWith=aI,y.shuffle=KA,y.slice=HS,y.sortBy=qA,y.sortedUniq=jS,y.sortedUniqBy=YS,y.split=RI,y.spread=tb,y.tail=JS,y.take=QS,y.takeRight=XS,y.takeRightWhile=ZS,y.takeWhile=eA,y.tap=mA,y.throttle=nb,y.thru=fs,y.toArray=om,y.toPairs=um,y.toPairsIn=dm,y.toPath=lk,y.toPlainObject=am,y.transform=sI,y.unary=rb,y.union=tA,y.unionBy=nA,y.unionWith=rA,y.uniq=oA,y.uniqBy=iA,y.uniqWith=aA,y.unset=cI,y.unzip=iu,y.unzipWith=Kg,y.update=lI,y.updateWith=uI,y.values=Bo,y.valuesIn=dI,y.without=sA,y.words=gm,y.wrap=ob,y.xor=cA,y.xorBy=lA,y.xorWith=uA,y.zip=dA,y.zipObject=hA,y.zipObjectDeep=fA,y.zipWith=gA,y.entries=um,y.entriesIn=dm,y.extend=sm,y.extendWith=ws,mu(y,y),y.add=dk,y.attempt=mm,y.camelCase=mI,y.capitalize=hm,y.ceil=hk,y.clamp=hI,y.clone=ab,y.cloneDeep=cb,y.cloneDeepWith=lb,y.cloneWith=sb,y.conformsTo=ub,y.deburr=fm,y.defaultTo=zI,y.divide=fk,y.endsWith=pI,y.eq=Nn,y.escape=vI,y.escapeRegExp=yI,y.every=AA,y.find=IA,y.findIndex=Ug,y.findKey=Fb,y.findLast=kA,y.findLastIndex=Vg,y.findLastKey=Hb,y.floor=gk,y.forEach=Wg,y.forEachRight=qg,y.forIn=$b,y.forInRight=Kb,y.forOwn=zb,y.forOwnRight=Wb,y.get=uu,y.gt=db,y.gte=hb,y.has=jb,y.hasIn=du,y.head=Hg,y.identity=Ut,y.includes=MA,y.indexOf=kS,y.inRange=fI,y.invoke=Qb,y.isArguments=no,y.isArray=ce,y.isArrayBuffer=fb,y.isArrayLike=Lt,y.isArrayLikeObject=je,y.isBoolean=gb,y.isBuffer=Mr,y.isDate=mb,y.isElement=pb,y.isEmpty=vb,y.isEqual=yb,y.isEqualWith=Cb,y.isError=cu,y.isFinite=wb,y.isFunction=dr,y.isInteger=em,y.isLength=ys,y.isMap=tm,y.isMatch=_b,y.isMatchWith=Tb,y.isNaN=Eb,y.isNative=Sb,y.isNil=bb,y.isNull=Ab,y.isNumber=nm,y.isObject=$e,y.isObjectLike=ze,y.isPlainObject=Gi,y.isRegExp=lu,y.isSafeInteger=Ib,y.isSet=rm,y.isString=Cs,y.isSymbol=qt,y.isTypedArray=Lo,y.isUndefined=kb,y.isWeakMap=Rb,y.isWeakSet=Nb,y.join=MS,y.kebabCase=CI,y.last=fn,y.lastIndexOf=xS,y.lowerCase=wI,y.lowerFirst=_I,y.lt=Ob,y.lte=Pb,y.max=mk,y.maxBy=pk,y.mean=vk,y.meanBy=yk,y.min=Ck,y.minBy=wk,y.stubArray=vu,y.stubFalse=yu,y.stubObject=ik,y.stubString=ak,y.stubTrue=sk,y.multiply=_k,y.nth=DS,y.noConflict=QI,y.noop=pu,y.now=ms,y.pad=TI,y.padEnd=EI,y.padStart=SI,y.parseInt=AI,y.random=gI,y.reduce=UA,y.reduceRight=VA,y.repeat=bI,y.replace=II,y.result=oI,y.round=Tk,y.runInContext=b,y.sample=HA,y.size=zA,y.snakeCase=kI,y.some=WA,y.sortedIndex=$S,y.sortedIndexBy=KS,y.sortedIndexOf=zS,y.sortedLastIndex=WS,y.sortedLastIndexBy=qS,y.sortedLastIndexOf=GS,y.startCase=NI,y.startsWith=OI,y.subtract=Ek,y.sum=Sk,y.sumBy=Ak,y.template=PI,y.times=ck,y.toFinite=hr,y.toInteger=de,y.toLength=im,y.toLower=MI,y.toNumber=gn,y.toSafeInteger=Mb,y.toString=Ae,y.toUpper=xI,y.trim=DI,y.trimEnd=LI,y.trimStart=BI,y.truncate=UI,y.unescape=VI,y.uniqueId=uk,y.upperCase=FI,y.upperFirst=hu,y.each=Wg,y.eachRight=qg,y.first=Hg,mu(y,function(){var o={};return Kn(y,function(a,u){Ie.call(y.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),y.VERSION=n,cn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){y[o].placeholder=y}),cn(["drop","take"],function(o,a){pe.prototype[o]=function(u){u=u===t?1:rt(de(u),0);var h=this.__filtered__&&!a?new pe(this):this.clone();return h.__filtered__?h.__takeCount__=_t(u,h.__takeCount__):h.__views__.push({size:_t(u,$t),type:o+(h.__dir__<0?"Right":"")}),h},pe.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),cn(["filter","map","takeWhile"],function(o,a){var u=a+1,h=u==Ct||u==an;pe.prototype[o]=function(p){var C=this.clone();return C.__iteratees__.push({iteratee:X(p,3),type:u}),C.__filtered__=C.__filtered__||h,C}}),cn(["head","last"],function(o,a){var u="take"+(a?"Right":"");pe.prototype[o]=function(){return this[u](1).value()[0]}}),cn(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");pe.prototype[o]=function(){return this.__filtered__?new pe(this):this[u](1)}}),pe.prototype.compact=function(){return this.filter(Ut)},pe.prototype.find=function(o){return this.filter(o).head()},pe.prototype.findLast=function(o){return this.reverse().find(o)},pe.prototype.invokeMap=fe(function(o,a){return typeof o=="function"?new pe(this):this.map(function(u){return Hi(u,o,a)})}),pe.prototype.reject=function(o){return this.filter(vs(X(o)))},pe.prototype.slice=function(o,a){o=de(o);var u=this;return u.__filtered__&&(o>0||a<0)?new pe(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==t&&(a=de(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},pe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},pe.prototype.toArray=function(){return this.take($t)},Kn(pe.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),p=y[h?"take"+(a=="last"?"Right":""):a],C=h||/^find/.test(a);p&&(y.prototype[a]=function(){var T=this.__wrapped__,S=h?[1]:arguments,I=T instanceof pe,x=S[0],D=I||ce(T),L=function(me){var ve=p.apply(y,br([me],S));return h&&K?ve[0]:ve};D&&u&&typeof x=="function"&&x.length!=1&&(I=D=!1);var K=this.__chain__,Y=!!this.__actions__.length,Z=C&&!K,he=I&&!Y;if(!C&&D){T=he?T:new pe(this);var ee=o.apply(T,S);return ee.__actions__.push({func:fs,args:[L],thisArg:t}),new un(ee,K)}return Z&&he?o.apply(this,S):(ee=this.thru(L),Z?h?ee.value()[0]:ee.value():ee)})}),cn(["pop","push","shift","sort","splice","unshift"],function(o){var a=Va[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);y.prototype[o]=function(){var p=arguments;if(h&&!this.__chain__){var C=this.value();return a.apply(ce(C)?C:[],p)}return this[u](function(T){return a.apply(ce(T)?T:[],p)})}}),Kn(pe.prototype,function(o,a){var u=y[a];if(u){var h=u.name+"";Ie.call(Oo,h)||(Oo[h]=[]),Oo[h].push({name:a,func:u})}}),Oo[as(t,$).name]=[{name:"wrapper",func:t}],pe.prototype.clone=VT,pe.prototype.reverse=FT,pe.prototype.value=HT,y.prototype.at=pA,y.prototype.chain=vA,y.prototype.commit=yA,y.prototype.next=CA,y.prototype.plant=_A,y.prototype.reverse=TA,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=EA,y.prototype.first=y.prototype.head,xi&&(y.prototype[xi]=wA),y},ko=yT();jr?((jr.exports=ko)._=ko,gl._=ko):ht._=ko}).call(WB)}(ea,ea.exports)),ea.exports}var Ti=qB();const Xs=zB(Ti),GB={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-Bgflcka2.js")),meta:{requiresAuth:!1}},jB={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-DONI9kZ0.js")),meta:{requiresAuth:!1}},{isAuthenticated:Yp,handleRedirect:YB}=xh(),JB=Jc();function QB(r,e){r.addRoute(GB),r.addRoute(jB),r.beforeEach(async(t,n,i)=>{function s(d){return d.matched.some(f=>f.meta.requiresAuth)}if(!s(t))return i();if(!Yp.value){ie.value=!0;try{await YB(e,t.fullPath),await JB.__init__()}catch(d){console.error("Fail to authenticate",d),await r.push("/jplan-auth-fail")}ie.value=!1}if(Yp.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),i(d),localStorage.removeItem("returnRoute");return}i()}})}const{scope:Jp}=Jc();function XB(){const r=Vh(),e=c.ref({scope_type:"org"});async function t(n){e.value=n}return c.watch(Jp,()=>{r.interceptors.request.use(n=>{const i=n.headers,s=i.Authorization;s&&(i.Authorization=s);const l=Jp.value;return l&&(l.scope_type&&(i["j-scope-type"]=l.scope_type,l.organization&&(i["j-scope-organization"]=l.organization),l.team&&(i["j-scope-team"]=l.team)),l.environment&&(i["j-scope-environment"]=l.environment)),n})},{immediate:!0}),Object.assign(r,{setScope:t,scope:e})}function Ei(r){const e=XB();e.defaults.baseURL=r;const t=c.ref({scope_type:"org"});async function n(i){t.value=i}return c.watch(t,()=>{e.interceptors.request.use(i=>{const s=t.value;return delete i.headers["j-scope-type"],delete i.headers["j-scope-organization"],delete i.headers["j-scope-team"],s!=null&&s.scope_type&&(i.headers["j-scope-type"]=s.scope_type),s!=null&&s.organization&&(i.headers["j-scope-organization"]=s.organization),s!=null&&s.team&&(i.headers["j-scope-team"]=s.team),i})},{immediate:!0}),Object.assign(e,{setScope:n,scope:t})}function ZB(){const r=Ei("https://api.jplan.com.br/management/organization"),{error:e}=Fn();return{async getOrgList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Organization list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getOrgList:",n),e("Failed to fetch Organization list");return}},async createOrg(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Organization"),s}},async updateOrg(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Organization"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Organization"),s}},async getOrg(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Organization"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Organization"),s}},async activateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in activateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Organization"),s}},async deactivateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Organization"),s}}}}const Vr=ZB();function eU(){const r=Ei("https://api.jplan.com.br/management/branch/"),{error:e}=Fn();return{async getBranchList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error){e("Failed to fetch Branch list");return}return i.data.data}catch(n){console.error("Error in getBranchList:",n),e("Failed to fetch Branch list")}},async createBranch(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){console.error("Error in createBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Branch")}},async updateBranch(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error){e(s.data.error||"Failed to update Branch");return}return s}catch(s){console.error("Error in updateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Branch")}},async getBranch(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error){e(s.data.error||"Failed to fetch Branch");return}return s.data}catch(s){console.error("Error in getBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Branch")}},async activateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error){e(s.data.error||"Failed to activate Branch");return}}catch(s){console.error("Error in activateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Branch")}},async deactivateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error){e(s.data.error||"Failed to deactivate Branch");return}}catch(s){console.error("Error in deactivateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Branch")}}}}const Fr=eU();function tU(){const r=Ei("https://api.jplan.com.br/management/team"),{error:e}=Fn();return{async getTeamList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Team list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getTeamList:",n),e("Failed to fetch Team list");return}},async createTeam(t){var n,i;try{const s=await r.post("/item",t);if(s.data.error)throw e("Failed to create Team"),new Error(s.data.error);return s}catch(s){throw console.error("Error in createTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Team"),s}},async updateTeam(t){var n,i;try{const s=await r.patch("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in updateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Team"),s}},async getTeam(t){var n,i;try{const s=await r.get(`/item/${t}`);return s.data.error&&e("Failed to fetch Team"),s.data}catch(s){console.error("Error in getTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Team");return}},async activateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in activateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Team"),s}},async deactivateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Team"),s}},async getTeamUserList(t,n){try{const i=n?`?filter_query=${n}`:"",s=await r.get(`/item/${t}/user/list/${i}`);if(s.data.error)throw e("Failed to fetch Team User list"),new Error(s.data.error);return s.data.data}catch(i){console.error("Error in getTeamUserList:",i),e("Failed to fetch Team User list");return}},async linkManageUser(t,n){try{const i=await r.post(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to link User"),new Error(i.data.error);return i.data}catch(i){console.error("Error in link User:",i),e("Failed to link User");return}},async updateManageUser(t,n){try{const i=await r.patch(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to update User"),new Error(i.data.error);return i.data.data}catch(i){throw console.error("Error in update User:",i),e("Failed to update User"),i}},async getManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"",l=await r.get(`/item/${t}/user/item/${n}/${s}`);if(l.data.error)throw e("Failed to fetch User"),new Error(l.data.error);return l.data.data}catch(s){console.error("Error in getUser:",s),e("Failed to fetch User");return}},async unlinkManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"";await r.delete(`/item/${t}/user/item/${n}/${s}`)}catch(s){throw console.error("Error in unlink User:",s),e("Failed to unlink User"),s}}}}const Zt=tU();async function nU({url:r,method:e,header:t={},body:n,bearerToken:i}){const s=i?{Authorization:`Bearer ${i}`}:{};try{return(await Ke({url:r,method:e,headers:{...t,...s},data:n??{}})).data}catch(l){throw console.error(`Request failed for ${e} ${r}:`,l),l}}function Si(r,e,t=[]){const n=oU(e);if(!n)return r;const i=n.split(" ");return r.filter(s=>rU(s,i,t))}function rU(r,e,t){return t.some(n=>{const i=Xs.get(r,n);if(Xs.isNil(i))return!1;const s=Xs.toString(i).toLowerCase();return e.every(l=>s.includes(l))})}function oU(r){return Xs.trim(r).toLowerCase().replace(/\s+/g," ")}let Ds=!1;const Gu=c.ref(!1),mn=c.ref([]),Qp=c.ref([]),We=c.ref(null),qo=c.ref([]),Go=c.ref([]),Mw=()=>{const r=Fn(),e=async _=>{Gu.value=!0;const A=_?`_active eq true and ${_}`:"_active eq true",R=await Vr.getOrgList(A);R&&(mn.value=R,Ds=!0),Gu.value=!1},t=async _=>{var A;return(A=mn.value)!=null&&A.length||await e(_),mn.value};function n(_){if(!mn.value)throw new Error("Data not stored yet");const A=Si(mn.value,_,["name","description"]);return _!==""?A:mn.value}const i=_=>{Qp.value=_},s=_=>{We.value=Ti.cloneDeep(_)},l=async _=>await Vr.getOrg(_),d=async()=>{if(We.value!=null){const _=await Vr.createOrg(We.value);return _!=null&&_.data.created_at&&(r.success("Organization created."),Ds&&mn.value.push(_.data)),_==null?void 0:_.data}},f=async()=>{if(ie.value=!0,We.value&&We.value.__id){const _=await Vr.updateOrg(We.value);if(Ds&&(_!=null&&_.data.__id)){const A=mn.value.findIndex(R=>R.__id===_.data.__id);return A!==-1?(mn.value[A]=_.data,r.success("Organization updated.")):r.error("Unable to update item"),ie.value=!1,_.data}}else ie.value=!1,r.error("Unable to update item")},g=async()=>{if(ie.value=!0,We.value&&We.value.created_at){if(await Vr.deactivateOrg(We.value.__id),Ds){const _=mn.value.findIndex(A=>{var R;return A.__id===((R=We.value)==null?void 0:R.__id)});if(_!==-1)return mn.value.splice(_,1),We.value;r.error("Unable to deactivate organization")}ie.value=!1}};async function m(_){ie.value=!0;try{if(We.value&&We.value.__id){const A={..._,organization:We.value.__id};if(!await Fr.updateBranch(A)){ie.value=!1;return}if(qo.value.findIndex(V=>V.__id===_.__id)===-1)return r.success("Branch added successfully."),qo.value.push(A),A;r.info("Branch already added.")}}catch(A){console.error(A)}finally{ie.value=!1}}async function w(_){if(ie.value=!0,We.value&&We.value.__id){const A={..._,organization:null};if(!await Fr.updateBranch(A)){ie.value=!1;return}const $=qo.value.findIndex(V=>V.__id===_.__id);if($!==-1)return qo.value.splice($,1),ie.value=!1,qo.value;throw new Error("Item not found to remove")}ie.value=!1}async function v(_){ie.value=!0;try{if(We.value&&We.value.__id){const A={..._,organization:We.value.__id};if(!await Zt.updateTeam(A)){ie.value=!1;return}if(Go.value.findIndex(V=>V.__id===_.__id)===-1)return r.success("Team added successfully."),Go.value.push(A),A;r.info("Team already added.")}}catch(A){console.error(A)}finally{ie.value=!1}}async function E(_){if(ie.value=!0,We.value&&We.value.__id){const A={..._,organization:null};if(!await Zt.updateTeam(A)){ie.value=!1;return}const $=Go.value.findIndex(V=>V.__id===_.__id);if($!==-1)return Go.value.splice($,1),ie.value=!1,Go.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:mn,loading:Gu,columns:Qp,item:We,filterData:n,__init__:e,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgBranches:qo,orgTeams:Go,linkBranch:m,unlinkBranch:w,linkTeam:v,unlinkTeam:E}};let Ls=!1;const pn=c.ref([]),Xp=c.ref([]),ot=c.ref(null),ju=c.ref(!1),jo=c.ref([]),xw=()=>{const r=Fn(),e=async v=>{ju.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await Zt.getTeamList(E);_&&(pn.value=_,Ls=!0),ju.value=!1},t=async v=>(pn.value.length||await e(v),pn.value);function n(v){if(!pn.value)throw new Error("Data not stored yet");const E=Si(pn.value,v,["name","description"]);return v!==""?E:pn.value}const i=v=>{Xp.value=v},s=v=>{ot.value=Ti.cloneDeep(v)},l=async v=>await Zt.getTeam(v),d=async()=>{if(ot.value!=null){const v=await Zt.createTeam(ot.value);return v!=null&&v.data.created_at&&(r.success("Team created."),Ls&&pn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(ie.value=!0,ot.value&&ot.value.__id){const v=await Zt.updateTeam(ot.value);if(Ls&&(v!=null&&v.data.__id)){const E=pn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(pn.value[E]=v.data,r.success("Team updated.")):r.error("Unable to update item"),v.data}}else r.error("Unable to update item")},g=async()=>{if(ot.value&&ot.value.created_at&&(await Zt.deactivateTeam(ot.value.__id),Ls)){const v=pn.value.findIndex(E=>{var _;return E.__id===((_=ot.value)==null?void 0:_.__id)});if(v!==-1)return pn.value.splice(v,1),ot.value;r.error("Unable to deactivate organization")}};async function m(v){var E;if(ie.value=!0,(E=ot.value)!=null&&E.__id)if(jo.value.findIndex(A=>A.__id===v.__id)===-1)try{const A=await Zt.linkManageUser(ot.value.__id,{team:ot.value.__id,user:v.__id,role:"string",joined_at:"string",comments:"string"}),R=await Zt.getTeamUserList(ot.value.__id);return R&&(jo.value=R),r.success("User added successfully."),A}catch(A){console.error(A),r.error("Unable to add User.")}finally{ie.value=!1}else r.info("User already added.");else console.warn("No item selected or item ID is missing."),r.info("Please select a valid item.");ie.value=!1}async function w(v){if(ie.value=!0,ot.value&&ot.value.__id){const E=jo.value.findIndex(_=>_.__id===v);if(E!==-1)return await Zt.unlinkManageUser(ot.value.__id,v),jo.value.splice(E,1),ie.value=!1,jo.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:pn,loading:ju,columns:Xp,item:ot,usersTeam:jo,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,linkUser:m,unlinkUser:w}},Dw=c.defineComponent({__name:"GlobalScopeFilter",setup(r){var A,R,$;const{openDialog:e}=ya("global-scope__J-"),{user:t,scope:n,session:i,setScope:s}=Jc(),{getData:l,data:d}=Mw(),{getData:f,data:g}=xw(),m=c.ref(!1);c.onBeforeMount(async()=>{m.value=!0,await l(),await f(),m.value=!1});const w=c.ref({scope_type:(A=n.value)==null?void 0:A.scope_type,organization:((R=n.value)==null?void 0:R.organization)??"org",team:($=n.value)==null?void 0:$.team});function v(){var V,U,J;w.value={...n.value,scope_type:(V=n.value)==null?void 0:V.scope_type,organization:((U=n.value)==null?void 0:U.organization)??"",team:(J=n.value)==null?void 0:J.team},e()}const E=c.computed(()=>{var V;switch((V=n.value)==null?void 0:V.scope_type){case"user":return F1;case"org":return U1;case"team":return H1;default:return V1}});async function _(){var V;((V=n.value)==null?void 0:V.scope_type)!==""&&s(w.value)}return(V,U)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(Be.VBtn,{onClick:v,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(E.value),{size:"20"}))]),_:1}),c.createVNode(c.unref(wa),{loading:m.value,title:"Scope","dd-id":"global-scope__J-",onOnSave:_},{default:c.withCtx(()=>[c.createElementVNode("div",null,[c.createVNode(be.VRow,null,{default:c.withCtx(()=>[c.createVNode(be.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[3]||(U[3]=[c.createTextVNode(" User")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>{var J;return[c.createTextVNode(c.toDisplayString(((J=c.unref(t))==null?void 0:J.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),c.createVNode(be.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[4]||(U[4]=[c.createTextVNode(" Domain")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(i).domain),1)]),_:1})]),_:1})]),_:1}),c.createVNode(be.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[5]||(U[5]=[c.createTextVNode(" Environment")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(i).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),c.createVNode(Nk.VBtnToggle,{density:"compact",variant:"outlined",modelValue:w.value.scope_type,"onUpdate:modelValue":U[0]||(U[0]=J=>w.value.scope_type=J),class:"d-flex justify-center my-4"},{default:c.withCtx(()=>[c.createVNode(Be.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:c.withCtx(()=>U[6]||(U[6]=[c.createTextVNode("Organizational")])),_:1}),c.createVNode(Be.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:c.withCtx(()=>U[7]||(U[7]=[c.createTextVNode("Team")])),_:1}),c.createVNode(Be.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:c.withCtx(()=>U[8]||(U[8]=[c.createTextVNode("User")])),_:1}),c.createVNode(Be.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:c.withCtx(()=>U[9]||(U[9]=[c.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),c.createElementVNode("div",null,[c.createVNode(ua.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>U[10]||(U[10]=[c.createTextVNode("Organization")])),_:1}),c.createVNode(ta.VSelect,{items:c.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:w.value.organization,"onUpdate:modelValue":U[1]||(U[1]=J=>w.value.organization=J),clearable:""},null,8,["items","modelValue"]),c.createVNode(ua.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>U[11]||(U[11]=[c.createTextVNode("Team")])),_:1}),c.createVNode(ta.VSelect,{items:c.unref(g),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:w.value.team,"onUpdate:modelValue":U[2]||(U[2]=J=>w.value.team=J),clearable:""},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),iU={},aU={class:"double-ring-spinner-container"};function sU(r,e){return c.openBlock(),c.createElementBlock("div",aU,e[0]||(e[0]=[c.createElementVNode("div",{class:"spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])],-1)]))}const Lw=vi(iU,[["render",sU],["__scopeId","data-v-00d7a69f"]]),cU={key:0,class:"_jspinner-overlay_jj"},Bw=c.defineComponent({__name:"GlobalSpinner",setup(r){return(e,t)=>c.unref(ie)?(c.openBlock(),c.createElementBlock("div",cU,t[0]||(t[0]=[c.createElementVNode("div",{class:"j-double-ring-spinner-container"},[c.createElementVNode("div",{class:"j-global-spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])])],-1)]))):c.createCommentVNode("",!0)}}),Uw=c.defineComponent({__name:"SubMenu",props:{title:{}},setup(r,{expose:e}){return e({props:r}),(n,i)=>(c.openBlock(),c.createBlock(St.VListItem,{onClick:i[0]||(i[0]=()=>{}),density:"compact"},{append:c.withCtx(()=>[c.createVNode(c.unref($1))]),default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),_:1}),c.createVNode(Bd.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:c.withCtx(()=>[c.renderSlot(n.$slots,"default")]),_:3})]),_:3}))}}),lU=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:Hv,ColumnSettingsDialog:qd,ConfirmDialog:Vv,ContextMenu:$v,CopyButton:wc,DeleteAllBtn:Hd,DotsMenu:Uv,EditButton:Bv,FormHeadless:Cy,FormMetadata:Nc,GlobalScopeFilter:Dw,GlobalSpinner:Bw,JAvatar:Fv,JBtn:iv,JDialog:wa,JForm:vy,JIconBtn:ov,JSelect:fy,JTextArea:gy,JTextField:hy,ParentCard:Ac,SearchFilter:kc,SpinnerLoader:Lw,SubMenu:Uw,TabFormHeader:yy,TableAdvanced:Yv,TableCard:Gd,TableCardsView:uy,TableHeader:Jv,UiTable:Kv},Symbol.toStringTag,{value:"Module"})),uU=iR(),dU={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let Yu=!1;const Ju=c.ref(!1),vn=c.ref([]),Zp=c.ref([]),gt=c.ref(null),Yo=c.ref([]),hU=()=>{const r=Fn(),e=async v=>{Ju.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await Fr.getBranchList(E);_&&(vn.value=_,Yu=!0),Ju.value=!1},t=async v=>(vn.value.length||await e(v),vn.value);function n(v){if(!vn.value)throw new Error("Data not stored yet");const E=Si(vn.value,v,["name","description"]);return v!==""?E:vn.value}const i=v=>{Zp.value=v},s=v=>{gt.value=Ti.cloneDeep(v)},l=async v=>await Fr.getBranch(v),d=async()=>{if(gt.value!=null){const v=await Fr.createBranch(gt.value);return v!=null&&v.data.created_at&&(r.success("Branch created."),Yu&&vn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(gt.value&&gt.value.__id){const v=await Fr.updateBranch(gt.value);if(Yu&&v){const E=vn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(vn.value[E]=v.data,r.success("Branch updated.")):r.error("Unable to update item"),v}}else r.error("Unable to update item")},g=async()=>{if(gt.value&&gt.value.created_at){await Fr.deactivateBranch(gt.value.__id);const v=vn.value.findIndex(E=>{var _;return E.__id===((_=gt.value)==null?void 0:_.__id)});if(v!==-1)return vn.value.splice(v,1),gt.value;r.error("Unable to deactivate Domain")}};async function m(v){ie.value=!0;try{if(gt.value&&gt.value.__id){const E={...v,branch:gt.value.__id};if(!await Zt.updateTeam(E)){r.error("Unable to link team");return}if(Yo.value.findIndex(R=>R.__id===v.__id)===-1)return r.success("Team added successfully."),Yo.value.push(E),E;r.info("Team already added.")}else throw new Error("Item is not defined")}catch(E){console.error(E)}finally{ie.value=!1}}async function w(v){if(ie.value=!0,gt.value&&gt.value.__id){const E={...v,branch:null};if(!await Zt.updateTeam(E))return;const A=Yo.value.findIndex(R=>R.__id===v.__id);if(A!==-1)return Yo.value.splice(A,1),ie.value=!1,Yo.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:vn,columns:Zp,item:gt,loading:Ju,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,branchTeams:Yo,linkTeam:m,unlinkTeam:w}};function fU(){const r=Ei("https://api.jplan.com.br/management/division"),{error:e}=Fn();return{async getDivisionList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Division list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getDivisionList:",n),e("Failed to fetch Division list");return}},async createDivision(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Division"),s}},async updateDivision(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Division"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Division"),s}},async getDivision(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Division"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Division"),s}},async activateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in activateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Division"),s}},async deactivateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Division"),s}}}}const ti=fU();let Qu=!1;const Xu=c.ref(!1),yn=c.ref([]),ev=c.ref([]),mt=c.ref(null),Jo=c.ref([]),gU=()=>{const r=Fn(),e=async v=>{Xu.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await ti.getDivisionList(E);_&&(yn.value=_,Qu=!0),Xu.value=!1},t=async v=>(yn.value.length||await e(v),yn.value);function n(v){if(!yn.value)throw new Error("Data not stored yet");const E=Si(yn.value,v,["name","description"]);return v!==""?E:yn.value}const i=v=>{ev.value=v},s=v=>{mt.value=Ti.cloneDeep(v)},l=async v=>await ti.getDivision(v),d=async()=>{if(mt.value!=null){const v=await ti.createDivision(mt.value);return v!=null&&v.data.created_at&&(r.success("Division created."),Qu&&yn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(ie.value=!0,mt.value&&mt.value.__id){const v=await ti.updateDivision(mt.value);if(Qu&&(v!=null&&v.data.__id)){const E=yn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(yn.value[E]=v.data,r.success("Updated Division.")):r.error("Unable to update item"),ie.value=!1,v}}else ie.value=!1,r.error("Unable to update item")},g=async()=>{if(ie.value=!0,mt.value&&mt.value.created_at){await ti.deactivateDivision(mt.value.__id);const v=yn.value.findIndex(E=>{var _;return E.__id===((_=mt.value)==null?void 0:_.__id)});if(v!==-1)return yn.value.splice(v,1),mt.value;r.error("Unable to deactivate Division")}ie.value=!1};async function m(v){ie.value=!0;try{if(mt.value&&mt.value.__id){const E={...v,division:mt.value.__id};return await Vr.updateOrg(E)?(Jo.value.findIndex(R=>R.__id===v.__id)===-1?(r.success("Organization added successfully."),Jo.value.push(E)):r.info("Organization already added."),E):void 0}else throw new Error("Item is not defined")}catch(E){console.error(E)}finally{ie.value=!1}}async function w(v){if(ie.value=!0,mt.value&&mt.value.__id){const E={...v,division:null};if(!await Vr.updateOrg(E))return;const A=Jo.value.findIndex(R=>R.__id===v.__id);if(A!==-1)Jo.value.splice(A,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return ie.value=!1,Jo.value}return{data:yn,columns:ev,item:mt,loading:Xu,__init__:e,filterData:n,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgs:Jo,linkDivision:m,unlinkDivision:w}};function mU(){const r=Ei("https://api.jplan.com.br/management/user"),{error:e}=Fn();return{async getManageUserList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch User list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getManageUserList:",n),e("Failed to fetch User list");return}},async createManageUser(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create User"),s}},async updateManageUser(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update User"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update User"),s}},async getManageUser(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch User"),new Error(s.data.error);return s.data}catch(s){console.error("Error in getManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch User");return}},async activateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate User"),new Error(s.data.error)}catch(s){throw console.error("Error in activateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate User"),s}},async deactivateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate User"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate User"),s}}}}const ni=mU();let Zu=!1,ed=c.ref(!1);const Cn=c.ref([]),tv=c.ref([]),wn=c.ref(null),pU=c.ref(null),vU=c.ref([]),yU=()=>{const r=Fn(),e=async m=>{ed.value=!0;const w=m?`_active eq true and ${m}`:"_active eq true",v=await ni.getManageUserList(w);v&&(Cn.value=v,Zu=!0),ed.value=!1},t=async m=>(Cn.value.length||await e(m),Cn.value);function n(m){if(!Cn.value)throw new Error("Data not stored yet");const w=Si(Cn.value,m,["name","description"]);return m!==""?w:Cn.value}return{data:Cn,loading:ed,columns:tv,item:wn,filterData:n,__init__:e,getData:t,setColumns:m=>{tv.value=m},setItem:m=>{wn.value=Ti.cloneDeep(m)},getItem:async m=>await ni.getManageUser(m),createItem:async()=>{if(wn.value!=null){const m=crypto.randomUUID(),w=await ni.createManageUser({...wn.value,__id:m});return w!=null&&w.data.created_at&&(r.success("User created."),Zu&&Cn.value.push(w.data)),w==null?void 0:w.data}},updateItem:async()=>{if(ie.value=!0,wn.value&&wn.value.created_at){const m=await ni.updateManageUser(wn.value);if(Zu&&(m!=null&&m.data)){const w=Cn.value.findIndex(v=>v.__id===(m==null?void 0:m.data.__id));if(w!==-1)Cn.value[w]=m==null?void 0:m.data,r.success("User created.");else throw new Error("Unable to find item after update")}return ie.value=!1,m==null?void 0:m.data}},removeItem:async()=>{if(wn.value&&wn.value.created_at){try{await ni.deactivateManageUser(wn.value.__id)}catch{r.error("Unable to deactivate user");return}const m=Cn.value.findIndex(w=>{var v;return w.__id===((v=wn.value)==null?void 0:v.__id)});if(m!==-1)return Cn.value.splice(m,1),wn.value}},userOrg:pU,userTeams:vU}},CU=r=>{r.use(uU),r.use(s0,dU),Object.entries(lU).forEach(([e,t])=>{r.component(e,t)}),Object.entries(Pk).forEach(([e,t])=>{r.provide(e,t)})},wU={install:CU};exports.ContextMenu=$v;exports.EmptyListImg=od;exports.EventBus=Ec;exports.FormHeadless=Cy;exports.HttpCore=nU;exports.SpinnerLoader=Lw;exports.TableCardsView=uy;exports.TableHeader=Jv;exports.__spinner=ie;exports._export_sfc=vi;exports._sfc_main=Kv;exports._sfc_main$1=Yv;exports._sfc_main$10=Hd;exports._sfc_main$11=Bv;exports._sfc_main$12=ov;exports._sfc_main$13=fy;exports._sfc_main$14=gy;exports._sfc_main$15=hy;exports._sfc_main$16=vy;exports._sfc_main$17=yy;exports._sfc_main$18=Ac;exports._sfc_main$19=Fv;exports._sfc_main$2=qd;exports._sfc_main$20=Hv;exports._sfc_main$21=wa;exports._sfc_main$22=Uw;exports._sfc_main$23=Dw;exports._sfc_main$24=Bw;exports._sfc_main$3=Gd;exports._sfc_main$4=kc;exports._sfc_main$5=Vv;exports._sfc_main$6=wc;exports._sfc_main$7=Uv;exports._sfc_main$8=Nc;exports._sfc_main$9=iv;exports.branchInstance=Fr;exports.coreClient=Vh;exports.createToastInterface=fa;exports.dateFormat=jv;exports.divisionInstance=ti;exports.filterQuery=Si;exports.globalEventBus=Fd;exports.index=wU;exports.manageUserInstance=ni;exports.msal=yt;exports.orgInstance=Vr;exports.provideToast=a0;exports.scopedClient=Ei;exports.setupAuthGuard=QB;exports.teamInstance=Zt;exports.toastInjectionKey=Sc;exports.useAuth=xh;exports.useBranchStore=hU;exports.useCustomizer=uR;exports.useDialog=ya;exports.useDivisionStore=gU;exports.useManageUserStore=yU;exports.useOrganizationStore=Mw;exports.useSession=Jc;exports.useTeamStore=xw;exports.useToast=Fn;
92
+ }`;var he=mm(function(){return Ee(C,Y+"return "+L).apply(t,T)});if(he.source=L,cu(he))throw he;return he}function MI(o){return Ae(o).toLowerCase()}function xI(o){return Ae(o).toUpperCase()}function DI(o,a,u){if(o=Ae(o),o&&(u||a===t))return Sf(o);if(!o||!(a=Wt(a)))return o;var h=kn(o),p=kn(a),C=Af(h,p),T=bf(h,p)+1;return Pr(h,C,T).join("")}function LI(o,a,u){if(o=Ae(o),o&&(u||a===t))return o.slice(0,kf(o)+1);if(!o||!(a=Wt(a)))return o;var h=kn(o),p=bf(h,kn(a))+1;return Pr(h,0,p).join("")}function BI(o,a,u){if(o=Ae(o),o&&(u||a===t))return o.replace(cl,"");if(!o||!(a=Wt(a)))return o;var h=kn(o),p=Af(h,kn(a));return Pr(h,p).join("")}function UI(o,a){var u=j,h=q;if($e(a)){var p="separator"in a?a.separator:p;u="length"in a?de(a.length):u,h="omission"in a?Wt(a.omission):h}o=Ae(o);var C=o.length;if(bo(o)){var T=kn(o);C=T.length}if(u>=C)return o;var S=u-Io(h);if(S<1)return h;var I=T?Pr(T,0,S).join(""):o.slice(0,S);if(p===t)return I+h;if(T&&(S+=I.length-S),lu(p)){if(o.slice(S).search(p)){var x,D=I;for(p.global||(p=Al(p.source,Ae(Wh.exec(p))+"g")),p.lastIndex=0;x=p.exec(D);)var L=x.index;I=I.slice(0,L===t?S:L)}}else if(o.indexOf(Wt(p),S)!=S){var K=I.lastIndexOf(p);K>-1&&(I=I.slice(0,K))}return I+h}function VI(o){return o=Ae(o),o&&Jw.test(o)?o.replace($h,gT):o}var FI=xo(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),hu=pg("toUpperCase");function gm(o,a,u){return o=Ae(o),a=u?t:a,a===t?lT(o)?vT(o):eT(o):o.match(a)||[]}var mm=fe(function(o,a){try{return Kt(o,t,a)}catch(u){return cu(u)?u:new ae(u)}}),HI=lr(function(o,a){return cn(a,function(u){u=Wn(u),sr(o,u,au(o[u],o))}),o});function $I(o){var a=o==null?0:o.length,u=X();return o=a?Ve(o,function(h){if(typeof h[1]!="function")throw new ln(l);return[u(h[0]),h[1]]}):[],fe(function(h){for(var p=-1;++p<a;){var C=o[p];if(Kt(C[0],this,h))return Kt(C[1],this,h)}})}function KI(o){return gE(dn(o,w))}function fu(o){return function(){return o}}function zI(o,a){return o==null||o!==o?a:o}var WI=yg(),qI=yg(!0);function Ut(o){return o}function gu(o){return jf(typeof o=="function"?o:dn(o,w))}function GI(o){return Jf(dn(o,w))}function jI(o,a){return Qf(o,dn(a,w))}var YI=fe(function(o,a){return function(u){return Hi(u,o,a)}}),JI=fe(function(o,a){return function(u){return Hi(o,u,a)}});function mu(o,a,u){var h=st(a),p=ts(a,h);u==null&&!($e(a)&&(p.length||!h.length))&&(u=a,a=o,o=this,p=ts(a,st(a)));var C=!($e(u)&&"chain"in u)||!!u.chain,T=dr(o);return cn(p,function(S){var I=a[S];o[S]=I,T&&(o.prototype[S]=function(){var x=this.__chain__;if(C||x){var D=o(this.__wrapped__),L=D.__actions__=Dt(this.__actions__);return L.push({func:I,args:arguments,thisArg:o}),D.__chain__=x,D}return I.apply(o,br([this.value()],arguments))})}),o}function QI(){return ht._===this&&(ht._=ET),this}function pu(){}function XI(o){return o=de(o),fe(function(a){return Xf(a,o)})}var ZI=Gl(Ve),ek=Gl(Cf),tk=Gl(yl);function pm(o){return eu(o)?Cl(Wn(o)):OE(o)}function nk(o){return function(a){return o==null?t:Zr(o,a)}}var rk=wg(),ok=wg(!0);function vu(){return[]}function yu(){return!1}function ik(){return{}}function ak(){return""}function sk(){return!0}function ck(o,a){if(o=de(o),o<1||o>Qe)return[];var u=$t,h=_t(o,$t);a=X(a),o-=$t;for(var p=Tl(h,a);++u<o;)a(u);return p}function lk(o){return ce(o)?Ve(o,Wn):qt(o)?[o]:Dt(Lg(Ae(o)))}function uk(o){var a=++_T;return Ae(o)+a}var dk=ss(function(o,a){return o+a},0),hk=jl("ceil"),fk=ss(function(o,a){return o/a},1),gk=jl("floor");function mk(o){return o&&o.length?es(o,Ut,Ml):t}function pk(o,a){return o&&o.length?es(o,X(a,2),Ml):t}function vk(o){return Tf(o,Ut)}function yk(o,a){return Tf(o,X(a,2))}function Ck(o){return o&&o.length?es(o,Ut,Bl):t}function wk(o,a){return o&&o.length?es(o,X(a,2),Bl):t}var _k=ss(function(o,a){return o*a},1),Tk=jl("round"),Ek=ss(function(o,a){return o-a},0);function Sk(o){return o&&o.length?_l(o,Ut):0}function Ak(o,a){return o&&o.length?_l(o,X(a,2)):0}return y.after=GA,y.ary=Gg,y.assign=xb,y.assignIn=sm,y.assignInWith=ws,y.assignWith=Db,y.at=Lb,y.before=jg,y.bind=au,y.bindAll=HI,y.bindKey=Yg,y.castArray=ib,y.chain=zg,y.chunk=gS,y.compact=mS,y.concat=pS,y.cond=$I,y.conforms=KI,y.constant=fu,y.countBy=SA,y.create=Bb,y.curry=Jg,y.curryRight=Qg,y.debounce=Xg,y.defaults=Ub,y.defaultsDeep=Vb,y.defer=jA,y.delay=YA,y.difference=vS,y.differenceBy=yS,y.differenceWith=CS,y.drop=wS,y.dropRight=_S,y.dropRightWhile=TS,y.dropWhile=ES,y.fill=SS,y.filter=bA,y.flatMap=RA,y.flatMapDeep=NA,y.flatMapDepth=OA,y.flatten=Fg,y.flattenDeep=AS,y.flattenDepth=bS,y.flip=JA,y.flow=WI,y.flowRight=qI,y.fromPairs=IS,y.functions=qb,y.functionsIn=Gb,y.groupBy=PA,y.initial=RS,y.intersection=NS,y.intersectionBy=OS,y.intersectionWith=PS,y.invert=Yb,y.invertBy=Jb,y.invokeMap=xA,y.iteratee=gu,y.keyBy=DA,y.keys=st,y.keysIn=Bt,y.map=gs,y.mapKeys=Xb,y.mapValues=Zb,y.matches=GI,y.matchesProperty=jI,y.memoize=ps,y.merge=eI,y.mergeWith=cm,y.method=YI,y.methodOf=JI,y.mixin=mu,y.negate=vs,y.nthArg=XI,y.omit=tI,y.omitBy=nI,y.once=QA,y.orderBy=LA,y.over=ZI,y.overArgs=XA,y.overEvery=ek,y.overSome=tk,y.partial=su,y.partialRight=Zg,y.partition=BA,y.pick=rI,y.pickBy=lm,y.property=pm,y.propertyOf=nk,y.pull=LS,y.pullAll=$g,y.pullAllBy=BS,y.pullAllWith=US,y.pullAt=VS,y.range=rk,y.rangeRight=ok,y.rearg=ZA,y.reject=FA,y.remove=FS,y.rest=eb,y.reverse=ou,y.sampleSize=$A,y.set=iI,y.setWith=aI,y.shuffle=KA,y.slice=HS,y.sortBy=qA,y.sortedUniq=jS,y.sortedUniqBy=YS,y.split=RI,y.spread=tb,y.tail=JS,y.take=QS,y.takeRight=XS,y.takeRightWhile=ZS,y.takeWhile=eA,y.tap=mA,y.throttle=nb,y.thru=fs,y.toArray=om,y.toPairs=um,y.toPairsIn=dm,y.toPath=lk,y.toPlainObject=am,y.transform=sI,y.unary=rb,y.union=tA,y.unionBy=nA,y.unionWith=rA,y.uniq=oA,y.uniqBy=iA,y.uniqWith=aA,y.unset=cI,y.unzip=iu,y.unzipWith=Kg,y.update=lI,y.updateWith=uI,y.values=Bo,y.valuesIn=dI,y.without=sA,y.words=gm,y.wrap=ob,y.xor=cA,y.xorBy=lA,y.xorWith=uA,y.zip=dA,y.zipObject=hA,y.zipObjectDeep=fA,y.zipWith=gA,y.entries=um,y.entriesIn=dm,y.extend=sm,y.extendWith=ws,mu(y,y),y.add=dk,y.attempt=mm,y.camelCase=mI,y.capitalize=hm,y.ceil=hk,y.clamp=hI,y.clone=ab,y.cloneDeep=cb,y.cloneDeepWith=lb,y.cloneWith=sb,y.conformsTo=ub,y.deburr=fm,y.defaultTo=zI,y.divide=fk,y.endsWith=pI,y.eq=Nn,y.escape=vI,y.escapeRegExp=yI,y.every=AA,y.find=IA,y.findIndex=Ug,y.findKey=Fb,y.findLast=kA,y.findLastIndex=Vg,y.findLastKey=Hb,y.floor=gk,y.forEach=Wg,y.forEachRight=qg,y.forIn=$b,y.forInRight=Kb,y.forOwn=zb,y.forOwnRight=Wb,y.get=uu,y.gt=db,y.gte=hb,y.has=jb,y.hasIn=du,y.head=Hg,y.identity=Ut,y.includes=MA,y.indexOf=kS,y.inRange=fI,y.invoke=Qb,y.isArguments=no,y.isArray=ce,y.isArrayBuffer=fb,y.isArrayLike=Lt,y.isArrayLikeObject=je,y.isBoolean=gb,y.isBuffer=Mr,y.isDate=mb,y.isElement=pb,y.isEmpty=vb,y.isEqual=yb,y.isEqualWith=Cb,y.isError=cu,y.isFinite=wb,y.isFunction=dr,y.isInteger=em,y.isLength=ys,y.isMap=tm,y.isMatch=_b,y.isMatchWith=Tb,y.isNaN=Eb,y.isNative=Sb,y.isNil=bb,y.isNull=Ab,y.isNumber=nm,y.isObject=$e,y.isObjectLike=ze,y.isPlainObject=Gi,y.isRegExp=lu,y.isSafeInteger=Ib,y.isSet=rm,y.isString=Cs,y.isSymbol=qt,y.isTypedArray=Lo,y.isUndefined=kb,y.isWeakMap=Rb,y.isWeakSet=Nb,y.join=MS,y.kebabCase=CI,y.last=fn,y.lastIndexOf=xS,y.lowerCase=wI,y.lowerFirst=_I,y.lt=Ob,y.lte=Pb,y.max=mk,y.maxBy=pk,y.mean=vk,y.meanBy=yk,y.min=Ck,y.minBy=wk,y.stubArray=vu,y.stubFalse=yu,y.stubObject=ik,y.stubString=ak,y.stubTrue=sk,y.multiply=_k,y.nth=DS,y.noConflict=QI,y.noop=pu,y.now=ms,y.pad=TI,y.padEnd=EI,y.padStart=SI,y.parseInt=AI,y.random=gI,y.reduce=UA,y.reduceRight=VA,y.repeat=bI,y.replace=II,y.result=oI,y.round=Tk,y.runInContext=b,y.sample=HA,y.size=zA,y.snakeCase=kI,y.some=WA,y.sortedIndex=$S,y.sortedIndexBy=KS,y.sortedIndexOf=zS,y.sortedLastIndex=WS,y.sortedLastIndexBy=qS,y.sortedLastIndexOf=GS,y.startCase=NI,y.startsWith=OI,y.subtract=Ek,y.sum=Sk,y.sumBy=Ak,y.template=PI,y.times=ck,y.toFinite=hr,y.toInteger=de,y.toLength=im,y.toLower=MI,y.toNumber=gn,y.toSafeInteger=Mb,y.toString=Ae,y.toUpper=xI,y.trim=DI,y.trimEnd=LI,y.trimStart=BI,y.truncate=UI,y.unescape=VI,y.uniqueId=uk,y.upperCase=FI,y.upperFirst=hu,y.each=Wg,y.eachRight=qg,y.first=Hg,mu(y,function(){var o={};return Kn(y,function(a,u){Ie.call(y.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),y.VERSION=n,cn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){y[o].placeholder=y}),cn(["drop","take"],function(o,a){pe.prototype[o]=function(u){u=u===t?1:rt(de(u),0);var h=this.__filtered__&&!a?new pe(this):this.clone();return h.__filtered__?h.__takeCount__=_t(u,h.__takeCount__):h.__views__.push({size:_t(u,$t),type:o+(h.__dir__<0?"Right":"")}),h},pe.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),cn(["filter","map","takeWhile"],function(o,a){var u=a+1,h=u==Ct||u==an;pe.prototype[o]=function(p){var C=this.clone();return C.__iteratees__.push({iteratee:X(p,3),type:u}),C.__filtered__=C.__filtered__||h,C}}),cn(["head","last"],function(o,a){var u="take"+(a?"Right":"");pe.prototype[o]=function(){return this[u](1).value()[0]}}),cn(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");pe.prototype[o]=function(){return this.__filtered__?new pe(this):this[u](1)}}),pe.prototype.compact=function(){return this.filter(Ut)},pe.prototype.find=function(o){return this.filter(o).head()},pe.prototype.findLast=function(o){return this.reverse().find(o)},pe.prototype.invokeMap=fe(function(o,a){return typeof o=="function"?new pe(this):this.map(function(u){return Hi(u,o,a)})}),pe.prototype.reject=function(o){return this.filter(vs(X(o)))},pe.prototype.slice=function(o,a){o=de(o);var u=this;return u.__filtered__&&(o>0||a<0)?new pe(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==t&&(a=de(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},pe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},pe.prototype.toArray=function(){return this.take($t)},Kn(pe.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),p=y[h?"take"+(a=="last"?"Right":""):a],C=h||/^find/.test(a);p&&(y.prototype[a]=function(){var T=this.__wrapped__,S=h?[1]:arguments,I=T instanceof pe,x=S[0],D=I||ce(T),L=function(me){var ve=p.apply(y,br([me],S));return h&&K?ve[0]:ve};D&&u&&typeof x=="function"&&x.length!=1&&(I=D=!1);var K=this.__chain__,Y=!!this.__actions__.length,Z=C&&!K,he=I&&!Y;if(!C&&D){T=he?T:new pe(this);var ee=o.apply(T,S);return ee.__actions__.push({func:fs,args:[L],thisArg:t}),new un(ee,K)}return Z&&he?o.apply(this,S):(ee=this.thru(L),Z?h?ee.value()[0]:ee.value():ee)})}),cn(["pop","push","shift","sort","splice","unshift"],function(o){var a=Va[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);y.prototype[o]=function(){var p=arguments;if(h&&!this.__chain__){var C=this.value();return a.apply(ce(C)?C:[],p)}return this[u](function(T){return a.apply(ce(T)?T:[],p)})}}),Kn(pe.prototype,function(o,a){var u=y[a];if(u){var h=u.name+"";Ie.call(Oo,h)||(Oo[h]=[]),Oo[h].push({name:a,func:u})}}),Oo[as(t,$).name]=[{name:"wrapper",func:t}],pe.prototype.clone=VT,pe.prototype.reverse=FT,pe.prototype.value=HT,y.prototype.at=pA,y.prototype.chain=vA,y.prototype.commit=yA,y.prototype.next=CA,y.prototype.plant=_A,y.prototype.reverse=TA,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=EA,y.prototype.first=y.prototype.head,xi&&(y.prototype[xi]=wA),y},ko=yT();jr?((jr.exports=ko)._=ko,gl._=ko):ht._=ko}).call(WB)}(ea,ea.exports)),ea.exports}var Ti=qB();const Xs=zB(Ti),GB={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-BwUGmB0W.js")),meta:{requiresAuth:!1}},jB={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-B2W5gPgi.js")),meta:{requiresAuth:!1}},{isAuthenticated:Yp,handleRedirect:YB}=xh(),JB=Jc();function QB(r,e){r.addRoute(GB),r.addRoute(jB),r.beforeEach(async(t,n,i)=>{function s(d){return d.matched.some(f=>f.meta.requiresAuth)}if(!s(t))return i();if(!Yp.value){ie.value=!0;try{await YB(e,t.fullPath),await JB.__init__()}catch(d){console.error("Fail to authenticate",d),await r.push("/jplan-auth-fail")}ie.value=!1}if(Yp.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),i(d),localStorage.removeItem("returnRoute");return}i()}})}const{scope:Jp}=Jc();function XB(){const r=Vh(),e=c.ref({scope_type:"org"});async function t(n){e.value=n}return c.watch(Jp,()=>{r.interceptors.request.use(n=>{const i=n.headers,s=i.Authorization;s&&(i.Authorization=s);const l=Jp.value;return l&&(l.scope_type&&(i["j-scope-type"]=l.scope_type,l.organization&&(i["j-scope-organization"]=l.organization),l.team&&(i["j-scope-team"]=l.team)),l.environment&&(i["j-scope-environment"]=l.environment)),n})},{immediate:!0}),Object.assign(r,{setScope:t,scope:e})}function Ei(r){const e=XB();e.defaults.baseURL=r;const t=c.ref({scope_type:"org"});async function n(i){t.value=i}return c.watch(t,()=>{e.interceptors.request.use(i=>{const s=t.value;return delete i.headers["j-scope-type"],delete i.headers["j-scope-organization"],delete i.headers["j-scope-team"],s!=null&&s.scope_type&&(i.headers["j-scope-type"]=s.scope_type),s!=null&&s.organization&&(i.headers["j-scope-organization"]=s.organization),s!=null&&s.team&&(i.headers["j-scope-team"]=s.team),i})},{immediate:!0}),Object.assign(e,{setScope:n,scope:t})}function ZB(){const r=Ei("https://api.jplan.com.br/management/organization"),{error:e}=Fn();return{async getOrgList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Organization list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getOrgList:",n),e("Failed to fetch Organization list");return}},async createOrg(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Organization"),s}},async updateOrg(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Organization"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Organization"),s}},async getOrg(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Organization"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Organization"),s}},async activateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in activateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Organization"),s}},async deactivateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Organization"),s}}}}const Vr=ZB();function eU(){const r=Ei("https://api.jplan.com.br/management/branch/"),{error:e}=Fn();return{async getBranchList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error){e("Failed to fetch Branch list");return}return i.data.data}catch(n){console.error("Error in getBranchList:",n),e("Failed to fetch Branch list")}},async createBranch(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){console.error("Error in createBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Branch")}},async updateBranch(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error){e(s.data.error||"Failed to update Branch");return}return s}catch(s){console.error("Error in updateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Branch")}},async getBranch(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error){e(s.data.error||"Failed to fetch Branch");return}return s.data}catch(s){console.error("Error in getBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Branch")}},async activateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error){e(s.data.error||"Failed to activate Branch");return}}catch(s){console.error("Error in activateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Branch")}},async deactivateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error){e(s.data.error||"Failed to deactivate Branch");return}}catch(s){console.error("Error in deactivateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Branch")}}}}const Fr=eU();function tU(){const r=Ei("https://api.jplan.com.br/management/team"),{error:e}=Fn();return{async getTeamList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Team list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getTeamList:",n),e("Failed to fetch Team list");return}},async createTeam(t){var n,i;try{const s=await r.post("/item",t);if(s.data.error)throw e("Failed to create Team"),new Error(s.data.error);return s}catch(s){throw console.error("Error in createTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Team"),s}},async updateTeam(t){var n,i;try{const s=await r.patch("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in updateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Team"),s}},async getTeam(t){var n,i;try{const s=await r.get(`/item/${t}`);return s.data.error&&e("Failed to fetch Team"),s.data}catch(s){console.error("Error in getTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Team");return}},async activateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in activateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Team"),s}},async deactivateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Team"),s}},async getTeamUserList(t,n){try{const i=n?`?filter_query=${n}`:"",s=await r.get(`/item/${t}/user/list/${i}`);if(s.data.error)throw e("Failed to fetch Team User list"),new Error(s.data.error);return s.data.data}catch(i){console.error("Error in getTeamUserList:",i),e("Failed to fetch Team User list");return}},async linkManageUser(t,n){try{const i=await r.post(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to link User"),new Error(i.data.error);return i.data}catch(i){console.error("Error in link User:",i),e("Failed to link User");return}},async updateManageUser(t,n){try{const i=await r.patch(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to update User"),new Error(i.data.error);return i.data.data}catch(i){throw console.error("Error in update User:",i),e("Failed to update User"),i}},async getManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"",l=await r.get(`/item/${t}/user/item/${n}/${s}`);if(l.data.error)throw e("Failed to fetch User"),new Error(l.data.error);return l.data.data}catch(s){console.error("Error in getUser:",s),e("Failed to fetch User");return}},async unlinkManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"";await r.delete(`/item/${t}/user/item/${n}/${s}`)}catch(s){throw console.error("Error in unlink User:",s),e("Failed to unlink User"),s}}}}const Zt=tU();async function nU({url:r,method:e,header:t={},body:n,bearerToken:i}){const s=i?{Authorization:`Bearer ${i}`}:{};try{return(await Ke({url:r,method:e,headers:{...t,...s},data:n??{}})).data}catch(l){throw console.error(`Request failed for ${e} ${r}:`,l),l}}function Si(r,e,t=[]){const n=oU(e);if(!n)return r;const i=n.split(" ");return r.filter(s=>rU(s,i,t))}function rU(r,e,t){return t.some(n=>{const i=Xs.get(r,n);if(Xs.isNil(i))return!1;const s=Xs.toString(i).toLowerCase();return e.every(l=>s.includes(l))})}function oU(r){return Xs.trim(r).toLowerCase().replace(/\s+/g," ")}let Ds=!1;const Gu=c.ref(!1),mn=c.ref([]),Qp=c.ref([]),We=c.ref(null),qo=c.ref([]),Go=c.ref([]),Mw=()=>{const r=Fn(),e=async _=>{Gu.value=!0;const A=_?`_active eq true and ${_}`:"_active eq true",R=await Vr.getOrgList(A);R&&(mn.value=R,Ds=!0),Gu.value=!1},t=async _=>{var A;return(A=mn.value)!=null&&A.length||await e(_),mn.value};function n(_){if(!mn.value)throw new Error("Data not stored yet");const A=Si(mn.value,_,["name","description"]);return _!==""?A:mn.value}const i=_=>{Qp.value=_},s=_=>{We.value=Ti.cloneDeep(_)},l=async _=>await Vr.getOrg(_),d=async()=>{if(We.value!=null){const _=await Vr.createOrg(We.value);return _!=null&&_.data.created_at&&(r.success("Organization created."),Ds&&mn.value.push(_.data)),_==null?void 0:_.data}},f=async()=>{if(ie.value=!0,We.value&&We.value.__id){const _=await Vr.updateOrg(We.value);if(Ds&&(_!=null&&_.data.__id)){const A=mn.value.findIndex(R=>R.__id===_.data.__id);return A!==-1?(mn.value[A]=_.data,r.success("Organization updated.")):r.error("Unable to update item"),ie.value=!1,_.data}}else ie.value=!1,r.error("Unable to update item")},g=async()=>{if(ie.value=!0,We.value&&We.value.created_at){if(await Vr.deactivateOrg(We.value.__id),Ds){const _=mn.value.findIndex(A=>{var R;return A.__id===((R=We.value)==null?void 0:R.__id)});if(_!==-1)return mn.value.splice(_,1),We.value;r.error("Unable to deactivate organization")}ie.value=!1}};async function m(_){ie.value=!0;try{if(We.value&&We.value.__id){const A={..._,organization:We.value.__id};if(!await Fr.updateBranch(A)){ie.value=!1;return}if(qo.value.findIndex(V=>V.__id===_.__id)===-1)return r.success("Branch added successfully."),qo.value.push(A),A;r.info("Branch already added.")}}catch(A){console.error(A)}finally{ie.value=!1}}async function w(_){if(ie.value=!0,We.value&&We.value.__id){const A={..._,organization:null};if(!await Fr.updateBranch(A)){ie.value=!1;return}const $=qo.value.findIndex(V=>V.__id===_.__id);if($!==-1)return qo.value.splice($,1),ie.value=!1,qo.value;throw new Error("Item not found to remove")}ie.value=!1}async function v(_){ie.value=!0;try{if(We.value&&We.value.__id){const A={..._,organization:We.value.__id};if(!await Zt.updateTeam(A)){ie.value=!1;return}if(Go.value.findIndex(V=>V.__id===_.__id)===-1)return r.success("Team added successfully."),Go.value.push(A),A;r.info("Team already added.")}}catch(A){console.error(A)}finally{ie.value=!1}}async function E(_){if(ie.value=!0,We.value&&We.value.__id){const A={..._,organization:null};if(!await Zt.updateTeam(A)){ie.value=!1;return}const $=Go.value.findIndex(V=>V.__id===_.__id);if($!==-1)return Go.value.splice($,1),ie.value=!1,Go.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:mn,loading:Gu,columns:Qp,item:We,filterData:n,__init__:e,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgBranches:qo,orgTeams:Go,linkBranch:m,unlinkBranch:w,linkTeam:v,unlinkTeam:E}};let Ls=!1;const pn=c.ref([]),Xp=c.ref([]),ot=c.ref(null),ju=c.ref(!1),jo=c.ref([]),xw=()=>{const r=Fn(),e=async v=>{ju.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await Zt.getTeamList(E);_&&(pn.value=_,Ls=!0),ju.value=!1},t=async v=>(pn.value.length||await e(v),pn.value);function n(v){if(!pn.value)throw new Error("Data not stored yet");const E=Si(pn.value,v,["name","description"]);return v!==""?E:pn.value}const i=v=>{Xp.value=v},s=v=>{ot.value=Ti.cloneDeep(v)},l=async v=>await Zt.getTeam(v),d=async()=>{if(ot.value!=null){const v=await Zt.createTeam(ot.value);return v!=null&&v.data.created_at&&(r.success("Team created."),Ls&&pn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(ie.value=!0,ot.value&&ot.value.__id){const v=await Zt.updateTeam(ot.value);if(Ls&&(v!=null&&v.data.__id)){const E=pn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(pn.value[E]=v.data,r.success("Team updated.")):r.error("Unable to update item"),v.data}}else r.error("Unable to update item")},g=async()=>{if(ot.value&&ot.value.created_at&&(await Zt.deactivateTeam(ot.value.__id),Ls)){const v=pn.value.findIndex(E=>{var _;return E.__id===((_=ot.value)==null?void 0:_.__id)});if(v!==-1)return pn.value.splice(v,1),ot.value;r.error("Unable to deactivate organization")}};async function m(v){var E;if(ie.value=!0,(E=ot.value)!=null&&E.__id)if(jo.value.findIndex(A=>A.__id===v.__id)===-1)try{const A=await Zt.linkManageUser(ot.value.__id,{team:ot.value.__id,user:v.__id,role:"string",joined_at:"string",comments:"string"}),R=await Zt.getTeamUserList(ot.value.__id);return R&&(jo.value=R),r.success("User added successfully."),A}catch(A){console.error(A),r.error("Unable to add User.")}finally{ie.value=!1}else r.info("User already added.");else console.warn("No item selected or item ID is missing."),r.info("Please select a valid item.");ie.value=!1}async function w(v){if(ie.value=!0,ot.value&&ot.value.__id){const E=jo.value.findIndex(_=>_.__id===v);if(E!==-1)return await Zt.unlinkManageUser(ot.value.__id,v),jo.value.splice(E,1),ie.value=!1,jo.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:pn,loading:ju,columns:Xp,item:ot,usersTeam:jo,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,linkUser:m,unlinkUser:w}},Dw=c.defineComponent({__name:"GlobalScopeFilter",setup(r){var A,R,$;const{openDialog:e}=ya("global-scope__J-"),{user:t,scope:n,session:i,setScope:s}=Jc(),{getData:l,data:d}=Mw(),{getData:f,data:g}=xw(),m=c.ref(!1);c.onBeforeMount(async()=>{m.value=!0,await l(),await f(),m.value=!1});const w=c.ref({scope_type:(A=n.value)==null?void 0:A.scope_type,organization:((R=n.value)==null?void 0:R.organization)??"org",team:($=n.value)==null?void 0:$.team});function v(){var V,U,J;w.value={...n.value,scope_type:(V=n.value)==null?void 0:V.scope_type,organization:((U=n.value)==null?void 0:U.organization)??"",team:(J=n.value)==null?void 0:J.team},e()}const E=c.computed(()=>{var V;switch((V=n.value)==null?void 0:V.scope_type){case"user":return F1;case"org":return U1;case"team":return H1;default:return V1}});async function _(){var V;((V=n.value)==null?void 0:V.scope_type)!==""&&s(w.value)}return(V,U)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(Be.VBtn,{onClick:v,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(E.value),{size:"20"}))]),_:1}),c.createVNode(c.unref(wa),{loading:m.value,title:"Scope","dd-id":"global-scope__J-",onOnSave:_},{default:c.withCtx(()=>[c.createElementVNode("div",null,[c.createVNode(be.VRow,null,{default:c.withCtx(()=>[c.createVNode(be.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[3]||(U[3]=[c.createTextVNode(" User")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>{var J;return[c.createTextVNode(c.toDisplayString(((J=c.unref(t))==null?void 0:J.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),c.createVNode(be.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[4]||(U[4]=[c.createTextVNode(" Domain")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(i).domain),1)]),_:1})]),_:1})]),_:1}),c.createVNode(be.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(St.VListItem,null,{default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>U[5]||(U[5]=[c.createTextVNode(" Environment")])),_:1}),c.createVNode(St.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(i).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),c.createVNode(Nk.VBtnToggle,{density:"compact",variant:"outlined",modelValue:w.value.scope_type,"onUpdate:modelValue":U[0]||(U[0]=J=>w.value.scope_type=J),class:"d-flex justify-center my-4"},{default:c.withCtx(()=>[c.createVNode(Be.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:c.withCtx(()=>U[6]||(U[6]=[c.createTextVNode("Organizational")])),_:1}),c.createVNode(Be.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:c.withCtx(()=>U[7]||(U[7]=[c.createTextVNode("Team")])),_:1}),c.createVNode(Be.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:c.withCtx(()=>U[8]||(U[8]=[c.createTextVNode("User")])),_:1}),c.createVNode(Be.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:c.withCtx(()=>U[9]||(U[9]=[c.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),c.createElementVNode("div",null,[c.createVNode(ua.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>U[10]||(U[10]=[c.createTextVNode("Organization")])),_:1}),c.createVNode(ta.VSelect,{items:c.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:w.value.organization,"onUpdate:modelValue":U[1]||(U[1]=J=>w.value.organization=J),clearable:""},null,8,["items","modelValue"]),c.createVNode(ua.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>U[11]||(U[11]=[c.createTextVNode("Team")])),_:1}),c.createVNode(ta.VSelect,{items:c.unref(g),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:w.value.team,"onUpdate:modelValue":U[2]||(U[2]=J=>w.value.team=J),clearable:""},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),iU={},aU={class:"double-ring-spinner-container"};function sU(r,e){return c.openBlock(),c.createElementBlock("div",aU,e[0]||(e[0]=[c.createElementVNode("div",{class:"spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])],-1)]))}const Lw=vi(iU,[["render",sU],["__scopeId","data-v-00d7a69f"]]),cU={key:0,class:"_jspinner-overlay_jj"},Bw=c.defineComponent({__name:"GlobalSpinner",setup(r){return(e,t)=>c.unref(ie)?(c.openBlock(),c.createElementBlock("div",cU,t[0]||(t[0]=[c.createElementVNode("div",{class:"j-double-ring-spinner-container"},[c.createElementVNode("div",{class:"j-global-spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])])],-1)]))):c.createCommentVNode("",!0)}}),Uw=c.defineComponent({__name:"SubMenu",props:{title:{}},setup(r,{expose:e}){return e({props:r}),(n,i)=>(c.openBlock(),c.createBlock(St.VListItem,{onClick:i[0]||(i[0]=()=>{}),density:"compact"},{append:c.withCtx(()=>[c.createVNode(c.unref($1))]),default:c.withCtx(()=>[c.createVNode(St.VListItemTitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),_:1}),c.createVNode(Bd.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:c.withCtx(()=>[c.renderSlot(n.$slots,"default")]),_:3})]),_:3}))}}),lU=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:Hv,ColumnSettingsDialog:qd,ConfirmDialog:Vv,ContextMenu:$v,CopyButton:wc,DeleteAllBtn:Hd,DotsMenu:Uv,EditButton:Bv,FormHeadless:Cy,FormMetadata:Nc,GlobalScopeFilter:Dw,GlobalSpinner:Bw,JAvatar:Fv,JBtn:iv,JDialog:wa,JForm:vy,JIconBtn:ov,JSelect:fy,JTextArea:gy,JTextField:hy,ParentCard:Ac,SearchFilter:kc,SpinnerLoader:Lw,SubMenu:Uw,TabFormHeader:yy,TableAdvanced:Yv,TableCard:Gd,TableCardsView:uy,TableHeader:Jv,UiTable:Kv},Symbol.toStringTag,{value:"Module"})),uU=iR(),dU={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let Yu=!1;const Ju=c.ref(!1),vn=c.ref([]),Zp=c.ref([]),gt=c.ref(null),Yo=c.ref([]),hU=()=>{const r=Fn(),e=async v=>{Ju.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await Fr.getBranchList(E);_&&(vn.value=_,Yu=!0),Ju.value=!1},t=async v=>(vn.value.length||await e(v),vn.value);function n(v){if(!vn.value)throw new Error("Data not stored yet");const E=Si(vn.value,v,["name","description"]);return v!==""?E:vn.value}const i=v=>{Zp.value=v},s=v=>{gt.value=Ti.cloneDeep(v)},l=async v=>await Fr.getBranch(v),d=async()=>{if(gt.value!=null){const v=await Fr.createBranch(gt.value);return v!=null&&v.data.created_at&&(r.success("Branch created."),Yu&&vn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(gt.value&&gt.value.__id){const v=await Fr.updateBranch(gt.value);if(Yu&&v){const E=vn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(vn.value[E]=v.data,r.success("Branch updated.")):r.error("Unable to update item"),v}}else r.error("Unable to update item")},g=async()=>{if(gt.value&&gt.value.created_at){await Fr.deactivateBranch(gt.value.__id);const v=vn.value.findIndex(E=>{var _;return E.__id===((_=gt.value)==null?void 0:_.__id)});if(v!==-1)return vn.value.splice(v,1),gt.value;r.error("Unable to deactivate Domain")}};async function m(v){ie.value=!0;try{if(gt.value&&gt.value.__id){const E={...v,branch:gt.value.__id};if(!await Zt.updateTeam(E)){r.error("Unable to link team");return}if(Yo.value.findIndex(R=>R.__id===v.__id)===-1)return r.success("Team added successfully."),Yo.value.push(E),E;r.info("Team already added.")}else throw new Error("Item is not defined")}catch(E){console.error(E)}finally{ie.value=!1}}async function w(v){if(ie.value=!0,gt.value&&gt.value.__id){const E={...v,branch:null};if(!await Zt.updateTeam(E))return;const A=Yo.value.findIndex(R=>R.__id===v.__id);if(A!==-1)return Yo.value.splice(A,1),ie.value=!1,Yo.value;throw new Error("Item not found to remove")}ie.value=!1}return{data:vn,columns:Zp,item:gt,loading:Ju,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,branchTeams:Yo,linkTeam:m,unlinkTeam:w}};function fU(){const r=Ei("https://api.jplan.com.br/management/division"),{error:e}=Fn();return{async getDivisionList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Division list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getDivisionList:",n),e("Failed to fetch Division list");return}},async createDivision(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Division"),s}},async updateDivision(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Division"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Division"),s}},async getDivision(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Division"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Division"),s}},async activateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in activateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Division"),s}},async deactivateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Division"),s}}}}const ti=fU();let Qu=!1;const Xu=c.ref(!1),yn=c.ref([]),ev=c.ref([]),mt=c.ref(null),Jo=c.ref([]),gU=()=>{const r=Fn(),e=async v=>{Xu.value=!0;const E=v?`_active eq true and ${v}`:"_active eq true",_=await ti.getDivisionList(E);_&&(yn.value=_,Qu=!0),Xu.value=!1},t=async v=>(yn.value.length||await e(v),yn.value);function n(v){if(!yn.value)throw new Error("Data not stored yet");const E=Si(yn.value,v,["name","description"]);return v!==""?E:yn.value}const i=v=>{ev.value=v},s=v=>{mt.value=Ti.cloneDeep(v)},l=async v=>await ti.getDivision(v),d=async()=>{if(mt.value!=null){const v=await ti.createDivision(mt.value);return v!=null&&v.data.created_at&&(r.success("Division created."),Qu&&yn.value.push(v.data)),v==null?void 0:v.data}},f=async()=>{if(ie.value=!0,mt.value&&mt.value.__id){const v=await ti.updateDivision(mt.value);if(Qu&&(v!=null&&v.data.__id)){const E=yn.value.findIndex(_=>_.__id===v.data.__id);return E!==-1?(yn.value[E]=v.data,r.success("Updated Division.")):r.error("Unable to update item"),ie.value=!1,v}}else ie.value=!1,r.error("Unable to update item")},g=async()=>{if(ie.value=!0,mt.value&&mt.value.created_at){await ti.deactivateDivision(mt.value.__id);const v=yn.value.findIndex(E=>{var _;return E.__id===((_=mt.value)==null?void 0:_.__id)});if(v!==-1)return yn.value.splice(v,1),mt.value;r.error("Unable to deactivate Division")}ie.value=!1};async function m(v){ie.value=!0;try{if(mt.value&&mt.value.__id){const E={...v,division:mt.value.__id};return await Vr.updateOrg(E)?(Jo.value.findIndex(R=>R.__id===v.__id)===-1?(r.success("Organization added successfully."),Jo.value.push(E)):r.info("Organization already added."),E):void 0}else throw new Error("Item is not defined")}catch(E){console.error(E)}finally{ie.value=!1}}async function w(v){if(ie.value=!0,mt.value&&mt.value.__id){const E={...v,division:null};if(!await Vr.updateOrg(E))return;const A=Jo.value.findIndex(R=>R.__id===v.__id);if(A!==-1)Jo.value.splice(A,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return ie.value=!1,Jo.value}return{data:yn,columns:ev,item:mt,loading:Xu,__init__:e,filterData:n,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgs:Jo,linkDivision:m,unlinkDivision:w}};function mU(){const r=Ei("https://api.jplan.com.br/management/user"),{error:e}=Fn();return{async getManageUserList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch User list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getManageUserList:",n),e("Failed to fetch User list");return}},async createManageUser(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create User"),s}},async updateManageUser(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update User"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update User"),s}},async getManageUser(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch User"),new Error(s.data.error);return s.data}catch(s){console.error("Error in getManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch User");return}},async activateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate User"),new Error(s.data.error)}catch(s){throw console.error("Error in activateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate User"),s}},async deactivateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate User"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate User"),s}}}}const ni=mU();let Zu=!1,ed=c.ref(!1);const Cn=c.ref([]),tv=c.ref([]),wn=c.ref(null),pU=c.ref(null),vU=c.ref([]),yU=()=>{const r=Fn(),e=async m=>{ed.value=!0;const w=m?`_active eq true and ${m}`:"_active eq true",v=await ni.getManageUserList(w);v&&(Cn.value=v,Zu=!0),ed.value=!1},t=async m=>(Cn.value.length||await e(m),Cn.value);function n(m){if(!Cn.value)throw new Error("Data not stored yet");const w=Si(Cn.value,m,["name","description"]);return m!==""?w:Cn.value}return{data:Cn,loading:ed,columns:tv,item:wn,filterData:n,__init__:e,getData:t,setColumns:m=>{tv.value=m},setItem:m=>{wn.value=Ti.cloneDeep(m)},getItem:async m=>await ni.getManageUser(m),createItem:async()=>{if(wn.value!=null){const m=crypto.randomUUID(),w=await ni.createManageUser({...wn.value,__id:m});return w!=null&&w.data.created_at&&(r.success("User created."),Zu&&Cn.value.push(w.data)),w==null?void 0:w.data}},updateItem:async()=>{if(ie.value=!0,wn.value&&wn.value.created_at){const m=await ni.updateManageUser(wn.value);if(Zu&&(m!=null&&m.data)){const w=Cn.value.findIndex(v=>v.__id===(m==null?void 0:m.data.__id));if(w!==-1)Cn.value[w]=m==null?void 0:m.data,r.success("User created.");else throw new Error("Unable to find item after update")}return ie.value=!1,m==null?void 0:m.data}},removeItem:async()=>{if(wn.value&&wn.value.created_at){try{await ni.deactivateManageUser(wn.value.__id)}catch{r.error("Unable to deactivate user");return}const m=Cn.value.findIndex(w=>{var v;return w.__id===((v=wn.value)==null?void 0:v.__id)});if(m!==-1)return Cn.value.splice(m,1),wn.value}},userOrg:pU,userTeams:vU}},CU=r=>{r.use(uU),r.use(s0,dU),Object.entries(lU).forEach(([e,t])=>{r.component(e,t)}),Object.entries(Pk).forEach(([e,t])=>{r.provide(e,t)})},wU={install:CU};exports.ContextMenu=$v;exports.EmptyListImg=od;exports.EventBus=Ec;exports.FormHeadless=Cy;exports.HttpCore=nU;exports.SpinnerLoader=Lw;exports.TableCardsView=uy;exports.TableHeader=Jv;exports.__spinner=ie;exports._export_sfc=vi;exports._sfc_main=Kv;exports._sfc_main$1=Yv;exports._sfc_main$10=Hd;exports._sfc_main$11=Bv;exports._sfc_main$12=ov;exports._sfc_main$13=fy;exports._sfc_main$14=gy;exports._sfc_main$15=hy;exports._sfc_main$16=vy;exports._sfc_main$17=yy;exports._sfc_main$18=Ac;exports._sfc_main$19=Fv;exports._sfc_main$2=qd;exports._sfc_main$20=Hv;exports._sfc_main$21=wa;exports._sfc_main$22=Uw;exports._sfc_main$23=Dw;exports._sfc_main$24=Bw;exports._sfc_main$3=Gd;exports._sfc_main$4=kc;exports._sfc_main$5=Vv;exports._sfc_main$6=wc;exports._sfc_main$7=Uv;exports._sfc_main$8=Nc;exports._sfc_main$9=iv;exports.branchInstance=Fr;exports.coreClient=Vh;exports.createToastInterface=fa;exports.dateFormat=jv;exports.divisionInstance=ti;exports.filterQuery=Si;exports.globalEventBus=Fd;exports.index=wU;exports.manageUserInstance=ni;exports.msal=yt;exports.orgInstance=Vr;exports.provideToast=a0;exports.scopedClient=Ei;exports.setupAuthGuard=QB;exports.teamInstance=Zt;exports.toastInjectionKey=Sc;exports.useAuth=xh;exports.useBranchStore=hU;exports.useCustomizer=uR;exports.useDialog=ya;exports.useDivisionStore=gU;exports.useManageUserStore=yU;exports.useOrganizationStore=Mw;exports.useSession=Jc;exports.useTeamStore=xw;exports.useToast=Fn;
@@ -19961,7 +19961,7 @@ function wf() {
19961
19961
  url: "https://api.jplan.com.br/platform/user/domain/",
19962
19962
  method: "GET"
19963
19963
  });
19964
- kv.value = A.data ?? [];
19964
+ kv.value = A.data.data ?? [];
19965
19965
  } catch (A) {
19966
19966
  console.error("Failed to fetch user domains:", A);
19967
19967
  }
@@ -23668,11 +23668,11 @@ function print() { __p += __j.call(arguments, '') }
23668
23668
  var Bi = Z2();
23669
23669
  const Rc = /* @__PURE__ */ Q2(Bi), eH = {
23670
23670
  path: "/_/dashboard",
23671
- component: () => import("./AuthRoute-D4zq27Qx.mjs"),
23671
+ component: () => import("./AuthRoute-CoiP6HEp.mjs"),
23672
23672
  meta: { requiresAuth: !1 }
23673
23673
  }, tH = {
23674
23674
  path: "/jplan-auth-fail",
23675
- component: () => import("./AuthFailRoute-D66Spb95.mjs"),
23675
+ component: () => import("./AuthFailRoute-DrTuU_Z3.mjs"),
23676
23676
  meta: { requiresAuth: !1 }
23677
23677
  }, { isAuthenticated: Mv, handleRedirect: nH } = L_(), rH = wf();
23678
23678
  function QH(r, e) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CK1Qc84f.js");require("@vueuse/core");exports.AvatarPicture=e._sfc_main$20;exports.ColumnSettingsDialog=e._sfc_main$2;exports.ConfirmDialog=e._sfc_main$5;exports.ContextMenu=e.ContextMenu;exports.CopyButton=e._sfc_main$6;exports.DeleteAllBtn=e._sfc_main$10;exports.DotsMenu=e._sfc_main$7;exports.EditButton=e._sfc_main$11;exports.EmptyListImg=e.EmptyListImg;exports.EventBus=e.EventBus;exports.FormHeadless=e.FormHeadless;exports.FormMetadata=e._sfc_main$8;exports.GlobalScopeFilter=e._sfc_main$23;exports.GlobalSpinner=e._sfc_main$24;exports.HttpCore=e.HttpCore;exports.JAvatar=e._sfc_main$19;exports.JBtn=e._sfc_main$9;exports.JDialog=e._sfc_main$21;exports.JForm=e._sfc_main$16;exports.JIconBtn=e._sfc_main$12;exports.JSelect=e._sfc_main$13;exports.JTextArea=e._sfc_main$14;exports.JTextField=e._sfc_main$15;Object.defineProperty(exports,"POSITION",{enumerable:!0,get:()=>e.POSITION});exports.ParentCard=e._sfc_main$18;exports.SearchFilter=e._sfc_main$4;exports.SpinnerLoader=e.SpinnerLoader;exports.SubMenu=e._sfc_main$22;Object.defineProperty(exports,"TYPE",{enumerable:!0,get:()=>e.TYPE});exports.TabFormHeader=e._sfc_main$17;exports.TableAdvanced=e._sfc_main$1;exports.TableCard=e._sfc_main$3;exports.TableCardsView=e.TableCardsView;exports.TableHeader=e.TableHeader;exports.UiTable=e._sfc_main;exports.__spinner=e.__spinner;exports.branchInstance=e.branchInstance;exports.coreClient=e.coreClient;exports.createToastInterface=e.createToastInterface;exports.dateFormat=e.dateFormat;exports.default=e.index;exports.divisionInstance=e.divisionInstance;exports.filterQuery=e.filterQuery;exports.globalEventBus=e.globalEventBus;exports.manageUserInstance=e.manageUserInstance;exports.orgInstance=e.orgInstance;exports.provideToast=e.provideToast;exports.scopedClient=e.scopedClient;exports.setupAuthGuard=e.setupAuthGuard;exports.teamInstance=e.teamInstance;exports.toastInjectionKey=e.toastInjectionKey;exports.useAuth=e.useAuth;exports.useBranchStore=e.useBranchStore;exports.useCustomizer=e.useCustomizer;exports.useDialog=e.useDialog;exports.useDivisionStore=e.useDivisionStore;exports.useManageUserStore=e.useManageUserStore;exports.useOrganizationStore=e.useOrganizationStore;exports.useSession=e.useSession;exports.useTeamStore=e.useTeamStore;exports.useToast=e.useToast;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CqH8CLfH.js");require("@vueuse/core");exports.AvatarPicture=e._sfc_main$20;exports.ColumnSettingsDialog=e._sfc_main$2;exports.ConfirmDialog=e._sfc_main$5;exports.ContextMenu=e.ContextMenu;exports.CopyButton=e._sfc_main$6;exports.DeleteAllBtn=e._sfc_main$10;exports.DotsMenu=e._sfc_main$7;exports.EditButton=e._sfc_main$11;exports.EmptyListImg=e.EmptyListImg;exports.EventBus=e.EventBus;exports.FormHeadless=e.FormHeadless;exports.FormMetadata=e._sfc_main$8;exports.GlobalScopeFilter=e._sfc_main$23;exports.GlobalSpinner=e._sfc_main$24;exports.HttpCore=e.HttpCore;exports.JAvatar=e._sfc_main$19;exports.JBtn=e._sfc_main$9;exports.JDialog=e._sfc_main$21;exports.JForm=e._sfc_main$16;exports.JIconBtn=e._sfc_main$12;exports.JSelect=e._sfc_main$13;exports.JTextArea=e._sfc_main$14;exports.JTextField=e._sfc_main$15;Object.defineProperty(exports,"POSITION",{enumerable:!0,get:()=>e.POSITION});exports.ParentCard=e._sfc_main$18;exports.SearchFilter=e._sfc_main$4;exports.SpinnerLoader=e.SpinnerLoader;exports.SubMenu=e._sfc_main$22;Object.defineProperty(exports,"TYPE",{enumerable:!0,get:()=>e.TYPE});exports.TabFormHeader=e._sfc_main$17;exports.TableAdvanced=e._sfc_main$1;exports.TableCard=e._sfc_main$3;exports.TableCardsView=e.TableCardsView;exports.TableHeader=e.TableHeader;exports.UiTable=e._sfc_main;exports.__spinner=e.__spinner;exports.branchInstance=e.branchInstance;exports.coreClient=e.coreClient;exports.createToastInterface=e.createToastInterface;exports.dateFormat=e.dateFormat;exports.default=e.index;exports.divisionInstance=e.divisionInstance;exports.filterQuery=e.filterQuery;exports.globalEventBus=e.globalEventBus;exports.manageUserInstance=e.manageUserInstance;exports.orgInstance=e.orgInstance;exports.provideToast=e.provideToast;exports.scopedClient=e.scopedClient;exports.setupAuthGuard=e.setupAuthGuard;exports.teamInstance=e.teamInstance;exports.toastInjectionKey=e.toastInjectionKey;exports.useAuth=e.useAuth;exports.useBranchStore=e.useBranchStore;exports.useCustomizer=e.useCustomizer;exports.useDialog=e.useDialog;exports.useDivisionStore=e.useDivisionStore;exports.useManageUserStore=e.useManageUserStore;exports.useOrganizationStore=e.useOrganizationStore;exports.useSession=e.useSession;exports.useTeamStore=e.useTeamStore;exports.useToast=e.useToast;
@@ -1,4 +1,4 @@
1
- import { D as t, f as n, k as r, C as o, l as i, q as l, n as u, r as c, P as d, Q as m, F as S, o as T, H as p, I as b, M as g, B as C, p as I, E as v, y as B, t as F, v as J, w as A, x as D, R as f, A as h, j as E, S as M, G as x, U as y, z as H, e as P, g as G, h as O, T as U, d as z, a as L, a0 as j, c as w, V as K, O as N, i as Q, Z as V, N as Y, W as _, a2 as k, $ as q, X as R, a8 as W, s as X, a1 as Z, Y as $, b as aa, a5 as sa, J as ea, K as ta, a3 as na, a7 as ra, a4 as oa, u as ia, a6 as la, L as ua } from "./index-BR15WIpi.mjs";
1
+ import { D as t, f as n, k as r, C as o, l as i, q as l, n as u, r as c, P as d, Q as m, F as S, o as T, H as p, I as b, M as g, B as C, p as I, E as v, y as B, t as F, v as J, w as A, x as D, R as f, A as h, j as E, S as M, G as x, U as y, z as H, e as P, g as G, h as O, T as U, d as z, a as L, a0 as j, c as w, V as K, O as N, i as Q, Z as V, N as Y, W as _, a2 as k, $ as q, X as R, a8 as W, s as X, a1 as Z, Y as $, b as aa, a5 as sa, J as ea, K as ta, a3 as na, a7 as ra, a4 as oa, u as ia, a6 as la, L as ua } from "./index-rEtGavjD.mjs";
2
2
  import "@vueuse/core";
3
3
  export {
4
4
  t as AvatarPicture,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jplan-pack",
3
- "version": "0.6.642",
3
+ "version": "0.6.643",
4
4
  "main": "./dist/jplan-pack.cjs.js",
5
5
  "module": "./dist/jplan-pack.es.js",
6
6
  "types": "dist/types/index.d.ts",