PageSourceSearch

https://app.nutrio.com.br/build/assets/PatientPhotoPicker-VNk5DnRz.js

js nutrio.com.br collected 2026-09-24 11:09:33 UTC 6,802 bytes, 1 lines download raw bytes

1import{bt as y,bH as z,x as D,aJ as J,o as g,c as $,i as x,b as T,e as c,j as i,bn as w,v as W,w as H,bP as Y,f as Z,aF as q,s as u,Y as U}from"./@vue-Bj2z7V2L.js";import{a as G}from"./axios-j9Xff9LH.js";import{s as Q}from"./ziggy-js-WVgcLQ-B.js";import{K as X}from"./vue-sonner-CfLI2UVm.js";import{S as ee}from"./Spinner-C7UGdGGz.js";/* empty css                                              */import{_ as te}from"./ActionButton-BXcyeNpG.js";import{_ as oe}from"./FloatingPopover-EJ8B-MeZ.js";import{_ as ae}from"./InputText-Bwe1-e5r.js";import{_ as ne}from"./Upload-DeiS8pXf.js";import{_ as se}from"./SocialNetworkIcon-Coqi2D1B.js";import{_ as ie}from"./Button-uMn0xzOD.js";import{x as re,a5 as le,aR as pe,aS as me}from"./@heroicons-DgqJM6UC.js";import"./qs-esm-Darriogh.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./useLayout-CXJ0dlra.js";import"./useTeam-T6uo8fu2.js";import"./@inertiajs-DoFGc54o.js";import"./qs-C7lisP5f.js";import"./side-channel-0QT8aTEN.js";import"./es-errors-QpLItibJ.js";import"./object-inspect-R27-2t9C.js";import"./side-channel-list-CocWUctw.js";import"./side-channel-map-DBT0Yb7_.js";import"./get-intrinsic-DvaXw8cg.js";import"./es-object-atoms-Ditt1eQ6.js";import"./math-intrinsics-Cv-yPkyD.js";import"./gopd-fcd2-aIC.js";import"./es-define-property-bDCdrV83.js";import"./has-symbols-BaUvM3gb.js";import"./get-proto-Bk-W3If8.js";import"./dunder-proto-CbF-aPDJ.js";import"./call-bind-apply-helpers-aHIJBKk7.js";import"./function-bind-BbkWVFrm.js";import"./hasown-C2NEVhna.js";import"./call-bound-C_l59bMG.js";import"./side-channel-weakmap-DeDvWJMQ.js";import"./lodash-es-DM7yqScx.js";import"./laravel-precognition-Bfe19aNu.js";import"./@vueuse-C1Zg_WGw.js";import"./maska-DQcLBnih.js";import"./Label-Cip5d_nD.js";import"./vue-advanced-cropper-DSUdj0ez.js";import"./BaseModal-CaUEqOF6.js";import"./@headlessui-BYOhRzcZ.js";import"./Title-bW-uezpC.js";function j(a){let o=String(a??"").trim();return o=o.replace(/^https?:\/\/(www\.)?instagram\.com\//i,""),o=o.split(/[/?#]/)[0]??"",o=o.replace(/^@+/u,""),o=o.replace(/[^A-Za-z0-9._]/g,""),o.slice(0,30)}function ce(a){const o=j(a);return o===""?"":`@${o}`}const ue={key:0,class:"p-0.5"},fe={class:"flex items-center text-left"},de=["disabled"],ve={class:"flex items-center text-left"},he={class:"text-[15px] font-medium text-zinc-600 dark:text-zinc-300"},ge={key:1,class:"flex items-center gap-1 p-2"},xe=["onKeydown"],ct={__name:"PatientPhotoPicker",props:q({name:{type:String,default:"photo_file"}},{photo:{default:null},photoModifiers:{},photoPath:{default:null},photoPathModifiers:{},photoRemove:{default:!1},photoRemoveModifiers:{}}),emits:["update:photo","update:photoPath","update:photoRemove"],setup(a){const o=y(a,"photo"),b=y(a,"photoPath"),I=y(a,"photoRemove"),n=u(!1),f=u("options"),r=u(""),l=u(!1),R=u(0),_=u(Date.now()),P=u(null),B=`patient-instagram-${Math.random().toString(36).slice(2,8)}`;let p=null,k=!1;const S=U(()=>Math.max(0,Math.ceil((R.value-_.value)/1e3))),d=U(()=>S.value>0);function K(t){R.value=Date.now()+(Number(t)||60)*1e3,_.value=Date.now(),!p&&(p=window.setInterval(()=>{_.value=Date.now(),!d.value&&p&&(window.clearInterval(p),p=null)},1e3))}z(b,(t,e)=>{e!=null&&e.startsWith("blob:")&&e!==t&&URL.revokeObjectURL(e)}),z(n,t=>{t||(f.value="options",r.value="",l.value=!1)}),z(f,async t=>{var e;t==="instagram"&&(await D(),(e=document.getElementById(B))==null||e.focus())});function A(){if(k){k=!1;return}n.value=!n.value}function E(){k=!0,n.value=!1,f.value="options",D(()=>{var t;(t=P.value)==null||t.triggerInput(),n.value=!1})}function L(){f.value="instagram"}function O(){f.value="options",r.value=""}function F(t){r.value=j(t)}J(()=>{p&&window.clearInterval(p)});async function M(){var e,m,C,N;const t=ce(r.value);if(!(!t||l.value||d.value)){l.value=!0;try{const h=await G.post(Q("patients.instagram-photo"),{username:t},{responseType:"blob"}),s=((e=h.headers["content-type"])==null?void 0:e.split(";")[0])||"image/jpeg",v=s==="image/png"?"png":s==="image/webp"?"webp":"jpg",V=new File([h.data],`${r.value}.${v}`,{type:s});o.value=V,b.value=URL.createObjectURL(V),I.value=!1,n.value=!1}catch(h){let s="Não foi possível capturar a foto do Instagram. Tente novamente mais tarde.";if(((m=h.response)==null?void 0:m.data)instanceof Blob)try{const v=JSON.parse(await h.response.data.text());s=v.message||((N=(C=v.errors)==null?void 0:C.username)==null?void 0:N[0])||s,v.retry_after&&K(v.retry_after)}catch{s="Não foi possível capturar a foto do Instagram. Tente novamente mais tarde."}X.error(s)}finally{l.value=!1}}}return(t,e)=>(g(),$(oe,{open:n.value,"onUpdate:open":e[2]||(e[2]=m=>n.value=m),position:"left","close-on-scroll-out":!1,"popover-class":"!rounded-xl !p-0 min-w-[15rem] overflow-hidden"},{trigger:x(()=>[i(ne,{ref_key:"uploadRef",ref:P,modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=m=>o.value=m),name:a.name,"initial-url":b.value,class:"size-20","max-size":2*1024*1024,accept:"image/*",variant:"circle","crop-width":200,"crop-height":200,"open-on-click":!1,onClick:A,onRemove:e[1]||(e[1]=m=>I.value=!0)}
1,{label:x(()=>[Z(t.$slots,"label",{},()=>[i(w(me),{class:"size-8 text-zinc-500 dark:text-zinc-400"})])]),_:3},8,["modelValue","name","initial-url"])]),content:x(()=>[f.value==="options"?(g(),T("div",ue,[c("button",{type:"button",class:"flex w-full cursor-pointer select-none flex-col rounded-lg px-3 py-1.5 text-left transition-colors hover:bg-zinc-50 focus:outline-none dark:hover:bg-zinc-900",onClick:E},[c("div",fe,[i(w(re),{class:"mr-2 size-5 shrink-0 text-zinc-600 dark:text-zinc-300"}),e[3]||(e[3]=c("span",{class:"text-[15px] font-medium text-zinc-600 dark:text-zinc-300"}," Enviar foto ",-1))])]),c("button",{type:"button",class:"flex w-full cursor-pointer select-none flex-col rounded-lg px-3 py-1.5 text-left transition-colors hover:bg-zinc-50 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-zinc-900",disabled:d.value,onClick:L},[c("div",ve,[i(se,{network:"instagram",class:"mr-2 size-4 shrink-0 text-zinc-600 dark:text-zinc-300"}),c("span",he,W(d.value?`Aguarde ${S.value}s`:"Buscar foto pelo Instagram"),1)])],8,de)])):(g(),T("div",ge,[i(te,{"aria-label":"Voltar",onClick:O},{default:x(()=>[i(w(le),{class:"size-5"})]),_:1}),c("div",{onKeydown:H(Y(M,["prevent"]),["enter"])},[i(ae,{id:B,"model-value":r.value,prefix:"@",placeholder:"usuario",autocomplete:"off",spellcheck:"false",autocapitalize:"off",maxlength:"30",disabled:l.value||d.value,"onUpdate:modelValue":F},null,8,["model-value","disabled"])],40,xe),i(ie,{class:"h-9",color:"primary",disabled:l.value||d.value||!r.value,"aria-label":"Buscar foto",onClick:M},{label:x(()=>[l.value?(g(),$(w(ee),{key:0,class:"size-5 animate-spin"})):(g(),$(w(pe),{key:1,class:"size-5"}))]),_:1},8,["disabled"])]))]),_:3},8,["open"]))}};export{ct as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.