1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7022],{2626:function(e,t,n){n.d(t,{X:function(){return l}});var i=n(7437);n(2265);var a=n(3799),r=n(8556);function l(e){let{text:t}=e,n=(0,a.E)(),l=t.trim().length,u=Math.max(0,l-r.pk),o=e=>e.toLocaleString(n.locale);return(0,i.jsxs)("div",{className:"reanalysis-paste-count"+(u>0?" is-over":""),children:[u>0?(0,i.jsx)("span",{className:"reanalysis-paste-note",children:n.fmt.menuTextTooLong(o(u))}):null,(0,i.jsx)("span",{className:"reanalysis-paste-num",children:n.fmt.menuTextCount(o(l),o(r.pk))})]})}},8556:function(e,t,n){n.d(t,{Bo:function(){return p},Ck:function(){return a},Cw:function(){return w},Gu:function(){return y},Oo:function(){return s},Q$:function(){return l},U2:function(){return h},X2:function(){return f},XU:function(){return v},eR:function(){return b},fD:function(){return g},mc:function(){return o},o0:function(){return m},pk:function(){return i.pk},xD:function(){return d},xq:function(){return x}});var i=n(9512);let a="image/*,.pdf,.xls,.xlsx,.docx",r=["pdf","docx","xls","xlsx","jpg","jpeg","png","webp"];function l(e){return Number.isFinite(e.stdDev)&&Number.isFinite(e.mean)&&!(e.stdDev>8)?e.mean<=40?"dark":e.mean>=225?"bright":"flat":null}function u(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function o(e,t){return e.startsWith("image/")||["jpg","jpeg","png","gif","webp"].includes(u(t))?"image":"file"}function s(e){return e.type.startsWith("image/")||r.includes(u(e.name))?e.size>52428800?{ok:!1,reason:"size"}:{ok:!0}:{ok:!1,reason:"type"}}function m(e,t,n){return!(!t||"image.jpg"!==e.name.toLowerCase()||Math.abs(n-e.lastModified)>12e4)&&!t.make&&!t.model&&!t.dateTimeOriginal}async function d(e){try{let t=new DataView(await e.slice(0,262144).arrayBuffer());if(t.byteLength<4||65496!==t.getUint16(0))return null;let n=2;for(;n+10<=t.byteLength;){let e=t.getUint16(n);if((65280&e)!=65280||65498===e)break;if(65505===e&&1165519206===t.getUint32(n+4))return function(e,t){let n=18761===e.getUint16(t),i=t=>e.getUint16(t,n),a=t=>e.getUint32(t,n),r=n=>{let i=a(n+4),r=i>4?t+a(n+8):n+8,l="";for(let t=0;t<i;t++){let n=e.getUint8(r+t);if(!n)break;l+=String.fromCharCode(n)}return l.trim()},l=e=>Array.from({length:i(e)},(t,n)=>e+2+12*n),u={},o=0;for(let e of l(t+a(t+4))){let t=i(e),n=271===t||272===t?r(e):"";271===t&&n?u.make=n:272===t&&n?u.model=n:34665===t&&(o=a(e+8))}if(o)for(let e of l(t+o)){let t=36867===i(e)?r(e):"";t&&(u.dateTimeOriginal=t)}return u}(t,n+10);n+=2+t.getUint16(n+2)}return{}}catch(e){return null}}let c={"image/png":"png","image/jpeg":"jpg","image/webp":"webp"};function f(e){let t=e.name.trim();if(t&&r.includes(u(t)))return t;let n=c[e.type.trim().toLowerCase()];return n?"pasted-image.".concat(n):null}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+t<=30}function g(e,t){return e.filter(e=>e.id!==t)}function h(e,t,n){if(t===n||t<0||n<0||t>=e.length||n>=e.length)return e;let i=e.slice(),[a]=i.splice(t,1);return i.splice(n,0,a),i}function v(e,t){if(!e)return null;if("existing"===e.kind){var n;if(!e.menuId)return null;let t=null===(n=e.name)||void 0===n?void 0:n.trim();return t?{menuId:e.menuId,menuName:t}:{menuId:e.menuId}}let i=e.name.trim();return i?{newMenu:{name:i,...t?{allowDuplicateName:!0}:{}}}:null}function b(e,t){if("none"===e||"custom"===e)return null;let n=new Date(t.getFullYear(),t.getMonth(),t.getDate());if("1w"===e)n.setDate(n.getDate()+7);else{let t=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+("1m"===e?1:3));let i=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();n.setDate(Math.min(t,i))}let i=e=>String(e).padStart(2,"0");return"".concat(n.getFullYear(),"-").concat(i(n.getMonth()+1),"-").concat(i(n.getDate()))}function y(e,t){var n,i;let a={};if(t.expiresAt&&(a.expiresAt=t.expiresAt),"paste"===e)return{source:"paste",menuText:(null!==(n=t.menuText)&&void 0!==n?n:"").trim(),...t.target,...a};if("upload"===e){let e=(null!==(i=t.pages)&&void 0!==i?i:[]).filter(e=>"done"===e.status&&e.blobName);return{source:"upload",requestId:t.requestId,uploadPages:e.map(e=>({blobName:e.blobName,filename:e.filename,mime:e.mime})),...t.target,...a}}return{source:"public",...t.target,...a}}
1function x(e){return!e.some(e=>"uploading"===e.status)}function w(e){var t,n;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("public"===e)return!0;if("paste"===e){let e=(null!==(t=a.menuText)&&void 0!==t?t:"").trim().length;return e>0&&e<=i.pk}let r=null!==(n=a.pages)&&void 0!==n?n:[],l=r.some(e=>"uploading"===e.status);return r.some(e=>"done"===e.status&&e.blobName)&&!l}},9043:function(e,t,n){n.d(t,{_U:function(){return u},pr:function(){return s}});var i=n(2265),a=n(7855),r=n(3799),l=n(8556);let u={api:(e,t)=>(0,a.h)(e,t),put:(e,t)=>fetch(e,t)};async function o(e){try{var t;let n=await createImageBitmap(e),i=Math.min(1,128/Math.max(n.width,n.height)),a=Math.max(1,Math.round(n.width*i)),r=Math.max(1,Math.round(n.height*i)),l=document.createElement("canvas");l.width=a,l.height=r;let u=l.getContext("2d",{willReadFrequently:!0});if(!u)return null;u.drawImage(n,0,0,a,r),null===(t=n.close)||void 0===t||t.call(n);let{data:o}=u.getImageData(0,0,a,r),s=0,m=0,d=a*r;for(let e=0;e<o.length;e+=4){let t=.2126*o[e]+.7152*o[e+1]+.0722*o[e+2];s+=t,m+=t*t}let c=s/d;return{mean:c,stdDev:Math.sqrt(Math.max(0,m/d-c*c))}}catch(e){return null}}function s(e){var t,n,a,s,m,d;let{partner:c,menus:f,initialDraft:p,menuId:g,onSubmit:h,onClose:v,onSaveDraft:b,requests:y=u}=e,x=(0,r.E)(),[w,k]=(0,i.useState)("upload"),[N,I]=(0,i.useState)(null!==(n=null==p?void 0:p.menuText)&&void 0!==n?n:""),[S,U]=(0,i.useState)(()=>p?{kind:"existing",menuId:p.menuId}:g&&f.some(e=>e.id===g)?{kind:"existing",menuId:g}:f.length?null:{kind:"new",name:""}),[D,T]=(0,i.useState)((null==p?void 0:p.expiresAt)?"custom":"none"),[M,C]=(0,i.useState)(null!==(a=null==p?void 0:p.expiresAt)&&void 0!==a?a:""),[j,q]=(0,i.useState)(()=>{var e,t;return e=()=>crypto.randomUUID(),(null!==(t=null==p?void 0:p.pages)&&void 0!==t?t:[]).map(t=>({id:e(),filename:t.filename,mime:t.mime,kind:(0,l.mc)(t.mime,t.filename),status:"done",blobName:t.blobName}))}),[O,E]=(0,i.useState)(null),[F,L]=(0,i.useState)(null),[A,R]=(0,i.useState)(null),[B,P]=(0,i.useState)(!1),[X,_]=(0,i.useState)(null),[z,J]=(0,i.useState)(!1),[Y,G]=(0,i.useState)(!1),Q=(0,i.useRef)(null!==(s=null==p?void 0:p.requestId)&&void 0!==s?s:null),W=(0,i.useRef)({}),$=(e,t)=>q(n=>n.map(n=>n.id===e?{...n,...t}:n));async function V(e,t){let n=t.type||"application/octet-stream";$(e,{status:"uploading"});try{var i;let a=await y.api("/api/upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:c,filename:t.name,contentType:n,requestId:null!==(i=Q.current)&&void 0!==i?i:void 0,...p?{draft:!0}:{}})});if(!a.ok)throw Error("upload-url "+a.status);let{url:r,blobName:l,requestId:u,contentType:o}=await a.json();u&&(Q.current=u);let s=await y.put(r,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","content-type":o||n},body:t});if(!s.ok)throw Error("put "+s.status);$(e,{status:"done",blobName:l})}catch(t){$(e,{status:"error"})}}async function H(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];E(null);let n=Array.from(e),i=30-j.length;G(!0);try{for(let e of n){let n=(0,l.Oo)(e);if(!n.ok){E("size"===n.reason?x.reanalysisFileTooBig:x.reanalysisFileBadType);continue}if(t&&function(){var e,t;return(null===(e=(t=window).matchMedia)||void 0===e?void 0:e.call(t,"(pointer: coarse)").matches)===!0}()&&(0,l.o0)(e,await (0,l.xD)(e),Date.now())){E(x.reanalysisInMenuPhoto);continue}if(i<=0||!(0,l.Bo)(30-i)){E(x.reanalysisCapReached);break}i-=1;let a=crypto.randomUUID(),r=(0,l.mc)(e.type,e.name),u="image"===r?URL.createObjectURL(e):void 0;W.current[a]=e,q(t=>[...t,{id:a,filename:e.name,mime:e.type||"application/octet-stream",kind:r,status:"uploading",thumbUrl:u}]),"image"===r&&o(e).then(e=>{let t=e?(0,l.Q$)(e):null;t&&q(e=>e.map(e=>e.id===a?{...e,warning:t}:e))}),await V(a,e)}}finally{G(!1)}}async function K(e){let t=e.map(e=>{let t=(0,l.X2)(e);return t?t===e.name?e:new File([e],t,{type:e.type}):null}).filter(e=>null!==e);if(!t.length){E(x.reanalysisFileBadType);return}await H(t)}let Z=(0,l.XU)(S),ee=(null==S?void 0:S.kind)==="existing"?f.find(e=>e.id===S.menuId):void 0,et=!!ee&&!ee.name.trim()&&!(null==S?void 0:null===(t=S.name)||void 0===t?void 0:t.trim()),en=!!Z&&!et&&!B&&(0,l.Cw)(w,{menuText:N,pages:j}
1),ei=(m=new Date,"custom"===D?M||null:(0,l.eR)(D,m)),{seededBlobs:ea,newPages:er}=function(e,t){var n;let i=new Set((null!==(n=null==t?void 0:t.pages)&&void 0!==n?n:[]).map(e=>e.blobName)),a=e.filter(e=>e.blobName&&!i.has(e.blobName));return{seededBlobs:i,newPages:a}}(j,p),el=er.length>0||N.trim()!==(null!==(d=null==p?void 0:p.menuText)&&void 0!==d?d:"").trim(),eu=z&&(Y||!(0,l.xq)(j));async function eo(e){let t=null!=e?e:Z;if(t&&!B){P(!0),_(null);try{var n;let e=await h((0,l.Gu)(w,{menuText:N,requestId:null!==(n=Q.current)&&void 0!==n?n:void 0,pages:j,target:t,expiresAt:ei}));if(e.ok){v();return}if(e.collision){L(e.collision);return}if(e.busy){R(e.busy);return}_(x.reanalysisSubmitFailed)}finally{P(!1)}}}return(0,i.useEffect)(()=>{var e,t,n,i;z&&!Y&&(0,l.xq)(j)&&b&&(b({requestId:(t={requestId:null!==(e=Q.current)&&void 0!==e?e:"",pages:j,choice:S,menuText:N,resolvedExpiry:ei}).requestId,pages:t.pages.filter(e=>"done"===e.status&&e.blobName).map(e=>({blobName:e.blobName,filename:e.filename,mime:e.mime})),...(null===(n=t.choice)||void 0===n?void 0:n.kind)==="existing"?{menuId:t.choice.menuId}:{newMenu:{name:(null===(i=t.choice)||void 0===i?void 0:i.kind)==="new"?t.choice.name.trim():""}},menuText:t.menuText,...t.resolvedExpiry?{expiresAt:t.resolvedExpiry}:{}}),v())},[z,Y,j]),{method:w,setMethod:k,menuText:N,setMenuText:I,choice:S,setChoice:U,expiryPreset:D,setExpiryPreset:T,customExpiry:M,setCustomExpiry:C,resolvedExpiry:ei,pages:j,notice:O,setNotice:E,collision:F,setCollision:L,busy:A,setBusy:R,submitting:B,submitError:X,requestId:Q.current,addFiles:H,addPastedFiles:K,retry:function(e){let t=W.current[e];t&&V(e,t)},remove:function(e){let t=j.find(t=>t.id===e);(null==t?void 0:t.thumbUrl)&&URL.revokeObjectURL(t.thumbUrl),delete W.current[e],q(t=>(0,l.fD)(t,e)),(null==t?void 0:t.blobName)&&y.api("/api/upload-page-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:c,blobName:t.blobName})}).catch(()=>{})},reorder:function(e,t){q(n=>(0,l.U2)(n,e,t))},target:Z,needsName:et,submitEnabled:en,seededBlobs:ea,newPages:er,dirty:el,discardNewAndClose:function(){for(let e of er)e.blobName&&y.api("/api/upload-page-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:c,blobName:e.blobName})}).catch(()=>{});v()},draftWaiting:eu,requestSaveDraft:function(){b&&J(!0)},send:eo,confirmSummary:()=>(function(e,t){var n,i,a;let r=e.pages.filter(e=>"done"===e.status&&e.blobName).length;return{menuName:(null===(n=e.choice)||void 0===n?void 0:n.kind)==="new"?e.choice.name.trim()||t.menuUnnamed:(null===(i=e.menus.find(t=>{var n;return t.id===(null===(n=e.choice)||void 0===n?void 0:n.menuId)}))||void 0===i?void 0:i.name)||t.menuUnnamed,isNewMenu:(null===(a=e.choice)||void 0===a?void 0:a.kind)==="new",source:"paste"===e.method?t.srcPasted:t.fmt.srcNImages(r),expiry:e.resolvedExpiry,pages:r}})({choice:S,menus:f,method:w,pages:j,resolvedExpiry:ei},x)}}}}]);
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.