kritzel-stencil 0.0.104 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-D62tBCuq.js.map +1 -1
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +281 -2167
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +1 -0
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +4 -4
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +7 -2
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/image.class.js +15 -10
- package/dist/collection/classes/objects/image.class.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +22 -16
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-box.class.js +15 -9
- package/dist/collection/classes/objects/selection-box.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +19 -12
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +29 -12
- package/dist/collection/classes/objects/text.class.js.map +1 -1
- package/dist/collection/classes/reviver.class.js +4 -4
- package/dist/collection/classes/reviver.class.js.map +1 -1
- package/dist/collection/classes/store.class.js +30 -14
- package/dist/collection/classes/store.class.js.map +1 -1
- package/dist/collection/classes/structures/octree.structure.js +2 -2
- package/dist/collection/classes/structures/octree.structure.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +4 -4
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +3 -2
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +2 -2
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.css +10 -10
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +42 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +236 -23
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.css +43 -43
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +3 -3
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.css +20 -20
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +53 -53
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +2 -2
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.css +10 -10
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +48 -48
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +3 -3
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +30 -30
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +1 -1
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +17 -17
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +17 -17
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +4 -4
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +18 -18
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +2 -2
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +2 -2
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +2 -2
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
- package/dist/collection/helpers/object.helper.js +2 -15
- package/dist/collection/helpers/object.helper.js.map +1 -1
- package/dist/collection/interfaces/object.interface.js.map +1 -1
- package/dist/components/kritzel-brush-style.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-control-brush-config.js +1 -1
- package/dist/components/kritzel-control-text-config.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +58 -18
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/{p-X3xYsp4r.js → p-9IX8ss5J.js} +6 -6
- package/dist/components/p-9IX8ss5J.js.map +1 -0
- package/dist/components/{p-Ddfewfv9.js → p-B1tJ3Woq.js} +3 -3
- package/dist/components/{p-Ddfewfv9.js.map → p-B1tJ3Woq.js.map} +1 -1
- package/dist/components/{p-D06w3u84.js → p-B7P9QBiE.js} +4 -4
- package/dist/components/p-B7P9QBiE.js.map +1 -0
- package/dist/components/{p-BjqfG-5H.js → p-BFlJumTk.js} +10 -10
- package/dist/components/{p-BjqfG-5H.js.map → p-BFlJumTk.js.map} +1 -1
- package/dist/components/p-BcQCX1Z6.js +813 -0
- package/dist/components/p-BcQCX1Z6.js.map +1 -0
- package/dist/components/{p-_wFpvzNp.js → p-Bhfk_puI.js} +4 -4
- package/dist/components/p-Bhfk_puI.js.map +1 -0
- package/dist/components/{p-BYH2jNAX.js → p-CF5pcRGS.js} +4 -4
- package/dist/components/{p-BYH2jNAX.js.map → p-CF5pcRGS.js.map} +1 -1
- package/dist/components/p-CZkSABuJ.js.map +1 -1
- package/dist/components/{p-BYt7-mGK.js → p-Cbu5RSmC.js} +3 -3
- package/dist/components/{p-BYt7-mGK.js.map → p-Cbu5RSmC.js.map} +1 -1
- package/dist/components/{p-DaeIjoQm.js → p-Ck2d5Wd1.js} +4 -4
- package/dist/components/p-Ck2d5Wd1.js.map +1 -0
- package/dist/components/{p-DMSOfO6k.js → p-CkPd1oL1.js} +165 -84
- package/dist/components/p-CkPd1oL1.js.map +1 -0
- package/dist/components/{p-C8KDwUb7.js → p-D9nf_Yw4.js} +3 -3
- package/dist/components/p-D9nf_Yw4.js.map +1 -0
- package/dist/components/p-DC8SDK2U.js.map +1 -1
- package/dist/components/{p-DJUnTtGg.js → p-DIxwvThL.js} +17 -17
- package/dist/components/{p-DJUnTtGg.js.map → p-DIxwvThL.js.map} +1 -1
- package/dist/components/{p-CDhTT8u8.js → p-Ds3FhuuO.js} +3 -3
- package/dist/components/p-Ds3FhuuO.js.map +1 -0
- package/dist/components/{p-BgUIonZF.js → p-I1jXruHK.js} +4 -4
- package/dist/components/p-I1jXruHK.js.map +1 -0
- package/dist/components/{p-BqUM5gV3.js → p-JvUh5Cky.js} +9 -9
- package/dist/components/p-JvUh5Cky.js.map +1 -0
- package/dist/components/{p-DQHNxDS7.js → p-c6tIpE_t.js} +3 -3
- package/dist/components/p-c6tIpE_t.js.map +1 -0
- package/dist/components/{p-BJ5xxphF.js → p-wUZba7Vi.js} +4 -4
- package/dist/components/{p-BJ5xxphF.js.map → p-wUZba7Vi.js.map} +1 -1
- package/dist/esm/index-BOJOOWaP.js.map +1 -1
- package/dist/esm/kritzel-brush-style_18.entry.js +281 -2167
- package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/esm/stencil.js.map +1 -1
- package/dist/stencil/p-7aaf3e49.entry.js +2 -0
- package/dist/stencil/p-7aaf3e49.entry.js.map +1 -0
- package/dist/stencil/p-BOJOOWaP.js.map +1 -1
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/stencil/stencil.esm.js.map +1 -1
- package/dist/types/classes/objects/base-object.class.d.ts +4 -3
- package/dist/types/classes/objects/image.class.d.ts +2 -2
- package/dist/types/classes/objects/path.class.d.ts +1 -1
- package/dist/types/classes/objects/selection-box.class.d.ts +1 -1
- package/dist/types/classes/objects/selection-group.class.d.ts +1 -1
- package/dist/types/classes/objects/text.class.d.ts +12 -1
- package/dist/types/classes/store.class.d.ts +3 -3
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +7 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +8 -1
- package/dist/types/components.d.ts +11 -3
- package/dist/types/helpers/object.helper.d.ts +0 -1
- package/dist/types/interfaces/object.interface.d.ts +1 -1
- package/package.json +3 -5
- package/dist/components/p-BgUIonZF.js.map +0 -1
- package/dist/components/p-BqUM5gV3.js.map +0 -1
- package/dist/components/p-C8KDwUb7.js.map +0 -1
- package/dist/components/p-CDhTT8u8.js.map +0 -1
- package/dist/components/p-CFkDfXW4.js +0 -2814
- package/dist/components/p-CFkDfXW4.js.map +0 -1
- package/dist/components/p-D06w3u84.js.map +0 -1
- package/dist/components/p-DMSOfO6k.js.map +0 -1
- package/dist/components/p-DQHNxDS7.js.map +0 -1
- package/dist/components/p-DaeIjoQm.js.map +0 -1
- package/dist/components/p-X3xYsp4r.js.map +0 -1
- package/dist/components/p-_wFpvzNp.js.map +0 -1
- package/dist/stencil/p-f059fbff.entry.js +0 -2
- package/dist/stencil/p-f059fbff.entry.js.map +0 -1
|
@@ -22,7 +22,7 @@ const KritzelBrushStyle = class {
|
|
|
22
22
|
value: option.value,
|
|
23
23
|
label: option.label,
|
|
24
24
|
}));
|
|
25
|
-
return (index.h(index.Host, { key: '
|
|
25
|
+
return (index.h(index.Host, { key: 'd7af382fe6f613aa16a5146785990ad2faa17f60' }, index.h("kritzel-dropdown", { key: '6d6d330d415c210058834b2968774b3db2ab7fc4', options: dropdownOptions, value: this.type, onValueChanged: event => this.handleDropdownValueChange(event) }, index.h("button", { key: 'c9fb33795b8e25f68c1d2ae248dc82a6de29e199', class: "brush-style-button", slot: "prefix" }, index.h("kritzel-icon", { key: '975c95b545a1c27ae2984405ac298592eec9743d', name: this.type, size: 16 })))));
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
KritzelBrushStyle.style = kritzelBrushStyleCss;
|
|
@@ -60,13 +60,13 @@ const KritzelColor = class {
|
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
62
|
const isColorVeryLight = this.isLightColor(this.value);
|
|
63
|
-
return (index.h(index.Host, { key: '
|
|
63
|
+
return (index.h(index.Host, { key: '606cfb813de66c495b2a2ff1e54aac4a5f761ab8' }, index.h("div", { key: '066d364e6e025b245c896603f68a15962684f78b', class: "checkerboard-bg", style: {
|
|
64
64
|
width: `${this.size}px`,
|
|
65
65
|
height: `${this.size}px`,
|
|
66
66
|
borderRadius: '50%',
|
|
67
67
|
display: 'inline-block',
|
|
68
68
|
position: 'relative',
|
|
69
|
-
} }, index.h("div", { key: '
|
|
69
|
+
} }, index.h("div", { key: '500d1a781d0b7a1777a7a43f89be8c6217726584', class: {
|
|
70
70
|
'color-circle': true,
|
|
71
71
|
'white': isColorVeryLight,
|
|
72
72
|
}, style: {
|
|
@@ -108,7 +108,7 @@ const KritzelColorPalette = class {
|
|
|
108
108
|
render() {
|
|
109
109
|
const displayedColors = this.isExpanded ? this.colors : this.colors.slice(0, 6);
|
|
110
110
|
const expandedHeight = this.isExpanded ? this.calculateHeight() : '32px';
|
|
111
|
-
return (index.h(index.Host, { key: '
|
|
111
|
+
return (index.h(index.Host, { key: '9590fbda0cb20e767880c49323350b12c7d287e4' }, index.h("div", { key: '9fd8699050018a90919c0045630b766183abb42e', class: {
|
|
112
112
|
'color-grid': true,
|
|
113
113
|
'expanded': this.isExpanded,
|
|
114
114
|
}, style: {
|
|
@@ -136,7 +136,7 @@ const KritzelContextMenu = class {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
render() {
|
|
139
|
-
return (index.h(index.Host, { key: '
|
|
139
|
+
return (index.h(index.Host, { key: 'db318a0936f89f202ef5101447b723c0ba7aa139' }, index.h("div", { key: '53da01021464f605e08c5f910997bb8f21d481a1', class: "menu-container" }, this.items.map(item => (index.h("button", { key: `${item.label}-${this.items.indexOf(item)}`, class: { 'menu-item': true, 'disabled': typeof item.disabled === 'function' ? item.disabled() : item.disabled }, onClick: () => this.handleItemClick(item), onTouchStart: () => this.handleItemClick(item), disabled: typeof item.disabled === 'function' ? item.disabled() : item.disabled }, item.icon && index.h("kritzel-icon", { name: item.icon, size: 16 }), index.h("span", { class: "label" }, item.label)))))));
|
|
140
140
|
}
|
|
141
141
|
get hostElement() { return index.getElement(this); }
|
|
142
142
|
};
|
|
@@ -175,14 +175,14 @@ const KritzelControlBrushConfig = class {
|
|
|
175
175
|
this.toolChange.emit(this.tool);
|
|
176
176
|
}
|
|
177
177
|
render() {
|
|
178
|
-
return (index.h(index.Host, { key: '
|
|
178
|
+
return (index.h(index.Host, { key: '29f0492264283879fd86195fc0db8e5a8f352a0f' }, index.h("div", { key: 'c5bde66ab565eb717bf302f3f97d08ed0b261289', style: {
|
|
179
179
|
display: 'flex',
|
|
180
180
|
flexDirection: 'row',
|
|
181
181
|
alignItems: 'center',
|
|
182
182
|
justifyContent: 'flex-start',
|
|
183
183
|
width: '100%',
|
|
184
184
|
gap: '8px',
|
|
185
|
-
} }, index.h("kritzel-brush-style", { key: '
|
|
185
|
+
} }, index.h("kritzel-brush-style", { key: 'e78ec70c5d0eb24933543e12389f1a3db4c3b8f2', type: this.tool.type, onTypeChange: event => this.handleTypeChange(event) }), index.h("button", { key: '9fbde247a8ed3cf43ef0bd0b269f8562dfac56a0', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand', style: this.palette.length > 6 ? { visibillity: 'visible' } : { visibility: 'hidden' } }, index.h("kritzel-icon", { key: '3cf37dd520fabd632cfd7d764254467d563670e1', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: 'daa59edce48e683a52a39ae4062fe811908dc685', colors: this.palette, selectedColor: this.tool.color, isExpanded: this.isExpanded, isOpaque: true, onColorChange: color => this.handleColorChange(color) }), index.h("kritzel-stroke-size", { key: 'b71bfb1176c35c24c15827ebc89dcac56bb42f0e', selectedSize: this.tool.size, onSizeChange: event => this.handleSizeChange(event) })));
|
|
186
186
|
}
|
|
187
187
|
static get watchers() { return {
|
|
188
188
|
"tool": ["handleToolChange"]
|
|
@@ -214,14 +214,14 @@ const KritzelControlTextConfig = class {
|
|
|
214
214
|
this.toolChange.emit(this.tool);
|
|
215
215
|
}
|
|
216
216
|
render() {
|
|
217
|
-
return (index.h(index.Host, { key: '
|
|
217
|
+
return (index.h(index.Host, { key: '4a530500af6a26013d286f995987c8321c3565ec' }, index.h("div", { key: '98499852c8c2b95e2485058c8d0d114dfc4c133d', style: {
|
|
218
218
|
display: 'flex',
|
|
219
219
|
flexDirection: 'row',
|
|
220
220
|
alignItems: 'center',
|
|
221
221
|
justifyContent: 'flex-start',
|
|
222
222
|
width: '100%',
|
|
223
223
|
gap: '8px',
|
|
224
|
-
} }, index.h("kritzel-font-family", { key: '
|
|
224
|
+
} }, index.h("kritzel-font-family", { key: '21a06dd2a43b47219bf9fd983cbd75af75a7489d', selectedFontFamily: this.tool.fontFamily, onFontFamilyChange: event => this.handleFamilyChange(event) }), index.h("button", { key: 'dfef40e171b4c2c5c771a017448ae2c22597834b', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand' }, index.h("kritzel-icon", { key: 'ce3f80a32af959676b3dd16faedf195e9686fff3', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: '61dd15d6577784511b7abce9fe9e0c38c10a99fa', colors: this.tool.palette, selectedColor: this.tool.fontColor, isExpanded: this.isExpanded, onColorChange: event => this.handleColorChange(event) }), index.h("kritzel-font-size", { key: '162b9e3b4c342b4c224ec20bba61adbe168a638f', selectedSize: this.tool.fontSize, fontFamily: this.tool.fontFamily, onSizeChange: event => this.handleSizeChange(event) })));
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
227
|
KritzelControlTextConfig.style = kritzelControlTextConfigCss;
|
|
@@ -316,2023 +316,6 @@ class KritzelMathHelper {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
/** Detect free variable `global` from Node.js. */
|
|
320
|
-
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
321
|
-
|
|
322
|
-
/** Detect free variable `self`. */
|
|
323
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
324
|
-
|
|
325
|
-
/** Used as a reference to the global object. */
|
|
326
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
327
|
-
|
|
328
|
-
/** Built-in value references. */
|
|
329
|
-
var Symbol = root.Symbol;
|
|
330
|
-
|
|
331
|
-
/** Used for built-in method references. */
|
|
332
|
-
var objectProto$b = Object.prototype;
|
|
333
|
-
|
|
334
|
-
/** Used to check objects for own properties. */
|
|
335
|
-
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Used to resolve the
|
|
339
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
340
|
-
* of values.
|
|
341
|
-
*/
|
|
342
|
-
var nativeObjectToString$1 = objectProto$b.toString;
|
|
343
|
-
|
|
344
|
-
/** Built-in value references. */
|
|
345
|
-
var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
349
|
-
*
|
|
350
|
-
* @private
|
|
351
|
-
* @param {*} value The value to query.
|
|
352
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
353
|
-
*/
|
|
354
|
-
function getRawTag(value) {
|
|
355
|
-
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
356
|
-
tag = value[symToStringTag$1];
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
value[symToStringTag$1] = undefined;
|
|
360
|
-
var unmasked = true;
|
|
361
|
-
} catch (e) {}
|
|
362
|
-
|
|
363
|
-
var result = nativeObjectToString$1.call(value);
|
|
364
|
-
if (unmasked) {
|
|
365
|
-
if (isOwn) {
|
|
366
|
-
value[symToStringTag$1] = tag;
|
|
367
|
-
} else {
|
|
368
|
-
delete value[symToStringTag$1];
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return result;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/** Used for built-in method references. */
|
|
375
|
-
var objectProto$a = Object.prototype;
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Used to resolve the
|
|
379
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
380
|
-
* of values.
|
|
381
|
-
*/
|
|
382
|
-
var nativeObjectToString = objectProto$a.toString;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
386
|
-
*
|
|
387
|
-
* @private
|
|
388
|
-
* @param {*} value The value to convert.
|
|
389
|
-
* @returns {string} Returns the converted string.
|
|
390
|
-
*/
|
|
391
|
-
function objectToString(value) {
|
|
392
|
-
return nativeObjectToString.call(value);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/** `Object#toString` result references. */
|
|
396
|
-
var nullTag = '[object Null]',
|
|
397
|
-
undefinedTag = '[object Undefined]';
|
|
398
|
-
|
|
399
|
-
/** Built-in value references. */
|
|
400
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
404
|
-
*
|
|
405
|
-
* @private
|
|
406
|
-
* @param {*} value The value to query.
|
|
407
|
-
* @returns {string} Returns the `toStringTag`.
|
|
408
|
-
*/
|
|
409
|
-
function baseGetTag(value) {
|
|
410
|
-
if (value == null) {
|
|
411
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
412
|
-
}
|
|
413
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
414
|
-
? getRawTag(value)
|
|
415
|
-
: objectToString(value);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
420
|
-
* and has a `typeof` result of "object".
|
|
421
|
-
*
|
|
422
|
-
* @static
|
|
423
|
-
* @memberOf _
|
|
424
|
-
* @since 4.0.0
|
|
425
|
-
* @category Lang
|
|
426
|
-
* @param {*} value The value to check.
|
|
427
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
428
|
-
* @example
|
|
429
|
-
*
|
|
430
|
-
* _.isObjectLike({});
|
|
431
|
-
* // => true
|
|
432
|
-
*
|
|
433
|
-
* _.isObjectLike([1, 2, 3]);
|
|
434
|
-
* // => true
|
|
435
|
-
*
|
|
436
|
-
* _.isObjectLike(_.noop);
|
|
437
|
-
* // => false
|
|
438
|
-
*
|
|
439
|
-
* _.isObjectLike(null);
|
|
440
|
-
* // => false
|
|
441
|
-
*/
|
|
442
|
-
function isObjectLike(value) {
|
|
443
|
-
return value != null && typeof value == 'object';
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Checks if `value` is classified as an `Array` object.
|
|
448
|
-
*
|
|
449
|
-
* @static
|
|
450
|
-
* @memberOf _
|
|
451
|
-
* @since 0.1.0
|
|
452
|
-
* @category Lang
|
|
453
|
-
* @param {*} value The value to check.
|
|
454
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
455
|
-
* @example
|
|
456
|
-
*
|
|
457
|
-
* _.isArray([1, 2, 3]);
|
|
458
|
-
* // => true
|
|
459
|
-
*
|
|
460
|
-
* _.isArray(document.body.children);
|
|
461
|
-
* // => false
|
|
462
|
-
*
|
|
463
|
-
* _.isArray('abc');
|
|
464
|
-
* // => false
|
|
465
|
-
*
|
|
466
|
-
* _.isArray(_.noop);
|
|
467
|
-
* // => false
|
|
468
|
-
*/
|
|
469
|
-
var isArray = Array.isArray;
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Checks if `value` is the
|
|
473
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
474
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
475
|
-
*
|
|
476
|
-
* @static
|
|
477
|
-
* @memberOf _
|
|
478
|
-
* @since 0.1.0
|
|
479
|
-
* @category Lang
|
|
480
|
-
* @param {*} value The value to check.
|
|
481
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
482
|
-
* @example
|
|
483
|
-
*
|
|
484
|
-
* _.isObject({});
|
|
485
|
-
* // => true
|
|
486
|
-
*
|
|
487
|
-
* _.isObject([1, 2, 3]);
|
|
488
|
-
* // => true
|
|
489
|
-
*
|
|
490
|
-
* _.isObject(_.noop);
|
|
491
|
-
* // => true
|
|
492
|
-
*
|
|
493
|
-
* _.isObject(null);
|
|
494
|
-
* // => false
|
|
495
|
-
*/
|
|
496
|
-
function isObject(value) {
|
|
497
|
-
var type = typeof value;
|
|
498
|
-
return value != null && (type == 'object' || type == 'function');
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/** `Object#toString` result references. */
|
|
502
|
-
var asyncTag = '[object AsyncFunction]',
|
|
503
|
-
funcTag$2 = '[object Function]',
|
|
504
|
-
genTag$1 = '[object GeneratorFunction]',
|
|
505
|
-
proxyTag = '[object Proxy]';
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Checks if `value` is classified as a `Function` object.
|
|
509
|
-
*
|
|
510
|
-
* @static
|
|
511
|
-
* @memberOf _
|
|
512
|
-
* @since 0.1.0
|
|
513
|
-
* @category Lang
|
|
514
|
-
* @param {*} value The value to check.
|
|
515
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
516
|
-
* @example
|
|
517
|
-
*
|
|
518
|
-
* _.isFunction(_);
|
|
519
|
-
* // => true
|
|
520
|
-
*
|
|
521
|
-
* _.isFunction(/abc/);
|
|
522
|
-
* // => false
|
|
523
|
-
*/
|
|
524
|
-
function isFunction(value) {
|
|
525
|
-
if (!isObject(value)) {
|
|
526
|
-
return false;
|
|
527
|
-
}
|
|
528
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
529
|
-
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
530
|
-
var tag = baseGetTag(value);
|
|
531
|
-
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/** Used to detect overreaching core-js shims. */
|
|
535
|
-
var coreJsData = root['__core-js_shared__'];
|
|
536
|
-
|
|
537
|
-
/** Used to detect methods masquerading as native. */
|
|
538
|
-
var maskSrcKey = (function() {
|
|
539
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
540
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
541
|
-
}());
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Checks if `func` has its source masked.
|
|
545
|
-
*
|
|
546
|
-
* @private
|
|
547
|
-
* @param {Function} func The function to check.
|
|
548
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
549
|
-
*/
|
|
550
|
-
function isMasked(func) {
|
|
551
|
-
return !!maskSrcKey && (maskSrcKey in func);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
/** Used for built-in method references. */
|
|
555
|
-
var funcProto$1 = Function.prototype;
|
|
556
|
-
|
|
557
|
-
/** Used to resolve the decompiled source of functions. */
|
|
558
|
-
var funcToString$1 = funcProto$1.toString;
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Converts `func` to its source code.
|
|
562
|
-
*
|
|
563
|
-
* @private
|
|
564
|
-
* @param {Function} func The function to convert.
|
|
565
|
-
* @returns {string} Returns the source code.
|
|
566
|
-
*/
|
|
567
|
-
function toSource(func) {
|
|
568
|
-
if (func != null) {
|
|
569
|
-
try {
|
|
570
|
-
return funcToString$1.call(func);
|
|
571
|
-
} catch (e) {}
|
|
572
|
-
try {
|
|
573
|
-
return (func + '');
|
|
574
|
-
} catch (e) {}
|
|
575
|
-
}
|
|
576
|
-
return '';
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Used to match `RegExp`
|
|
581
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
582
|
-
*/
|
|
583
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
584
|
-
|
|
585
|
-
/** Used to detect host constructors (Safari). */
|
|
586
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
587
|
-
|
|
588
|
-
/** Used for built-in method references. */
|
|
589
|
-
var funcProto = Function.prototype,
|
|
590
|
-
objectProto$9 = Object.prototype;
|
|
591
|
-
|
|
592
|
-
/** Used to resolve the decompiled source of functions. */
|
|
593
|
-
var funcToString = funcProto.toString;
|
|
594
|
-
|
|
595
|
-
/** Used to check objects for own properties. */
|
|
596
|
-
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
597
|
-
|
|
598
|
-
/** Used to detect if a method is native. */
|
|
599
|
-
var reIsNative = RegExp('^' +
|
|
600
|
-
funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
|
|
601
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
602
|
-
);
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
606
|
-
*
|
|
607
|
-
* @private
|
|
608
|
-
* @param {*} value The value to check.
|
|
609
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
610
|
-
* else `false`.
|
|
611
|
-
*/
|
|
612
|
-
function baseIsNative(value) {
|
|
613
|
-
if (!isObject(value) || isMasked(value)) {
|
|
614
|
-
return false;
|
|
615
|
-
}
|
|
616
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
617
|
-
return pattern.test(toSource(value));
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* Gets the value at `key` of `object`.
|
|
622
|
-
*
|
|
623
|
-
* @private
|
|
624
|
-
* @param {Object} [object] The object to query.
|
|
625
|
-
* @param {string} key The key of the property to get.
|
|
626
|
-
* @returns {*} Returns the property value.
|
|
627
|
-
*/
|
|
628
|
-
function getValue(object, key) {
|
|
629
|
-
return object == null ? undefined : object[key];
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Gets the native function at `key` of `object`.
|
|
634
|
-
*
|
|
635
|
-
* @private
|
|
636
|
-
* @param {Object} object The object to query.
|
|
637
|
-
* @param {string} key The key of the method to get.
|
|
638
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
639
|
-
*/
|
|
640
|
-
function getNative(object, key) {
|
|
641
|
-
var value = getValue(object, key);
|
|
642
|
-
return baseIsNative(value) ? value : undefined;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/* Built-in method references that are verified to be native. */
|
|
646
|
-
var WeakMap = getNative(root, 'WeakMap');
|
|
647
|
-
|
|
648
|
-
/** Built-in value references. */
|
|
649
|
-
var objectCreate = Object.create;
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* The base implementation of `_.create` without support for assigning
|
|
653
|
-
* properties to the created object.
|
|
654
|
-
*
|
|
655
|
-
* @private
|
|
656
|
-
* @param {Object} proto The object to inherit from.
|
|
657
|
-
* @returns {Object} Returns the new object.
|
|
658
|
-
*/
|
|
659
|
-
var baseCreate = (function() {
|
|
660
|
-
function object() {}
|
|
661
|
-
return function(proto) {
|
|
662
|
-
if (!isObject(proto)) {
|
|
663
|
-
return {};
|
|
664
|
-
}
|
|
665
|
-
if (objectCreate) {
|
|
666
|
-
return objectCreate(proto);
|
|
667
|
-
}
|
|
668
|
-
object.prototype = proto;
|
|
669
|
-
var result = new object;
|
|
670
|
-
object.prototype = undefined;
|
|
671
|
-
return result;
|
|
672
|
-
};
|
|
673
|
-
}());
|
|
674
|
-
|
|
675
|
-
var defineProperty = (function() {
|
|
676
|
-
try {
|
|
677
|
-
var func = getNative(Object, 'defineProperty');
|
|
678
|
-
func({}, '', {});
|
|
679
|
-
return func;
|
|
680
|
-
} catch (e) {}
|
|
681
|
-
}());
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* A specialized version of `_.forEach` for arrays without support for
|
|
685
|
-
* iteratee shorthands.
|
|
686
|
-
*
|
|
687
|
-
* @private
|
|
688
|
-
* @param {Array} [array] The array to iterate over.
|
|
689
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
690
|
-
* @returns {Array} Returns `array`.
|
|
691
|
-
*/
|
|
692
|
-
function arrayEach(array, iteratee) {
|
|
693
|
-
var index = -1,
|
|
694
|
-
length = array == null ? 0 : array.length;
|
|
695
|
-
|
|
696
|
-
while (++index < length) {
|
|
697
|
-
if (iteratee(array[index], index, array) === false) {
|
|
698
|
-
break;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
return array;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
/** Used as references for various `Number` constants. */
|
|
705
|
-
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
706
|
-
|
|
707
|
-
/** Used to detect unsigned integer values. */
|
|
708
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* Checks if `value` is a valid array-like index.
|
|
712
|
-
*
|
|
713
|
-
* @private
|
|
714
|
-
* @param {*} value The value to check.
|
|
715
|
-
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
716
|
-
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
717
|
-
*/
|
|
718
|
-
function isIndex(value, length) {
|
|
719
|
-
var type = typeof value;
|
|
720
|
-
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
721
|
-
|
|
722
|
-
return !!length &&
|
|
723
|
-
(type == 'number' ||
|
|
724
|
-
(type != 'symbol' && reIsUint.test(value))) &&
|
|
725
|
-
(value > -1 && value % 1 == 0 && value < length);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
730
|
-
* value checks.
|
|
731
|
-
*
|
|
732
|
-
* @private
|
|
733
|
-
* @param {Object} object The object to modify.
|
|
734
|
-
* @param {string} key The key of the property to assign.
|
|
735
|
-
* @param {*} value The value to assign.
|
|
736
|
-
*/
|
|
737
|
-
function baseAssignValue(object, key, value) {
|
|
738
|
-
if (key == '__proto__' && defineProperty) {
|
|
739
|
-
defineProperty(object, key, {
|
|
740
|
-
'configurable': true,
|
|
741
|
-
'enumerable': true,
|
|
742
|
-
'value': value,
|
|
743
|
-
'writable': true
|
|
744
|
-
});
|
|
745
|
-
} else {
|
|
746
|
-
object[key] = value;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* Performs a
|
|
752
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
753
|
-
* comparison between two values to determine if they are equivalent.
|
|
754
|
-
*
|
|
755
|
-
* @static
|
|
756
|
-
* @memberOf _
|
|
757
|
-
* @since 4.0.0
|
|
758
|
-
* @category Lang
|
|
759
|
-
* @param {*} value The value to compare.
|
|
760
|
-
* @param {*} other The other value to compare.
|
|
761
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
762
|
-
* @example
|
|
763
|
-
*
|
|
764
|
-
* var object = { 'a': 1 };
|
|
765
|
-
* var other = { 'a': 1 };
|
|
766
|
-
*
|
|
767
|
-
* _.eq(object, object);
|
|
768
|
-
* // => true
|
|
769
|
-
*
|
|
770
|
-
* _.eq(object, other);
|
|
771
|
-
* // => false
|
|
772
|
-
*
|
|
773
|
-
* _.eq('a', 'a');
|
|
774
|
-
* // => true
|
|
775
|
-
*
|
|
776
|
-
* _.eq('a', Object('a'));
|
|
777
|
-
* // => false
|
|
778
|
-
*
|
|
779
|
-
* _.eq(NaN, NaN);
|
|
780
|
-
* // => true
|
|
781
|
-
*/
|
|
782
|
-
function eq(value, other) {
|
|
783
|
-
return value === other || (value !== value && other !== other);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
/** Used for built-in method references. */
|
|
787
|
-
var objectProto$8 = Object.prototype;
|
|
788
|
-
|
|
789
|
-
/** Used to check objects for own properties. */
|
|
790
|
-
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
794
|
-
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
795
|
-
* for equality comparisons.
|
|
796
|
-
*
|
|
797
|
-
* @private
|
|
798
|
-
* @param {Object} object The object to modify.
|
|
799
|
-
* @param {string} key The key of the property to assign.
|
|
800
|
-
* @param {*} value The value to assign.
|
|
801
|
-
*/
|
|
802
|
-
function assignValue(object, key, value) {
|
|
803
|
-
var objValue = object[key];
|
|
804
|
-
if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) ||
|
|
805
|
-
(value === undefined && !(key in object))) {
|
|
806
|
-
baseAssignValue(object, key, value);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
/** Used as references for various `Number` constants. */
|
|
811
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* Checks if `value` is a valid array-like length.
|
|
815
|
-
*
|
|
816
|
-
* **Note:** This method is loosely based on
|
|
817
|
-
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
818
|
-
*
|
|
819
|
-
* @static
|
|
820
|
-
* @memberOf _
|
|
821
|
-
* @since 4.0.0
|
|
822
|
-
* @category Lang
|
|
823
|
-
* @param {*} value The value to check.
|
|
824
|
-
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
825
|
-
* @example
|
|
826
|
-
*
|
|
827
|
-
* _.isLength(3);
|
|
828
|
-
* // => true
|
|
829
|
-
*
|
|
830
|
-
* _.isLength(Number.MIN_VALUE);
|
|
831
|
-
* // => false
|
|
832
|
-
*
|
|
833
|
-
* _.isLength(Infinity);
|
|
834
|
-
* // => false
|
|
835
|
-
*
|
|
836
|
-
* _.isLength('3');
|
|
837
|
-
* // => false
|
|
838
|
-
*/
|
|
839
|
-
function isLength(value) {
|
|
840
|
-
return typeof value == 'number' &&
|
|
841
|
-
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
846
|
-
* not a function and has a `value.length` that's an integer greater than or
|
|
847
|
-
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
848
|
-
*
|
|
849
|
-
* @static
|
|
850
|
-
* @memberOf _
|
|
851
|
-
* @since 4.0.0
|
|
852
|
-
* @category Lang
|
|
853
|
-
* @param {*} value The value to check.
|
|
854
|
-
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
855
|
-
* @example
|
|
856
|
-
*
|
|
857
|
-
* _.isArrayLike([1, 2, 3]);
|
|
858
|
-
* // => true
|
|
859
|
-
*
|
|
860
|
-
* _.isArrayLike(document.body.children);
|
|
861
|
-
* // => true
|
|
862
|
-
*
|
|
863
|
-
* _.isArrayLike('abc');
|
|
864
|
-
* // => true
|
|
865
|
-
*
|
|
866
|
-
* _.isArrayLike(_.noop);
|
|
867
|
-
* // => false
|
|
868
|
-
*/
|
|
869
|
-
function isArrayLike(value) {
|
|
870
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
/** Used for built-in method references. */
|
|
874
|
-
var objectProto$7 = Object.prototype;
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Checks if `value` is likely a prototype object.
|
|
878
|
-
*
|
|
879
|
-
* @private
|
|
880
|
-
* @param {*} value The value to check.
|
|
881
|
-
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
882
|
-
*/
|
|
883
|
-
function isPrototype(value) {
|
|
884
|
-
var Ctor = value && value.constructor,
|
|
885
|
-
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$7;
|
|
886
|
-
|
|
887
|
-
return value === proto;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* The base implementation of `_.times` without support for iteratee shorthands
|
|
892
|
-
* or max array length checks.
|
|
893
|
-
*
|
|
894
|
-
* @private
|
|
895
|
-
* @param {number} n The number of times to invoke `iteratee`.
|
|
896
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
897
|
-
* @returns {Array} Returns the array of results.
|
|
898
|
-
*/
|
|
899
|
-
function baseTimes(n, iteratee) {
|
|
900
|
-
var index = -1,
|
|
901
|
-
result = Array(n);
|
|
902
|
-
|
|
903
|
-
while (++index < n) {
|
|
904
|
-
result[index] = iteratee(index);
|
|
905
|
-
}
|
|
906
|
-
return result;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/** `Object#toString` result references. */
|
|
910
|
-
var argsTag$2 = '[object Arguments]';
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
* The base implementation of `_.isArguments`.
|
|
914
|
-
*
|
|
915
|
-
* @private
|
|
916
|
-
* @param {*} value The value to check.
|
|
917
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
918
|
-
*/
|
|
919
|
-
function baseIsArguments(value) {
|
|
920
|
-
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/** Used for built-in method references. */
|
|
924
|
-
var objectProto$6 = Object.prototype;
|
|
925
|
-
|
|
926
|
-
/** Used to check objects for own properties. */
|
|
927
|
-
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
928
|
-
|
|
929
|
-
/** Built-in value references. */
|
|
930
|
-
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
* Checks if `value` is likely an `arguments` object.
|
|
934
|
-
*
|
|
935
|
-
* @static
|
|
936
|
-
* @memberOf _
|
|
937
|
-
* @since 0.1.0
|
|
938
|
-
* @category Lang
|
|
939
|
-
* @param {*} value The value to check.
|
|
940
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
941
|
-
* else `false`.
|
|
942
|
-
* @example
|
|
943
|
-
*
|
|
944
|
-
* _.isArguments(function() { return arguments; }());
|
|
945
|
-
* // => true
|
|
946
|
-
*
|
|
947
|
-
* _.isArguments([1, 2, 3]);
|
|
948
|
-
* // => false
|
|
949
|
-
*/
|
|
950
|
-
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
951
|
-
return isObjectLike(value) && hasOwnProperty$5.call(value, 'callee') &&
|
|
952
|
-
!propertyIsEnumerable$1.call(value, 'callee');
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* This method returns `false`.
|
|
957
|
-
*
|
|
958
|
-
* @static
|
|
959
|
-
* @memberOf _
|
|
960
|
-
* @since 4.13.0
|
|
961
|
-
* @category Util
|
|
962
|
-
* @returns {boolean} Returns `false`.
|
|
963
|
-
* @example
|
|
964
|
-
*
|
|
965
|
-
* _.times(2, _.stubFalse);
|
|
966
|
-
* // => [false, false]
|
|
967
|
-
*/
|
|
968
|
-
function stubFalse() {
|
|
969
|
-
return false;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
/** Detect free variable `exports`. */
|
|
973
|
-
var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
974
|
-
|
|
975
|
-
/** Detect free variable `module`. */
|
|
976
|
-
var freeModule$1 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
|
|
977
|
-
|
|
978
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
979
|
-
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$2;
|
|
980
|
-
|
|
981
|
-
/** Built-in value references. */
|
|
982
|
-
var Buffer = moduleExports$1 ? root.Buffer : undefined;
|
|
983
|
-
|
|
984
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
985
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Checks if `value` is a buffer.
|
|
989
|
-
*
|
|
990
|
-
* @static
|
|
991
|
-
* @memberOf _
|
|
992
|
-
* @since 4.3.0
|
|
993
|
-
* @category Lang
|
|
994
|
-
* @param {*} value The value to check.
|
|
995
|
-
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
996
|
-
* @example
|
|
997
|
-
*
|
|
998
|
-
* _.isBuffer(new Buffer(2));
|
|
999
|
-
* // => true
|
|
1000
|
-
*
|
|
1001
|
-
* _.isBuffer(new Uint8Array(2));
|
|
1002
|
-
* // => false
|
|
1003
|
-
*/
|
|
1004
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1005
|
-
|
|
1006
|
-
/** `Object#toString` result references. */
|
|
1007
|
-
var argsTag$1 = '[object Arguments]',
|
|
1008
|
-
arrayTag$1 = '[object Array]',
|
|
1009
|
-
boolTag$2 = '[object Boolean]',
|
|
1010
|
-
dateTag$2 = '[object Date]',
|
|
1011
|
-
errorTag$1 = '[object Error]',
|
|
1012
|
-
funcTag$1 = '[object Function]',
|
|
1013
|
-
mapTag$4 = '[object Map]',
|
|
1014
|
-
numberTag$2 = '[object Number]',
|
|
1015
|
-
objectTag$2 = '[object Object]',
|
|
1016
|
-
regexpTag$2 = '[object RegExp]',
|
|
1017
|
-
setTag$4 = '[object Set]',
|
|
1018
|
-
stringTag$2 = '[object String]',
|
|
1019
|
-
weakMapTag$2 = '[object WeakMap]';
|
|
1020
|
-
|
|
1021
|
-
var arrayBufferTag$2 = '[object ArrayBuffer]',
|
|
1022
|
-
dataViewTag$3 = '[object DataView]',
|
|
1023
|
-
float32Tag$2 = '[object Float32Array]',
|
|
1024
|
-
float64Tag$2 = '[object Float64Array]',
|
|
1025
|
-
int8Tag$2 = '[object Int8Array]',
|
|
1026
|
-
int16Tag$2 = '[object Int16Array]',
|
|
1027
|
-
int32Tag$2 = '[object Int32Array]',
|
|
1028
|
-
uint8Tag$2 = '[object Uint8Array]',
|
|
1029
|
-
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
|
|
1030
|
-
uint16Tag$2 = '[object Uint16Array]',
|
|
1031
|
-
uint32Tag$2 = '[object Uint32Array]';
|
|
1032
|
-
|
|
1033
|
-
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1034
|
-
var typedArrayTags = {};
|
|
1035
|
-
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
|
|
1036
|
-
typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
|
|
1037
|
-
typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
|
|
1038
|
-
typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
|
|
1039
|
-
typedArrayTags[uint32Tag$2] = true;
|
|
1040
|
-
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1041
|
-
typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
|
|
1042
|
-
typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
|
|
1043
|
-
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
|
|
1044
|
-
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
|
|
1045
|
-
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] =
|
|
1046
|
-
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
|
|
1047
|
-
typedArrayTags[weakMapTag$2] = false;
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1051
|
-
*
|
|
1052
|
-
* @private
|
|
1053
|
-
* @param {*} value The value to check.
|
|
1054
|
-
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1055
|
-
*/
|
|
1056
|
-
function baseIsTypedArray(value) {
|
|
1057
|
-
return isObjectLike(value) &&
|
|
1058
|
-
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
* The base implementation of `_.unary` without support for storing metadata.
|
|
1063
|
-
*
|
|
1064
|
-
* @private
|
|
1065
|
-
* @param {Function} func The function to cap arguments for.
|
|
1066
|
-
* @returns {Function} Returns the new capped function.
|
|
1067
|
-
*/
|
|
1068
|
-
function baseUnary(func) {
|
|
1069
|
-
return function(value) {
|
|
1070
|
-
return func(value);
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
/** Detect free variable `exports`. */
|
|
1075
|
-
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1076
|
-
|
|
1077
|
-
/** Detect free variable `module`. */
|
|
1078
|
-
var freeModule = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
1079
|
-
|
|
1080
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1081
|
-
var moduleExports = freeModule && freeModule.exports === freeExports$1;
|
|
1082
|
-
|
|
1083
|
-
/** Detect free variable `process` from Node.js. */
|
|
1084
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
1085
|
-
|
|
1086
|
-
/** Used to access faster Node.js helpers. */
|
|
1087
|
-
var nodeUtil = (function() {
|
|
1088
|
-
try {
|
|
1089
|
-
// Use `util.types` for Node.js 10+.
|
|
1090
|
-
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1091
|
-
|
|
1092
|
-
if (types) {
|
|
1093
|
-
return types;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1097
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1098
|
-
} catch (e) {}
|
|
1099
|
-
}());
|
|
1100
|
-
|
|
1101
|
-
/* Node.js helper references. */
|
|
1102
|
-
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1103
|
-
|
|
1104
|
-
/**
|
|
1105
|
-
* Checks if `value` is classified as a typed array.
|
|
1106
|
-
*
|
|
1107
|
-
* @static
|
|
1108
|
-
* @memberOf _
|
|
1109
|
-
* @since 3.0.0
|
|
1110
|
-
* @category Lang
|
|
1111
|
-
* @param {*} value The value to check.
|
|
1112
|
-
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1113
|
-
* @example
|
|
1114
|
-
*
|
|
1115
|
-
* _.isTypedArray(new Uint8Array);
|
|
1116
|
-
* // => true
|
|
1117
|
-
*
|
|
1118
|
-
* _.isTypedArray([]);
|
|
1119
|
-
* // => false
|
|
1120
|
-
*/
|
|
1121
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1122
|
-
|
|
1123
|
-
/** Used for built-in method references. */
|
|
1124
|
-
var objectProto$5 = Object.prototype;
|
|
1125
|
-
|
|
1126
|
-
/** Used to check objects for own properties. */
|
|
1127
|
-
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1128
|
-
|
|
1129
|
-
/**
|
|
1130
|
-
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1131
|
-
*
|
|
1132
|
-
* @private
|
|
1133
|
-
* @param {*} value The value to query.
|
|
1134
|
-
* @param {boolean} inherited Specify returning inherited property names.
|
|
1135
|
-
* @returns {Array} Returns the array of property names.
|
|
1136
|
-
*/
|
|
1137
|
-
function arrayLikeKeys(value, inherited) {
|
|
1138
|
-
var isArr = isArray(value),
|
|
1139
|
-
isArg = !isArr && isArguments(value),
|
|
1140
|
-
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1141
|
-
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1142
|
-
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1143
|
-
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1144
|
-
length = result.length;
|
|
1145
|
-
|
|
1146
|
-
for (var key in value) {
|
|
1147
|
-
if ((hasOwnProperty$4.call(value, key)) &&
|
|
1148
|
-
!(skipIndexes && (
|
|
1149
|
-
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1150
|
-
key == 'length' ||
|
|
1151
|
-
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1152
|
-
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1153
|
-
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1154
|
-
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1155
|
-
// Skip index properties.
|
|
1156
|
-
isIndex(key, length)
|
|
1157
|
-
))) {
|
|
1158
|
-
result.push(key);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return result;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
/**
|
|
1165
|
-
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1166
|
-
*
|
|
1167
|
-
* @private
|
|
1168
|
-
* @param {Function} func The function to wrap.
|
|
1169
|
-
* @param {Function} transform The argument transform.
|
|
1170
|
-
* @returns {Function} Returns the new function.
|
|
1171
|
-
*/
|
|
1172
|
-
function overArg(func, transform) {
|
|
1173
|
-
return function(arg) {
|
|
1174
|
-
return func(transform(arg));
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1179
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
1180
|
-
|
|
1181
|
-
/** Used for built-in method references. */
|
|
1182
|
-
var objectProto$4 = Object.prototype;
|
|
1183
|
-
|
|
1184
|
-
/** Used to check objects for own properties. */
|
|
1185
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1189
|
-
*
|
|
1190
|
-
* @private
|
|
1191
|
-
* @param {Object} object The object to query.
|
|
1192
|
-
* @returns {Array} Returns the array of property names.
|
|
1193
|
-
*/
|
|
1194
|
-
function baseKeys(object) {
|
|
1195
|
-
if (!isPrototype(object)) {
|
|
1196
|
-
return nativeKeys(object);
|
|
1197
|
-
}
|
|
1198
|
-
var result = [];
|
|
1199
|
-
for (var key in Object(object)) {
|
|
1200
|
-
if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
|
|
1201
|
-
result.push(key);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
return result;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
/**
|
|
1208
|
-
* Creates an array of the own enumerable property names of `object`.
|
|
1209
|
-
*
|
|
1210
|
-
* **Note:** Non-object values are coerced to objects. See the
|
|
1211
|
-
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1212
|
-
* for more details.
|
|
1213
|
-
*
|
|
1214
|
-
* @static
|
|
1215
|
-
* @since 0.1.0
|
|
1216
|
-
* @memberOf _
|
|
1217
|
-
* @category Object
|
|
1218
|
-
* @param {Object} object The object to query.
|
|
1219
|
-
* @returns {Array} Returns the array of property names.
|
|
1220
|
-
* @example
|
|
1221
|
-
*
|
|
1222
|
-
* function Foo() {
|
|
1223
|
-
* this.a = 1;
|
|
1224
|
-
* this.b = 2;
|
|
1225
|
-
* }
|
|
1226
|
-
*
|
|
1227
|
-
* Foo.prototype.c = 3;
|
|
1228
|
-
*
|
|
1229
|
-
* _.keys(new Foo);
|
|
1230
|
-
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1231
|
-
*
|
|
1232
|
-
* _.keys('hi');
|
|
1233
|
-
* // => ['0', '1']
|
|
1234
|
-
*/
|
|
1235
|
-
function keys(object) {
|
|
1236
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
/* Built-in method references that are verified to be native. */
|
|
1240
|
-
var nativeCreate = getNative(Object, 'create');
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* Removes all key-value entries from the hash.
|
|
1244
|
-
*
|
|
1245
|
-
* @private
|
|
1246
|
-
* @name clear
|
|
1247
|
-
* @memberOf Hash
|
|
1248
|
-
*/
|
|
1249
|
-
function hashClear() {
|
|
1250
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1251
|
-
this.size = 0;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* Removes `key` and its value from the hash.
|
|
1256
|
-
*
|
|
1257
|
-
* @private
|
|
1258
|
-
* @name delete
|
|
1259
|
-
* @memberOf Hash
|
|
1260
|
-
* @param {Object} hash The hash to modify.
|
|
1261
|
-
* @param {string} key The key of the value to remove.
|
|
1262
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1263
|
-
*/
|
|
1264
|
-
function hashDelete(key) {
|
|
1265
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1266
|
-
this.size -= result ? 1 : 0;
|
|
1267
|
-
return result;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1271
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1272
|
-
|
|
1273
|
-
/** Used for built-in method references. */
|
|
1274
|
-
var objectProto$3 = Object.prototype;
|
|
1275
|
-
|
|
1276
|
-
/** Used to check objects for own properties. */
|
|
1277
|
-
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
* Gets the hash value for `key`.
|
|
1281
|
-
*
|
|
1282
|
-
* @private
|
|
1283
|
-
* @name get
|
|
1284
|
-
* @memberOf Hash
|
|
1285
|
-
* @param {string} key The key of the value to get.
|
|
1286
|
-
* @returns {*} Returns the entry value.
|
|
1287
|
-
*/
|
|
1288
|
-
function hashGet(key) {
|
|
1289
|
-
var data = this.__data__;
|
|
1290
|
-
if (nativeCreate) {
|
|
1291
|
-
var result = data[key];
|
|
1292
|
-
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1293
|
-
}
|
|
1294
|
-
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
/** Used for built-in method references. */
|
|
1298
|
-
var objectProto$2 = Object.prototype;
|
|
1299
|
-
|
|
1300
|
-
/** Used to check objects for own properties. */
|
|
1301
|
-
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* Checks if a hash value for `key` exists.
|
|
1305
|
-
*
|
|
1306
|
-
* @private
|
|
1307
|
-
* @name has
|
|
1308
|
-
* @memberOf Hash
|
|
1309
|
-
* @param {string} key The key of the entry to check.
|
|
1310
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1311
|
-
*/
|
|
1312
|
-
function hashHas(key) {
|
|
1313
|
-
var data = this.__data__;
|
|
1314
|
-
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$1.call(data, key);
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1318
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Sets the hash `key` to `value`.
|
|
1322
|
-
*
|
|
1323
|
-
* @private
|
|
1324
|
-
* @name set
|
|
1325
|
-
* @memberOf Hash
|
|
1326
|
-
* @param {string} key The key of the value to set.
|
|
1327
|
-
* @param {*} value The value to set.
|
|
1328
|
-
* @returns {Object} Returns the hash instance.
|
|
1329
|
-
*/
|
|
1330
|
-
function hashSet(key, value) {
|
|
1331
|
-
var data = this.__data__;
|
|
1332
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1333
|
-
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1334
|
-
return this;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
/**
|
|
1338
|
-
* Creates a hash object.
|
|
1339
|
-
*
|
|
1340
|
-
* @private
|
|
1341
|
-
* @constructor
|
|
1342
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1343
|
-
*/
|
|
1344
|
-
function Hash(entries) {
|
|
1345
|
-
var index = -1,
|
|
1346
|
-
length = entries == null ? 0 : entries.length;
|
|
1347
|
-
|
|
1348
|
-
this.clear();
|
|
1349
|
-
while (++index < length) {
|
|
1350
|
-
var entry = entries[index];
|
|
1351
|
-
this.set(entry[0], entry[1]);
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
// Add methods to `Hash`.
|
|
1356
|
-
Hash.prototype.clear = hashClear;
|
|
1357
|
-
Hash.prototype['delete'] = hashDelete;
|
|
1358
|
-
Hash.prototype.get = hashGet;
|
|
1359
|
-
Hash.prototype.has = hashHas;
|
|
1360
|
-
Hash.prototype.set = hashSet;
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* Removes all key-value entries from the list cache.
|
|
1364
|
-
*
|
|
1365
|
-
* @private
|
|
1366
|
-
* @name clear
|
|
1367
|
-
* @memberOf ListCache
|
|
1368
|
-
*/
|
|
1369
|
-
function listCacheClear() {
|
|
1370
|
-
this.__data__ = [];
|
|
1371
|
-
this.size = 0;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
/**
|
|
1375
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1376
|
-
*
|
|
1377
|
-
* @private
|
|
1378
|
-
* @param {Array} array The array to inspect.
|
|
1379
|
-
* @param {*} key The key to search for.
|
|
1380
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1381
|
-
*/
|
|
1382
|
-
function assocIndexOf(array, key) {
|
|
1383
|
-
var length = array.length;
|
|
1384
|
-
while (length--) {
|
|
1385
|
-
if (eq(array[length][0], key)) {
|
|
1386
|
-
return length;
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
return -1;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
/** Used for built-in method references. */
|
|
1393
|
-
var arrayProto = Array.prototype;
|
|
1394
|
-
|
|
1395
|
-
/** Built-in value references. */
|
|
1396
|
-
var splice = arrayProto.splice;
|
|
1397
|
-
|
|
1398
|
-
/**
|
|
1399
|
-
* Removes `key` and its value from the list cache.
|
|
1400
|
-
*
|
|
1401
|
-
* @private
|
|
1402
|
-
* @name delete
|
|
1403
|
-
* @memberOf ListCache
|
|
1404
|
-
* @param {string} key The key of the value to remove.
|
|
1405
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1406
|
-
*/
|
|
1407
|
-
function listCacheDelete(key) {
|
|
1408
|
-
var data = this.__data__,
|
|
1409
|
-
index = assocIndexOf(data, key);
|
|
1410
|
-
|
|
1411
|
-
if (index < 0) {
|
|
1412
|
-
return false;
|
|
1413
|
-
}
|
|
1414
|
-
var lastIndex = data.length - 1;
|
|
1415
|
-
if (index == lastIndex) {
|
|
1416
|
-
data.pop();
|
|
1417
|
-
} else {
|
|
1418
|
-
splice.call(data, index, 1);
|
|
1419
|
-
}
|
|
1420
|
-
--this.size;
|
|
1421
|
-
return true;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
/**
|
|
1425
|
-
* Gets the list cache value for `key`.
|
|
1426
|
-
*
|
|
1427
|
-
* @private
|
|
1428
|
-
* @name get
|
|
1429
|
-
* @memberOf ListCache
|
|
1430
|
-
* @param {string} key The key of the value to get.
|
|
1431
|
-
* @returns {*} Returns the entry value.
|
|
1432
|
-
*/
|
|
1433
|
-
function listCacheGet(key) {
|
|
1434
|
-
var data = this.__data__,
|
|
1435
|
-
index = assocIndexOf(data, key);
|
|
1436
|
-
|
|
1437
|
-
return index < 0 ? undefined : data[index][1];
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* Checks if a list cache value for `key` exists.
|
|
1442
|
-
*
|
|
1443
|
-
* @private
|
|
1444
|
-
* @name has
|
|
1445
|
-
* @memberOf ListCache
|
|
1446
|
-
* @param {string} key The key of the entry to check.
|
|
1447
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1448
|
-
*/
|
|
1449
|
-
function listCacheHas(key) {
|
|
1450
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
/**
|
|
1454
|
-
* Sets the list cache `key` to `value`.
|
|
1455
|
-
*
|
|
1456
|
-
* @private
|
|
1457
|
-
* @name set
|
|
1458
|
-
* @memberOf ListCache
|
|
1459
|
-
* @param {string} key The key of the value to set.
|
|
1460
|
-
* @param {*} value The value to set.
|
|
1461
|
-
* @returns {Object} Returns the list cache instance.
|
|
1462
|
-
*/
|
|
1463
|
-
function listCacheSet(key, value) {
|
|
1464
|
-
var data = this.__data__,
|
|
1465
|
-
index = assocIndexOf(data, key);
|
|
1466
|
-
|
|
1467
|
-
if (index < 0) {
|
|
1468
|
-
++this.size;
|
|
1469
|
-
data.push([key, value]);
|
|
1470
|
-
} else {
|
|
1471
|
-
data[index][1] = value;
|
|
1472
|
-
}
|
|
1473
|
-
return this;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
/**
|
|
1477
|
-
* Creates an list cache object.
|
|
1478
|
-
*
|
|
1479
|
-
* @private
|
|
1480
|
-
* @constructor
|
|
1481
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1482
|
-
*/
|
|
1483
|
-
function ListCache(entries) {
|
|
1484
|
-
var index = -1,
|
|
1485
|
-
length = entries == null ? 0 : entries.length;
|
|
1486
|
-
|
|
1487
|
-
this.clear();
|
|
1488
|
-
while (++index < length) {
|
|
1489
|
-
var entry = entries[index];
|
|
1490
|
-
this.set(entry[0], entry[1]);
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
// Add methods to `ListCache`.
|
|
1495
|
-
ListCache.prototype.clear = listCacheClear;
|
|
1496
|
-
ListCache.prototype['delete'] = listCacheDelete;
|
|
1497
|
-
ListCache.prototype.get = listCacheGet;
|
|
1498
|
-
ListCache.prototype.has = listCacheHas;
|
|
1499
|
-
ListCache.prototype.set = listCacheSet;
|
|
1500
|
-
|
|
1501
|
-
/* Built-in method references that are verified to be native. */
|
|
1502
|
-
var Map$1 = getNative(root, 'Map');
|
|
1503
|
-
|
|
1504
|
-
/**
|
|
1505
|
-
* Removes all key-value entries from the map.
|
|
1506
|
-
*
|
|
1507
|
-
* @private
|
|
1508
|
-
* @name clear
|
|
1509
|
-
* @memberOf MapCache
|
|
1510
|
-
*/
|
|
1511
|
-
function mapCacheClear() {
|
|
1512
|
-
this.size = 0;
|
|
1513
|
-
this.__data__ = {
|
|
1514
|
-
'hash': new Hash,
|
|
1515
|
-
'map': new (Map$1 || ListCache),
|
|
1516
|
-
'string': new Hash
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
1522
|
-
*
|
|
1523
|
-
* @private
|
|
1524
|
-
* @param {*} value The value to check.
|
|
1525
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1526
|
-
*/
|
|
1527
|
-
function isKeyable(value) {
|
|
1528
|
-
var type = typeof value;
|
|
1529
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1530
|
-
? (value !== '__proto__')
|
|
1531
|
-
: (value === null);
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
/**
|
|
1535
|
-
* Gets the data for `map`.
|
|
1536
|
-
*
|
|
1537
|
-
* @private
|
|
1538
|
-
* @param {Object} map The map to query.
|
|
1539
|
-
* @param {string} key The reference key.
|
|
1540
|
-
* @returns {*} Returns the map data.
|
|
1541
|
-
*/
|
|
1542
|
-
function getMapData(map, key) {
|
|
1543
|
-
var data = map.__data__;
|
|
1544
|
-
return isKeyable(key)
|
|
1545
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1546
|
-
: data.map;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
/**
|
|
1550
|
-
* Removes `key` and its value from the map.
|
|
1551
|
-
*
|
|
1552
|
-
* @private
|
|
1553
|
-
* @name delete
|
|
1554
|
-
* @memberOf MapCache
|
|
1555
|
-
* @param {string} key The key of the value to remove.
|
|
1556
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1557
|
-
*/
|
|
1558
|
-
function mapCacheDelete(key) {
|
|
1559
|
-
var result = getMapData(this, key)['delete'](key);
|
|
1560
|
-
this.size -= result ? 1 : 0;
|
|
1561
|
-
return result;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
/**
|
|
1565
|
-
* Gets the map value for `key`.
|
|
1566
|
-
*
|
|
1567
|
-
* @private
|
|
1568
|
-
* @name get
|
|
1569
|
-
* @memberOf MapCache
|
|
1570
|
-
* @param {string} key The key of the value to get.
|
|
1571
|
-
* @returns {*} Returns the entry value.
|
|
1572
|
-
*/
|
|
1573
|
-
function mapCacheGet(key) {
|
|
1574
|
-
return getMapData(this, key).get(key);
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
/**
|
|
1578
|
-
* Checks if a map value for `key` exists.
|
|
1579
|
-
*
|
|
1580
|
-
* @private
|
|
1581
|
-
* @name has
|
|
1582
|
-
* @memberOf MapCache
|
|
1583
|
-
* @param {string} key The key of the entry to check.
|
|
1584
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1585
|
-
*/
|
|
1586
|
-
function mapCacheHas(key) {
|
|
1587
|
-
return getMapData(this, key).has(key);
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
/**
|
|
1591
|
-
* Sets the map `key` to `value`.
|
|
1592
|
-
*
|
|
1593
|
-
* @private
|
|
1594
|
-
* @name set
|
|
1595
|
-
* @memberOf MapCache
|
|
1596
|
-
* @param {string} key The key of the value to set.
|
|
1597
|
-
* @param {*} value The value to set.
|
|
1598
|
-
* @returns {Object} Returns the map cache instance.
|
|
1599
|
-
*/
|
|
1600
|
-
function mapCacheSet(key, value) {
|
|
1601
|
-
var data = getMapData(this, key),
|
|
1602
|
-
size = data.size;
|
|
1603
|
-
|
|
1604
|
-
data.set(key, value);
|
|
1605
|
-
this.size += data.size == size ? 0 : 1;
|
|
1606
|
-
return this;
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
/**
|
|
1610
|
-
* Creates a map cache object to store key-value pairs.
|
|
1611
|
-
*
|
|
1612
|
-
* @private
|
|
1613
|
-
* @constructor
|
|
1614
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1615
|
-
*/
|
|
1616
|
-
function MapCache(entries) {
|
|
1617
|
-
var index = -1,
|
|
1618
|
-
length = entries == null ? 0 : entries.length;
|
|
1619
|
-
|
|
1620
|
-
this.clear();
|
|
1621
|
-
while (++index < length) {
|
|
1622
|
-
var entry = entries[index];
|
|
1623
|
-
this.set(entry[0], entry[1]);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
// Add methods to `MapCache`.
|
|
1628
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
1629
|
-
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1630
|
-
MapCache.prototype.get = mapCacheGet;
|
|
1631
|
-
MapCache.prototype.has = mapCacheHas;
|
|
1632
|
-
MapCache.prototype.set = mapCacheSet;
|
|
1633
|
-
|
|
1634
|
-
/**
|
|
1635
|
-
* Appends the elements of `values` to `array`.
|
|
1636
|
-
*
|
|
1637
|
-
* @private
|
|
1638
|
-
* @param {Array} array The array to modify.
|
|
1639
|
-
* @param {Array} values The values to append.
|
|
1640
|
-
* @returns {Array} Returns `array`.
|
|
1641
|
-
*/
|
|
1642
|
-
function arrayPush(array, values) {
|
|
1643
|
-
var index = -1,
|
|
1644
|
-
length = values.length,
|
|
1645
|
-
offset = array.length;
|
|
1646
|
-
|
|
1647
|
-
while (++index < length) {
|
|
1648
|
-
array[offset + index] = values[index];
|
|
1649
|
-
}
|
|
1650
|
-
return array;
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
/** Built-in value references. */
|
|
1654
|
-
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Removes all key-value entries from the stack.
|
|
1658
|
-
*
|
|
1659
|
-
* @private
|
|
1660
|
-
* @name clear
|
|
1661
|
-
* @memberOf Stack
|
|
1662
|
-
*/
|
|
1663
|
-
function stackClear() {
|
|
1664
|
-
this.__data__ = new ListCache;
|
|
1665
|
-
this.size = 0;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Removes `key` and its value from the stack.
|
|
1670
|
-
*
|
|
1671
|
-
* @private
|
|
1672
|
-
* @name delete
|
|
1673
|
-
* @memberOf Stack
|
|
1674
|
-
* @param {string} key The key of the value to remove.
|
|
1675
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1676
|
-
*/
|
|
1677
|
-
function stackDelete(key) {
|
|
1678
|
-
var data = this.__data__,
|
|
1679
|
-
result = data['delete'](key);
|
|
1680
|
-
|
|
1681
|
-
this.size = data.size;
|
|
1682
|
-
return result;
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
/**
|
|
1686
|
-
* Gets the stack value for `key`.
|
|
1687
|
-
*
|
|
1688
|
-
* @private
|
|
1689
|
-
* @name get
|
|
1690
|
-
* @memberOf Stack
|
|
1691
|
-
* @param {string} key The key of the value to get.
|
|
1692
|
-
* @returns {*} Returns the entry value.
|
|
1693
|
-
*/
|
|
1694
|
-
function stackGet(key) {
|
|
1695
|
-
return this.__data__.get(key);
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
/**
|
|
1699
|
-
* Checks if a stack value for `key` exists.
|
|
1700
|
-
*
|
|
1701
|
-
* @private
|
|
1702
|
-
* @name has
|
|
1703
|
-
* @memberOf Stack
|
|
1704
|
-
* @param {string} key The key of the entry to check.
|
|
1705
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1706
|
-
*/
|
|
1707
|
-
function stackHas(key) {
|
|
1708
|
-
return this.__data__.has(key);
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
/** Used as the size to enable large array optimizations. */
|
|
1712
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
1713
|
-
|
|
1714
|
-
/**
|
|
1715
|
-
* Sets the stack `key` to `value`.
|
|
1716
|
-
*
|
|
1717
|
-
* @private
|
|
1718
|
-
* @name set
|
|
1719
|
-
* @memberOf Stack
|
|
1720
|
-
* @param {string} key The key of the value to set.
|
|
1721
|
-
* @param {*} value The value to set.
|
|
1722
|
-
* @returns {Object} Returns the stack cache instance.
|
|
1723
|
-
*/
|
|
1724
|
-
function stackSet(key, value) {
|
|
1725
|
-
var data = this.__data__;
|
|
1726
|
-
if (data instanceof ListCache) {
|
|
1727
|
-
var pairs = data.__data__;
|
|
1728
|
-
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1729
|
-
pairs.push([key, value]);
|
|
1730
|
-
this.size = ++data.size;
|
|
1731
|
-
return this;
|
|
1732
|
-
}
|
|
1733
|
-
data = this.__data__ = new MapCache(pairs);
|
|
1734
|
-
}
|
|
1735
|
-
data.set(key, value);
|
|
1736
|
-
this.size = data.size;
|
|
1737
|
-
return this;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
/**
|
|
1741
|
-
* Creates a stack cache object to store key-value pairs.
|
|
1742
|
-
*
|
|
1743
|
-
* @private
|
|
1744
|
-
* @constructor
|
|
1745
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1746
|
-
*/
|
|
1747
|
-
function Stack(entries) {
|
|
1748
|
-
var data = this.__data__ = new ListCache(entries);
|
|
1749
|
-
this.size = data.size;
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
// Add methods to `Stack`.
|
|
1753
|
-
Stack.prototype.clear = stackClear;
|
|
1754
|
-
Stack.prototype['delete'] = stackDelete;
|
|
1755
|
-
Stack.prototype.get = stackGet;
|
|
1756
|
-
Stack.prototype.has = stackHas;
|
|
1757
|
-
Stack.prototype.set = stackSet;
|
|
1758
|
-
|
|
1759
|
-
/** Detect free variable `exports`. */
|
|
1760
|
-
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1761
|
-
|
|
1762
|
-
/** Detect free variable `module`. */
|
|
1763
|
-
freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* Creates a clone of `buffer`.
|
|
1767
|
-
*
|
|
1768
|
-
* @private
|
|
1769
|
-
* @param {Buffer} buffer The buffer to clone.
|
|
1770
|
-
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1771
|
-
* @returns {Buffer} Returns the cloned buffer.
|
|
1772
|
-
*/
|
|
1773
|
-
function cloneBuffer(buffer, isDeep) {
|
|
1774
|
-
{
|
|
1775
|
-
return buffer.slice();
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
* A specialized version of `_.filter` for arrays without support for
|
|
1781
|
-
* iteratee shorthands.
|
|
1782
|
-
*
|
|
1783
|
-
* @private
|
|
1784
|
-
* @param {Array} [array] The array to iterate over.
|
|
1785
|
-
* @param {Function} predicate The function invoked per iteration.
|
|
1786
|
-
* @returns {Array} Returns the new filtered array.
|
|
1787
|
-
*/
|
|
1788
|
-
function arrayFilter(array, predicate) {
|
|
1789
|
-
var index = -1,
|
|
1790
|
-
length = array == null ? 0 : array.length,
|
|
1791
|
-
resIndex = 0,
|
|
1792
|
-
result = [];
|
|
1793
|
-
|
|
1794
|
-
while (++index < length) {
|
|
1795
|
-
var value = array[index];
|
|
1796
|
-
if (predicate(value, index, array)) {
|
|
1797
|
-
result[resIndex++] = value;
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
return result;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
/**
|
|
1804
|
-
* This method returns a new empty array.
|
|
1805
|
-
*
|
|
1806
|
-
* @static
|
|
1807
|
-
* @memberOf _
|
|
1808
|
-
* @since 4.13.0
|
|
1809
|
-
* @category Util
|
|
1810
|
-
* @returns {Array} Returns the new empty array.
|
|
1811
|
-
* @example
|
|
1812
|
-
*
|
|
1813
|
-
* var arrays = _.times(2, _.stubArray);
|
|
1814
|
-
*
|
|
1815
|
-
* console.log(arrays);
|
|
1816
|
-
* // => [[], []]
|
|
1817
|
-
*
|
|
1818
|
-
* console.log(arrays[0] === arrays[1]);
|
|
1819
|
-
* // => false
|
|
1820
|
-
*/
|
|
1821
|
-
function stubArray() {
|
|
1822
|
-
return [];
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
/** Used for built-in method references. */
|
|
1826
|
-
var objectProto$1 = Object.prototype;
|
|
1827
|
-
|
|
1828
|
-
/** Built-in value references. */
|
|
1829
|
-
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
1830
|
-
|
|
1831
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1832
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1833
|
-
|
|
1834
|
-
/**
|
|
1835
|
-
* Creates an array of the own enumerable symbols of `object`.
|
|
1836
|
-
*
|
|
1837
|
-
* @private
|
|
1838
|
-
* @param {Object} object The object to query.
|
|
1839
|
-
* @returns {Array} Returns the array of symbols.
|
|
1840
|
-
*/
|
|
1841
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1842
|
-
if (object == null) {
|
|
1843
|
-
return [];
|
|
1844
|
-
}
|
|
1845
|
-
object = Object(object);
|
|
1846
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1847
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
1848
|
-
});
|
|
1849
|
-
};
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1852
|
-
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1853
|
-
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1854
|
-
* symbols of `object`.
|
|
1855
|
-
*
|
|
1856
|
-
* @private
|
|
1857
|
-
* @param {Object} object The object to query.
|
|
1858
|
-
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1859
|
-
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1860
|
-
* @returns {Array} Returns the array of property names and symbols.
|
|
1861
|
-
*/
|
|
1862
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1863
|
-
var result = keysFunc(object);
|
|
1864
|
-
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
/**
|
|
1868
|
-
* Creates an array of own enumerable property names and symbols of `object`.
|
|
1869
|
-
*
|
|
1870
|
-
* @private
|
|
1871
|
-
* @param {Object} object The object to query.
|
|
1872
|
-
* @returns {Array} Returns the array of property names and symbols.
|
|
1873
|
-
*/
|
|
1874
|
-
function getAllKeys(object) {
|
|
1875
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
/* Built-in method references that are verified to be native. */
|
|
1879
|
-
var DataView$1 = getNative(root, 'DataView');
|
|
1880
|
-
|
|
1881
|
-
/* Built-in method references that are verified to be native. */
|
|
1882
|
-
var Promise$1 = getNative(root, 'Promise');
|
|
1883
|
-
|
|
1884
|
-
/* Built-in method references that are verified to be native. */
|
|
1885
|
-
var Set$1 = getNative(root, 'Set');
|
|
1886
|
-
|
|
1887
|
-
/** `Object#toString` result references. */
|
|
1888
|
-
var mapTag$3 = '[object Map]',
|
|
1889
|
-
objectTag$1 = '[object Object]',
|
|
1890
|
-
promiseTag = '[object Promise]',
|
|
1891
|
-
setTag$3 = '[object Set]',
|
|
1892
|
-
weakMapTag$1 = '[object WeakMap]';
|
|
1893
|
-
|
|
1894
|
-
var dataViewTag$2 = '[object DataView]';
|
|
1895
|
-
|
|
1896
|
-
/** Used to detect maps, sets, and weakmaps. */
|
|
1897
|
-
var dataViewCtorString = toSource(DataView$1),
|
|
1898
|
-
mapCtorString = toSource(Map$1),
|
|
1899
|
-
promiseCtorString = toSource(Promise$1),
|
|
1900
|
-
setCtorString = toSource(Set$1),
|
|
1901
|
-
weakMapCtorString = toSource(WeakMap);
|
|
1902
|
-
|
|
1903
|
-
/**
|
|
1904
|
-
* Gets the `toStringTag` of `value`.
|
|
1905
|
-
*
|
|
1906
|
-
* @private
|
|
1907
|
-
* @param {*} value The value to query.
|
|
1908
|
-
* @returns {string} Returns the `toStringTag`.
|
|
1909
|
-
*/
|
|
1910
|
-
var getTag = baseGetTag;
|
|
1911
|
-
|
|
1912
|
-
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
1913
|
-
if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
1914
|
-
(Map$1 && getTag(new Map$1) != mapTag$3) ||
|
|
1915
|
-
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
1916
|
-
(Set$1 && getTag(new Set$1) != setTag$3) ||
|
|
1917
|
-
(WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
|
|
1918
|
-
getTag = function(value) {
|
|
1919
|
-
var result = baseGetTag(value),
|
|
1920
|
-
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
1921
|
-
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1922
|
-
|
|
1923
|
-
if (ctorString) {
|
|
1924
|
-
switch (ctorString) {
|
|
1925
|
-
case dataViewCtorString: return dataViewTag$2;
|
|
1926
|
-
case mapCtorString: return mapTag$3;
|
|
1927
|
-
case promiseCtorString: return promiseTag;
|
|
1928
|
-
case setCtorString: return setTag$3;
|
|
1929
|
-
case weakMapCtorString: return weakMapTag$1;
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
return result;
|
|
1933
|
-
};
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
/** Used for built-in method references. */
|
|
1937
|
-
var objectProto = Object.prototype;
|
|
1938
|
-
|
|
1939
|
-
/** Used to check objects for own properties. */
|
|
1940
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1941
|
-
|
|
1942
|
-
/**
|
|
1943
|
-
* Initializes an array clone.
|
|
1944
|
-
*
|
|
1945
|
-
* @private
|
|
1946
|
-
* @param {Array} array The array to clone.
|
|
1947
|
-
* @returns {Array} Returns the initialized clone.
|
|
1948
|
-
*/
|
|
1949
|
-
function initCloneArray(array) {
|
|
1950
|
-
var length = array.length,
|
|
1951
|
-
result = new array.constructor(length);
|
|
1952
|
-
|
|
1953
|
-
// Add properties assigned by `RegExp#exec`.
|
|
1954
|
-
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
|
1955
|
-
result.index = array.index;
|
|
1956
|
-
result.input = array.input;
|
|
1957
|
-
}
|
|
1958
|
-
return result;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
/** Built-in value references. */
|
|
1962
|
-
var Uint8Array$1 = root.Uint8Array;
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* Creates a clone of `arrayBuffer`.
|
|
1966
|
-
*
|
|
1967
|
-
* @private
|
|
1968
|
-
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
1969
|
-
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
1970
|
-
*/
|
|
1971
|
-
function cloneArrayBuffer(arrayBuffer) {
|
|
1972
|
-
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
1973
|
-
new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
|
|
1974
|
-
return result;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
/**
|
|
1978
|
-
* Creates a clone of `dataView`.
|
|
1979
|
-
*
|
|
1980
|
-
* @private
|
|
1981
|
-
* @param {Object} dataView The data view to clone.
|
|
1982
|
-
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1983
|
-
* @returns {Object} Returns the cloned data view.
|
|
1984
|
-
*/
|
|
1985
|
-
function cloneDataView(dataView, isDeep) {
|
|
1986
|
-
var buffer = cloneArrayBuffer(dataView.buffer) ;
|
|
1987
|
-
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
/** Used to match `RegExp` flags from their coerced string values. */
|
|
1991
|
-
var reFlags = /\w*$/;
|
|
1992
|
-
|
|
1993
|
-
/**
|
|
1994
|
-
* Creates a clone of `regexp`.
|
|
1995
|
-
*
|
|
1996
|
-
* @private
|
|
1997
|
-
* @param {Object} regexp The regexp to clone.
|
|
1998
|
-
* @returns {Object} Returns the cloned regexp.
|
|
1999
|
-
*/
|
|
2000
|
-
function cloneRegExp(regexp) {
|
|
2001
|
-
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2002
|
-
result.lastIndex = regexp.lastIndex;
|
|
2003
|
-
return result;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
/** Used to convert symbols to primitives and strings. */
|
|
2007
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
2008
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
2009
|
-
|
|
2010
|
-
/**
|
|
2011
|
-
* Creates a clone of the `symbol` object.
|
|
2012
|
-
*
|
|
2013
|
-
* @private
|
|
2014
|
-
* @param {Object} symbol The symbol object to clone.
|
|
2015
|
-
* @returns {Object} Returns the cloned symbol object.
|
|
2016
|
-
*/
|
|
2017
|
-
function cloneSymbol(symbol) {
|
|
2018
|
-
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
/**
|
|
2022
|
-
* Creates a clone of `typedArray`.
|
|
2023
|
-
*
|
|
2024
|
-
* @private
|
|
2025
|
-
* @param {Object} typedArray The typed array to clone.
|
|
2026
|
-
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2027
|
-
* @returns {Object} Returns the cloned typed array.
|
|
2028
|
-
*/
|
|
2029
|
-
function cloneTypedArray(typedArray, isDeep) {
|
|
2030
|
-
var buffer = cloneArrayBuffer(typedArray.buffer) ;
|
|
2031
|
-
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
/** `Object#toString` result references. */
|
|
2035
|
-
var boolTag$1 = '[object Boolean]',
|
|
2036
|
-
dateTag$1 = '[object Date]',
|
|
2037
|
-
mapTag$2 = '[object Map]',
|
|
2038
|
-
numberTag$1 = '[object Number]',
|
|
2039
|
-
regexpTag$1 = '[object RegExp]',
|
|
2040
|
-
setTag$2 = '[object Set]',
|
|
2041
|
-
stringTag$1 = '[object String]',
|
|
2042
|
-
symbolTag$1 = '[object Symbol]';
|
|
2043
|
-
|
|
2044
|
-
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
2045
|
-
dataViewTag$1 = '[object DataView]',
|
|
2046
|
-
float32Tag$1 = '[object Float32Array]',
|
|
2047
|
-
float64Tag$1 = '[object Float64Array]',
|
|
2048
|
-
int8Tag$1 = '[object Int8Array]',
|
|
2049
|
-
int16Tag$1 = '[object Int16Array]',
|
|
2050
|
-
int32Tag$1 = '[object Int32Array]',
|
|
2051
|
-
uint8Tag$1 = '[object Uint8Array]',
|
|
2052
|
-
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
|
|
2053
|
-
uint16Tag$1 = '[object Uint16Array]',
|
|
2054
|
-
uint32Tag$1 = '[object Uint32Array]';
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* Initializes an object clone based on its `toStringTag`.
|
|
2058
|
-
*
|
|
2059
|
-
* **Note:** This function only supports cloning values with tags of
|
|
2060
|
-
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
2061
|
-
*
|
|
2062
|
-
* @private
|
|
2063
|
-
* @param {Object} object The object to clone.
|
|
2064
|
-
* @param {string} tag The `toStringTag` of the object to clone.
|
|
2065
|
-
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2066
|
-
* @returns {Object} Returns the initialized clone.
|
|
2067
|
-
*/
|
|
2068
|
-
function initCloneByTag(object, tag, isDeep) {
|
|
2069
|
-
var Ctor = object.constructor;
|
|
2070
|
-
switch (tag) {
|
|
2071
|
-
case arrayBufferTag$1:
|
|
2072
|
-
return cloneArrayBuffer(object);
|
|
2073
|
-
|
|
2074
|
-
case boolTag$1:
|
|
2075
|
-
case dateTag$1:
|
|
2076
|
-
return new Ctor(+object);
|
|
2077
|
-
|
|
2078
|
-
case dataViewTag$1:
|
|
2079
|
-
return cloneDataView(object);
|
|
2080
|
-
|
|
2081
|
-
case float32Tag$1: case float64Tag$1:
|
|
2082
|
-
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2083
|
-
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2084
|
-
return cloneTypedArray(object);
|
|
2085
|
-
|
|
2086
|
-
case mapTag$2:
|
|
2087
|
-
return new Ctor;
|
|
2088
|
-
|
|
2089
|
-
case numberTag$1:
|
|
2090
|
-
case stringTag$1:
|
|
2091
|
-
return new Ctor(object);
|
|
2092
|
-
|
|
2093
|
-
case regexpTag$1:
|
|
2094
|
-
return cloneRegExp(object);
|
|
2095
|
-
|
|
2096
|
-
case setTag$2:
|
|
2097
|
-
return new Ctor;
|
|
2098
|
-
|
|
2099
|
-
case symbolTag$1:
|
|
2100
|
-
return cloneSymbol(object);
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
|
|
2104
|
-
/**
|
|
2105
|
-
* Initializes an object clone.
|
|
2106
|
-
*
|
|
2107
|
-
* @private
|
|
2108
|
-
* @param {Object} object The object to clone.
|
|
2109
|
-
* @returns {Object} Returns the initialized clone.
|
|
2110
|
-
*/
|
|
2111
|
-
function initCloneObject(object) {
|
|
2112
|
-
return (typeof object.constructor == 'function' && !isPrototype(object))
|
|
2113
|
-
? baseCreate(getPrototype(object))
|
|
2114
|
-
: {};
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
/** `Object#toString` result references. */
|
|
2118
|
-
var mapTag$1 = '[object Map]';
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
2122
|
-
*
|
|
2123
|
-
* @private
|
|
2124
|
-
* @param {*} value The value to check.
|
|
2125
|
-
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2126
|
-
*/
|
|
2127
|
-
function baseIsMap(value) {
|
|
2128
|
-
return isObjectLike(value) && getTag(value) == mapTag$1;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
/* Node.js helper references. */
|
|
2132
|
-
var nodeIsMap = nodeUtil && nodeUtil.isMap;
|
|
2133
|
-
|
|
2134
|
-
/**
|
|
2135
|
-
* Checks if `value` is classified as a `Map` object.
|
|
2136
|
-
*
|
|
2137
|
-
* @static
|
|
2138
|
-
* @memberOf _
|
|
2139
|
-
* @since 4.3.0
|
|
2140
|
-
* @category Lang
|
|
2141
|
-
* @param {*} value The value to check.
|
|
2142
|
-
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2143
|
-
* @example
|
|
2144
|
-
*
|
|
2145
|
-
* _.isMap(new Map);
|
|
2146
|
-
* // => true
|
|
2147
|
-
*
|
|
2148
|
-
* _.isMap(new WeakMap);
|
|
2149
|
-
* // => false
|
|
2150
|
-
*/
|
|
2151
|
-
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
2152
|
-
|
|
2153
|
-
/** `Object#toString` result references. */
|
|
2154
|
-
var setTag$1 = '[object Set]';
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2158
|
-
*
|
|
2159
|
-
* @private
|
|
2160
|
-
* @param {*} value The value to check.
|
|
2161
|
-
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2162
|
-
*/
|
|
2163
|
-
function baseIsSet(value) {
|
|
2164
|
-
return isObjectLike(value) && getTag(value) == setTag$1;
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
/* Node.js helper references. */
|
|
2168
|
-
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
2169
|
-
|
|
2170
|
-
/**
|
|
2171
|
-
* Checks if `value` is classified as a `Set` object.
|
|
2172
|
-
*
|
|
2173
|
-
* @static
|
|
2174
|
-
* @memberOf _
|
|
2175
|
-
* @since 4.3.0
|
|
2176
|
-
* @category Lang
|
|
2177
|
-
* @param {*} value The value to check.
|
|
2178
|
-
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2179
|
-
* @example
|
|
2180
|
-
*
|
|
2181
|
-
* _.isSet(new Set);
|
|
2182
|
-
* // => true
|
|
2183
|
-
*
|
|
2184
|
-
* _.isSet(new WeakSet);
|
|
2185
|
-
* // => false
|
|
2186
|
-
*/
|
|
2187
|
-
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
2188
|
-
|
|
2189
|
-
/** `Object#toString` result references. */
|
|
2190
|
-
var argsTag = '[object Arguments]',
|
|
2191
|
-
arrayTag = '[object Array]',
|
|
2192
|
-
boolTag = '[object Boolean]',
|
|
2193
|
-
dateTag = '[object Date]',
|
|
2194
|
-
errorTag = '[object Error]',
|
|
2195
|
-
funcTag = '[object Function]',
|
|
2196
|
-
genTag = '[object GeneratorFunction]',
|
|
2197
|
-
mapTag = '[object Map]',
|
|
2198
|
-
numberTag = '[object Number]',
|
|
2199
|
-
objectTag = '[object Object]',
|
|
2200
|
-
regexpTag = '[object RegExp]',
|
|
2201
|
-
setTag = '[object Set]',
|
|
2202
|
-
stringTag = '[object String]',
|
|
2203
|
-
symbolTag = '[object Symbol]',
|
|
2204
|
-
weakMapTag = '[object WeakMap]';
|
|
2205
|
-
|
|
2206
|
-
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2207
|
-
dataViewTag = '[object DataView]',
|
|
2208
|
-
float32Tag = '[object Float32Array]',
|
|
2209
|
-
float64Tag = '[object Float64Array]',
|
|
2210
|
-
int8Tag = '[object Int8Array]',
|
|
2211
|
-
int16Tag = '[object Int16Array]',
|
|
2212
|
-
int32Tag = '[object Int32Array]',
|
|
2213
|
-
uint8Tag = '[object Uint8Array]',
|
|
2214
|
-
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2215
|
-
uint16Tag = '[object Uint16Array]',
|
|
2216
|
-
uint32Tag = '[object Uint32Array]';
|
|
2217
|
-
|
|
2218
|
-
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2219
|
-
var cloneableTags = {};
|
|
2220
|
-
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
2221
|
-
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
2222
|
-
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
2223
|
-
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
2224
|
-
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
2225
|
-
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
2226
|
-
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
2227
|
-
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
2228
|
-
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
2229
|
-
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
2230
|
-
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2231
|
-
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
2232
|
-
cloneableTags[weakMapTag] = false;
|
|
2233
|
-
|
|
2234
|
-
/**
|
|
2235
|
-
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2236
|
-
* traversed objects.
|
|
2237
|
-
*
|
|
2238
|
-
* @private
|
|
2239
|
-
* @param {*} value The value to clone.
|
|
2240
|
-
* @param {boolean} bitmask The bitmask flags.
|
|
2241
|
-
* 1 - Deep clone
|
|
2242
|
-
* 2 - Flatten inherited properties
|
|
2243
|
-
* 4 - Clone symbols
|
|
2244
|
-
* @param {Function} [customizer] The function to customize cloning.
|
|
2245
|
-
* @param {string} [key] The key of `value`.
|
|
2246
|
-
* @param {Object} [object] The parent object of `value`.
|
|
2247
|
-
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2248
|
-
* @returns {*} Returns the cloned value.
|
|
2249
|
-
*/
|
|
2250
|
-
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2251
|
-
var result;
|
|
2252
|
-
if (result !== undefined) {
|
|
2253
|
-
return result;
|
|
2254
|
-
}
|
|
2255
|
-
if (!isObject(value)) {
|
|
2256
|
-
return value;
|
|
2257
|
-
}
|
|
2258
|
-
var isArr = isArray(value);
|
|
2259
|
-
if (isArr) {
|
|
2260
|
-
result = initCloneArray(value);
|
|
2261
|
-
} else {
|
|
2262
|
-
var tag = getTag(value),
|
|
2263
|
-
isFunc = tag == funcTag || tag == genTag;
|
|
2264
|
-
|
|
2265
|
-
if (isBuffer(value)) {
|
|
2266
|
-
return cloneBuffer(value);
|
|
2267
|
-
}
|
|
2268
|
-
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
2269
|
-
result = (isFunc) ? {} : initCloneObject(value);
|
|
2270
|
-
} else {
|
|
2271
|
-
if (!cloneableTags[tag]) {
|
|
2272
|
-
return object ? value : {};
|
|
2273
|
-
}
|
|
2274
|
-
result = initCloneByTag(value, tag);
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
// Check for circular references and return its corresponding clone.
|
|
2278
|
-
stack || (stack = new Stack);
|
|
2279
|
-
var stacked = stack.get(value);
|
|
2280
|
-
if (stacked) {
|
|
2281
|
-
return stacked;
|
|
2282
|
-
}
|
|
2283
|
-
stack.set(value, result);
|
|
2284
|
-
|
|
2285
|
-
if (isSet(value)) {
|
|
2286
|
-
value.forEach(function(subValue) {
|
|
2287
|
-
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2288
|
-
});
|
|
2289
|
-
} else if (isMap(value)) {
|
|
2290
|
-
value.forEach(function(subValue, key) {
|
|
2291
|
-
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
var keysFunc = (getAllKeys)
|
|
2296
|
-
;
|
|
2297
|
-
|
|
2298
|
-
var props = isArr ? undefined : keysFunc(value);
|
|
2299
|
-
arrayEach(props || value, function(subValue, key) {
|
|
2300
|
-
if (props) {
|
|
2301
|
-
key = subValue;
|
|
2302
|
-
subValue = value[key];
|
|
2303
|
-
}
|
|
2304
|
-
// Recursively populate clone (susceptible to call stack limits).
|
|
2305
|
-
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2306
|
-
});
|
|
2307
|
-
return result;
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
/** Used to compose bitmasks for cloning. */
|
|
2311
|
-
var CLONE_DEEP_FLAG = 1,
|
|
2312
|
-
CLONE_SYMBOLS_FLAG = 4;
|
|
2313
|
-
|
|
2314
|
-
/**
|
|
2315
|
-
* This method is like `_.clone` except that it recursively clones `value`.
|
|
2316
|
-
*
|
|
2317
|
-
* @static
|
|
2318
|
-
* @memberOf _
|
|
2319
|
-
* @since 1.0.0
|
|
2320
|
-
* @category Lang
|
|
2321
|
-
* @param {*} value The value to recursively clone.
|
|
2322
|
-
* @returns {*} Returns the deep cloned value.
|
|
2323
|
-
* @see _.clone
|
|
2324
|
-
* @example
|
|
2325
|
-
*
|
|
2326
|
-
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
2327
|
-
*
|
|
2328
|
-
* var deep = _.cloneDeep(objects);
|
|
2329
|
-
* console.log(deep[0] === objects[0]);
|
|
2330
|
-
* // => false
|
|
2331
|
-
*/
|
|
2332
|
-
function cloneDeep(value) {
|
|
2333
|
-
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
319
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
2337
320
|
var t = {};
|
|
2338
321
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -2345,25 +328,13 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
2345
328
|
return t;
|
|
2346
329
|
};
|
|
2347
330
|
class ObjectHelper {
|
|
2348
|
-
static safeStringify(obj, indent = 2) {
|
|
2349
|
-
const seen = new WeakSet();
|
|
2350
|
-
return JSON.stringify(obj, (_key, value) => {
|
|
2351
|
-
if (typeof value === 'object' && value !== null) {
|
|
2352
|
-
if (seen.has(value)) {
|
|
2353
|
-
return undefined;
|
|
2354
|
-
}
|
|
2355
|
-
seen.add(value);
|
|
2356
|
-
}
|
|
2357
|
-
return value;
|
|
2358
|
-
}, indent);
|
|
2359
|
-
}
|
|
2360
331
|
static generateUUID() {
|
|
2361
332
|
return Math.random().toString(36).substr(2, 9);
|
|
2362
333
|
}
|
|
2363
334
|
static clone(objOrObjs) {
|
|
2364
335
|
const cloneObject = (obj) => {
|
|
2365
|
-
const
|
|
2366
|
-
return
|
|
336
|
+
const remainingProps = __rest(obj, ["_store", "_elementRef", "totalWidth", "totalHeight"]);
|
|
337
|
+
return structuredClone(remainingProps);
|
|
2367
338
|
};
|
|
2368
339
|
if (Array.isArray(objOrObjs)) {
|
|
2369
340
|
return objOrObjs.map(cloneObject);
|
|
@@ -2483,7 +454,7 @@ class KritzelBaseObject {
|
|
|
2483
454
|
get centerY() {
|
|
2484
455
|
return this.translateY + this.totalHeight / 2;
|
|
2485
456
|
}
|
|
2486
|
-
constructor(
|
|
457
|
+
constructor() {
|
|
2487
458
|
this.__class__ = 'KritzelBaseObject';
|
|
2488
459
|
this.visible = true;
|
|
2489
460
|
this.borderWidth = 0;
|
|
@@ -2496,9 +467,14 @@ class KritzelBaseObject {
|
|
|
2496
467
|
this.isMounted = false;
|
|
2497
468
|
this.zIndex = 0;
|
|
2498
469
|
this.debugInfoVisible = false;
|
|
2499
|
-
this._store = store;
|
|
2500
470
|
this.id = this.generateId();
|
|
2501
471
|
}
|
|
472
|
+
static create(store) {
|
|
473
|
+
const object = new KritzelBaseObject();
|
|
474
|
+
object._store = store;
|
|
475
|
+
object.zIndex = store.currentZIndex;
|
|
476
|
+
return object;
|
|
477
|
+
}
|
|
2502
478
|
mount(element) {
|
|
2503
479
|
if (this.isMounted) {
|
|
2504
480
|
return;
|
|
@@ -2557,12 +533,8 @@ class KritzelBaseObject {
|
|
|
2557
533
|
}
|
|
2558
534
|
|
|
2559
535
|
class KritzelPath extends KritzelBaseObject {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
}
|
|
2563
|
-
constructor(store, options) {
|
|
2564
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2565
|
-
super(store);
|
|
536
|
+
constructor() {
|
|
537
|
+
super(...arguments);
|
|
2566
538
|
this.__class__ = 'KritzelPath';
|
|
2567
539
|
this.stroke = 'none';
|
|
2568
540
|
this.lineSlack = 0.5;
|
|
@@ -2573,16 +545,26 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
2573
545
|
this.scale = 1;
|
|
2574
546
|
this.visible = true;
|
|
2575
547
|
this.debugInfoVisible = true;
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
this.
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
548
|
+
}
|
|
549
|
+
get viewBox() {
|
|
550
|
+
return `${this.x} ${this.y} ${this.width} ${this.height}`;
|
|
551
|
+
}
|
|
552
|
+
static create(store, options) {
|
|
553
|
+
var _a, _b, _c, _d, _e, _f;
|
|
554
|
+
const object = new KritzelPath();
|
|
555
|
+
object._store = store;
|
|
556
|
+
object.id = object.generateId();
|
|
557
|
+
object.options = options;
|
|
558
|
+
object.points = (_a = options === null || options === void 0 ? void 0 : options.points) !== null && _a !== void 0 ? _a : [];
|
|
559
|
+
object.translateX = (_b = options === null || options === void 0 ? void 0 : options.translateX) !== null && _b !== void 0 ? _b : 0;
|
|
560
|
+
object.translateY = (_c = options === null || options === void 0 ? void 0 : options.translateY) !== null && _c !== void 0 ? _c : 0;
|
|
561
|
+
object.scale = (_d = options === null || options === void 0 ? void 0 : options.scale) !== null && _d !== void 0 ? _d : 1;
|
|
562
|
+
object.strokeWidth = (_e = options === null || options === void 0 ? void 0 : options.strokeWidth) !== null && _e !== void 0 ? _e : 8;
|
|
563
|
+
object.fill = (_f = options === null || options === void 0 ? void 0 : options.fill) !== null && _f !== void 0 ? _f : '#000000';
|
|
564
|
+
object.zIndex = store.currentZIndex;
|
|
565
|
+
object.d = object.generateSvgPath();
|
|
566
|
+
object.updateDimensions();
|
|
567
|
+
return object;
|
|
2586
568
|
}
|
|
2587
569
|
resize(x, y, width, height) {
|
|
2588
570
|
if (width <= 1 || height <= 1) {
|
|
@@ -2729,7 +711,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
2729
711
|
this._store.state.isDrawing = true;
|
|
2730
712
|
const x = event.clientX - this._store.offsetX;
|
|
2731
713
|
const y = event.clientY - this._store.offsetY;
|
|
2732
|
-
this._store.state.currentPath =
|
|
714
|
+
this._store.state.currentPath = KritzelPath.create(this._store, {
|
|
2733
715
|
points: [[x, y]],
|
|
2734
716
|
translateX: -this._store.state.translateX,
|
|
2735
717
|
translateY: -this._store.state.translateY,
|
|
@@ -2743,7 +725,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
2743
725
|
if (this._store.state.isDrawing) {
|
|
2744
726
|
const x = event.clientX - this._store.offsetX;
|
|
2745
727
|
const y = event.clientY - this._store.offsetY;
|
|
2746
|
-
this._store.state.currentPath =
|
|
728
|
+
this._store.state.currentPath = KritzelPath.create(this._store, {
|
|
2747
729
|
points: [...this._store.state.currentPath.points, [x, y]],
|
|
2748
730
|
translateX: -this._store.state.translateX,
|
|
2749
731
|
translateY: -this._store.state.translateY,
|
|
@@ -2769,7 +751,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
2769
751
|
const x = Math.round(event.touches[0].clientX - this._store.offsetX);
|
|
2770
752
|
const y = Math.round(event.touches[0].clientY - this._store.offsetY);
|
|
2771
753
|
this._store.state.isDrawing = true;
|
|
2772
|
-
this._store.state.currentPath =
|
|
754
|
+
this._store.state.currentPath = KritzelPath.create(this._store, {
|
|
2773
755
|
points: [[x, y]],
|
|
2774
756
|
translateX: -this._store.state.translateX,
|
|
2775
757
|
translateY: -this._store.state.translateY,
|
|
@@ -2784,7 +766,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
2784
766
|
if (this._store.state.touchCount === 1) {
|
|
2785
767
|
const x = Math.round(event.touches[0].clientX - this._store.offsetX);
|
|
2786
768
|
const y = Math.round(event.touches[0].clientY - this._store.offsetY);
|
|
2787
|
-
this._store.state.currentPath =
|
|
769
|
+
this._store.state.currentPath = KritzelPath.create(this._store, {
|
|
2788
770
|
points: [...this._store.state.currentPath.points, [x, y]],
|
|
2789
771
|
translateX: -this._store.state.translateX,
|
|
2790
772
|
translateY: -this._store.state.translateY,
|
|
@@ -2812,8 +794,8 @@ class KritzelText extends KritzelBaseObject {
|
|
|
2812
794
|
get isReadonly() {
|
|
2813
795
|
return !(this._store.state.activeTool instanceof KritzelTextTool);
|
|
2814
796
|
}
|
|
2815
|
-
constructor(
|
|
2816
|
-
super(
|
|
797
|
+
constructor(config) {
|
|
798
|
+
super();
|
|
2817
799
|
this.__class__ = 'KritzelText';
|
|
2818
800
|
this.value = '';
|
|
2819
801
|
this.fontFamily = 'Arial';
|
|
@@ -2823,16 +805,33 @@ class KritzelText extends KritzelBaseObject {
|
|
|
2823
805
|
this.isNew = true;
|
|
2824
806
|
this.debugInfoVisible = true;
|
|
2825
807
|
this.rows = 1;
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
808
|
+
if (config) {
|
|
809
|
+
this.value = config.value || ' ';
|
|
810
|
+
this.translateX = config.translateX || 0;
|
|
811
|
+
this.translateY = config.translateY || 0;
|
|
812
|
+
this.fontSize = config.fontSize || 8;
|
|
813
|
+
this.fontFamily = config.fontFamily || 'Arial';
|
|
814
|
+
this.fontColor = config.fontColor || '#000000';
|
|
815
|
+
this.height = config.height || (this.fontSize * 1.2);
|
|
816
|
+
this.width = config.width || 0;
|
|
817
|
+
this.scale = config.scale || 1;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
static create(store, fontSize, fontFamily) {
|
|
821
|
+
const object = new KritzelText();
|
|
822
|
+
object._store = store;
|
|
823
|
+
object.fontSize = fontSize;
|
|
824
|
+
object.fontFamily = fontFamily;
|
|
825
|
+
object.translateX = 0;
|
|
826
|
+
object.translateY = 0;
|
|
827
|
+
object.width = object.initialWidth / (object._store.state.scale < 0 ? object._store.state.scale : 1);
|
|
828
|
+
object.height = (object.fontSize * 1.2) / (object._store.state.scale < 0 ? object._store.state.scale : 1);
|
|
829
|
+
object.padding = 5;
|
|
830
|
+
object.backgroundColor = 'transparent';
|
|
831
|
+
object.scale = object._store.state.scale;
|
|
832
|
+
object.value = ' ';
|
|
833
|
+
object.zIndex = store.currentZIndex;
|
|
834
|
+
return object;
|
|
2836
835
|
}
|
|
2837
836
|
mount(element) {
|
|
2838
837
|
if ((this.isMounted && this.elementRef === element) || this.isInViewport() === false) {
|
|
@@ -2984,7 +983,7 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
2984
983
|
}
|
|
2985
984
|
const clientX = event.clientX - this._store.offsetX;
|
|
2986
985
|
const clientY = event.clientY - this._store.offsetY;
|
|
2987
|
-
const text =
|
|
986
|
+
const text = KritzelText.create(this._store, this.fontSize, this.fontFamily);
|
|
2988
987
|
text.fontColor = this.fontColor;
|
|
2989
988
|
text.translateX = (clientX - this._store.state.translateX) / this._store.state.scale;
|
|
2990
989
|
text.translateY = (clientY - this._store.state.translateY) / this._store.state.scale;
|
|
@@ -3021,7 +1020,7 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
3021
1020
|
}
|
|
3022
1021
|
const clientX = Math.round(event.touches[0].clientX - this._store.offsetX);
|
|
3023
1022
|
const clientY = Math.round(event.touches[0].clientY - this._store.offsetY);
|
|
3024
|
-
const text =
|
|
1023
|
+
const text = KritzelText.create(this._store, this.fontSize, this.fontFamily);
|
|
3025
1024
|
text.fontColor = this.fontColor;
|
|
3026
1025
|
text.translateX = (clientX - this._store.state.translateX) / this._store.state.scale;
|
|
3027
1026
|
text.translateY = (clientY - this._store.state.translateY) / this._store.state.scale;
|
|
@@ -3126,11 +1125,11 @@ const KritzelControls = class {
|
|
|
3126
1125
|
render() {
|
|
3127
1126
|
var _a, _b;
|
|
3128
1127
|
const hasNoConfig = ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.config) === undefined || ((_b = this.activeControl) === null || _b === void 0 ? void 0 : _b.config) === null;
|
|
3129
|
-
return (index.h(index.Host, { key: '
|
|
1128
|
+
return (index.h(index.Host, { key: 'ed654553a1d3f5d2b5e85e3b3bce4a5705cc51e3' }, index.h("kritzel-utility-panel", { key: '9db82dacbe7360acba1b58b15536c7fed0c1f0dd', style: {
|
|
3130
1129
|
position: 'absolute',
|
|
3131
1130
|
bottom: '56px',
|
|
3132
1131
|
left: '12px',
|
|
3133
|
-
}, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: '
|
|
1132
|
+
}, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: '193a4efd69c51425dc0c8b142c8fba7c6f133077', class: "kritzel-controls" }, this.controls.map(control => {
|
|
3134
1133
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3135
1134
|
if (control.type === 'tool') {
|
|
3136
1135
|
return (index.h("button", { class: {
|
|
@@ -3233,7 +1232,7 @@ const KritzelCursorTrail = class {
|
|
|
3233
1232
|
}
|
|
3234
1233
|
}
|
|
3235
1234
|
render() {
|
|
3236
|
-
return (index.h(index.Host, { key: '
|
|
1235
|
+
return (index.h(index.Host, { key: 'c0a9b9ebe1634ba020024efed6446791d6a65a2f' }, this.cursorTrailPoints.length > 1 && (index.h("svg", { key: '50c73784eaffe743823bc6a75524fa4dc98566a8', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
3237
1236
|
position: 'absolute',
|
|
3238
1237
|
left: '0',
|
|
3239
1238
|
top: '0',
|
|
@@ -3337,7 +1336,7 @@ const KritzelDropdown = class {
|
|
|
3337
1336
|
'has-suffix-border': this.hasSuffixContent,
|
|
3338
1337
|
'has-prefix-border': this.hasPrefixContent,
|
|
3339
1338
|
};
|
|
3340
|
-
return (index.h(index.Host, { key: '
|
|
1339
|
+
return (index.h(index.Host, { key: '32c5f5a4f807c1e316c91b795c005b8d30ce6189' }, index.h("div", { key: 'b1cbeff18e688da4a2f7472be290b9527a619f07', class: "dropdown-wrapper" }, index.h("slot", { key: 'b3bbb7e21c6f5620cab41aa4b1c7206b6c75fd86', name: "prefix", ref: el => this.prefixSlotElement = el, onSlotchange: this.evaluatePrefixContent }), index.h("select", { key: '8b2dcdc125bee59cf29fce7c980b755e78d5816e', class: selectClasses, style: Object.assign(Object.assign({}, this.selectStyles), { width: this.width }), onInput: this.handleSelectChange }, this.options.map(option => (index.h("option", { value: option.value, style: option.style, selected: option.value === this.internalValue }, option.label)))), index.h("slot", { key: '8d83f0dea41ac959bf2392948efef33bb70d0154', name: "suffix", ref: el => this.suffixSlotElement = el, onSlotchange: this.evaluateSuffixContent }))));
|
|
3341
1340
|
}
|
|
3342
1341
|
static get watchers() { return {
|
|
3343
1342
|
"value": ["externalValueChanged"],
|
|
@@ -3490,18 +1489,23 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
3490
1489
|
}
|
|
3491
1490
|
|
|
3492
1491
|
class KritzelImage extends KritzelBaseObject {
|
|
3493
|
-
constructor(
|
|
3494
|
-
super(
|
|
1492
|
+
constructor() {
|
|
1493
|
+
super(...arguments);
|
|
3495
1494
|
this.__class__ = 'KritzelImage';
|
|
1495
|
+
this.src = '';
|
|
3496
1496
|
this.debugInfoVisible = true;
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
1497
|
+
}
|
|
1498
|
+
static create(store) {
|
|
1499
|
+
const object = new KritzelImage();
|
|
1500
|
+
object._store = store;
|
|
1501
|
+
object.id = object.generateId();
|
|
1502
|
+
object.x = 0;
|
|
1503
|
+
object.y = 0;
|
|
1504
|
+
object.translateX = 0;
|
|
1505
|
+
object.translateY = 0;
|
|
1506
|
+
object.scale = object._store.state.scale;
|
|
1507
|
+
object.zIndex = store.currentZIndex;
|
|
1508
|
+
return object;
|
|
3505
1509
|
}
|
|
3506
1510
|
resize(x, y, width, height) {
|
|
3507
1511
|
if (width <= 1 || height <= 1) {
|
|
@@ -3897,6 +1901,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
3897
1901
|
const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
|
|
3898
1902
|
this.rotation = currentRotation - this.initialRotation;
|
|
3899
1903
|
this._store.state.selectionGroup.rotate(this.rotation);
|
|
1904
|
+
this._store.rerender();
|
|
3900
1905
|
clearTimeout(this._store.state.longTouchTimeout);
|
|
3901
1906
|
}
|
|
3902
1907
|
}
|
|
@@ -3965,17 +1970,23 @@ class KritzelGeometryHelper {
|
|
|
3965
1970
|
}
|
|
3966
1971
|
|
|
3967
1972
|
class KrtizelSelectionBox extends KritzelBaseObject {
|
|
3968
|
-
constructor(
|
|
3969
|
-
super(
|
|
1973
|
+
constructor() {
|
|
1974
|
+
super(...arguments);
|
|
3970
1975
|
this.__class__ = 'KrtizelSelectionBox';
|
|
3971
1976
|
this.objects = [];
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
1977
|
+
}
|
|
1978
|
+
static create(store) {
|
|
1979
|
+
const object = new KrtizelSelectionBox();
|
|
1980
|
+
object._store = store;
|
|
1981
|
+
object.id = object.generateId();
|
|
1982
|
+
object.scale = store.state.scale;
|
|
1983
|
+
object.zIndex = 99999;
|
|
1984
|
+
object.backgroundColor = 'var(--kritzel-selection-box-background-color, rgba(14, 17, 17, 0.2))';
|
|
1985
|
+
object.borderColor = 'var(--kritzel-selection-box-border-color, rgba(14, 17, 17, 0.5))';
|
|
1986
|
+
object.borderWidth = 2;
|
|
1987
|
+
object.height = 0;
|
|
1988
|
+
object.width = 0;
|
|
1989
|
+
return object;
|
|
3979
1990
|
}
|
|
3980
1991
|
}
|
|
3981
1992
|
|
|
@@ -4077,7 +2088,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
4077
2088
|
let clientX, clientY;
|
|
4078
2089
|
clientX = event.clientX - this._store.offsetX;
|
|
4079
2090
|
clientY = event.clientY - this._store.offsetY;
|
|
4080
|
-
const selectionBox =
|
|
2091
|
+
const selectionBox = KrtizelSelectionBox.create(this._store);
|
|
4081
2092
|
this.startX = (clientX - this._store.state.translateX) / this._store.state.scale;
|
|
4082
2093
|
this.startY = (clientY - this._store.state.translateY) / this._store.state.scale;
|
|
4083
2094
|
selectionBox.translateX = this.startX;
|
|
@@ -4098,7 +2109,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
4098
2109
|
clientY = Math.round(firstTouch.clientY - this._store.offsetY);
|
|
4099
2110
|
this.touchStartX = clientX;
|
|
4100
2111
|
this.touchStartY = clientY;
|
|
4101
|
-
const selectionBox =
|
|
2112
|
+
const selectionBox = KrtizelSelectionBox.create(this._store);
|
|
4102
2113
|
this.startX = (clientX - this._store.state.translateX) / this._store.state.scale;
|
|
4103
2114
|
this.startY = (clientY - this._store.state.translateY) / this._store.state.scale;
|
|
4104
2115
|
selectionBox.translateX = this.startX;
|
|
@@ -4160,7 +2171,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
4160
2171
|
return;
|
|
4161
2172
|
}
|
|
4162
2173
|
selectedObjects.forEach(o => (o.selected = false));
|
|
4163
|
-
this._store.state.selectionGroup =
|
|
2174
|
+
this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
4164
2175
|
this._store.state.selectionGroup.addOrRemove(selectedObject);
|
|
4165
2176
|
this._store.state.selectionGroup.selected = true;
|
|
4166
2177
|
this._store.state.selectionGroup.rotation = this._store.state.selectionGroup.objects[0].rotation;
|
|
@@ -4171,7 +2182,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
4171
2182
|
if (selectedObjects.length === 0) {
|
|
4172
2183
|
return;
|
|
4173
2184
|
}
|
|
4174
|
-
this._store.state.selectionGroup =
|
|
2185
|
+
this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
4175
2186
|
selectedObjects.forEach(o => {
|
|
4176
2187
|
o.selected = false;
|
|
4177
2188
|
this._store.state.selectionGroup.addOrRemove(o);
|
|
@@ -4311,7 +2322,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
4311
2322
|
return object;
|
|
4312
2323
|
}
|
|
4313
2324
|
else {
|
|
4314
|
-
const group =
|
|
2325
|
+
const group = KritzelSelectionGroup.create(this._store);
|
|
4315
2326
|
group.translateX = 0;
|
|
4316
2327
|
group.translateY = 0;
|
|
4317
2328
|
group.addOrRemove(object);
|
|
@@ -4353,16 +2364,16 @@ class KritzelReviver {
|
|
|
4353
2364
|
let revivedObj;
|
|
4354
2365
|
switch (obj.__class__) {
|
|
4355
2366
|
case 'KritzelPath':
|
|
4356
|
-
revivedObj =
|
|
2367
|
+
revivedObj = KritzelPath.create(this._store).revive(obj);
|
|
4357
2368
|
break;
|
|
4358
2369
|
case 'KritzelText':
|
|
4359
|
-
revivedObj =
|
|
2370
|
+
revivedObj = KritzelText.create(this._store, obj.fontSize, obj.fontFamily).revive(obj);
|
|
4360
2371
|
break;
|
|
4361
2372
|
case 'KritzelImage':
|
|
4362
|
-
revivedObj =
|
|
2373
|
+
revivedObj = KritzelImage.create(this._store).revive(obj);
|
|
4363
2374
|
break;
|
|
4364
2375
|
case 'KritzelSelectionGroup':
|
|
4365
|
-
revivedObj =
|
|
2376
|
+
revivedObj = KritzelSelectionGroup.create(this._store).revive(obj);
|
|
4366
2377
|
break;
|
|
4367
2378
|
case 'KritzelBrushTool':
|
|
4368
2379
|
revivedObj = new KritzelBrushTool(this._store);
|
|
@@ -4397,17 +2408,23 @@ class KritzelReviver {
|
|
|
4397
2408
|
}
|
|
4398
2409
|
|
|
4399
2410
|
class KritzelSelectionGroup extends KritzelBaseObject {
|
|
4400
|
-
constructor(
|
|
4401
|
-
super(
|
|
2411
|
+
constructor() {
|
|
2412
|
+
super(...arguments);
|
|
4402
2413
|
this.__class__ = 'KritzelSelectionGroup';
|
|
4403
2414
|
this.objects = [];
|
|
4404
2415
|
this.unchangedObjects = [];
|
|
4405
|
-
this.scale = this._store.state.scale;
|
|
4406
|
-
this.zIndex = 99999;
|
|
4407
2416
|
}
|
|
4408
2417
|
get length() {
|
|
4409
2418
|
return this.objects.length;
|
|
4410
2419
|
}
|
|
2420
|
+
static create(store) {
|
|
2421
|
+
const object = new KritzelSelectionGroup();
|
|
2422
|
+
object._store = store;
|
|
2423
|
+
object.id = object.generateId();
|
|
2424
|
+
object.scale = store.state.scale;
|
|
2425
|
+
object.zIndex = 99999;
|
|
2426
|
+
return object;
|
|
2427
|
+
}
|
|
4411
2428
|
addOrRemove(object) {
|
|
4412
2429
|
const index = this.objects.findIndex(obj => obj.id === object.id);
|
|
4413
2430
|
if (index === -1) {
|
|
@@ -4461,13 +2478,13 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
4461
2478
|
const heightScaleFactor = height / this.height;
|
|
4462
2479
|
const deltaX = x - this.translateX;
|
|
4463
2480
|
const deltaY = y - this.translateY;
|
|
4464
|
-
this.objects.forEach(
|
|
4465
|
-
const updatedWidth =
|
|
4466
|
-
const updatedHeight =
|
|
4467
|
-
const updatedX =
|
|
4468
|
-
const updatedY =
|
|
4469
|
-
|
|
4470
|
-
this._store.state.objectsOctree.update(
|
|
2481
|
+
this.objects.forEach(child => {
|
|
2482
|
+
const updatedWidth = child.width * widthScaleFactor;
|
|
2483
|
+
const updatedHeight = child.height * heightScaleFactor;
|
|
2484
|
+
const updatedX = child.translateX + deltaX + (child.translateX - this.translateX) * (widthScaleFactor - 1);
|
|
2485
|
+
const updatedY = child.translateY + deltaY + (child.translateY - this.translateY) * (heightScaleFactor - 1);
|
|
2486
|
+
child.resize(updatedX, updatedY, updatedWidth, updatedHeight);
|
|
2487
|
+
this._store.state.objectsOctree.update(child);
|
|
4471
2488
|
});
|
|
4472
2489
|
this.refreshObjectDimensions();
|
|
4473
2490
|
this.unchangedObjects = ObjectHelper.clone(this.objects);
|
|
@@ -4488,10 +2505,11 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
4488
2505
|
child.translateX = centerX + rotatedX - child.totalWidth / 2 / child.scale;
|
|
4489
2506
|
child.translateY = centerY + rotatedY - child.totalHeight / 2 / child.scale;
|
|
4490
2507
|
child.rotation = this.objects.length === 1 ? value : value + unchangedChild.rotation;
|
|
2508
|
+
this._store.state.objectsOctree.update(child);
|
|
4491
2509
|
});
|
|
4492
2510
|
}
|
|
4493
2511
|
copy() {
|
|
4494
|
-
const selectionGroup =
|
|
2512
|
+
const selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
4495
2513
|
let currentZIndex = this._store.currentZIndex;
|
|
4496
2514
|
this.objects.forEach(obj => {
|
|
4497
2515
|
const copiedObject = obj.copy();
|
|
@@ -4630,7 +2648,8 @@ class KritzelImageTool extends KritzelBaseTool {
|
|
|
4630
2648
|
return { scaledWidth, scaledHeight };
|
|
4631
2649
|
}
|
|
4632
2650
|
createKritzelImage(img, width, height) {
|
|
4633
|
-
const image =
|
|
2651
|
+
const image = KritzelImage.create(this._store);
|
|
2652
|
+
image.src = img.src;
|
|
4634
2653
|
image.width = width;
|
|
4635
2654
|
image.height = height;
|
|
4636
2655
|
image.zIndex = this._store.currentZIndex;
|
|
@@ -4638,7 +2657,7 @@ class KritzelImageTool extends KritzelBaseTool {
|
|
|
4638
2657
|
return image;
|
|
4639
2658
|
}
|
|
4640
2659
|
addImageToStore(image) {
|
|
4641
|
-
const selectionGroup =
|
|
2660
|
+
const selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
4642
2661
|
selectionGroup.addOrRemove(image);
|
|
4643
2662
|
selectionGroup.selected = true;
|
|
4644
2663
|
const addImageCommand = new AddObjectCommand(this._store, this, image);
|
|
@@ -4793,6 +2812,7 @@ const KritzelEditor = class {
|
|
|
4793
2812
|
this.controls = DEFAULT_KRITZEL_CONTROLS;
|
|
4794
2813
|
this.customSvgIcons = {};
|
|
4795
2814
|
this.hideControls = false;
|
|
2815
|
+
this.text = null;
|
|
4796
2816
|
}
|
|
4797
2817
|
handleTouchStart(event) {
|
|
4798
2818
|
if (event.cancelable) {
|
|
@@ -4802,13 +2822,52 @@ const KritzelEditor = class {
|
|
|
4802
2822
|
componentWillLoad() {
|
|
4803
2823
|
this.registerCustomSvgIcons();
|
|
4804
2824
|
}
|
|
2825
|
+
addTextObject() {
|
|
2826
|
+
const obj = new KritzelText({
|
|
2827
|
+
translateX: 100,
|
|
2828
|
+
translateY: 100,
|
|
2829
|
+
width: 200,
|
|
2830
|
+
height: 50,
|
|
2831
|
+
value: 'New Text',
|
|
2832
|
+
fontSize: 16,
|
|
2833
|
+
fontFamily: 'Arial',
|
|
2834
|
+
fontColor: '#000000',
|
|
2835
|
+
scale: 1,
|
|
2836
|
+
});
|
|
2837
|
+
this.engineRef.addObject(obj).then((text) => this.text = text);
|
|
2838
|
+
}
|
|
2839
|
+
getTextObject() {
|
|
2840
|
+
var _a;
|
|
2841
|
+
this.engineRef.getObjectById(((_a = this.text) === null || _a === void 0 ? void 0 : _a.id) || '').then((object) => {
|
|
2842
|
+
console.log('Retrieved Text Object:', object);
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
updateTextObject() {
|
|
2846
|
+
const updatedText = {
|
|
2847
|
+
value: 'Updated Text',
|
|
2848
|
+
translateX: 150,
|
|
2849
|
+
translateY: 150,
|
|
2850
|
+
rotation: Math.PI / 2
|
|
2851
|
+
};
|
|
2852
|
+
this.engineRef.updateObject(this.text, updatedText)
|
|
2853
|
+
.then((text) => {
|
|
2854
|
+
this.text = text;
|
|
2855
|
+
console.log('Updated Text Object:', text);
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
removeTextObject() {
|
|
2859
|
+
this.engineRef.removeObject(this.text).then((text) => {
|
|
2860
|
+
console.log('Text Object removed', text);
|
|
2861
|
+
this.text = null;
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
4805
2864
|
registerCustomSvgIcons() {
|
|
4806
2865
|
for (const [name, svg] of Object.entries(this.customSvgIcons)) {
|
|
4807
2866
|
KritzelIconRegistry.register(name, svg);
|
|
4808
2867
|
}
|
|
4809
2868
|
}
|
|
4810
2869
|
render() {
|
|
4811
|
-
return (index.h(index.Host, { key: '
|
|
2870
|
+
return (index.h(index.Host, { key: '3e54e232dd459dcebf3322dcba5ac2f1936ef23a' }, index.h("div", { key: '5c7f90645dfe6010187a709a657b5366d0e6d402', class: "button-panel", style: { position: 'absolute', top: '0', left: '0', zIndex: '10', display: 'flex', flexDirection: 'row' } }, index.h("button", { key: 'b8c22edc7b752f176c8bee4af186692100d09e1c', onClick: () => this.addTextObject() }, "Add Text"), index.h("button", { key: 'd38091f4142392ab4d1ed3e4b26c9e4a38ded104', onClick: () => this.getTextObject() }, "Get Text"), index.h("button", { key: '2f2bacf47603b5fb50a782bf24a8e6b3954d77e2', onClick: () => this.updateTextObject() }, "Update Text"), index.h("button", { key: '5ce49401b19a3730b30a24aaee6474f8ff8ed94f', onClick: () => this.removeTextObject() }, "Remove Text"), index.h("button", { key: '38870ef7c6776a37c742722fc96c37055c9e2ae3', onClick: () => this.engineRef.selectObjects([this.text]) }, "Select Text"), index.h("button", { key: '9a95113343e746cac85a0643a7633bf1030987b5', onClick: () => this.engineRef.selectAllObjectsInViewport() }, "Select All"), index.h("button", { key: 'c2caf8b0f02ad07d9b7f2166ed04e17daff10786', onClick: () => this.engineRef.clearSelection() }, "Clear Selection")), index.h("kritzel-engine", { key: 'c3174bc087b7875744f222d9fd03c68f06ce2522', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: 'b22337b1d0cb2f703f69c197a3c2b50a21a7a9b1', controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
|
|
4812
2871
|
}
|
|
4813
2872
|
get host() { return index.getElement(this); }
|
|
4814
2873
|
};
|
|
@@ -5183,11 +3242,11 @@ class KritzelOctree {
|
|
|
5183
3242
|
];
|
|
5184
3243
|
}
|
|
5185
3244
|
intersects(a, b) {
|
|
5186
|
-
return !(
|
|
3245
|
+
return !(a.x >= b.x + b.width || // a is completely to the right of b
|
|
5187
3246
|
a.x + a.width <= b.x || // a is completely to the left of b
|
|
5188
3247
|
a.y >= b.y + b.height || // a is completely below b
|
|
5189
3248
|
a.y + a.height <= b.y // a is completely above b
|
|
5190
|
-
)
|
|
3249
|
+
);
|
|
5191
3250
|
}
|
|
5192
3251
|
}
|
|
5193
3252
|
|
|
@@ -5350,9 +3409,6 @@ class KritzelStore {
|
|
|
5350
3409
|
}
|
|
5351
3410
|
}
|
|
5352
3411
|
}
|
|
5353
|
-
clearSelection() {
|
|
5354
|
-
this.history.executeCommand(new RemoveSelectionGroupCommand(this, this.state.selectionGroup));
|
|
5355
|
-
}
|
|
5356
3412
|
delete() {
|
|
5357
3413
|
if (!this.state.selectionGroup) {
|
|
5358
3414
|
return;
|
|
@@ -5429,7 +3485,23 @@ class KritzelStore {
|
|
|
5429
3485
|
});
|
|
5430
3486
|
this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
|
|
5431
3487
|
}
|
|
5432
|
-
|
|
3488
|
+
selectObjects(objects) {
|
|
3489
|
+
if (objects.length === 0) {
|
|
3490
|
+
return;
|
|
3491
|
+
}
|
|
3492
|
+
const selectionGroup = KritzelSelectionGroup.create(this);
|
|
3493
|
+
objects.forEach(obj => {
|
|
3494
|
+
obj.selected = false;
|
|
3495
|
+
selectionGroup.addOrRemove(obj);
|
|
3496
|
+
});
|
|
3497
|
+
selectionGroup.selected = true;
|
|
3498
|
+
this.state.selectionGroup = selectionGroup;
|
|
3499
|
+
if (objects.length === 1) {
|
|
3500
|
+
selectionGroup.rotation = selectionGroup.objects[0].rotation;
|
|
3501
|
+
}
|
|
3502
|
+
this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
|
|
3503
|
+
}
|
|
3504
|
+
selectAllObjectsInViewport() {
|
|
5433
3505
|
const objectsInViewport = this._state.objectsOctree
|
|
5434
3506
|
.query({
|
|
5435
3507
|
x: -this._state.translateX / this._state.scale,
|
|
@@ -5441,17 +3513,29 @@ class KritzelStore {
|
|
|
5441
3513
|
})
|
|
5442
3514
|
.filter(o => !(o instanceof KritzelSelectionGroup) && !(o instanceof KrtizelSelectionBox) && !(o instanceof KritzelContextMenu));
|
|
5443
3515
|
if (objectsInViewport.length > 0) {
|
|
5444
|
-
const selectionGroup =
|
|
3516
|
+
const selectionGroup = KritzelSelectionGroup.create(this);
|
|
5445
3517
|
objectsInViewport.forEach(obj => {
|
|
5446
3518
|
obj.selected = false;
|
|
5447
3519
|
selectionGroup.addOrRemove(obj);
|
|
5448
3520
|
});
|
|
5449
3521
|
selectionGroup.selected = true;
|
|
5450
3522
|
this.state.isSelecting = false;
|
|
3523
|
+
if (objectsInViewport.length === 1) {
|
|
3524
|
+
selectionGroup.rotation = selectionGroup.objects[0].rotation;
|
|
3525
|
+
}
|
|
5451
3526
|
this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
|
|
5452
3527
|
this.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
5453
3528
|
}
|
|
5454
3529
|
}
|
|
3530
|
+
clearSelection() {
|
|
3531
|
+
const command = new RemoveSelectionGroupCommand(this, this.state.selectionGroup);
|
|
3532
|
+
this.history.executeCommand(command);
|
|
3533
|
+
this.state.selectionGroup = null;
|
|
3534
|
+
this.state.selectionBox = null;
|
|
3535
|
+
this.state.isSelecting = false;
|
|
3536
|
+
this.state.isResizeHandleSelected = false;
|
|
3537
|
+
this.state.isRotationHandleSelected = false;
|
|
3538
|
+
}
|
|
5455
3539
|
resetActiveText() {
|
|
5456
3540
|
if (this.state.activeText && this.state.activeText.value === ' ') {
|
|
5457
3541
|
this.deleteObject(this.state.activeText.id, false);
|
|
@@ -5486,15 +3570,6 @@ class KritzelStore {
|
|
|
5486
3570
|
}
|
|
5487
3571
|
return null;
|
|
5488
3572
|
}
|
|
5489
|
-
resetSelection() {
|
|
5490
|
-
this.state.selectionGroup = null;
|
|
5491
|
-
this.state.selectionBox = null;
|
|
5492
|
-
this.state.isSelecting = false;
|
|
5493
|
-
this.state.isResizeHandleSelected = false;
|
|
5494
|
-
this.state.isRotationHandleSelected = false;
|
|
5495
|
-
this._state.objectsOctree.remove(obj => obj instanceof KritzelSelectionGroup);
|
|
5496
|
-
this.rerender();
|
|
5497
|
-
}
|
|
5498
3573
|
}
|
|
5499
3574
|
|
|
5500
3575
|
class KritzelKeyHandler extends KritzelBaseHandler {
|
|
@@ -5634,7 +3709,7 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
|
|
|
5634
3709
|
}
|
|
5635
3710
|
const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
|
|
5636
3711
|
if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
|
|
5637
|
-
this._store.state.selectionGroup =
|
|
3712
|
+
this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
|
|
5638
3713
|
this._store.state.selectionGroup.addOrRemove(selectedObject);
|
|
5639
3714
|
this._store.state.selectionGroup.selected = true;
|
|
5640
3715
|
this._store.state.selectionGroup.rotation = selectedObject.rotation;
|
|
@@ -5691,7 +3766,7 @@ const KritzelEngine = class {
|
|
|
5691
3766
|
this.paste(x, y);
|
|
5692
3767
|
},
|
|
5693
3768
|
},
|
|
5694
|
-
{ label: 'Select All', icon: 'select-all', action: () => this.
|
|
3769
|
+
{ label: 'Select All', icon: 'select-all', action: () => this.selectAllObjectsInViewport() },
|
|
5695
3770
|
];
|
|
5696
3771
|
this.objectContextMenuItems = [
|
|
5697
3772
|
{ label: 'Copy', icon: 'copy', action: () => this.copy() },
|
|
@@ -5716,7 +3791,7 @@ const KritzelEngine = class {
|
|
|
5716
3791
|
this.keyHandler = new KritzelKeyHandler(this.store);
|
|
5717
3792
|
this.store.onStateChange('activeTool', (activeTool) => {
|
|
5718
3793
|
if (!(activeTool instanceof KritzelSelectionTool)) {
|
|
5719
|
-
this.store.
|
|
3794
|
+
this.store.clearSelection();
|
|
5720
3795
|
}
|
|
5721
3796
|
this.store.state.skipContextMenu = false;
|
|
5722
3797
|
this.activeToolChange.emit(activeTool);
|
|
@@ -5902,9 +3977,6 @@ const KritzelEngine = class {
|
|
|
5902
3977
|
async moveToBottom() {
|
|
5903
3978
|
this.store.moveToBottom();
|
|
5904
3979
|
}
|
|
5905
|
-
async selectAllInViewport() {
|
|
5906
|
-
this.store.selectAllInViewport();
|
|
5907
|
-
}
|
|
5908
3980
|
async undo() {
|
|
5909
3981
|
this.store.history.undo();
|
|
5910
3982
|
}
|
|
@@ -5916,21 +3988,63 @@ const KritzelEngine = class {
|
|
|
5916
3988
|
this.store.state.selectionBox = null;
|
|
5917
3989
|
this.store.state.isSelecting = false;
|
|
5918
3990
|
}
|
|
3991
|
+
async getObjectById(id) {
|
|
3992
|
+
const object = this.store.objects.find(obj => obj.id === id);
|
|
3993
|
+
return object || null;
|
|
3994
|
+
}
|
|
3995
|
+
async addObject(object) {
|
|
3996
|
+
this.store.deselectAllObjects();
|
|
3997
|
+
object.id = object.generateId();
|
|
3998
|
+
object._store = this.store;
|
|
3999
|
+
object.zIndex = this.store.currentZIndex;
|
|
4000
|
+
const command = new AddObjectCommand(this.store, this, object);
|
|
4001
|
+
this.store.history.executeCommand(command);
|
|
4002
|
+
return object;
|
|
4003
|
+
}
|
|
4004
|
+
async updateObject(object, updatedProperties) {
|
|
4005
|
+
this.store.deselectAllObjects();
|
|
4006
|
+
const command = new UpdateObjectCommand(this.store, this, object, updatedProperties);
|
|
4007
|
+
this.store.history.executeCommand(command);
|
|
4008
|
+
return object;
|
|
4009
|
+
}
|
|
4010
|
+
async removeObject(object) {
|
|
4011
|
+
this.store.deselectAllObjects();
|
|
4012
|
+
const command = new RemoveObjectCommand(this.store, this, object);
|
|
4013
|
+
this.store.history.executeCommand(command);
|
|
4014
|
+
return object;
|
|
4015
|
+
}
|
|
4016
|
+
async selectObjects(objects) {
|
|
4017
|
+
var _a;
|
|
4018
|
+
(_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
|
|
4019
|
+
this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
4020
|
+
this.store.deselectAllObjects();
|
|
4021
|
+
this.store.selectObjects(objects);
|
|
4022
|
+
}
|
|
4023
|
+
async selectAllObjectsInViewport() {
|
|
4024
|
+
var _a;
|
|
4025
|
+
(_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
|
|
4026
|
+
this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
4027
|
+
this.store.deselectAllObjects();
|
|
4028
|
+
this.store.selectAllObjectsInViewport();
|
|
4029
|
+
}
|
|
4030
|
+
async clearSelection() {
|
|
4031
|
+
this.store.clearSelection();
|
|
4032
|
+
}
|
|
5919
4033
|
render() {
|
|
5920
4034
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
5921
4035
|
const computedStyle = window.getComputedStyle(this.host);
|
|
5922
4036
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
5923
4037
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
5924
4038
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
5925
|
-
return (index.h(index.Host, { key: '
|
|
5926
|
-
_a.translateX), index.h("div", { key: '
|
|
5927
|
-
_b.translateY), index.h("div", { key: '
|
|
5928
|
-
_c.viewportWidth), index.h("div", { key: '
|
|
5929
|
-
_d.viewportHeight), index.h("div", { key: '
|
|
5930
|
-
_e.scale), index.h("div", { key: '
|
|
5931
|
-
_g.name), index.h("div", { key: '
|
|
5932
|
-
_m.cursorX), index.h("div", { key: '
|
|
5933
|
-
_o.cursorY)), index.h("div", { key: '
|
|
4039
|
+
return (index.h(index.Host, { key: '0c20c50e3ad8ac088902881c35c406ad2f0787d5' }, index.h("div", { key: 'a89d76b5f6a10cbc54c40d034a08b3ceb99be063', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '94345439d02de7d005bb92abb377b7ebeb91fcdb' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
|
|
4040
|
+
_a.translateX), index.h("div", { key: '1e2e3ffc6ad760f089f4d02d94dfeb09bb5725cb' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
|
|
4041
|
+
_b.translateY), index.h("div", { key: '36d6170934959e19b95326d84b32c9abe2385edc' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
|
|
4042
|
+
_c.viewportWidth), index.h("div", { key: '57e5d37af3fd1f6ad24ea89ca525a6f0bc8e014b' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
|
|
4043
|
+
_d.viewportHeight), index.h("div", { key: '8281e788e350db75bbf1fe12dd8c17b91b429135' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '9f42aad27d0a266cbc720d1e13292bea5be84770' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
|
|
4044
|
+
_e.scale), index.h("div", { key: '76848c1a0eb2379ee0d0314523a540dbeb3d0697' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
|
|
4045
|
+
_g.name), index.h("div", { key: '77f8ff0b660227f7b25c12b74d70946bc1f66e78' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '229e94fee90a847a853419ae61bc131221313fc6' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: 'f31784916ab54f9a5eda02cffebe55a1f9aaa51f' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '4611a6dd48f1033d42fc3b7813634cbc16bf9b3b' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '14388f4b5cca60d8a2d8d474f941b53a78ad327d' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '2f3dcd488855413e392f56718af640e369d99fae' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '2cd0e44a1d13eaf5d3a942f75a727a074bf37622' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '99d51cf25e02c9d06865bf1f847c704ad8a32110' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '87ab9908a318b238ad1fb00e91dba9c485038443' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '20f291bf45ba06b4107002e288b93f8f61ef9520' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '52244f4f0d368e7bc183eed4c65abe536d134f44' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '641edd47e7bccc7514ed6aeac3ecbead95568dde' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
|
|
4046
|
+
_m.cursorX), index.h("div", { key: 'bf0826a9cbc800ca0f13d4de4da7dbb21241498f' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
|
|
4047
|
+
_o.cursorY)), index.h("div", { key: '5659cb254f57b79ca8e33ab11a8087d5ca5088dc', class: "origin", style: {
|
|
5934
4048
|
transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
|
|
5935
4049
|
} }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
|
|
5936
4050
|
_t.map(object => {
|
|
@@ -5960,7 +4074,7 @@ const KritzelEngine = class {
|
|
|
5960
4074
|
width: object === null || object === void 0 ? void 0 : object.width.toString(),
|
|
5961
4075
|
position: 'absolute',
|
|
5962
4076
|
overflow: 'visible',
|
|
5963
|
-
}, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), object instanceof KritzelImage && (index.h("img", { ref: el => object.mount(el), src: object.
|
|
4077
|
+
}, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), object instanceof KritzelImage && (index.h("img", { ref: el => object.mount(el), src: object.src, style: {
|
|
5964
4078
|
width: '100%',
|
|
5965
4079
|
height: '100%',
|
|
5966
4080
|
userSelect: 'none',
|
|
@@ -6027,7 +4141,7 @@ const KritzelEngine = class {
|
|
|
6027
4141
|
fill: 'transparent',
|
|
6028
4142
|
cursor: 'grab',
|
|
6029
4143
|
}, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation)))))));
|
|
6030
|
-
}), index.h("svg", { key: '
|
|
4144
|
+
}), index.h("svg", { key: '05a35ebb17312d00a4065dc6dc76f3a93a72eff4', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
6031
4145
|
height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
|
|
6032
4146
|
width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
|
|
6033
4147
|
left: '0',
|
|
@@ -6037,12 +4151,12 @@ const KritzelEngine = class {
|
|
|
6037
4151
|
transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
|
|
6038
4152
|
transformOrigin: 'top left',
|
|
6039
4153
|
overflow: 'visible',
|
|
6040
|
-
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '
|
|
4154
|
+
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: 'cb232e2697ce6ede2e4d9ed2e1b433ccde3961b5', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: 'e41b88a78bbd25f692fbdba88fda80993055a078', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
|
|
6041
4155
|
position: 'fixed',
|
|
6042
4156
|
left: `${this.store.state.contextMenuX}px`,
|
|
6043
4157
|
top: `${this.store.state.contextMenuY}px`,
|
|
6044
4158
|
zIndex: '10000',
|
|
6045
|
-
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '
|
|
4159
|
+
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '1d96c0d7fa94ddcf5820fd76fbaf69c54b1face2' })));
|
|
6046
4160
|
}
|
|
6047
4161
|
get host() { return index.getElement(this); }
|
|
6048
4162
|
};
|
|
@@ -6058,7 +4172,7 @@ const KritzelFont = class {
|
|
|
6058
4172
|
this.color = '#000000';
|
|
6059
4173
|
}
|
|
6060
4174
|
render() {
|
|
6061
|
-
return (index.h(index.Host, { key: '
|
|
4175
|
+
return (index.h(index.Host, { key: 'b4ebef665dacaca67e0a7574a15eae851e40ba3d' }, index.h("div", { key: '3af8906e1092fe333daf52da9e0da7a764fc47e3', class: "font-preview", style: {
|
|
6062
4176
|
fontFamily: this.fontFamily,
|
|
6063
4177
|
fontSize: `${this.size}px`,
|
|
6064
4178
|
color: this.color
|
|
@@ -6103,7 +4217,7 @@ const KritzelFontFamily = class {
|
|
|
6103
4217
|
label: option.label,
|
|
6104
4218
|
style: { fontFamily: option.value },
|
|
6105
4219
|
}));
|
|
6106
|
-
return (index.h(index.Host, { key: '
|
|
4220
|
+
return (index.h(index.Host, { key: 'f420ff18156d54bfc475148a7d9aae0f1441408c' }, index.h("kritzel-dropdown", { key: '6b54fb8265a0eb59a6a681c6a2b7a95fb222671c', options: dropdownOptions, value: this.selectedFontFamily, onValueChanged: this.handleDropdownValueChange, selectStyles: { fontFamily: this.selectedFontFamily } }, index.h("button", { key: 'b853c75a425c7baafa7a8e749c90c0b08884375c', class: "font-style-button", slot: "suffix" }, "B"), index.h("button", { key: '68dea850dd1d1f38db727d8be0eec3481890c571', class: "font-style-button italic-text", slot: "suffix" }, "I"))));
|
|
6107
4221
|
}
|
|
6108
4222
|
};
|
|
6109
4223
|
KritzelFontFamily.style = kritzelFontFamilyCss;
|
|
@@ -6123,7 +4237,7 @@ const KritzelFontSize = class {
|
|
|
6123
4237
|
this.sizeChange.emit(size);
|
|
6124
4238
|
}
|
|
6125
4239
|
render() {
|
|
6126
|
-
return (index.h(index.Host, { key: '
|
|
4240
|
+
return (index.h(index.Host, { key: 'daf7a1f16f96dfcbaaaa2ba43b77c99565c9893d' }, this.sizes.map(size => (index.h("div", { class: {
|
|
6127
4241
|
'size-container': true,
|
|
6128
4242
|
'selected': this.selectedSize === size,
|
|
6129
4243
|
}, onClick: () => this.handleSizeClick(size) }, index.h("kritzel-font", { fontFamily: this.fontFamily, size: size }))))));
|
|
@@ -6167,7 +4281,7 @@ const KritzelStrokeSize = class {
|
|
|
6167
4281
|
this.sizeChange.emit(size);
|
|
6168
4282
|
}
|
|
6169
4283
|
render() {
|
|
6170
|
-
return (index.h(index.Host, { key: '
|
|
4284
|
+
return (index.h(index.Host, { key: 'ee73f8679fa8e1f99bc01f31fb5cd8935fa597a8' }, this.sizes.map(size => (index.h("div", { class: {
|
|
6171
4285
|
'size-container': true,
|
|
6172
4286
|
'selected': this.selectedSize === size,
|
|
6173
4287
|
}, onClick: () => this.handleSizeClick(size) }, index.h("kritzel-color", { value: '#000000', size: size }))))));
|
|
@@ -6216,23 +4330,23 @@ const KritzelTooltip = class {
|
|
|
6216
4330
|
}
|
|
6217
4331
|
}
|
|
6218
4332
|
render() {
|
|
6219
|
-
return (index.h(index.Host, { key: '
|
|
4333
|
+
return (index.h(index.Host, { key: 'd0ec1b12583a5e69a022ed4538060a0fe609b4fc', style: {
|
|
6220
4334
|
position: 'fixed',
|
|
6221
4335
|
zIndex: '9999',
|
|
6222
4336
|
transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
|
|
6223
4337
|
visibility: this.isVisible ? 'visible' : 'hidden',
|
|
6224
4338
|
left: !this.isMobileView ? `${this.positionX}px` : '50%',
|
|
6225
4339
|
marginBottom: `${this.offsetY + this.arrowSize}px`,
|
|
6226
|
-
} }, index.h("div", { key: '
|
|
4340
|
+
} }, index.h("div", { key: 'f4edf3ee17d5074aff60808dada77ddb601ea33d', class: "tooltip-content", onClick: event => event.stopPropagation() }, index.h("slot", { key: '947ea9110ccb0ed4a02684d7a51b04da8df6c909' }), index.h("div", { key: 'bffda8ba16f67e54cb581f96f355b5ddefca5792', class: "tooltip-arrow-wrapper", style: {
|
|
6227
4341
|
position: 'fixed',
|
|
6228
4342
|
left: this.arrowOffset,
|
|
6229
4343
|
bottom: `-${this.arrowSize * 2}px`,
|
|
6230
|
-
} }, index.h("div", { key: '
|
|
4344
|
+
} }, index.h("div", { key: '76d33735507f0164dc68173f02c3ca2d45070744', class: "tooltip-arrow", style: {
|
|
6231
4345
|
borderLeft: `${this.arrowSize}px solid transparent`,
|
|
6232
4346
|
borderRight: `${this.arrowSize}px solid transparent`,
|
|
6233
4347
|
borderTop: `${this.arrowSize}px solid var(--kritzel-controls-tooltip-background-color, #ffffff)`,
|
|
6234
4348
|
filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))',
|
|
6235
|
-
} }), index.h("div", { key: '
|
|
4349
|
+
} }), index.h("div", { key: '8f1913c9ed12f8a3171963cfb0360241fab21302', class: "tooltip-arrow-rect", style: {
|
|
6236
4350
|
position: 'relative',
|
|
6237
4351
|
width: `${this.arrowSize * 2}px`,
|
|
6238
4352
|
height: `${this.arrowSize}px`,
|
|
@@ -6266,7 +4380,7 @@ const KritzelUtilityPanel = class {
|
|
|
6266
4380
|
this.redo.emit();
|
|
6267
4381
|
}
|
|
6268
4382
|
render() {
|
|
6269
|
-
return (index.h(index.Host, { key: '
|
|
4383
|
+
return (index.h(index.Host, { key: 'c295ba2931094213a276ca2ccf002fea4a17a9a5' }, index.h("button", { key: 'ad636f88a4fb8540e0a5607b505fa157257a0cd4', class: "utility-button", onClick: event => this.handleUndo(event) }, index.h("kritzel-icon", { key: '9a6ebf66cafddeb5fd191ffe374831ad583598ae', name: "undo" })), index.h("button", { key: '334cb5c195b6da4992f08964f31f412172f3904d', class: "utility-button", onClick: event => this.handleRedo(event) }, index.h("kritzel-icon", { key: '5f3528d7cfdee42ed8203c8cb09f54550ab57810', name: "redo" })), index.h("div", { key: 'f859dcfd8a576323a2d52fc1bf3787b8ac589532', class: "utility-separator" }), index.h("button", { key: '30e28fc71e12caca42effe63fc033f84b9b07d02', class: "utility-button" }, index.h("kritzel-icon", { key: 'f448f23126e2d29a1be44d88e39c7dd6d5927ca2', name: "delete", onClick: () => this.delete.emit() }))));
|
|
6270
4384
|
}
|
|
6271
4385
|
};
|
|
6272
4386
|
KritzelUtilityPanel.style = kritzelUtilityPanelCss;
|