1var e=(e,r,n)=>new Promise((t,o)=>{var i=e=>{try{l(n.next(e))}catch(r){o(r)}},a=e=>{try{l(n.throw(e))}catch(r){o(r)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,a);l((n=n.apply(e,r)).next())});import{f as r,n}from"./index-064wTBYr.js";import"./react-vendor-Do6BM2ij.js";import"./amcharts-vendor-BHootuuA.js";import"./pdf-vendor-lib-BZh8gbg-.js";import"./html2canvas-vendor-aB19RaoZ.js";import"./doc-vendor-ppt-DPgCsEbC.js";import"./doc-vendor-excel-DttRKF0n.js";import"./phone-vendor-ByODWvOt.js";import"./pdf-vendor-core-hcP1TG0J.js";import"./popper-vendor-C5VukO4T.js";function t(e){var r;const t=null==e?void 0:e.response,o=null==t?void 0:t.data;if("string"==typeof(null==o?void 0:o.message)&&o.message.trim()){if("Validation Error"===o.message&&o.data&&"object"==typeof o.data){const e=Object.values(o.data).flat().find(e=>"string"==typeof e&&e.trim());if(e)return e}return o.message}if(401===(null==t?void 0:t.status))return"Please sign in again to upload your recording.";if(404===(null==t?void 0:t.status))return"Video Messenger upload is not available on this API server yet.";if(413===(null==t?void 0:t.status))return"Recording is too large for the server. Try a shorter clip or increase PHP upload limits on the API server.";if((null==t?void 0:t.status)>=500){return("string"==typeof(null==(r=null==o?void 0:o.data)?void 0:r.error)?o.data.error:null)||"Server error during upload. Please try again in a few minutes."}if(!t){if("ECONNABORTED"===(null==e?void 0:e.code))return"Upload timed out. Please try again.";if("ERR_NETWORK"===(null==e?void 0:e.code)){const e=`${n.apiUrl.replace(/\/?$/,"/")}video-messenger/upload`;return e?`Could not reach ${e}. Check VITE_API_URL and confirm the admin API is running.`:"Could not reach the API. Set VITE_API_URL in .env to your admin API URL (for example https://admin.example.com/api/v1/)."}return(null==e?void 0:e.message)||"Network error during upload."}return"string"==typeof o&&o.trim()?o.length>280?"Upload failed. Please try again.":o:`Upload failed (${t.status}).`}function o(n,t){return e(this,arguments,function*(e,n,{onProgress:t,signal:o}={}){const{data:i}=yield r.post("video-messenger/upload",e,{headers:{Authorization:`Bearer ${n}`,Accept:"application/json"},onUploadProgress:e=>{e.total&&(null==t||t(e.loaded/e.total))},signal:o,maxBodyLength:1/0,maxContentLength:1/0,timeout:0});return function(e){var r;const n=null!=(r=null==e?void 0:e.data)?r:e,t=(null==n?void 0:n.shareUrl)||(null==n?void 0:n.url)||(null==n?void 0:n.fileUrl)||(null==n?void 0:n.apiShareUrl);if(!t)throw new Error("Upload succeeded but no share URL was returned.");return{shareUrl:t,url:(null==n?void 0:n.url)||t,token:null==n?void 0:n.token,id:null==n?void 0:n.id}}(i)})}function i(r){return e(this,arguments,function*(e,{title:r,durationMs:n,thumbnail:i,accessToken:a,onProgress:l,signal:s}={}){if(!e||0===e.size)throw new Error("Recording is empty.");if(!a)throw new Error("Please sign in to save and share your recording.");const d=new FormData;d.append("video",function(e){var r;const n=(null==(r=e.type)?void 0:r.includes("mp4"))?"mp4":"webm",t="mp4"===n?"video/mp4":"video/webm",o=`recording-${Date.now()}.${n}`;return e instanceof File&&e.type===t&&e.name?e:new File([e],o,{type:t})}(e)),d.append("title",r||`Recording ${(new Date).toLocaleString()}`),n&&d.append("duration_ms",String(Math.round(n)));const u=function(e){return e?e instanceof File?e:new File([e],"thumbnail.jpg",{type:"image/jpeg"}):null}(i);u&&d.append("thumbnail",u);try{return yield o(d,a,{onProgress:l,signal:s})}catch(p){if(!function(e){if(!(null==e?void 0:e.response))return"ERR_NETWORK"===(null==e?void 0:e.code)||"ECONNABORTED"===(null==e?void 0:e.code);const r=e.response.status;return r>=502&&r<=504}(p))throw new Error(t(p));yield(c=1200,new Promise(e=>{setTimeout(e,c)}));try{return yield o(d,a,{onProgress:l,signal:s})}catch(m){throw new Error(t(m))}}var c})}function a(r){return e(this,null,function*(){if(!r)return!1;try{return yield navigator.clipboard.writeText(r),!0}catch(e){const n=document.createElement("textarea");n.value=r,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select();const t=document.execCommand("copy");return document.body.removeChild(n),t}})}export{a as copyTextToClipboard,i as uploadRecordingForShare};
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.