sm-click-library-ui 0.0.431 → 0.0.432
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-CmZZlNAu.js → index-qvZIg5Dm.js} +765 -771
- package/dist/sm-click-library-ui.es.js +1 -1
- package/dist/sm-click-library-ui.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{web-BeLd-9YA.js → web-Duu1BXH4.js} +2 -2
- package/dist/{web-Bl-IXp0O.js → web-hFuzStce.js} +2 -2
- package/package.json +1 -1
|
@@ -129,4 +129,4 @@ $bm_rt = loopOut('cycle', 0);`},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,
|
|
|
129
129
|
c5.426-1.969,11.42-1.629,16.591,0.935c5.171,2.565,9.08,7.133,10.792,12.646L353.732,451.163z M296.189,175.873
|
|
130
130
|
c-5.686-1.423-12.815-2.847-22.064-2.847c-47.017,0-84.035,46.27-84.035,101.11c0,27.053,12.117,44.117,35.594,44.117
|
|
131
131
|
c26.346,0,54.125-33.443,60.527-74.754L296.189,175.873z"/>
|
|
132
|
-
</svg>`,info:a.content.info??"Nome que será atribuído no Produto",type:a.content.type??"text",placeholder:a.content.placeholder??"Integração de sistemas",empty:a.content.empty??!1,data:a.content.data??""}),i=e.ref(r.data);e.watch(i,l=>{o("update:content",{...r,data:l})},{immediate:!0,deep:!0}),e.watch(()=>a.content,l=>{l.data!==i.value&&(i.value=l.data),l.empty!==r.empty&&(r.empty=l.empty)},{deep:!0});const s=e.computed(()=>r.empty&&!i.value);return(l,d)=>{const u=e.resolveComponent("Popper");return e.openBlock(),e.createElementBlock("section",Vy,[e.createElementVNode("header",My,[e.createElementVNode("p",Ny,e.toDisplayString(r.title),1),e.createVNode(u,{hover:"",content:r.info,placement:"top",arrow:""},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1},8,["content"])]),e.createElementVNode("div",{class:e.normalizeClass(["input__container",s.value?"input__container--error":"",r.type==="textArea"?"textArea":""])},[r.type!=="textArea"?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(s.value?"text-red-500":"text-base-100"),innerHTML:r.svg},null,10,Ay)):e.createCommentVNode("",!0),r.type!=="textArea"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:r.type,key:r.type,placeholder:r.placeholder,"onUpdate:modelValue":d[0]||(d[0]=c=>i.value=c),class:e.normalizeClass([s.value?"empty":null,"input__field"])},null,10,Ty)),[[e.vModelDynamic,i.value]]):e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:e.normalizeClass([s.value?"empty":null,"input__field h-full resize-y"]),"onUpdate:modelValue":d[1]||(d[1]=c=>i.value=c),placeholder:r.placeholder},null,10,Dy)),[[e.vModelText,i.value]]),s.value?(e.openBlock(),e.createElementBlock("span",Fy," Campo obrigatório ")):e.createCommentVNode("",!0)],2)])}}},[["__scopeId","data-v-cfd206c7"]]),Ly=["onClick"],$y={key:0,xmlns:"http://www.w3.org/2000/svg",class:"size-4 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Py=["onClick"],Oy={key:0,xmlns:"http://www.w3.org/2000/svg",class:"size-4 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mi=Ce({__name:"simpleSelect",props:{modelValue:{type:[Array,String,Number,Object],default:()=>[]},options:{type:Array,required:!0,default:()=>[]},placeholder:{type:String,default:"Selecione uma opção..."},multiple:{type:Boolean,default:!1},theme:{type:String,default:"bg-base-300 border-base-300"},teleportTo:{type:String,default:null}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(!1),i=e.ref(null),s=e.ref(null),l=e.ref({});Bn(i,()=>r.value=!1);const d=()=>{if(!a.teleportTo||!s.value)return;const g=s.value.getBoundingClientRect();l.value={position:"fixed",top:`${g.bottom+6}px`,left:`${g.left}px`,width:`${g.width}px`,zIndex:9999}};e.watch(r,g=>{g&&d()});const u=[];e.onMounted(()=>{if(a.teleportTo){const g=()=>{r.value&&d()};window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),u.push(["scroll",g],["resize",g])}}),e.onUnmounted(()=>{u.forEach(([g,m])=>window.removeEventListener(g,m,g==="scroll"?!0:void 0))});const c=g=>a.multiple&&Array.isArray(a.modelValue)?a.modelValue.includes(g):a.modelValue===g,h=g=>{if(a.multiple){const m=Array.isArray(a.modelValue)?[...a.modelValue]:[],p=m.indexOf(g);p===-1?m.push(g):m.splice(p,1),o("update:modelValue",m)}else o("update:modelValue",g),r.value=!1},f=e.computed(()=>{if(a.multiple&&Array.isArray(a.modelValue))return a.modelValue.length===0?a.placeholder:a.options.filter(p=>a.modelValue.includes(p.value)).map(p=>p.name).join(", ");const g=a.options.find(m=>m.value===a.modelValue);return(g==null?void 0:g.name)||a.placeholder});return(g,m)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full",ref_key:"dropdownRef",ref:i},[e.createElementVNode("div",{onClick:m[0]||(m[0]=p=>r.value=!r.value),class:e.normalizeClass(["flex flex-wrap items-center justify-between p-3 gap-2 rounded-md cursor-pointer transition",t.theme]),ref_key:"triggerRef",ref:s},[e.createElementVNode("span",{class:e.normalizeClass(["text-xs truncate max-w-full",f.value===t.placeholder?"text-gray-400":"text-white"])},e.toDisplayString(f.value),3),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["size-3 text-white transition-transform duration-300",r.value?"rotate-180":""]),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[...m[1]||(m[1]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m19 9-7 7-7-7"},null,-1)])],2))],2),r.value&&!t.teleportTo?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["absolute flex flex-col z-10 mt-1.5 w-full shadow-sm border rounded-md max-h-64 overflow-y-auto hide-scrollbar",t.theme])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,p=>(e.openBlock(),e.createElementBlock("button",{key:p.value,class:e.normalizeClass([c(p.value)?"bg-green-500/30 hover:bg-green-500/50":"hover:bg-base-200","flex items-center justify-between gap-2 px-3 py-2 text-left text-sm cursor-pointer transition w-full"]),onClick:y=>h(p.value)},[e.createElementVNode("span",null,e.toDisplayString(p.name),1),c(p.value)?(e.openBlock(),e.createElementBlock("svg",$y,[...m[2]||(m[2]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],10,Ly))),128))],2)):e.createCommentVNode("",!0),r.value&&t.teleportTo?(e.openBlock(),e.createBlock(e.Teleport,{key:1,to:t.teleportTo},[e.createElementVNode("div",{style:e.normalizeStyle(l.value),class:e.normalizeClass(["flex flex-col shadow-sm border rounded-md max-h-64 overflow-y-auto hide-scrollbar",t.theme])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,p=>(e.openBlock(),e.createElementBlock("button",{key:p.value,class:e.normalizeClass([c(p.value)?"bg-green-500/30 hover:bg-green-500/50":"hover:bg-base-200","flex items-center justify-between gap-2 px-3 py-2 text-left text-sm cursor-pointer transition w-full"]),onClick:y=>h(p.value)},[e.createElementVNode("span",null,e.toDisplayString(p.name),1),c(p.value)?(e.openBlock(),e.createElementBlock("svg",Oy,[...m[3]||(m[3]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],10,Py))),128))],6)],8,["to"])):e.createCommentVNode("",!0)],512))}},[["__scopeId","data-v-3ee440f9"]]),_y={class:"flex gap-2"},Hy=Ce({__name:"outcomeButton",props:{outcome:{type:String,default:null}},emits:["update:outcome","change"],setup(t,{emit:n}){const a=t,o=n;async function r(l){const d=a.outcome===l?null:l;o("update:outcome",d),o("change",d)}const i=e.computed(()=>a.outcome==="won"),s=e.computed(()=>a.outcome==="lost");return(l,d)=>(e.openBlock(),e.createElementBlock("div",_y,[e.createElementVNode("button",{onClick:d[0]||(d[0]=u=>r("won")),class:e.normalizeClass(["button_outcome-base",{"button_outcome-active-won":i.value}])},[d[3]||(d[3]=e.createElementVNode("p",null,"Ganho",-1)),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass([{"svg_outcome-active-won":i.value},"text-white size-4"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"none"},[...d[2]||(d[2]=[e.createElementVNode("path",{d:"M3.16666 6.37502C3.74962 6.37502 4.2222 6.85073 4.22222 7.43752V15.9375C4.22222 16.5243 3.74963 17 3.16666 17H1.05555C0.472588 17 0 16.5243 0 15.9375V7.43752C1.50967e-05 6.85073 0.472597 6.37502 1.05555 6.37502H3.16666Z",fill:"CurrentColor"},null,-1),e.createElementVNode("path",{d:"M9.48143 1.4454C9.79496 -0.637173 11.5194 0.143216 11.5194 0.143216C13.863 1.75728 13.005 4.80783 12.2832 6.13118H17.4424C19.5307 6.65187 19.0768 8.34354 18.5887 9.12465C19.5056 10.7905 18.4191 11.7716 17.7609 12.0538C18.1175 13.7717 17.0601 14.4178 16.4869 14.5264C16.8944 16.4004 15.5533 16.9564 14.8314 17H10.436C8.49997 16.9999 6.19055 16.1753 5.27777 15.7632V7.368C9.03523 5.6108 9.09933 3.98356 9.48143 1.4454Z",fill:"CurrentColor"},null,-1)])],2))],2),e.createElementVNode("button",{onClick:d[1]||(d[1]=u=>r("lost")),class:e.normalizeClass(["button_outcome-base",{"button_outcome-active-lost":s.value}])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass([{"svg_outcome-active-lost":s.value},"text-white size-4 mt-0.8"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 19",fill:"none"},[...d[4]||(d[4]=[e.createElementVNode("path",{d:"M15.8333 10.625C15.2504 10.625 14.7778 10.1493 14.7778 9.56249L14.7778 1.0625C14.7778 0.475698 15.2504 1.57955e-06 15.8333 1.63051e-06L17.9444 1.81507e-06C18.5274 1.86603e-06 19 0.475698 19 1.0625L19 9.56249C19 10.1493 18.5274 10.625 17.9444 10.625L15.8333 10.625Z",fill:"CurrentColor"},null,-1),e.createElementVNode("path",{d:"M9.51857 15.5546C9.20504 17.6372 7.48065 16.8568 7.48065 16.8568C5.13698 15.2427 5.99503 12.1922 6.71681 10.8688L1.55759 10.8688C-0.530671 10.3481 -0.0768444 8.65646 0.411319 7.87535C-0.50562 6.20951 0.580926 5.22844 1.23906 4.94622C0.882549 3.22832 1.93994 2.5822 2.51315 2.47363C2.10564 0.59965 3.44673 0.0436064 4.16864 6.1075e-07L8.56403 9.95007e-07C10.5 0.000138493 12.8095 0.824657 13.7222 1.23682L13.7222 9.632C9.96477 11.3892 9.90067 13.0164 9.51857 15.5546Z",fill:"CurrentColor"},null,-1)])],2)),d[5]||(d[5]=e.createElementVNode("p",null,"Perdido",-1))],2)]))}},[["__scopeId","data-v-cde71744"]]),Ry={class:"flex gap-1 select-none"},zy=["onMousemove","onClick"],ao=Ce({__name:"raitingInput",props:{modelValue:{type:Number,default:0}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(a.modelValue),i=e.ref(0);e.watch(()=>a.modelValue,c=>{r.value=c});const s=e.computed(()=>i.value||r.value);function l(c){const h=s.value-c+1;return h>=1?"100%":h>=.5?"50%":h>0?`${h*100}%`:"0%"}function d(c,h){const f=c.currentTarget.getBoundingClientRect(),g=c.offsetX<f.width/2;i.value=h-(g?.5:0)}function u(c,h){const f=c.currentTarget.getBoundingClientRect(),g=c.offsetX<f.width/2,m=h-(g?.5:0);r.value=r.value===m?0:m,o("update:modelValue",r.value)}return(c,h)=>(e.openBlock(),e.createElementBlock("main",Ry,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,f=>e.createElementVNode("div",{key:f,class:"relative size-6 cursor-pointer",onMousemove:g=>d(g,f),onMouseleave:h[0]||(h[0]=g=>i.value=0),onClick:g=>u(g,f)},[h[2]||(h[2]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"absolute top-0 left-0 size-6 color-disabled"},[e.createElementVNode("path",{d:"M13.849 4.22c-.684-1.626-3.014-1.626-3.698 0L8.397 8.387l-4.552.361c-1.775.14-2.495 2.331-1.142 3.477l3.468 2.937-1.06 4.392c-.413 1.713 1.472 3.067 2.992 2.149L12 19.35l3.897 2.354c1.52.918 3.405-.436 2.992-2.15l-1.06-4.39 3.468-2.938c1.353-1.146.633-3.336-1.142-3.477l-4.552-.36-1.754-4.17Z"})],-1)),e.createElementVNode("div",{class:"absolute top-0 left-0 h-full overflow-hidden text-primary transition-all duration-150",style:e.normalizeStyle({width:l(f)})},[...h[1]||(h[1]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"size-6"},[e.createElementVNode("path",{d:"M13.849 4.22c-.684-1.626-3.014-1.626-3.698 0L8.397 8.387l-4.552.361c-1.775.14-2.495 2.331-1.142 3.477l3.468 2.937-1.06 4.392c-.413 1.713 1.472 3.067 2.992 2.149L12 19.35l3.897 2.354c1.52.918 3.405-.436 2.992-2.15l-1.06-4.39 3.468-2.938c1.353-1.146.633-3.336-1.142-3.477l-4.552-.36-1.754-4.17Z"})],-1)])],4)],40,zy)),64))]))}},[["__scopeId","data-v-af20a8bd"]]),jy={key:0,class:"flex items-center justify-center overflow-hidden h-svh"},Gy={key:1,class:"flex flex-col"},Iy={key:0,class:"sticky top-0 z-10 bg-base-300 p-1 flex gap-2"},qy={class:"total-price-badge"},Wy={class:"flex-1 overflow-y-auto flex flex-col gap-2 px-2"},Uy={key:0,class:"w-full text-gray-500 list-none list-inside dark:text-gray-400 divide-y divide-base-200"},Zy={class:"flex gap-2 items-center"},Yy=["src"],Xy={key:1,class:"size-8 rounded-md flex items-center justify-center border border-base-200"},Ky={class:"flex flex-col items-start"},Qy={class:"text-xs font-semibold font-sans"},Jy={class:"flex gap-1"},ek={class:"flex gap-1"},tk=["onClick"],nk=["onClick"],ak={key:1,class:"flex flex-col gap-1 min-h-48 flex-1 w-full justify-center items-center"},ok=Ce({__name:"listProducts",props:{modelValue:{type:Array,default:()=>[]},allProducts:{type:Object,default:()=>{}}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(!1),i=e.ref([]),s=e.ref([...a.modelValue]),l=e.ref(1),d=e.ref(null),u=e.ref(null),c=e.computed(()=>s.value.reduce((A,H)=>{var N;const C=((N=H.product)==null?void 0:N.price)||H.price||0,x=H.quantity||0;return A+C*x},0)),h=e.computed(()=>{const A={};return s.value.forEach(H=>{A[H.product.id]=H.quantity}),A}),f=A=>h.value[A.id]||0,g=A=>{const H=s.value.find(C=>C.product.id===A.id);H?H.quantity++:s.value.push({product:{...A},quantity:1})},m=A=>{const H=s.value.find(C=>C.product.id===A.id);H&&(H.quantity>0?H.quantity--:H.quantity=0)},p=(A,H)=>{const C=new URLSearchParams,x=A;return Object.keys(H).forEach(N=>C.append(N,H[N])),`${x}?${C.toString()}`},y=async A=>{try{const{data:H}=await at.get(p(Ls,{page:l.value,...A})),{results:C,next:x,previous:N}=H;if(d.value=x,u.value=N,l.value===1)i.value=C;else{const L=new Set(i.value.map(S=>S.id)),F=C.filter(S=>!L.has(S.id));i.value=[...i.value,...F]}d.value&&(l.value+=1)}catch(H){console.error("Erro ao buscar produtos:",H)}};e.onMounted(async()=>{var A;a.allProducts&&((A=a.allProducts.results)==null?void 0:A.length)>0?(i.value=a.allProducts.results,d.value=a.allProducts.next||null,u.value=a.allProducts.previous||null,l.value=2):await y()}),e.watch(s,A=>{o("update:modelValue",A)},{deep:!0});const k=e.ref(!1),b=async A=>{if(!k.value){k.value=!0;try{if(!d.value){A.complete();return}await y(),d.value?A.loaded():A.complete()}catch(H){console.error("Erro ao carregar produtos:",H),A.complete()}finally{k.value=!1}}},E=e.ref({query:""}),V=e.ref(!1);let M;return e.watch(E,()=>{clearTimeout(M),M=setTimeout(async()=>{const{query:A}=E.value;l.value=1,V.value=!!A,r.value=!0,await y({query:A}),r.value=!1},500)},{deep:!0}),(A,H)=>{const C=e.resolveComponent("SimpleLoader");return r.value?(e.openBlock(),e.createElementBlock("div",jy,[e.createVNode(C)])):(e.openBlock(),e.createElementBlock("main",Gy,[i.value.length>0&&!V.value||V.value?(e.openBlock(),e.createElementBlock("header",Iy,[e.withDirectives(e.createElementVNode("input",{class:"w-full text-xs bg-base-300 rounded-md p-1 outline-none border-none focus:outline-none focus:ring-0 focus:shadow-none",type:"text",placeholder:"Buscar...","onUpdate:modelValue":H[0]||(H[0]=x=>E.value.query=x)},null,512),[[e.vModelText,E.value.query]]),e.createElementVNode("section",qy," Valor total: R$"+e.toDisplayString(c.value.toFixed(2)),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Wy,[i.value.length>0&&!V.value||V.value?(e.openBlock(),e.createElementBlock("ul",Uy,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(x,N)=>(e.openBlock(),e.createElementBlock("li",{class:"flex w-full justify-between items-center py-2",key:x.id},[e.createElementVNode("div",Zy,[e.createElementVNode("section",null,[x.photo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"size-8 rounded-md",src:x.photo,alt:""},null,8,Yy)):(e.openBlock(),e.createElementBlock("div",Xy,[...H[1]||(H[1]=[e.createElementVNode("svg",{class:"w-6 h-6","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[e.createElementVNode("path",{fill:"currentColor",d:"M4 19v2c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-2H4Z"}),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M9 3c0-.55228.44772-1 1-1h8c.5523 0 1 .44772 1 1v3c0 .55228-.4477 1-1 1h-2v1h2c.5096 0 .9376.38314.9939.88957L19.8951 17H4.10498l.90116-8.11043C5.06241 8.38314 5.49047 8 6.00002 8H12V7h-2c-.55228 0-1-.44772-1-1V3Zm1.01 8H8.00002v2.01H10.01V11Zm.99 0h2.01v2.01H11V11Zm5.01 0H14v2.01h2.01V11Zm-8.00998 3H10.01v2.01H8.00002V14ZM13.01 14H11v2.01h2.01V14Zm.99 0h2.01v2.01H14V14ZM11 4h6v1h-6V4Z","clip-rule":"evenodd"})],-1)])]))]),e.createElementVNode("section",Ky,[e.createElementVNode("p",{class:e.normalizeClass(["text-xs font-semibold",f(x)>0?"text-white":""])},e.toDisplayString(x.name),3),e.createElementVNode("p",Qy," R$ "+e.toDisplayString(x.price.toFixed(2)),1)])]),e.createElementVNode("section",Jy,[e.createElementVNode("p",{class:e.normalizeClass(["text-xs font-semibold font-sans products-and-services_badge",x.recurrence])},e.toDisplayString(x.recurrence==="monthly"?"Mensal":"Único"),3),e.createElementVNode("div",ek,[e.createElementVNode("button",{class:"bg-base-200 size-6 rounded-md flex items-center justify-center",onClick:L=>m(x)}," - ",8,tk),e.createElementVNode("p",{class:e.normalizeClass(["w-5 text-xs flex items-center justify-center font-semibold font-sans",f(x)>0?"text-white":""])},e.toDisplayString(f(x)),3),e.createElementVNode("button",{class:"bg-base-200 size-6 rounded-md flex items-center justify-center",onClick:L=>g(x)}," + ",8,nk)])])]))),128))])):e.createCommentVNode("",!0),V.value&&i.value.length===0||i.value.length===0?(e.openBlock(),e.createElementBlock("section",ak,[...H[2]||(H[2]=[e.createStaticVNode('<p class="text-gray-600 text-base font-sans" data-v-22918a3e>Nenhum item encontrado</p><p class="text-gray-600 text-xs font-sans" data-v-22918a3e> Comece criando seu primeiro na aba <strong data-v-22918a3e>Produtos</strong></p><button class="bg-green-700 text-white py-1 px-2 rounded-md text-xs mt-2 hover:bg-green-600 flex gap-1 items-center justify-center" data-v-22918a3e><p data-v-22918a3e>Criar novo</p><svg class="size-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" data-v-22918a3e><path fill="currentColor" d="M4 19v2c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-2H4Z" data-v-22918a3e></path><path fill="currentColor" fill-rule="evenodd" d="M9 3c0-.55228.44772-1 1-1h8c.5523 0 1 .44772 1 1v3c0 .55228-.4477 1-1 1h-2v1h2c.5096 0 .9376.38314.9939.88957L19.8951 17H4.10498l.90116-8.11043C5.06241 8.38314 5.49047 8 6.00002 8H12V7h-2c-.55228 0-1-.44772-1-1V3Zm1.01 8H8.00002v2.01H10.01V11Zm.99 0h2.01v2.01H11V11Zm5.01 0H14v2.01h2.01V11Zm-8.00998 3H10.01v2.01H8.00002V14ZM13.01 14H11v2.01h2.01V14Zm.99 0h2.01v2.01H14V14ZM11 4h6v1h-6V4Z" clip-rule="evenodd" data-v-22918a3e></path></svg></button>',3)])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createBlock(e.unref(Xt),{key:2,onInfinite:b,class:"p-3 bg-base-300"},{spinner:e.withCtx(()=>[...H[3]||(H[3]=[e.createElementVNode("section",{class:"w-full justify-center items-center flex"},[e.createElementVNode("div",{class:"size-4 animate-spin rounded-full border-4 border-solid border-white border-t-transparent"})],-1)])]),_:1})):e.createCommentVNode("",!0)])]))}}},[["__scopeId","data-v-22918a3e"]]),rk={},ik={class:"flex items-center justify-center h-full"};function sk(t,n){return e.openBlock(),e.createElementBlock("div",ik,[...n[0]||(n[0]=[e.createElementVNode("span",{class:"products-and-services_bar"},null,-1),e.createElementVNode("span",{class:"products-and-services_bar"},null,-1),e.createElementVNode("span",{class:"products-and-services_bar"},null,-1)])])}const oo=Ce(rk,[["render",sk],["__scopeId","data-v-3f0502dd"]]),lk={key:0,class:"flex items-center justify-center overflow-hidden h-svh"},ck={key:1,class:"rounded-md bg-base-200 border border-white/10 shadow-sm transition-shadow duration-200 hover:shadow-md p-1"},dk={class:"flex flex-col gap-2"},uk=["onUpdate:modelValue"],fk={class:"text-[10px] font-sans"},mk=["onUpdate:modelValue"],hk=["onUpdate:modelValue"],pk=Ce({__name:"listSegmentationsFields",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(s(a.modelValue)),i=e.ref(!1);function s(d){return JSON.parse(JSON.stringify(d))}const l=async()=>{try{i.value=!0;const d=await at.get(Ps);r.value=d.data}catch(d){console.error("Error fetching segmentation fields:",d)}finally{i.value=!1}};return e.onMounted(()=>{a.modelValue.length===0&&l()}),e.watch(()=>a.modelValue,d=>{r.value=s(d)},{deep:!0}),e.watch(r,d=>{o("update:modelValue",s(d))},{deep:!0}),(d,u)=>{const c=e.resolveComponent("SimpleSelect");return i.value?(e.openBlock(),e.createElementBlock("div",lk,[e.createVNode(oo)])):(e.openBlock(),e.createElementBlock("div",ck,[u[0]||(u[0]=e.createElementVNode("header",{class:"text-start w-full items-center justify-between flex mb-2 px-1"},[e.createElementVNode("p",{class:"text-sm font-semibold"},"Campos Personalizados")],-1)),e.createElementVNode("div",dk,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,h=>(e.openBlock(),e.createElementBlock("section",{key:h.id},[e.createElementVNode("div",{class:e.normalizeClass(["flex gap-1 rounded-md",h.type==="bool"?"flex-row items-center":"flex-col items-start"])},[h.type==="bool"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"checkbox size-4 rounded-sm",type:"checkbox","onUpdate:modelValue":f=>h.content=f},null,8,uk)),[[e.vModelCheckbox,h.content]]):e.createCommentVNode("",!0),e.createElementVNode("p",fk,e.toDisplayString(h.name)+":",1),h.type==="string"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"input_field",type:"text","onUpdate:modelValue":f=>h.content=f},null,8,mk)),[[e.vModelText,h.content]]):e.createCommentVNode("",!0),h.type==="float"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:2,class:"input_field",type:"number","onUpdate:modelValue":f=>h.content=f},null,8,hk)),[[e.vModelText,h.content]]):e.createCommentVNode("",!0),h.type==="list"?(e.openBlock(),e.createBlock(c,{key:3,modelValue:h.content,"onUpdate:modelValue":f=>h.content=f,options:h.additional_info.list.options.map(f=>({value:f,name:f})),placeholder:"Selecione uma opção",theme:"bg-base-300 border-base-100","teleport-to":"body"},null,8,["modelValue","onUpdate:modelValue","options"])):e.createCommentVNode("",!0)],2)]))),128))])]))}}},[["__scopeId","data-v-94f95167"]]),gk={class:"modal_head"},yk={class:"modal_responsive"},kk={style:{"min-height":"100%"},class:"flex min-h-full items-center justify-center text-center"},xk={class:"modal-form-container"},bk={class:"flex justify-between p-2.5 rounded-t-2xl bg-base-300 items-center text-current"},wk={class:"flex items-center gap-2"},Ek={class:"flex flex-col items-start"},vk={class:"text-lg font-semibold"},Ck={key:0,class:"text-xs text-gray-400"},Sk={class:"flex gap-2 items-center"},Bk={class:"grid grid-cols-2 flex-1 min-h-0 overflow-hidden"},Vk={class:"w-full flex flex-col justify-between items-center p-1"},Mk={class:"flex flex-col gap-2 justify-center items-center"},Nk={title:"Não é possível alterar a foto do cliente neste momento",class:"flex items-center justify-center w-full"},Ak=["src"],Tk={key:1,class:"bg-base-300 p-2 rounded-xl size-24 flex items-center justify-center border border-base-100 cursor-not-allowed"},Dk={class:"flex flex-col w-full gap-2"},Fk={class:"flex flex-col gap-2 w-full"},Lk={class:"w-full"},$k={class:"flex flex-col gap-2 w-full"},Pk={class:"flex items-center justify-between px-1"},Ok={key:0,class:"flex flex-col gap-2"},_k={class:"flex items-center justify-between px-1"},Hk={class:"w-full bg-base-300 rounded-lg"},Rk={class:"bg-base-300 flex flex-col flex-1 min-h-0"},zk={key:0,class:"flex gap-1 px-1.5"},jk=["disabled"],Gk={key:1,class:"flex flex-col gap-2 flex-1 min-h-0 px-1.5 pt-1.5 overflow-hidden"},Ik={class:"rounded-md bg-base-200 border border-white/10 shadow-sm transition-shadow duration-200 hover:shadow-md"},qk={class:"flex w-full"},Wk={class:"segmentation-section"},Uk={class:"products-list-section flex-1 min-h-0"},Zk={class:"modal_end_button"},Yk=["disabled"],Xk={key:0,class:"size-4 animate-spin rounded-full border-4 border-solid text-white border-t-transparent"},Kk={key:1,class:"text-xs font-semibold"},hi=Ce({__name:"clientsForm",props:{form:{type:Object,default:()=>({tags:[],country:"BR",name:"",photo:null,raw_telephone:"",telephone:"",whatsapp_id:"",whatsapp_jid:"",whatsapp_lid:null,rating:null,outcome:null,created_at:"",updated_at:"",client:"",products:[],notes:""})},save:{type:Function,default:()=>{}},hasCrmPlus:{type:Boolean,default:!1},allProducts:{type:Object,default:()=>{}},allTags:{type:Object,default:()=>{}}},emits:["close","save"],setup(t,{emit:n}){const a=n,o=e.ref("data"),r=t,i=e.reactive({...r.form}),s=e.ref(!1),l=e.ref(!1),d=e.ref([{title:"Nome",info:"Nome do contato",type:"text",placeholder:"Digite o nome do contato",empty:e.computed(()=>l.value),data:e.computed({get:()=>i.name,set:h=>i.name=h})},{title:"Descrição",info:"Descreva o produto para facilitar a identificação",type:"textArea",placeholder:"Automatize fluxos de trabalho com integração rápida e segura entre sistemas.",empty:!1,data:e.computed({get:()=>i.notes,set:h=>i.notes=h})}]),u=e.computed(()=>r.form.mode==="edit"?"Editar cliente":"Adicionar Novo Cliente"),c=async()=>{try{if(l.value=i.name.trim()==="",l.value)return;s.value=!0,await r.save(i)}catch(h){console.error(h)}finally{s.value=!1}};return e.watch(()=>r.form,h=>{Object.assign(i,e.toRaw(h))},{deep:!0,immediate:!0}),(h,f)=>{var p,y,k;const g=e.resolveComponent("Popper"),m=e.resolveComponent("vue-tel-input");return e.openBlock(),e.createElementBlock("div",gk,[f[24]||(f[24]=e.createElementVNode("div",{class:"modal-form-background"},null,-1)),e.createElementVNode("div",yk,[e.createElementVNode("div",kk,[e.createElementVNode("div",xk,[e.createElementVNode("div",{class:e.normalizeClass([{noCrmPlus:!t.hasCrmPlus},"clients-form-background relative rounded-2xl bg-base-200 backdrop-blur-lg"])},[e.createElementVNode("div",bk,[e.createElementVNode("span",wk,[f[14]||(f[14]=e.createElementVNode("svg",{class:"size-6 text-green-500","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4h-4Z","clip-rule":"evenodd"})],-1)),e.createElementVNode("span",Ek,[e.createElementVNode("p",vk,e.toDisplayString(u.value),1),i.id?(e.openBlock(),e.createElementBlock("p",Ck," ID: "+e.toDisplayString(i.id),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("section",Sk,[e.createElementVNode("button",{class:"bg-base-200 p-1.5 rounded-md hover:bg-base-200/70 transition",onClick:f[0]||(f[0]=b=>a("close"))},[...f[15]||(f[15]=[e.createElementVNode("svg",{class:"size-4 text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18 17.94 6M18 18 6.06 6"})],-1)])])])]),e.createElementVNode("div",Bk,[e.createElementVNode("section",Vk,[e.createElementVNode("div",Mk,[t.hasCrmPlus?(e.openBlock(),e.createBlock(Hy,{key:0,outcome:i.outcome,"onUpdate:outcome":f[1]||(f[1]=b=>i.outcome=b),G:""},null,8,["outcome"])):e.createCommentVNode("",!0),e.createElementVNode("div",Nk,[i.photo?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:f[2]||(f[2]=b=>h.viewSingleImage(i.photo))},[e.createElementVNode("img",{src:i.photo,alt:"",class:"size-24 object-cover rounded-md cursor-not-allowed"},null,8,Ak)])):(e.openBlock(),e.createElementBlock("span",Tk,[...f[16]||(f[16]=[e.createElementVNode("svg",{class:"size-14","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4h-4Z","clip-rule":"evenodd"})],-1)])]))]),t.hasCrmPlus?(e.openBlock(),e.createBlock(ao,{key:1,modelValue:i.rating,"onUpdate:modelValue":f[3]||(f[3]=b=>i.rating=b)},null,8,["modelValue"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Dk,[e.createElementVNode("div",Fk,[e.createElementVNode("div",Lk,[e.createVNode(no,{"onUpdate:content":f[4]||(f[4]=b=>d.value[0].data=b.data),content:d.value[0]},null,8,["content"])]),e.createElementVNode("div",$k,[e.createElementVNode("header",Pk,[f[18]||(f[18]=e.createElementVNode("p",{class:"text-xs font-medium text-left"}," Escolha suas etiquetas ",-1)),e.createVNode(g,{hover:"",content:"Etiquetas que estão atribuídas ao cliente",placement:"top",arrow:""},{default:e.withCtx(()=>[...f[17]||(f[17]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1})]),e.createVNode(to,{teleportTo:"body",maxHeight:"10rem",allTags:t.allTags,modelValue:i.tags,"onUpdate:modelValue":f[5]||(f[5]=b=>i.tags=b)},null,8,["allTags","modelValue"])]),t.hasCrmPlus?(e.openBlock(),e.createElementBlock("div",Ok,[e.createElementVNode("header",_k,[f[20]||(f[20]=e.createElementVNode("p",{class:"text-xs font-medium text-left"}," Anotações sobre o cliente ",-1)),e.createVNode(g,{hover:"",content:"Anotações adicionais sobre o cliente",placement:"top",arrow:""},{default:e.withCtx(()=>[...f[19]||(f[19]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1})]),e.createElementVNode("div",Hk,[e.withDirectives(e.createElementVNode("textarea",{style:{padding:"0.5rem",resize:"none"},class:"w-full bg-base-300 text-xs rounded-md outline-none border-none focus:outline-none focus:ring-0 focus:shadow-none h-24 p-2 resize-none","onUpdate:modelValue":f[6]||(f[6]=b=>i.notes=b),maxlength:"1000"},null,512),[[e.vModelText,i.notes]]),e.createElementVNode("div",{class:e.normalizeClass(["text-right pr-2 pb-1 text-[10px]",((p=i.notes)==null?void 0:p.length)>900?"text-red-500":((y=i.notes)==null?void 0:y.length)>700?"text-yellow-500":"text-gray-400"])},e.toDisplayString(((k=i.notes)==null?void 0:k.length)||0)+"/1000 ",3)])])):e.createCommentVNode("",!0)])])]),e.createElementVNode("section",Rk,[t.hasCrmPlus?(e.openBlock(),e.createElementBlock("div",zk,[e.createElementVNode("button",{class:e.normalizeClass(["toggle-page-button",{selected:o.value==="data"}]),onClick:f[7]||(f[7]=b=>o.value="data")}," Dados do cliente ",2),e.createElementVNode("button",{class:e.normalizeClass(["toggle-page-button",{selected:o.value==="products"}]),disabled:!t.hasCrmPlus,onClick:f[8]||(f[8]=b=>o.value="products")},[...f[21]||(f[21]=[e.createElementVNode("p",null,"Produtos",-1)])],10,jk)])):e.createCommentVNode("",!0),o.value==="data"?(e.openBlock(),e.createElementBlock("div",Gk,[e.createElementVNode("div",Ik,[f[23]||(f[23]=e.createElementVNode("h1",{class:"text-start w-full items-center justify-between flex p-2"},[e.createElementVNode("p",{class:"text-xs font-semibold"},"Contatos")],-1)),e.createElementVNode("div",qk,[f[22]||(f[22]=e.createElementVNode("span",{style:{"border-bottom-left-radius":"0.4rem"},class:"bg-base-300 rounded-bl-lg rounded-t-none flex justify-center items-center w-8"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",class:"size-4 text-gray-500",viewBox:"0 0 17 17"},[e.createElementVNode("path",{d:"M13.601 2.326A7.854 7.854 0 0 0 7.994 0C3.627 0 .068 3.558.064 7.926c0 1.399.366 2.76 1.057 3.965L0 16l4.204-1.102a7.933 7.933 0 0 0 3.79.965h.004c4.368 0 7.926-3.558 7.93-7.93A7.898 7.898 0 0 0 13.6 2.326zM7.994 14.521a6.573 6.573 0 0 1-3.356-.92l-.24-.144-2.494.654.666-2.433-.156-.251a6.56 6.56 0 0 1-1.007-3.505c0-3.626 2.957-6.584 6.591-6.584a6.56 6.56 0 0 1 4.66 1.931 6.557 6.557 0 0 1 1.928 4.66c-.004 3.639-2.961 6.592-6.592 6.592zm3.615-4.934c-.197-.099-1.17-.578-1.353-.646-.182-.065-.315-.099-.445.099-.133.197-.513.646-.627.775-.114.133-.232.148-.43.05-.197-.1-.836-.308-1.592-.985-.59-.525-.985-1.175-1.103-1.372-.114-.198-.011-.304.088-.403.087-.088.197-.232.296-.346.1-.114.133-.198.198-.33.065-.134.034-.248-.015-.347-.05-.099-.445-1.076-.612-1.47-.16-.389-.323-.335-.445-.34-.114-.007-.247-.007-.38-.007a.729.729 0 0 0-.529.247c-.182.198-.691.677-.691 1.654 0 .977.71 1.916.81 2.049.098.133 1.394 2.132 3.383 2.992.47.205.84.326 1.129.418.475.152.904.129 1.246.08.38-.058 1.171-.48 1.338-.943.164-.464.164-.86.114-.943-.049-.084-.182-.133-.38-.232z"})])],-1)),e.createVNode(m,{class:"z-50 w-full",onCountryChanged:f[9]||(f[9]=b=>i.country=b.iso2),mode:"national",validCharactersOnly:!0,defaultCountry:i.country,inputOptions:{placeholder:"Coloque seu telefone",showDialCode:!1,required:!0,searchBoxPlaceholder:"Brazil"},dropdownOptions:{showSearchBox:!0,showFlags:!0,searchBoxPlaceholder:"Brazil"},modelValue:i.telephone,"onUpdate:modelValue":f[10]||(f[10]=b=>i.telephone=b)},null,8,["defaultCountry","modelValue"])])]),e.createElementVNode("div",Wk,[o.value==="data"?(e.openBlock(),e.createBlock(pk,{key:0,modelValue:i.segmentation_fields,"onUpdate:modelValue":f[11]||(f[11]=b=>i.segmentation_fields=b)},null,8,["modelValue"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Uk,[e.createVNode(ok,{allProducts:t.allProducts,modelValue:i.products,"onUpdate:modelValue":f[12]||(f[12]=b=>i.products=b)},null,8,["allProducts","modelValue"])],512),[[e.vShow,o.value==="products"]])])]),e.createElementVNode("div",Zk,[e.createElementVNode("button",{disabled:s.value,class:"bg-green-500 py-2 px-4 rounded-lg text-sm font-medium hover:bg-green-500/80 transition-colors flex gap-2 items-center justify-center min-w-32",onClick:f[13]||(f[13]=b=>c())},[s.value?(e.openBlock(),e.createElementBlock("div",Xk)):(e.openBlock(),e.createElementBlock("p",Kk,"Salvar"))],8,Yk)])],2)])])])])}}},[["__scopeId","data-v-870ff451"]]),Qk={class:"flex justify-center items-center"},Jk={class:"text-[8px] font-bold"},ex={class:"tag-view-popper-content-text"},tx={class:"flex"},nx={class:"svg-list-tag","aria-hidden":"true",viewBox:"0 0 25 100",style:{color:"#d1d5db"}},ax={style:{backgroundColor:"#d1d5db"},class:"w-full ml-[-0.5rem] rounded-r-md inline-flex items-center justify-center p-0.5 border-b-2 border-gray-900"},ox={class:"text-[8px] text-black font-bold"},rx={class:"max-h-64 overflow-y-auto hide-scrollbar"},ix={class:"flex flex-col gap-2"},sx={class:"tag-view-popper-content-text"},lx={key:1},pi=Ce({__name:"tagView",props:{clients:{type:Object,required:!0}},setup(t){const n=t;return e.computed(()=>{var a,o;return((o=(a=n.clients)==null?void 0:a.tags)==null?void 0:o.slice(0,4))||[]}),(a,o)=>{const r=e.resolveComponent("Popper");return e.openBlock(),e.createElementBlock("section",Qk,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.clients.tags.slice(0,4),(i,s)=>(e.openBlock(),e.createBlock(r,{class:"tag-view-theme",arrow:"",hover:"",key:s},{content:e.withCtx(()=>[e.createElementVNode("p",ex,e.toDisplayString(i.name),1)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex",e.unref(vn)(i.color)])},[(e.openBlock(),e.createElementBlock("svg",{class:"svg-list-tag","aria-hidden":"true",viewBox:"0 0 30 100",style:e.normalizeStyle({color:i.color||"#fff"})},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])],4)),e.createElementVNode("span",{style:e.normalizeStyle({backgroundColor:i.color||"#fff"}),class:"w-full ml-[-0.10rem] rounded-r-md inline-flex items-center justify-center px-1 py-0.5 border-b-2 border-gray-900"},[e.createElementVNode("p",Jk,e.toDisplayString(i.name.charAt(0).toUpperCase()),1)],4)],2)]),_:2},1024))),128)),t.clients.tags.length>4?(e.openBlock(),e.createBlock(r,{key:0,arrow:"",hover:"",class:"tag-view-theme"},{content:e.withCtx(()=>[e.createElementVNode("section",rx,[e.createElementVNode("div",ix,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.clients.tags,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id||i.name,class:"relative inline-flex items-center rounded-md overflow-hidden"},[(e.openBlock(),e.createElementBlock("svg",{class:"size-6","aria-hidden":"true",viewBox:"0 0 75 100",style:e.normalizeStyle({color:i.color||"#fff"})},[...o[2]||(o[2]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])],4)),e.createElementVNode("span",{class:e.normalizeClass(["p-0.5 w-full text-sm font-semibold truncate text-start -ml-2",e.unref(vn)(i.color)]),style:e.normalizeStyle(["max-width: 12rem",{background:i.color||"#fff"}])},[e.createElementVNode("p",sx,e.toDisplayString(i.name),1)],6)]))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",tx,[(e.openBlock(),e.createElementBlock("svg",nx,[...o[1]||(o[1]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])])),e.createElementVNode("span",ax,[e.createElementVNode("p",ox," +"+e.toDisplayString(t.clients.tags.length-4),1)])])]),_:1})):e.createCommentVNode("",!0),!t.clients.tags||t.clients.tags.length===0?(e.openBlock(),e.createElementBlock("span",lx,"-")):e.createCommentVNode("",!0)])}}},[["__scopeId","data-v-e2356f0a"]]),gi=Ce({__name:"floating-dev",setup(t){const n=e.ref(!1),a=e.ref({x:30,y:30}),o=e.ref({x:0,y:0}),r=e.ref(!1),i=e.ref(null),s=e.ref(null),l=e.ref({vertical:"bottom",horizontal:"right"}),d=e.computed(()=>({position:"fixed",left:`${a.value.x}px`,top:`${a.value.y}px`,zIndex:1e3,cursor:r.value?"grabbing":"grab"})),u=e.computed(()=>{const p={position:"absolute",background:"#fff",borderRadius:"10px",boxShadow:"0 4px 15px rgba(0, 0, 0, 0.2)",width:"280px",maxWidth:"90vw",zIndex:1001};return l.value.vertical==="top"?p.bottom="60px":p.top="60px",l.value.horizontal==="left"?p.right="0":p.left="0",p});async function c(){if(n.value){n.value=!1;return}n.value=!0,await e.nextTick(),h()}function h(){if(!i.value||!s.value)return;const p=i.value.getBoundingClientRect(),y=s.value.offsetWidth,k=s.value.offsetHeight,b={top:p.top,bottom:window.innerHeight-(p.top+p.height),left:p.left,right:window.innerWidth-(p.left+p.width)};l.value.vertical=b.bottom<k&&b.top>k?"top":"bottom",l.value.horizontal=b.right<y&&b.left>y?"left":"right"}function f(p){r.value=!0;const y=p.type.includes("touch")?p.touches[0]:p;o.value={x:y.clientX-a.value.x,y:y.clientY-a.value.y},document.addEventListener("mousemove",g),document.addEventListener("mouseup",m),document.addEventListener("touchmove",g),document.addEventListener("touchend",m)}function g(p){if(!r.value)return;const y=p.type.includes("touch")?p.touches[0]:p,k=y.clientX-o.value.x,b=y.clientY-o.value.y,E=window.innerWidth-i.value.offsetWidth,V=window.innerHeight-i.value.offsetHeight;a.value.x=Math.min(Math.max(0,k),E),a.value.y=Math.min(Math.max(0,b),V)}function m(){r.value=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",m)}return e.onBeforeUnmount(m),(p,y)=>(e.openBlock(),e.createElementBlock("div",{class:"floating-widget",style:e.normalizeStyle(d.value),ref_key:"widgetRef",ref:i,onMousedown:f,onTouchstart:f},[e.createElementVNode("button",{class:"floating-button",onClick:e.withModifiers(c,["stop"]),"aria-label":"Abrir painel flutuante"},[...y[0]||(y[0]=[e.createElementVNode("svg",{class:"floating-button-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M370 378c28.89 23.52 46 46.07 46 86M142 378c-28.89 23.52-46 46.06-46 86M384 208c28.89-23.52 32-56.07 32-96M128 206c-28.89-23.52-32-54.06-32-94M464 288.13h-80M128 288.13H48M256 192v256",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),e.createElementVNode("path",{d:"M256 448h0c-70.4 0-128-57.6-128-128v-96.07c0-65.07 57.6-96 128-96h0c70.4 0 128 25.6 128 96V320c0 70.4-57.6 128-128 128z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),e.createElementVNode("path",{d:"M179.43 143.52a49.08 49.08 0 01-3.43-15.73A80 80 0 01255.79 48h.42A80 80 0 01336 127.79a41.91 41.91 0 01-3.12 14.3",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1)])]),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"floating-panel",ref_key:"panelRef",ref:s,style:e.normalizeStyle(u.value)},[e.renderSlot(p.$slots,"default",{},()=>[y[1]||(y[1]=e.createElementVNode("p",{style:{"text-align":"center","font-size":"0.9rem"}}," Adicione seu conteúdo aqui 👇 ",-1))],!0)],4)):e.createCommentVNode("",!0)]),_:3})],36))}},[["__scopeId","data-v-7767be25"]]);Dt.defineStore("debug",{state:()=>({message:"Debug store initialized"}),actions:{logMessage(){console.log(this.message)}}});function cx(t){t.component("primarySelect",go),t.component("departSelect",J1),t.component("attendantSelect",ei),t.component("SimpleModal",yo),t.component("simpleCard",ko),t.component("instanceSelect",rr),t.component("calendarEvents",yr),t.component("MFA",kr),t.component("MfaQrCode",Ad),t.component("chatWindow",K1),t.component("FilterSelectLib",ti),t.component("MobileInternalChat",Q1),t.component("RandomAvatar",ri),t.component("MinModal",ii),t.component("LibPatchNotes",ci),t.component("BtnNewUpdates",di),t.component("LibPhotoPicker",ui),t.component("SelectMultipleDepartments",fi),t.component("PrimaryInput",no),t.component("SimpleSelect",mi),t.component("FloatingDev",gi),t.component("RaitingInput",ao),t.component("TagView",pi),t.component("ClientsForm",hi),t.component("SelectMultipleTags",to),t.component("SimpleLoader",oo)}function yi(t,n="add"){const a=eo();n==="add"?a.addDepartments(t):n==="delete"?a.removeDepartments(t):n==="update"?(a.departments=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibDeparts.`)}function ki(t,n="add"){const a=Yt();n==="add"?a.addAttendants(t):n==="delete"?a.removeAttendants(t):n==="update"?(a.attendants=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibAttendants.`)}function xi(t,n="add"){const a=va();n==="add"?a.addInstance(t):n==="delete"?a.removeInstance(t):n==="update"?(a.instances=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibInstances.`)}async function bi(t,n,a,o=[],r=[],i=[]){try{const s=await or(t);n&&await s.setToken(n),a&&(at.defaults.baseURL=a);const l=eo(t);r.length>0&&(l.departments=r,l.count=r.length);const d=Yt(t);o.length>0&&(d.attendants=o,d.count=o.length),await va(t).fetchInstances()}catch(s){console.error("Erro no setupLibrary:",s)}}function wi(t){return vn(t)}const dx={install:cx,setupLibrary:bi,attLibDeparts:yi,attLibAttendants:ki,attLibInstances:xi,primarySelect:go,simpleModal:yo,simpleCard:ko,instanceSelect:rr,SimpleSelect:mi,FloatingDev:gi,calendar:yr,SimpleLoader:oo,MFA:kr,chatWindow:K1,departSelect:J1,attendantSelect:ei,FilterSelectLib:ti,MobileInternalChat:Q1,RandomAvatar:ri,MinModal:ii,libPatchNotes:ci,btnNewUpdates:di,LibPhotoPicker:ui,SelectMultipleDepartments:fi,SelectMultipleTags:to,PrimaryInput:no,getWithContrastColor:wi,RaitingInput:ao,TagView:pi,ClientsForm:hi};function ux(t){t.CapacitorUtils.Synapse=new Proxy({},{get(n,a){return new Proxy({},{get(o,r){return(i,s,l)=>{const d=t.Capacitor.Plugins[a];if(d===void 0){l(new Error(`Capacitor plugin ${a} not found`));return}if(typeof d[r]!="function"){l(new Error(`Method ${r} not found in Capacitor plugin ${a}`));return}(async()=>{try{const u=await d[r](i);s(u)}catch(u){l(u)}})()}}})}})}function fx(t){t.CapacitorUtils.Synapse=new Proxy({},{get(n,a){return t.cordova.plugins[a]}})}function mx(t=!1){typeof window>"u"||(window.CapacitorUtils=window.CapacitorUtils||{},window.Capacitor!==void 0&&!t?ux(window):window.cordova!==void 0&&fx(window))}var Ei;(function(t){t.Documents="DOCUMENTS",t.Data="DATA",t.Library="LIBRARY",t.Cache="CACHE",t.External="EXTERNAL",t.ExternalStorage="EXTERNAL_STORAGE",t.ExternalCache="EXTERNAL_CACHE",t.LibraryNoCloud="LIBRARY_NO_CLOUD",t.Temporary="TEMPORARY"})(Ei||(Ei={}));var ro;(function(t){t.UTF8="utf8",t.ASCII="ascii",t.UTF16="utf16"})(ro||(ro={}));const sa=wn("Filesystem",{web:()=>Promise.resolve().then(()=>Fx).then(t=>new t.FilesystemWeb)});mx();const hx=wn("BlobWriter");function px(t){return window.btoa(Array.from(new Uint8Array(t)).map(function(n){return String.fromCharCode(n)}).join(""))}function gx({path:t,directory:n,blob:a,recursive:o}){return sa.writeFile({directory:n,path:t,recursive:o,data:""}).then(function(){return new Promise(function(r,i){function s(d){i(d.target.error)}const l=window.indexedDB.open("Disc");l.onerror=s,l.onsuccess=function(){const u=l.result.transaction("FileStorage","readwrite");u.onerror=s;const c=u.objectStore("FileStorage"),h=`/${n}/${t.replace(/^\//,"")}`,f=c.get(h);f.onsuccess=function(){f.result.size=a.size,f.result.content=a;const g=c.put(f.result);g.onsuccess=function(){r(void 0)}}}})})}function vi({path:t,directory:n,blob:a,recursive:o}){return sa.writeFile({directory:n,path:t,recursive:o,data:""}).then(function r(){if(a.size===0)return Promise.resolve();const i=3*128*1024,s=a.slice(0,i);return a=a.slice(i),new Response(s).arrayBuffer().then(function(d){return sa.appendFile({directory:n,path:t,data:px(d)})}).then(r)})}function yx(t){const{path:n,directory:a,blob:o,fast_mode:r=!1,recursive:i,on_fallback:s}=t;return!o||!Number.isSafeInteger(o.size)||typeof o.type!="string"?Promise.reject(new Error("Not a Blob.")):ea.getPlatform()==="web"?r?gx(t):vi(t):Promise.all([hx.get_config(),sa.getUri({path:n,directory:a})]).then(function([l,d]){const u=d.uri.replace("file://","");return(window.CapacitorWebFetch||window.fetch)(l.base_url+u+(i?"?recursive=true":""),{headers:{authorization:l.auth_token},method:"put",body:o}).then(function(h){if(h.status!==204)throw new Error("Bad HTTP status: "+h.status);return d.uri})}).catch(function(d){return s!==void 0&&s(d),vi(t)})}const kx=Object.freeze(yx);function xx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ci={};function bx(t){return t&&t.__esModule?t:{default:t}}var wx=bx,io={exports:{}},Si;function Ex(){return Si||(Si=1,function(t){var n=function(a){var o=Object.prototype,r=o.hasOwnProperty,i=Object.defineProperty||function(P,R,_){P[R]=_.value},s,l=typeof Symbol=="function"?Symbol:{},d=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",c=l.toStringTag||"@@toStringTag";function h(P,R,_){return Object.defineProperty(P,R,{value:_,enumerable:!0,configurable:!0,writable:!0}),P[R]}try{h({},"")}catch{h=function(R,_,oe){return R[_]=oe}}function f(P,R,_,oe){var de=R&&R.prototype instanceof E?R:E,pe=Object.create(de.prototype),ye=new Z(oe||[]);return i(pe,"_invoke",{value:F(P,_,ye)}),pe}a.wrap=f;function g(P,R,_){try{return{type:"normal",arg:P.call(R,_)}}catch(oe){return{type:"throw",arg:oe}}}var m="suspendedStart",p="suspendedYield",y="executing",k="completed",b={};function E(){}function V(){}function M(){}var A={};h(A,d,function(){return this});var H=Object.getPrototypeOf,C=H&&H(H(Q([])));C&&C!==o&&r.call(C,d)&&(A=C);var x=M.prototype=E.prototype=Object.create(A);V.prototype=M,i(x,"constructor",{value:M,configurable:!0}),i(M,"constructor",{value:V,configurable:!0}),V.displayName=h(M,c,"GeneratorFunction");function N(P){["next","throw","return"].forEach(function(R){h(P,R,function(_){return this._invoke(R,_)})})}a.isGeneratorFunction=function(P){var R=typeof P=="function"&&P.constructor;return R?R===V||(R.displayName||R.name)==="GeneratorFunction":!1},a.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,M):(P.__proto__=M,h(P,c,"GeneratorFunction")),P.prototype=Object.create(x),P},a.awrap=function(P){return{__await:P}};function L(P,R){function _(pe,ye,Ve,Le){var Ae=g(P[pe],P,ye);if(Ae.type==="throw")Le(Ae.arg);else{var qe=Ae.arg,_e=qe.value;return _e&&typeof _e=="object"&&r.call(_e,"__await")?R.resolve(_e.__await).then(function($e){_("next",$e,Ve,Le)},function($e){_("throw",$e,Ve,Le)}):R.resolve(_e).then(function($e){qe.value=$e,Ve(qe)},function($e){return _("throw",$e,Ve,Le)})}}var oe;function de(pe,ye){function Ve(){return new R(function(Le,Ae){_(pe,ye,Le,Ae)})}return oe=oe?oe.then(Ve,Ve):Ve()}i(this,"_invoke",{value:de})}N(L.prototype),h(L.prototype,u,function(){return this}),a.AsyncIterator=L,a.async=function(P,R,_,oe,de){de===void 0&&(de=Promise);var pe=new L(f(P,R,_,oe),de);return a.isGeneratorFunction(R)?pe:pe.next().then(function(ye){return ye.done?ye.value:pe.next()})};function F(P,R,_){var oe=m;return function(pe,ye){if(oe===y)throw new Error("Generator is already running");if(oe===k){if(pe==="throw")throw ye;return ee()}for(_.method=pe,_.arg=ye;;){var Ve=_.delegate;if(Ve){var Le=S(Ve,_);if(Le){if(Le===b)continue;return Le}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(oe===m)throw oe=k,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);oe=y;var Ae=g(P,R,_);if(Ae.type==="normal"){if(oe=_.done?k:p,Ae.arg===b)continue;return{value:Ae.arg,done:_.done}}else Ae.type==="throw"&&(oe=k,_.method="throw",_.arg=Ae.arg)}}}function S(P,R){var _=R.method,oe=P.iterator[_];if(oe===s)return R.delegate=null,_==="throw"&&P.iterator.return&&(R.method="return",R.arg=s,S(P,R),R.method==="throw")||_!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+_+"' method")),b;var de=g(oe,P.iterator,R.arg);if(de.type==="throw")return R.method="throw",R.arg=de.arg,R.delegate=null,b;var pe=de.arg;if(!pe)return R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,b;if(pe.done)R[P.resultName]=pe.value,R.next=P.nextLoc,R.method!=="return"&&(R.method="next",R.arg=s);else return pe;return R.delegate=null,b}N(x),h(x,c,"Generator"),h(x,d,function(){return this}),h(x,"toString",function(){return"[object Generator]"});function v(P){var R={tryLoc:P[0]};1 in P&&(R.catchLoc=P[1]),2 in P&&(R.finallyLoc=P[2],R.afterLoc=P[3]),this.tryEntries.push(R)}function O(P){var R=P.completion||{};R.type="normal",delete R.arg,P.completion=R}function Z(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(v,this),this.reset(!0)}a.keys=function(P){var R=Object(P),_=[];for(var oe in R)_.push(oe);return _.reverse(),function de(){for(;_.length;){var pe=_.pop();if(pe in R)return de.value=pe,de.done=!1,de}return de.done=!0,de}};function Q(P){if(P){var R=P[d];if(R)return R.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var _=-1,oe=function de(){for(;++_<P.length;)if(r.call(P,_))return de.value=P[_],de.done=!1,de;return de.value=s,de.done=!0,de};return oe.next=oe}}return{next:ee}}a.values=Q;function ee(){return{value:s,done:!0}}return Z.prototype={constructor:Z,reset:function(P){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach(O),!P)for(var R in this)R.charAt(0)==="t"&&r.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=s)},stop:function(){this.done=!0;var P=this.tryEntries[0],R=P.completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var R=this;function _(Le,Ae){return pe.type="throw",pe.arg=P,R.next=Le,Ae&&(R.method="next",R.arg=s),!!Ae}for(var oe=this.tryEntries.length-1;oe>=0;--oe){var de=this.tryEntries[oe],pe=de.completion;if(de.tryLoc==="root")return _("end");if(de.tryLoc<=this.prev){var ye=r.call(de,"catchLoc"),Ve=r.call(de,"finallyLoc");if(ye&&Ve){if(this.prev<de.catchLoc)return _(de.catchLoc,!0);if(this.prev<de.finallyLoc)return _(de.finallyLoc)}else if(ye){if(this.prev<de.catchLoc)return _(de.catchLoc,!0)}else if(Ve){if(this.prev<de.finallyLoc)return _(de.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(P,R){for(var _=this.tryEntries.length-1;_>=0;--_){var oe=this.tryEntries[_];if(oe.tryLoc<=this.prev&&r.call(oe,"finallyLoc")&&this.prev<oe.finallyLoc){var de=oe;break}}de&&(P==="break"||P==="continue")&&de.tryLoc<=R&&R<=de.finallyLoc&&(de=null);var pe=de?de.completion:{};return pe.type=P,pe.arg=R,de?(this.method="next",this.next=de.finallyLoc,b):this.complete(pe)},complete:function(P,R){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&R&&(this.next=R),b},finish:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var _=this.tryEntries[R];if(_.finallyLoc===P)return this.complete(_.completion,_.afterLoc),O(_),b}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var _=this.tryEntries[R];if(_.tryLoc===P){var oe=_.completion;if(oe.type==="throw"){var de=oe.arg;O(_)}return de}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,_){return this.delegate={iterator:Q(P),resultName:R,nextLoc:_},this.method==="next"&&(this.arg=s),b}},a}(t.exports);try{regeneratorRuntime=n}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}(io)),io.exports}var so,Bi;function vx(){return Bi||(Bi=1,so=Ex()),so}var lo,Vi;function Cx(){if(Vi)return lo;Vi=1;function t(a,o,r,i,s,l,d){try{var u=a[l](d),c=u.value}catch(h){r(h);return}u.done?o(c):Promise.resolve(c).then(i,s)}function n(a){return function(){var o=this,r=arguments;return new Promise(function(i,s){var l=a.apply(o,r);function d(c){t(l,i,s,d,u,"next",c)}function u(c){t(l,i,s,d,u,"throw",c)}d(void 0)})}}return lo=n,lo}(function(t){var n=wx;Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var a=n(vx()),o=n(Cx());function r(s){return i.apply(this,arguments)}function i(){return(i=(0,o.default)(a.default.mark(function s(l){var d,u;return a.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return d=document.createElement("video"),u=new Promise(function(h,f){d.addEventListener("loadedmetadata",function(){d.duration===1/0?(d.currentTime=Number.MAX_SAFE_INTEGER,d.ontimeupdate=function(){d.ontimeupdate=null,h(d.duration),d.currentTime=0}):h(d.duration)}),d.onerror=function(g){return f(g.target.error)}}),d.src=typeof l=="string"||l instanceof String?l:window.URL.createObjectURL(l),c.abrupt("return",u);case 4:case"end":return c.stop()}},s)}))).apply(this,arguments)}})(Ci);const Sx=xx(Ci),Tt=()=>({value:!0}),Cn=()=>({value:!1}),Bx=()=>new Error("MISSING_PERMISSION"),Vx=()=>new Error("ALREADY_RECORDING"),Mx=()=>new Error("DEVICE_CANNOT_VOICE_RECORD"),Mi=()=>new Error("FAILED_TO_RECORD"),Nx=()=>new Error("EMPTY_RECORDING"),co=()=>new Error("RECORDING_HAS_NOT_STARTED"),Ni=()=>new Error("FAILED_TO_FETCH_RECORDING"),uo=()=>new Error("COULD_NOT_QUERY_PERMISSION_STATUS"),Ai={"audio/aac":".aac","audio/mp4":".mp3","audio/webm;codecs=opus":".ogg","audio/webm":".ogg","audio/ogg;codecs=opus":".ogg"},Ti=()=>new Promise(()=>{});class ht{constructor(){this.mediaRecorder=null,this.chunks=[],this.pendingResult=Ti()}static async canDeviceVoiceRecord(){var n;return((n=navigator==null?void 0:navigator.mediaDevices)===null||n===void 0?void 0:n.getUserMedia)==null||ht.getSupportedMimeType()==null?Cn():Tt()}async startRecording(n){if(this.mediaRecorder!=null)throw Vx();if(!(await ht.canDeviceVoiceRecord()).value)throw Mx();if(!(await ht.hasAudioRecordingPermission().catch(()=>Tt())).value)throw Bx();return navigator.mediaDevices.getUserMedia({audio:!0}).then(r=>this.onSuccessfullyStartedRecording(r,n)).catch(this.onFailedToStartRecording.bind(this))}async stopRecording(){if(this.mediaRecorder==null)throw co();try{return this.mediaRecorder.stop(),this.mediaRecorder.stream.getTracks().forEach(n=>n.stop()),this.pendingResult}catch{throw Ni()}finally{this.prepareInstanceForNextOperation()}}static async hasAudioRecordingPermission(){return navigator.permissions.query==null?navigator.mediaDevices==null?Promise.reject(uo()):navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Tt()).catch(()=>{throw uo()}):navigator.permissions.query({name:"microphone"}).then(n=>({value:n.state==="granted"})).catch(()=>{throw uo()})}static async requestAudioRecordingPermission(){return(await ht.hasAudioRecordingPermission().catch(()=>Cn())).value?Tt():navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Tt()).catch(()=>Cn())}pauseRecording(){if(this.mediaRecorder==null)throw co();return this.mediaRecorder.state==="recording"?(this.mediaRecorder.pause(),Promise.resolve(Tt())):Promise.resolve(Cn())}resumeRecording(){if(this.mediaRecorder==null)throw co();return this.mediaRecorder.state==="paused"?(this.mediaRecorder.resume(),Promise.resolve(Tt())):Promise.resolve(Cn())}getCurrentStatus(){return this.mediaRecorder==null?Promise.resolve({status:na.NONE}):this.mediaRecorder.state==="recording"?Promise.resolve({status:na.RECORDING}):this.mediaRecorder.state==="paused"?Promise.resolve({status:na.PAUSED}):Promise.resolve({status:na.NONE})}static getSupportedMimeType(){if((MediaRecorder==null?void 0:MediaRecorder.isTypeSupported)==null)return null;const n=Object.keys(Ai).find(a=>MediaRecorder.isTypeSupported(a));return n??null}onSuccessfullyStartedRecording(n,a){return this.pendingResult=new Promise((o,r)=>{this.mediaRecorder=new MediaRecorder(n),this.mediaRecorder.onerror=()=>{this.prepareInstanceForNextOperation(),r(Mi())},this.mediaRecorder.onstop=async()=>{var i,s,l;const d=ht.getSupportedMimeType();if(d==null){this.prepareInstanceForNextOperation(),r(Ni());return}const u=new Blob(this.chunks,{type:d});if(u.size<=0){this.prepareInstanceForNextOperation(),r(Nx());return}let c,h;a!=null?(c=`${(l=(s=(i=a.subDirectory)===null||i===void 0?void 0:i.match(/^\/?(.+[^/])\/?$/))===null||s===void 0?void 0:s[1])!==null&&l!==void 0?l:""}/recording-${new Date().getTime()}${Ai[d]}`,await kx({blob:u,directory:a.directory,fast_mode:!0,path:c,recursive:!0})):h=await ht.blobToBase64(u);const f=await Sx(u);this.prepareInstanceForNextOperation(),o({value:{recordDataBase64:h,mimeType:d,msDuration:f*1e3,path:c}})},this.mediaRecorder.ondataavailable=i=>this.chunks.push(i.data),this.mediaRecorder.start()}),Tt()}onFailedToStartRecording(){throw this.prepareInstanceForNextOperation(),Mi()}static blobToBase64(n){return new Promise(a=>{const o=new FileReader;o.onloadend=()=>{const r=String(o.result),i=r.split("base64,"),s=i.length>1?i[1]:r;a(s.trim())},o.readAsDataURL(n)})}prepareInstanceForNextOperation(){if(this.mediaRecorder!=null&&this.mediaRecorder.state==="recording")try{this.mediaRecorder.stop()}catch(n){console.warn("While trying to stop a media recorder, an error was thrown",n)}this.pendingResult=Ti(),this.mediaRecorder=null,this.chunks=[]}}class Ax extends ta{constructor(){super(...arguments),this.voiceRecorderInstance=new ht}canDeviceVoiceRecord(){return ht.canDeviceVoiceRecord()}hasAudioRecordingPermission(){return ht.hasAudioRecordingPermission()}requestAudioRecordingPermission(){return ht.requestAudioRecordingPermission()}startRecording(n){return this.voiceRecorderInstance.startRecording(n)}stopRecording(){return this.voiceRecorderInstance.stopRecording()}pauseRecording(){return this.voiceRecorderInstance.pauseRecording()}resumeRecording(){return this.voiceRecorderInstance.resumeRecording()}getCurrentStatus(){return this.voiceRecorderInstance.getCurrentStatus()}}const Tx=Object.freeze(Object.defineProperty({__proto__:null,VoiceRecorderWeb:Ax},Symbol.toStringTag,{value:"Module"}));function Di(t){const n=t.split("/").filter(o=>o!=="."),a=[];return n.forEach(o=>{o===".."&&a.length>0&&a[a.length-1]!==".."?a.pop():a.push(o)}),a.join("/")}function Dx(t,n){t=Di(t),n=Di(n);const a=t.split("/"),o=n.split("/");return t!==n&&a.every((r,i)=>r===o[i])}class la extends ta{constructor(){super(...arguments),this.DB_VERSION=1,this.DB_NAME="Disc",this._writeCmds=["add","put","delete"],this.downloadFile=async n=>{var a,o;const r=F1(n,n.webFetchExtra),i=await fetch(n.url,r);let s;if(!n.progress)s=await i.blob();else if(!(i!=null&&i.body))s=new Blob;else{const d=i.body.getReader();let u=0;const c=[],h=i.headers.get("content-type"),f=parseInt(i.headers.get("content-length")||"0",10);for(;;){const{done:p,value:y}=await d.read();if(p)break;c.push(y),u+=(y==null?void 0:y.length)||0;const k={url:n.url,bytes:u,contentLength:f};this.notifyListeners("progress",k)}const g=new Uint8Array(u);let m=0;for(const p of c)typeof p>"u"||(g.set(p,m),m+=p.length);s=new Blob([g.buffer],{type:h||void 0})}return{path:(await this.writeFile({path:n.path,directory:(a=n.directory)!==null&&a!==void 0?a:void 0,recursive:(o=n.recursive)!==null&&o!==void 0?o:!1,data:s})).uri,blob:s}}}readFileInChunks(n,a){throw this.unavailable("Method not implemented.")}async initDb(){if(this._db!==void 0)return this._db;if(!("indexedDB"in window))throw this.unavailable("This browser doesn't support IndexedDB");return new Promise((n,a)=>{const o=indexedDB.open(this.DB_NAME,this.DB_VERSION);o.onupgradeneeded=la.doUpgrade,o.onsuccess=()=>{this._db=o.result,n(o.result)},o.onerror=()=>a(o.error),o.onblocked=()=>{console.warn("db blocked")}})}static doUpgrade(n){const o=n.target.result;switch(n.oldVersion){case 0:case 1:default:o.objectStoreNames.contains("FileStorage")&&o.deleteObjectStore("FileStorage"),o.createObjectStore("FileStorage",{keyPath:"path"}).createIndex("by_folder","folder")}}async dbRequest(n,a){const o=this._writeCmds.indexOf(n)!==-1?"readwrite":"readonly";return this.initDb().then(r=>new Promise((i,s)=>{const u=r.transaction(["FileStorage"],o).objectStore("FileStorage")[n](...a);u.onsuccess=()=>i(u.result),u.onerror=()=>s(u.error)}))}async dbIndexRequest(n,a,o){const r=this._writeCmds.indexOf(a)!==-1?"readwrite":"readonly";return this.initDb().then(i=>new Promise((s,l)=>{const h=i.transaction(["FileStorage"],r).objectStore("FileStorage").index(n)[a](...o);h.onsuccess=()=>s(h.result),h.onerror=()=>l(h.error)}))}getPath(n,a){const o=a!==void 0?a.replace(/^[/]+|[/]+$/g,""):"";let r="";return n!==void 0&&(r+="/"+n),a!==""&&(r+="/"+o),r}async clear(){(await this.initDb()).transaction(["FileStorage"],"readwrite").objectStore("FileStorage").clear()}async readFile(n){const a=this.getPath(n.directory,n.path),o=await this.dbRequest("get",[a]);if(o===void 0)throw Error("File does not exist.");return{data:o.content?o.content:""}}async writeFile(n){const a=this.getPath(n.directory,n.path);let o=n.data;const r=n.encoding,i=n.recursive,s=await this.dbRequest("get",[a]);if(s&&s.type==="directory")throw Error("The supplied path is a directory.");const l=a.substr(0,a.lastIndexOf("/"));if(await this.dbRequest("get",[l])===void 0){const h=l.indexOf("/",1);if(h!==-1){const f=l.substr(h);await this.mkdir({path:f,directory:n.directory,recursive:i})}}if(!r&&!(o instanceof Blob)&&(o=o.indexOf(",")>=0?o.split(",")[1]:o,!this.isBase64String(o)))throw Error("The supplied data is not valid base64 content.");const u=Date.now(),c={path:a,folder:l,type:"file",size:o instanceof Blob?o.size:o.length,ctime:u,mtime:u,content:o};return await this.dbRequest("put",[c]),{uri:c.path}}async appendFile(n){const a=this.getPath(n.directory,n.path);let o=n.data;const r=n.encoding,i=a.substr(0,a.lastIndexOf("/")),s=Date.now();let l=s;const d=await this.dbRequest("get",[a]);if(d&&d.type==="directory")throw Error("The supplied path is a directory.");if(await this.dbRequest("get",[i])===void 0){const h=i.indexOf("/",1);if(h!==-1){const f=i.substr(h);await this.mkdir({path:f,directory:n.directory,recursive:!0})}}if(!r&&!this.isBase64String(o))throw Error("The supplied data is not valid base64 content.");if(d!==void 0){if(d.content instanceof Blob)throw Error("The occupied entry contains a Blob object which cannot be appended to.");d.content!==void 0&&!r?o=btoa(atob(d.content)+atob(o)):o=d.content+o,l=d.ctime}const c={path:a,folder:i,type:"file",size:o.length,ctime:l,mtime:s,content:o};await this.dbRequest("put",[c])}async deleteFile(n){const a=this.getPath(n.directory,n.path);if(await this.dbRequest("get",[a])===void 0)throw Error("File does not exist.");if((await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(a)])).length!==0)throw Error("Folder is not empty.");await this.dbRequest("delete",[a])}async mkdir(n){const a=this.getPath(n.directory,n.path),o=n.recursive,r=a.substr(0,a.lastIndexOf("/")),i=(a.match(/\//g)||[]).length,s=await this.dbRequest("get",[r]),l=await this.dbRequest("get",[a]);if(i===1)throw Error("Cannot create Root directory");if(l!==void 0)throw Error("Current directory does already exist.");if(!o&&i!==2&&s===void 0)throw Error("Parent directory must exist");if(o&&i!==2&&s===void 0){const c=r.substr(r.indexOf("/",1));await this.mkdir({path:c,directory:n.directory,recursive:o})}const d=Date.now(),u={path:a,folder:r,type:"directory",size:0,ctime:d,mtime:d};await this.dbRequest("put",[u])}async rmdir(n){const{path:a,directory:o,recursive:r}=n,i=this.getPath(o,a),s=await this.dbRequest("get",[i]);if(s===void 0)throw Error("Folder does not exist.");if(s.type!=="directory")throw Error("Requested path is not a directory");const l=await this.readdir({path:a,directory:o});if(l.files.length!==0&&!r)throw Error("Folder is not empty");for(const d of l.files){const u=`${a}/${d.name}`;(await this.stat({path:u,directory:o})).type==="file"?await this.deleteFile({path:u,directory:o}):await this.rmdir({path:u,directory:o,recursive:r})}await this.dbRequest("delete",[i])}async readdir(n){const a=this.getPath(n.directory,n.path),o=await this.dbRequest("get",[a]);if(n.path!==""&&o===void 0)throw Error("Folder does not exist.");const r=await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(a)]);return{files:await Promise.all(r.map(async s=>{let l=await this.dbRequest("get",[s]);return l===void 0&&(l=await this.dbRequest("get",[s+"/"])),{name:s.substring(a.length+1),type:l.type,size:l.size,ctime:l.ctime,mtime:l.mtime,uri:l.path}}))}}async getUri(n){const a=this.getPath(n.directory,n.path);let o=await this.dbRequest("get",[a]);return o===void 0&&(o=await this.dbRequest("get",[a+"/"])),{uri:(o==null?void 0:o.path)||a}}async stat(n){const a=this.getPath(n.directory,n.path);let o=await this.dbRequest("get",[a]);if(o===void 0&&(o=await this.dbRequest("get",[a+"/"])),o===void 0)throw Error("Entry does not exist.");return{name:o.path.substring(a.length+1),type:o.type,size:o.size,ctime:o.ctime,mtime:o.mtime,uri:o.path}}async rename(n){await this._copy(n,!0)}async copy(n){return this._copy(n,!1)}async requestPermissions(){return{publicStorage:"granted"}}async checkPermissions(){return{publicStorage:"granted"}}async _copy(n,a=!1){let{toDirectory:o}=n;const{to:r,from:i,directory:s}=n;if(!r||!i)throw Error("Both to and from must be provided");o||(o=s);const l=this.getPath(s,i),d=this.getPath(o,r);if(l===d)return{uri:d};if(Dx(l,d))throw Error("To path cannot contain the from path");let u;try{u=await this.stat({path:r,directory:o})}catch{const m=r.split("/");m.pop();const p=m.join("/");if(m.length>0&&(await this.stat({path:p,directory:o})).type!=="directory")throw new Error("Parent directory of the to path is a file")}if(u&&u.type==="directory")throw new Error("Cannot overwrite a directory with a file");const c=await this.stat({path:i,directory:s}),h=async(g,m,p)=>{const y=this.getPath(o,g),k=await this.dbRequest("get",[y]);k.ctime=m,k.mtime=p,await this.dbRequest("put",[k])},f=c.ctime?c.ctime:Date.now();switch(c.type){case"file":{const g=await this.readFile({path:i,directory:s});a&&await this.deleteFile({path:i,directory:s});let m;!(g.data instanceof Blob)&&!this.isBase64String(g.data)&&(m=ro.UTF8);const p=await this.writeFile({path:r,directory:o,data:g.data,encoding:m});return a&&await h(r,f,c.mtime),p}case"directory":{if(u)throw Error("Cannot move a directory over an existing object");try{await this.mkdir({path:r,directory:o,recursive:!1}),a&&await h(r,f,c.mtime)}catch{}const g=(await this.readdir({path:i,directory:s})).files;for(const m of g)await this._copy({from:`${i}/${m.name}`,to:`${r}/${m.name}`,directory:s,toDirectory:o},a);a&&await this.rmdir({path:i,directory:s})}}return{uri:d}}isBase64String(n){try{return btoa(atob(n))==n}catch{return!1}}}la._debug=!0;const Fx=Object.freeze(Object.defineProperty({__proto__:null,FilesystemWeb:la},Symbol.toStringTag,{value:"Module"}));et.attLibAttendants=ki,et.attLibDeparts=yi,et.attLibInstances=xi,et.default=dx,et.getWithContrastColor=wi,et.setupLibrary=bi,et.useScheduledStore=mr,Object.defineProperties(et,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
132
|
+
</svg>`,info:a.content.info??"Nome que será atribuído no Produto",type:a.content.type??"text",placeholder:a.content.placeholder??"Integração de sistemas",empty:a.content.empty??!1,data:a.content.data??""}),i=e.ref(r.data);e.watch(i,l=>{o("update:content",{...r,data:l})},{immediate:!0,deep:!0}),e.watch(()=>a.content,l=>{l.data!==i.value&&(i.value=l.data),l.empty!==r.empty&&(r.empty=l.empty)},{deep:!0});const s=e.computed(()=>r.empty&&!i.value);return(l,d)=>{const u=e.resolveComponent("Popper");return e.openBlock(),e.createElementBlock("section",Vy,[e.createElementVNode("header",My,[e.createElementVNode("p",Ny,e.toDisplayString(r.title),1),e.createVNode(u,{hover:"",content:r.info,placement:"top",arrow:""},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1},8,["content"])]),e.createElementVNode("div",{class:e.normalizeClass(["input__container",s.value?"input__container--error":"",r.type==="textArea"?"textArea":""])},[r.type!=="textArea"?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(s.value?"text-red-500":"text-base-100"),innerHTML:r.svg},null,10,Ay)):e.createCommentVNode("",!0),r.type!=="textArea"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:r.type,key:r.type,placeholder:r.placeholder,"onUpdate:modelValue":d[0]||(d[0]=c=>i.value=c),class:e.normalizeClass([s.value?"empty":null,"input__field"])},null,10,Ty)),[[e.vModelDynamic,i.value]]):e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:e.normalizeClass([s.value?"empty":null,"input__field h-full resize-y"]),"onUpdate:modelValue":d[1]||(d[1]=c=>i.value=c),placeholder:r.placeholder},null,10,Dy)),[[e.vModelText,i.value]]),s.value?(e.openBlock(),e.createElementBlock("span",Fy," Campo obrigatório ")):e.createCommentVNode("",!0)],2)])}}},[["__scopeId","data-v-cfd206c7"]]),Ly=["onClick"],$y={key:0,xmlns:"http://www.w3.org/2000/svg",class:"size-4 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Py=["onClick"],Oy={key:0,xmlns:"http://www.w3.org/2000/svg",class:"size-4 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mi=Ce({__name:"simpleSelect",props:{modelValue:{type:[Array,String,Number,Object],default:()=>[]},options:{type:Array,required:!0,default:()=>[]},placeholder:{type:String,default:"Selecione uma opção..."},multiple:{type:Boolean,default:!1},theme:{type:String,default:"bg-base-300 border-base-300"},teleportTo:{type:String,default:null}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(!1),i=e.ref(null),s=e.ref(null),l=e.ref({});Bn(i,()=>r.value=!1);const d=()=>{if(!a.teleportTo||!s.value)return;const g=s.value.getBoundingClientRect();l.value={position:"fixed",top:`${g.bottom+6}px`,left:`${g.left}px`,width:`${g.width}px`,zIndex:9999}};e.watch(r,g=>{g&&d()});const u=[];e.onMounted(()=>{if(a.teleportTo){const g=()=>{r.value&&d()};window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),u.push(["scroll",g],["resize",g])}}),e.onUnmounted(()=>{u.forEach(([g,m])=>window.removeEventListener(g,m,g==="scroll"?!0:void 0))});const c=g=>a.multiple&&Array.isArray(a.modelValue)?a.modelValue.includes(g):a.modelValue===g,h=g=>{if(a.multiple){const m=Array.isArray(a.modelValue)?[...a.modelValue]:[],p=m.indexOf(g);p===-1?m.push(g):m.splice(p,1),o("update:modelValue",m)}else o("update:modelValue",g),r.value=!1},f=e.computed(()=>{if(a.multiple&&Array.isArray(a.modelValue))return a.modelValue.length===0?a.placeholder:a.options.filter(p=>a.modelValue.includes(p.value)).map(p=>p.name).join(", ");const g=a.options.find(m=>m.value===a.modelValue);return(g==null?void 0:g.name)||a.placeholder});return(g,m)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full",ref_key:"dropdownRef",ref:i},[e.createElementVNode("div",{onClick:m[0]||(m[0]=p=>r.value=!r.value),class:e.normalizeClass(["flex flex-wrap items-center justify-between p-3 gap-2 rounded-md cursor-pointer transition",t.theme]),ref_key:"triggerRef",ref:s},[e.createElementVNode("span",{class:e.normalizeClass(["text-xs truncate max-w-full",f.value===t.placeholder?"text-gray-400":"text-white"])},e.toDisplayString(f.value),3),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["size-3 text-white transition-transform duration-300",r.value?"rotate-180":""]),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[...m[1]||(m[1]=[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m19 9-7 7-7-7"},null,-1)])],2))],2),r.value&&!t.teleportTo?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["absolute flex flex-col z-10 mt-1.5 w-full shadow-sm border rounded-md max-h-64 overflow-y-auto hide-scrollbar",t.theme])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,p=>(e.openBlock(),e.createElementBlock("button",{key:p.value,class:e.normalizeClass([c(p.value)?"bg-green-500/30 hover:bg-green-500/50":"hover:bg-base-200","flex items-center justify-between gap-2 px-3 py-2 text-left text-sm cursor-pointer transition w-full"]),onClick:y=>h(p.value)},[e.createElementVNode("span",null,e.toDisplayString(p.name),1),c(p.value)?(e.openBlock(),e.createElementBlock("svg",$y,[...m[2]||(m[2]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],10,Ly))),128))],2)):e.createCommentVNode("",!0),r.value&&t.teleportTo?(e.openBlock(),e.createBlock(e.Teleport,{key:1,to:t.teleportTo},[e.createElementVNode("div",{style:e.normalizeStyle(l.value),class:e.normalizeClass(["flex flex-col shadow-sm border rounded-md max-h-64 overflow-y-auto hide-scrollbar",t.theme])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,p=>(e.openBlock(),e.createElementBlock("button",{key:p.value,class:e.normalizeClass([c(p.value)?"bg-green-500/30 hover:bg-green-500/50":"hover:bg-base-200","flex items-center justify-between gap-2 px-3 py-2 text-left text-sm cursor-pointer transition w-full"]),onClick:y=>h(p.value)},[e.createElementVNode("span",null,e.toDisplayString(p.name),1),c(p.value)?(e.openBlock(),e.createElementBlock("svg",Oy,[...m[3]||(m[3]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):e.createCommentVNode("",!0)],10,Py))),128))],6)],8,["to"])):e.createCommentVNode("",!0)],512))}},[["__scopeId","data-v-3ee440f9"]]),_y={class:"flex gap-2"},Hy=Ce({__name:"outcomeButton",props:{outcome:{type:String,default:null}},emits:["update:outcome","change"],setup(t,{emit:n}){const a=t,o=n;async function r(l){const d=a.outcome===l?null:l;o("update:outcome",d),o("change",d)}const i=e.computed(()=>a.outcome==="won"),s=e.computed(()=>a.outcome==="lost");return(l,d)=>(e.openBlock(),e.createElementBlock("div",_y,[e.createElementVNode("button",{onClick:d[0]||(d[0]=u=>r("won")),class:e.normalizeClass(["button_outcome-base",{"button_outcome-active-won":i.value}])},[d[3]||(d[3]=e.createElementVNode("p",null,"Ganho",-1)),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass([{"svg_outcome-active-won":i.value},"text-white size-4"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"none"},[...d[2]||(d[2]=[e.createElementVNode("path",{d:"M3.16666 6.37502C3.74962 6.37502 4.2222 6.85073 4.22222 7.43752V15.9375C4.22222 16.5243 3.74963 17 3.16666 17H1.05555C0.472588 17 0 16.5243 0 15.9375V7.43752C1.50967e-05 6.85073 0.472597 6.37502 1.05555 6.37502H3.16666Z",fill:"CurrentColor"},null,-1),e.createElementVNode("path",{d:"M9.48143 1.4454C9.79496 -0.637173 11.5194 0.143216 11.5194 0.143216C13.863 1.75728 13.005 4.80783 12.2832 6.13118H17.4424C19.5307 6.65187 19.0768 8.34354 18.5887 9.12465C19.5056 10.7905 18.4191 11.7716 17.7609 12.0538C18.1175 13.7717 17.0601 14.4178 16.4869 14.5264C16.8944 16.4004 15.5533 16.9564 14.8314 17H10.436C8.49997 16.9999 6.19055 16.1753 5.27777 15.7632V7.368C9.03523 5.6108 9.09933 3.98356 9.48143 1.4454Z",fill:"CurrentColor"},null,-1)])],2))],2),e.createElementVNode("button",{onClick:d[1]||(d[1]=u=>r("lost")),class:e.normalizeClass(["button_outcome-base",{"button_outcome-active-lost":s.value}])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass([{"svg_outcome-active-lost":s.value},"text-white size-4 mt-0.8"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 19",fill:"none"},[...d[4]||(d[4]=[e.createElementVNode("path",{d:"M15.8333 10.625C15.2504 10.625 14.7778 10.1493 14.7778 9.56249L14.7778 1.0625C14.7778 0.475698 15.2504 1.57955e-06 15.8333 1.63051e-06L17.9444 1.81507e-06C18.5274 1.86603e-06 19 0.475698 19 1.0625L19 9.56249C19 10.1493 18.5274 10.625 17.9444 10.625L15.8333 10.625Z",fill:"CurrentColor"},null,-1),e.createElementVNode("path",{d:"M9.51857 15.5546C9.20504 17.6372 7.48065 16.8568 7.48065 16.8568C5.13698 15.2427 5.99503 12.1922 6.71681 10.8688L1.55759 10.8688C-0.530671 10.3481 -0.0768444 8.65646 0.411319 7.87535C-0.50562 6.20951 0.580926 5.22844 1.23906 4.94622C0.882549 3.22832 1.93994 2.5822 2.51315 2.47363C2.10564 0.59965 3.44673 0.0436064 4.16864 6.1075e-07L8.56403 9.95007e-07C10.5 0.000138493 12.8095 0.824657 13.7222 1.23682L13.7222 9.632C9.96477 11.3892 9.90067 13.0164 9.51857 15.5546Z",fill:"CurrentColor"},null,-1)])],2)),d[5]||(d[5]=e.createElementVNode("p",null,"Perdido",-1))],2)]))}},[["__scopeId","data-v-cde71744"]]),Ry={class:"flex gap-1 select-none"},zy=["onMousemove","onClick"],ao=Ce({__name:"raitingInput",props:{modelValue:{type:Number,default:0}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(a.modelValue),i=e.ref(0);e.watch(()=>a.modelValue,c=>{r.value=c});const s=e.computed(()=>i.value||r.value);function l(c){const h=s.value-c+1;return h>=1?"100%":h>=.5?"50%":h>0?`${h*100}%`:"0%"}function d(c,h){const f=c.currentTarget.getBoundingClientRect(),g=c.offsetX<f.width/2;i.value=h-(g?.5:0)}function u(c,h){const f=c.currentTarget.getBoundingClientRect(),g=c.offsetX<f.width/2,m=h-(g?.5:0);r.value=r.value===m?0:m,o("update:modelValue",r.value)}return(c,h)=>(e.openBlock(),e.createElementBlock("main",Ry,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,f=>e.createElementVNode("div",{key:f,class:"relative size-6 cursor-pointer",onMousemove:g=>d(g,f),onMouseleave:h[0]||(h[0]=g=>i.value=0),onClick:g=>u(g,f)},[h[2]||(h[2]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"absolute top-0 left-0 size-6 color-disabled"},[e.createElementVNode("path",{d:"M13.849 4.22c-.684-1.626-3.014-1.626-3.698 0L8.397 8.387l-4.552.361c-1.775.14-2.495 2.331-1.142 3.477l3.468 2.937-1.06 4.392c-.413 1.713 1.472 3.067 2.992 2.149L12 19.35l3.897 2.354c1.52.918 3.405-.436 2.992-2.15l-1.06-4.39 3.468-2.938c1.353-1.146.633-3.336-1.142-3.477l-4.552-.36-1.754-4.17Z"})],-1)),e.createElementVNode("div",{class:"absolute top-0 left-0 h-full overflow-hidden text-primary transition-all duration-150",style:e.normalizeStyle({width:l(f)})},[...h[1]||(h[1]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",class:"size-6"},[e.createElementVNode("path",{d:"M13.849 4.22c-.684-1.626-3.014-1.626-3.698 0L8.397 8.387l-4.552.361c-1.775.14-2.495 2.331-1.142 3.477l3.468 2.937-1.06 4.392c-.413 1.713 1.472 3.067 2.992 2.149L12 19.35l3.897 2.354c1.52.918 3.405-.436 2.992-2.15l-1.06-4.39 3.468-2.938c1.353-1.146.633-3.336-1.142-3.477l-4.552-.36-1.754-4.17Z"})],-1)])],4)],40,zy)),64))]))}},[["__scopeId","data-v-af20a8bd"]]),jy={key:0,class:"flex items-center justify-center overflow-hidden h-svh"},Gy={key:1,class:"flex flex-col"},Iy={key:0,class:"sticky top-0 z-10 bg-base-300 p-1 flex gap-2"},qy={class:"total-price-badge"},Wy={class:"flex-1 overflow-y-auto flex flex-col gap-2 px-2"},Uy={key:0,class:"w-full text-gray-500 list-none list-inside dark:text-gray-400 divide-y divide-base-200"},Zy={class:"flex gap-2 items-center"},Yy=["src"],Xy={key:1,class:"size-8 rounded-md flex items-center justify-center border border-base-200"},Ky={class:"flex flex-col items-start"},Qy={class:"text-xs font-semibold font-sans"},Jy={class:"flex gap-1"},ek={class:"flex gap-1"},tk=["onClick"],nk=["onClick"],ak={key:1,class:"flex flex-col gap-1 min-h-48 flex-1 w-full justify-center items-center"},ok=Ce({__name:"listProducts",props:{modelValue:{type:Array,default:()=>[]},allProducts:{type:Object,default:()=>{}}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(!1),i=e.ref([]),s=e.ref([...a.modelValue]),l=e.ref(1),d=e.ref(null),u=e.ref(null),c=e.computed(()=>s.value.reduce((A,H)=>{var N;const C=((N=H.product)==null?void 0:N.price)||H.price||0,x=H.quantity||0;return A+C*x},0)),h=e.computed(()=>{const A={};return s.value.forEach(H=>{A[H.product.id]=H.quantity}),A}),f=A=>h.value[A.id]||0,g=A=>{const H=s.value.find(C=>C.product.id===A.id);H?H.quantity++:s.value.push({product:{...A},quantity:1})},m=A=>{const H=s.value.find(C=>C.product.id===A.id);H&&(H.quantity>0?H.quantity--:H.quantity=0)},p=(A,H)=>{const C=new URLSearchParams,x=A;return Object.keys(H).forEach(N=>C.append(N,H[N])),`${x}?${C.toString()}`},y=async A=>{try{const{data:H}=await at.get(p(Ls,{page:l.value,...A})),{results:C,next:x,previous:N}=H;if(d.value=x,u.value=N,l.value===1)i.value=C;else{const L=new Set(i.value.map(S=>S.id)),F=C.filter(S=>!L.has(S.id));i.value=[...i.value,...F]}d.value&&(l.value+=1)}catch(H){console.error("Erro ao buscar produtos:",H)}};e.onMounted(async()=>{var A;a.allProducts&&((A=a.allProducts.results)==null?void 0:A.length)>0?(i.value=a.allProducts.results,d.value=a.allProducts.next||null,u.value=a.allProducts.previous||null,l.value=2):await y()}),e.watch(s,A=>{o("update:modelValue",A)},{deep:!0});const k=e.ref(!1),b=async A=>{if(!k.value){k.value=!0;try{if(!d.value){A.complete();return}await y(),d.value?A.loaded():A.complete()}catch(H){console.error("Erro ao carregar produtos:",H),A.complete()}finally{k.value=!1}}},E=e.ref({query:""}),V=e.ref(!1);let M;return e.watch(E,()=>{clearTimeout(M),M=setTimeout(async()=>{const{query:A}=E.value;l.value=1,V.value=!!A,r.value=!0,await y({query:A}),r.value=!1},500)},{deep:!0}),(A,H)=>{const C=e.resolveComponent("SimpleLoader");return r.value?(e.openBlock(),e.createElementBlock("div",jy,[e.createVNode(C)])):(e.openBlock(),e.createElementBlock("main",Gy,[i.value.length>0&&!V.value||V.value?(e.openBlock(),e.createElementBlock("header",Iy,[e.withDirectives(e.createElementVNode("input",{class:"w-full text-xs bg-base-300 rounded-md p-1 outline-none border-none focus:outline-none focus:ring-0 focus:shadow-none",type:"text",placeholder:"Buscar...","onUpdate:modelValue":H[0]||(H[0]=x=>E.value.query=x)},null,512),[[e.vModelText,E.value.query]]),e.createElementVNode("section",qy," Valor total: R$"+e.toDisplayString(c.value.toFixed(2)),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Wy,[i.value.length>0&&!V.value||V.value?(e.openBlock(),e.createElementBlock("ul",Uy,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(x,N)=>(e.openBlock(),e.createElementBlock("li",{class:"flex w-full justify-between items-center py-2",key:x.id},[e.createElementVNode("div",Zy,[e.createElementVNode("section",null,[x.photo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"size-8 rounded-md",src:x.photo,alt:""},null,8,Yy)):(e.openBlock(),e.createElementBlock("div",Xy,[...H[1]||(H[1]=[e.createElementVNode("svg",{class:"w-6 h-6","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[e.createElementVNode("path",{fill:"currentColor",d:"M4 19v2c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-2H4Z"}),e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M9 3c0-.55228.44772-1 1-1h8c.5523 0 1 .44772 1 1v3c0 .55228-.4477 1-1 1h-2v1h2c.5096 0 .9376.38314.9939.88957L19.8951 17H4.10498l.90116-8.11043C5.06241 8.38314 5.49047 8 6.00002 8H12V7h-2c-.55228 0-1-.44772-1-1V3Zm1.01 8H8.00002v2.01H10.01V11Zm.99 0h2.01v2.01H11V11Zm5.01 0H14v2.01h2.01V11Zm-8.00998 3H10.01v2.01H8.00002V14ZM13.01 14H11v2.01h2.01V14Zm.99 0h2.01v2.01H14V14ZM11 4h6v1h-6V4Z","clip-rule":"evenodd"})],-1)])]))]),e.createElementVNode("section",Ky,[e.createElementVNode("p",{class:e.normalizeClass(["text-xs font-semibold",f(x)>0?"text-white":""])},e.toDisplayString(x.name),3),e.createElementVNode("p",Qy," R$ "+e.toDisplayString(x.price.toFixed(2)),1)])]),e.createElementVNode("section",Jy,[e.createElementVNode("p",{class:e.normalizeClass(["text-xs font-semibold font-sans products-and-services_badge",x.recurrence])},e.toDisplayString(x.recurrence==="monthly"?"Mensal":"Único"),3),e.createElementVNode("div",ek,[e.createElementVNode("button",{class:"bg-base-200 size-6 rounded-md flex items-center justify-center",onClick:L=>m(x)}," - ",8,tk),e.createElementVNode("p",{class:e.normalizeClass(["w-5 text-xs flex items-center justify-center font-semibold font-sans",f(x)>0?"text-white":""])},e.toDisplayString(f(x)),3),e.createElementVNode("button",{class:"bg-base-200 size-6 rounded-md flex items-center justify-center",onClick:L=>g(x)}," + ",8,nk)])])]))),128))])):e.createCommentVNode("",!0),V.value&&i.value.length===0||i.value.length===0?(e.openBlock(),e.createElementBlock("section",ak,[...H[2]||(H[2]=[e.createStaticVNode('<p class="text-gray-600 text-base font-sans" data-v-22918a3e>Nenhum item encontrado</p><p class="text-gray-600 text-xs font-sans" data-v-22918a3e> Comece criando seu primeiro na aba <strong data-v-22918a3e>Produtos</strong></p><button class="bg-green-700 text-white py-1 px-2 rounded-md text-xs mt-2 hover:bg-green-600 flex gap-1 items-center justify-center" data-v-22918a3e><p data-v-22918a3e>Criar novo</p><svg class="size-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" data-v-22918a3e><path fill="currentColor" d="M4 19v2c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-2H4Z" data-v-22918a3e></path><path fill="currentColor" fill-rule="evenodd" d="M9 3c0-.55228.44772-1 1-1h8c.5523 0 1 .44772 1 1v3c0 .55228-.4477 1-1 1h-2v1h2c.5096 0 .9376.38314.9939.88957L19.8951 17H4.10498l.90116-8.11043C5.06241 8.38314 5.49047 8 6.00002 8H12V7h-2c-.55228 0-1-.44772-1-1V3Zm1.01 8H8.00002v2.01H10.01V11Zm.99 0h2.01v2.01H11V11Zm5.01 0H14v2.01h2.01V11Zm-8.00998 3H10.01v2.01H8.00002V14ZM13.01 14H11v2.01h2.01V14Zm.99 0h2.01v2.01H14V14ZM11 4h6v1h-6V4Z" clip-rule="evenodd" data-v-22918a3e></path></svg></button>',3)])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createBlock(e.unref(Xt),{key:2,onInfinite:b,class:"p-3 bg-base-300"},{spinner:e.withCtx(()=>[...H[3]||(H[3]=[e.createElementVNode("section",{class:"w-full justify-center items-center flex"},[e.createElementVNode("div",{class:"size-4 animate-spin rounded-full border-4 border-solid border-white border-t-transparent"})],-1)])]),_:1})):e.createCommentVNode("",!0)])]))}}},[["__scopeId","data-v-22918a3e"]]),rk={},ik={class:"flex items-center justify-center h-full"};function sk(t,n){return e.openBlock(),e.createElementBlock("div",ik,[...n[0]||(n[0]=[e.createElementVNode("span",{class:"products-and-services_bar"},null,-1),e.createElementVNode("span",{class:"products-and-services_bar"},null,-1),e.createElementVNode("span",{class:"products-and-services_bar"},null,-1)])])}const oo=Ce(rk,[["render",sk],["__scopeId","data-v-3f0502dd"]]),lk={key:0,class:"flex items-center justify-center overflow-hidden h-svh"},ck={key:1,class:"rounded-md bg-base-200 border border-white/10 shadow-sm transition-shadow duration-200 hover:shadow-md p-1"},dk={class:"flex flex-col gap-2"},uk=["onUpdate:modelValue"],fk={class:"text-[10px] font-sans"},mk=["onUpdate:modelValue"],hk=["onUpdate:modelValue"],pk=Ce({__name:"listSegmentationsFields",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(t,{emit:n}){const a=t,o=n,r=e.ref(s(a.modelValue)),i=e.ref(!1);function s(d){return JSON.parse(JSON.stringify(d))}const l=async()=>{try{i.value=!0;const d=await at.get(Ps);r.value=d.data}catch(d){console.error("Error fetching segmentation fields:",d)}finally{i.value=!1}};return e.onMounted(()=>{a.modelValue.length===0&&l()}),e.watch(r,d=>{JSON.stringify(d)!==JSON.stringify(a.modelValue)&&o("update:modelValue",s(d))},{deep:!0}),(d,u)=>{const c=e.resolveComponent("SimpleSelect");return i.value?(e.openBlock(),e.createElementBlock("div",lk,[e.createVNode(oo)])):(e.openBlock(),e.createElementBlock("div",ck,[u[0]||(u[0]=e.createElementVNode("header",{class:"text-start w-full items-center justify-between flex mb-2 px-1"},[e.createElementVNode("p",{class:"text-sm font-semibold"},"Campos Personalizados")],-1)),e.createElementVNode("div",dk,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,h=>(e.openBlock(),e.createElementBlock("section",{key:h.id},[e.createElementVNode("div",{class:e.normalizeClass(["flex gap-1 rounded-md",h.type==="bool"?"flex-row items-center":"flex-col items-start"])},[h.type==="bool"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"checkbox size-4 rounded-sm",type:"checkbox","onUpdate:modelValue":f=>h.content=f},null,8,uk)),[[e.vModelCheckbox,h.content]]):e.createCommentVNode("",!0),e.createElementVNode("p",fk,e.toDisplayString(h.name)+":",1),h.type==="string"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"input_field",type:"text","onUpdate:modelValue":f=>h.content=f},null,8,mk)),[[e.vModelText,h.content]]):e.createCommentVNode("",!0),h.type==="float"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:2,class:"input_field",type:"number","onUpdate:modelValue":f=>h.content=f},null,8,hk)),[[e.vModelText,h.content]]):e.createCommentVNode("",!0),h.type==="list"?(e.openBlock(),e.createBlock(c,{key:3,modelValue:h.content,"onUpdate:modelValue":f=>h.content=f,options:h.additional_info.list.options.map(f=>({value:f,name:f})),placeholder:"Selecione uma opção",theme:"bg-base-300 border-base-100","teleport-to":"body"},null,8,["modelValue","onUpdate:modelValue","options"])):e.createCommentVNode("",!0)],2)]))),128))])]))}}},[["__scopeId","data-v-05f68e6b"]]),gk={class:"modal_head"},yk={class:"modal_responsive"},kk={style:{"min-height":"100%"},class:"flex min-h-full items-center justify-center text-center"},xk={class:"modal-form-container"},bk={class:"flex justify-between p-2.5 rounded-t-2xl bg-base-300 items-center text-current"},wk={class:"flex items-center gap-2"},Ek={class:"flex flex-col items-start"},vk={class:"text-lg font-semibold"},Ck={key:0,class:"text-xs text-gray-400"},Sk={class:"flex gap-2 items-center"},Bk={class:"grid grid-cols-2 flex-1 min-h-0 overflow-hidden"},Vk={class:"w-full flex flex-col justify-between items-center p-1"},Mk={class:"flex flex-col gap-2 justify-center items-center"},Nk={title:"Não é possível alterar a foto do cliente neste momento",class:"flex items-center justify-center w-full"},Ak=["src"],Tk={key:1,class:"bg-base-300 p-2 rounded-xl size-24 flex items-center justify-center border border-base-100 cursor-not-allowed"},Dk={class:"flex flex-col w-full gap-2"},Fk={class:"flex flex-col gap-2 w-full"},Lk={class:"w-full"},$k={class:"flex flex-col gap-2 w-full"},Pk={class:"flex items-center justify-between px-1"},Ok={key:0,class:"flex flex-col gap-2"},_k={class:"flex items-center justify-between px-1"},Hk={class:"w-full bg-base-300 rounded-lg"},Rk={class:"bg-base-300 flex flex-col flex-1 min-h-0"},zk={key:0,class:"flex gap-1 px-1.5"},jk=["disabled"],Gk={key:1,class:"flex flex-col gap-2 flex-1 min-h-0 px-1.5 pt-1.5 overflow-hidden"},Ik={class:"rounded-md bg-base-200 border border-white/10 shadow-sm transition-shadow duration-200 hover:shadow-md"},qk={class:"flex w-full"},Wk={class:"segmentation-section"},Uk={class:"products-list-section flex-1 min-h-0"},Zk={class:"modal_end_button"},Yk=["disabled"],Xk={key:0,class:"size-4 animate-spin rounded-full border-4 border-solid text-white border-t-transparent"},Kk={key:1,class:"text-xs font-semibold"},hi=Ce({__name:"clientsForm",props:{form:{type:Object,default:()=>({tags:[],country:"BR",name:"",photo:null,raw_telephone:"",telephone:"",whatsapp_id:"",whatsapp_jid:"",whatsapp_lid:null,rating:null,outcome:null,created_at:"",updated_at:"",client:"",products:[],notes:""})},save:{type:Function,default:()=>{}},hasCrmPlus:{type:Boolean,default:!1},allProducts:{type:Object,default:()=>{}},allTags:{type:Object,default:()=>{}}},emits:["close","save"],setup(t,{emit:n}){const a=n,o=e.ref("data"),r=t,i=e.reactive({...r.form}),s=e.ref(!1),l=e.ref(!1),d=e.ref([{title:"Nome",info:"Nome do contato",type:"text",placeholder:"Digite o nome do contato",empty:e.computed(()=>l.value),data:e.computed({get:()=>i.name,set:h=>i.name=h})},{title:"Descrição",info:"Descreva o produto para facilitar a identificação",type:"textArea",placeholder:"Automatize fluxos de trabalho com integração rápida e segura entre sistemas.",empty:!1,data:e.computed({get:()=>i.notes,set:h=>i.notes=h})}]),u=e.computed(()=>r.form.mode==="edit"?"Editar cliente":"Adicionar Novo Cliente"),c=async()=>{try{if(l.value=i.name.trim()==="",l.value)return;s.value=!0,await r.save(i)}catch(h){console.error(h)}finally{s.value=!1}};return e.watch(()=>r.form,h=>{Object.assign(i,e.toRaw(h))},{deep:!0,immediate:!0}),(h,f)=>{var p,y,k;const g=e.resolveComponent("Popper"),m=e.resolveComponent("vue-tel-input");return e.openBlock(),e.createElementBlock("div",gk,[f[24]||(f[24]=e.createElementVNode("div",{class:"modal-form-background"},null,-1)),e.createElementVNode("div",yk,[e.createElementVNode("div",kk,[e.createElementVNode("div",xk,[e.createElementVNode("div",{class:e.normalizeClass([{noCrmPlus:!t.hasCrmPlus},"clients-form-background relative rounded-2xl bg-base-200 backdrop-blur-lg"])},[e.createElementVNode("div",bk,[e.createElementVNode("span",wk,[f[14]||(f[14]=e.createElementVNode("svg",{class:"size-6 text-green-500","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4h-4Z","clip-rule":"evenodd"})],-1)),e.createElementVNode("span",Ek,[e.createElementVNode("p",vk,e.toDisplayString(u.value),1),i.id?(e.openBlock(),e.createElementBlock("p",Ck," ID: "+e.toDisplayString(i.id),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("section",Sk,[e.createElementVNode("button",{class:"bg-base-200 p-1.5 rounded-md hover:bg-base-200/70 transition",onClick:f[0]||(f[0]=b=>a("close"))},[...f[15]||(f[15]=[e.createElementVNode("svg",{class:"size-4 text-white","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18 17.94 6M18 18 6.06 6"})],-1)])])])]),e.createElementVNode("div",Bk,[e.createElementVNode("section",Vk,[e.createElementVNode("div",Mk,[t.hasCrmPlus?(e.openBlock(),e.createBlock(Hy,{key:0,outcome:i.outcome,"onUpdate:outcome":f[1]||(f[1]=b=>i.outcome=b),G:""},null,8,["outcome"])):e.createCommentVNode("",!0),e.createElementVNode("div",Nk,[i.photo?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:f[2]||(f[2]=b=>h.viewSingleImage(i.photo))},[e.createElementVNode("img",{src:i.photo,alt:"",class:"size-24 object-cover rounded-md cursor-not-allowed"},null,8,Ak)])):(e.openBlock(),e.createElementBlock("span",Tk,[...f[16]||(f[16]=[e.createElementVNode("svg",{class:"size-14","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4h-4Z","clip-rule":"evenodd"})],-1)])]))]),t.hasCrmPlus?(e.openBlock(),e.createBlock(ao,{key:1,modelValue:i.rating,"onUpdate:modelValue":f[3]||(f[3]=b=>i.rating=b)},null,8,["modelValue"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Dk,[e.createElementVNode("div",Fk,[e.createElementVNode("div",Lk,[e.createVNode(no,{"onUpdate:content":f[4]||(f[4]=b=>d.value[0].data=b.data),content:d.value[0]},null,8,["content"])]),e.createElementVNode("div",$k,[e.createElementVNode("header",Pk,[f[18]||(f[18]=e.createElementVNode("p",{class:"text-xs font-medium text-left"}," Escolha suas etiquetas ",-1)),e.createVNode(g,{hover:"",content:"Etiquetas que estão atribuídas ao cliente",placement:"top",arrow:""},{default:e.withCtx(()=>[...f[17]||(f[17]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1})]),e.createVNode(to,{teleportTo:"body",maxHeight:"10rem",allTags:t.allTags,modelValue:i.tags,"onUpdate:modelValue":f[5]||(f[5]=b=>i.tags=b)},null,8,["allTags","modelValue"])]),t.hasCrmPlus?(e.openBlock(),e.createElementBlock("div",Ok,[e.createElementVNode("header",_k,[f[20]||(f[20]=e.createElementVNode("p",{class:"text-xs font-medium text-left"}," Anotações sobre o cliente ",-1)),e.createVNode(g,{hover:"",content:"Anotações adicionais sobre o cliente",placement:"top",arrow:""},{default:e.withCtx(()=>[...f[19]||(f[19]=[e.createElementVNode("svg",{class:"size-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.408-5.5a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2h-.01ZM10 10a1 1 0 1 0 0 2h1v3h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-4a1 1 0 0 0-1-1h-2Z"})],-1)])]),_:1})]),e.createElementVNode("div",Hk,[e.withDirectives(e.createElementVNode("textarea",{style:{padding:"0.5rem",resize:"none"},class:"w-full bg-base-300 text-xs rounded-md outline-none border-none focus:outline-none focus:ring-0 focus:shadow-none h-24 p-2 resize-none","onUpdate:modelValue":f[6]||(f[6]=b=>i.notes=b),maxlength:"1000"},null,512),[[e.vModelText,i.notes]]),e.createElementVNode("div",{class:e.normalizeClass(["text-right pr-2 pb-1 text-[10px]",((p=i.notes)==null?void 0:p.length)>900?"text-red-500":((y=i.notes)==null?void 0:y.length)>700?"text-yellow-500":"text-gray-400"])},e.toDisplayString(((k=i.notes)==null?void 0:k.length)||0)+"/1000 ",3)])])):e.createCommentVNode("",!0)])])]),e.createElementVNode("section",Rk,[t.hasCrmPlus?(e.openBlock(),e.createElementBlock("div",zk,[e.createElementVNode("button",{class:e.normalizeClass(["toggle-page-button",{selected:o.value==="data"}]),onClick:f[7]||(f[7]=b=>o.value="data")}," Dados do cliente ",2),e.createElementVNode("button",{class:e.normalizeClass(["toggle-page-button",{selected:o.value==="products"}]),disabled:!t.hasCrmPlus,onClick:f[8]||(f[8]=b=>o.value="products")},[...f[21]||(f[21]=[e.createElementVNode("p",null,"Produtos",-1)])],10,jk)])):e.createCommentVNode("",!0),o.value==="data"?(e.openBlock(),e.createElementBlock("div",Gk,[e.createElementVNode("div",Ik,[f[23]||(f[23]=e.createElementVNode("h1",{class:"text-start w-full items-center justify-between flex p-2"},[e.createElementVNode("p",{class:"text-xs font-semibold"},"Contatos")],-1)),e.createElementVNode("div",qk,[f[22]||(f[22]=e.createElementVNode("span",{style:{"border-bottom-left-radius":"0.4rem"},class:"bg-base-300 rounded-bl-lg rounded-t-none flex justify-center items-center w-8"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",class:"size-4 text-gray-500",viewBox:"0 0 17 17"},[e.createElementVNode("path",{d:"M13.601 2.326A7.854 7.854 0 0 0 7.994 0C3.627 0 .068 3.558.064 7.926c0 1.399.366 2.76 1.057 3.965L0 16l4.204-1.102a7.933 7.933 0 0 0 3.79.965h.004c4.368 0 7.926-3.558 7.93-7.93A7.898 7.898 0 0 0 13.6 2.326zM7.994 14.521a6.573 6.573 0 0 1-3.356-.92l-.24-.144-2.494.654.666-2.433-.156-.251a6.56 6.56 0 0 1-1.007-3.505c0-3.626 2.957-6.584 6.591-6.584a6.56 6.56 0 0 1 4.66 1.931 6.557 6.557 0 0 1 1.928 4.66c-.004 3.639-2.961 6.592-6.592 6.592zm3.615-4.934c-.197-.099-1.17-.578-1.353-.646-.182-.065-.315-.099-.445.099-.133.197-.513.646-.627.775-.114.133-.232.148-.43.05-.197-.1-.836-.308-1.592-.985-.59-.525-.985-1.175-1.103-1.372-.114-.198-.011-.304.088-.403.087-.088.197-.232.296-.346.1-.114.133-.198.198-.33.065-.134.034-.248-.015-.347-.05-.099-.445-1.076-.612-1.47-.16-.389-.323-.335-.445-.34-.114-.007-.247-.007-.38-.007a.729.729 0 0 0-.529.247c-.182.198-.691.677-.691 1.654 0 .977.71 1.916.81 2.049.098.133 1.394 2.132 3.383 2.992.47.205.84.326 1.129.418.475.152.904.129 1.246.08.38-.058 1.171-.48 1.338-.943.164-.464.164-.86.114-.943-.049-.084-.182-.133-.38-.232z"})])],-1)),e.createVNode(m,{class:"z-50 w-full",onCountryChanged:f[9]||(f[9]=b=>i.country=b.iso2),mode:"national",validCharactersOnly:!0,defaultCountry:i.country,inputOptions:{placeholder:"Coloque seu telefone",showDialCode:!1,required:!0,searchBoxPlaceholder:"Brazil"},dropdownOptions:{showSearchBox:!0,showFlags:!0,searchBoxPlaceholder:"Brazil"},modelValue:i.telephone,"onUpdate:modelValue":f[10]||(f[10]=b=>i.telephone=b)},null,8,["defaultCountry","modelValue"])])]),e.createElementVNode("div",Wk,[o.value==="data"?(e.openBlock(),e.createBlock(pk,{key:0,modelValue:i.segmentation_fields,"onUpdate:modelValue":f[11]||(f[11]=b=>i.segmentation_fields=b)},null,8,["modelValue"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Uk,[e.createVNode(ok,{allProducts:t.allProducts,modelValue:i.products,"onUpdate:modelValue":f[12]||(f[12]=b=>i.products=b)},null,8,["allProducts","modelValue"])],512),[[e.vShow,o.value==="products"]])])]),e.createElementVNode("div",Zk,[e.createElementVNode("button",{disabled:s.value,class:"bg-green-500 py-2 px-4 rounded-lg text-sm font-medium hover:bg-green-500/80 transition-colors flex gap-2 items-center justify-center min-w-32",onClick:f[13]||(f[13]=b=>c())},[s.value?(e.openBlock(),e.createElementBlock("div",Xk)):(e.openBlock(),e.createElementBlock("p",Kk,"Salvar"))],8,Yk)])],2)])])])])}}},[["__scopeId","data-v-870ff451"]]),Qk={class:"flex justify-center items-center"},Jk={class:"text-[8px] font-bold"},ex={class:"tag-view-popper-content-text"},tx={class:"flex"},nx={class:"svg-list-tag","aria-hidden":"true",viewBox:"0 0 25 100",style:{color:"#d1d5db"}},ax={style:{backgroundColor:"#d1d5db"},class:"w-full ml-[-0.5rem] rounded-r-md inline-flex items-center justify-center p-0.5 border-b-2 border-gray-900"},ox={class:"text-[8px] text-black font-bold"},rx={class:"max-h-64 overflow-y-auto hide-scrollbar"},ix={class:"flex flex-col gap-2"},sx={class:"tag-view-popper-content-text"},lx={key:1},pi=Ce({__name:"tagView",props:{clients:{type:Object,required:!0}},setup(t){const n=t;return e.computed(()=>{var a,o;return((o=(a=n.clients)==null?void 0:a.tags)==null?void 0:o.slice(0,4))||[]}),(a,o)=>{const r=e.resolveComponent("Popper");return e.openBlock(),e.createElementBlock("section",Qk,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.clients.tags.slice(0,4),(i,s)=>(e.openBlock(),e.createBlock(r,{class:"tag-view-theme",arrow:"",hover:"",key:s},{content:e.withCtx(()=>[e.createElementVNode("p",ex,e.toDisplayString(i.name),1)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex",e.unref(vn)(i.color)])},[(e.openBlock(),e.createElementBlock("svg",{class:"svg-list-tag","aria-hidden":"true",viewBox:"0 0 30 100",style:e.normalizeStyle({color:i.color||"#fff"})},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])],4)),e.createElementVNode("span",{style:e.normalizeStyle({backgroundColor:i.color||"#fff"}),class:"w-full ml-[-0.10rem] rounded-r-md inline-flex items-center justify-center px-1 py-0.5 border-b-2 border-gray-900"},[e.createElementVNode("p",Jk,e.toDisplayString(i.name.charAt(0).toUpperCase()),1)],4)],2)]),_:2},1024))),128)),t.clients.tags.length>4?(e.openBlock(),e.createBlock(r,{key:0,arrow:"",hover:"",class:"tag-view-theme"},{content:e.withCtx(()=>[e.createElementVNode("section",rx,[e.createElementVNode("div",ix,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.clients.tags,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id||i.name,class:"relative inline-flex items-center rounded-md overflow-hidden"},[(e.openBlock(),e.createElementBlock("svg",{class:"size-6","aria-hidden":"true",viewBox:"0 0 75 100",style:e.normalizeStyle({color:i.color||"#fff"})},[...o[2]||(o[2]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])],4)),e.createElementVNode("span",{class:e.normalizeClass(["p-0.5 w-full text-sm font-semibold truncate text-start -ml-2",e.unref(vn)(i.color)]),style:e.normalizeStyle(["max-width: 12rem",{background:i.color||"#fff"}])},[e.createElementVNode("p",sx,e.toDisplayString(i.name),1)],6)]))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",tx,[(e.openBlock(),e.createElementBlock("svg",nx,[...o[1]||(o[1]=[e.createElementVNode("path",{d:"M49.9,0a17.1,17.1,0,0,0-12,5L5,37.9A17,17,0,0,0,5,62L37.9,94.9a17.1,17.1,0,0,0,12,5ZM25.4,59.4a9.5,9.5,0,1,1,9.5-9.5A9.5,9.5,0,0,1,25.4,59.4Z",fill:"currentColor"},null,-1)])])),e.createElementVNode("span",ax,[e.createElementVNode("p",ox," +"+e.toDisplayString(t.clients.tags.length-4),1)])])]),_:1})):e.createCommentVNode("",!0),!t.clients.tags||t.clients.tags.length===0?(e.openBlock(),e.createElementBlock("span",lx,"-")):e.createCommentVNode("",!0)])}}},[["__scopeId","data-v-e2356f0a"]]),gi=Ce({__name:"floating-dev",setup(t){const n=e.ref(!1),a=e.ref({x:30,y:30}),o=e.ref({x:0,y:0}),r=e.ref(!1),i=e.ref(null),s=e.ref(null),l=e.ref({vertical:"bottom",horizontal:"right"}),d=e.computed(()=>({position:"fixed",left:`${a.value.x}px`,top:`${a.value.y}px`,zIndex:1e3,cursor:r.value?"grabbing":"grab"})),u=e.computed(()=>{const p={position:"absolute",background:"#fff",borderRadius:"10px",boxShadow:"0 4px 15px rgba(0, 0, 0, 0.2)",width:"280px",maxWidth:"90vw",zIndex:1001};return l.value.vertical==="top"?p.bottom="60px":p.top="60px",l.value.horizontal==="left"?p.right="0":p.left="0",p});async function c(){if(n.value){n.value=!1;return}n.value=!0,await e.nextTick(),h()}function h(){if(!i.value||!s.value)return;const p=i.value.getBoundingClientRect(),y=s.value.offsetWidth,k=s.value.offsetHeight,b={top:p.top,bottom:window.innerHeight-(p.top+p.height),left:p.left,right:window.innerWidth-(p.left+p.width)};l.value.vertical=b.bottom<k&&b.top>k?"top":"bottom",l.value.horizontal=b.right<y&&b.left>y?"left":"right"}function f(p){r.value=!0;const y=p.type.includes("touch")?p.touches[0]:p;o.value={x:y.clientX-a.value.x,y:y.clientY-a.value.y},document.addEventListener("mousemove",g),document.addEventListener("mouseup",m),document.addEventListener("touchmove",g),document.addEventListener("touchend",m)}function g(p){if(!r.value)return;const y=p.type.includes("touch")?p.touches[0]:p,k=y.clientX-o.value.x,b=y.clientY-o.value.y,E=window.innerWidth-i.value.offsetWidth,V=window.innerHeight-i.value.offsetHeight;a.value.x=Math.min(Math.max(0,k),E),a.value.y=Math.min(Math.max(0,b),V)}function m(){r.value=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",m)}return e.onBeforeUnmount(m),(p,y)=>(e.openBlock(),e.createElementBlock("div",{class:"floating-widget",style:e.normalizeStyle(d.value),ref_key:"widgetRef",ref:i,onMousedown:f,onTouchstart:f},[e.createElementVNode("button",{class:"floating-button",onClick:e.withModifiers(c,["stop"]),"aria-label":"Abrir painel flutuante"},[...y[0]||(y[0]=[e.createElementVNode("svg",{class:"floating-button-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M370 378c28.89 23.52 46 46.07 46 86M142 378c-28.89 23.52-46 46.06-46 86M384 208c28.89-23.52 32-56.07 32-96M128 206c-28.89-23.52-32-54.06-32-94M464 288.13h-80M128 288.13H48M256 192v256",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),e.createElementVNode("path",{d:"M256 448h0c-70.4 0-128-57.6-128-128v-96.07c0-65.07 57.6-96 128-96h0c70.4 0 128 25.6 128 96V320c0 70.4-57.6 128-128 128z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),e.createElementVNode("path",{d:"M179.43 143.52a49.08 49.08 0 01-3.43-15.73A80 80 0 01255.79 48h.42A80 80 0 01336 127.79a41.91 41.91 0 01-3.12 14.3",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1)])]),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"floating-panel",ref_key:"panelRef",ref:s,style:e.normalizeStyle(u.value)},[e.renderSlot(p.$slots,"default",{},()=>[y[1]||(y[1]=e.createElementVNode("p",{style:{"text-align":"center","font-size":"0.9rem"}}," Adicione seu conteúdo aqui 👇 ",-1))],!0)],4)):e.createCommentVNode("",!0)]),_:3})],36))}},[["__scopeId","data-v-7767be25"]]);Dt.defineStore("debug",{state:()=>({message:"Debug store initialized"}),actions:{logMessage(){console.log(this.message)}}});function cx(t){t.component("primarySelect",go),t.component("departSelect",J1),t.component("attendantSelect",ei),t.component("SimpleModal",yo),t.component("simpleCard",ko),t.component("instanceSelect",rr),t.component("calendarEvents",yr),t.component("MFA",kr),t.component("MfaQrCode",Ad),t.component("chatWindow",K1),t.component("FilterSelectLib",ti),t.component("MobileInternalChat",Q1),t.component("RandomAvatar",ri),t.component("MinModal",ii),t.component("LibPatchNotes",ci),t.component("BtnNewUpdates",di),t.component("LibPhotoPicker",ui),t.component("SelectMultipleDepartments",fi),t.component("PrimaryInput",no),t.component("SimpleSelect",mi),t.component("FloatingDev",gi),t.component("RaitingInput",ao),t.component("TagView",pi),t.component("ClientsForm",hi),t.component("SelectMultipleTags",to),t.component("SimpleLoader",oo)}function yi(t,n="add"){const a=eo();n==="add"?a.addDepartments(t):n==="delete"?a.removeDepartments(t):n==="update"?(a.departments=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibDeparts.`)}function ki(t,n="add"){const a=Yt();n==="add"?a.addAttendants(t):n==="delete"?a.removeAttendants(t):n==="update"?(a.attendants=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibAttendants.`)}function xi(t,n="add"){const a=va();n==="add"?a.addInstance(t):n==="delete"?a.removeInstance(t):n==="update"?(a.instances=t,a.loaded=!0):console.error(`Ação "${n}" não suportada em attLibInstances.`)}async function bi(t,n,a,o=[],r=[],i=[]){try{const s=await or(t);n&&await s.setToken(n),a&&(at.defaults.baseURL=a);const l=eo(t);r.length>0&&(l.departments=r,l.count=r.length);const d=Yt(t);o.length>0&&(d.attendants=o,d.count=o.length),await va(t).fetchInstances()}catch(s){console.error("Erro no setupLibrary:",s)}}function wi(t){return vn(t)}const dx={install:cx,setupLibrary:bi,attLibDeparts:yi,attLibAttendants:ki,attLibInstances:xi,primarySelect:go,simpleModal:yo,simpleCard:ko,instanceSelect:rr,SimpleSelect:mi,FloatingDev:gi,calendar:yr,SimpleLoader:oo,MFA:kr,chatWindow:K1,departSelect:J1,attendantSelect:ei,FilterSelectLib:ti,MobileInternalChat:Q1,RandomAvatar:ri,MinModal:ii,libPatchNotes:ci,btnNewUpdates:di,LibPhotoPicker:ui,SelectMultipleDepartments:fi,SelectMultipleTags:to,PrimaryInput:no,getWithContrastColor:wi,RaitingInput:ao,TagView:pi,ClientsForm:hi};function ux(t){t.CapacitorUtils.Synapse=new Proxy({},{get(n,a){return new Proxy({},{get(o,r){return(i,s,l)=>{const d=t.Capacitor.Plugins[a];if(d===void 0){l(new Error(`Capacitor plugin ${a} not found`));return}if(typeof d[r]!="function"){l(new Error(`Method ${r} not found in Capacitor plugin ${a}`));return}(async()=>{try{const u=await d[r](i);s(u)}catch(u){l(u)}})()}}})}})}function fx(t){t.CapacitorUtils.Synapse=new Proxy({},{get(n,a){return t.cordova.plugins[a]}})}function mx(t=!1){typeof window>"u"||(window.CapacitorUtils=window.CapacitorUtils||{},window.Capacitor!==void 0&&!t?ux(window):window.cordova!==void 0&&fx(window))}var Ei;(function(t){t.Documents="DOCUMENTS",t.Data="DATA",t.Library="LIBRARY",t.Cache="CACHE",t.External="EXTERNAL",t.ExternalStorage="EXTERNAL_STORAGE",t.ExternalCache="EXTERNAL_CACHE",t.LibraryNoCloud="LIBRARY_NO_CLOUD",t.Temporary="TEMPORARY"})(Ei||(Ei={}));var ro;(function(t){t.UTF8="utf8",t.ASCII="ascii",t.UTF16="utf16"})(ro||(ro={}));const sa=wn("Filesystem",{web:()=>Promise.resolve().then(()=>Fx).then(t=>new t.FilesystemWeb)});mx();const hx=wn("BlobWriter");function px(t){return window.btoa(Array.from(new Uint8Array(t)).map(function(n){return String.fromCharCode(n)}).join(""))}function gx({path:t,directory:n,blob:a,recursive:o}){return sa.writeFile({directory:n,path:t,recursive:o,data:""}).then(function(){return new Promise(function(r,i){function s(d){i(d.target.error)}const l=window.indexedDB.open("Disc");l.onerror=s,l.onsuccess=function(){const u=l.result.transaction("FileStorage","readwrite");u.onerror=s;const c=u.objectStore("FileStorage"),h=`/${n}/${t.replace(/^\//,"")}`,f=c.get(h);f.onsuccess=function(){f.result.size=a.size,f.result.content=a;const g=c.put(f.result);g.onsuccess=function(){r(void 0)}}}})})}function vi({path:t,directory:n,blob:a,recursive:o}){return sa.writeFile({directory:n,path:t,recursive:o,data:""}).then(function r(){if(a.size===0)return Promise.resolve();const i=3*128*1024,s=a.slice(0,i);return a=a.slice(i),new Response(s).arrayBuffer().then(function(d){return sa.appendFile({directory:n,path:t,data:px(d)})}).then(r)})}function yx(t){const{path:n,directory:a,blob:o,fast_mode:r=!1,recursive:i,on_fallback:s}=t;return!o||!Number.isSafeInteger(o.size)||typeof o.type!="string"?Promise.reject(new Error("Not a Blob.")):ea.getPlatform()==="web"?r?gx(t):vi(t):Promise.all([hx.get_config(),sa.getUri({path:n,directory:a})]).then(function([l,d]){const u=d.uri.replace("file://","");return(window.CapacitorWebFetch||window.fetch)(l.base_url+u+(i?"?recursive=true":""),{headers:{authorization:l.auth_token},method:"put",body:o}).then(function(h){if(h.status!==204)throw new Error("Bad HTTP status: "+h.status);return d.uri})}).catch(function(d){return s!==void 0&&s(d),vi(t)})}const kx=Object.freeze(yx);function xx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ci={};function bx(t){return t&&t.__esModule?t:{default:t}}var wx=bx,io={exports:{}},Si;function Ex(){return Si||(Si=1,function(t){var n=function(a){var o=Object.prototype,r=o.hasOwnProperty,i=Object.defineProperty||function(P,R,_){P[R]=_.value},s,l=typeof Symbol=="function"?Symbol:{},d=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",c=l.toStringTag||"@@toStringTag";function h(P,R,_){return Object.defineProperty(P,R,{value:_,enumerable:!0,configurable:!0,writable:!0}),P[R]}try{h({},"")}catch{h=function(R,_,oe){return R[_]=oe}}function f(P,R,_,oe){var de=R&&R.prototype instanceof E?R:E,pe=Object.create(de.prototype),ye=new Z(oe||[]);return i(pe,"_invoke",{value:F(P,_,ye)}),pe}a.wrap=f;function g(P,R,_){try{return{type:"normal",arg:P.call(R,_)}}catch(oe){return{type:"throw",arg:oe}}}var m="suspendedStart",p="suspendedYield",y="executing",k="completed",b={};function E(){}function V(){}function M(){}var A={};h(A,d,function(){return this});var H=Object.getPrototypeOf,C=H&&H(H(Q([])));C&&C!==o&&r.call(C,d)&&(A=C);var x=M.prototype=E.prototype=Object.create(A);V.prototype=M,i(x,"constructor",{value:M,configurable:!0}),i(M,"constructor",{value:V,configurable:!0}),V.displayName=h(M,c,"GeneratorFunction");function N(P){["next","throw","return"].forEach(function(R){h(P,R,function(_){return this._invoke(R,_)})})}a.isGeneratorFunction=function(P){var R=typeof P=="function"&&P.constructor;return R?R===V||(R.displayName||R.name)==="GeneratorFunction":!1},a.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,M):(P.__proto__=M,h(P,c,"GeneratorFunction")),P.prototype=Object.create(x),P},a.awrap=function(P){return{__await:P}};function L(P,R){function _(pe,ye,Ve,Le){var Ae=g(P[pe],P,ye);if(Ae.type==="throw")Le(Ae.arg);else{var qe=Ae.arg,_e=qe.value;return _e&&typeof _e=="object"&&r.call(_e,"__await")?R.resolve(_e.__await).then(function($e){_("next",$e,Ve,Le)},function($e){_("throw",$e,Ve,Le)}):R.resolve(_e).then(function($e){qe.value=$e,Ve(qe)},function($e){return _("throw",$e,Ve,Le)})}}var oe;function de(pe,ye){function Ve(){return new R(function(Le,Ae){_(pe,ye,Le,Ae)})}return oe=oe?oe.then(Ve,Ve):Ve()}i(this,"_invoke",{value:de})}N(L.prototype),h(L.prototype,u,function(){return this}),a.AsyncIterator=L,a.async=function(P,R,_,oe,de){de===void 0&&(de=Promise);var pe=new L(f(P,R,_,oe),de);return a.isGeneratorFunction(R)?pe:pe.next().then(function(ye){return ye.done?ye.value:pe.next()})};function F(P,R,_){var oe=m;return function(pe,ye){if(oe===y)throw new Error("Generator is already running");if(oe===k){if(pe==="throw")throw ye;return ee()}for(_.method=pe,_.arg=ye;;){var Ve=_.delegate;if(Ve){var Le=S(Ve,_);if(Le){if(Le===b)continue;return Le}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(oe===m)throw oe=k,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);oe=y;var Ae=g(P,R,_);if(Ae.type==="normal"){if(oe=_.done?k:p,Ae.arg===b)continue;return{value:Ae.arg,done:_.done}}else Ae.type==="throw"&&(oe=k,_.method="throw",_.arg=Ae.arg)}}}function S(P,R){var _=R.method,oe=P.iterator[_];if(oe===s)return R.delegate=null,_==="throw"&&P.iterator.return&&(R.method="return",R.arg=s,S(P,R),R.method==="throw")||_!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+_+"' method")),b;var de=g(oe,P.iterator,R.arg);if(de.type==="throw")return R.method="throw",R.arg=de.arg,R.delegate=null,b;var pe=de.arg;if(!pe)return R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,b;if(pe.done)R[P.resultName]=pe.value,R.next=P.nextLoc,R.method!=="return"&&(R.method="next",R.arg=s);else return pe;return R.delegate=null,b}N(x),h(x,c,"Generator"),h(x,d,function(){return this}),h(x,"toString",function(){return"[object Generator]"});function v(P){var R={tryLoc:P[0]};1 in P&&(R.catchLoc=P[1]),2 in P&&(R.finallyLoc=P[2],R.afterLoc=P[3]),this.tryEntries.push(R)}function O(P){var R=P.completion||{};R.type="normal",delete R.arg,P.completion=R}function Z(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(v,this),this.reset(!0)}a.keys=function(P){var R=Object(P),_=[];for(var oe in R)_.push(oe);return _.reverse(),function de(){for(;_.length;){var pe=_.pop();if(pe in R)return de.value=pe,de.done=!1,de}return de.done=!0,de}};function Q(P){if(P){var R=P[d];if(R)return R.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var _=-1,oe=function de(){for(;++_<P.length;)if(r.call(P,_))return de.value=P[_],de.done=!1,de;return de.value=s,de.done=!0,de};return oe.next=oe}}return{next:ee}}a.values=Q;function ee(){return{value:s,done:!0}}return Z.prototype={constructor:Z,reset:function(P){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach(O),!P)for(var R in this)R.charAt(0)==="t"&&r.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=s)},stop:function(){this.done=!0;var P=this.tryEntries[0],R=P.completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var R=this;function _(Le,Ae){return pe.type="throw",pe.arg=P,R.next=Le,Ae&&(R.method="next",R.arg=s),!!Ae}for(var oe=this.tryEntries.length-1;oe>=0;--oe){var de=this.tryEntries[oe],pe=de.completion;if(de.tryLoc==="root")return _("end");if(de.tryLoc<=this.prev){var ye=r.call(de,"catchLoc"),Ve=r.call(de,"finallyLoc");if(ye&&Ve){if(this.prev<de.catchLoc)return _(de.catchLoc,!0);if(this.prev<de.finallyLoc)return _(de.finallyLoc)}else if(ye){if(this.prev<de.catchLoc)return _(de.catchLoc,!0)}else if(Ve){if(this.prev<de.finallyLoc)return _(de.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(P,R){for(var _=this.tryEntries.length-1;_>=0;--_){var oe=this.tryEntries[_];if(oe.tryLoc<=this.prev&&r.call(oe,"finallyLoc")&&this.prev<oe.finallyLoc){var de=oe;break}}de&&(P==="break"||P==="continue")&&de.tryLoc<=R&&R<=de.finallyLoc&&(de=null);var pe=de?de.completion:{};return pe.type=P,pe.arg=R,de?(this.method="next",this.next=de.finallyLoc,b):this.complete(pe)},complete:function(P,R){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&R&&(this.next=R),b},finish:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var _=this.tryEntries[R];if(_.finallyLoc===P)return this.complete(_.completion,_.afterLoc),O(_),b}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var _=this.tryEntries[R];if(_.tryLoc===P){var oe=_.completion;if(oe.type==="throw"){var de=oe.arg;O(_)}return de}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,_){return this.delegate={iterator:Q(P),resultName:R,nextLoc:_},this.method==="next"&&(this.arg=s),b}},a}(t.exports);try{regeneratorRuntime=n}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}(io)),io.exports}var so,Bi;function vx(){return Bi||(Bi=1,so=Ex()),so}var lo,Vi;function Cx(){if(Vi)return lo;Vi=1;function t(a,o,r,i,s,l,d){try{var u=a[l](d),c=u.value}catch(h){r(h);return}u.done?o(c):Promise.resolve(c).then(i,s)}function n(a){return function(){var o=this,r=arguments;return new Promise(function(i,s){var l=a.apply(o,r);function d(c){t(l,i,s,d,u,"next",c)}function u(c){t(l,i,s,d,u,"throw",c)}d(void 0)})}}return lo=n,lo}(function(t){var n=wx;Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var a=n(vx()),o=n(Cx());function r(s){return i.apply(this,arguments)}function i(){return(i=(0,o.default)(a.default.mark(function s(l){var d,u;return a.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return d=document.createElement("video"),u=new Promise(function(h,f){d.addEventListener("loadedmetadata",function(){d.duration===1/0?(d.currentTime=Number.MAX_SAFE_INTEGER,d.ontimeupdate=function(){d.ontimeupdate=null,h(d.duration),d.currentTime=0}):h(d.duration)}),d.onerror=function(g){return f(g.target.error)}}),d.src=typeof l=="string"||l instanceof String?l:window.URL.createObjectURL(l),c.abrupt("return",u);case 4:case"end":return c.stop()}},s)}))).apply(this,arguments)}})(Ci);const Sx=xx(Ci),Tt=()=>({value:!0}),Cn=()=>({value:!1}),Bx=()=>new Error("MISSING_PERMISSION"),Vx=()=>new Error("ALREADY_RECORDING"),Mx=()=>new Error("DEVICE_CANNOT_VOICE_RECORD"),Mi=()=>new Error("FAILED_TO_RECORD"),Nx=()=>new Error("EMPTY_RECORDING"),co=()=>new Error("RECORDING_HAS_NOT_STARTED"),Ni=()=>new Error("FAILED_TO_FETCH_RECORDING"),uo=()=>new Error("COULD_NOT_QUERY_PERMISSION_STATUS"),Ai={"audio/aac":".aac","audio/mp4":".mp3","audio/webm;codecs=opus":".ogg","audio/webm":".ogg","audio/ogg;codecs=opus":".ogg"},Ti=()=>new Promise(()=>{});class ht{constructor(){this.mediaRecorder=null,this.chunks=[],this.pendingResult=Ti()}static async canDeviceVoiceRecord(){var n;return((n=navigator==null?void 0:navigator.mediaDevices)===null||n===void 0?void 0:n.getUserMedia)==null||ht.getSupportedMimeType()==null?Cn():Tt()}async startRecording(n){if(this.mediaRecorder!=null)throw Vx();if(!(await ht.canDeviceVoiceRecord()).value)throw Mx();if(!(await ht.hasAudioRecordingPermission().catch(()=>Tt())).value)throw Bx();return navigator.mediaDevices.getUserMedia({audio:!0}).then(r=>this.onSuccessfullyStartedRecording(r,n)).catch(this.onFailedToStartRecording.bind(this))}async stopRecording(){if(this.mediaRecorder==null)throw co();try{return this.mediaRecorder.stop(),this.mediaRecorder.stream.getTracks().forEach(n=>n.stop()),this.pendingResult}catch{throw Ni()}finally{this.prepareInstanceForNextOperation()}}static async hasAudioRecordingPermission(){return navigator.permissions.query==null?navigator.mediaDevices==null?Promise.reject(uo()):navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Tt()).catch(()=>{throw uo()}):navigator.permissions.query({name:"microphone"}).then(n=>({value:n.state==="granted"})).catch(()=>{throw uo()})}static async requestAudioRecordingPermission(){return(await ht.hasAudioRecordingPermission().catch(()=>Cn())).value?Tt():navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Tt()).catch(()=>Cn())}pauseRecording(){if(this.mediaRecorder==null)throw co();return this.mediaRecorder.state==="recording"?(this.mediaRecorder.pause(),Promise.resolve(Tt())):Promise.resolve(Cn())}resumeRecording(){if(this.mediaRecorder==null)throw co();return this.mediaRecorder.state==="paused"?(this.mediaRecorder.resume(),Promise.resolve(Tt())):Promise.resolve(Cn())}getCurrentStatus(){return this.mediaRecorder==null?Promise.resolve({status:na.NONE}):this.mediaRecorder.state==="recording"?Promise.resolve({status:na.RECORDING}):this.mediaRecorder.state==="paused"?Promise.resolve({status:na.PAUSED}):Promise.resolve({status:na.NONE})}static getSupportedMimeType(){if((MediaRecorder==null?void 0:MediaRecorder.isTypeSupported)==null)return null;const n=Object.keys(Ai).find(a=>MediaRecorder.isTypeSupported(a));return n??null}onSuccessfullyStartedRecording(n,a){return this.pendingResult=new Promise((o,r)=>{this.mediaRecorder=new MediaRecorder(n),this.mediaRecorder.onerror=()=>{this.prepareInstanceForNextOperation(),r(Mi())},this.mediaRecorder.onstop=async()=>{var i,s,l;const d=ht.getSupportedMimeType();if(d==null){this.prepareInstanceForNextOperation(),r(Ni());return}const u=new Blob(this.chunks,{type:d});if(u.size<=0){this.prepareInstanceForNextOperation(),r(Nx());return}let c,h;a!=null?(c=`${(l=(s=(i=a.subDirectory)===null||i===void 0?void 0:i.match(/^\/?(.+[^/])\/?$/))===null||s===void 0?void 0:s[1])!==null&&l!==void 0?l:""}/recording-${new Date().getTime()}${Ai[d]}`,await kx({blob:u,directory:a.directory,fast_mode:!0,path:c,recursive:!0})):h=await ht.blobToBase64(u);const f=await Sx(u);this.prepareInstanceForNextOperation(),o({value:{recordDataBase64:h,mimeType:d,msDuration:f*1e3,path:c}})},this.mediaRecorder.ondataavailable=i=>this.chunks.push(i.data),this.mediaRecorder.start()}),Tt()}onFailedToStartRecording(){throw this.prepareInstanceForNextOperation(),Mi()}static blobToBase64(n){return new Promise(a=>{const o=new FileReader;o.onloadend=()=>{const r=String(o.result),i=r.split("base64,"),s=i.length>1?i[1]:r;a(s.trim())},o.readAsDataURL(n)})}prepareInstanceForNextOperation(){if(this.mediaRecorder!=null&&this.mediaRecorder.state==="recording")try{this.mediaRecorder.stop()}catch(n){console.warn("While trying to stop a media recorder, an error was thrown",n)}this.pendingResult=Ti(),this.mediaRecorder=null,this.chunks=[]}}class Ax extends ta{constructor(){super(...arguments),this.voiceRecorderInstance=new ht}canDeviceVoiceRecord(){return ht.canDeviceVoiceRecord()}hasAudioRecordingPermission(){return ht.hasAudioRecordingPermission()}requestAudioRecordingPermission(){return ht.requestAudioRecordingPermission()}startRecording(n){return this.voiceRecorderInstance.startRecording(n)}stopRecording(){return this.voiceRecorderInstance.stopRecording()}pauseRecording(){return this.voiceRecorderInstance.pauseRecording()}resumeRecording(){return this.voiceRecorderInstance.resumeRecording()}getCurrentStatus(){return this.voiceRecorderInstance.getCurrentStatus()}}const Tx=Object.freeze(Object.defineProperty({__proto__:null,VoiceRecorderWeb:Ax},Symbol.toStringTag,{value:"Module"}));function Di(t){const n=t.split("/").filter(o=>o!=="."),a=[];return n.forEach(o=>{o===".."&&a.length>0&&a[a.length-1]!==".."?a.pop():a.push(o)}),a.join("/")}function Dx(t,n){t=Di(t),n=Di(n);const a=t.split("/"),o=n.split("/");return t!==n&&a.every((r,i)=>r===o[i])}class la extends ta{constructor(){super(...arguments),this.DB_VERSION=1,this.DB_NAME="Disc",this._writeCmds=["add","put","delete"],this.downloadFile=async n=>{var a,o;const r=F1(n,n.webFetchExtra),i=await fetch(n.url,r);let s;if(!n.progress)s=await i.blob();else if(!(i!=null&&i.body))s=new Blob;else{const d=i.body.getReader();let u=0;const c=[],h=i.headers.get("content-type"),f=parseInt(i.headers.get("content-length")||"0",10);for(;;){const{done:p,value:y}=await d.read();if(p)break;c.push(y),u+=(y==null?void 0:y.length)||0;const k={url:n.url,bytes:u,contentLength:f};this.notifyListeners("progress",k)}const g=new Uint8Array(u);let m=0;for(const p of c)typeof p>"u"||(g.set(p,m),m+=p.length);s=new Blob([g.buffer],{type:h||void 0})}return{path:(await this.writeFile({path:n.path,directory:(a=n.directory)!==null&&a!==void 0?a:void 0,recursive:(o=n.recursive)!==null&&o!==void 0?o:!1,data:s})).uri,blob:s}}}readFileInChunks(n,a){throw this.unavailable("Method not implemented.")}async initDb(){if(this._db!==void 0)return this._db;if(!("indexedDB"in window))throw this.unavailable("This browser doesn't support IndexedDB");return new Promise((n,a)=>{const o=indexedDB.open(this.DB_NAME,this.DB_VERSION);o.onupgradeneeded=la.doUpgrade,o.onsuccess=()=>{this._db=o.result,n(o.result)},o.onerror=()=>a(o.error),o.onblocked=()=>{console.warn("db blocked")}})}static doUpgrade(n){const o=n.target.result;switch(n.oldVersion){case 0:case 1:default:o.objectStoreNames.contains("FileStorage")&&o.deleteObjectStore("FileStorage"),o.createObjectStore("FileStorage",{keyPath:"path"}).createIndex("by_folder","folder")}}async dbRequest(n,a){const o=this._writeCmds.indexOf(n)!==-1?"readwrite":"readonly";return this.initDb().then(r=>new Promise((i,s)=>{const u=r.transaction(["FileStorage"],o).objectStore("FileStorage")[n](...a);u.onsuccess=()=>i(u.result),u.onerror=()=>s(u.error)}))}async dbIndexRequest(n,a,o){const r=this._writeCmds.indexOf(a)!==-1?"readwrite":"readonly";return this.initDb().then(i=>new Promise((s,l)=>{const h=i.transaction(["FileStorage"],r).objectStore("FileStorage").index(n)[a](...o);h.onsuccess=()=>s(h.result),h.onerror=()=>l(h.error)}))}getPath(n,a){const o=a!==void 0?a.replace(/^[/]+|[/]+$/g,""):"";let r="";return n!==void 0&&(r+="/"+n),a!==""&&(r+="/"+o),r}async clear(){(await this.initDb()).transaction(["FileStorage"],"readwrite").objectStore("FileStorage").clear()}async readFile(n){const a=this.getPath(n.directory,n.path),o=await this.dbRequest("get",[a]);if(o===void 0)throw Error("File does not exist.");return{data:o.content?o.content:""}}async writeFile(n){const a=this.getPath(n.directory,n.path);let o=n.data;const r=n.encoding,i=n.recursive,s=await this.dbRequest("get",[a]);if(s&&s.type==="directory")throw Error("The supplied path is a directory.");const l=a.substr(0,a.lastIndexOf("/"));if(await this.dbRequest("get",[l])===void 0){const h=l.indexOf("/",1);if(h!==-1){const f=l.substr(h);await this.mkdir({path:f,directory:n.directory,recursive:i})}}if(!r&&!(o instanceof Blob)&&(o=o.indexOf(",")>=0?o.split(",")[1]:o,!this.isBase64String(o)))throw Error("The supplied data is not valid base64 content.");const u=Date.now(),c={path:a,folder:l,type:"file",size:o instanceof Blob?o.size:o.length,ctime:u,mtime:u,content:o};return await this.dbRequest("put",[c]),{uri:c.path}}async appendFile(n){const a=this.getPath(n.directory,n.path);let o=n.data;const r=n.encoding,i=a.substr(0,a.lastIndexOf("/")),s=Date.now();let l=s;const d=await this.dbRequest("get",[a]);if(d&&d.type==="directory")throw Error("The supplied path is a directory.");if(await this.dbRequest("get",[i])===void 0){const h=i.indexOf("/",1);if(h!==-1){const f=i.substr(h);await this.mkdir({path:f,directory:n.directory,recursive:!0})}}if(!r&&!this.isBase64String(o))throw Error("The supplied data is not valid base64 content.");if(d!==void 0){if(d.content instanceof Blob)throw Error("The occupied entry contains a Blob object which cannot be appended to.");d.content!==void 0&&!r?o=btoa(atob(d.content)+atob(o)):o=d.content+o,l=d.ctime}const c={path:a,folder:i,type:"file",size:o.length,ctime:l,mtime:s,content:o};await this.dbRequest("put",[c])}async deleteFile(n){const a=this.getPath(n.directory,n.path);if(await this.dbRequest("get",[a])===void 0)throw Error("File does not exist.");if((await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(a)])).length!==0)throw Error("Folder is not empty.");await this.dbRequest("delete",[a])}async mkdir(n){const a=this.getPath(n.directory,n.path),o=n.recursive,r=a.substr(0,a.lastIndexOf("/")),i=(a.match(/\//g)||[]).length,s=await this.dbRequest("get",[r]),l=await this.dbRequest("get",[a]);if(i===1)throw Error("Cannot create Root directory");if(l!==void 0)throw Error("Current directory does already exist.");if(!o&&i!==2&&s===void 0)throw Error("Parent directory must exist");if(o&&i!==2&&s===void 0){const c=r.substr(r.indexOf("/",1));await this.mkdir({path:c,directory:n.directory,recursive:o})}const d=Date.now(),u={path:a,folder:r,type:"directory",size:0,ctime:d,mtime:d};await this.dbRequest("put",[u])}async rmdir(n){const{path:a,directory:o,recursive:r}=n,i=this.getPath(o,a),s=await this.dbRequest("get",[i]);if(s===void 0)throw Error("Folder does not exist.");if(s.type!=="directory")throw Error("Requested path is not a directory");const l=await this.readdir({path:a,directory:o});if(l.files.length!==0&&!r)throw Error("Folder is not empty");for(const d of l.files){const u=`${a}/${d.name}`;(await this.stat({path:u,directory:o})).type==="file"?await this.deleteFile({path:u,directory:o}):await this.rmdir({path:u,directory:o,recursive:r})}await this.dbRequest("delete",[i])}async readdir(n){const a=this.getPath(n.directory,n.path),o=await this.dbRequest("get",[a]);if(n.path!==""&&o===void 0)throw Error("Folder does not exist.");const r=await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(a)]);return{files:await Promise.all(r.map(async s=>{let l=await this.dbRequest("get",[s]);return l===void 0&&(l=await this.dbRequest("get",[s+"/"])),{name:s.substring(a.length+1),type:l.type,size:l.size,ctime:l.ctime,mtime:l.mtime,uri:l.path}}))}}async getUri(n){const a=this.getPath(n.directory,n.path);let o=await this.dbRequest("get",[a]);return o===void 0&&(o=await this.dbRequest("get",[a+"/"])),{uri:(o==null?void 0:o.path)||a}}async stat(n){const a=this.getPath(n.directory,n.path);let o=await this.dbRequest("get",[a]);if(o===void 0&&(o=await this.dbRequest("get",[a+"/"])),o===void 0)throw Error("Entry does not exist.");return{name:o.path.substring(a.length+1),type:o.type,size:o.size,ctime:o.ctime,mtime:o.mtime,uri:o.path}}async rename(n){await this._copy(n,!0)}async copy(n){return this._copy(n,!1)}async requestPermissions(){return{publicStorage:"granted"}}async checkPermissions(){return{publicStorage:"granted"}}async _copy(n,a=!1){let{toDirectory:o}=n;const{to:r,from:i,directory:s}=n;if(!r||!i)throw Error("Both to and from must be provided");o||(o=s);const l=this.getPath(s,i),d=this.getPath(o,r);if(l===d)return{uri:d};if(Dx(l,d))throw Error("To path cannot contain the from path");let u;try{u=await this.stat({path:r,directory:o})}catch{const m=r.split("/");m.pop();const p=m.join("/");if(m.length>0&&(await this.stat({path:p,directory:o})).type!=="directory")throw new Error("Parent directory of the to path is a file")}if(u&&u.type==="directory")throw new Error("Cannot overwrite a directory with a file");const c=await this.stat({path:i,directory:s}),h=async(g,m,p)=>{const y=this.getPath(o,g),k=await this.dbRequest("get",[y]);k.ctime=m,k.mtime=p,await this.dbRequest("put",[k])},f=c.ctime?c.ctime:Date.now();switch(c.type){case"file":{const g=await this.readFile({path:i,directory:s});a&&await this.deleteFile({path:i,directory:s});let m;!(g.data instanceof Blob)&&!this.isBase64String(g.data)&&(m=ro.UTF8);const p=await this.writeFile({path:r,directory:o,data:g.data,encoding:m});return a&&await h(r,f,c.mtime),p}case"directory":{if(u)throw Error("Cannot move a directory over an existing object");try{await this.mkdir({path:r,directory:o,recursive:!1}),a&&await h(r,f,c.mtime)}catch{}const g=(await this.readdir({path:i,directory:s})).files;for(const m of g)await this._copy({from:`${i}/${m.name}`,to:`${r}/${m.name}`,directory:s,toDirectory:o},a);a&&await this.rmdir({path:i,directory:s})}}return{uri:d}}isBase64String(n){try{return btoa(atob(n))==n}catch{return!1}}}la._debug=!0;const Fx=Object.freeze(Object.defineProperty({__proto__:null,FilesystemWeb:la},Symbol.toStringTag,{value:"Module"}));et.attLibAttendants=ki,et.attLibDeparts=yi,et.attLibInstances=xi,et.default=dx,et.getWithContrastColor=wi,et.setupLibrary=bi,et.useScheduledStore=mr,Object.defineProperties(et,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|