(window.webpackJsonp=window.webpackJsonp||[]).push([[23],{16:function(t,e,n){t.exports=n("spWN")},"3VoG":function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */\n\n.cropper-container {\n direction: ltr;\n font-size: 0;\n line-height: 0;\n position: relative;\n -ms-touch-action: none;\n touch-action: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.cropper-container img {\n display: block;\n height: 100%;\n image-orientation: 0deg;\n max-height: none !important;\n max-width: none !important;\n min-height: 0 !important;\n min-width: 0 !important;\n width: 100%;\n}\n\n.cropper-wrap-box,\n.cropper-canvas,\n.cropper-drag-box,\n.cropper-crop-box,\n.cropper-modal {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.cropper-wrap-box,\n.cropper-canvas {\n overflow: hidden;\n}\n\n.cropper-drag-box {\n background-color: #fff;\n opacity: 0;\n}\n\n.cropper-modal {\n background-color: #000;\n opacity: 0.5;\n}\n\n.cropper-view-box {\n display: block;\n height: 100%;\n outline: 1px solid #39f;\n outline-color: rgba(51, 153, 255, 0.75);\n overflow: hidden;\n width: 100%;\n}\n\n.cropper-dashed {\n border: 0 dashed #eee;\n display: block;\n opacity: 0.5;\n position: absolute;\n}\n\n.cropper-dashed.dashed-h {\n border-bottom-width: 1px;\n border-top-width: 1px;\n height: calc(100% / 3);\n left: 0;\n top: calc(100% / 3);\n width: 100%;\n}\n\n.cropper-dashed.dashed-v {\n border-left-width: 1px;\n border-right-width: 1px;\n height: 100%;\n left: calc(100% / 3);\n top: 0;\n width: calc(100% / 3);\n}\n\n.cropper-center {\n display: block;\n height: 0;\n left: 50%;\n opacity: 0.75;\n position: absolute;\n top: 50%;\n width: 0;\n}\n\n.cropper-center::before,\n.cropper-center::after {\n background-color: #eee;\n content: ' ';\n display: block;\n position: absolute;\n}\n\n.cropper-center::before {\n height: 1px;\n left: -3px;\n top: 0;\n width: 7px;\n}\n\n.cropper-center::after {\n height: 7px;\n left: 0;\n top: -3px;\n width: 1px;\n}\n\n.cropper-face,\n.cropper-line,\n.cropper-point {\n display: block;\n height: 100%;\n opacity: 0.1;\n position: absolute;\n width: 100%;\n}\n\n.cropper-face {\n background-color: #fff;\n left: 0;\n top: 0;\n}\n\n.cropper-line {\n background-color: #39f;\n}\n\n.cropper-line.line-e {\n cursor: ew-resize;\n right: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-n {\n cursor: ns-resize;\n height: 5px;\n left: 0;\n top: -3px;\n}\n\n.cropper-line.line-w {\n cursor: ew-resize;\n left: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-s {\n bottom: -3px;\n cursor: ns-resize;\n height: 5px;\n left: 0;\n}\n\n.cropper-point {\n background-color: #39f;\n height: 5px;\n opacity: 0.75;\n width: 5px;\n}\n\n.cropper-point.point-e {\n cursor: ew-resize;\n margin-top: -3px;\n right: -3px;\n top: 50%;\n}\n\n.cropper-point.point-n {\n cursor: ns-resize;\n left: 50%;\n margin-left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-w {\n cursor: ew-resize;\n left: -3px;\n margin-top: -3px;\n top: 50%;\n}\n\n.cropper-point.point-s {\n bottom: -3px;\n cursor: s-resize;\n left: 50%;\n margin-left: -3px;\n}\n\n.cropper-point.point-ne {\n cursor: nesw-resize;\n right: -3px;\n top: -3px;\n}\n\n.cropper-point.point-nw {\n cursor: nwse-resize;\n left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-sw {\n bottom: -3px;\n cursor: nesw-resize;\n left: -3px;\n}\n\n.cropper-point.point-se {\n bottom: -3px;\n cursor: nwse-resize;\n height: 20px;\n opacity: 1;\n right: -3px;\n width: 20px;\n}\n\n@media (min-width: 768px) {\n .cropper-point.point-se {\n height: 15px;\n width: 15px;\n }\n}\n\n@media (min-width: 992px) {\n .cropper-point.point-se {\n height: 10px;\n width: 10px;\n }\n}\n\n@media (min-width: 1200px) {\n .cropper-point.point-se {\n height: 5px;\n opacity: 0.75;\n width: 5px;\n }\n}\n\n.cropper-point.point-se::before {\n background-color: #39f;\n bottom: -50%;\n content: ' ';\n display: block;\n height: 200%;\n opacity: 0;\n position: absolute;\n right: -50%;\n width: 200%;\n}\n\n.cropper-invisible {\n opacity: 0;\n}\n\n.cropper-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\n}\n\n.cropper-hide {\n display: block;\n height: 0;\n position: absolute;\n width: 0;\n}\n\n.cropper-hidden {\n display: none !important;\n}\n\n.cropper-move {\n cursor: move;\n}\n\n.cropper-crop {\n cursor: crosshair;\n}\n\n.cropper-disabled .cropper-drag-box,\n.cropper-disabled .cropper-face,\n.cropper-disabled .cropper-line,\n.cropper-disabled .cropper-point {\n cursor: not-allowed;\n}\n",""])},"4Toj":function(t,e,n){var i=n("54Wo");t.exports=function(t,e){var n=i(t,e)/1e3;return n>0?Math.floor(n):Math.ceil(n)}},"54Wo":function(t,e,n){var i=n("yNUO");t.exports=function(t,e){var n=i(t),o=i(e);return n.getTime()-o.getTime()}},"6DAA":function(t,e,n){var i=n("kOWh");t.exports=function(){var t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Su","Mo","Tu","We","Th","Fr","Sa"],o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=["AM","PM"],s=["am","pm"],c=["a.m.","p.m."],l={MMM:function(e){return t[e.getMonth()]},MMMM:function(t){return e[t.getMonth()]},dd:function(t){return n[t.getDay()]},ddd:function(t){return o[t.getDay()]},dddd:function(t){return a[t.getDay()]},A:function(t){return t.getHours()/12>=1?r[1]:r[0]},a:function(t){return t.getHours()/12>=1?s[1]:s[0]},aa:function(t){return t.getHours()/12>=1?c[1]:c[0]}};return["M","D","DDD","d","Q","W"].forEach((function(t){l[t+"o"]=function(e,n){return function(t){var e=t%100;if(e>20||e<10)switch(e%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"}(n[t](e))}})),{formatters:l,formattingTokensRegExp:i(l)}}},"9tPo":function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,a=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?t:(o=0===a.indexOf("//")?a:0===a.indexOf("/")?n+a:i+a.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},ABLE:function(t,e,n){var i=n("S31t");"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(i,o);i.locals&&(t.exports=i.locals)},DT56:function(t,e,n){var i=n("yNUO");t.exports=function(t,e){var n=i(t).getTime(),o=i(e).getTime();return no?1:0}},E2P6:function(t,e,n){"use strict";n("ABLE")},F809:function(t,e,n){var i=n("yNUO"),o=n("sunR"),a=n("DT56");t.exports=function(t,e){var n=i(t),r=i(e),s=a(n,r),c=Math.abs(o(n,r));return n.setMonth(n.getMonth()-s*c),s*(c-(a(n,r)===-s))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(r=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),a=i.sources.map((function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(a).concat([o]).join("\n")}var r;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o0?"in "+o:o+" ago":o}}}},NmtT:function(t,e,n){var i=n("yHON"),o=n("yNUO"),a=n("4Toj"),r=n("F809"),s=n("Us+F");t.exports=function(t,e,n){var c=n||{},l=i(t,e),h=c.locale,p=s.distanceInWords.localize;h&&h.distanceInWords&&h.distanceInWords.localize&&(p=h.distanceInWords.localize);var d,u,f={addSuffix:Boolean(c.addSuffix),comparison:l};l>0?(d=o(t),u=o(e)):(d=o(e),u=o(t));var m,g=a(u,d),v=u.getTimezoneOffset()-d.getTimezoneOffset(),b=Math.round(g/60)-v;if(b<2)return c.includeSeconds?g<5?p("lessThanXSeconds",5,f):g<10?p("lessThanXSeconds",10,f):g<20?p("lessThanXSeconds",20,f):g<40?p("halfAMinute",null,f):p(g<60?"lessThanXMinutes":"xMinutes",1,f):0===b?p("lessThanXMinutes",1,f):p("xMinutes",b,f);if(b<45)return p("xMinutes",b,f);if(b<90)return p("aboutXHours",1,f);if(b<1440)return p("aboutXHours",Math.round(b/60),f);if(b<2520)return p("xDays",1,f);if(b<43200)return p("xDays",Math.round(b/1440),f);if(b<86400)return p("aboutXMonths",m=Math.round(b/43200),f);if((m=r(u,d))<12)return p("xMonths",Math.round(b/43200),f);var w=m%12,y=Math.floor(m/12);return w<3?p("aboutXYears",y,f):w<9?p("overXYears",y,f):p("almostXYears",y+1,f)}},S31t:function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,".story-compose-component #lightbox .modal-content[data-v-7779e7d2] {\n background: transparent;\n}\n.story-compose-component[data-v-7779e7d2] ::-moz-placeholder {\n color: #ccc;\n}\n.story-compose-component[data-v-7779e7d2] :-ms-input-placeholder {\n color: #ccc;\n}\n.story-compose-component[data-v-7779e7d2] ::placeholder {\n color: #ccc;\n}\n.story-compose-component .crop-container[data-v-7779e7d2] {\n z-index: 9;\n position: absolute;\n top: 0;\n width: 100%;\n min-height: 100px;\n padding: 15px 30px;\n background: linear-gradient(180deg, rgba(38, 38, 38, 0.8) 0%, rgba(38, 38, 38, 0) 100%);\n}",""])},TP5S:function(t,e,n){"use strict";n.r(e);var i=n("hoI+"),o=n("lcPr"),a=n.n(o);n("YQfW");function r(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=2})).length>=2?this.canPostPoll=!0:this.canPostPoll=!1}},mounted:function(){var t=this;$("body").addClass("bg-black"),this.mediaWatcher(),setTimeout((function(){axios.get("/api/web/stories/v1/profile/"+t.profileId).then((function(e){e.data.length&&(t.stories=e.data[0].nodes.map((function(t){return t.showViewers=!1,t.viewers=[],t}))),t.loaded=!0}))}),400)},methods:{upload:function(){$('.file-input[name="media"]').trigger("click")},mediaWatcher:function(){var t=this;$(document).on("change","#pf-dz",(function(e){t.triggerUpload()}))},triggerUpload:function(){var t=this;t.uploading=!0;var e=document.querySelector("#pf-dz");t.page="uploading",Array.prototype.forEach.call(e.files,(function(e,n){if(t.media&&t.media.length+n>=t.config.uploader.album_limit)return swal("Error","You can only upload "+t.config.uploader.album_limit+" photos per album","error"),t.uploading=!1,void(t.page=2);var i=e.type;if(-1==$.inArray(i,t.mimes))return swal("Invalid File Type","The file you are trying to add is not a valid mime type. Please upload a "+t.mimes+" only.","error"),t.uploading=!1,void(t.page="error");var o=new FormData;o.append("file",e);var a={onUploadProgress:function(e){var n=Math.floor(100*e.loaded/e.total);t.uploadProgress=n}};e.value=null,axios.post("/api/web/stories/v1/add",o,a).then((function(e){t.uploadProgress=100,t.uploading=!1,t.mediaUrl=e.data.media_url,t.mediaId=e.data.media_id,t.mediaType=e.data.media_type,t.page="video"===e.data.media_type?"preview":"crop",e.data.hasOwnProperty("media_duration")&&(t.max_duration=e.data.media_duration)})).catch((function(n){t.uploading=!1,e.value=null;var i=n.response.data.message?n.response.data.message:n.response.data.error?n.response.data.error:"Something went wrong.";swal("Oops!",i,"warning"),t.page="error"})),t.uploadProgress=0})),document.querySelector("#pf-dz").value=""},expiresTimestamp:function(t){return(t=new Date(1e3*t)).toDateString()+" "+t.toLocaleTimeString()},edit:function(){this.page="edit"},showLightbox:function(t){this.lightboxMedia={url:t.src},this.$refs.lightboxModal.show()},deleteStory:function(t,e){var n=this;1==window.confirm("Are you sure you want to delete this Story?")&&axios.delete("/api/web/stories/v1/delete/"+t.id).then((function(t){n.stories.splice(e,1),0==n.stories.length&&(window.location.href="/i/stories/new")}))},navigateTo:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";window.location.href=t},goBack:function(){this.page="landing"},performCrop:function(){var t=this;this.page="cropping";var e=this.$refs.croppa.getData();axios.post("/api/web/stories/v1/crop",{media_id:this.mediaId,width:e.width,height:e.height,x:e.x,y:e.y}).then((function(e){t.page="preview"}))},deleteCurrentStory:function(){var t={id:this.mediaId};this.deleteStory(t),this.page="landing"},shareStoryToFollowers:function(){var t=this;this.canPostPoll?axios.post("/api/web/stories/v1/publish/poll",{question:this.pollQuestion,options:this.pollOptions,can_reply:this.canReply,can_react:this.canReact}).then((function(e){window.location.href="/i/my/story?id="+t.mediaId})):axios.post("/api/web/stories/v1/publish",{media_id:this.mediaId,duration:this.duration,can_reply:this.canReply,can_react:this.canReact}).then((function(e){window.location.href="/i/my/story?id="+t.mediaId}))},viewMyStory:function(){window.location.href="/i/my/story"},toggleShowViewers:function(t){this.stories[t].showViewers=!this.stories[t].showViewers},timeago:function(t){return App.util.format.timeAgo(t)},newPoll:function(){this.page="createPoll"},addOptionInput:function(){this.pollOptions.filter((function(t){return t.length<3})).length||this.pollOptions.push([])},pollPreview:function(){var t=this.pollOptions;r(new Set(this.pollOptions)).length==t.length?this.page="preview":swal("Oops!","You cannot use duplicate poll answers, please remove any duplicates and try again.","error")}}},l=(n("KqzN"),n("E2P6"),n("KHd+")),h=Object(l.a)(c,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"story-compose-component container mt-2 mt-md-5 bg-black"},[n("input",{staticClass:"d-none file-input",attrs:{type:"file",id:"pf-dz",name:"media",accept:t.config.mimes}}),t._v(" "),n("span",{staticClass:"fixed-top text-right m-3 cursor-pointer",on:{click:function(e){return t.navigateTo()}}},[n("i",{staticClass:"fal fa-times-circle fa-2x text-lighter"})]),t._v(" "),t.loaded?n("div",{staticClass:"row"},[n("div",{staticClass:"col-12 col-md-6 offset-md-3 bg-dark rounded-lg px-0"},["landing"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center",staticStyle:{height:"90vh"}},[t._m(0),t._v(" "),n("div",{staticClass:"flex-fill py-4"},[n("p",{staticClass:"text-center lead font-weight-light text-lighter mb-4"},[t._v("Share moments with followers that last 24 hours")]),t._v(" "),n("div",{staticClass:"card w-100 shadow-none bg-transparent"},[n("div",{staticClass:"d-flex"},[n("button",{staticClass:"btn btn-outline-light btn-lg font-weight-bold btn-block rounded-pill my-1",attrs:{type:"button",disabled:t.stories.length>=20},on:{click:function(e){return e.preventDefault(),t.upload()}}},[t._v("\n\t\t\t\t\t\t\t\tAdd to Story\n\t\t\t\t\t\t\t")])]),t._v(" "),t.stories.length>=20?n("p",{staticClass:"font-weight-bold text-muted text-center"},[t._v("\n\t\t\t\t\t\t\tYou have reached the limit for new stories\n\t\t\t\t\t\t")]):t._e(),t._v(" "),n("button",{staticClass:"btn btn-outline-light btn-lg font-weight-bold btn-block rounded-pill my-3",attrs:{type:"button",disabled:0==t.stories.length},on:{click:t.viewMyStory}},[n("span",[t._v("My Story")]),t._v(" "),t.stories.length?n("sup",{staticClass:"ml-2 px-2 text-light bg-danger rounded-pill",staticStyle:{"font-size":"12px","padding-top":"2px","padding-bottom":"3px"}},[t._v(t._s(t.stories.length))]):t._e()])])]),t._v(" "),t._m(1)]):"crop"==t.page?n("div",{staticClass:"d-flex justify-content-center flex-fill",staticStyle:{position:"relative",height:"90vh"}},[n("vue-cropper",{ref:"croppa",staticClass:"w-100 h-100 p-0",attrs:{aspectRatio:t.cropper.aspectRatio,viewMode:3,dragMode:"move",autoCropArea:1,guides:!1,highlight:!1,cropBoxMovable:!1,cropBoxResizable:!1,toggleDragModeOnDblclick:!1,src:t.mediaUrl}}),t._v(" "),n("div",{staticClass:"crop-container"},[n("div",{staticClass:"d-flex justify-content-between align-items-center"},[n("button",{staticClass:"btn btn-outline-muted rounded-pill font-weight-bold px-4",attrs:{type:"button"},on:{click:function(e){return t.deleteCurrentStory()}}},[t._v("\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t")]),t._v(" "),t._m(2),t._v(" "),n("button",{staticClass:"btn btn-outline-light rounded-pill font-weight-bold px-4",attrs:{type:"button"},on:{click:function(e){return t.performCrop()}}},[t._v("\n\t\t\t\t\t\t\tNext\n\t\t\t\t\t\t")])])])],1):"error"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center align-items-center",staticStyle:{height:"90vh"}},[t._m(3),t._v(" "),t._m(4)]):"uploading"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center align-items-center",staticStyle:{height:"90vh"}},[t._m(5)]):"cropping"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center align-items-center",staticStyle:{height:"90vh"}},[t._m(6)]):"preview"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center align-items-center",staticStyle:{height:"90vh"}},[t._m(7),t._v(" "),n("div",{staticClass:"flex-fill"},[n("div",{staticClass:"form-group pb-3"},[n("label",{staticClass:"text-light lead font-weight-bold",attrs:{for:"durationSlider"}},[t._v("Options")]),t._v(" "),n("div",{staticClass:"custom-control custom-checkbox mb-2"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.canReply,expression:"canReply"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"optionReplies"},domProps:{checked:Array.isArray(t.canReply)?t._i(t.canReply,null)>-1:t.canReply},on:{change:function(e){var n=t.canReply,i=e.target,o=!!i.checked;if(Array.isArray(n)){var a=t._i(n,null);i.checked?a<0&&(t.canReply=n.concat([null])):a>-1&&(t.canReply=n.slice(0,a).concat(n.slice(a+1)))}else t.canReply=o}}}),t._v(" "),n("label",{staticClass:"custom-control-label text-light font-weight-lighter",attrs:{for:"optionReplies"}},[t._v("Allow replies")])]),t._v(" "),n("div",{staticClass:"custom-control custom-checkbox mb-2"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.canReact,expression:"canReact"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"formReactions"},domProps:{checked:Array.isArray(t.canReact)?t._i(t.canReact,null)>-1:t.canReact},on:{change:function(e){var n=t.canReact,i=e.target,o=!!i.checked;if(Array.isArray(n)){var a=t._i(n,null);i.checked?a<0&&(t.canReact=n.concat([null])):a>-1&&(t.canReact=n.slice(0,a).concat(n.slice(a+1)))}else t.canReact=o}}}),t._v(" "),n("label",{staticClass:"custom-control-label text-light font-weight-lighter",attrs:{for:"formReactions"}},[t._v("Allow reactions")])])]),t._v(" "),t.canPostPoll?t._e():n("div",{staticClass:"form-group"},["video"==t.mediaType?n("video",{ref:"previewVideo",staticClass:"mb-4 w-100",staticStyle:{"max-height":"200px","object-fit":"contain"}},[n("source",{attrs:{src:t.mediaUrl,type:"video/mp4"}})]):t._e(),t._v(" "),n("label",{staticClass:"text-light lead font-weight-bold",attrs:{for:"durationSlider"}},[t._v("Story Duration")]),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.duration,expression:"duration"}],staticClass:"custom-range",attrs:{type:"range",min:"3",max:t.max_duration,step:"1",id:"durationSlider"},domProps:{value:t.duration},on:{__r:function(e){t.duration=e.target.value}}}),t._v(" "),n("p",{staticClass:"help-text text-center"},[n("span",{staticClass:"text-light"},[t._v(t._s(t.duration)+" seconds")])])])]),t._v(" "),n("div",{staticClass:"flex-fill w-100 px-md-5"},[n("div",{staticClass:"d-flex"},[n("a",{staticClass:"btn btn-outline-muted btn-block font-weight-bold my-3 mr-3 rounded-pill",attrs:{href:"/"},on:{click:function(e){return e.preventDefault(),t.deleteCurrentStory()}}},[t._v("\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t")]),t._v(" "),n("a",{staticClass:"btn btn-primary btn-block font-weight-bold my-3 rounded-pill",attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.shareStoryToFollowers()}}},[t._v("\n\t\t\t\t\t\t\tPost "+t._s(t.canPostPoll?"Poll":"Story")+"\n\t\t\t\t\t\t")])])])]):"edit"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center",staticStyle:{height:"90vh"}},[t._m(8),t._v(" "),n("div",{staticClass:"flex-fill py-4"},[n("p",{staticClass:"lead font-weight-bold text-lighter"},[t._v("My Stories")]),t._v(" "),n("div",{staticClass:"card w-100 shadow-none bg-transparent",staticStyle:{"max-height":"50vh","overflow-y":"scroll"}},[n("div",{staticClass:"list-group"},t._l(t.stories,(function(e,i){return n("div",{staticClass:"list-group-item bg-transparent text-center border-muted text-lighter",attrs:{href:"#"}},[n("div",{staticClass:"media align-items-center"},[n("div",{staticClass:"mr-3 cursor-pointer",on:{click:function(n){return t.showLightbox(e)}}},[n("img",{staticClass:"rounded-circle border",staticStyle:{"object-fit":"cover"},attrs:{src:e.src,width:"40px",height:"40px"}})]),t._v(" "),n("div",{staticClass:"media-body text-left"},[n("p",{staticClass:"mb-0 text-muted font-weight-bold"},[n("span",[t._v(t._s(t.timeago(e.created_at))+" ago")])])]),t._v(" "),n("div",{staticClass:"flex-grow-1 text-right"},[e.viewers.length?n("button",{staticClass:"btn btn-link btn-sm mr-1",on:{click:function(e){return t.toggleShowViewers(i)}}},[n("i",{staticClass:"fal fa-eye fa-lg text-muted"})]):t._e(),t._v(" "),n("button",{staticClass:"btn btn-link btn-sm",on:{click:function(n){return t.deleteStory(e,i)}}},[n("i",{staticClass:"fal fa-trash-alt fa-lg text-muted"})])])]),t._v(" "),e.showViewers&&e.viewers.length?n("div",{staticClass:"m-2 text-left"},[n("p",{staticClass:"font-weight-bold mb-2"},[t._v("Viewed By")]),t._v(" "),t._l(e.viewers,(function(e){return n("div",{staticClass:"d-flex"},[n("img",{staticClass:"rounded-circle mr-2",attrs:{src:"/storage/avatars/default.png",width:"24",height:"24"}}),t._v(" "),n("p",{staticClass:"mb-0 font-weight-bold"},[t._v("viewer.username")])])}))],2):t._e()])})),0)])]),t._v(" "),n("div",{staticClass:"flex-fill text-center"},[n("a",{staticClass:"btn btn-outline-secondary btn-block px-5 font-weight-bold",attrs:{href:"/i/stories/new"},on:{click:function(e){return e.preventDefault(),t.goBack()}}},[t._v("Go back")])])]):"createPoll"==t.page?n("div",{staticClass:"card card-body bg-transparent border-0 shadow-none d-flex justify-content-center",staticStyle:{height:"90vh"}},[t._m(9),t._v(" "),n("div",{staticClass:"flex-fill mt-3"},[n("div",{staticClass:"align-items-center"},[n("div",{staticClass:"form-group mb-5"},[n("label",{staticClass:"font-weight-bold text-lighter"},[t._v("Poll Question")]),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.pollQuestion,expression:"pollQuestion"}],staticClass:"form-control form-control-lg rounded-pill bg-muted shadow text-white border-0",attrs:{placeholder:"Ask a poll question here..."},domProps:{value:t.pollQuestion},on:{input:function(e){e.target.composing||(t.pollQuestion=e.target.value)}}})]),t._v(" "),n("label",{staticClass:"font-weight-bold text-lighter"},[t._v("Poll Answers")]),t._v(" "),t._l(t.pollOptions,(function(e,i){return n("div",{staticClass:"form-group mb-4"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.pollOptions[i],expression:"pollOptions[index]"}],staticClass:"form-control form-control-lg rounded-pill bg-muted shadow text-white border-0",attrs:{placeholder:"Add a poll answer here..."},domProps:{value:t.pollOptions[i]},on:{input:function(e){e.target.composing||t.$set(t.pollOptions,i,e.target.value)}}})])})),t._v(" "),t.pollOptions.length<4?n("div",{staticClass:"mb-3"},[n("button",{staticClass:"btn btn-block font-weight-bold rounded-pill shadow",class:[(t.pollQuestion&&t.pollQuestion.length)>6&&(0==t.pollOptions.length||t.pollOptions.length&&t.pollOptions[t.pollOptions.length-1].length>3)?"btn-muted":"btn-outline-muted"],attrs:{disabled:!t.pollQuestion||t.pollQuestion.length<6},on:{click:t.addOptionInput}},[t._v("\n\t\t\t\t\t\t\t\tAdd poll option\n\t\t\t\t\t\t\t")])]):t._e()],2)]),t._v(" "),n("div",{staticClass:"flex-fill text-center"},[t.canPostPoll?n("a",{staticClass:"btn btn-outline-light btn-block px-5 font-weight-bold rounded-pill",attrs:{href:"/i/stories/new"},on:{click:function(e){return e.preventDefault(),t.pollPreview.apply(null,arguments)}}},[t._v("Next")]):t._e(),t._v(" "),n("a",{staticClass:"btn btn-outline-secondary btn-block px-5 font-weight-bold rounded-pill",attrs:{href:"/i/stories/new"},on:{click:function(e){return e.preventDefault(),t.goBack()}}},[t._v("Go back")])])]):t._e()])]):n("div",{staticClass:"row"},[t._m(10)]),t._v(" "),n("b-modal",{ref:"lightboxModal",staticClass:"bg-transparent",attrs:{id:"lightbox","hide-header":"","hide-footer":"",centered:"",size:"md","body-class":"p-0 bg-transparent"}},[t.lightboxMedia?n("div",{staticClass:"w-100 h-100 bg-transparent"},[n("img",{staticStyle:{"max-height":"90vh",width:"100%","object-fit":"contain"},attrs:{src:t.lightboxMedia.url}})]):t._e()])],1)}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center flex-fill pt-3"},[e("img",{staticClass:"mb-2",attrs:{src:"/img/pixelfed-icon-color.svg",width:"70",height:"70"}}),this._v(" "),e("p",{staticClass:"lead text-lighter font-weight-light mb-0"},[this._v("Stories")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center flex-fill"},[e("p",{staticClass:"text-uppercase mb-0"},[e("a",{staticClass:"text-lighter font-weight-bold",attrs:{href:"/"}},[this._v("Home")]),this._v(" "),e("span",{staticClass:"px-2 text-lighter"},[this._v("|")]),this._v(" "),e("a",{staticClass:"text-lighter font-weight-bold",attrs:{href:"/site/help"}},[this._v("Help")])]),this._v(" "),e("p",{staticClass:"small text-muted mb-0"},[this._v("v 1.0.0")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center"},[e("h4",{staticClass:"font-weight-light text-light mb-n1"},[this._v("Crop")]),this._v(" "),e("span",{staticClass:"small text-light"},[this._v("Pan around and pinch to zoom")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center flex-fill pt-3"},[e("img",{staticClass:"mb-2",attrs:{src:"/img/pixelfed-icon-color.svg",width:"70",height:"70"}}),this._v(" "),e("p",{staticClass:"lead text-lighter font-weight-light mb-0"},[this._v("Stories")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"flex-fill text-center"},[e("p",{staticClass:"h3 mb-0 text-light"},[this._v("Oops!")]),this._v(" "),e("p",{staticClass:"text-muted lead"},[this._v("An error occurred, please try again later.")]),this._v(" "),e("p",{staticClass:"text-muted mb-0"},[e("a",{staticClass:"btn btn-outline-muted py-0 px-5 rounded-pill font-weight-bold",attrs:{href:"/"}},[this._v("Go back")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"spinner-border text-lighter",attrs:{role:"status"}},[e("span",{staticClass:"sr-only"},[this._v("Loading...")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"spinner-border text-lighter",attrs:{role:"status"}},[e("span",{staticClass:"sr-only"},[this._v("Loading...")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center flex-fill pt-3"},[e("img",{staticClass:"mb-2",attrs:{src:"/img/pixelfed-icon-color.svg",width:"70",height:"70"}}),this._v(" "),e("p",{staticClass:"lead text-lighter font-weight-light mb-0"},[this._v("Stories")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center flex-fill mt-5"},[e("p",{staticClass:"text-muted font-weight-light mb-1"},[e("i",{staticClass:"fal fa-history fa-5x"})]),this._v(" "),e("p",{staticClass:"text-muted font-weight-bold mb-0"},[this._v("STORIES")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center pt-3"},[e("img",{staticClass:"mb-2",attrs:{src:"/img/pixelfed-icon-color.svg",width:"70",height:"70"}}),this._v(" "),e("p",{staticClass:"lead text-lighter font-weight-light mb-0"},[this._v("Stories")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12 col-md-6 offset-md-3 bg-dark rounded-lg px-0",staticStyle:{height:"90vh"}},[e("div",{staticClass:"w-100 h-100 d-flex justify-content-center align-items-center"},[e("div",{staticClass:"spinner-border text-lighter",attrs:{role:"status"}},[e("span",{staticClass:"sr-only"},[this._v("Loading...")])])])])}],!1,null,"7779e7d2",null);e.default=h.exports},UlOV:function(t,e,n){var i=n("hDc5");"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(i,o);i.locals&&(t.exports=i.locals)},"Us+F":function(t,e,n){var i=n("LZbM"),o=n("6DAA");t.exports={distanceInWords:i(),format:o()}},VGX7:function(t,e){t.exports=function(t){var e=new Date(t.getTime()),n=e.getTimezoneOffset();return e.setSeconds(0,0),6e4*n+e.getTime()%6e4}},YQfW:function(t,e,n){var i=n("3VoG");"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(i,o);i.locals&&(t.exports=i.locals)},YlT8:function(t,e,n){var i=n("NmtT");t.exports=function(t,e){return i(Date.now(),t,e)}},"aET+":function(t,e,n){var i,o,a={},r=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(t,e){return e?e.querySelector(t):document.querySelector(t)},c=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var i=s.call(this,t,n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}}(),l=null,h=0,p=[],d=n("9tPo");function u(t,e){for(var n=0;n=0&&p.splice(e,1)}function v(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return n.nc}();i&&(t.attrs.nonce=i)}return b(e,t.attrs),m(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function w(t,e){var n,i,o,a;if(e.transform&&t.css){if(!(a="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=a}if(e.singleton){var r=h++;n=l||(l=v(e)),i=C.bind(null,n,r,!1),o=C.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),m(t,e),e}(e),i=D.bind(null,n,e),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=M.bind(null,n),o=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return u(n,e),function(t){for(var i=[],o=0;o=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(t,["containerStyle","src","alt","imgStyle"])),n={};for(var i in e)void 0!==this[i]&&(n[i]=this[i]);this.cropper=new a.default(this.$refs.img,n)},methods:{reset:function(){return this.cropper.reset()},clear:function(){return this.cropper.clear()},initCrop:function(){return this.cropper.crop()},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(t,e)},enable:function(){return this.cropper.enable()},disable:function(){return this.cropper.disable()},destroy:function(){return this.cropper.destroy()},move:function(t,e){return this.cropper.move(t,e)},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.cropper.moveTo(t,e)},relativeZoom:function(t,e){return this.cropper.zoom(t,e)},zoomTo:function(t,e){return this.cropper.zoomTo(t,e)},rotate:function(t){return this.cropper.rotate(t)},rotateTo:function(t){return this.cropper.rotateTo(t)},scaleX:function(t){return this.cropper.scaleX(t)},scaleY:function(t){return this.cropper.scaleY(t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.cropper.scale(t,e)},getData:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(t)},setData:function(t){return this.cropper.setData(t)},getContainerData:function(){return this.cropper.getContainerData()},getImageData:function(){return this.cropper.getImageData()},getCanvasData:function(){return this.cropper.getCanvasData()},setCanvasData:function(t){return this.cropper.setCanvasData(t)},getCropBoxData:function(){return this.cropper.getCropBoxData()},setCropBoxData:function(t){return this.cropper.setCropBoxData(t)},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(t)},setAspectRatio:function(t){return this.cropper.setAspectRatio(t)},setDragMode:function(t){return this.cropper.setDragMode(t)}}}},pzWd:function(t,e){t.exports=function(t){return t instanceof Date}},spWN:function(t,e,n){Vue.component("story-compose",n("TP5S").default)},sunR:function(t,e,n){var i=n("yNUO");t.exports=function(t,e){var n=i(t),o=i(e);return 12*(n.getFullYear()-o.getFullYear())+(n.getMonth()-o.getMonth())}},urRO:function(t,e,n){t.exports=function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function e(e){for(var n=1;nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n0&&t<1/0};function z(t){return void 0===t}function W(t){return"object"===n(t)&&null!==t}var I=Object.prototype.hasOwnProperty;function U(t){if(!W(t))return!1;try{var e=t.constructor,n=e.prototype;return e&&n&&I.call(n,"isPrototypeOf")}catch(t){return!1}}function j(t){return"function"==typeof t}var H=Array.prototype.slice;function L(t){return Array.from?Array.from(t):H.call(t)}function P(t,e){return t&&j(e)&&(Array.isArray(t)||E(t.length)?L(t).forEach((function(n,i){e.call(t,n,i,t)})):W(t)&&Object.keys(t).forEach((function(n){e.call(t,t[n],n,t)}))),t}var Y=Object.assign||function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i0&&n.forEach((function(e){W(e)&&Object.keys(e).forEach((function(n){t[n]=e[n]}))})),t},X=/\.\d*(?:0|9){12}\d*$/;function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return X.test(t)?Math.round(t*e)/e:t}var F=/^width|height|left|top|marginLeft|marginTop$/;function V(t,e){var n=t.style;P(e,(function(t,e){F.test(e)&&E(t)&&(t="".concat(t,"px")),n[e]=t}))}function Q(t,e){if(e)if(E(t.length))P(t,(function(t){Q(t,e)}));else if(t.classList)t.classList.add(e);else{var n=t.className.trim();n?n.indexOf(e)<0&&(t.className="".concat(n," ").concat(e)):t.className=e}}function q(t,e){e&&(E(t.length)?P(t,(function(t){q(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function G(t,e,n){e&&(E(t.length)?P(t,(function(t){G(t,e,n)})):n?Q(t,e):q(t,e))}var Z=/([a-z\d])([A-Z])/g;function J(t){return t.replace(Z,"$1-$2").toLowerCase()}function K(t,e){return W(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(J(e)))}function tt(t,e,n){W(n)?t[e]=n:t.dataset?t.dataset[e]=n:t.setAttribute("data-".concat(J(e)),n)}var et=/\s\s*/,nt=function(){var t=!1;if(c){var e=!1,n=function(){},i=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});l.addEventListener("test",n,i),l.removeEventListener("test",n,i)}return t}();function it(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n;e.trim().split(et).forEach((function(e){if(!nt){var a=t.listeners;a&&a[e]&&a[e][n]&&(o=a[e][n],delete a[e][n],0===Object.keys(a[e]).length&&delete a[e],0===Object.keys(a).length&&delete t.listeners)}t.removeEventListener(e,o,i)}))}function ot(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n;e.trim().split(et).forEach((function(e){if(i.once&&!nt){var a=t.listeners,r=void 0===a?{}:a;o=function(){delete r[e][n],t.removeEventListener(e,o,i);for(var a=arguments.length,s=new Array(a),c=0;c1&&void 0!==arguments[1]?arguments[1]:"contain",a=N(i),r=N(n);if(a&&r){var s=n*e;"contain"===o&&s>i||"cover"===o&&s=8&&(a=c+h)}}}if(a){var p,d,u=n.getUint16(a,i);for(d=0;d=0?o:200),height:Math.max(n.offsetHeight,a>=0?a:100)};this.containerData=r,V(i,{width:r.width,height:r.height}),Q(t,f),q(i,f)},initCanvas:function(){var t=this.containerData,e=this.imageData,n=this.options.viewMode,i=Math.abs(e.rotate)%180==90,o=i?e.naturalHeight:e.naturalWidth,a=i?e.naturalWidth:e.naturalHeight,r=o/a,s=t.width,c=t.height;t.height*r>t.width?3===n?s=t.height*r:c=t.width/r:3===n?c=t.width/r:s=t.height*r;var l={aspectRatio:r,naturalWidth:o,naturalHeight:a,width:s,height:c};this.canvasData=l,this.limited=1===n||2===n,this.limitCanvas(!0,!0),l.width=Math.min(Math.max(l.width,l.minWidth),l.maxWidth),l.height=Math.min(Math.max(l.height,l.minHeight),l.maxHeight),l.left=(t.width-l.width)/2,l.top=(t.height-l.height)/2,l.oldLeft=l.left,l.oldTop=l.top,this.initialCanvasData=Y({},l)},limitCanvas:function(t,e){var n=this.options,i=this.containerData,o=this.canvasData,a=this.cropBoxData,r=n.viewMode,s=o.aspectRatio,c=this.cropped&&a;if(t){var l=Number(n.minCanvasWidth)||0,h=Number(n.minCanvasHeight)||0;r>1?(l=Math.max(l,i.width),h=Math.max(h,i.height),3===r&&(h*s>l?l=h*s:h=l/s)):r>0&&(l?l=Math.max(l,c?a.width:0):h?h=Math.max(h,c?a.height:0):c&&(l=a.width,(h=a.height)*s>l?l=h*s:h=l/s));var p=ut({aspectRatio:s,width:l,height:h});l=p.width,h=p.height,o.minWidth=l,o.minHeight=h,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(r>(c?0:1)){var d=i.width-o.width,u=i.height-o.height;o.minLeft=Math.min(0,d),o.minTop=Math.min(0,u),o.maxLeft=Math.max(0,d),o.maxTop=Math.max(0,u),c&&this.limited&&(o.minLeft=Math.min(a.left,a.left+(a.width-o.width)),o.minTop=Math.min(a.top,a.top+(a.height-o.height)),o.maxLeft=a.left,o.maxTop=a.top,2===r&&(o.width>=i.width&&(o.minLeft=Math.min(0,d),o.maxLeft=Math.max(0,d)),o.height>=i.height&&(o.minTop=Math.min(0,u),o.maxTop=Math.max(0,u))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=i.width,o.maxTop=i.height},renderCanvas:function(t,e){var n=this.canvasData,i=this.imageData;if(e){var o=function(t){var e=t.width,n=t.height,i=t.degree;if(90==(i=Math.abs(i)%180))return{width:n,height:e};var o=i%90*Math.PI/180,a=Math.sin(o),r=Math.cos(o),s=e*r+n*a,c=e*a+n*r;return i>90?{width:c,height:s}:{width:s,height:c}}({width:i.naturalWidth*Math.abs(i.scaleX||1),height:i.naturalHeight*Math.abs(i.scaleY||1),degree:i.rotate||0}),a=o.width,r=o.height,s=n.width*(a/n.naturalWidth),c=n.height*(r/n.naturalHeight);n.left-=(s-n.width)/2,n.top-=(c-n.height)/2,n.width=s,n.height=c,n.aspectRatio=a/r,n.naturalWidth=a,n.naturalHeight=r,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.widthn.maxHeight||n.heighte.width?o.height=o.width/n:o.width=o.height*n),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*i),o.height=Math.max(o.minHeight,o.height*i),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=Y({},o)},limitCropBox:function(t,e){var n=this.options,i=this.containerData,o=this.canvasData,a=this.cropBoxData,r=this.limited,s=n.aspectRatio;if(t){var c=Number(n.minCropBoxWidth)||0,l=Number(n.minCropBoxHeight)||0,h=r?Math.min(i.width,o.width,o.width+o.left,i.width-o.left):i.width,p=r?Math.min(i.height,o.height,o.height+o.top,i.height-o.top):i.height;c=Math.min(c,i.width),l=Math.min(l,i.height),s&&(c&&l?l*s>c?l=c/s:c=l*s:c?l=c/s:l&&(c=l*s),p*s>h?p=h/s:h=p*s),a.minWidth=Math.min(c,h),a.minHeight=Math.min(l,p),a.maxWidth=h,a.maxHeight=p}e&&(r?(a.minLeft=Math.max(0,o.left),a.minTop=Math.max(0,o.top),a.maxLeft=Math.min(i.width,o.left+o.width)-a.width,a.maxTop=Math.min(i.height,o.top+o.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=i.width-a.width,a.maxTop=i.height-a.height))},renderCropBox:function(){var t=this.options,e=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.widthn.maxHeight||n.height=e.width&&n.height>=e.height?"move":"all"),V(this.cropBox,Y({width:n.width,height:n.height},pt({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),at(this.element,"crop",this.getData())}},wt={initPreview:function(){var t=this.element,e=this.crossOrigin,n=this.options.preview,i=e?this.crossOriginUrl:this.url,o=t.alt||"The image to preview",a=document.createElement("img");if(e&&(a.crossOrigin=e),a.src=i,a.alt=o,this.viewBox.appendChild(a),this.viewBoxImage=a,n){var r=n;"string"==typeof n?r=t.ownerDocument.querySelectorAll(n):n.querySelector&&(r=[n]),this.previews=r,P(r,(function(t){var n=document.createElement("img");tt(t,y,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(n.crossOrigin=e),n.src=i,n.alt=o,n.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(n)}))}},resetPreview:function(){P(this.previews,(function(t){var e=K(t,y);V(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(W(t[e]))try{delete t[e]}catch(n){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(n){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(J(e)))}(t,y)}))},preview:function(){var t=this.imageData,e=this.canvasData,n=this.cropBoxData,i=n.width,o=n.height,a=t.width,r=t.height,s=n.left-e.left-t.left,c=n.top-e.top-t.top;this.cropped&&!this.disabled&&(V(this.viewBoxImage,Y({width:a,height:r},pt(Y({translateX:-s,translateY:-c},t)))),P(this.previews,(function(e){var n=K(e,y),l=n.width,h=n.height,p=l,d=h,u=1;i&&(d=o*(u=l/i)),o&&d>h&&(p=i*(u=h/o),d=h),V(e,{width:p,height:d}),V(e.getElementsByTagName("img")[0],Y({width:a*u,height:r*u},pt(Y({translateX:-s*u,translateY:-c*u},t))))})))}},yt={bind:function(){var t=this.element,e=this.options,n=this.cropper;j(e.cropstart)&&ot(t,"cropstart",e.cropstart),j(e.cropmove)&&ot(t,"cropmove",e.cropmove),j(e.cropend)&&ot(t,"cropend",e.cropend),j(e.crop)&&ot(t,"crop",e.crop),j(e.zoom)&&ot(t,"zoom",e.zoom),ot(n,D,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ot(n,"wheel",this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ot(n,"dblclick",this.onDblclick=this.dblclick.bind(this)),ot(t.ownerDocument,_,this.onCropMove=this.cropMove.bind(this)),ot(t.ownerDocument,S,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ot(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,n=this.cropper;j(e.cropstart)&&it(t,"cropstart",e.cropstart),j(e.cropmove)&&it(t,"cropmove",e.cropmove),j(e.cropend)&&it(t,"cropend",e.cropend),j(e.crop)&&it(t,"crop",e.crop),j(e.zoom)&&it(t,"zoom",e.zoom),it(n,D,this.onCropStart),e.zoomable&&e.zoomOnWheel&&it(n,"wheel",this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&it(n,"dblclick",this.onDblclick),it(t.ownerDocument,_,this.onCropMove),it(t.ownerDocument,S,this.onCropEnd),e.responsive&&it(window,"resize",this.onResize)}},xt={resize:function(){if(!this.disabled){var t,e,n=this.options,i=this.container,o=this.containerData,a=i.offsetWidth/o.width,r=i.offsetHeight/o.height,s=Math.abs(a-1)>Math.abs(r-1)?a:r;1!==s&&(n.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),n.restore&&(this.setCanvasData(P(t,(function(e,n){t[n]=e*s}))),this.setCropBoxData(P(e,(function(t,n){e[n]=t*s})))))}},dblclick:function(){var t,e;this.disabled||"none"===this.options.dragMode||this.setDragMode((t=this.dragBox,e=d,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?"move":"crop"))},wheel:function(t){var e=this,n=Number(this.options.wheelZoomRatio)||.1,i=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?i=t.deltaY>0?1:-1:t.wheelDelta?i=-t.wheelDelta/120:t.detail&&(i=t.detail>0?1:-1),this.zoom(-i*n,t)))},cropStart:function(t){var e=t.buttons,n=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(E(e)&&1!==e||E(n)&&0!==n||t.ctrlKey))){var i,o=this.options,a=this.pointers;t.changedTouches?P(t.changedTouches,(function(t){a[t.identifier]=dt(t)})):a[t.pointerId||0]=dt(t),i=Object.keys(a).length>1&&o.zoomable&&o.zoomOnTouch?"zoom":K(t.target,w),T.test(i)&&!1!==at(this.element,"cropstart",{originalEvent:t,action:i})&&(t.preventDefault(),this.action=i,this.cropping=!1,"crop"===i&&(this.cropping=!0,Q(this.dragBox,v)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var n=this.pointers;t.preventDefault(),!1!==at(this.element,"cropmove",{originalEvent:t,action:e})&&(t.changedTouches?P(t.changedTouches,(function(t){Y(n[t.identifier]||{},dt(t,!0))})):Y(n[t.pointerId||0]||{},dt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,n=this.pointers;t.changedTouches?P(t.changedTouches,(function(t){delete n[t.identifier]})):delete n[t.pointerId||0],e&&(t.preventDefault(),Object.keys(n).length||(this.action=""),this.cropping&&(this.cropping=!1,G(this.dragBox,v,this.cropped&&this.options.modal)),at(this.element,"cropend",{originalEvent:t,action:e}))}}},Ct={change:function(t){var n,i=this.options,o=this.canvasData,a=this.containerData,r=this.cropBoxData,s=this.pointers,c=this.action,l=i.aspectRatio,h=r.left,p=r.top,d=r.width,u=r.height,m=h+d,g=p+u,v=0,b=0,w=a.width,y=a.height,x=!0;!l&&t.shiftKey&&(l=d&&u?d/u:1),this.limited&&(v=r.minLeft,b=r.minTop,w=v+Math.min(a.width,o.width,o.left+o.width),y=b+Math.min(a.height,o.height,o.top+o.height));var C=s[Object.keys(s)[0]],M={x:C.endX-C.startX,y:C.endY-C.startY},D=function(t){switch(t){case"e":m+M.x>w&&(M.x=w-m);break;case"w":h+M.xy&&(M.y=y-g)}};switch(c){case"all":h+=M.x,p+=M.y;break;case"e":if(M.x>=0&&(m>=w||l&&(p<=b||g>=y))){x=!1;break}D("e"),(d+=M.x)<0&&(c="w",h-=d=-d),l&&(u=d/l,p+=(r.height-u)/2);break;case"n":if(M.y<=0&&(p<=b||l&&(h<=v||m>=w))){x=!1;break}D("n"),u-=M.y,p+=M.y,u<0&&(c="s",p-=u=-u),l&&(d=u*l,h+=(r.width-d)/2);break;case"w":if(M.x<=0&&(h<=v||l&&(p<=b||g>=y))){x=!1;break}D("w"),d-=M.x,h+=M.x,d<0&&(c="e",h-=d=-d),l&&(u=d/l,p+=(r.height-u)/2);break;case"s":if(M.y>=0&&(g>=y||l&&(h<=v||m>=w))){x=!1;break}D("s"),(u+=M.y)<0&&(c="n",p-=u=-u),l&&(d=u*l,h+=(r.width-d)/2);break;case"ne":if(l){if(M.y<=0&&(p<=b||m>=w)){x=!1;break}D("n"),u-=M.y,p+=M.y,d=u*l}else D("n"),D("e"),M.x>=0?mb&&(u-=M.y,p+=M.y):(u-=M.y,p+=M.y);d<0&&u<0?(c="sw",p-=u=-u,h-=d=-d):d<0?(c="nw",h-=d=-d):u<0&&(c="se",p-=u=-u);break;case"nw":if(l){if(M.y<=0&&(p<=b||h<=v)){x=!1;break}D("n"),u-=M.y,p+=M.y,d=u*l,h+=r.width-d}else D("n"),D("w"),M.x<=0?h>v?(d-=M.x,h+=M.x):M.y<=0&&p<=b&&(x=!1):(d-=M.x,h+=M.x),M.y<=0?p>b&&(u-=M.y,p+=M.y):(u-=M.y,p+=M.y);d<0&&u<0?(c="se",p-=u=-u,h-=d=-d):d<0?(c="ne",h-=d=-d):u<0&&(c="sw",p-=u=-u);break;case"sw":if(l){if(M.x<=0&&(h<=v||g>=y)){x=!1;break}D("w"),d-=M.x,h+=M.x,u=d/l}else D("s"),D("w"),M.x<=0?h>v?(d-=M.x,h+=M.x):M.y>=0&&g>=y&&(x=!1):(d-=M.x,h+=M.x),M.y>=0?g=0&&(m>=w||g>=y)){x=!1;break}D("e"),u=(d+=M.x)/l}else D("s"),D("e"),M.x>=0?m=0&&g>=y&&(x=!1):d+=M.x,M.y>=0?gMath.abs(i)&&(i=c)}))})),i}(s),t),x=!1;break;case"crop":if(!M.x||!M.y){x=!1;break}n=rt(this.cropper),h=C.startX-n.left,p=C.startY-n.top,d=r.minWidth,u=r.minHeight,M.x>0?c=M.y>0?"se":"ne":M.x<0&&(h-=d,c=M.y>0?"sw":"nw"),M.y<0&&(p-=u),this.cropped||(q(this.cropBox,f),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}x&&(r.width=d,r.height=u,r.left=h,r.top=p,this.action=c,this.renderCropBox()),P(s,(function(t){t.startX=t.endX,t.startY=t.endY}))}},Mt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Q(this.dragBox,v),q(this.cropBox,f),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Y({},this.initialImageData),this.canvasData=Y({},this.initialCanvasData),this.cropBoxData=Y({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Y(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),q(this.dragBox,v),Q(this.cropBox,f)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,P(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,q(this.cropper,u)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Q(this.cropper,u)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.canvasData,i=n.left,o=n.top;return this.moveTo(z(t)?t:i+Number(t),z(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.canvasData,i=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(E(t)&&(n.left=t,i=!0),E(e)&&(n.top=e,i=!0),i&&this.renderCanvas(!0)),this},zoom:function(t,e){var n=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,null,e)},zoomTo:function(t,e,n){var i=this.options,o=this.canvasData,a=o.width,r=o.height,s=o.naturalWidth,c=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&i.zoomable){var l=s*t,h=c*t;if(!1===at(this.element,"zoom",{ratio:t,oldRatio:a/s,originalEvent:n}))return this;if(n){var p=this.pointers,d=rt(this.cropper),u=p&&Object.keys(p).length?function(t){var e=0,n=0,i=0;return P(t,(function(t){var o=t.startX,a=t.startY;e+=o,n+=a,i+=1})),{pageX:e/=i,pageY:n/=i}}(p):{pageX:n.pageX,pageY:n.pageY};o.left-=(l-a)*((u.pageX-d.left-o.left)/a),o.top-=(h-r)*((u.pageY-d.top-o.top)/r)}else U(e)&&E(e.x)&&E(e.y)?(o.left-=(l-a)*((e.x-o.left)/a),o.top-=(h-r)*((e.y-o.top)/r)):(o.left-=(l-a)/2,o.top-=(h-r)/2);o.width=l,o.height=h,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return E(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,E(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(E(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.imageData,i=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(E(t)&&(n.scaleX=t,i=!0),E(e)&&(n.scaleY=e,i=!0),i&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.options,i=this.imageData,o=this.canvasData,a=this.cropBoxData;if(this.ready&&this.cropped){t={x:a.left-o.left,y:a.top-o.top,width:a.width,height:a.height};var r=i.width/i.naturalWidth;if(P(t,(function(e,n){t[n]=e/r})),e){var s=Math.round(t.y+t.height),c=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=c-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return n.rotatable&&(t.rotate=i.rotate||0),n.scalable&&(t.scaleX=i.scaleX||1,t.scaleY=i.scaleY||1),t},setData:function(t){var e=this.options,n=this.imageData,i=this.canvasData,o={};if(this.ready&&!this.disabled&&U(t)){var a=!1;e.rotatable&&E(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,a=!0),e.scalable&&(E(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,a=!0),E(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var r=n.width/n.naturalWidth;E(t.x)&&(o.left=t.x*r+i.left),E(t.y)&&(o.top=t.y*r+i.top),E(t.width)&&(o.width=t.width*r),E(t.height)&&(o.height=t.height*r),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Y({},this.containerData):{}},getImageData:function(){return this.sized?Y({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&P(["left","top","width","height","naturalWidth","naturalHeight"],(function(n){e[n]=t[n]})),e},setCanvasData:function(t){var e=this.canvasData,n=e.aspectRatio;return this.ready&&!this.disabled&&U(t)&&(E(t.left)&&(e.left=t.left),E(t.top)&&(e.top=t.top),E(t.width)?(e.width=t.width,e.height=t.width/n):E(t.height)&&(e.height=t.height,e.width=t.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,n,i=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&U(t)&&(E(t.left)&&(i.left=t.left),E(t.top)&&(i.top=t.top),E(t.width)&&t.width!==i.width&&(e=!0,i.width=t.width),E(t.height)&&t.height!==i.height&&(n=!0,i.height=t.height),o&&(e?i.height=i.width/o:n&&(i.width=i.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,n=ft(this.image,this.imageData,e,t);if(!this.cropped)return n;var i=this.getData(),o=i.x,a=i.y,s=i.width,c=i.height,l=n.width/Math.floor(e.naturalWidth);1!==l&&(o*=l,a*=l,s*=l,c*=l);var h=s/c,p=ut({aspectRatio:h,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=ut({aspectRatio:h,width:t.minWidth||0,height:t.minHeight||0},"cover"),u=ut({aspectRatio:h,width:t.width||(1!==l?n.width:s),height:t.height||(1!==l?n.height:c)}),f=u.width,m=u.height;f=Math.min(p.width,Math.max(d.width,f)),m=Math.min(p.height,Math.max(d.height,m));var g=document.createElement("canvas"),v=g.getContext("2d");g.width=$(f),g.height=$(m),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,f,m);var b=t.imageSmoothingEnabled,w=void 0===b||b,y=t.imageSmoothingQuality;v.imageSmoothingEnabled=w,y&&(v.imageSmoothingQuality=y);var x,C,M,D,_,S,T=n.width,k=n.height,A=o,O=a;A<=-s||A>T?(A=0,x=0,M=0,_=0):A<=0?(M=-A,A=0,_=x=Math.min(T,s+A)):A<=T&&(M=0,_=x=Math.min(s,T-A)),x<=0||O<=-c||O>k?(O=0,C=0,D=0,S=0):O<=0?(D=-O,O=0,S=C=Math.min(k,c+O)):O<=k&&(D=0,S=C=Math.min(c,k-O));var B=[A,O,x,C];if(_>0&&S>0){var R=f/s;B.push(M*R,D*R,_*R,S*R)}return v.drawImage.apply(v,[n].concat(r(B.map((function(t){return Math.floor($(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||z(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,n=this.dragBox,i=this.face;if(this.ready&&!this.disabled){var o="crop"===t,a=e.movable&&"move"===t;t=o||a?t:"none",e.dragMode=t,tt(n,w,t),G(n,d,o),G(n,b,a),e.cropBoxMovable||(tt(i,w,t),G(i,d,o),G(i,b,a))}return this}},Dt=l.Cropper,_t=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this,t),!e||!O.test(e.tagName))throw new Error("The first argument is required and must be an or element.");this.element=e,this.options=Y({},B,U(n)&&n),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,n,a;return e=t,a=[{key:"noConflict",value:function(){return window.Cropper=Dt,t}},{key:"setDefaults",value:function(t){Y(B,U(t)&&t)}}],(n=[{key:"init",value:function(){var t,e=this.element,n=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===n){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===n&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var n=this.element,i=this.options;if(i.rotatable||i.scalable||(i.checkOrientation=!1),i.checkOrientation&&window.ArrayBuffer)if(k.test(t))A.test(t)?this.read((o=t.replace(gt,""),a=atob(o),r=new ArrayBuffer(a.length),P(s=new Uint8Array(r),(function(t,e){s[e]=a.charCodeAt(e)})),r)):this.clone();else{var o,a,r,s,c=new XMLHttpRequest,l=this.clone.bind(this);this.reloading=!0,this.xhr=c,c.onabort=l,c.onerror=l,c.ontimeout=l,c.onprogress=function(){"image/jpeg"!==c.getResponseHeader("content-type")&&c.abort()},c.onload=function(){e.read(c.response)},c.onloadend=function(){e.reloading=!1,e.xhr=null},i.checkCrossOrigin&<(t)&&n.crossOrigin&&(t=ht(t)),c.open("GET",t,!0),c.responseType="arraybuffer",c.withCredentials="use-credentials"===n.crossOrigin,c.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,n=this.imageData,i=vt(t),o=0,a=1,r=1;if(i>1){this.url=function(t,e){for(var n=[],i=new Uint8Array(t);i.length>0;)n.push(mt.apply(null,L(i.subarray(0,8192)))),i=i.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(n.join("")))}(t,"image/jpeg");var s=function(t){var e=0,n=1,i=1;switch(t){case 2:n=-1;break;case 3:e=-180;break;case 4:i=-1;break;case 5:e=90,i=-1;break;case 6:e=90;break;case 7:e=90,n=-1;break;case 8:e=-90}return{rotate:e,scaleX:n,scaleY:i}}(i);o=s.rotate,a=s.scaleX,r=s.scaleY}e.rotatable&&(n.rotate=o),e.scalable&&(n.scaleX=a,n.scaleY=r),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,n=t.crossOrigin,i=e;this.options.checkCrossOrigin&<(e)&&(n||(n="anonymous"),i=ht(e)),this.crossOrigin=n,this.crossOriginUrl=i;var o=document.createElement("img");n&&(o.crossOrigin=n),o.src=i||e,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),Q(o,m),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var n=l.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(l.navigator.userAgent),i=function(e,n){Y(t.imageData,{naturalWidth:e,naturalHeight:n,aspectRatio:e/n}),t.initialImageData=Y({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||n){var o=document.createElement("img"),a=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){i(o.width,o.height),n||a.removeChild(o)},o.src=e.src,n||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",a.appendChild(o))}else i(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,n=this.image,i=t.parentNode,o=document.createElement("div");o.innerHTML='
';var a=o.querySelector(".".concat("cropper","-container")),r=a.querySelector(".".concat("cropper","-canvas")),s=a.querySelector(".".concat("cropper","-drag-box")),c=a.querySelector(".".concat("cropper","-crop-box")),l=c.querySelector(".".concat("cropper","-face"));this.container=i,this.cropper=a,this.canvas=r,this.dragBox=s,this.cropBox=c,this.viewBox=a.querySelector(".".concat("cropper","-view-box")),this.face=l,r.appendChild(n),Q(t,f),i.insertBefore(a,t.nextSibling),this.isImg||q(n,m),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Q(c,f),e.guides||Q(c.getElementsByClassName("".concat("cropper","-dashed")),f),e.center||Q(c.getElementsByClassName("".concat("cropper","-center")),f),e.background&&Q(a,"".concat("cropper","-bg")),e.highlight||Q(l,g),e.cropBoxMovable&&(Q(l,b),tt(l,w,"all")),e.cropBoxResizable||(Q(c.getElementsByClassName("".concat("cropper","-line")),f),Q(c.getElementsByClassName("".concat("cropper","-point")),f)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),j(e.ready)&&ot(t,"ready",e.ready,{once:!0}),at(t,"ready")}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),q(this.element,f))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}])&&o(e.prototype,n),a&&o(e,a),t}();return Y(_t.prototype,bt,wt,yt,xt,Ct,Mt),_t}()},yHON:function(t,e,n){var i=n("yNUO");t.exports=function(t,e){var n=i(t).getTime(),o=i(e).getTime();return n>o?-1:n0&&(k+=N)}return new Date(A+O+k)}return new Date(t)}}},[[16,0]]]);