<commit_before>import get_dialog_constructor from "./widget_dialog.js";

export default class NewWidget {
	constructor(opts) {
		Object.assign(this, opts);
		this.make();
	}

	customize() {
		return;
	}

	make() {
		this.make_widget();
		this.widget.appendTo(this.container);
		this.setup_events();
	}

	get_title() {
		// DO NOT REMOVE: Comment to load translation
		// __("New Chart") __("New Shortcut")
		return __(`New ${frappe.model.unscrub(this.type)}`);
	}

	make_widget() {
		const new_widget_class = `new-${frappe.scrub(frappe.model.unscrub(this.type), '-')}-widget`;
		this.widget = $(`<div class="widget new-widget ${new_widget_class}">
				+ ${this.get_title()}
			</div>`);
		this.body = this.widget;
	}

	setup_events() {
		this.widget.on("click", () => {
			if (!this.custom_dialog) {
				this.open_dialog();
			} else {
				this.custom_dialog();
			}<commit_msg>fix: add number card to translation comment<commit_after>import get_dialog_constructor from "./widget_dialog.js";

export default class NewWidget {
	constructor(opts) {
		Object.assign(this, opts);
		this.make();
	}

	customize() {
		return;
	}

	make() {
		this.make_widget();
		this.widget.appendTo(this.container);
		this.setup_events();
	}

	get_title() {
		// DO NOT REMOVE: Comment to load translation
		// __("New Chart") __("New Shortcut") __("New Number Card")
		return __(`New ${frappe.model.unscrub(this.type)}`);
	}

	make_widget() {
		const new_widget_class = `new-${frappe.scrub(frappe.model.unscrub(this.type), '-')}-widget`;
		this.widget = $(`<div class="widget new-widget ${new_widget_class}">
				+ ${this.get_title()}
			</div>`);
		this.body = this.widget;
	}

	setup_events() {
		this.widget.on("click", () => {
			if (!this.custom_dialog) {
				this.open_dialog();
			} else {
				this.custom_dialog();
			}
{'fraction_non_alphanumeric': 0.18196902654867256, 'fraction_numerical': 0.0, 'mean_word_length': 3.889189189189189, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7580258', 'n_tokens_mistral': 716, 'n_tokens_neox': 656, 'n_words': 117}