{"version":3,"sources":["webpack:///../WCC.UI/App/components/attachments/upload/upload.html?d491","webpack:///../WCC.UI/App/components/attachments/upload/upload.scss?768c","webpack:///../WCC.UI/App/components/attachments/upload/upload.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/attachments/upload/upload.scss","webpack:///../WCC.UI/App/components/attachments/upload/upload.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","allowedUploadImageExtensions","allowedUploadImageExtensionsForTopicThreads","allowedUploadVideoExtensions","settings","components","preload","WCCUploadVM","constructor","config","info","layoutFactory","this","upload","ko","flattenComputed","coverConfig","cover","name","pluck","progress","preview","extension","pureComputed","system","getExtension","isImage","mapNotNull","includes","isVideo","icon","strictComputed","undefined","AttachmentsHelpers","getFileIcon","ratio","_","isNumber","layoutConfig","create","layout","theme","controlsConfig","value","expand","src","title","cancel","isCancellable","applyBindingsToNode","element","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","attachmentLayoutFactory","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"6IAAA,UAAO,CACC,6GACA,wDAIC,KAJ4C,EAAF,SAAYA,EAASC,GAG5D,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,0ECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,wJAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,g4BCNnC,MAAM,6BAAEC,EAA4B,4CAAEC,EAA2C,6BAAEC,GAAiCC,EAEpHC,EAAWC,QAAQ,sBAAuB,aAU1C,IAAqBC,EAArB,MAYIC,YACwCC,EACFC,EACUC,GA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4C,EAAA,CAD/BC,cAcQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWG,2BAfNnD,gB,0VCxBrB,WAOC,KAPD,aACI,MAAMiB,EAAS,EAAQ,mCAAkBmC,cAEzC,OAAO,SAAUC,GACbpC,EAAOqC,yBAAyBD,GAC3BE,SAAQ,SAAUC,GAAQC,SAASC,KAAKC,YAAYH,QAEhE,+B,wKCLDhE,EADkC,EAAQ,wDAChCoE,EAA4B,IAE9BC,KAAK,CAACxE,EAAOC,EAAI,ghBAAihB,KAE1iBD,EAAOG,QAAUA,G,wHCHjBH,EAAOG,QAFI","file":"269.79b2a7ea3bf7ae1375e7.js","sourcesContent":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./upload.html\", \n \"!../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./upload.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { CustomElementConfig } from 'extensions/knockout/bindings/customElement';\r\nimport { AttachmentsHelpers } from 'helpers/attachments';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport WCCUpload from 'models/upload';\r\nimport { WCCAttachmentControlsVMConfig } from '../decorators/controls/controls';\r\nimport { WCCAttachmentLayoutVMTheme } from '../layouts/base/base.interfaces';\r\nimport { IAttachmentLayoutFactory, WCCAttachmentLayout } from '../layouts/iFactory';\r\nimport './upload.html';\r\nimport './upload.scss';\r\n\nconst { allowedUploadImageExtensions, allowedUploadImageExtensionsForTopicThreads, allowedUploadVideoExtensions } = settings;\n\ncomponents.preload('attachment-controls', 'wcc-image');\n\nexport interface WCCUploadVMConfig {\n upload: SubscribableOrNullableValue\r\n layout?: SubscribableOrNullableValue\r\n theme?: SubscribableOrNullableValue\r\n cover: SubscribableOrNullableValue\r\n}\n\n@injectable()\nexport default class WCCUploadVM {\n private upload: Subscribable\n\n name: Subscribable\n progress: Subscribable\n\n preview: Subscribable\n icon: Subscribable\n\n layoutConfig: Subscribable\n controlsConfig: Subscribable\n\n constructor(\n @inject(wccModules.componentConfig) config: WCCUploadVMConfig,\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\n @inject(wccModules.attachmentLayoutFactory) layoutFactory: IAttachmentLayoutFactory\n ) {\n this.upload = ko.flattenComputed(config.upload);\n\n const coverConfig = ko.flattenComputed(config.cover);\n\n this.name = this.upload.pluck('name', '');\n this.progress = this.upload.pluck('progress', 0);\n this.preview = this.upload.pluck('preview');\n\n const extension = ko.pureComputed(() => system.getExtension(this.name()));\n const isImage = extension.mapNotNull(extension => allowedUploadImageExtensions.includes(extension) || allowedUploadImageExtensionsForTopicThreads.includes(extension)).default(false);\n const isVideo = extension.mapNotNull(extension => allowedUploadVideoExtensions.includes(extension)).default(false);\n\n this.icon = ko.strictComputed((extension, isImage, isVideo): string => {\n if (extension != undefined) {\n if (isImage)\n return 'fal fa-image';\n else if (isVideo)\n return 'fal fa-film';\n }\n\n return AttachmentsHelpers.getFileIcon(extension);\n }, [extension, isImage, isVideo]);\n\n const ratio = ko.strictComputed(config => {\n if (_.isNumber(config))\r\n return config;\r\n\r\n return 1.77;\r\n }, [coverConfig]);\n\n this.layoutConfig = layoutFactory.create({\r\n layout: config.layout,\r\n\r\n config: {\r\n ratio: ratio,\r\n theme: config.theme\r\n }\r\n });\n\n this.controlsConfig = this.upload.pluck(upload => ({\n progress: {\r\n value: this.progress,\r\n icon: this.icon\r\n },\r\n\r\n expand: {\r\n src: this.preview,\r\n title: this.name\r\n },\r\n\r\n cancel: upload.isCancellable() ? () => upload.cancel() : undefined\r\n }));\n\n ko.applyBindingsToNode(info.element, {\n 'css': {\n 'wcc-upload': true\n },\n\n 'style': {\n 'background-image': this.preview.pluck(preview => `url(${preview})`)\r\n }\n });\n }\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".wcc-upload{display:block;border-radius:4px;overflow:hidden;background-size:cover}.wcc-upload:hover .wcc-upload__icon{color:#868686}.wcc-upload__icon-wrapper{position:relative;text-align:center}.wcc-upload__icon{position:absolute;top:0;right:0;bottom:0;left:0;color:#adadad;transition:color .4s ease-in-out}.wcc-upload__image-wrapper{position:relative}.wcc-upload__image{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;padding:20%}.wcc-upload__image img{max-height:100%}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}