avo 3.26.2 → 3.26.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/lib/avo/services/telemetry_service.rb +10 -0
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.base.css +14 -1
- data/public/avo-assets/avo.base.js +1 -1
- data/public/avo-assets/avo.base.js.map +3 -3
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b364a3e09c4c019f21d8c5ac5f9bafd1b87bca5d7ec99ef17e52af249a08158f
|
|
4
|
+
data.tar.gz: e64f37b27b5c5bf882b4b13728236c66dc13790171450741f7accf20193a67f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3017ef0058d7e3c191ad79c2fdb402206f26a55ef85ec9033ffbc99aaee70af0c5840bb5a67bda5405e216c74b00feca696fff3e5c7fdb5dd8d0336d583553e8
|
|
7
|
+
data.tar.gz: b1ee6ef8b1744c5d5ab4e708d946a4412a29445576d8884dc2051c96ca68d85aee99f6037b4565cab7499511760a6a4c269c36f749b608e570b0426c6aa51ac7
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
avo (3.26.
|
|
4
|
+
avo (3.26.3)
|
|
5
5
|
actionview (>= 6.1)
|
|
6
6
|
active_link_to
|
|
7
7
|
activerecord (>= 6.1)
|
|
@@ -131,8 +131,8 @@ GEM
|
|
|
131
131
|
money-rails (~> 1.12)
|
|
132
132
|
avo-record_link_field (0.0.2)
|
|
133
133
|
aws-eventstream (1.4.0)
|
|
134
|
-
aws-partitions (1.
|
|
135
|
-
aws-sdk-core (3.
|
|
134
|
+
aws-partitions (1.1180.0)
|
|
135
|
+
aws-sdk-core (3.236.0)
|
|
136
136
|
aws-eventstream (~> 1, >= 1.3.0)
|
|
137
137
|
aws-partitions (~> 1, >= 1.992.0)
|
|
138
138
|
aws-sigv4 (~> 1.9)
|
|
@@ -140,10 +140,10 @@ GEM
|
|
|
140
140
|
bigdecimal
|
|
141
141
|
jmespath (~> 1, >= 1.6.1)
|
|
142
142
|
logger
|
|
143
|
-
aws-sdk-kms (1.
|
|
143
|
+
aws-sdk-kms (1.116.0)
|
|
144
144
|
aws-sdk-core (~> 3, >= 3.234.0)
|
|
145
145
|
aws-sigv4 (~> 1.5)
|
|
146
|
-
aws-sdk-s3 (1.
|
|
146
|
+
aws-sdk-s3 (1.203.0)
|
|
147
147
|
aws-sdk-core (~> 3, >= 3.234.0)
|
|
148
148
|
aws-sdk-kms (~> 1)
|
|
149
149
|
aws-sigv4 (~> 1.5)
|
|
@@ -359,7 +359,7 @@ GEM
|
|
|
359
359
|
activesupport (>= 3.0)
|
|
360
360
|
nokogiri (>= 1.6)
|
|
361
361
|
io-console (0.8.1)
|
|
362
|
-
irb (1.15.
|
|
362
|
+
irb (1.15.3)
|
|
363
363
|
pp (>= 0.6.0)
|
|
364
364
|
rdoc (>= 4.0.0)
|
|
365
365
|
reline (>= 0.4.2)
|
|
@@ -416,7 +416,7 @@ GEM
|
|
|
416
416
|
railties (>= 3.0)
|
|
417
417
|
msgpack (1.8.0)
|
|
418
418
|
multipart-post (2.4.1)
|
|
419
|
-
net-http (0.
|
|
419
|
+
net-http (0.7.0)
|
|
420
420
|
uri
|
|
421
421
|
net-imap (0.5.12)
|
|
422
422
|
date
|
|
@@ -427,7 +427,7 @@ GEM
|
|
|
427
427
|
timeout
|
|
428
428
|
net-smtp (0.5.1)
|
|
429
429
|
net-protocol
|
|
430
|
-
nio4r (2.7.
|
|
430
|
+
nio4r (2.7.5)
|
|
431
431
|
nokogiri (1.18.10-aarch64-linux-gnu)
|
|
432
432
|
racc (~> 1.4)
|
|
433
433
|
nokogiri (1.18.10-arm64-darwin)
|
|
@@ -463,7 +463,7 @@ GEM
|
|
|
463
463
|
puma (6.6.1)
|
|
464
464
|
nio4r (~> 2.0)
|
|
465
465
|
racc (1.8.1)
|
|
466
|
-
rack (3.2.
|
|
466
|
+
rack (3.2.4)
|
|
467
467
|
rack-session (2.1.1)
|
|
468
468
|
base64 (>= 0.1.0)
|
|
469
469
|
rack (>= 3.0.0)
|
|
@@ -519,7 +519,7 @@ GEM
|
|
|
519
519
|
ffi (~> 1.0)
|
|
520
520
|
rbs (3.9.5)
|
|
521
521
|
logger
|
|
522
|
-
rdoc (6.15.
|
|
522
|
+
rdoc (6.15.1)
|
|
523
523
|
erb
|
|
524
524
|
psych (>= 4.0.0)
|
|
525
525
|
tsort
|
|
@@ -548,7 +548,7 @@ GEM
|
|
|
548
548
|
rspec-expectations (3.13.5)
|
|
549
549
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
550
550
|
rspec-support (~> 3.13.0)
|
|
551
|
-
rspec-mocks (3.13.
|
|
551
|
+
rspec-mocks (3.13.7)
|
|
552
552
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
553
553
|
rspec-support (~> 3.13.0)
|
|
554
554
|
rspec-rails (6.1.5)
|
|
@@ -689,7 +689,7 @@ GEM
|
|
|
689
689
|
unicode-display_width (3.2.0)
|
|
690
690
|
unicode-emoji (~> 4.1)
|
|
691
691
|
unicode-emoji (4.1.0)
|
|
692
|
-
uri (1.
|
|
692
|
+
uri (1.1.1)
|
|
693
693
|
useragent (0.16.11)
|
|
694
694
|
view_component (4.0.0)
|
|
695
695
|
activesupport (>= 7.1.0, < 8.1)
|
|
@@ -705,7 +705,7 @@ GEM
|
|
|
705
705
|
activemodel (>= 6.0.0)
|
|
706
706
|
bindex (>= 0.4.0)
|
|
707
707
|
railties (>= 6.0.0)
|
|
708
|
-
webmock (3.26.
|
|
708
|
+
webmock (3.26.1)
|
|
709
709
|
addressable (>= 2.8.0)
|
|
710
710
|
crack (>= 0.3.2)
|
|
711
711
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -52,6 +52,7 @@ class Avo::Services::TelemetryService
|
|
|
52
52
|
main_menu_present: Avo.configuration.main_menu.present?,
|
|
53
53
|
profile_menu_present: Avo.configuration.profile_menu.present?,
|
|
54
54
|
cache_store: Avo.cache_store&.class&.to_s,
|
|
55
|
+
cache_operational: cache_operational?,
|
|
55
56
|
**config_metadata
|
|
56
57
|
}
|
|
57
58
|
# rescue => error
|
|
@@ -60,6 +61,15 @@ class Avo::Services::TelemetryService
|
|
|
60
61
|
# }
|
|
61
62
|
end
|
|
62
63
|
|
|
64
|
+
def cache_operational?
|
|
65
|
+
Avo.cache_store.write("avo-test-cache", "test_value")
|
|
66
|
+
operational = Avo.cache_store.read("avo-test-cache") == "test_value"
|
|
67
|
+
Avo.cache_store.delete("avo-test-cache")
|
|
68
|
+
operational
|
|
69
|
+
rescue => error
|
|
70
|
+
"error: #{error.message}"
|
|
71
|
+
end
|
|
72
|
+
|
|
63
73
|
def other_metadata(type = :actions)
|
|
64
74
|
resources = Avo.resource_manager.all
|
|
65
75
|
|
data/lib/avo/version.rb
CHANGED
|
@@ -3384,10 +3384,11 @@ body[data-theme=dark], body.dark {
|
|
|
3384
3384
|
.tagify__input{
|
|
3385
3385
|
flex-grow:1;
|
|
3386
3386
|
display:inline-block;
|
|
3387
|
-
min-width:110px;
|
|
3388
3387
|
margin:5px;
|
|
3389
3388
|
padding:var(--tag-pad);
|
|
3390
3389
|
line-height:normal;
|
|
3390
|
+
min-width:110px;
|
|
3391
|
+
min-height:1.5lh;
|
|
3391
3392
|
position:relative;
|
|
3392
3393
|
white-space:pre-wrap;
|
|
3393
3394
|
color:var(--input-color);
|
|
@@ -7850,6 +7851,10 @@ tag.tagify__tag{
|
|
|
7850
7851
|
margin-top:0.375rem
|
|
7851
7852
|
}
|
|
7852
7853
|
|
|
7854
|
+
.mt-11{
|
|
7855
|
+
margin-top:2.75rem
|
|
7856
|
+
}
|
|
7857
|
+
|
|
7853
7858
|
.mt-12{
|
|
7854
7859
|
margin-top:3rem
|
|
7855
7860
|
}
|
|
@@ -8330,6 +8335,10 @@ tag.tagify__tag{
|
|
|
8330
8335
|
max-width:6rem
|
|
8331
8336
|
}
|
|
8332
8337
|
|
|
8338
|
+
.max-w-2xl{
|
|
8339
|
+
max-width:42rem
|
|
8340
|
+
}
|
|
8341
|
+
|
|
8333
8342
|
.max-w-4xl{
|
|
8334
8343
|
max-width:56rem
|
|
8335
8344
|
}
|
|
@@ -9842,6 +9851,10 @@ tag.tagify__tag{
|
|
|
9842
9851
|
padding-left:0.25rem
|
|
9843
9852
|
}
|
|
9844
9853
|
|
|
9854
|
+
.pl-6{
|
|
9855
|
+
padding-left:1.5rem
|
|
9856
|
+
}
|
|
9857
|
+
|
|
9845
9858
|
.pr-0{
|
|
9846
9859
|
padding-right:0px
|
|
9847
9860
|
}
|
|
@@ -784,7 +784,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
784
784
|
tabindex="0"
|
|
785
785
|
role="option">`).concat(r.mappedValue||r.value,"</div>")},dropdownHeader:function(r){return`<header data-selector='tagify-suggestions-header' class="`.concat(this.settings.classNames.dropdownHeader,'"></header>')},dropdownFooter:function(r){var e=r.length-this.settings.dropdown.maxItems;return e>0?`<footer data-selector='tagify-suggestions-footer' class="`.concat(this.settings.classNames.dropdownFooter,`">
|
|
786
786
|
`).concat(e,` more items. Refine your search.
|
|
787
|
-
</footer>`):""},dropdownItemNoMatch:null};function fqe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function hqe(r,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](r):r instanceof e}function uVt(r,e){return(function(t){if(Array.isArray(t))return t})(r)||(function(t,n){var i=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i!=null){var o,a,s=[],c=!0,p=!1;try{for(i=i.call(t);!(c=(o=i.next()).done)&&(s.push(o.value),!n||s.length!==n);c=!0);}catch(m){p=!0,a=m}finally{try{c||i.return==null||i.return()}finally{if(p)throw a}}return s}})(r,e)||(function(t,n){if(t){if(typeof t=="string")return fqe(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return fqe(t,n)}})(r,e)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function $K(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function P1(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dqe(r,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](r):r instanceof e}function cVt(r,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):(function(t,n){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter((function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.push.apply(i,o)}return i})(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})),r}function GK(r){return(function(e){if(Array.isArray(e))return $K(e)})(r)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(r)||(function(e,t){if(e){if(typeof e=="string")return $K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $K(e,t)}})(r)||(function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}var fVt={customBinding:function(){var r=this;this.customEventsList.forEach((function(e){r.on(e,r.settings.callbacks[e])}))},binding:function(){var r,e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],t=this.settings,n=this.events.callbacks,i=e?"addEventListener":"removeEventListener";if(!(this.state.mainEvents&&e||t.disabled||t.readonly)){for(var o in this.state.mainEvents=e,e&&!this.listeners.main&&(this.events.bindGlobal.call(this),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),r=this.listeners.main=this.listeners.main||{keydown:["input",n.onKeydown.bind(this)],click:["scope",n.onClickScope.bind(this)],dblclick:t.mode!="select"&&["scope",n.onDoubleClickScope.bind(this)],paste:["input",n.onPaste.bind(this)],drop:["input",n.onDrop.bind(this)],compositionstart:["input",n.onCompositionStart.bind(this)],compositionend:["input",n.onCompositionEnd.bind(this)]})r[o]&&this.DOM[r[o][0]][i](o,r[o][1]);var a=this.listeners.main.inputMutationObserver||new MutationObserver(n.onInputDOMChange.bind(this));a.disconnect(),t.mode=="mix"&&a.observe(this.DOM.input,{childList:!0}),this.events.bindOriginaInputListener.call(this),e&&(this.listeners.main=void 0)}},bindOriginaInputListener:function(r){var e=(r||0)+500;this.listeners.main&&(clearInterval(this.listeners.main.originalInputValueObserverInterval),this.listeners.main.originalInputValueObserverInterval=setInterval(this.events.callbacks.observeOriginalInputValue.bind(this),e))},bindGlobal:function(r){var e,t=this.events.callbacks,n=r?"removeEventListener":"addEventListener";if(this.listeners&&(r||!this.listeners.global)){this.listeners.global=this.listeners.global||[{type:this.isIE?"keydown":"input",target:this.DOM.input,cb:t[this.isIE?"onInputIE":"onInput"].bind(this)},{type:"keydown",target:window,cb:t.onWindowKeyDown.bind(this)},{type:"focusin",target:this.DOM.scope,cb:t.onFocusBlur.bind(this)},{type:"focusout",target:this.DOM.scope,cb:t.onFocusBlur.bind(this)},{type:"click",target:document,cb:t.onClickAnywhere.bind(this),useCapture:!0}];var i=!0,o=!1,a=void 0;try{for(var s,c=this.listeners.global[Symbol.iterator]();!(i=(s=c.next()).done);i=!0)(e=s.value).target[n](e.type,e.cb,!!e.useCapture)}catch(p){o=!0,a=p}finally{try{i||c.return==null||c.return()}finally{if(o)throw a}}r&&(this.listeners.global=void 0)}},unbindGlobal:function(){this.events.bindGlobal.call(this,!0)},callbacks:{onFocusBlur:function(r){var e,t,n=this.settings,i=cqe.call(this,r.relatedTarget),o=R1.call(this,r.target),a=r.target.classList.contains(n.classNames.tagX),s=r.type=="focusin",c=r.type=="focusout";a&&n.mode!="mix"&&n.focusInputOnRemove&&this.DOM.input.focus(),i&&s&&!o&&!a&&this.toggleFocusClass(this.state.hasFocus=+new Date);var p=r.target?this.trim(this.DOM.input.textContent):"",m=(t=this.value)===null||t===void 0||(e=t[0])===null||e===void 0?void 0:e[n.tagTextProp],x=n.dropdown.enabled>=0,O={relatedTarget:r.relatedTarget},M=this.state.actions.selectOption&&(x||!n.dropdown.closeOnSelect),R=this.state.actions.addNew&&x;if(c){if(r.relatedTarget===this.DOM.scope)return this.dropdown.hide(),void this.DOM.input.focus();this.postUpdate(),n.onChangeAfterBlur&&this.triggerChangeEvent()}if(!(M||R||a))if(this.state.hasFocus=!(!s&&!i)&&+new Date,this.toggleFocusClass(this.state.hasFocus),n.mode!="mix"){if(s){if(!n.focusable)return;var F=n.dropdown.enabled===0&&!this.state.dropdown.visible,H=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector);return this.trigger("focus",O),void(F&&!o&&(this.dropdown.show(this.value.length?"":void 0),n.mode==="select"&&this.setRangeAtStartEnd(!1,H)))}if(c){if(this.trigger("blur",O),this.loading(!1),n.mode=="select"){if(this.value.length){var $=this.getTagElms()[0];p=this.trim($.textContent)}m===p&&(p="")}p&&!this.state.actions.selectOption&&n.addTagOnBlur&&n.addTagOn.includes("blur")&&this.addTags(p,!0)}i||(this.DOM.input.removeAttribute("style"),this.dropdown.hide())}else s?this.trigger("focus",O):c&&(this.trigger("blur",O),this.loading(!1),this.dropdown.hide(),this.state.dropdown.visible=void 0,this.setStateSelection())},onCompositionStart:function(r){this.state.composing=!0},onCompositionEnd:function(r){this.state.composing=!1},onWindowKeyDown:function(r){var e,t=this.settings,n=document.activeElement,i=cqe.call(this,n)&&this.DOM.scope.contains(n),o=n===this.DOM.input,a=i&&n.hasAttribute("readonly"),s=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector),c=this.state.dropdown.visible;if((r.key==="Tab"&&c||this.state.hasFocus||i&&!a)&&!o){e=n.nextElementSibling;var p=r.target.classList.contains(t.classNames.tagX);switch(r.key){case"Backspace":t.readonly||this.state.editing||(this.removeTags(n),(e||this.DOM.input).focus());break;case"Enter":if(p)return void this.removeTags(r.target.parentNode);t.a11y.focusableTags&&R1.call(this,n)&&setTimeout(this.editTag.bind(this),0,n);break;case"ArrowDown":this.state.dropdown.visible||t.mode=="mix"||this.dropdown.show();break;case"Tab":s?.focus()}}},onKeydown:function(r){var e=this,t=this.settings;if(!this.state.composing&&t.userInput){t.mode=="select"&&t.enforceWhitelist&&this.value.length&&r.key!="Tab"&&r.preventDefault();var n=this.trim(r.target.textContent);this.trigger("keydown",{event:r}),t.hooks.beforeKeyDown(r,{tagify:this}).then((function(i){if(t.mode=="mix"){switch(r.key){case"Left":case"ArrowLeft":e.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(e.state.editing)return;var o=document.getSelection(),a=r.key=="Delete"&&o.anchorOffset==(o.anchorNode.length||0),s=o.anchorNode.previousSibling,c=o.anchorNode.nodeType==1||!o.anchorOffset&&s&&s.nodeType==1&&o.anchorNode.previousSibling;(function(Y){var ne=document.createElement("div");Y.replace(/\&#?[0-9a-z]+;/gi,(function(w){return ne.innerHTML=w,ne.innerText}))})(e.DOM.input.innerHTML);var p,m,x,O=e.getTagElms(),M=o.anchorNode.length===1&&o.anchorNode.nodeValue=="\u200B";if(t.backspace=="edit"&&c)return p=o.anchorNode.nodeType==1?null:o.anchorNode.previousElementSibling,setTimeout(e.editTag.bind(e),0,p),void r.preventDefault();if(lqe()&&dqe(c,Element))return x=aqe(c),c.hasAttribute("readonly")||c.remove(),e.DOM.input.focus(),void setTimeout((function(){C0(x),e.DOM.input.click()}));if(o.anchorNode.nodeName=="BR")return;if((a||c)&&o.anchorNode.nodeType==1?m=o.anchorOffset==0?a?O[0]:null:O[Math.min(O.length,o.anchorOffset)-1]:a?m=o.anchorNode.nextElementSibling:dqe(c,Element)&&(m=c),o.anchorNode.nodeType==3&&!o.anchorNode.nodeValue&&o.anchorNode.previousElementSibling&&r.preventDefault(),(c||a)&&!t.backspace||o.type!="Range"&&!o.anchorOffset&&o.anchorNode==e.DOM.input&&r.key!="Delete")return void r.preventDefault();if(o.type!="Range"&&m&&m.hasAttribute("readonly"))return void C0(aqe(m));r.key=="Delete"&&M&&ol(o.anchorNode.nextSibling)&&e.removeTags(o.anchorNode.nextSibling);break;case"Enter":if(r.preventDefault(),e.state.tag)return;var R=window.getSelection();R.getRangeAt(0).insertNode(document.createElement("br")),R.collapseToEnd()}return!0}var F=t.dropdown.position=="manual";switch(r.key){case"Backspace":t.mode=="select"&&t.enforceWhitelist&&e.value.length?e.removeTags():e.state.dropdown.visible&&t.dropdown.position!="manual"||r.target.textContent!=""&&n.charCodeAt(0)!=8203||(t.backspace===!0?e.removeTags():t.backspace=="edit"&&setTimeout(e.editTag.bind(e),0));break;case"Esc":case"Escape":if(e.state.dropdown.visible)return;r.target.blur();break;case"Down":case"ArrowDown":e.state.dropdown.visible||e.dropdown.show();break;case"ArrowRight":var H=e.state.inputSuggestion||e.state.ddItemData;if(H&&t.autoComplete.rightKey)return void e.addTags([H],!0);break;case"Tab":return!0;case"Enter":if(e.state.dropdown.visible&&!F)return;r.preventDefault();var $=e.state.autoCompleteData||n;setTimeout((function(){e.state.dropdown.visible&&!F||e.state.actions.selectOption||!t.addTagOn.includes(r.key.toLowerCase())||(e.addTags([$],!0),e.state.autoCompleteData=null)}))}})).catch((function(i){return i}))}},onInput:function(r){this.postUpdate();var e=this.settings;if(e.mode=="mix")return this.events.callbacks.onMixTagsInput.call(this,r);var t=this.input.normalize.call(this,void 0,{trim:!1}),n=t.length>=e.dropdown.enabled,i={value:t,inputElm:this.DOM.input},o=this.validateTag({value:t});e.mode=="select"&&this.toggleScopeValidation(o),i.isValid=o,this.state.inputText!=t&&(this.input.set.call(this,t,!1),t.search(e.delimiters)!=-1?this.addTags(t)&&this.input.set.call(this):e.dropdown.enabled>=0&&this.dropdown[n?"show":"hide"](t),this.trigger("input",i))},onMixTagsInput:function(r){var e,t,n,i,o,a,s,c,p=this,m=this.settings,x=this.value.length,O=this.getTagElms(),M=document.createDocumentFragment(),R=window.getSelection().getRangeAt(0),F=[].map.call(O,(function(H){return ol(H).value}));if(r.inputType=="deleteContentBackward"&&lqe()&&this.events.callbacks.onKeydown.call(this,{target:r.target,key:"Backspace"}),vqe(this.getTagElms()),this.value.slice().forEach((function(H){H.readonly&&!F.includes(H.value)&&M.appendChild(p.createTagElem(H))})),M.childNodes.length&&(R.insertNode(M),this.setRangeAtStartEnd(!1,M.lastChild)),O.length!=x)return this.value=[].map.call(this.getTagElms(),(function(H){return ol(H)})),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(a=window.getSelection()).rangeCount>0&&a.anchorNode.nodeType==3){if((R=a.getRangeAt(0).cloneRange()).collapse(!0),R.setStart(a.focusNode,0),n=(e=R.toString().slice(0,R.endOffset)).split(m.pattern).length-1,(t=e.match(m.pattern))&&(i=e.slice(e.lastIndexOf(t[t.length-1]))),i){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:i.match(m.pattern)[0],value:i.replace(m.pattern,"")},this.state.tag.baseOffset=a.baseOffset-this.state.tag.value.length,c=this.state.tag.value.match(m.delimiters))return this.state.tag.value=this.state.tag.value.replace(m.delimiters,""),this.state.tag.delimiters=c[0],this.addTags(this.state.tag.value,m.dropdown.clearOnSelect),void this.dropdown.hide();o=this.state.tag.value.length>=m.dropdown.enabled;try{s=(s=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&s.value[0]==this.state.tag.value[0],this.state.flaggedTags[this.state.tag.baseOffset]&&!this.state.tag.value&&delete this.state.flaggedTags[this.state.tag.baseOffset]}catch{}(s||n<this.state.mixMode.matchedPatternCount)&&(o=!1)}else this.state.flaggedTags={};this.state.mixMode.matchedPatternCount=n}setTimeout((function(){p.update({withoutChangeEvent:!0}),p.trigger("input",Sc({},p.state.tag,{textContent:p.DOM.input.textContent})),p.state.tag&&p.dropdown[o?"show":"hide"](p.state.tag.value)}),10)},onInputIE:function(r){var e=this;setTimeout((function(){e.events.callbacks.onInput.call(e,r)}))},observeOriginalInputValue:function(){this.DOM.originalInput.parentNode||this.destroy(),this.DOM.originalInput.value!=this.DOM.originalInput.tagifyValue&&this.loadOriginalValues()},onClickAnywhere:function(r){if(r.target!=this.DOM.scope&&!this.DOM.scope.contains(r.target)){this.toggleFocusClass(!1),this.state.hasFocus=!1;var e=r.target.closest(this.settings.classNames.dropdownSelector);e?.__tagify!=this&&this.dropdown.hide()}},onClickScope:function(r){var e=this.settings,t=r.target.closest("."+e.classNames.tag);r.target,this.DOM.scope;var n=+new Date-this.state.hasFocus;if(!r.target.classList.contains(e.classNames.tagX))return t&&!this.state.editing?(this.trigger("click",{tag:t,index:this.getNodeIndex(t),data:ol(t),event:r}),void(e.editTags!==1&&e.editTags.clicks!==1&&e.mode!="select"||this.events.callbacks.onDoubleClickScope.call(this,r))):void(r.target==this.DOM.input&&(e.mode=="mix"&&this.fixFirefoxLastTagNoCaret(),n>500||!e.focusable)?this.state.dropdown.visible?this.dropdown.hide():e.dropdown.enabled===0&&e.mode!="mix"&&this.dropdown.show(this.value.length?"":void 0):e.mode!="select"||e.dropdown.enabled!==0||this.state.dropdown.visible||(this.events.callbacks.onDoubleClickScope.call(this,cVt((function(i){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{},s=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(a).filter((function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})))),s.forEach((function(c){P1(i,c,a[c])}))}return i})({},r),{target:this.getTagElms()[0]})),!e.userInput&&this.dropdown.show()));this.removeTags(r.target.parentNode)},onPaste:function(r){var e=this;r.preventDefault();var t,n,i,o=this.settings;if(!o.userInput)return!1;o.readonly||(n=r.clipboardData||window.clipboardData,i=n.getData("Text"),o.hooks.beforePaste(r,{tagify:this,pastedText:i,clipboardData:n}).then((function(a){a===void 0&&(a=i),a&&(e.injectAtCaret(a,window.getSelection().getRangeAt(0)),e.settings.mode=="mix"?e.events.callbacks.onMixTagsInput.call(e,r):e.settings.pasteAsTags?t=e.addTags(e.state.inputText+a,!0):(e.state.inputText=a,e.dropdown.show(a))),e.trigger("paste",{event:r,pastedText:i,clipboardData:n,tagsElems:t})})).catch((function(a){return a})))},onDrop:function(r){r.preventDefault()},onEditTagInput:function(r,e){var t,n=r.closest("."+this.settings.classNames.tag),i=this.getNodeIndex(n),o=ol(n),a=this.input.normalize.call(this,r),s=(P1(t={},this.settings.tagTextProp,a),P1(t,"__tagId",o.__tagId),t),c=this.validateTag(s);this.editTagChangeDetected(Sc(o,s))||r.originalIsValid!==!0||(c=!0),n.classList.toggle(this.settings.classNames.tagInvalid,c!==!0),o.__isValid=c,n.title=c===!0?o.title||o.value:c,a.length>=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=a),this.dropdown.show(a)),this.trigger("edit:input",{tag:n,index:i,data:Sc({},this.value[i],{newValue:a}),event:e})},onEditTagPaste:function(r,e){var t=(e.clipboardData||window.clipboardData).getData("Text");e.preventDefault();var n=gqe(t);this.setRangeAtStartEnd(!1,n)},onEditTagClick:function(r,e){this.events.callbacks.onClickScope.call(this,e)},onEditTagFocus:function(r){this.state.editing={scope:r,input:r.querySelector("[contenteditable]")}},onEditTagBlur:function(r,e){var t=R1.call(this,e.relatedTarget);if(this.settings.mode=="select"&&t&&e.relatedTarget.contains(e.target))this.dropdown.hide();else if(this.state.editing&&(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(document.activeElement)||this.trigger("blur",{}),this.DOM.scope.contains(r))){var n,i,o,a=this.settings,s=r.closest("."+a.classNames.tag),c=ol(s),p=this.input.normalize.call(this,r),m=(P1(n={},a.tagTextProp,p),P1(n,"__tagId",c.__tagId),n),x=c.__originalData,O=this.editTagChangeDetected(Sc(c,m)),M=this.validateTag(m);if(p)if(O){var R;if(i=this.hasMaxTags(),o=Sc({},x,(P1(R={},a.tagTextProp,this.trim(p)),P1(R,"__isValid",M),R)),a.transformTag.call(this,o,x),(M=(!i||x.__isValid===!0)&&this.validateTag(o))!==!0){if(this.trigger("invalid",{data:o,tag:s,message:M}),a.editTags.keepInvalid)return;a.keepInvalidTags?o.__isValid=M:o=x}else a.keepInvalidTags&&(delete o.title,delete o["aria-invalid"],delete o.class);this.onEditTagDone(s,o)}else this.onEditTagDone(s,x);else this.onEditTagDone(s)}},onEditTagkeydown:function(r,e){if(!this.state.composing)switch(this.trigger("edit:keydown",{event:r}),r.key){case"Esc":case"Escape":this.state.editing=!1,e.__tagifyTagData.__originalData.value?e.parentNode.replaceChild(e.__tagifyTagData.__originalHTML,e):e.remove();break;case"Enter":case"Tab":r.preventDefault(),setTimeout((function(){return r.target.blur()}),0)}},onDoubleClickScope:function(r){var e=r.target.closest("."+this.settings.classNames.tag);if(e){var t,n,i=ol(e),o=this.settings;i?.editable!==!1&&(t=e.classList.contains(this.settings.classNames.tagEditing),n=e.hasAttribute("readonly"),o.readonly||t||n||!this.settings.editTags||!o.userInput||(this.events.callbacks.onEditTagFocus.call(this,e),this.editTag(e)),this.toggleFocusClass(!0),o.mode!="select"&&this.trigger("dblclick",{tag:e,index:this.getNodeIndex(e),data:ol(e)}))}},onInputDOMChange:function(r){var e=this;r.forEach((function(n){n.addedNodes.forEach((function(i){if(i.outerHTML=="<div><br></div>")i.replaceWith(document.createElement("br"));else if(i.nodeType==1&&i.querySelector(e.settings.classNames.tagSelector)){var o,a=document.createTextNode("");i.childNodes[0].nodeType==3&&i.previousSibling.nodeName!="BR"&&(a=document.createTextNode(`
|
|
787
|
+
</footer>`):""},dropdownItemNoMatch:null};function fqe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function hqe(r,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](r):r instanceof e}function uVt(r,e){return(function(t){if(Array.isArray(t))return t})(r)||(function(t,n){var i=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i!=null){var o,a,s=[],c=!0,p=!1;try{for(i=i.call(t);!(c=(o=i.next()).done)&&(s.push(o.value),!n||s.length!==n);c=!0);}catch(m){p=!0,a=m}finally{try{c||i.return==null||i.return()}finally{if(p)throw a}}return s}})(r,e)||(function(t,n){if(t){if(typeof t=="string")return fqe(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return fqe(t,n)}})(r,e)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function $K(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function P1(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dqe(r,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](r):r instanceof e}function cVt(r,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):(function(t,n){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter((function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.push.apply(i,o)}return i})(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})),r}function GK(r){return(function(e){if(Array.isArray(e))return $K(e)})(r)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(r)||(function(e,t){if(e){if(typeof e=="string")return $K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $K(e,t)}})(r)||(function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}var fVt={customBinding:function(){var r=this;this.customEventsList.forEach((function(e){r.on(e,r.settings.callbacks[e])}))},binding:function(){var r,e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],t=this.settings,n=this.events.callbacks,i=e?"addEventListener":"removeEventListener";if(!(this.state.mainEvents&&e||t.disabled||t.readonly)){for(var o in this.state.mainEvents=e,e&&!this.listeners.main&&(this.events.bindGlobal.call(this),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),r=this.listeners.main=this.listeners.main||{keydown:["input",n.onKeydown.bind(this)],click:["scope",n.onClickScope.bind(this)],dblclick:t.mode!="select"&&["scope",n.onDoubleClickScope.bind(this)],paste:["input",n.onPaste.bind(this)],drop:["input",n.onDrop.bind(this)],compositionstart:["input",n.onCompositionStart.bind(this)],compositionend:["input",n.onCompositionEnd.bind(this)]})r[o]&&this.DOM[r[o][0]][i](o,r[o][1]);var a=this.listeners.main.inputMutationObserver||new MutationObserver(n.onInputDOMChange.bind(this));a.disconnect(),t.mode=="mix"&&a.observe(this.DOM.input,{childList:!0}),this.events.bindOriginaInputListener.call(this),e&&(this.listeners.main=void 0)}},bindOriginaInputListener:function(r){var e=(r||0)+500;this.listeners.main&&(clearInterval(this.listeners.main.originalInputValueObserverInterval),this.listeners.main.originalInputValueObserverInterval=setInterval(this.events.callbacks.observeOriginalInputValue.bind(this),e))},bindGlobal:function(r){var e,t=this.events.callbacks,n=r?"removeEventListener":"addEventListener";if(this.listeners&&(r||!this.listeners.global)){this.listeners.global=this.listeners.global||[{type:this.isIE?"keydown":"input",target:this.DOM.input,cb:t[this.isIE?"onInputIE":"onInput"].bind(this)},{type:"keydown",target:window,cb:t.onWindowKeyDown.bind(this)},{type:"focusin",target:this.DOM.scope,cb:t.onFocusBlur.bind(this)},{type:"focusout",target:this.DOM.scope,cb:t.onFocusBlur.bind(this)},{type:"click",target:document,cb:t.onClickAnywhere.bind(this),useCapture:!0}];var i=!0,o=!1,a=void 0;try{for(var s,c=this.listeners.global[Symbol.iterator]();!(i=(s=c.next()).done);i=!0)(e=s.value).target[n](e.type,e.cb,!!e.useCapture)}catch(p){o=!0,a=p}finally{try{i||c.return==null||c.return()}finally{if(o)throw a}}r&&(this.listeners.global=void 0)}},unbindGlobal:function(){this.events.bindGlobal.call(this,!0)},callbacks:{onFocusBlur:function(r){var e,t,n=this.settings,i=cqe.call(this,r.relatedTarget),o=R1.call(this,r.target),a=r.target.classList.contains(n.classNames.tagX),s=r.type=="focusin",c=r.type=="focusout";a&&n.mode!="mix"&&n.focusInputOnRemove&&this.DOM.input.focus(),i&&s&&!o&&!a&&this.toggleFocusClass(this.state.hasFocus=+new Date);var p=r.target?this.trim(this.DOM.input.textContent):"",m=(t=this.value)===null||t===void 0||(e=t[0])===null||e===void 0?void 0:e[n.tagTextProp],x=n.dropdown.enabled>=0,O={relatedTarget:r.relatedTarget},M=this.state.actions.selectOption&&(x||!n.dropdown.closeOnSelect),R=this.state.actions.addNew&&x;if(c){if(r.relatedTarget===this.DOM.scope)return this.dropdown.hide(),void this.DOM.input.focus();this.postUpdate(),n.onChangeAfterBlur&&this.triggerChangeEvent()}if(!(M||R||a))if(this.state.hasFocus=!(!s&&!i)&&+new Date,this.toggleFocusClass(this.state.hasFocus),n.mode!="mix"){if(s){if(!n.focusable)return;var F=n.dropdown.enabled===0&&!this.state.dropdown.visible,H=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector);return this.trigger("focus",O),void(F&&!o&&(this.dropdown.show(this.value.length?"":void 0),n.mode==="select"&&this.setRangeAtStartEnd(!1,H)))}if(c){if(this.trigger("blur",O),this.loading(!1),n.mode=="select"){if(this.value.length){var $=this.getTagElms()[0];p=this.trim($.textContent)}m===p&&(p="")}p&&!this.state.actions.selectOption&&n.addTagOnBlur&&n.addTagOn.includes("blur")&&this.addTags(p,!0)}i||(this.DOM.input.removeAttribute("style"),this.dropdown.hide())}else s?this.trigger("focus",O):c&&(this.trigger("blur",O),this.loading(!1),this.dropdown.hide(),this.state.dropdown.visible=void 0,this.setStateSelection())},onCompositionStart:function(r){this.state.composing=!0},onCompositionEnd:function(r){this.state.composing=!1},onWindowKeyDown:function(r){var e,t=this.settings,n=document.activeElement,i=cqe.call(this,n)&&this.DOM.scope.contains(n),o=n===this.DOM.input,a=i&&n.hasAttribute("readonly"),s=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector),c=this.state.dropdown.visible;if((r.key==="Tab"&&c||this.state.hasFocus||i&&!a)&&!o){e=n.nextElementSibling;var p=r.target.classList.contains(t.classNames.tagX);switch(r.key){case"Backspace":t.readonly||this.state.editing||(this.removeTags(n),(e||this.DOM.input).focus());break;case"Enter":if(p)return void this.removeTags(r.target.parentNode);t.a11y.focusableTags&&R1.call(this,n)&&setTimeout(this.editTag.bind(this),0,n);break;case"ArrowDown":this.state.dropdown.visible||t.mode=="mix"||this.dropdown.show();break;case"Tab":s?.focus()}}},onKeydown:function(r){var e=this,t=this.settings;if(!this.state.composing&&t.userInput){t.mode=="select"&&t.enforceWhitelist&&this.value.length&&r.key!="Tab"&&r.preventDefault();var n=this.trim(r.target.textContent);this.trigger("keydown",{event:r}),t.hooks.beforeKeyDown(r,{tagify:this}).then((function(i){if(t.mode=="mix"){switch(r.key){case"Left":case"ArrowLeft":e.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(e.state.editing)return;var o=document.getSelection(),a=r.key=="Delete"&&o.anchorOffset==(o.anchorNode.length||0),s=o.anchorNode.previousSibling,c=o.anchorNode.nodeType==1||!o.anchorOffset&&s&&s.nodeType==1&&o.anchorNode.previousSibling;(function(Y){var ne=document.createElement("div");Y.replace(/\&#?[0-9a-z]+;/gi,(function(w){return ne.innerHTML=w,ne.innerText}))})(e.DOM.input.innerHTML);var p,m,x,O=e.getTagElms(),M=o.anchorNode.length===1&&o.anchorNode.nodeValue=="\u200B";if(t.backspace=="edit"&&c)return p=o.anchorNode.nodeType==1?null:o.anchorNode.previousElementSibling,setTimeout(e.editTag.bind(e),0,p),void r.preventDefault();if(lqe()&&dqe(c,Element))return x=aqe(c),c.hasAttribute("readonly")||c.remove(),e.DOM.input.focus(),void setTimeout((function(){C0(x),e.DOM.input.click()}));if(o.anchorNode.nodeName=="BR")return;if((a||c)&&o.anchorNode.nodeType==1?m=o.anchorOffset==0?a?O[0]:null:O[Math.min(O.length,o.anchorOffset)-1]:a?m=o.anchorNode.nextElementSibling:dqe(c,Element)&&(m=c),o.anchorNode.nodeType==3&&!o.anchorNode.nodeValue&&o.anchorNode.previousElementSibling&&r.preventDefault(),(c||a)&&!t.backspace||o.type!="Range"&&!o.anchorOffset&&o.anchorNode==e.DOM.input&&r.key!="Delete")return void r.preventDefault();if(o.type!="Range"&&m&&m.hasAttribute("readonly"))return void C0(aqe(m));r.key=="Delete"&&M&&ol(o.anchorNode.nextSibling)&&e.removeTags(o.anchorNode.nextSibling);break;case"Enter":if(r.preventDefault(),e.state.tag)return;var R=window.getSelection();R.getRangeAt(0).insertNode(document.createElement("br")),R.collapseToEnd()}return!0}var F=t.dropdown.position=="manual";switch(r.key){case"Backspace":t.mode=="select"&&t.enforceWhitelist&&e.value.length?e.removeTags():e.state.dropdown.visible&&t.dropdown.position!="manual"||r.target.textContent!=""&&n.charCodeAt(0)!=8203||(t.backspace===!0?e.removeTags():t.backspace=="edit"&&setTimeout(e.editTag.bind(e),0));break;case"Esc":case"Escape":if(e.state.dropdown.visible)return;r.target.blur();break;case"Down":case"ArrowDown":e.state.dropdown.visible||e.dropdown.show();break;case"ArrowRight":var H=e.state.inputSuggestion||e.state.ddItemData;if(H&&t.autoComplete.rightKey)return void e.addTags([H],!0);break;case"Tab":if(!t.addTagOn.includes(r.key.toLowerCase()))break;case"Enter":if(e.state.dropdown.visible&&!F)return;r.preventDefault();var $=e.state.autoCompleteData||n;setTimeout((function(){e.state.dropdown.visible&&!F||e.state.actions.selectOption||!t.addTagOn.includes(r.key.toLowerCase())||(e.addTags([$],!0),e.state.autoCompleteData=null)})),console.log(111111)}})).catch((function(i){return i}))}},onInput:function(r){this.postUpdate();var e=this.settings;if(e.mode=="mix")return this.events.callbacks.onMixTagsInput.call(this,r);var t=this.input.normalize.call(this,void 0,{trim:!1}),n=t.length>=e.dropdown.enabled,i={value:t,inputElm:this.DOM.input},o=this.validateTag({value:t});e.mode=="select"&&this.toggleScopeValidation(o),i.isValid=o,this.state.inputText!=t&&(this.input.set.call(this,t,!1),t.search(e.delimiters)!=-1?this.addTags(t)&&this.input.set.call(this):e.dropdown.enabled>=0&&this.dropdown[n?"show":"hide"](t),this.trigger("input",i))},onMixTagsInput:function(r){var e,t,n,i,o,a,s,c,p=this,m=this.settings,x=this.value.length,O=this.getTagElms(),M=document.createDocumentFragment(),R=window.getSelection().getRangeAt(0),F=[].map.call(O,(function(H){return ol(H).value}));if(r.inputType=="deleteContentBackward"&&lqe()&&this.events.callbacks.onKeydown.call(this,{target:r.target,key:"Backspace"}),vqe(this.getTagElms()),this.value.slice().forEach((function(H){H.readonly&&!F.includes(H.value)&&M.appendChild(p.createTagElem(H))})),M.childNodes.length&&(R.insertNode(M),this.setRangeAtStartEnd(!1,M.lastChild)),O.length!=x)return this.value=[].map.call(this.getTagElms(),(function(H){return ol(H)})),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(a=window.getSelection()).rangeCount>0&&a.anchorNode.nodeType==3){if((R=a.getRangeAt(0).cloneRange()).collapse(!0),R.setStart(a.focusNode,0),n=(e=R.toString().slice(0,R.endOffset)).split(m.pattern).length-1,(t=e.match(m.pattern))&&(i=e.slice(e.lastIndexOf(t[t.length-1]))),i){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:i.match(m.pattern)[0],value:i.replace(m.pattern,"")},this.state.tag.baseOffset=a.baseOffset-this.state.tag.value.length,c=this.state.tag.value.match(m.delimiters))return this.state.tag.value=this.state.tag.value.replace(m.delimiters,""),this.state.tag.delimiters=c[0],this.addTags(this.state.tag.value,m.dropdown.clearOnSelect),void this.dropdown.hide();o=this.state.tag.value.length>=m.dropdown.enabled;try{s=(s=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&s.value[0]==this.state.tag.value[0],this.state.flaggedTags[this.state.tag.baseOffset]&&!this.state.tag.value&&delete this.state.flaggedTags[this.state.tag.baseOffset]}catch{}(s||n<this.state.mixMode.matchedPatternCount)&&(o=!1)}else this.state.flaggedTags={};this.state.mixMode.matchedPatternCount=n}setTimeout((function(){p.update({withoutChangeEvent:!0}),p.trigger("input",Sc({},p.state.tag,{textContent:p.DOM.input.textContent})),p.state.tag&&p.dropdown[o?"show":"hide"](p.state.tag.value)}),10)},onInputIE:function(r){var e=this;setTimeout((function(){e.events.callbacks.onInput.call(e,r)}))},observeOriginalInputValue:function(){this.DOM.originalInput.parentNode||this.destroy(),this.DOM.originalInput.value!=this.DOM.originalInput.tagifyValue&&this.loadOriginalValues()},onClickAnywhere:function(r){if(r.target!=this.DOM.scope&&!this.DOM.scope.contains(r.target)){this.toggleFocusClass(!1),this.state.hasFocus=!1;var e=r.target.closest(this.settings.classNames.dropdownSelector);e?.__tagify!=this&&this.dropdown.hide()}},onClickScope:function(r){var e=this.settings,t=r.target.closest("."+e.classNames.tag);r.target,this.DOM.scope;var n=+new Date-this.state.hasFocus;if(!r.target.classList.contains(e.classNames.tagX))return t&&!this.state.editing?(this.trigger("click",{tag:t,index:this.getNodeIndex(t),data:ol(t),event:r}),void(e.editTags!==1&&e.editTags.clicks!==1&&e.mode!="select"||this.events.callbacks.onDoubleClickScope.call(this,r))):void(r.target==this.DOM.input&&(e.mode=="mix"&&this.fixFirefoxLastTagNoCaret(),n>500||!e.focusable)?this.state.dropdown.visible?this.dropdown.hide():e.dropdown.enabled===0&&e.mode!="mix"&&this.dropdown.show(this.value.length?"":void 0):e.mode!="select"||e.dropdown.enabled!==0||this.state.dropdown.visible||(this.events.callbacks.onDoubleClickScope.call(this,cVt((function(i){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{},s=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(a).filter((function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})))),s.forEach((function(c){P1(i,c,a[c])}))}return i})({},r),{target:this.getTagElms()[0]})),!e.userInput&&this.dropdown.show()));this.removeTags(r.target.parentNode)},onPaste:function(r){var e=this;r.preventDefault();var t,n,i,o=this.settings;if(!o.userInput)return!1;o.readonly||(n=r.clipboardData||window.clipboardData,i=n.getData("Text"),o.hooks.beforePaste(r,{tagify:this,pastedText:i,clipboardData:n}).then((function(a){a===void 0&&(a=i),a&&(e.injectAtCaret(a,window.getSelection().getRangeAt(0)),e.settings.mode=="mix"?e.events.callbacks.onMixTagsInput.call(e,r):e.settings.pasteAsTags?t=e.addTags(e.state.inputText+a,!0):(e.state.inputText=a,e.dropdown.show(a))),e.trigger("paste",{event:r,pastedText:i,clipboardData:n,tagsElems:t})})).catch((function(a){return a})))},onDrop:function(r){r.preventDefault()},onEditTagInput:function(r,e){var t,n=r.closest("."+this.settings.classNames.tag),i=this.getNodeIndex(n),o=ol(n),a=this.input.normalize.call(this,r),s=(P1(t={},this.settings.tagTextProp,a),P1(t,"__tagId",o.__tagId),t),c=this.validateTag(s);this.editTagChangeDetected(Sc(o,s))||r.originalIsValid!==!0||(c=!0),n.classList.toggle(this.settings.classNames.tagInvalid,c!==!0),o.__isValid=c,n.title=c===!0?o.title||o.value:c,a.length>=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=a),this.dropdown.show(a)),this.trigger("edit:input",{tag:n,index:i,data:Sc({},this.value[i],{newValue:a}),event:e})},onEditTagPaste:function(r,e){var t=(e.clipboardData||window.clipboardData).getData("Text");e.preventDefault();var n=gqe(t);this.setRangeAtStartEnd(!1,n)},onEditTagClick:function(r,e){this.events.callbacks.onClickScope.call(this,e)},onEditTagFocus:function(r){this.state.editing={scope:r,input:r.querySelector("[contenteditable]")}},onEditTagBlur:function(r,e){var t=R1.call(this,e.relatedTarget);if(this.settings.mode=="select"&&t&&e.relatedTarget.contains(e.target))this.dropdown.hide();else if(this.state.editing&&(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(document.activeElement)||this.trigger("blur",{}),this.DOM.scope.contains(r))){var n,i,o,a=this.settings,s=r.closest("."+a.classNames.tag),c=ol(s),p=this.input.normalize.call(this,r),m=(P1(n={},a.tagTextProp,p),P1(n,"__tagId",c.__tagId),n),x=c.__originalData,O=this.editTagChangeDetected(Sc(c,m)),M=this.validateTag(m);if(p)if(O){var R;if(i=this.hasMaxTags(),o=Sc({},x,(P1(R={},a.tagTextProp,this.trim(p)),P1(R,"__isValid",M),R)),a.transformTag.call(this,o,x),(M=(!i||x.__isValid===!0)&&this.validateTag(o))!==!0){if(this.trigger("invalid",{data:o,tag:s,message:M}),a.editTags.keepInvalid)return;a.keepInvalidTags?o.__isValid=M:o=x}else a.keepInvalidTags&&(delete o.title,delete o["aria-invalid"],delete o.class);this.onEditTagDone(s,o)}else this.onEditTagDone(s,x);else this.onEditTagDone(s)}},onEditTagkeydown:function(r,e){if(!this.state.composing)switch(this.trigger("edit:keydown",{event:r}),r.key){case"Esc":case"Escape":this.state.editing=!1,e.__tagifyTagData.__originalData.value?e.parentNode.replaceChild(e.__tagifyTagData.__originalHTML,e):e.remove();break;case"Enter":case"Tab":r.preventDefault(),setTimeout((function(){return r.target.blur()}),0)}},onDoubleClickScope:function(r){var e=r.target.closest("."+this.settings.classNames.tag);if(e){var t,n,i=ol(e),o=this.settings;i?.editable!==!1&&(t=e.classList.contains(this.settings.classNames.tagEditing),n=e.hasAttribute("readonly"),o.readonly||t||n||!this.settings.editTags||!o.userInput||(this.events.callbacks.onEditTagFocus.call(this,e),this.editTag(e)),this.toggleFocusClass(!0),o.mode!="select"&&this.trigger("dblclick",{tag:e,index:this.getNodeIndex(e),data:ol(e)}))}},onInputDOMChange:function(r){var e=this;r.forEach((function(n){n.addedNodes.forEach((function(i){if(i.outerHTML=="<div><br></div>")i.replaceWith(document.createElement("br"));else if(i.nodeType==1&&i.querySelector(e.settings.classNames.tagSelector)){var o,a=document.createTextNode("");i.childNodes[0].nodeType==3&&i.previousSibling.nodeName!="BR"&&(a=document.createTextNode(`
|
|
788
788
|
`)),(o=i).replaceWith.apply(o,GK([a].concat(GK(GK(i.childNodes).slice(0,-1))))),C0(a)}else if(R1.call(e,i)){var s;if(((s=i.previousSibling)===null||s===void 0?void 0:s.nodeType)!=3||i.previousSibling.textContent||i.previousSibling.remove(),i.previousSibling&&i.previousSibling.nodeName=="BR"){i.previousSibling.replaceWith(`
|
|
789
789
|
\u200B`);for(var c=i.nextSibling,p="";c;)p+=c.textContent,c=c.nextSibling;p.trim()&&C0(i.previousSibling)}else i.previousSibling&&!ol(i.previousSibling)||i.before("\u200B")}})),n.removedNodes.forEach((function(i){i&&i.nodeName=="BR"&&R1.call(e,t)&&(e.removeTags(t),e.fixFirefoxLastTagNoCaret())}))}));var t=this.DOM.input.lastChild;t&&t.nodeValue==""&&t.remove(),t&&t.nodeName=="BR"||this.DOM.input.appendChild(document.createElement("br"))}}};function KK(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function XK(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cy(r,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](r):r instanceof e}function pqe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})))),n.forEach((function(i){XK(r,i,t[i])}))}return r}function Gq(r){return(function(e){if(Array.isArray(e))return KK(e)})(r)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(r)||(function(e,t){if(e){if(typeof e=="string")return KK(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KK(e,t)}})(r)||(function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function VO(r,e){if(!r){A0.warn("input element not found",r);var t=new Proxy(this,{get:function(){return function(){return t}}});return t}if(r.__tagify)return A0.warn("input element is already Tagified - Same instance is returned.",r),r.__tagify;var n;Sc(this,(function(i){var o=document.createTextNode(""),a={};function s(c,p,m){m&&p.split(/\s+/g).forEach((function(x){return o[c+"EventListener"].call(o,x,m)}))}return{removeAllCustomListeners:function(){Object.entries(a).forEach((function(c){var p=uVt(c,2),m=p[0];p[1].forEach((function(x){return s("remove",m,x)}))})),a={}},off:function(c,p){return c&&(p?s("remove",c,p):c.split(/\s+/g).forEach((function(m){var x;(x=a[m])===null||x===void 0||x.forEach((function(O){return s("remove",m,O)})),delete a[m]}))),this},on:function(c,p){return p&&typeof p=="function"&&(c.split(/\s+/g).forEach((function(m){Array.isArray(a[m])?a[m].push(p):a[m]=[p]})),s("add",c,p)),this},trigger:function(c,p,m){var x;if(m=m||{cloneData:!0},c)if(i.settings.isJQueryPlugin)c=="remove"&&(c="removeTag"),jQuery(i.DOM.originalInput).triggerHandler(c,[p]);else{try{var O=typeof p=="object"?p:{value:p};if((O=m.cloneData?Sc({},O):O).tagify=this,p.event&&(O.event=this.cloneEvent(p.event)),hqe(p,Object))for(var M in p)hqe(p[M],HTMLElement)&&(O[M]=p[M]);x=new CustomEvent(c,{detail:O})}catch(R){A0.warn(R)}o.dispatchEvent(x)}}}})(this)),this.isFirefox=/firefox|fxios/i.test(navigator.userAgent)&&!/seamonkey/i.test(navigator.userAgent),this.isIE=window.document.documentMode,e=e||{},this.getPersistedData=(n=e.id,function(i){var o;if(n){var a,s="/"+i;if(((o=localStorage)===null||o===void 0?void 0:o.getItem(HO+n+"/v"))===1)try{a=JSON.parse(localStorage[HO+n+s])}catch{}return a}}),this.setPersistedData=(function(i){var o;return i?((o=localStorage)===null||o===void 0||o.setItem(HO+i+"/v",1),function(a,s){var c,p="/"+s,m=JSON.stringify(a);a&&s&&((c=localStorage)===null||c===void 0||c.setItem(HO+i+p,m),dispatchEvent(new Event("storage")))}):function(){}})(e.id),this.clearPersistedData=(function(i){return function(o){var a=HO+"/"+i+"/";if(o)localStorage.removeItem(a+o);else for(var s in localStorage)s.includes(a)&&localStorage.removeItem(s)}})(e.id),this.applySettings(r,e),this.state={inputText:"",editing:!1,composing:!1,actions:{},mixMode:{},dropdown:{},flaggedTags:{}},this.value=[],this.listeners={},this.DOM={},this.build(r),oVt.call(this),this.getCSSVars(),this.loadOriginalValues(),this.events.customBinding.call(this),this.events.binding.call(this),r.autofocus&&this.DOM.input.focus(),r.__tagify=this}VO.prototype={_dropdown:aVt,placeCaretAfterNode:C0,getSetTagData:ol,helpers:{sameStr:WO,removeCollectionProp:oqe,omit:YK,isObject:Og,parseHTML:HK,escapeHTML:L1,extend:Sc,concatWithoutDups:sqe,getUID:uqe,isNodeTag:R1},customEventsList:["change","add","remove","invalid","input","paste","click","keydown","focus","blur","edit:input","edit:beforeUpdate","edit:updated","edit:start","edit:keydown","dropdown:show","dropdown:hide","dropdown:select","dropdown:updated","dropdown:noMatch","dropdown:scroll"],dataProps:["__isValid","__removed","__originalData","__originalHTML","__tagId"],trim:function(r){return this.settings.trim&&r&&typeof r=="string"?r.trim():r},parseHTML:HK,templates:lVt,parseTemplate:function(r,e){return HK((r=this.settings.templates[r]||r).apply(this,e))},set whitelist(r){var e=r&&Array.isArray(r);this.settings.whitelist=e?r:[],this.setPersistedData(e?r:[],"whitelist")},get whitelist(){return this.settings.whitelist},set userInput(r){this.settings.userInput=!!r,this.setContentEditable(!!r)},get userInput(){return this.settings.userInput},generateClassSelectors:function(r){var e=function(n){var i=n;Object.defineProperty(r,i+"Selector",{get:function(){return"."+this[i].split(" ")[0]}})};for(var t in r)e(t)},applySettings:function(r,e){var t,n;WK.templates=this.templates;var i=Sc({},WK,e.mode=="mix"?{dropdown:{position:"text"}}:{}),o=this.settings=Sc({},i,e);if(o.disabled=r.hasAttribute("disabled"),o.readonly=o.readonly||r.hasAttribute("readonly"),o.placeholder=L1(r.getAttribute("placeholder")||o.placeholder||""),o.required=r.hasAttribute("required"),this.generateClassSelectors(o.classNames),this.isIE&&(o.autoComplete=!1),["whitelist","blacklist"].forEach((function(s){var c=r.getAttribute("data-"+s);c&&Cy(c=c.split(o.delimiters),Array)&&(o[s]=c)})),"autoComplete"in e&&!Og(e.autoComplete)&&(o.autoComplete=WK.autoComplete,o.autoComplete.enabled=e.autoComplete),o.mode=="mix"&&(o.pattern=o.pattern||/@/,o.autoComplete.rightKey=!0,o.delimiters=e.delimiters||null,o.tagTextProp&&!o.dropdown.searchKeys.includes(o.tagTextProp)&&o.dropdown.searchKeys.push(o.tagTextProp)),r.pattern)try{o.pattern=new RegExp(r.pattern)}catch{}if(o.delimiters){o._delimiters=o.delimiters;try{o.delimiters=new RegExp(this.settings.delimiters,"g")}catch{}}(o.disabled||o.readonly)&&(o.userInput=!1),this.TEXTS=pqe({},sVt,o.texts||{}),o.mode=="select"&&(o.dropdown.includeSelectedTags=!0),(o.mode!="select"||!((t=e.dropdown)===null||t===void 0)&&t.enabled)&&o.userInput||(o.dropdown.enabled=0),o.disabled&&(o.dropdown.enabled=!1),o.dropdown.appendTarget=((n=e.dropdown)===null||n===void 0?void 0:n.appendTarget)||document.body,o.dropdown.includeSelectedTags===void 0&&(o.dropdown.includeSelectedTags=o.duplicates);var a=this.getPersistedData("whitelist");Array.isArray(a)&&(this.whitelist=Array.isArray(o.whitelist)?sqe(o.whitelist,a):a)},getAttributes:function(r){var e,t=this.getCustomAttributes(r),n="";for(e in t)n+=" "+e+(r[e]!==void 0?'="'.concat(t[e],'"'):"");return n},getCustomAttributes:function(r){if(!Og(r))return"";var e,t={};for(e in r)e.slice(0,2)!="__"&&e!="class"&&r.hasOwnProperty(e)&&r[e]!==void 0&&(t[e]=L1(r[e]));return t},setStateSelection:function(){var r=window.getSelection(),e={anchorOffset:r.anchorOffset,anchorNode:r.anchorNode,range:r.getRangeAt&&r.rangeCount&&r.getRangeAt(0)};return this.state.selection=e,e},getCSSVars:function(){var r,e,t,n=getComputedStyle(this.DOM.scope,null);this.CSSVars={tagHideTransition:(r=(function(i){if(!i)return{};var o=(i=i.trim().split(" ")[0]).split(/\d+/g).filter((function(a){return a})).pop().trim();return{value:+i.split(o).filter((function(a){return a}))[0].trim(),unit:o}})((t="tag-hide-transition",n.getPropertyValue("--"+t))),e=r.value,r.unit=="s"?1e3*e:e)}},build:function(r){var e=this.DOM,t=r.closest("label");this.settings.mixMode.integrated?(e.originalInput=null,e.scope=r,e.input=r):(e.originalInput=r,e.originalInput_tabIndex=r.tabIndex,e.scope=this.parseTemplate("wrapper",[r,this.settings]),e.input=e.scope.querySelector(this.settings.classNames.inputSelector),r.parentNode.insertBefore(e.scope,r),r.tabIndex=-1),t&&t.setAttribute("for","")},destroy:function(){var r,e,t;this.events.unbindGlobal.call(this),(r=this.DOM.scope.parentNode)===null||r===void 0||r.removeChild(this.DOM.scope),this.DOM.originalInput.tabIndex=this.DOM.originalInput_tabIndex,delete this.DOM.originalInput.__tagify,this.dropdown.hide(!0),this.removeAllCustomListeners(),clearTimeout(this.dropdownHide__bindEventsTimeout),clearInterval((t=this.listeners)===null||t===void 0||(e=t.main)===null||e===void 0?void 0:e.originalInputValueObserverInterval)},loadOriginalValues:function(r){var e,t=this.settings;if(this.state.blockChangeEvent=!0,r===void 0){var n=this.getPersistedData("value");r=n&&!this.DOM.originalInput.value?n:t.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value}if(this.removeAllTags(),r)if(t.mode=="mix")this.parseMixTags(r),(e=this.DOM.input.lastChild)&&e.tagName=="BR"||this.DOM.input.insertAdjacentHTML("beforeend","<br>");else{try{Cy(JSON.parse(r),Array)&&(r=JSON.parse(r))}catch{}this.addTags(r,!0).forEach((function(i){return i&&i.classList.add(t.classNames.tagNoAnimation)}))}else this.postUpdate();this.state.lastOriginalValueReported=t.mixMode.integrated?"":this.DOM.originalInput.value},cloneEvent:function(r){var e={};for(var t in r)t!="path"&&(e[t]=r[t]);return e},loading:function(r){return this.state.isLoading=r,this.DOM.scope.classList[r?"add":"remove"](this.settings.classNames.scopeLoading),this},tagLoading:function(r,e){return r&&r.classList[e?"add":"remove"](this.settings.classNames.tagLoading),this},toggleClass:function(r,e){typeof r=="string"&&this.DOM.scope.classList.toggle(r,e)},toggleScopeValidation:function(r){var e=r===!0||r===void 0;!this.settings.required&&r&&r===this.TEXTS.empty&&(e=!0),this.toggleClass(this.settings.classNames.tagInvalid,!e),this.DOM.scope.title=e?"":r},toggleFocusClass:function(r){this.toggleClass(this.settings.classNames.focus,!!r)},setPlaceholder:function(r){var e=this;["data","aria"].forEach((function(t){return e.DOM.input.setAttribute("".concat(t,"-placeholder"),r)}))},triggerChangeEvent:function(){if(!this.settings.mixMode.integrated){var r=this.DOM.originalInput,e=this.state.lastOriginalValueReported!==r.value,t=new CustomEvent("change",{bubbles:!0});e&&(this.state.lastOriginalValueReported=r.value,t.simulated=!0,r._valueTracker&&r._valueTracker.setValue(Math.random()),r.dispatchEvent(t),this.trigger("change",this.state.lastOriginalValueReported),r.value=this.state.lastOriginalValueReported)}},events:fVt,fixFirefoxLastTagNoCaret:function(){},setRangeAtStartEnd:function(r,e){if(e){r=typeof r=="number"?r:!!r,e=e.lastChild||e;var t=document.getSelection();if(Cy(t.focusNode,Element)&&!this.DOM.input.contains(t.focusNode))return!0;try{t.rangeCount>=1&&["Start","End"].forEach((function(n){return t.getRangeAt(0)["set"+n](e,r||e.length)}))}catch(n){console.warn(n)}}},insertAfterTag:function(r,e){if(e=e||this.settings.mixMode.insertAfterTag,r&&r.parentNode&&e)return e=typeof e=="string"?document.createTextNode(e):e,r.parentNode.insertBefore(e,r.nextSibling),e},editTagChangeDetected:function(r){var e=r.__originalData;for(var t in e)if(!this.dataProps.includes(t)&&r[t]!=e[t])return!0;return!1},getTagTextNode:function(r){return r.querySelector(this.settings.classNames.tagTextSelector)},setTagTextNode:function(r,e){this.getTagTextNode(r).innerHTML=L1(e)},editTag:function(r,e){var t=this;r=r||this.getLastTag(),e=e||{};var n=this.settings,i=this.getTagTextNode(r),o=this.getNodeIndex(r),a=ol(r),s=this.events.callbacks,c=!0,p=n.mode=="select";if(!p&&this.dropdown.hide(),i){if(!Cy(a,Object)||!("editable"in a)||a.editable)return a=ol(r,{__originalData:Sc({},a),__originalHTML:r.cloneNode(!0)}),ol(a.__originalHTML,a.__originalData),i.setAttribute("contenteditable",!0),r.classList.add(n.classNames.tagEditing),this.events.callbacks.onEditTagFocus.call(this,r),i.addEventListener("click",s.onEditTagClick.bind(this,r)),i.addEventListener("blur",s.onEditTagBlur.bind(this,this.getTagTextNode(r))),i.addEventListener("input",s.onEditTagInput.bind(this,i)),i.addEventListener("paste",s.onEditTagPaste.bind(this,i)),i.addEventListener("keydown",(function(m){return s.onEditTagkeydown.call(t,m,r)})),i.addEventListener("compositionstart",s.onCompositionStart.bind(this)),i.addEventListener("compositionend",s.onCompositionEnd.bind(this)),e.skipValidation||(c=this.editTagToggleValidity(r)),i.originalIsValid=c,this.trigger("edit:start",{tag:r,index:o,data:a,isValid:c}),i.focus(),!p&&this.setRangeAtStartEnd(!1,i),n.dropdown.enabled===0&&!p&&this.dropdown.show(),this.state.hasFocus=!0,this}else A0.warn("Cannot find element in Tag template: .",n.classNames.tagTextSelector)},editTagToggleValidity:function(r,e){var t;if(e=e||ol(r))return(t=!("__isValid"in e)||e.__isValid===!0)||this.removeTagsFromValue(r),this.update(),r.classList.toggle(this.settings.classNames.tagNotAllowed,!t),e.__isValid=t,e.__isValid;A0.warn("tag has no data: ",r,e)},onEditTagDone:function(r,e){r=r||this.state.editing.scope,e=e||{};var t,n,i=this.settings,o={tag:r,index:this.getNodeIndex(r),previousData:ol(r),data:e};this.trigger("edit:beforeUpdate",o,{cloneData:!1}),this.state.editing=!1,delete e.__originalData,delete e.__originalHTML,r&&r.parentNode&&(((n=e[i.tagTextProp])!==void 0?!((t=(n+="").trim)===null||t===void 0)&&t.call(n):!(i.tagTextProp in e)&&e.value)?(r=this.replaceTag(r,e),this.editTagToggleValidity(r,e),i.a11y.focusableTags?r.focus():i.mode!="select"&&C0(r)):this.removeTags(r)),this.trigger("edit:updated",o),i.dropdown.closeOnSelect&&this.dropdown.hide(),this.settings.keepInvalidTags&&this.reCheckInvalidTags()},replaceTag:function(r,e){e&&e.value!==""&&e.value!==void 0||(e=r.__tagifyTagData),e.__isValid&&e.__isValid!=1&&Sc(e,this.getInvalidTagAttrs(e,e.__isValid));var t=this.createTagElem(e);return r.parentNode.replaceChild(t,r),this.updateValueByDOMTags(),t},updateValueByDOMTags:function(){var r=this;this.value.length=0;var e=this.settings.classNames,t=[e.tagNotAllowed.split(" ")[0],e.tagHide];[].forEach.call(this.getTagElms(),(function(n){Gq(n.classList).some((function(i){return t.includes(i)}))||r.value.push(ol(n))})),this.update(),this.dropdown.refilter()},injectAtCaret:function(r,e){var t;if(e=e||((t=this.state.selection)===null||t===void 0?void 0:t.range),typeof r=="string"&&(r=document.createTextNode(r)),!e&&r)return this.appendMixTags(r),this;if(!this.DOM.scope.contains(e?.startContainer))return this;var n=gqe(r,e);return this.setRangeAtStartEnd(!1,n),this.updateValueByDOMTags(),this.update(),this},input:{set:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],t=this.settings,n=t.dropdown.closeOnSelect;this.state.inputText=r,e&&(this.DOM.input.innerHTML=L1(""+r),r&&this.toggleClass(t.classNames.empty,!this.DOM.input.innerHTML)),!r&&n&&this.dropdown.hide.bind(this),this.input.autocomplete.suggest.call(this),this.input.validate.call(this)},raw:function(){return this.DOM.input.textContent},validate:function(){var r=!this.state.inputText||this.validateTag({value:this.state.inputText})===!0;return this.DOM.input.classList.toggle(this.settings.classNames.inputInvalid,!r),r},normalize:function(r,e){var t=r||this.DOM.input,n=[];t.childNodes.forEach((function(i){return i.nodeType==3&&n.push(i.nodeValue)})),n=n.join(`
|
|
790
790
|
`);try{n=n.replace(/(?:\r\n|\r|\n)/g,this.settings.delimiters.source.charAt(0))}catch{}return n=n.replace(/\s/g," "),e?.trim?this.trim(n):n},autocomplete:{suggest:function(r){if(this.settings.autoComplete.enabled){typeof(r=r||{value:""})!="object"&&(r={value:r});var e=this.dropdown.getMappedValue(r);if(typeof e!="number"){var t=this.state.inputText.toLowerCase(),n=e.substr(0,this.state.inputText.length).toLowerCase(),i=e.substring(this.state.inputText.length);e&&this.state.inputText&&n==t?(this.DOM.input.setAttribute("data-suggest",i),this.state.inputSuggestion=r):(this.DOM.input.removeAttribute("data-suggest"),delete this.state.inputSuggestion)}}},set:function(r){var e=this.DOM.input.getAttribute("data-suggest"),t=r||(e?this.state.inputText+e:null);return!!t&&(this.settings.mode=="mix"?this.replaceTextWithNode(document.createTextNode(this.state.tag.prefix+t)):(this.input.set.call(this,t),this.setRangeAtStartEnd(!1,this.DOM.input)),this.input.autocomplete.suggest.call(this),this.dropdown.hide(),!0)}}},getTagIdx:function(r){return this.value.findIndex((function(e){return e.__tagId==(r||{}).__tagId}))},getNodeIndex:function(r){var e=0;if(r)for(;r=r.previousElementSibling;)e++;return e},getTagElms:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n="."+Gq(this.settings.classNames.tag.split(" ")).concat(Gq(e)).join(".");return[].slice.call(this.DOM.scope.querySelectorAll(n))},getLastTag:function(){var r=this.settings.classNames,e=this.DOM.scope.querySelectorAll("".concat(r.tagSelector,":not(.").concat(r.tagHide,"):not([readonly])"));return e[e.length-1]},isTagDuplicate:function(r,e,t){var n=0,i=!0,o=!1,a=void 0;try{for(var s,c=this.value[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var p=s.value;WO(this.trim(""+r),p.value,e)&&t!=p.__tagId&&n++}}catch(m){o=!0,a=m}finally{try{i||c.return==null||c.return()}finally{if(o)throw a}}return n},getTagIndexByValue:function(r){var e=this,t=[],n=this.settings.dropdown.caseSensitive;return this.getTagElms().forEach((function(i,o){i.__tagifyTagData&&WO(e.trim(i.__tagifyTagData.value),r,n)&&t.push(o)})),t},getTagElmByValue:function(r){var e=this.getTagIndexByValue(r)[0];return this.getTagElms()[e]},flashTag:function(r){var e=this;r&&(r.classList.add(this.settings.classNames.tagFlash),setTimeout((function(){r.classList.remove(e.settings.classNames.tagFlash)}),100))},isTagBlacklisted:function(r){return r=this.trim(r.toLowerCase()),this.settings.blacklist.filter((function(e){return(""+e).toLowerCase()==r})).length},isTagWhitelisted:function(r){return!!this.getWhitelistItem(r)},getWhitelistItem:function(r,e,t){e=e||"value";var n,i=this.settings;return(t=t||i.whitelist).some((function(o){var a=typeof o=="object"?o[e]||o.value:o;if(WO(a,r,i.dropdown.caseSensitive,i.trim))return n=typeof o=="object"?o:{value:o},!0})),n||e!="value"||i.tagTextProp=="value"||(n=this.getWhitelistItem(r,i.tagTextProp,t)),n},validateTag:function(r){var e=this.settings,t="value"in r?"value":e.tagTextProp,n=this.trim(r[t]+"");return(r[t]+"").trim()?e.mode!="mix"&&e.pattern&&Cy(e.pattern,RegExp)&&!e.pattern.test(n)?this.TEXTS.pattern:!e.duplicates&&this.isTagDuplicate(n,e.dropdown.caseSensitive,r.__tagId)?this.TEXTS.duplicate:this.isTagBlacklisted(n)||e.enforceWhitelist&&!this.isTagWhitelisted(n)?this.TEXTS.notAllowed:!e.validate||e.validate(r):this.TEXTS.empty},getInvalidTagAttrs:function(r,e){return{"aria-invalid":!0,class:"".concat(r.class||""," ").concat(this.settings.classNames.tagNotAllowed).trim(),title:e}},hasMaxTags:function(){return this.value.length>=this.settings.maxTags&&this.TEXTS.exceed},setReadonly:function(r,e){var t=this.settings;this.DOM.scope.contains(document.activeElement)&&document.activeElement.blur(),t[e||"readonly"]=r,this.DOM.scope[(r?"set":"remove")+"Attribute"](e||"readonly",!0),this.settings.userInput=!0,this.setContentEditable(!r),r||(this.events.binding.call(this,!0),this.events.binding.call(this))},setContentEditable:function(r){this.DOM.scope.querySelectorAll("[data-can-editable]").forEach((function(e){e.contentEditable=r,e.tabIndex=r?0:-1}))},setDisabled:function(r){this.setReadonly(r,"disabled")},normalizeTags:function(r){var e=this,t=this.settings,n=t.whitelist,i=t.delimiters,o=t.mode,a=t.tagTextProp,s=[],c=!!n&&Cy(n[0],Object),p=Array.isArray(r),m=p&&r[0].value,x=function(O){return(O+"").split(i).reduce((function(M,R){var F,H=e.trim(R);return H&&M.push((XK(F={},a,H),XK(F,"value",H),F)),M}),[])};if(typeof r=="number"&&(r=r.toString()),typeof r=="string"){if(!r.trim())return[];r=x(r)}else p&&(r=r.reduce((function(O,M){if(Og(M)){var R=Sc({},M);a in R||(a="value"),R[a]=e.trim(R[a]),(R[a]||R[a]===0)&&O.push(R)}else if(M!=null&&M!==""&&M!==void 0){var F;(F=O).push.apply(F,Gq(x(M)))}return O}),[]));return c&&!m&&(r.forEach((function(O){var M=s.map((function(H){return H.value})),R=e.dropdown.filterListItems.call(e,O[a],{exact:!0});e.settings.duplicates||(R=R.filter((function(H){return!M.includes(H.value)})));var F=R.length>1?e.getWhitelistItem(O[a],a,R):R[0];F&&Cy(F,Object)?s.push(F):o!="mix"&&(O.value==null&&(O.value=O[a]),s.push(O))})),s.length&&(r=s)),r},parseMixTags:function(r){var e=this,t=this.settings,n=t.mixTagsInterpolator,i=t.duplicates,o=t.transformTag,a=t.enforceWhitelist,s=t.maxTags,c=t.tagTextProp,p=[];r=r.split(n[0]).map((function(x,O){var M,R,F,H=x.split(n[1]),$=H[0],Y=p.length==s;try{if($==+$)throw Error;R=JSON.parse($)}catch{R=e.normalizeTags($)[0]||{value:$}}if(o.call(e,R),Y||!(H.length>1)||a&&!e.isTagWhitelisted(R.value)||!i&&e.isTagDuplicate(R.value)){if(x)return O?n[0]+x:x}else R[M=R[c]?c:"value"]=e.trim(R[M]),F=e.createTagElem(R),p.push(R),F.classList.add(e.settings.classNames.tagNoAnimation),H[0]=F.outerHTML,e.value.push(R);return H.join("")})).join(""),this.DOM.input.innerHTML=r,this.DOM.input.appendChild(document.createTextNode("")),this.DOM.input.normalize();var m=this.getTagElms();return m.forEach((function(x,O){return ol(x,p[O])})),this.update({withoutChangeEvent:!0}),vqe(m,this.state.hasFocus),r},replaceTextWithNode:function(r,e){if(this.state.tag||e){e=e||this.state.tag.prefix+this.state.tag.value;var t,n,i=this.state.selection||window.getSelection(),o=i.anchorNode,a=this.state.tag.delimiters?this.state.tag.delimiters.length:0;return o.splitText(i.anchorOffset-a),(t=o.nodeValue.lastIndexOf(e))==-1||(n=o.splitText(t),r&&o.parentNode.replaceChild(r,n)),!0}},prepareNewTagNode:function(r,e){e=e||{};var t=this.settings,n=[],i={},o=Object.assign({},r,{value:r.value+""});if(r=Object.assign({},o),t.transformTag.call(this,r),r.__isValid=this.hasMaxTags()||this.validateTag(r),r.__isValid!==!0){if(e.skipInvalid)return;if(Sc(i,this.getInvalidTagAttrs(r,r.__isValid),{__preInvalidData:o}),r.__isValid==this.TEXTS.duplicate&&this.flashTag(this.getTagElmByValue(r.value)),!t.createInvalidTags)return void n.push(r.value)}return"readonly"in r&&(r.readonly?i["aria-readonly"]=!0:delete r.readonly),{tagElm:this.createTagElem(r,i),tagData:r,aggregatedInvalidInput:n}},postProcessNewTagNode:function(r,e){var t=this,n=this.settings,i=e.__isValid;i&&i===!0?this.value.push(e):(this.trigger("invalid",{data:e,index:this.value.length,tag:r,message:i}),n.keepInvalidTags||setTimeout((function(){return t.removeTags(r,!0)}),1e3)),this.dropdown.position()},selectTag:function(r,e){var t=this;if(!this.settings.enforceWhitelist||this.isTagWhitelisted(e.value)){this.state.actions.selectOption&&setTimeout((function(){return t.setRangeAtStartEnd(!1,t.DOM.input)}));var n=this.getLastTag();return n?this.replaceTag(n,e):this.appendTag(r),this.value[0]=e,this.update(),this.trigger("add",{tag:r,data:e}),[r]}},addEmptyTag:function(r){var e=Sc({value:""},r||{}),t=this.createTagElem(e);ol(t,e),this.appendTag(t),this.editTag(t,{skipValidation:!0}),this.toggleFocusClass(!0)},addTags:function(r,e,t){var n=this,i=[],o=this.settings,a=[],s=document.createDocumentFragment(),c=[];if(!r||r.length==0)return i;switch(r=this.normalizeTags(r),o.mode){case"mix":return this.addMixTags(r);case"select":e=!1,this.removeAllTags()}return this.DOM.input.removeAttribute("style"),r.forEach((function(p){var m=n.prepareNewTagNode(p,{skipInvalid:t||o.skipInvalid});if(m){var x=m.tagElm;if(p=m.tagData,a=m.aggregatedInvalidInput,i.push(x),o.mode=="select")return n.selectTag(x,p);s.appendChild(x),n.postProcessNewTagNode(x,p),c.push({tagElm:x,tagData:p})}})),this.appendTag(s),c.forEach((function(p){var m=p.tagElm,x=p.tagData;return n.trigger("add",{tag:m,index:n.getTagIdx(x),data:x})})),this.update(),r.length&&e&&(this.input.set.call(this,o.createInvalidTags?"":a.join(o._delimiters)),this.setRangeAtStartEnd(!1,this.DOM.input)),this.dropdown.refilter(),i},addMixTags:function(r){var e=this;if((r=this.normalizeTags(r))[0].prefix||this.state.tag)return this.prefixedTextToTag(r[0]);var t=document.createDocumentFragment(),n=[];return r.forEach((function(i){var o=e.prepareNewTagNode(i);t.appendChild(o.tagElm),e.insertAfterTag(o.tagElm),e.postProcessNewTagNode(o.tagElm,o.tagData),n.push({tagElm:o.tagElm,tagData:o.tagData})})),this.appendMixTags(t,n),t.children},appendMixTags:function(r,e){var t=!!this.state.selection;t?this.injectAtCaret(r):(this.DOM.input.focus(),(t=this.setStateSelection()).range.setStart(this.DOM.input,t.range.endOffset),t.range.setEnd(this.DOM.input,t.range.endOffset),this.DOM.input.appendChild(r),this.updateValueByDOMTags(),this.update(),this.trigger("add",{tags:e||r.children}))},prefixedTextToTag:function(r){var e,t,n,i=this,o=this.settings,a=(e=this.state.tag)===null||e===void 0?void 0:e.delimiters;if(r.prefix=r.prefix||this.state.tag?this.state.tag.prefix:(o.pattern.source||o.pattern)[0],n=this.prepareNewTagNode(r),t=n.tagElm,this.replaceTextWithNode(t)||this.DOM.input.appendChild(t),setTimeout((function(){return t.classList.add(i.settings.classNames.tagNoAnimation)}),300),this.update(),!a){var s=this.insertAfterTag(t)||t;setTimeout(C0,0,s)}return this.state.tag=null,this.postProcessNewTagNode(t,n.tagData),this.trigger("add",{tag:n,data:r}),t},appendTag:function(r){var e=this.DOM,t=e.input;e.scope.insertBefore(r,t)},createTagElem:function(r,e){r.__tagId=uqe();var t,n=Sc({},r,pqe({value:L1(r.value+"")},e));return(function(i){for(var o,a=document.createNodeIterator(i,NodeFilter.SHOW_TEXT,null,!1);o=a.nextNode();)o.textContent.trim()||o.parentNode.removeChild(o)})(t=this.parseTemplate("tag",[n,this])),ol(t,r),t},reCheckInvalidTags:function(){var r=this,e=this.settings;this.getTagElms(e.classNames.tagNotAllowed).forEach((function(t,n){var i=ol(t),o=r.hasMaxTags(),a=r.validateTag(i),s=a===!0&&!o;if(e.mode=="select"&&r.toggleScopeValidation(a),s)return i=i.__preInvalidData?i.__preInvalidData:{value:i.value},r.replaceTag(t,i);t.title=o||a}))},removeTags:function(r,e,t){var n,i=this,o=this.settings;if(r=r&&Cy(r,HTMLElement)?[r]:Cy(r,Array)?r:r?[r]:[this.getLastTag()].filter((function(a){return a})),n=r.reduce((function(a,s){s&&typeof s=="string"&&(s=i.getTagElmByValue(s));var c=ol(s);return s&&c&&!c.readonly&&a.push({node:s,idx:i.getTagIdx(c),data:ol(s,{__removed:!0})}),a}),[]),t=typeof t=="number"?t:this.CSSVars.tagHideTransition,o.mode=="select"&&(t=0,this.input.set.call(this)),n.length==1&&o.mode!="select"&&n[0].node.classList.contains(o.classNames.tagNotAllowed)&&(e=!0),n.length)return o.hooks.beforeRemoveTag(n,{tagify:this}).then((function(){var a=function(s){s.node.parentNode&&(s.node.parentNode.removeChild(s.node),e?o.keepInvalidTags&&this.trigger("remove",{tag:s.node,index:s.idx}):(this.dropdown.refilter(),this.dropdown.position(),this.DOM.input.normalize(),o.keepInvalidTags&&this.reCheckInvalidTags(),this.trigger("remove",{tag:s.node,index:s.idx,data:s.data})))};e||(i.removeTagsFromValue(n.map((function(s){return s.node}))),i.update(),o.mode=="select"&&o.userInput&&i.setContentEditable(!0)),t&&t>10&&n.length==1?function(s){s.node.style.width=parseFloat(window.getComputedStyle(s.node).width)+"px",document.body.clientTop,s.node.classList.add(o.classNames.tagHide),setTimeout(a.bind(this),t,s)}.call(i,n[0]):n.forEach(a.bind(i))})).catch((function(a){}))},removeTagsFromDOM:function(){this.getTagElms().forEach((function(r){return r.remove()}))},removeTagsFromValue:function(r){var e=this;(r=Array.isArray(r)?r:[r]).forEach((function(t){var n=ol(t),i=e.getTagIdx(n);i>-1&&e.value.splice(i,1)}))},removeAllTags:function(r){var e=this;r=r||{},this.value=[],this.settings.mode=="mix"?this.DOM.input.innerHTML="":this.removeTagsFromDOM(),this.dropdown.refilter(),this.dropdown.position(),this.state.dropdown.visible&&setTimeout((function(){e.DOM.input.focus()})),this.settings.mode=="select"&&(this.input.set.call(this),this.settings.userInput&&this.setContentEditable(!0)),this.update(r,(function(){e.trigger("remove",{})}))},postUpdate:function(){this.state.blockChangeEvent=!1;var r,e,t=this.settings,n=t.classNames,i=t.mode=="mix"?t.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value.trim():this.value.length+this.input.raw.call(this).length;this.toggleClass(n.hasMaxTags,this.value.length>=t.maxTags),this.toggleClass(n.hasNoTags,!this.value.length),this.toggleClass(n.empty,!i),t.mode=="select"&&this.toggleScopeValidation((e=this.value)===null||e===void 0||(r=e[0])===null||r===void 0?void 0:r.__isValid)},setOriginalInputValue:function(r){var e=this.DOM.originalInput;this.settings.mixMode.integrated||(e.value=r,e.tagifyValue=e.value)},update:function(r,e){clearTimeout(this.debouncedUpdateTimeout),this.debouncedUpdateTimeout=setTimeout(function(){this.setPersistedData(t,"value"),this.settings.onChangeAfterBlur&&(r||{}).withoutChangeEvent||this.state.blockChangeEvent||this.triggerChangeEvent(),this.postUpdate(),e?.()}.bind(this),100),this.events.bindOriginaInputListener.call(this,100);var t=this.getInputValue();this.setOriginalInputValue(t)},getInputValue:function(){var r=this.getCleanValue();return this.settings.mode=="mix"?this.getMixedTagsAsString(r):r.length?this.settings.originalInputValueFormat?this.settings.originalInputValueFormat(r):JSON.stringify(r):""},getCleanValue:function(r){return oqe(r||this.value,this.dataProps)},getMixedTagsAsString:function(){var r="",e=this,t=this.settings,n=t.originalInputValueFormat||JSON.stringify,i=t.mixTagsInterpolator;return(function o(a){a.childNodes.forEach((function(s){if(s.nodeType==1){var c=ol(s);if(s.tagName=="BR"&&(r+=`\r
|