Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quikpik

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quikpik - npm Package Compare versions

Comparing version 0.0.30 to 0.0.31

2

dist/quikpik-cjs.js

@@ -1,1 +0,1 @@

var x=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))ee.call(t,o)&&E(e,o,t[o]);return e},q=(e,t)=>J(e,Q(t));var te=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},oe=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Z(t))!A.call(e,n)&&n!==o&&x(e,n,{get:()=>t[n],enumerable:!(r=K(t,n))||r.enumerable});return e};var ne=e=>oe(x({},"__esModule",{value:!0}),e);var xe={};te(xe,{default:()=>_});module.exports=ne(xe);function U(){let e=!1,t,o,r=(i,u)=>{e||(e=!0,i(u))},n=new Promise((i,u)=>{t=i,o=u});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function re(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ie(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let u=t[0],l=re(u)&&u;return n.length&&(i.className=n.join(" ")),ae(l,i),ce(l?t.slice(1):t,i),i}function ae(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function ce(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?se(e,t):(ie(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function se(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var y=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),M=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function N(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function F(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function I(e){return e.name=`your${e.type.replace("/",".")}`,e}function O(e){let t=[],o,r;function n(a){a.data.size>0?t.push(a.data):console.error("No data",a)}function i(){return o}function u(){let a=o.getVideoTracks()[0];return new ImageCapture(a).takePhoto().then(I)}function l(){t=[],r=new MediaRecorder(o,{mimeType:F(e)}),r.ondataavailable=n,r.start()}function p(){return new Promise((a,d)=>{r.onstop=()=>{e.isDisposed()&&d(new Error("Disposed."));try{let s=new Blob(t,{type:F(e)});a(I(s))}catch(s){d(s)}},r.stop()})}return setTimeout(function a(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(a,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(a=>(o=a,{liveSrc:i,capturePhoto:u,beginMediaCapture:l,endMediaCapture:p}))}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=N(r),u=(p,a,d)=>i[p]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(s){s.preventDefault(),n(p)}},a(),d),l=c("label.quik-drop-target.quik-content",{ondragover(p){p.preventDefault(),l.classList.add("quik-drop-target-active")},ondragleave(){l.classList.remove("quik-drop-target-active")},ondrop(p){p.preventDefault(),p.stopPropagation();let a=p.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(p){t(p.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),u("takephoto",y,"Take Photo"),u("takevideo",M,"Record Video"),u("takeaudio",C,"Record Audio"))));return l}function S(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function w(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function W(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function X(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function Y(e,t,o,r){let n=0,i=!1,u=new Image;function l(){let a=o.width;o.width=o.height,o.height=a}function p(a,d,s){if(!d||!i)return;let f=d.getContext("2d");f.translate(d.width/2,d.height/2),f.rotate(s*Math.PI/180),f.drawImage(a,-a.width/2,-a.height/2),f.rotate(-s*Math.PI/180),f.translate(-d.width/2,-d.height/2)}return u.addEventListener("load",()=>{i=!0,o.width=u.width,o.height=u.height,p(u,o,n),r()}),u.addEventListener("error",()=>alert("Failed to load image.")),u.src=e,{save(a="image/png",d=void 0){return n?new Promise(s=>o.toBlob(f=>{f.name=t&&t.name,s(f)},a,d)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),p(u,o,n)}}}var T=32,P=32;function ue(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(u=>{n.toBlob(l=>{l.name=t.name,u(l)},"image/png")})}function de(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function $(e,t){e=L(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,u=e.clientX>o.right-r,l=e.clientY<o.top+n,p=e.clientY>o.bottom-n;return(l?"n":p?"s":"")+(u?"e":i?"w":"")||"move"}function le(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function fe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function B(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function he(e){let t={};return e.direction==="sw"&&e.aspectRatio?B(e):e.direction==="nw"&&e.aspectRatio?(t=B(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,fe(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,me(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,B(e)),e.direction.includes("e")&&Object.assign(t,pe(e))),t)}function ge(e,t,o,r,n){let i=t.getBoundingClientRect(),u=e.clientX,l=e.clientY,p={direction:n,aspectRatio:o,parentBounds:i,bounds:r.getBoundingClientRect(),deltaY:0,deltaX:0,applyEvent(a){a=L(a),p.deltaX=a.clientX-u,p.deltaY=a.clientY-l},resize(a){a.top&&(a.top=a.top-i.top),a.left&&(a.left=a.left-i.left),Object.keys(a).forEach(d=>{r.style[d]=Math.round(a[d])+"px"})}};return p}function D(e,t){let o=de(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let u=$(i,o);o.style.cursor=u==="move"?"grabbing":u+"-resize"}});function n(i){if(i.preventDefault(),i=L(i),r)return;r=!0;let u=$(i,o),l=ge(i,e,t,o,u),p=[];function a(s){l.applyEvent(s),l.resize(u==="move"?le(l):he(l))}function d(){r=!1,p.forEach(s=>s())}p=[h(document,"mousemove",a),h(document,"touchmove",a),h(document,"mouseup",d),h(document,"touchend",d),h(document,"touchcancel",d)]}return{el:o,dispose(){o.remove()},apply(i){return ue({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function ke(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function V(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,u=e.onConfirm,l=e.requireCrop,p=e.cropRatio,a,d=c(".quik-content-wrapper",c(".quik-text","Loading...")),s=c("canvas.quik-confirm-item"),f=c(".quik-content",s),m=Y(t,o,s,()=>{a=l?D(s,p):void 0,d.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){a?(a.dispose(),a=void 0):a=D(s,p)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>a?ke(v,a.apply):v).then(v=>{v.name||(v.name=o.name),u(v)})}},n))),d.firstChild.replaceWith(f)});return d}function H(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,u=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(p){p.target.disabled=!0,u(o)}},n)))}var ve=10;function we(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function be(e,t,o){let r=Date.now(),n=t*60,i=d=>`${Math.floor(d/60)}:${`00${d%60}`.slice(-2)} / ${t}:00`,u,l=c("span.quik-progress-bar",{style:"width: 0%"}),p=c("span.quik-duration",i(0)),a=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),p),c("span.quik-progress-bar-wrapper",l));return u=setTimeout(function d(){let s=Math.floor((Date.now()-r)/1e3);if(p.textContent=i(s),l.style.width=`${Math.floor(s*100/n)}%`,s>=n){o();return}a.isConnected&&setTimeout(d,1e3)},1e3),a}function G(e){let t=e.onPickFiles,o=e.maxDuration||ve,r=e.onCancel,n=e.type,i,u=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),p=c(".quik-media",u,l),a=()=>!p.isConnected,d=s=>u.replaceWith(c("p.quik-error",s.toString()));return O({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:a}).then(s=>{let f=()=>{u.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?s.capturePhoto():s.endMediaCapture()).then(k=>t([k])).catch(d)};u.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&p.insertBefore(we({recorder:s,onPickFiles:t,onError:d}),u),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,f()):(s.beginMediaCapture(),i=be("Recording...",o,f),u.textContent="",p.insertBefore(i,l),m.target.innerHTML="",m.target.append(C(),c("span","Stop recording")))}},n==="takephoto"?y():n==="takeaudio"?C():M(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(d),p}function Ce(e){e=b({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",s=>{(s.key==="Escape"||s.code==="Escape")&&u()}),h(document.body,"paste",s=>{s.clipboardData&&s.clipboardData.files&&s.clipboardData.files.length&&(s.preventDefault(),l(s.clipboardData.files))})],n=q(b({},e),{close:u,uploadFiles:d,onPickFiles:l,beginCaptureMedia:a,promise:o,root:void 0,uploader:void 0});n.root=S(n);function i(){w(n.root,R({onPickFiles:l,beginCaptureMedia:a,accept:n.accept,sources:n.sources}))}function u(){o.resolve(t),n.root.remove(),r.forEach(s=>s()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(s){let f=s.length===1?s[0]:void 0;if(f&&f.type!=="image/gif"&&!f.type.startsWith("image/svg")&&f.type.startsWith("image/")){let m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),w(n.root,V(q(b({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>d([k])})));return}d(s)}function p(s){let f=s[0],m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),w(n.root,H(q(b({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>d([k])})))}function a(s){w(n.root,G({type:s,onPickFiles:s==="takephoto"?l:p,onCancel:i,maxDuration:n.maxDuration}))}function d(s){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:s,onProgress(){}}),n.uploader.promise.then(f=>o.resolve(f)).catch(o.reject);else{let f=W();w(n.root,f),n.uploader=e.upload({files:s,onProgress(m,k){X(f,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(u,250)}).catch(o.reject)}return n.uploader}return o.cancel=u,n}function _(e={}){let t=Ce(e);return document.body.appendChild(t.root),t.promise}
var q=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,Z=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))te.call(t,o)&&E(e,o,t[o]);return e},y=(e,t)=>K(e,Z(t));var oe=(e,t)=>{for(var o in t)q(e,o,{get:t[o],enumerable:!0})},ne=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ee(t))!A.call(e,n)&&n!==o&&q(e,n,{get:()=>t[n],enumerable:!(r=Q(t,n))||r.enumerable});return e};var re=e=>ne(q({},"__esModule",{value:!0}),e);var qe={};oe(qe,{default:()=>J});module.exports=re(qe);function U(){let e=!1,t,o,r=(i,d)=>{e||(e=!0,i(d))},n=new Promise((i,d)=>{t=i,o=d});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function ie(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ae(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let d=t[0],l=ie(d)&&d;return n.length&&(i.className=n.join(" ")),ce(l,i),se(l?t.slice(1):t,i),i}function ce(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function se(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?ue(e,t):(ae(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function ue(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var M=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),x=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function I(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function S(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function F(e){return e.name=`your${e.type.replace("/",".")}`,e}function N(e){let t=[],o,r;function n(s){s.data.size>0?t.push(s.data):console.error("No data",s)}function i(){return o}function d(){let s=o.getVideoTracks()[0];return new ImageCapture(s).takePhoto().then(F)}function l(){t=[],r=new MediaRecorder(o,{mimeType:S(e)}),r.ondataavailable=n,r.start()}function f(){return new Promise((s,u)=>{r.onstop=()=>{e.isDisposed()&&u(new Error("Disposed."));try{let a=new Blob(t,{type:S(e)});s(F(a))}catch(a){u(a)}},r.stop()})}return setTimeout(function s(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(s,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(s=>(o=s,{liveSrc:i,capturePhoto:d,beginMediaCapture:l,endMediaCapture:f}))}function O(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&!e.includes("chrome")}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=I(r),d=O(),l=(u,a,p)=>i[u]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),n(u)}},a(),p),f=()=>{let u=i.takevideo,a=i.takephoto,p=u?"video/*;capture=camcorder":a?"image/*,":"";if(!!p)return c("label.quik-footer-btn.quik-main-footer-btn",C(),u?"Take photo or video":"Take photo",c("input.quik-file-input",{type:"file",accept:p,onchange(m){t(m.target.files)}}))},s=c("label.quik-drop-target.quik-content",{ondragover(u){u.preventDefault(),s.classList.add("quik-drop-target-active")},ondragleave(){s.classList.remove("quik-drop-target-active")},ondrop(u){u.preventDefault(),u.stopPropagation();let a=u.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(u){t(u.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!d&&l("takephoto",M,"Take Photo"),!d&&l("takevideo",C,"Record Video"),d&&f(),l("takeaudio",x,"Record Audio"))));return s}function W(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function b(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function X(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function Y(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function $(e,t,o,r){let n=0,i=!1,d=new Image;function l(){let s=o.width;o.width=o.height,o.height=s}function f(s,u,a){if(!u||!i)return;let p=u.getContext("2d");p.translate(u.width/2,u.height/2),p.rotate(a*Math.PI/180),p.drawImage(s,-s.width/2,-s.height/2),p.rotate(-a*Math.PI/180),p.translate(-u.width/2,-u.height/2)}return d.addEventListener("load",()=>{i=!0,o.width=d.width,o.height=d.height,f(d,o,n),r()}),d.addEventListener("error",()=>alert("Failed to load image.")),d.src=e,{save(s="image/png",u=void 0){return n?new Promise(a=>o.toBlob(p=>{p.name=t&&t.name,a(p)},s,u)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),f(d,o,n)}}}var T=32,P=32;function de(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(d=>{n.toBlob(l=>{l.name=t.name,d(l)},"image/png")})}function le(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function V(e,t){e=L(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,d=e.clientX>o.right-r,l=e.clientY<o.top+n,f=e.clientY>o.bottom-n;return(l?"n":f?"s":"")+(d?"e":i?"w":"")||"move"}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function fe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function B(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function he(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function ge(e){let t={};return e.direction==="sw"&&e.aspectRatio?B(e):e.direction==="nw"&&e.aspectRatio?(t=B(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,me(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,he(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,B(e)),e.direction.includes("e")&&Object.assign(t,fe(e))),t)}function ke(e,t,o,r,n){let i=t.getBoundingClientRect(),d=e.clientX,l=e.clientY,f={direction:n,aspectRatio:o,parentBounds:i,bounds:r.getBoundingClientRect(),deltaY:0,deltaX:0,applyEvent(s){s=L(s),f.deltaX=s.clientX-d,f.deltaY=s.clientY-l},resize(s){s.top&&(s.top=s.top-i.top),s.left&&(s.left=s.left-i.left),Object.keys(s).forEach(u=>{r.style[u]=Math.round(s[u])+"px"})}};return f}function D(e,t){let o=le(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let d=V(i,o);o.style.cursor=d==="move"?"grabbing":d+"-resize"}});function n(i){if(i.preventDefault(),i=L(i),r)return;r=!0;let d=V(i,o),l=ke(i,e,t,o,d),f=[];function s(a){l.applyEvent(a),l.resize(d==="move"?pe(l):ge(l))}function u(){r=!1,f.forEach(a=>a())}f=[h(document,"mousemove",s),h(document,"touchmove",s),h(document,"mouseup",u),h(document,"touchend",u),h(document,"touchcancel",u)]}return{el:o,dispose(){o.remove()},apply(i){return de({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function ve(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function H(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=e.requireCrop,f=e.cropRatio,s,u=c(".quik-content-wrapper",c(".quik-text","Loading...")),a=c("canvas.quik-confirm-item"),p=c(".quik-content",a),m=$(t,o,a,()=>{s=l?D(a,f):void 0,u.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){s?(s.dispose(),s=void 0):s=D(a,f)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>s?ve(v,s.apply):v).then(v=>{v.name||(v.name=o.name),d(v)})}},n))),u.firstChild.replaceWith(p)});return u}function G(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(f){f.target.disabled=!0,d(o)}},n)))}var be=10;function we(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function Ce(e,t,o){let r=Date.now(),n=t*60,i=u=>`${Math.floor(u/60)}:${`00${u%60}`.slice(-2)} / ${t}:00`,d,l=c("span.quik-progress-bar",{style:"width: 0%"}),f=c("span.quik-duration",i(0)),s=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),f),c("span.quik-progress-bar-wrapper",l));return d=setTimeout(function u(){let a=Math.floor((Date.now()-r)/1e3);if(f.textContent=i(a),l.style.width=`${Math.floor(a*100/n)}%`,a>=n){o();return}s.isConnected&&setTimeout(u,1e3)},1e3),s}function _(e){let t=e.onPickFiles,o=e.maxDuration||be,r=e.onCancel,n=e.type,i,d=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),f=c(".quik-media",d,l),s=()=>!f.isConnected,u=a=>d.replaceWith(c("p.quik-error",a.toString()));return N({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:s}).then(a=>{let p=()=>{d.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?a.capturePhoto():a.endMediaCapture()).then(k=>t([k])).catch(u)};d.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&f.insertBefore(we({recorder:a,onPickFiles:t,onError:u}),d),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,p()):(a.beginMediaCapture(),i=Ce("Recording...",o,p),d.textContent="",f.insertBefore(i,l),m.target.innerHTML="",m.target.append(x(),c("span","Stop recording")))}},n==="takephoto"?M():n==="takeaudio"?x():C(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(u),f}function xe(e){e=w({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",a=>{(a.key==="Escape"||a.code==="Escape")&&d()}),h(document.body,"paste",a=>{a.clipboardData&&a.clipboardData.files&&a.clipboardData.files.length&&(a.preventDefault(),l(a.clipboardData.files))})],n=y(w({},e),{close:d,uploadFiles:u,onPickFiles:l,beginCaptureMedia:s,promise:o,root:void 0,uploader:void 0});n.root=W(n);function i(){b(n.root,R({onPickFiles:l,beginCaptureMedia:s,accept:n.accept,sources:n.sources}))}function d(){o.resolve(t),n.root.remove(),r.forEach(a=>a()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(a){let p=a.length===1?a[0]:void 0;if(p&&p.type!=="image/gif"&&!p.type.startsWith("image/svg")&&p.type.startsWith("image/")){let m=URL.createObjectURL(p);r.push(()=>URL.revokeObjectURL(m)),b(n.root,H(y(w({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>u([k])})));return}u(a)}function f(a){let p=a[0],m=URL.createObjectURL(p);r.push(()=>URL.revokeObjectURL(m)),b(n.root,G(y(w({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>u([k])})))}function s(a){b(n.root,_({type:a,onPickFiles:a==="takephoto"?l:f,onCancel:i,maxDuration:n.maxDuration}))}function u(a){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:a,onProgress(){}}),n.uploader.promise.then(p=>o.resolve(p)).catch(o.reject);else{let p=X();b(n.root,p),n.uploader=e.upload({files:a,onProgress(m,k){Y(p,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(d,250)}).catch(o.reject)}return n.uploader}return o.cancel=d,n}function J(e={}){let t=xe(e);return document.body.appendChild(t.root),t.promise}

@@ -1,1 +0,1 @@

var quikpik=(()=>{var x=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))ee.call(t,o)&&E(e,o,t[o]);return e},q=(e,t)=>J(e,Q(t));var te=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},oe=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Z(t))!A.call(e,n)&&n!==o&&x(e,n,{get:()=>t[n],enumerable:!(r=K(t,n))||r.enumerable});return e};var ne=e=>oe(x({},"__esModule",{value:!0}),e);var xe={};te(xe,{default:()=>_});function U(){let e=!1,t,o,r=(i,u)=>{e||(e=!0,i(u))},n=new Promise((i,u)=>{t=i,o=u});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function re(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ie(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let u=t[0],l=re(u)&&u;return n.length&&(i.className=n.join(" ")),ae(l,i),ce(l?t.slice(1):t,i),i}function ae(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function ce(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?se(e,t):(ie(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function se(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var y=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),M=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function N(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function F(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function I(e){return e.name=`your${e.type.replace("/",".")}`,e}function O(e){let t=[],o,r;function n(a){a.data.size>0?t.push(a.data):console.error("No data",a)}function i(){return o}function u(){let a=o.getVideoTracks()[0];return new ImageCapture(a).takePhoto().then(I)}function l(){t=[],r=new MediaRecorder(o,{mimeType:F(e)}),r.ondataavailable=n,r.start()}function p(){return new Promise((a,d)=>{r.onstop=()=>{e.isDisposed()&&d(new Error("Disposed."));try{let s=new Blob(t,{type:F(e)});a(I(s))}catch(s){d(s)}},r.stop()})}return setTimeout(function a(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(a,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(a=>(o=a,{liveSrc:i,capturePhoto:u,beginMediaCapture:l,endMediaCapture:p}))}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=N(r),u=(p,a,d)=>i[p]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(s){s.preventDefault(),n(p)}},a(),d),l=c("label.quik-drop-target.quik-content",{ondragover(p){p.preventDefault(),l.classList.add("quik-drop-target-active")},ondragleave(){l.classList.remove("quik-drop-target-active")},ondrop(p){p.preventDefault(),p.stopPropagation();let a=p.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(p){t(p.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),u("takephoto",y,"Take Photo"),u("takevideo",M,"Record Video"),u("takeaudio",C,"Record Audio"))));return l}function S(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function w(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function W(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function X(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function Y(e,t,o,r){let n=0,i=!1,u=new Image;function l(){let a=o.width;o.width=o.height,o.height=a}function p(a,d,s){if(!d||!i)return;let f=d.getContext("2d");f.translate(d.width/2,d.height/2),f.rotate(s*Math.PI/180),f.drawImage(a,-a.width/2,-a.height/2),f.rotate(-s*Math.PI/180),f.translate(-d.width/2,-d.height/2)}return u.addEventListener("load",()=>{i=!0,o.width=u.width,o.height=u.height,p(u,o,n),r()}),u.addEventListener("error",()=>alert("Failed to load image.")),u.src=e,{save(a="image/png",d=void 0){return n?new Promise(s=>o.toBlob(f=>{f.name=t&&t.name,s(f)},a,d)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),p(u,o,n)}}}var T=32,P=32;function ue(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(u=>{n.toBlob(l=>{l.name=t.name,u(l)},"image/png")})}function de(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function $(e,t){e=L(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,u=e.clientX>o.right-r,l=e.clientY<o.top+n,p=e.clientY>o.bottom-n;return(l?"n":p?"s":"")+(u?"e":i?"w":"")||"move"}function le(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function fe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function B(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function he(e){let t={};return e.direction==="sw"&&e.aspectRatio?B(e):e.direction==="nw"&&e.aspectRatio?(t=B(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,fe(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,me(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,B(e)),e.direction.includes("e")&&Object.assign(t,pe(e))),t)}function ge(e,t,o,r,n){let i=t.getBoundingClientRect(),u=e.clientX,l=e.clientY,p={direction:n,aspectRatio:o,parentBounds:i,bounds:r.getBoundingClientRect(),deltaY:0,deltaX:0,applyEvent(a){a=L(a),p.deltaX=a.clientX-u,p.deltaY=a.clientY-l},resize(a){a.top&&(a.top=a.top-i.top),a.left&&(a.left=a.left-i.left),Object.keys(a).forEach(d=>{r.style[d]=Math.round(a[d])+"px"})}};return p}function D(e,t){let o=de(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let u=$(i,o);o.style.cursor=u==="move"?"grabbing":u+"-resize"}});function n(i){if(i.preventDefault(),i=L(i),r)return;r=!0;let u=$(i,o),l=ge(i,e,t,o,u),p=[];function a(s){l.applyEvent(s),l.resize(u==="move"?le(l):he(l))}function d(){r=!1,p.forEach(s=>s())}p=[h(document,"mousemove",a),h(document,"touchmove",a),h(document,"mouseup",d),h(document,"touchend",d),h(document,"touchcancel",d)]}return{el:o,dispose(){o.remove()},apply(i){return ue({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function ke(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function V(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,u=e.onConfirm,l=e.requireCrop,p=e.cropRatio,a,d=c(".quik-content-wrapper",c(".quik-text","Loading...")),s=c("canvas.quik-confirm-item"),f=c(".quik-content",s),m=Y(t,o,s,()=>{a=l?D(s,p):void 0,d.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){a?(a.dispose(),a=void 0):a=D(s,p)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>a?ke(v,a.apply):v).then(v=>{v.name||(v.name=o.name),u(v)})}},n))),d.firstChild.replaceWith(f)});return d}function H(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,u=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(p){p.target.disabled=!0,u(o)}},n)))}var ve=10;function we(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function be(e,t,o){let r=Date.now(),n=t*60,i=d=>`${Math.floor(d/60)}:${`00${d%60}`.slice(-2)} / ${t}:00`,u,l=c("span.quik-progress-bar",{style:"width: 0%"}),p=c("span.quik-duration",i(0)),a=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),p),c("span.quik-progress-bar-wrapper",l));return u=setTimeout(function d(){let s=Math.floor((Date.now()-r)/1e3);if(p.textContent=i(s),l.style.width=`${Math.floor(s*100/n)}%`,s>=n){o();return}a.isConnected&&setTimeout(d,1e3)},1e3),a}function G(e){let t=e.onPickFiles,o=e.maxDuration||ve,r=e.onCancel,n=e.type,i,u=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),p=c(".quik-media",u,l),a=()=>!p.isConnected,d=s=>u.replaceWith(c("p.quik-error",s.toString()));return O({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:a}).then(s=>{let f=()=>{u.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?s.capturePhoto():s.endMediaCapture()).then(k=>t([k])).catch(d)};u.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&p.insertBefore(we({recorder:s,onPickFiles:t,onError:d}),u),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,f()):(s.beginMediaCapture(),i=be("Recording...",o,f),u.textContent="",p.insertBefore(i,l),m.target.innerHTML="",m.target.append(C(),c("span","Stop recording")))}},n==="takephoto"?y():n==="takeaudio"?C():M(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(d),p}function Ce(e){e=b({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",s=>{(s.key==="Escape"||s.code==="Escape")&&u()}),h(document.body,"paste",s=>{s.clipboardData&&s.clipboardData.files&&s.clipboardData.files.length&&(s.preventDefault(),l(s.clipboardData.files))})],n=q(b({},e),{close:u,uploadFiles:d,onPickFiles:l,beginCaptureMedia:a,promise:o,root:void 0,uploader:void 0});n.root=S(n);function i(){w(n.root,R({onPickFiles:l,beginCaptureMedia:a,accept:n.accept,sources:n.sources}))}function u(){o.resolve(t),n.root.remove(),r.forEach(s=>s()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(s){let f=s.length===1?s[0]:void 0;if(f&&f.type!=="image/gif"&&!f.type.startsWith("image/svg")&&f.type.startsWith("image/")){let m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),w(n.root,V(q(b({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>d([k])})));return}d(s)}function p(s){let f=s[0],m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),w(n.root,H(q(b({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>d([k])})))}function a(s){w(n.root,G({type:s,onPickFiles:s==="takephoto"?l:p,onCancel:i,maxDuration:n.maxDuration}))}function d(s){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:s,onProgress(){}}),n.uploader.promise.then(f=>o.resolve(f)).catch(o.reject);else{let f=W();w(n.root,f),n.uploader=e.upload({files:s,onProgress(m,k){X(f,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(u,250)}).catch(o.reject)}return n.uploader}return o.cancel=u,n}function _(e={}){let t=Ce(e);return document.body.appendChild(t.root),t.promise}return ne(xe);})();
var quikpik=(()=>{var q=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,Z=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))te.call(t,o)&&E(e,o,t[o]);return e},y=(e,t)=>K(e,Z(t));var oe=(e,t)=>{for(var o in t)q(e,o,{get:t[o],enumerable:!0})},ne=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ee(t))!A.call(e,n)&&n!==o&&q(e,n,{get:()=>t[n],enumerable:!(r=Q(t,n))||r.enumerable});return e};var re=e=>ne(q({},"__esModule",{value:!0}),e);var qe={};oe(qe,{default:()=>J});function U(){let e=!1,t,o,r=(i,d)=>{e||(e=!0,i(d))},n=new Promise((i,d)=>{t=i,o=d});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function ie(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ae(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let d=t[0],l=ie(d)&&d;return n.length&&(i.className=n.join(" ")),ce(l,i),se(l?t.slice(1):t,i),i}function ce(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function se(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?ue(e,t):(ae(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function ue(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var M=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),x=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function I(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function S(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function F(e){return e.name=`your${e.type.replace("/",".")}`,e}function N(e){let t=[],o,r;function n(s){s.data.size>0?t.push(s.data):console.error("No data",s)}function i(){return o}function d(){let s=o.getVideoTracks()[0];return new ImageCapture(s).takePhoto().then(F)}function l(){t=[],r=new MediaRecorder(o,{mimeType:S(e)}),r.ondataavailable=n,r.start()}function f(){return new Promise((s,u)=>{r.onstop=()=>{e.isDisposed()&&u(new Error("Disposed."));try{let a=new Blob(t,{type:S(e)});s(F(a))}catch(a){u(a)}},r.stop()})}return setTimeout(function s(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(s,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(s=>(o=s,{liveSrc:i,capturePhoto:d,beginMediaCapture:l,endMediaCapture:f}))}function O(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&!e.includes("chrome")}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=I(r),d=O(),l=(u,a,p)=>i[u]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),n(u)}},a(),p),f=()=>{let u=i.takevideo,a=i.takephoto,p=u?"video/*;capture=camcorder":a?"image/*,":"";if(!!p)return c("label.quik-footer-btn.quik-main-footer-btn",C(),u?"Take photo or video":"Take photo",c("input.quik-file-input",{type:"file",accept:p,onchange(m){t(m.target.files)}}))},s=c("label.quik-drop-target.quik-content",{ondragover(u){u.preventDefault(),s.classList.add("quik-drop-target-active")},ondragleave(){s.classList.remove("quik-drop-target-active")},ondrop(u){u.preventDefault(),u.stopPropagation();let a=u.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(u){t(u.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!d&&l("takephoto",M,"Take Photo"),!d&&l("takevideo",C,"Record Video"),d&&f(),l("takeaudio",x,"Record Audio"))));return s}function W(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function b(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function X(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function Y(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function $(e,t,o,r){let n=0,i=!1,d=new Image;function l(){let s=o.width;o.width=o.height,o.height=s}function f(s,u,a){if(!u||!i)return;let p=u.getContext("2d");p.translate(u.width/2,u.height/2),p.rotate(a*Math.PI/180),p.drawImage(s,-s.width/2,-s.height/2),p.rotate(-a*Math.PI/180),p.translate(-u.width/2,-u.height/2)}return d.addEventListener("load",()=>{i=!0,o.width=d.width,o.height=d.height,f(d,o,n),r()}),d.addEventListener("error",()=>alert("Failed to load image.")),d.src=e,{save(s="image/png",u=void 0){return n?new Promise(a=>o.toBlob(p=>{p.name=t&&t.name,a(p)},s,u)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),f(d,o,n)}}}var T=32,P=32;function de(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(d=>{n.toBlob(l=>{l.name=t.name,d(l)},"image/png")})}function le(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function V(e,t){e=L(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,d=e.clientX>o.right-r,l=e.clientY<o.top+n,f=e.clientY>o.bottom-n;return(l?"n":f?"s":"")+(d?"e":i?"w":"")||"move"}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function fe(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function B(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function he(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function ge(e){let t={};return e.direction==="sw"&&e.aspectRatio?B(e):e.direction==="nw"&&e.aspectRatio?(t=B(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,me(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,he(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,B(e)),e.direction.includes("e")&&Object.assign(t,fe(e))),t)}function ke(e,t,o,r,n){let i=t.getBoundingClientRect(),d=e.clientX,l=e.clientY,f={direction:n,aspectRatio:o,parentBounds:i,bounds:r.getBoundingClientRect(),deltaY:0,deltaX:0,applyEvent(s){s=L(s),f.deltaX=s.clientX-d,f.deltaY=s.clientY-l},resize(s){s.top&&(s.top=s.top-i.top),s.left&&(s.left=s.left-i.left),Object.keys(s).forEach(u=>{r.style[u]=Math.round(s[u])+"px"})}};return f}function D(e,t){let o=le(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let d=V(i,o);o.style.cursor=d==="move"?"grabbing":d+"-resize"}});function n(i){if(i.preventDefault(),i=L(i),r)return;r=!0;let d=V(i,o),l=ke(i,e,t,o,d),f=[];function s(a){l.applyEvent(a),l.resize(d==="move"?pe(l):ge(l))}function u(){r=!1,f.forEach(a=>a())}f=[h(document,"mousemove",s),h(document,"touchmove",s),h(document,"mouseup",u),h(document,"touchend",u),h(document,"touchcancel",u)]}return{el:o,dispose(){o.remove()},apply(i){return de({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function ve(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function H(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=e.requireCrop,f=e.cropRatio,s,u=c(".quik-content-wrapper",c(".quik-text","Loading...")),a=c("canvas.quik-confirm-item"),p=c(".quik-content",a),m=$(t,o,a,()=>{s=l?D(a,f):void 0,u.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){s?(s.dispose(),s=void 0):s=D(a,f)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>s?ve(v,s.apply):v).then(v=>{v.name||(v.name=o.name),d(v)})}},n))),u.firstChild.replaceWith(p)});return u}function G(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(f){f.target.disabled=!0,d(o)}},n)))}var be=10;function we(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function Ce(e,t,o){let r=Date.now(),n=t*60,i=u=>`${Math.floor(u/60)}:${`00${u%60}`.slice(-2)} / ${t}:00`,d,l=c("span.quik-progress-bar",{style:"width: 0%"}),f=c("span.quik-duration",i(0)),s=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),f),c("span.quik-progress-bar-wrapper",l));return d=setTimeout(function u(){let a=Math.floor((Date.now()-r)/1e3);if(f.textContent=i(a),l.style.width=`${Math.floor(a*100/n)}%`,a>=n){o();return}s.isConnected&&setTimeout(u,1e3)},1e3),s}function _(e){let t=e.onPickFiles,o=e.maxDuration||be,r=e.onCancel,n=e.type,i,d=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),f=c(".quik-media",d,l),s=()=>!f.isConnected,u=a=>d.replaceWith(c("p.quik-error",a.toString()));return N({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:s}).then(a=>{let p=()=>{d.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?a.capturePhoto():a.endMediaCapture()).then(k=>t([k])).catch(u)};d.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&f.insertBefore(we({recorder:a,onPickFiles:t,onError:u}),d),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,p()):(a.beginMediaCapture(),i=Ce("Recording...",o,p),d.textContent="",f.insertBefore(i,l),m.target.innerHTML="",m.target.append(x(),c("span","Stop recording")))}},n==="takephoto"?M():n==="takeaudio"?x():C(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(u),f}function xe(e){e=w({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",a=>{(a.key==="Escape"||a.code==="Escape")&&d()}),h(document.body,"paste",a=>{a.clipboardData&&a.clipboardData.files&&a.clipboardData.files.length&&(a.preventDefault(),l(a.clipboardData.files))})],n=y(w({},e),{close:d,uploadFiles:u,onPickFiles:l,beginCaptureMedia:s,promise:o,root:void 0,uploader:void 0});n.root=W(n);function i(){b(n.root,R({onPickFiles:l,beginCaptureMedia:s,accept:n.accept,sources:n.sources}))}function d(){o.resolve(t),n.root.remove(),r.forEach(a=>a()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(a){let p=a.length===1?a[0]:void 0;if(p&&p.type!=="image/gif"&&!p.type.startsWith("image/svg")&&p.type.startsWith("image/")){let m=URL.createObjectURL(p);r.push(()=>URL.revokeObjectURL(m)),b(n.root,H(y(w({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>u([k])})));return}u(a)}function f(a){let p=a[0],m=URL.createObjectURL(p);r.push(()=>URL.revokeObjectURL(m)),b(n.root,G(y(w({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>u([k])})))}function s(a){b(n.root,_({type:a,onPickFiles:a==="takephoto"?l:f,onCancel:i,maxDuration:n.maxDuration}))}function u(a){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:a,onProgress(){}}),n.uploader.promise.then(p=>o.resolve(p)).catch(o.reject);else{let p=X();b(n.root,p),n.uploader=e.upload({files:a,onProgress(m,k){Y(p,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(d,250)}).catch(o.reject)}return n.uploader}return o.cancel=d,n}function J(e={}){let t=xe(e);return document.body.appendChild(t.root),t.promise}return re(qe);})();
{
"name": "quikpik",
"version": "0.0.30",
"version": "0.0.31",
"main": "./dist/quikpik-cjs.js",

@@ -5,0 +5,0 @@ "types": "./types.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc