1"use strict";(self.webpackChunkall_voiced=self.webpackChunkall_voiced||[]).push([[3210],{3210:(e,a,l)=>{l.r(a),l.d(a,{default:()=>d});var s=l(2791),t=l(4194),o=l(8494),n=l(9924),i=l(7783),r=l(9511),c=l(184);function d(){const e=(0,r.Z)(),[a,l]=(0,s.useState)(0);return(0,c.jsx)(t.Z,{contextControls:(0,c.jsx)(n.Z,{}),children:(0,c.jsx)(o.Z,{ToolParent:i.Z,toolName:"CAPE-V",activityTitleKey:"cape_v",useRandomSample:!1,onReset:()=>{l((e=>e+1))},showResetAction:!1,toolProps:{capevAdaptationId:e},citationProps:{capevAdaptationId:e}},a)})}},8494:(e,a,l)=>{l.d(a,{Z:()=>j});var s=l(2791),t=l(9230),o=l(1675),n=l(3525),i=l(836),r=l(1157),c=l(7615),d=l(9367),p=l(2141),m=l(8114),u=l(1814),h=l(4266),v=l(184);const j=function(e){let{ToolParent:a,toolName:l,activityTitleKey:j=null,useRandomSample:x=!1,onReset:g,showResetAction:f=!0,toolProps:b={},citationProps:_={}}=e;const{t:N}=(0,t.$G)(),y="CAPE-V"===l&&null!==_&&void 0!==_&&_.capevAdaptationId?u.Z.getFixedT((0,h.k3)(_.capevAdaptationId).i18nKey):N,{user:Z}=(0,r.aC)(),R=(null===Z||void 0===Z?void 0:Z.role)||"guest",C="https://api.all-voiced.com/api",S=(0,m.Z)(),[k,P]=(0,s.useState)(null),A="6821a3cb6dbf21c7d84eb717",{voiceDatabase:$,voiceCollection:w}=(0,d.Z)(C,"67b7575a6c7397bd463488d9",A),{samples:I,loading:T,error:U}=(0,p.Z)(A,C);(0,s.useEffect)((()=>{if(x&&I.length>0){const e=Math.floor(Math.random()*I.length);P(I[e]),S()}}),[x,I,S]);const E=()=>{P(null),S(),g&&g()};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(n.Z,{pageName:`${l}_${x?"Random":"Select"}`}),x?T?(0,v.jsx)("p",{children:y("loading_random_sample","Loading random sample...")}):U?(0,v.jsx)("p",{style:{color:"red"},children:U}):k?(0,v.jsx)(a,{selectedSample:k,userRole:R,useCase:"training",onReset:E,...b}):(0,v.jsx)("p",{children:y("no_sample_available","No random sample available.")}):(0,v.jsx)("div",{children:k?(0,v.jsx)(a,{selectedSample:k,userRole:R,useCase:"training",onReset:E,...b}):(0,v.jsxs)("div",{className:"sample-loader-container",children:[(0,v.jsx)("h1",{className:j?"os-hierarchy__activity-title":void 0,children:j?y(j):l}),(0,v.jsx)("h2",{className:j?"os-hierarchy__view-title os-hierarchy__mode-title":void 0,children:y("select_a_sample_yourself")}),(0,v.jsx)(c.Z,{apiUrl:C,mode:"manual",sampleCollectionId:A,labelT:y,onSampleSelected:e=>{P(e),S()}})]})}),f?(0,v.jsx)("div",{className:"app-btn-container",children:(0,v.jsx)("button",{onClick:E,className:"app-btn app-btn-link",children:y("reset","Reset")})}):null,(0,v.jsx)(o.Z,{toolName:l,voiceDatabase:$,voiceCollection:w,..._}),(0,v.jsx)(i.Z,{pageName:`${l}_${x?"Random":"Select"}`})]})}},5347:(e,a,l)=>{l.d(a,{Z:()=>i});var s=l(2791),t=l(9230),o=l(4846),n=l(184);const i=e=>{let{onFileUpload:a,labelT:l=null}=e;const{t:i}=(0,t.$G)(),r=l||i,[c,d]=(0,s.useState)(null),p=(0,s.useRef)(null);return(0,s.useEffect)((()=>{const e=p.current;return()=>{e&&(e.pause(),e.src="")}}),[c]),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"app-btn-container",children:(0,n.jsx)("input",{className:"app-btn app-btn-primary",type:"file",accept:"audio/*",onChange:e=>{if(e.target.files&&e.target.files.length>0){const l=e.target.files[0];if(l.type.startsWith("audio/")){const e=URL.createObjectURL(l);d(e),a({file:l,sampleLink:e,identificationData:{voiceDatabaseId:{databaseName:"upload"}}})}else console.error("File is not an audio type:",l.type)}else console.error("No file selected")}})}),(0,n.jsxs)("div",{className:"warning-message",children:[(0,n.jsx)(o.Z,{icon:"info",size:20,color:"#209385"}),r("local_storage_notice")]}),c&&(0,n.jsx)("div",{className:"app-btn-container",children:(0,n.jsxs)("audio",{ref:p,controls:!0,children:[(0,n.jsx)("source",{src:c,type:"audio/mpeg"}),"Your browser does not support the audio element."]})})]})}},7615:(e,a,l)=>{l.d(a,{Z:()=>c});var s=l(2791),t=l(9230),o=l(2141),n=l(5347);const i=e=>{let{samples:a,onPick:l}=e;const t=(0,s.useMemo)((()=>{if(!a||0===a.length)return null;const e=(new Date).toISOString().slice(0,10),l=Array.from(e).reduce(((e,a)=>e+a.charCodeAt(0)),0),s=a[l%a.length];return console.log("\ud83c\udfaf Mostra del dia generada:",s),s}
1),[a]);return(0,s.useEffect)((()=>{t?(console.log("\ud83d\udce4 Enviant mostra al pare:",t),l(t)):console.warn("\u26a0\ufe0f No s'ha pogut seleccionar cap mostra per avui.")}),[t,l]),null};var r=l(184);const c=e=>{let{apiUrl:a,mode:l,sampleCollectionId:c,onSampleSelected:d,labelT:p=null}=e;const{t:m}=(0,t.$G)(),u=p||m,{samples:h,loading:v,error:j}=(0,o.Z)(c,a),[x,g]=(0,s.useState)(null),f=(0,s.useMemo)((()=>h.filter((e=>{var a;return null===(a=e.visibility)||void 0===a?void 0:a.isPublic})).sort(((e,a)=>(e.sampleName||"").localeCompare(a.sampleName||"")))),[h]);(0,s.useEffect)((()=>{if("random"===l&&!x&&f.length>0){const e=Math.floor(Math.random()*f.length),a=f[e];g(a),d(a)}}),[l,x,d,f]);return"daily"===l?(0,r.jsx)(i,{samples:f,onPick:d}):(0,r.jsxs)("div",{children:[v&&(0,r.jsx)("p",{children:u("loading_samples")}),j&&(0,r.jsxs)("p",{style:{color:"red"},children:[u("error_loading_samples"),": ",j]}),"manual"===l&&f.length>0&&(0,r.jsxs)("select",{className:"app-select",onChange:e=>(e=>{const a=f[e]||null;g(a),d(a)})(parseInt(e.target.value,10)),children:[(0,r.jsx)("option",{value:"",children:u("select_a_sample")}),f.map(((e,a)=>(0,r.jsx)("option",{value:a,children:e.sampleName||`${u("sample")} ${a+1}`},e._id)))]}),"upload"===l&&(0,r.jsx)(n.Z,{onFileUpload:e=>{const a=e.name.replace(/\.[^/.]+$/,""),l=URL.createObjectURL(e);d({sampleLink:l,sampleName:a})},labelT:u})]})}}}]); 2//# sourceMappingURL=3210.7b49713f.chunk.js.map
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.