1import{l as t}from"./lazy-loaders.0bffce22.js";import{C as o}from"./CroppieCropper.7ba2d281.js";import{n as e}from"./vueComponentNormalizer.fc2fb13f.js";import"./sweetalert2.8872205b.js";import"./download-feedback.53c63ecb.js";import"./app.e14bf9ef.js";import"./sentry.cf212017.js";var s=function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"default-qr-code"},[e("div",{staticClass:"qr-customizer"},[e("div",{staticClass:"row qr-customizer__layout"},[e("div",{staticClass:"col-lg-5 mb-4 mb-lg-0"},[e("div",{staticClass:"qr-preview-card"},[e("div",{staticClass:"qr-code-canvas-wrapper"},[e("div",{ref:"qrCode",staticClass:"w-100",attrs:{id:"qr-code"}})]),t._v(" "),e("div",{staticClass:"qr-preview-actions"},[e("button",{staticClass:"btn btn-secondary",attrs:{type:"button"},on:{click:t.resetQrCode}},[e("i",{staticClass:"fa fa-undo",attrs:{"aria-hidden":"true"}}),t._v(" Reset")])])])]),t._v(" "),e("div",{staticClass:"col-lg-7"},[t.options?e("div",[e("div",{staticClass:"qr-customizer-form"},[e("form",{on:{submit:function(o){return o.preventDefault(),t.saveQrCode(o)}}},[e("div",{staticClass:"qr-customizer-form__section"},[t._m(0),t._v(" "),e("div",{staticClass:"qr-color-swatches"},[e("div",{staticClass:"qr-color-picker"},[e("button",{staticClass:"qr-color-swatch qr-color-swatch--picker",attrs:{type:"button","aria-label":t.ariaLabel("dots color","custom")}},[e("i",{staticClass:"fa fa-eye-dropper",attrs:{"aria-hidden":"true"}})]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.options.dotsOptions.color,expression:"options.dotsOptions.color"}],staticClass:"qr-color-input",attrs:{id:"default-dots-color",type:"color"},domProps:{value:t.options.dotsOptions.color},on:{input:function(o){o.target.composing||t.$set(t.options.dotsOptions,"color",o.target.value)}}})]),t._v(" "),t._l(t.getPalette("dotsOptions"),function(o){return e("button",{key:`dots-${o}`,staticClass:"qr-color-swatch",class:{"is-active":t.isColorSelected("dotsOptions",o)},style:{backgroundColor:o},attrs:{type:"button","aria-label":t.ariaLabel("dots color",o)},on:{click:function(e){return t.selectOptionColor("dotsOptions",o)}}})})],2)]),t._v(" "),e("div",{staticClass:"qr-customizer-form__section"},[t._m(1),t._v(" "),e("div",{staticClass:"qr-color-swatches"},[e("div",{staticClass:"qr-color-picker"},[e("button",{staticClass:"qr-color-swatch qr-color-swatch--picker",attrs:{type:"button","aria-label":t.ariaLabel("corner color","custom")}},[e("i",{staticClass:"fa fa-eye-dropper",attrs:{"aria-hidden":"true"}})]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.options.cornersSquareOptions.color,expression:"options.cornersSquareOptions.color"}],staticClass:"qr-color-input",attrs:{id:"default-corner-color",type:"color"},domProps:{value:t.options.cornersSquareOptions.color},on:{input:[function(o){o.target.composing||t.$set(t.options.cornersSquareOptions,"color",o.target.value)},function(o){return t.syncCornerDotColor(o.target.value)}]}})]),t._v(" "),t._l(t.getPalette("cornersSquareOptions"),function(o){return e("button",{key:`corners-${o}`,staticClass:"qr-color-swatch",class:{"is-active":t.isColorSelected("cornersSquareOptions",o)},style:{backgroundColor:o},attrs:{type:"button","aria-label":t.ariaLabel("corner color",o)},on:{click:function(e){return t.selectOptionColor("cornersSquareOptions",o)}}})})],2)]),t._v(" "),e("div",{staticClass:"qr-customizer-form__section"},[t._m(2),t._v(" "),e("div",{staticClass:"qr-color-swatches"},[e("div",{staticClass:"qr-color-picker"},[e("button",{staticClass:"qr-color-swatch qr-color-swatch--picker",attrs:{type:"button","aria-label":t.ariaLabel("background color","custom")}},[e("i",{staticClass:"fa fa-eye-dropper",attrs:{"aria-hidden":"true"}})]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.options.backgroundOptions.color,expression:"options.backgroundOptions.color"}],staticClass:"qr-color-input",attrs:{id:"default-background-color",type:"color"},domProps:{value:t.options.backgroundOptions.color},on:{input:function(o){o.target.composing||t.$set(t.options.backgroundOptions,"color",o.target.value)}}})]),t._v(" "),t._l(t.getPalette("backgroundOptions"),function(o){return e("button",{key:`background-${o}
1`,staticClass:"qr-color-swatch",class:{"is-active":t.isColorSelected("backgroundOptions",o)},style:{backgroundColor:o},attrs:{type:"button","aria-label":t.ariaLabel("background color",o)},on:{click:function(e){return t.selectOptionColor("backgroundOptions",o)}}})})],2),t._v(" "),e("small",{staticClass:"text-muted"},[t._v("\n Warning some colors may not work well together. Make sure you test the QR code before sharing.\n ")])]),t._v(" "),e("div",{staticClass:"qr-customizer-form__section"},[e("div",{staticClass:"form-row"},[e("div",{staticClass:"form-group col-md-6 mb-3 mb-md-0"},[e("span",{staticClass:"d-block font-weight-semibold mb-2"},[t._v("Pattern")]),t._v(" "),e("div",{staticClass:"d-flex flex-wrap"},t._l(t.patternOptions,function(o){return e("button",{key:o.key,staticClass:"btn btn-outline-secondary mr-2 mb-2",class:{active:t.selectedPattern===o.key},attrs:{type:"button"},on:{click:function(e){return t.setPattern(o.key)}}},[t._v("\n "+t._s(o.label)+"\n ")])}),0)]),t._v(" "),e("div",{staticClass:"form-group col-md-6"},[e("span",{staticClass:"d-block font-weight-semibold mb-2"},[t._v("Corners")]),t._v(" "),e("div",{staticClass:"d-flex flex-wrap"},t._l(t.cornerShapeOptions,function(o){return e("button",{key:o.key,staticClass:"btn btn-outline-secondary mr-2 mb-2",class:{active:t.selectedCorner===o.key},attrs:{type:"button"},on:{click:function(e){return t.setCornerStyle(o.key)}}},[t._v("\n "+t._s(o.label)+"\n ")])}),0)])])]),t._v(" "),e("div",{staticClass:"qr-customizer-form__section"},[e("label",{staticClass:"d-block font-weight-semibold mb-2",attrs:{for:"default-image"}},[t._v("Image/Logo (Optional)")]),t._v(" "),t.options.image?e("div",{staticClass:"qr-logo-preview mb-2"},[e("img",{staticClass:"img-thumbnail",staticStyle:{"max-width":"120px","max-height":"120px"},attrs:{src:t.options.image,alt:"Logo preview"}}),t._v(" "),e("button",{staticClass:"btn btn-sm btn-danger qr-logo-clear",attrs:{type:"button","aria-label":"Remove logo",title:"Remove logo"},on:{click:t.removeImage}},[e("i",{staticClass:"fa fa-trash",attrs:{"aria-hidden":"true"}})])]):e("dropzone-uploader",{attrs:{accept:"image/*",multiple:!1},on:{change:t.loadImage}},[e("div",{staticClass:"font-weight-bold"},[e("i",{staticClass:"fa fa-image mr-1",attrs:{"aria-hidden":"true"}}),t._v(t._s(t.options.image?"Drop an image file to replace":"Drag & drop an image file here"))]),t._v(" "),e("div",{staticClass:"text-muted"},[t._v("or click to upload")])])],1),t._v(" "),e("div",{staticClass:"d-flex justify-content-end mt-4"},[e("button",{staticClass:"btn btn-primary",attrs:{type:"submit",disabled:t.isSaving}},[e("i",{staticClass:"fa",class:t.isSaving?"fa-spinner fa-spin":"fa-save",attrs:{"aria-hidden":"true"}}),t._v("\n "+t._s(t.isSaving?"Saving...":"Save")+"\n ")])])])])]):e("div",{staticClass:"text-center py-5"},[e("span",{staticClass:"text-muted"},[t._v("Loading QR code settings...")])])])])]),t._v(" "),e("div",{staticClass:"modal fade",attrs:{id:"defaultQrLogoCropModal",tabindex:"-1",role:"dialog","aria-labelledby":"defaultQrLogoCropModalLabel","aria-hidden":"true"}},[e("div",{staticClass:"modal-dialog modal-lg",attrs:{role:"document"}},[e("div",{staticClass:"modal-content"},[t._m(3),t._v(" "),e("div",{staticClass:"modal-body"},[e("croppie-cropper",{key:`default-qr-logo-${t.logoShape}`,ref:"qrLogoCroppie",attrs:{enableResize:!0,enableOrientation:!0,enableExif:!0,boundary:t.logoBoundary,viewport:t.logoViewport,"lock-aspect-ratio":!0,"lock-boundary":!0,"min-viewport-size":120,"output-format":"png","output-type":"base64","output-size":t.logoResultSize,"max-size":t.logoMaxSize,"force-max-size":!0,"output-circle":"round"===t.logoShape}})],1),t._v(" "),e("div",{staticClass:"modal-footer"},[e("div",{staticClass:"btn-group qr-logo-shape-toggle",attrs:{role:"group","aria-label":"Logo shape"}},[e("button",{staticClass:"btn btn-outline-secondary",class:{active:"square"===t.logoShape},attrs:{type:"button"},on:{click:function(o){return t.setLogoShape("square")}}},[t._v("Square")]),t._v(" "),e("button",{staticClass:"btn btn-outline-secondary",class:{active:"round"===t.logoShape},attrs:{type:"button"},on:{click:function(o){return t.setLogoShape("round")}}},[t._v("Round")])]),t._v(" "),e("button",{staticClass:"btn btn-primary logo-crop-action",attrs:{type:"button","aria-label":"Save logo",title:"Save Logo"},on:{click:t.applyLogoCrop}},[e("i",{staticClass:"fa fa-floppy-disk",attrs:{"aria-hidden":"true"}}),e("span",{staticClass:"logo-crop-action-label"},[t._v("Save Logo")])])])])])])])},r=[function(){var t=this,o=t.$createElement,e=t._self._c||o;
1return e("div",{staticClass:"qr-customizer__control"},[e("label",{attrs:{for:"default-dots-color"}},[t._v("Dots Color")])])},function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"qr-customizer__control"},[e("label",{attrs:{for:"default-corner-color"}},[t._v("Corner Dots Color")])])},function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"qr-customizer__control"},[e("label",{attrs:{for:"default-background-color"}},[t._v("Background Color")])])},function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"modal-header bg-primary text-white"},[e("h5",{staticClass:"modal-title",attrs:{id:"defaultQrLogoCropModalLabel"}},[t._v("Crop Logo")]),t._v(" "),e("button",{staticClass:"modal-close-x",attrs:{type:"button","data-dismiss":"modal","aria-label":"Close"}},[e("i",{staticClass:"fa fa-times",attrs:{"aria-hidden":"true"}})])])}];const i=[{key:"classic",label:"Classic",dotStyle:"square",backendStyle:"square"},{key:"dots",label:"Dots",dotStyle:"dots",backendStyle:"dot"}],a=[{key:"sharp",label:"Sharp",cornerSquareStyle:"square",cornerDotStyle:"square",backendStyle:"square"},{key:"soft",label:"Soft",cornerSquareStyle:"extra-rounded",cornerDotStyle:"dot",backendStyle:"circle"}],n=300,l={components:{"croppie-cropper":o},data:()=>({options:null,qrCodeInstance:null,pendingLogoImage:null,logoCropImage:null,logoBoundary:{width:420,height:320},logoViewport:{width:240,height:240,type:"square"},logoResultSize:{width:600,height:600},logoShape:"square",logoMaxSize:5e5,colorPalettes:{default:["#ffffff","#111827","#1d4ed8","#FFDE21","#0ea5e9","#FF2C2C","#16a34a","#65a30d","#ea580c"],backgroundOptions:["#ffffff","#111827","#1d4ed8","#FFDE21","#0ea5e9","#FF2C2C","#16a34a","#65a30d","#ea580c"],dotsOptions:["#ffffff","#111827","#1d4ed8","#FFDE21","#0ea5e9","#FF2C2C","#16a34a","#65a30d","#ea580c"],cornersSquareOptions:["#ffffff","#111827","#1d4ed8","#FFDE21","#0ea5e9","#FF2C2C","#16a34a","#65a30d","#ea580c"]},patternOptions:i,cornerShapeOptions:a,selectedPattern:i[0].key,selectedCorner:a[0].key,isSaving:!1}),mounted(){this.initQrCode(),this.getDefaultQrCode(),this.options||(this.options=APP.TOOLS.buildQrCodeComponentData(),this.updateSelectionsFromOptions(),this.syncQRCode()),this.boundLogoCropShown=this.handleLogoCropperShown.bind(this),this.boundLogoCropHidden=this.handleLogoCropperHidden.bind(this),$("#defaultQrLogoCropModal").on("shown.bs.modal",this.boundLogoCropShown),$("#defaultQrLogoCropModal").on("hidden.bs.modal",this.boundLogoCropHidden)},beforeDestroy(){this.boundLogoCropShown&&$("#defaultQrLogoCropModal").off("shown.bs.modal",this.boundLogoCropShown),this.boundLogoCropHidden&&$("#defaultQrLogoCropModal").off("hidden.bs.modal",this.boundLogoCropHidden)},watch:{options:{deep:!0,handler:_.debounce(function(){this.options&&(this.options.cornersSquareOptions&&this.options.cornersDotOptions&&(this.options.cornersDotOptions.color=this.options.cornersSquareOptions.color),this.syncQRCode())},100)}},methods:{async initQrCode(){if(this.qrCodeInstance)return this.qrCodeInstance;let o;try{o=await t()}catch(s){return null}const e=o.default||o;return e?(this.qrCodeInstance=new e({data:"",width:n,height:n}),this.$refs.qrCode&&this.qrCodeInstance.append(this.$refs.qrCode),this.options&&this.syncQRCode(),this.qrCodeInstance):null},getPalette(t){return this.colorPalettes[t]||this.colorPalettes.default||[]},isColorSelected(t,o){if(!this.options||!o)return!1;const e=this.options[t];return!(!e||!e.color)&&e.color.toLowerCase()===o.toLowerCase()},ariaLabel:(t,o)=>`Set ${t} to ${o}`,selectOptionColor(t,o){if(!this.options)return;const e=this.options[t];e&&(e.color=o),"cornersSquareOptions"===t&&this.syncCornerDotColor(o)},syncCornerDotColor(t){var o;if(!this.options)return;const e=t||(null==(o=this.options.cornersSquareOptions)?void 0:o.color);e&&this.options.cornersDotOptions&&(this.options.cornersDotOptions.color=e)},syncQRCode(){if(this.qrCodeInstance&&this.options)try{this.qrCodeInstance.update(this.options)}catch(t){}},getDefaultQrCode(){axios.get(_apiUrl+"v1/team/default-qr-codes").then(t=>{var o;this.options=APP.TOOLS.buildQrCodeComponentData(null,t.data.qr_code_options);const e=Number(this.options.width)||n;this.options.width=e,this.options.height=e,this.updateSelectionsFromOptions(),this.syncCornerDotColor(null==(o=this.options.cornersSquareOptions)?void 0:o.color),this.syncQRCode()})},async saveQrCode(){var t,o,e;if(this.isSaving||!this.options)return;this.isSaving=!0;let s=!1;try{if(this.options.image&&this.options.image.length>this.logoMaxSize)return void $.toast({title:"Logo Too Large",message:"Please crop a smaller area or use a simpler image (max 500 KB).",style:"danger"});const r={background_color:null==(t=this.options.backgroundOptions)?void 0:t.color,corner_dots_color:null==(o=this.options.cornersSquareOptions)?void 0:o.color,dots_color:null==(e=this.options.dotsOptions)?void 0:e.color,dots_style:this.options.dots_style||("dots"===this.selectedPattern?"dot":"square"),corner_style:this.options.corner_style||("soft"===this.selectedCorner?"circle":"square"),image:this.options.image||null};APP.LOADER.show(),s=!0;(await axios.put("/api/v1/team/default-qr-codes",r)).data&&$.toast({title:"QR Code Settings Saved",message:"Make sure you test the QR code before sharing.",style:"success"})}finally{s&&APP.LOADER.hide(),this.isSaving=!1}},removeImage(){this.options&&(this.options.image=null,this.syncQRCode())},resetQrCode(){var t;this.options=APP.TOOLS.buildQrCodeComponentData();const o=Number(this.options.width)||n;this.options.width=o,this.options.height=o,this.updateSelectionsFromOptions(),this.syncCornerDotColor(null==(t=this.options.cornersSquareOptions)?void 0:t.color),this.syncQRCode()},async loadImage(t){var o;const e=t.target.files||(null==(o=t.dataTransfer)?void 0:o.files);if(!e||!e.length)return;const s=e[0];if(s.size>5e6)return void $.toast({title:"Image Too Large",message:"Please upload an image under 5 MB.",style:"danger"});const r=s.type||"";if(r&&!r.startsWith("image/"))return void $.toast({title:"Invalid Image",message:"Please upload a valid image file.",style:"danger"});const i=new FileReader;i.onload=t=>{const o=t.target.result;o&&(this.pendingLogoImage=o,$("#defaultQrLogoCropModal").modal("show"))},i.onerror=()=>{$.toast({title:"Upload Error",message:"Unable to read the image file.",style:"danger"})},i.readAsDataURL(s)},handleLogoCropperShown(){this.$nextTick(()=>{this.pendingLogoImage&&this.$refs.qrLogoCroppie&&(this.logoCropImage=this.pendingLogoImage,this.$refs.qrLogoCroppie.refresh&&this.$refs.qrLogoCroppie.refresh(),this.$refs.qrLogoCroppie.bind({url:this.logoCropImage}).catch(()=>{}),this.updateLogoViewportType(),this.pendingLogoImage=null)})},getLogoViewportSize(){if(this.$refs.qrLogoCroppie&&this.$refs.qrLogoCroppie.getViewportSize){const t=this.$refs.qrLogoCroppie.getViewportSize();if(t&&t.width&&t.height)return Math.min(t.width,t.height)}return null},updateLogoViewportType(t=this.logoShape){var o;const e="round"===t?"circle":"square",s=this.getLogoViewportSize()||(null==(o=this.logoViewport)?void 0:o.width)||240;this.logoViewport={...this.logoViewport,type:e,width:s,height:s}},rebindLogoCropper(){this.logoCropImage&&this.$refs.qrLogoCroppie&&(this.$refs.qrLogoCroppie.refresh&&this.$refs.qrLogoCroppie.refresh(),this.$refs.qrLogoCroppie.bind({url:this.logoCropImage}).catch(()=>{}))}
1,setLogoShape(t){this.logoShape!==t&&(this.updateLogoViewportType(t),this.logoShape=t,this.$nextTick(()=>{this.rebindLogoCropper()}))},handleLogoCropperHidden(){this.pendingLogoImage=null,this.logoCropImage=null},async applyLogoCrop(){if(!this.$refs.qrLogoCroppie||!this.options)return;const t=await this.$refs.qrLogoCroppie.result();t?t.length>this.logoMaxSize?$.toast({title:"Logo Too Large",message:"Please crop a smaller area or use a simpler image (max 500 KB).",style:"danger"}):(this.options.image=t,this.syncQRCode(),$("#defaultQrLogoCropModal").modal("hide")):$.toast({title:"Logo Error",message:"Unable to process that image. Please try another file.",style:"danger"})},ensureOptionObjects(){var t,o;this.options&&(this.options.dotsOptions||this.$set(this.options,"dotsOptions",{}),this.options.cornersSquareOptions||this.$set(this.options,"cornersSquareOptions",{}),this.options.cornersDotOptions||this.$set(this.options,"cornersDotOptions",{}),this.options.dots_style||this.$set(this.options,"dots_style",(null==(t=this.patternOptions[0])?void 0:t.backendStyle)||"square"),this.options.corner_style||this.$set(this.options,"corner_style",(null==(o=this.cornerShapeOptions[0])?void 0:o.backendStyle)||"square"))},setPattern(t){if(!this.options)return;const o=this.patternOptions.find(o=>o.key===t);o&&(this.selectedPattern=t,this.ensureOptionObjects(),this.options.dotsOptions.type=o.dotStyle,this.options.dots_style=o.backendStyle)},setCornerStyle(t){if(!this.options)return;const o=this.cornerShapeOptions.find(o=>o.key===t);o&&(this.selectedCorner=t,this.ensureOptionObjects(),this.options.cornersSquareOptions.type=o.cornerSquareStyle,this.options.cornersDotOptions.type=o.cornerDotStyle,this.options.corner_style=o.backendStyle)},updateSelectionsFromOptions(){var t,o,e;if(!this.options)return;this.ensureOptionObjects();const s=(this.options.dots_style||"").toString().toLowerCase();let r=this.patternOptions.find(t=>t.backendStyle===s);if(!r){const o=((null==(t=this.options.dotsOptions)?void 0:t.type)||"").toString().toLowerCase();r=this.patternOptions.find(t=>t.dotStyle===o)}!r&&this.patternOptions.length&&(r=this.patternOptions[0]),r&&this.setPattern(r.key);const i=(this.options.corner_style||"").toString().toLowerCase();let a=this.cornerShapeOptions.find(t=>t.backendStyle===i);if(!a){const t=((null==(o=this.options.cornersSquareOptions)?void 0:o.type)||"").toString().toLowerCase(),s=((null==(e=this.options.cornersDotOptions)?void 0:e.type)||"").toString().toLowerCase();a=this.cornerShapeOptions.find(o=>o.cornerSquareStyle===t&&o.cornerDotStyle===s)}!a&&this.cornerShapeOptions.length&&(a=this.cornerShapeOptions[0]),a&&this.setCornerStyle(a.key)}}},c={};var d=e(l,s,r,!1,p,null,null,null);function p(t){for(let o in c)this[o]=c[o]}const u=function(){return d.exports}();export{u as default};
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.