1"use strict";(self.webpackChunknodebb=self.webpackChunknodebb||[]).push([[16852],{72254(p,g,l){var d,f;d=[l(29930)],f=(function(m){const u={};u.show=function(e,r){const i=e.hasOwnProperty("fileSize")&&e.fileSize!==void 0?parseInt(e.fileSize,10):!1;app.parseAndTranslate("modals/upload-file",{showHelp:e.hasOwnProperty("showHelp")&&e.showHelp!==void 0?e.showHelp:!0,fileSize:i,title:e.title||"[[global:upload-file]]",description:e.description||"",button:e.button||"[[global:upload]]",accept:e.accept?e.accept.replace(/,/g,", "):""},function(o){o.modal("show"),o.on("hidden.bs.modal",function(){o.remove()});const s=o.find("#uploadForm");e.route&&s.attr("action",e.route),o.find("#fileUploadSubmitBtn").on("click",function(){return $(this).addClass("disabled"),e.uploadModal=o,C(e,r),!1})})},u.handleImageCrop=function(e,r){$("#crop-picture-modal").remove(),app.parseAndTranslate("modals/crop_picture",{url:utils.escapeHTML(e.url)},async function(i){i.modal({backdrop:"static"}).modal("show");const o=parseInt($(window).height()/2,10),s=document.getElementById("cropped-image");$(s).css("max-height",o);const c=(await l.e(60239).then(l.t.bind(l,65643,23))).default;let n=new c(s,{aspectRatio:e.aspectRatio,autoCropArea:1,viewMode:1,checkCrossOrigin:!0,cropmove:function(){e.restrictImageDimension&&(n.cropBoxData.width>e.imageDimension&&n.setCropBoxData({width:e.imageDimension}),n.cropBoxData.height>e.imageDimension&&n.setCropBoxData({height:e.imageDimension}))},ready:function(){if(!h(n,e))return i.modal("hide");if(e.restrictImageDimension){const t=s.width<s.height?s.width:s.height,a=t>e.imageDimension?e.imageDimension:t;n.setCropBoxData({width:a,height:a})}i.find(".rotate").on("click",function(){const t=this.getAttribute("data-degrees");n.rotate(t)}),i.find(".flip").on("click",function(){const t=this.getAttribute("data-option");this.getAttribute("data-method")==="scaleX"?n.scaleX(t):n.scaleY(t),this.setAttribute("data-option",t*-1)}),i.find(".reset").on("click",function(){n.reset()}),i.find(".crop-btn").on("click",function(){const t=h(n,e);t&&($(this).addClass("disabled"),i.find("#upload-progress-bar").css("width","0%"),i.find("#upload-progress-box").show().removeClass("hide"),D({data:e,imageData:t,progressBarEl:i.find("#upload-progress-bar")},function(a,b){if(a)return i.find("#upload-progress-box").hide(),i.find(".upload-btn").removeClass("disabled"),i.find(".crop-btn").removeClass("disabled"),m.error(a);r(b.url),i.modal("hide")}))}),i.find(".upload-btn").on("click",async function(){$(this).addClass("disabled"),n.destroy();const t=(await l.e(60239).then(l.t.bind(l,65643,23))).default;n=new t(s,{viewMode:1,autoCropArea:1,ready:function(){i.find(".crop-btn").trigger("click")}})})}})})};function D(e,r){const i={};i[e.data.paramName]=e.data.paramValue,i.method=e.data.socketMethod,i.size=e.imageData.length,i.progress=0;const o=1e5;function s(){const c=e.imageData.slice(i.progress,i.progress+o);socket.emit("uploads.upload",{chunk:c,params:i},function(n,t){if(n)return r(n);if(i.progress+o<i.size)return i.progress+=c.length,e.progressBarEl.css("width",(i.progress/i.size*100).toFixed(2)+"%"),setTimeout(s,100);e.progressBarEl.css("width","100%"),r(null,t)})}s()}function h(e,r){let i;try{const o={};r.restrictImageDimension&&(o.width=r.imageDimension,o.height=r.imageDimension,o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high"),i=r.imageType?e.getCroppedCanvas(o).toDataURL(r.imageType):e.getCroppedCanvas(o).toDataURL()}catch(o){["The operation is insecure.","Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported."].indexOf(o.message)!==-1?m.error("[[error:cors-error]]"):m.error(o.message);return}return i}function C(e,r){function i(t,a){t==="error"&&e.uploadModal.find("#fileUploadSubmitBtn").removeClass("disabled"),e.uploadModal.find("#alert-"+t).translateText(a).removeClass("hide")}const o=e.uploadModal.find("#fileInput");if(!o.val())return i("error","[[uploads:select-file-to-upload]]");const s=o[0].files[0],c=e.hasOwnProperty("fileSize")&&e.fileSize?parseInt(e.fileSize,10):!1;if(c&&s.size>c*1024)return i("error","[[error:file-too-big, "+c+"]]");if(s.name.endsWith(".gif")){l.e(98463).then(function(){var t=[l(24187)];(function(a){a.ajaxSubmit(e.uploadModal,r)}).apply(null,t)}).catch(l.oe);return}const n=new FileReader;n.addEventListener("load",function(){const t=n.result;e.uploadModal.modal("hide"),u.handleImageCrop({url:t,imageType:s.type,socketMethod:e.socketMethod,aspectRatio:e.aspectRatio,allowSkippingCrop:e.allowSkippingCrop,restrictImageDimension:e.restrictImageDimension,imageDimension:e.imageDimension,paramName:e.paramName,paramValue:e.paramValue},r)},!1),s&&n.readAsDataURL(s)}return u}).apply(g,d),f!==void 0&&(p.exports=f)}}]);
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.