alchemy_cms 8.2.7 → 8.3.0

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.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/app/assets/builds/alchemy/admin.css +1 -1
  4. data/app/assets/builds/alchemy/alchemy_admin.min.js +1 -1
  5. data/app/assets/builds/alchemy/alchemy_admin.min.js.map +1 -1
  6. data/app/assets/builds/alchemy/dark-theme.css +1 -1
  7. data/app/assets/builds/alchemy/light-theme.css +1 -1
  8. data/app/assets/builds/alchemy/preview.min.js +1 -1
  9. data/app/assets/builds/alchemy/theme.css +1 -1
  10. data/app/assets/builds/alchemy/welcome.css +1 -1
  11. data/app/assets/builds/tinymce/skins/content/alchemy/content.min.css +1 -1
  12. data/app/assets/builds/tinymce/skins/content/alchemy-dark/content.min.css +1 -1
  13. data/app/assets/builds/tinymce/skins/ui/alchemy/skin.min.css +1 -1
  14. data/app/assets/builds/tinymce/skins/ui/alchemy-dark/skin.min.css +1 -1
  15. data/app/assets/images/alchemy/admin/logo.svg +27 -0
  16. data/app/assets/images/alchemy/icons-sprite.svg +1 -1
  17. data/app/components/alchemy/admin/dashboard/widget.rb +40 -0
  18. data/app/components/alchemy/admin/dashboard/widgets/attachment_counts.rb +17 -0
  19. data/app/components/alchemy/admin/dashboard/widgets/element_usage.rb +37 -0
  20. data/app/components/alchemy/admin/dashboard/widgets/greeting.html.erb +13 -0
  21. data/app/components/alchemy/admin/dashboard/widgets/greeting.rb +21 -0
  22. data/app/components/alchemy/admin/dashboard/widgets/locked_pages.html.erb +54 -0
  23. data/app/components/alchemy/admin/dashboard/widgets/locked_pages.rb +20 -0
  24. data/app/components/alchemy/admin/dashboard/widgets/online_users.html.erb +22 -0
  25. data/app/components/alchemy/admin/dashboard/widgets/online_users.rb +19 -0
  26. data/app/components/alchemy/admin/dashboard/widgets/page_counts.rb +23 -0
  27. data/app/components/alchemy/admin/dashboard/widgets/page_usage.rb +46 -0
  28. data/app/components/alchemy/admin/dashboard/widgets/picture_counts.rb +17 -0
  29. data/app/components/alchemy/admin/dashboard/widgets/recent_pages.html.erb +41 -0
  30. data/app/components/alchemy/admin/dashboard/widgets/recent_pages.rb +16 -0
  31. data/app/components/alchemy/admin/dashboard/widgets/sites.html.erb +29 -0
  32. data/app/components/alchemy/admin/dashboard/widgets/sites.rb +15 -0
  33. data/app/components/alchemy/admin/dashboard/widgets/stat_widget.html.erb +23 -0
  34. data/app/components/alchemy/admin/dashboard/widgets/stat_widget.rb +19 -0
  35. data/app/components/alchemy/admin/dashboard/widgets/system_info.html.erb +32 -0
  36. data/app/components/alchemy/admin/dashboard/widgets/system_info.rb +37 -0
  37. data/app/components/alchemy/admin/dashboard/widgets/usage_widget.html.erb +42 -0
  38. data/app/components/alchemy/admin/dashboard/widgets/usage_widget.rb +66 -0
  39. data/app/components/alchemy/admin/dashboard/widgets/user_counts.rb +25 -0
  40. data/app/components/alchemy/admin/element_editor.html.erb +27 -20
  41. data/app/components/alchemy/admin/element_schedule_timestamps.rb +33 -0
  42. data/app/components/alchemy/admin/element_select.rb +4 -3
  43. data/app/components/alchemy/admin/page_node.html.erb +1 -20
  44. data/app/components/alchemy/admin/page_publication_fields.html.erb +30 -0
  45. data/app/components/alchemy/admin/page_publication_fields.rb +18 -0
  46. data/app/components/alchemy/admin/page_status_indicators.html.erb +29 -0
  47. data/app/components/alchemy/admin/page_status_indicators.rb +9 -0
  48. data/app/components/alchemy/admin/publish_element_button.html.erb +12 -4
  49. data/app/components/alchemy/ingredients/headline_editor.rb +1 -1
  50. data/app/controllers/alchemy/admin/dashboard/widgets_controller.rb +21 -0
  51. data/app/controllers/alchemy/admin/dashboard_controller.rb +3 -12
  52. data/app/controllers/alchemy/pages_controller.rb +5 -4
  53. data/app/helpers/alchemy/elements_block_helper.rb +1 -0
  54. data/app/javascript/alchemy_admin/components/auto_submit.js +15 -9
  55. data/app/javascript/alchemy_admin/components/char_counter.js +17 -7
  56. data/app/javascript/alchemy_admin/components/clipboard_button.js +2 -6
  57. data/app/javascript/alchemy_admin/components/color_select.js +13 -4
  58. data/app/javascript/alchemy_admin/components/datepicker.js +11 -14
  59. data/app/javascript/alchemy_admin/components/dialog_link.js +5 -2
  60. data/app/javascript/alchemy_admin/components/element_editor/delete_element_button.js +6 -3
  61. data/app/javascript/alchemy_admin/components/element_editor.js +45 -28
  62. data/app/javascript/alchemy_admin/components/element_select.js +7 -4
  63. data/app/javascript/alchemy_admin/components/elements_window.js +38 -31
  64. data/app/javascript/alchemy_admin/components/elements_window_handle.js +7 -3
  65. data/app/javascript/alchemy_admin/components/file_editor.js +5 -2
  66. data/app/javascript/alchemy_admin/components/ingredient_group.js +6 -4
  67. data/app/javascript/alchemy_admin/components/link_buttons/link_button.js +1 -2
  68. data/app/javascript/alchemy_admin/components/link_buttons/unlink_button.js +1 -2
  69. data/app/javascript/alchemy_admin/components/link_buttons.js +6 -2
  70. data/app/javascript/alchemy_admin/components/list_filter.js +44 -29
  71. data/app/javascript/alchemy_admin/components/message.js +22 -15
  72. data/app/javascript/alchemy_admin/components/overlay.js +5 -7
  73. data/app/javascript/alchemy_admin/components/page_publication_fields.js +38 -25
  74. data/app/javascript/alchemy_admin/components/picture_description_select.js +5 -2
  75. data/app/javascript/alchemy_admin/components/picture_editor.js +5 -10
  76. data/app/javascript/alchemy_admin/components/picture_thumbnail.js +4 -5
  77. data/app/javascript/alchemy_admin/components/preview_window.js +5 -10
  78. data/app/javascript/alchemy_admin/components/publish_page_button.js +2 -5
  79. data/app/javascript/alchemy_admin/components/remote_select.js +53 -23
  80. data/app/javascript/alchemy_admin/components/select.js +169 -26
  81. data/app/javascript/alchemy_admin/components/sortable_elements.js +1 -1
  82. data/app/javascript/alchemy_admin/components/spinner.js +11 -11
  83. data/app/javascript/alchemy_admin/components/tags_autocomplete.js +9 -1
  84. data/app/javascript/alchemy_admin/components/tinymce.js +16 -22
  85. data/app/javascript/alchemy_admin/components/uploader/file_upload.js +48 -45
  86. data/app/javascript/alchemy_admin/components/uploader/progress.js +70 -84
  87. data/app/javascript/alchemy_admin/components/uploader.js +71 -46
  88. data/app/javascript/alchemy_admin/dialog.js +3 -0
  89. data/app/javascript/alchemy_admin/hotkeys.js +0 -18
  90. data/app/javascript/alchemy_admin/image_cropper.js +7 -9
  91. data/app/javascript/alchemy_admin/initializer.js +21 -0
  92. data/app/javascript/alchemy_admin/utils/dispatch_page_dirty_event.js +7 -0
  93. data/app/javascript/tinymce/plugins/alchemy_link/index.js +9 -0
  94. data/app/jobs/alchemy/base_job.rb +2 -2
  95. data/app/jobs/alchemy/invalidate_elements_cache_job.rb +33 -0
  96. data/app/models/alchemy/page/page_naming.rb +28 -5
  97. data/app/models/alchemy/page/page_natures.rb +7 -2
  98. data/app/models/alchemy/page/page_scopes.rb +2 -2
  99. data/app/models/alchemy/page/url_path.rb +7 -2
  100. data/app/models/alchemy/page.rb +2 -2
  101. data/app/models/alchemy/page_definition.rb +1 -0
  102. data/app/models/alchemy/permissions.rb +1 -1
  103. data/app/models/concerns/alchemy/relatable_resource.rb +8 -0
  104. data/app/services/alchemy/page_finder.rb +88 -0
  105. data/app/stylesheets/alchemy/_custom-properties.scss +6 -4
  106. data/app/stylesheets/alchemy/_mixins.scss +1 -7
  107. data/app/stylesheets/alchemy/_themes.scss +13 -1
  108. data/app/stylesheets/alchemy/admin/_tom-select.scss +240 -0
  109. data/app/stylesheets/alchemy/admin/archive.scss +0 -1
  110. data/app/stylesheets/alchemy/admin/base.scss +0 -19
  111. data/app/stylesheets/alchemy/admin/dashboard.scss +395 -28
  112. data/app/stylesheets/alchemy/admin/elements.scss +14 -17
  113. data/app/stylesheets/alchemy/admin/form_fields.scss +3 -3
  114. data/app/stylesheets/alchemy/admin/forms.scss +107 -93
  115. data/app/stylesheets/alchemy/admin/icons.scss +28 -0
  116. data/app/stylesheets/alchemy/admin/image_library.scss +20 -10
  117. data/app/stylesheets/alchemy/admin/navigation.scss +4 -1
  118. data/app/stylesheets/alchemy/admin/popover.scss +3 -5
  119. data/app/stylesheets/alchemy/admin/resource_info.scss +11 -17
  120. data/app/stylesheets/alchemy/admin/shoelace.scss +8 -0
  121. data/app/stylesheets/alchemy/admin/sitemap.scss +5 -0
  122. data/app/stylesheets/alchemy/admin/tables.scss +32 -3
  123. data/app/stylesheets/alchemy/admin/toolbar.scss +0 -1
  124. data/app/stylesheets/alchemy/admin.scss +1 -0
  125. data/app/stylesheets/tinymce/skins/ui/alchemy/skin.scss +0 -4
  126. data/app/stylesheets/tinymce/skins/ui/alchemy-dark/skin.scss +0 -4
  127. data/app/types/alchemy/wildcard_url_type.rb +48 -0
  128. data/app/views/alchemy/_menubar.html.erb +1 -5
  129. data/app/views/alchemy/admin/attachments/edit.html.erb +6 -3
  130. data/app/views/alchemy/admin/dashboard/_dashboard.html.erb +3 -2
  131. data/app/views/alchemy/admin/dashboard/_footer.html.erb +22 -0
  132. data/app/views/alchemy/admin/dashboard/_stats.html.erb +7 -0
  133. data/app/views/alchemy/admin/dashboard/_top.html.erb +4 -12
  134. data/app/views/alchemy/admin/dashboard/_widgets.html.erb +7 -0
  135. data/app/views/alchemy/admin/dashboard/index.html.erb +0 -17
  136. data/app/views/alchemy/admin/dashboard/info.html.erb +1 -62
  137. data/app/views/alchemy/admin/dashboard/widgets/show.html.erb +3 -0
  138. data/app/views/alchemy/admin/elements/_form.html.erb +2 -1
  139. data/app/views/alchemy/admin/elements/_schedule.html.erb +2 -15
  140. data/app/views/alchemy/admin/elements/_schedule_fields.html.erb +2 -0
  141. data/app/views/alchemy/admin/layoutpages/edit.html.erb +6 -3
  142. data/app/views/alchemy/admin/nodes/_page_nodes.html.erb +10 -8
  143. data/app/views/alchemy/admin/pages/_form.html.erb +25 -19
  144. data/app/views/alchemy/admin/pages/_publication_fields.html.erb +2 -32
  145. data/app/views/alchemy/admin/pages/_table.html.erb +1 -18
  146. data/app/views/alchemy/admin/pages/configure.html.erb +2 -2
  147. data/app/views/alchemy/admin/pages/info.html.erb +6 -0
  148. data/app/views/alchemy/admin/resources/_form.html.erb +7 -4
  149. data/app/views/alchemy/admin/resources/edit.html.erb +3 -1
  150. data/app/views/alchemy/admin/resources/new.html.erb +3 -1
  151. data/app/views/alchemy/admin/styleguide/index.html.erb +52 -30
  152. data/app/views/alchemy/admin/translations/_en.js +4 -0
  153. data/app/views/layouts/alchemy/admin.html.erb +3 -3
  154. data/config/importmap.rb +2 -0
  155. data/config/locales/alchemy.en.yml +15 -0
  156. data/config/routes.rb +1 -0
  157. data/lib/alchemy/configuration/class_option.rb +46 -3
  158. data/lib/alchemy/configuration/collection_option.rb +4 -0
  159. data/lib/alchemy/configurations/dashboard.rb +79 -0
  160. data/lib/alchemy/configurations/main.rb +15 -0
  161. data/lib/alchemy/engine.rb +9 -3
  162. data/lib/alchemy/sprockets/skip_builds_compression.rb +33 -0
  163. data/lib/alchemy/test_support/capybara_helpers.rb +17 -0
  164. data/lib/alchemy/test_support/relatable_resource_examples.rb +20 -0
  165. data/lib/alchemy/test_support/rspec_matchers.rb +8 -0
  166. data/lib/alchemy/test_support/shared_publishable_examples.rb +38 -31
  167. data/lib/alchemy/tinymce.rb +1 -1
  168. data/lib/alchemy/version.rb +17 -3
  169. data/vendor/javascript/cropperjs.min.js +1 -1
  170. data/vendor/javascript/flatpickr.min.js +1 -1
  171. data/vendor/javascript/floating-ui.min.js +1 -0
  172. data/vendor/javascript/keymaster.min.js +1 -1
  173. data/vendor/javascript/rails-ujs.min.js +1 -1
  174. data/vendor/javascript/shoelace.min.js +93 -93
  175. data/vendor/javascript/sortable.min.js +1 -1
  176. data/vendor/javascript/tinymce.min.js +5 -1
  177. data/vendor/javascript/tom-select.min.js +1 -0
  178. metadata +57 -18
  179. data/app/javascript/alchemy_admin/components/alchemy_html_element.js +0 -129
  180. data/app/views/alchemy/admin/dashboard/_left_column.html.erb +0 -4
  181. data/app/views/alchemy/admin/dashboard/_right_column.html.erb +0 -9
  182. data/app/views/alchemy/admin/dashboard/widgets/_locked_pages.html.erb +0 -52
  183. data/app/views/alchemy/admin/dashboard/widgets/_recent_pages.html.erb +0 -34
  184. data/app/views/alchemy/admin/dashboard/widgets/_sites.html.erb +0 -25
  185. data/app/views/alchemy/admin/dashboard/widgets/_users.html.erb +0 -21
  186. data/app/views/alchemy/admin/languages/edit.html.erb +0 -1
  187. data/app/views/alchemy/admin/languages/new.html.erb +0 -1
  188. data/app/views/alchemy/admin/sites/edit.html.erb +0 -1
  189. data/app/views/alchemy/admin/sites/new.html.erb +0 -1
@@ -0,0 +1 @@
1
+ function t(t,e){t.split(/\s+/).forEach(t=>{e(t)})}class e{constructor(){this._events={}}on(e,i){t(e,t=>{const e=this._events[t]||[];e.push(i),this._events[t]=e})}off(e,i){var s=arguments.length;0!==s?t(e,t=>{if(1===s)return void delete this._events[t];const e=this._events[t];void 0!==e&&(e.splice(e.indexOf(i),1),this._events[t]=e)}):this._events={}}trigger(e,...i){var s=this;t(e,t=>{const e=s._events[t];void 0!==e&&e.forEach(t=>{t.apply(s,i)})})}}const i=t=>(t=t.filter(Boolean)).length<2?t[0]||"":1==l(t)?"["+t.join("")+"]":"(?:"+t.join("|")+")",s=t=>{if(!o(t))return t.join("");let e="",i=0;const s=()=>{i>1&&(e+="{"+i+"}")};return t.forEach((n,o)=>{n!==t[o-1]?(s(),e+=n,i=1):i++}),s(),e},n=t=>{let e=Array.from(t);return i(e)},o=t=>new Set(t).size!==t.length,r=t=>(t+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),l=t=>t.reduce((t,e)=>Math.max(t,a(e)),0),a=t=>Array.from(t).length,c=t=>{if(1===t.length)return[[t]];let e=[];const i=t.substring(1);return c(i).forEach(function(i){let s=i.slice(0);s[0]=t.charAt(0)+s[0],e.push(s),s=i.slice(0),s.unshift(t.charAt(0)),e.push(s)}),e},d=[[0,65535]];let p,u;const h={},g={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let t in g){let e=g[t]||"";for(let i=0;i<e.length;i++){let s=e.substring(i,i+1);h[s]=t}}const f=new RegExp(Object.keys(h).join("|")+"|[̀-ͯ·ʾʼ]","gu"),m=(t,e="NFKD")=>t.normalize(e),v=t=>Array.from(t).reduce((t,e)=>t+y(e),""),y=t=>(t=m(t).toLowerCase().replace(f,t=>h[t]||""),m(t,"NFC"));const O=t=>{const e={},i=(t,i)=>{const s=e[t]||new Set,o=new RegExp("^"+n(s)+"$","iu");i.match(o)||(s.add(r(i)),e[t]=s)};for(let e of function*(t){for(const[e,i]of t)for(let t=e;t<=i;t++){let e=String.fromCharCode(t),i=v(e);i!=e.toLowerCase()&&(i.length>3||0!=i.length&&(yield{folded:i,composed:e,code_point:t}))}}(t))i(e.folded,e.folded),i(e.folded,e.composed);return e},b=t=>{const e=O(t),s={};let o=[];for(let t in e){let i=e[t];i&&(s[t]=n(i)),t.length>1&&o.push(r(t))}o.sort((t,e)=>e.length-t.length);const l=i(o);return u=new RegExp("^"+l,"u"),s},w=(t,e=1)=>(e=Math.max(e,t.length-1),i(c(t).map(t=>((t,e=1)=>{let i=0;return t=t.map(t=>(p[t]&&(i+=t.length),p[t]||t)),i>=e?s(t):""})(t,e)))),S=(t,e=!0)=>{let n=t.length>1?1:0;return i(t.map(t=>{let i=[];const o=e?t.length():t.length()-1;for(let e=0;e<o;e++)i.push(w(t.substrs[e]||"",n));return s(i)}))},I=(t,e)=>{for(const i of e){if(i.start!=t.start||i.end!=t.end)continue;if(i.substrs.join("")!==t.substrs.join(""))continue;let e=t.parts;const s=t=>{for(const i of e){if(i.start===t.start&&i.substr===t.substr)return!1;if(1!=t.length&&1!=i.length){if(t.start<i.start&&t.end>i.start)return!0;if(i.start<t.start&&i.end>t.start)return!0}}return!1};if(!(i.parts.filter(s).length>0))return!0}return!1};class A{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let i=new A,s=JSON.parse(JSON.stringify(this.parts)),n=s.pop();for(const t of s)i.add(t);let o=e.substr.substring(0,t-n.start),r=o.length;return i.add({start:n.start,end:n.start+r,length:r,substr:o}),i}}const C=t=>{void 0===p&&(p=b(d)),t=v(t);let e="",i=[new A];for(let s=0;s<t.length;s++){let n=t.substring(s).match(u);const o=t.substring(s,s+1),r=n?n[0]:null;let l=[],a=new Set;for(const t of i){const e=t.last();if(!e||1==e.length||e.end<=s)if(r){const e=r.length;t.add({start:s,end:s+e,length:e,substr:r}),a.add("1")}else t.add({start:s,end:s+1,length:1,substr:o}),a.add("2");else if(r){let i=t.clone(s,e);const n=r.length;i.add({start:s,end:s+n,length:n,substr:r}),l.push(i)}else a.add("3")}if(l.length>0){l=l.sort((t,e)=>t.length()-e.length());for(let t of l)I(t,i)||i.push(t)}else if(s>0&&1==a.size&&!a.has("3")){e+=S(i,!1);let t=new A;const s=i[0];s&&t.add(s.last()),i=[t]}}return e+=S(i,!0),e},_=(t,e)=>{if(t)return t[e]},x=(t,e)=>{if(t){for(var i,s=e.split(".");(i=s.shift())&&(t=t[i]););return t}},F=(t,e,i)=>{var s,n;return t?(t+="",null==e.regex||-1===(n=t.search(e.regex))?0:(s=e.string.length/t.length,0===n&&(s+=.5),s*i)):0},L=(t,e)=>{var i=t[e];if("function"==typeof i)return i;i&&!Array.isArray(i)&&(t[e]=[i])},k=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},E=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=v(t+"").toLowerCase())>(e=v(e+"").toLowerCase())?1:e>t?-1:0;class T{items;settings;constructor(t,e){this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,i){if(!t||!t.length)return[];const s=[],n=t.split(/\s+/);var o;return i&&(o=new RegExp("^("+Object.keys(i).map(r).join("|")+"):(.*)$")),n.forEach(t=>{let i,n=null,l=null;o&&(i=t.match(o))&&(n=i[1],t=i[2]),t.length>0&&(l=this.settings.diacritics?C(t)||null:r(t),l&&e&&(l="\\b"+l)),s.push({string:t,regex:l?new RegExp(l,"iu"):null,field:n})}),s}getScoreFunction(t,e){var i=this.prepareSearch(t,e);return this._getScoreFunction(i)}_getScoreFunction(t){const e=t.tokens,i=e.length;if(!i)return function(){return 0};const s=t.options.fields,n=t.weights,o=s.length,r=t.getAttrFn;if(!o)return function(){return 1};const l=1===o?function(t,e){const i=s[0].field;return F(r(e,i),t,n[i]||1)}:function(t,e){var i=0;if(t.field){const s=r(e,t.field);!t.regex&&s?i+=1/o:i+=F(s,t,1)}else k(n,(s,n)=>{i+=F(r(e,n),t,s)});return i/o};return 1===i?function(t){return l(e[0],t)}:"and"===t.options.conjunction?function(t){var s,n=0;for(let i of e){if((s=l(i,t))<=0)return 0;n+=s}return n/i}:function(t){var s=0;return k(e,e=>{s+=l(e,t)}),s/i}}getSortFunction(t,e){var i=this.prepareSearch(t,e);return this._getSortFunction(i)}_getSortFunction(t){var e,i=[];const s=this,n=t.options,o=!t.query&&n.sort_empty?n.sort_empty:n.sort;if("function"==typeof o)return o.bind(this);const r=function(e,i){return"$score"===e?i.score:t.getAttrFn(s.items[i.id],e)};if(o)for(let e of o)(t.query||"$score"!==e.field)&&i.push(e);if(t.query){e=!0;for(let t of i)if("$score"===t.field){e=!1;break}e&&i.unshift({field:"$score",direction:"desc"})}else i=i.filter(t=>"$score"!==t.field);return i.length?function(t,e){var s,n;for(let o of i){if(n=o.field,s=("desc"===o.direction?-1:1)*E(r(n,t),r(n,e)))return s}return 0}:null}prepareSearch(t,e){const i={};var s=Object.assign({},e);if(L(s,"sort"),L(s,"sort_empty"),s.fields){L(s,"fields");const t=[];s.fields.forEach(e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1}),s.fields=t}return{options:s,query:t.toLowerCase().trim(),tokens:this.tokenize(t,s.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:s.nesting?x:_}}search(t,e){var i,s,n=this;s=this.prepareSearch(t,e),e=s.options,t=s.query;const o=e.score||n._getScoreFunction(s);t.length?k(n.items,(t,n)=>{i=o(t),(!1===e.filter||i>0)&&s.items.push({score:i,id:n})}):k(n.items,(t,e)=>{s.items.push({score:1,id:e})});const r=n._getSortFunction(s);return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof e.limit&&(s.items=s.items.slice(0,e.limit)),s}}const P=t=>null==t?null:D(t),D=t=>"boolean"==typeof t?t?"1":"0":t+"",$=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),V=(t,e)=>{var i;return function(s,n){var o=this;i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout(function(){i=null,o.loadedSearches[s]=!0,t.call(o,s,n)},e)}},j=(t,e,i)=>{var s,n=t.trigger,o={};for(s of(t.trigger=function(){var i=arguments[0];if(-1===e.indexOf(i))return n.apply(t,arguments);o[i]=arguments},i.apply(t,[]),t.trigger=n,e))s in o&&n.apply(t,o[s])},q=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},N=(t,e,i,s)=>{t.addEventListener(e,i,s)},R=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),H=(t,e)=>{const i=t.getAttribute("id");return i||(t.setAttribute("id",e),e)},M=t=>t.replace(/[\\"']/g,"\\$&"),z=(t,e)=>{e&&t.append(e)},B=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},K=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(G(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},G=t=>"string"==typeof t&&t.indexOf("<")>-1,Q=(t,e)=>{var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!1),t.dispatchEvent(i)},W=(t,e)=>{Object.assign(t.style,e)},J=(t,...e)=>{var i=X(e);(t=Y(t)).map(t=>{i.map(e=>{t.classList.add(e)})})},U=(t,...e)=>{var i=X(e);(t=Y(t)).map(t=>{i.map(e=>{t.classList.remove(e)})})},X=t=>{var e=[];return B(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Y=t=>(Array.isArray(t)||(t=[t]),t),Z=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}},tt=(t,e=0)=>e>0?t[t.length-1]:t[0],et=(t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i},it=(t,e)=>{B(e,(e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)})},st=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},nt=(t,e)=>{if(null===e)return;if("string"==typeof e){if(!e.length)return;e=new RegExp(e,"i")}const i=t=>3===t.nodeType?(t=>{var i=t.data.match(e);if(i&&t.data.length>0){var s=document.createElement("span");s.className="highlight";var n=t.splitText(i.index);n.splitText(i[0].length);var o=n.cloneNode(!0);return s.appendChild(o),st(n,s),1}return 0})(t):((t=>{1!==t.nodeType||!t.childNodes||/(script|style)/i.test(t.tagName)||"highlight"===t.className&&"SPAN"===t.tagName||Array.from(t.childNodes).forEach(t=>{i(t)})})(t),0);i(t)},ot="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var rt={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,clearAfterSelect:!1,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}};function lt(t,e){var i=Object.assign({},rt,e),s=i.dataAttr,n=i.labelField,o=i.valueField,r=i.disabledField,l=i.optgroupField,a=i.optgroupLabelField,c=i.optgroupValueField,d=t.tagName.toLowerCase(),p=t.getAttribute("placeholder")||t.getAttribute("data-placeholder");if(!p&&!i.allowEmptyOption){let e=t.querySelector('option[value=""]');e&&(p=e.textContent)}var u={placeholder:p,options:[],optgroups:[],items:[],maxItems:null};return"select"===d?(()=>{var e,d=u.options,p={},h=1;let g=0;var f=t=>{var e=Object.assign({},t.dataset),i=s&&e[s];return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},m=(t,e)=>{var s=P(t.value);if(null!=s&&(s||i.allowEmptyOption)){if(p.hasOwnProperty(s)){if(e){var a=p[s][l];a?Array.isArray(a)?a.push(e):p[s][l]=[a,e]:p[s][l]=e}}else{var c=f(t);c[n]=c[n]||t.textContent,c[o]=c[o]||s,c[r]=c[r]||t.disabled,c[l]=c[l]||e,c.$option=t,c.$order=c.$order||++g,p[s]=c,d.push(c)}t.selected&&u.items.push(s)}};u.maxItems=t.hasAttribute("multiple")?null:1,B(t.children,t=>{var i,s,n;"optgroup"===(e=t.tagName.toLowerCase())?((n=f(i=t))[a]=n[a]||i.getAttribute("label")||"",n[c]=n[c]||h++,n[r]=n[r]||i.disabled,n.$order=n.$order||++g,u.optgroups.push(n),s=n[c],B(i.children,t=>{m(t,s)})):"option"===e&&m(t)})})():(()=>{var e,r;const l=t.getAttribute(s);if(l)u.options=JSON.parse(l),B(u.options,t=>{u.items.push(t[o])});else{var a=null!==(r=null===(e=null==t?void 0:t.value)||void 0===e?void 0:e.trim())&&void 0!==r?r:"";if(!i.allowEmptyOption&&!a.length)return;const s=a.split(i.delimiter);B(s,t=>{const e={};e[n]=t,e[o]=t,u.options.push(e)}),u.items=s}})(),Object.assign({},rt,u,e)}var at=0;class ct extends(function(t){return t.plugins={},class extends t{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,i){t.plugins[e]={name:e,fn:i}}initializePlugins(t){var e,i;const s=this,n=[];if(Array.isArray(t))t.forEach(t=>{"string"==typeof t?n.push(t):(s.plugins.settings[t.name]=t.options,n.push(t.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(s.plugins.settings[e]=t[e],n.push(e));for(;i=n.shift();)s.require(i)}loadPlugin(e){var i=this,s=i.plugins,n=t.plugins[e];if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');s.requested[e]=!0,s.loaded[e]=n.fn.apply(i,[i.plugins.settings[e]||{}]),s.names.push(e)}require(t){var e=this,i=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return i.loaded[t]}}}(e)){constructor(t,e){var i;super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.isDropdownContentStale=!0,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,at++;var s=K(t);if(s.tomselect)throw new Error("Tom Select already initialized on this element");s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction");const n=lt(s,e);this.settings=n,this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag="select"===s.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=H(s,"tomselect-"+at),this.isRequired=s.required,this.sifter=new T(this.options,{diacritics:n.diacritics}),n.mode=n.mode||(1===n.maxItems?"single":"multi"),"boolean"!=typeof n.hideSelected&&(n.hideSelected="multi"===n.mode),"boolean"!=typeof n.hidePlaceholder&&(n.hidePlaceholder="multi"!==n.mode);var o=n.createFilter;"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?n.createFilter=t=>o.test(t):n.createFilter=t=>this.settings.duplicates||!this.options[t]),this.initializePlugins(n.plugins),this.setupCallbacks(),this.setupTemplates();const r=K("<div>"),l=K("<div>"),a=this._render("dropdown"),c=K('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",p=n.mode;var u;if(J(r,n.wrapperClass,d,p),J(l,n.controlClass),z(r,l),J(a,n.dropdownClass,p),n.copyClassesToDropdown&&J(a,d),J(c,n.dropdownContentClass),z(a,c),K(n.dropdownParent||r).appendChild(a),G(n.controlInput)){u=K(n.controlInput);B(["autocorrect","autocapitalize","autocomplete","spellcheck","aria-label"],t=>{s.getAttribute(t)&&it(u,{[t]:s.getAttribute(t)})}),u.tabIndex=-1,l.appendChild(u),this.focus_node=u}else n.controlInput?(u=K(n.controlInput),this.focus_node=u):(u=K("<input/>"),this.focus_node=l);this.wrapper=r,this.dropdown=a,this.dropdown_content=c,this.control=l,this.control_input=u,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,s=t.dropdown,n=t.dropdown_content,o=t.wrapper,l=t.control,a=t.input,c=t.focus_node,d={passive:!0},p=t.inputId+"-ts-dropdown";it(n,{id:p}),it(c,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":p});const u=H(c,t.inputId+"-ts-control"),h="label[for='"+(t=>t.replace(/['"\\]/g,"\\$&"))(t.inputId)+"']",g=document.querySelector(h),f=t.focus.bind(t);if(g){N(g,"click",f),it(g,{for:u});const e=H(g,t.inputId+"-ts-label");it(c,{"aria-labelledby":e}),it(n,{"aria-labelledby":e})}if(o.style.width=a.style.width,o.style.minWidth=a.style.minWidth,o.style.maxWidth=a.style.maxWidth,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-");J([o,s],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&it(a,{multiple:"multiple"}),e.placeholder&&it(i,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+r(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=V(e.load,e.loadThrottle)),N(s,"mousemove",()=>{t.ignoreHover=!1}),N(s,"mouseenter",e=>{var i=Z(e.target,"[data-selectable]",s);i&&t.onOptionHover(e,i)},{capture:!0}),N(s,"click",e=>{const i=Z(e.target,"[data-selectable]");i&&(t.onOptionSelect(e,i),q(e,!0))}),N(l,"click",e=>{var s=Z(e.target,"[data-ts-item]",l);s&&t.onItemSelect(e,s)?q(e,!0):""==i.value&&(t.onClick(),q(e,!0))}),N(c,"keydown",e=>t.onKeyDown(e)),N(i,"keypress",e=>t.onKeyPress(e)),N(i,"input",e=>t.onInput(e)),N(c,"blur",e=>t.onBlur(e)),N(c,"focus",e=>t.onFocus(e)),N(i,"paste",e=>t.onPaste(e));const m=e=>{const n=e.composedPath()[0];if(!o.contains(n)&&!s.contains(n))return t.isFocused&&t.blur(),void t.inputState();n==i&&t.isOpen?e.stopPropagation():q(e,!0)},v=()=>{t.isOpen&&t.positionDropdown()},y=()=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())};N(a,"invalid",y),N(document,"mousedown",m),N(window,"scroll",v,d),N(window,"resize",v,d),this._destroy=()=>{a.removeEventListener("invalid",y),document.removeEventListener("mousedown",m),window.removeEventListener("scroll",v),window.removeEventListener("resize",v),g&&g.removeEventListener("click",f)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,t.on("change",this.onChange),J(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),B(e,t=>{this.registerOptionGroup(t)})}setupTemplates(){var t=this,e=t.settings.labelField,i=t.settings.optgroupLabelField,s={optgroup:t=>{let e=document.createElement("div");return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'<div class="optgroup-header">'+e(t[i])+"</div>",option:(t,i)=>"<div>"+i(t[e])+"</div>",item:(t,i)=>"<div>"+i(t[e])+"</div>",option_create:(t,e)=>'<div class="create">Add <strong>'+e(t.input)+"</strong>&hellip;</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};t.settings.render=Object.assign({},s,t.settings.render)}setupCallbacks(){var t,e,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?lt(e.input,{delimiter:e.settings.delimiter,allowEmptyOption:e.settings.allowEmptyOption}):e.settings;e.setupOptions(i.options,i.optgroups),e.setValue(i.items||[],!0),e.input.disabled?e.disable():e.input.readOnly?e.setReadOnly(!0):e.enable(),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus();t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){Q(this.input,"input"),Q(this.input,"change")}onPaste(t){var e=this;e.isInputHidden||e.isLocked?q(t):e.settings.splitOn&&setTimeout(()=>{var t=e.inputValue();if(t.match(e.settings.splitOn)){var i=t.trim().split(e.settings.splitOn);B(i,t=>{P(t)&&(this.options[t]?e.addItem(t):e.createItem(t))})}},0)}onKeyPress(t){var e=this;if(!e.isLocked){var i=String.fromCharCode(t.keyCode||t.which);return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void q(t)):void 0}q(t)}onKeyDown(t){var e=this;if(e.ignoreHover=!0,e.isLocked)9!==t.keyCode&&q(t);else{switch(t.keyCode){case 65:if(R(ot,t)&&""==e.control_input.value)return q(t),void e.selectAll();break;case 27:return e.isOpen&&(q(t,!0),e.close()),void e.clearActiveItems();case 40:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1);t&&e.setActiveOption(t)}return void q(t);case 38:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1);t&&e.setActiveOption(t)}return void q(t);case 13:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),q(t)):(e.settings.create&&e.createItem()||document.activeElement==e.control_input&&e.isOpen)&&q(t));case 37:return void e.advanceSelection(-1,t);case 39:return void e.advanceSelection(1,t);case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),q(t)):e.settings.create&&e.createItem()&&q(t)));case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!R(ot,t)&&q(t)}}onInput(t){if(this.isLocked)return;const e=this.inputValue();this.lastValue!==e&&(this.lastValue=e,""!=e?(this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=((t,e)=>e>0?window.setTimeout(t,e):(t.call(null),null))(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)):this._onInput())}_onInput(){const t=this.lastValue;this.settings.shouldLoad.call(this,t)&&this.load(t),this.refreshOptions(),this.trigger("type",t)}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,i=e.isFocused;if(e.isDisabled||e.isReadOnly)return e.blur(),void q(t);e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.inputState(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var i=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,i):i()}}}onOptionSelect(t,e){var i,s=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?s.createItem(null,()=>{s.settings.closeAfterSelect?s.close():s.settings.clearAfterSelect&&s.setTextboxValue()}):void 0!==(i=e.dataset.value)&&(s.isDropdownContentStale=s.settings.hideSelected,s.addItem(i),s.settings.closeAfterSelect?s.close():s.settings.clearAfterSelect&&s.setTextboxValue(),!s.settings.hideSelected&&t.type&&/click/.test(t.type)&&s.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var i=this;return!i.isLocked&&"multi"===i.settings.mode&&(q(t),i.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this;if(!e.canLoad(t))return;J(e.wrapper,e.settings.loadingClass),e.loading++;const i=e.loadCallback.bind(e);e.settings.load.call(e,t,i)}loadCallback(t,e){const i=this;i.loading=Math.max(i.loading-1,0),i.isDropdownContentStale=!0,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||U(i.wrapper,i.settings.loadingClass),i.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input;e.value!==t&&(e.value=t,Q(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){j(this,e?[]:["change"],()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var i,s,n,o,r,l,a=this;if("single"!==a.settings.mode){if(!t)return a.clearActiveItems(),void(a.isFocused&&a.inputState());if("click"===(i=e&&e.type.toLowerCase())&&R("shiftKey",e)&&a.activeItems.length){for(l=a.getLastActive(),(n=Array.prototype.indexOf.call(a.control.children,l))>(o=Array.prototype.indexOf.call(a.control.children,t))&&(r=n,n=o,o=r),s=n;s<=o;s++)t=a.control.children[s],-1===a.activeItems.indexOf(t)&&a.setActiveItemClass(t);q(e)}else"click"===i&&R(ot,e)||"keydown"===i&&R("shiftKey",e)?t.classList.contains("active")?a.removeActiveItem(t):a.setActiveItemClass(t):(a.clearActiveItems(),a.setActiveItemClass(t));a.inputState(),a.isFocused||a.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active");i&&U(i,"last-active"),J(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),U(t,"active")}clearActiveItems(){U(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,it(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),it(t,{"aria-selected":"true"}),J(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;const i=this.dropdown_content,s=i.clientHeight,n=i.scrollTop||0,o=t.offsetHeight,r=t.getBoundingClientRect().top-i.getBoundingClientRect().top+n;r+o>s+n?this.scroll(r-s+o,e):r<n&&this.scroll(r,e)}scroll(t,e){const i=this.dropdown_content;e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(U(this.activeOption,"active"),it(this.activeOption,{"aria-selected":null})),this.activeOption=null,it(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this;if("single"===t.settings.mode)return;const e=t.controlChildren();e.length&&(t.inputState(),t.close(),t.activeItems=e,B(e,e=>{t.setActiveItemClass(e)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(it(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&it(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var t=this;if(t.isDisabled||t.isReadOnly)return;t.ignoreFocus=!0;const e=this.control_input.offsetWidth?this.control_input:this.focus_node;e.focus(),setTimeout(()=>{t.ignoreFocus=!1;e.getRootNode().activeElement===e&&this.onFocus()},0)}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,s=this,n=this.getSearchOptions();if(s.settings.score&&"function"!=typeof(i=s.settings.score.call(s,t)))throw new Error('Tom Select "score" setting must be a function that returns a function');return s.isDropdownContentStale||t!==s.lastQuery?(s.lastQuery=t,/(.)\1{15,}/.test(t)&&(t=""),e=s.sifter.search(t,Object.assign(n,{score:i})),s.currentResults=e):e=Object.assign({},s.currentResults),s.settings.hideSelected&&(e.items=e.items.filter(t=>{let e=P(t.id);return!(null!==e&&-1!==s.items.indexOf(e))})),e}refreshOptions(t=!0){var e,i,s,n,o,r,l,a,c,d;const p={},u=[];var h=this,g=h.inputValue();const f=g===h.lastQuery||""==g&&null==h.lastQuery;var m=h.search(g),v=null,y=h.settings.shouldOpen||!1,O=h.dropdown_content;f&&(v=h.activeOption)&&(c=v.closest("[data-group]")),n=m.items.length,"number"==typeof h.settings.maxOptions&&(n=Math.min(n,h.settings.maxOptions)),n>0&&(y=!0);const b=(t,e)=>{let i=p[t];if(void 0!==i){let t=u[i];if(void 0!==t)return[i,t.fragment]}let s=document.createDocumentFragment();return i=u.length,u.push({fragment:s,order:e,optgroup:t}),[i,s]};for(e=0;e<n;e++){let t=m.items[e];if(!t)continue;let n=t.id,l=h.options[n];if(void 0===l)continue;let a=D(n),d=h.getOption(a,!0);for(h.settings.hideSelected||d.classList.toggle("selected",h.items.includes(a)),o=l[h.settings.optgroupField]||"",i=0,s=(r=Array.isArray(o)?o:[o])&&r.length;i<s;i++){o=r[i];let t=l.$order,e=h.optgroups[o];var w;if(void 0===e&&"function"==typeof h.settings.optionGroupRegister)(w=h.settings.optionGroupRegister.apply(h,[o]))&&h.registerOptionGroup(w);e=h.optgroups[o],void 0===e?o="":t=e.$order;const[s,a]=b(o,t);i>0&&(d=d.cloneNode(!0),it(d,{id:l.$id+"-clone-"+i,"aria-selected":null}),d.classList.add("ts-cloned"),U(d,"active"),h.activeOption&&h.activeOption.dataset.value==n&&c&&c.dataset.group===o.toString()&&(v=d)),a.appendChild(d),""!=o&&(p[o]=s)}}var S;h.settings.lockOptgroupOrder&&u.sort((t,e)=>t.order-e.order),l=document.createDocumentFragment(),B(u,t=>{let e=t.fragment,i=t.optgroup;if(!e||!e.children.length)return;let s=h.optgroups[i];if(void 0!==s){let t=document.createDocumentFragment(),i=h.render("optgroup_header",s);z(t,i),z(t,e);let n=h.render("optgroup",{group:s,options:t});z(l,n)}else z(l,e)}),O.innerHTML="",z(O,l),h.isDropdownContentStale=!1,h.settings.highlight&&(S=O.querySelectorAll("span.highlight"),Array.prototype.forEach.call(S,function(t){var e=t.parentNode;e.replaceChild(t.firstChild,t),e.normalize()}),m.query.length&&m.tokens.length&&B(m.tokens,t=>{nt(O,t.regex)}));var I=t=>{let e=h.render(t,{input:g});return e&&(y=!0,O.insertBefore(e,O.firstChild)),e};if(h.loading?I("loading"):h.settings.shouldLoad.call(h,g)?0===m.items.length&&I("no_results"):I("not_loading"),(a=h.canCreate(g))&&(d=I("option_create")),h.hasOptions=m.items.length>0||a,y){if(m.items.length>0){if(v||"single"!==h.settings.mode||null==h.items[0]||(v=h.getOption(h.items[0])),!O.contains(v)){let t=0;d&&!h.settings.addPrecedence&&(t=1),v=h.selectable()[t]}}else d&&(v=d);t&&!h.isOpen&&(h.open(),h.scrollToOption(v,"auto")),h.setActiveOption(v)}else h.clearActiveOption(),t&&h.isOpen&&h.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const i=this;if(Array.isArray(t))return i.addOptions(t,e),!1;const s=P(t[i.settings.valueField]);return null===s||i.options.hasOwnProperty(s)?(i.updateOption(t[i.settings.valueField],t),!1):(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[s]=t,i.isDropdownContentStale=!0,e&&(i.userOptions[s]=e,i.trigger("option_add",s,t)),s)}addOptions(t,e=!1){B(t,t=>{this.addOption(t,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=P(t[this.settings.optgroupValueField]);return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var i;e[this.settings.optgroupValueField]=t,(i=this.registerOptionGroup(e))&&this.trigger("optgroup_add",i,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const i=this;var s,n;const o=P(t),r=P(e[i.settings.valueField]);if(null===o)return;const l=i.options[o];if(null==l)return;if("string"!=typeof r)throw new Error("Value must be set in option data");const a=i.getOption(o),c=i.getItem(o);if(e.$order=e.$order||l.$order,delete i.options[o],i.uncacheValue(r),i.options[r]=e,a){if(i.dropdown_content.contains(a)){const t=i._render("option",e);st(a,t),i.activeOption===a&&i.setActiveOption(t)}a.remove()}c&&(-1!==(n=i.items.indexOf(o))&&i.items.splice(n,1,r),s=i._render("item",e),c.classList.contains("active")&&J(s,"active"),st(c,s)),i.isDropdownContentStale=!0}removeOption(t,e){const i=this;t=D(t),i.uncacheValue(t),delete i.userOptions[t],delete i.options[t],i.isDropdownContentStale=!0,i.trigger("option_remove",t),i.removeItem(t,e)}clearOptions(t){const e=(t||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const i={};B(this.options,(t,s)=>{e(t,s)&&(i[s]=t)}),this.options=this.sifter.items=i,this.isDropdownContentStale=!0,this.trigger("option_clear")}clearFilter(t,e){return this.items.indexOf(e)>=0}getOption(t,e=!1){const i=P(t);if(null===i)return null;const s=this.options[i];if(null!=s){if(s.$div)return s.$div;if(e)return this._render("option",s)}return null}getAdjacent(t,e,i="option"){var s;if(!t)return null;s="item"==i?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]");for(let i=0;i<s.length;i++)if(s[i]==t)return e>0?s[i+1]:s[i-1];return null}getItem(t){if("object"==typeof t)return t;var e=P(t);return null!==e?this.control.querySelector(`[data-value="${M(e)}"]`):null}addItems(t,e){var i=this,s=Array.isArray(t)?t:[t];const n=(s=s.filter(t=>-1===i.items.indexOf(t)))[s.length-1];s.forEach(t=>{i.isPending=t!==n,i.addItem(t,e)})}addItem(t,e){j(this,e?[]:["change","dropdown_close"],()=>{var i,s;const n=this,o=n.settings.mode,r=P(t);if((!r||-1===n.items.indexOf(r)||("single"===o&&n.close(),"single"!==o&&n.settings.duplicates))&&null!==r&&n.options.hasOwnProperty(r)&&("single"===o&&n.clear(e),"multi"!==o||!n.isFull())){if(i=n._render("item",n.options[r]),n.control.contains(i)&&(i=i.cloneNode(!0)),s=n.isFull(),n.items.splice(n.caretPos,0,r),n.insertAtCaret(i),n.isSetup){if(!n.isPending&&n.settings.hideSelected){let t=n.getOption(r),e=n.getAdjacent(t,1);e&&n.setActiveOption(e)}n.settings.clearAfterSelect&&n.setTextboxValue(),n.isPending||n.settings.closeAfterSelect||n.refreshOptions(n.isFocused&&"single"!==o),0!=n.settings.closeAfterSelect&&n.isFull()?n.close():n.isPending||n.positionDropdown(),n.trigger("item_add",r,i),n.isPending||n.updateOriginalInput({silent:e})}(!n.isPending||!s&&n.isFull())&&(n.inputState(),n.refreshState())}})}removeItem(t=null,e){const i=this;if(!(t=i.getItem(t)))return;var s,n;const o=t.dataset.value;s=et(t),t.remove(),t.classList.contains("active")&&(n=i.activeItems.indexOf(t),i.activeItems.splice(n,1),U(t,"active")),i.items.splice(s,1),i.isDropdownContentStale=!0,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,e),s<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,t)}createItem(t=null,e=()=>{}){3===arguments.length&&(e=arguments[2]),"function"!=typeof e&&(e=()=>{});var i,s=this,n=s.caretPos;if(t=t||s.inputValue(),!s.canCreate(t)){return P(t)&&this.options[t]&&s.addItem(t),e(),!1}s.lock();var o=!1,r=t=>{if(s.unlock(),!t||"object"!=typeof t)return e();var i=P(t[s.settings.valueField]);if("string"!=typeof i)return e();s.setTextboxValue(),s.addOption(t,!0),s.setCaret(n),s.addItem(i),e(t),o=!0};return i="function"==typeof s.settings.create?s.settings.create.call(this,t,r):{[s.settings.labelField]:t,[s.settings.valueField]:t},o||r(i),!0}refreshItems(){var t=this;t.isDropdownContentStale=!0,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){const t=this;t.refreshValidityState();const e=t.isFull(),i=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);const s=t.wrapper.classList;var n;s.toggle("focus",t.isFocused),s.toggle("disabled",t.isDisabled),s.toggle("readonly",t.isReadOnly),s.toggle("required",t.isRequired),s.toggle("invalid",!t.isValid),s.toggle("locked",i),s.toggle("full",e),s.toggle("input-active",t.isFocused&&!t.isInputHidden),s.toggle("dropdown-active",t.isOpen),s.toggle("has-options",(n=t.options,0===Object.keys(n).length)),s.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){const e=this;var i,s;const n=e.input.querySelector('option[value=""]');if(e.is_select_tag){const o=[],r=e.input.querySelectorAll("option:checked").length;function l(t,i,s){return t||(t=K('<option value="'+$(i)+'">'+$(s)+"</option>")),t!=n&&e.input.append(t),o.push(t),(t!=n||r>0)&&(t.selected=!0),t}e.input.querySelectorAll("option:checked").forEach(t=>{t.selected=!1}),0==e.items.length&&"single"==e.settings.mode?l(n,"",""):e.items.forEach(t=>{if(i=e.options[t],s=i[e.settings.labelField]||"",o.includes(i.$option)){l(e.input.querySelector(`option[value="${M(t)}"]:not(:checked)`),t,s)}else i.$option=l(i.$option,t,s)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,it(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),W(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),W(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen;t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.inputState()),e.isOpen=!1,it(e.focus_node,{"aria-expanded":"false"}),W(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,s=e.left+window.scrollX;W(this.dropdown,{width:e.width+"px",top:i+"px",left:s+"px"})}}clear(t){var e=this;if(e.items.length){var i=e.controlChildren();B(i,t=>{e.removeItem(t,!0)}),e.inputState(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,s=e.control;s.insertBefore(t,s.children[i]||null),e.setCaret(i+1)}deleteSelection(t){var e,i,s,n,o,r=this;e=t&&8===t.keyCode?-1:1,i={start:(o=r.control_input).selectionStart||0,length:(o.selectionEnd||0)-(o.selectionStart||0)};const l=[];if(r.activeItems.length)n=tt(r.activeItems,e),s=et(n),e>0&&s++,B(r.activeItems,t=>l.push(t));else if((r.isFocused||"single"===r.settings.mode)&&r.items.length){const t=r.controlChildren();let s;e<0&&0===i.start&&0===i.length?s=t[r.caretPos-1]:e>0&&i.start===r.inputValue().length&&(s=t[r.caretPos]),void 0!==s&&l.push(s)}if(!r.shouldDelete(l,t))return!1;for(q(t,!0),void 0!==s&&r.setCaret(s);l.length;)r.removeItem(l.pop());return r.inputState(),r.positionDropdown(),r.refreshOptions(!1),!0}shouldDelete(t,e){const i=t.map(t=>t.dataset.value);return!(!i.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete.call(this,i,e))}advanceSelection(t,e){var i,s,n=this;n.rtl&&(t*=-1),n.inputValue().length||(R(ot,e)||R("shiftKey",e)?(s=(i=n.getLastActive(t))?i.classList.contains("active")?n.getAdjacent(i,t,"item"):i:t>0?n.control_input.nextElementSibling:n.control_input.previousElementSibling)&&(s.classList.contains("active")&&n.removeActiveItem(i),n.setActiveItemClass(s)):n.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var i=this.control.querySelectorAll(".active");return i?tt(i,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(t=this.isReadOnly||this.isDisabled){this.isLocked=t,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(t){this.focus_node.tabIndex=t?-1:this.tabIndex,this.isDisabled=t,this.input.disabled=t,this.control_input.disabled=t,this.setLocked()}setReadOnly(t){this.isReadOnly=t,this.input.readOnly=t,this.control_input.readOnly=t,this.setLocked()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,U(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){var i,s;const n=this;if("function"!=typeof this.settings.render[t])return null;if(!(s=n.settings.render[t].call(this,e,$)))return null;if(s=K(s),"option"===t||"option_create"===t?e[n.settings.disabledField]?it(s,{"aria-disabled":"true"}):it(s,{"data-selectable":""}):"optgroup"===t&&(i=e.group[n.settings.optgroupValueField],it(s,{"data-group":i}),e.group[n.settings.disabledField]&&it(s,{"data-disabled":""})),"option"===t||"item"===t){const i=D(e[n.settings.valueField]);it(s,{"data-value":i}),"item"===t?(J(s,n.settings.itemClass),it(s,{"data-ts-item":""})):(J(s,n.settings.optionClass),it(s,{role:"option",id:e.$id}),e.$div=s,n.options[i]=e)}return s}_render(t,e){const i=this.render(t,e);if(null==i)throw"HTMLElement expected";return i}clearCache(){B(this.options,t=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){const e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var s=this,n=s[e];s[e]=function(){var e,o;return"after"===t&&(e=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===t?o:("before"===t&&(e=n.apply(s,arguments)),e)}}}const dt=t=>"string"==typeof t&&t.indexOf("<")>-1;const pt=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},ut=(t,e,i,s)=>{t.addEventListener(e,i,s)},ht=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(gt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},gt=t=>"string"==typeof t&&t.indexOf("<")>-1;ct.define("clear_button",function(t){const e=this,i=Object.assign({className:"clear-button",title:"Clear All",role:"button",tabindex:0,html:t=>`<div class="${t.className}" title="${t.title}" role="${t.role}" tabindex="${t.tabindex}">&times;</div>`},t);e.on("initialize",()=>{var t=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(dt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(i.html(i));t.addEventListener("click",t=>{e.isLocked||(e.clear(),"single"===e.settings.mode&&e.settings.allowEmptyOption&&e.addItem(""),e.refreshOptions(!1),t.preventDefault(),t.stopPropagation())}),e.control.appendChild(t)})}),ct.define("remove_button",function(t){const e=Object.assign({label:"&times;",title:"Remove",className:"remove",append:!0},t);var i=this;if(e.append){var s='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+((e.title+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")+'">')+e.label+"</a>";i.hook("after","setupTemplates",()=>{var t=i.settings.render.item;i.settings.render.item=(e,n)=>{var o=ht(t.call(i,e,n)),r=ht(s);return o.appendChild(r),ut(r,"mousedown",t=>{pt(t,!0)}),ut(r,"click",t=>{i.isLocked||(pt(t,!0),i.isLocked||i.shouldDelete([o],t)&&(i.removeItem(o),i.refreshOptions(!1),i.inputState()))}),o}})}});export{ct as default};
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.7
4
+ version: 8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -320,16 +320,22 @@ dependencies:
320
320
  name: image_processing
321
321
  requirement: !ruby/object:Gem::Requirement
322
322
  requirements:
323
- - - "~>"
323
+ - - ">="
324
324
  - !ruby/object:Gem::Version
325
325
  version: '1.14'
326
+ - - "<"
327
+ - !ruby/object:Gem::Version
328
+ version: '3.0'
326
329
  type: :runtime
327
330
  prerelease: false
328
331
  version_requirements: !ruby/object:Gem::Requirement
329
332
  requirements:
330
- - - "~>"
333
+ - - ">="
331
334
  - !ruby/object:Gem::Version
332
335
  version: '1.14'
336
+ - - "<"
337
+ - !ruby/object:Gem::Version
338
+ version: '3.0'
333
339
  - !ruby/object:Gem::Dependency
334
340
  name: importmap-rails
335
341
  requirement: !ruby/object:Gem::Requirement
@@ -514,14 +520,14 @@ dependencies:
514
520
  requirements:
515
521
  - - "~>"
516
522
  - !ruby/object:Gem::Version
517
- version: '7.0'
523
+ version: '8.0'
518
524
  type: :development
519
525
  prerelease: false
520
526
  version_requirements: !ruby/object:Gem::Requirement
521
527
  requirements:
522
528
  - - "~>"
523
529
  - !ruby/object:Gem::Version
524
- version: '7.0'
530
+ version: '8.0'
525
531
  - !ruby/object:Gem::Dependency
526
532
  name: rails-controller-testing
527
533
  requirement: !ruby/object:Gem::Requirement
@@ -612,14 +618,14 @@ dependencies:
612
618
  requirements:
613
619
  - - "~>"
614
620
  - !ruby/object:Gem::Version
615
- version: '7.0'
621
+ version: '8.0'
616
622
  type: :development
617
623
  prerelease: false
618
624
  version_requirements: !ruby/object:Gem::Requirement
619
625
  requirements:
620
626
  - - "~>"
621
627
  - !ruby/object:Gem::Version
622
- version: '7.0'
628
+ version: '8.0'
623
629
  - !ruby/object:Gem::Dependency
624
630
  name: db-query-matchers
625
631
  requirement: !ruby/object:Gem::Requirement
@@ -674,6 +680,7 @@ files:
674
680
  - app/assets/builds/tinymce/skins/ui/alchemy/content.min.css
675
681
  - app/assets/builds/tinymce/skins/ui/alchemy/skin.min.css
676
682
  - app/assets/config/alchemy_manifest.js
683
+ - app/assets/images/alchemy/admin/logo.svg
677
684
  - app/assets/images/alchemy/alchemy-logo.png
678
685
  - app/assets/images/alchemy/alchemy-logo.svg
679
686
  - app/assets/images/alchemy/element_icons/layout-bottom-2-line.svg
@@ -684,8 +691,32 @@ files:
684
691
  - app/assets/images/alchemy/missing-image.svg
685
692
  - app/components/alchemy/admin/attachment_select.rb
686
693
  - app/components/alchemy/admin/current_user_name.rb
694
+ - app/components/alchemy/admin/dashboard/widget.rb
695
+ - app/components/alchemy/admin/dashboard/widgets/attachment_counts.rb
696
+ - app/components/alchemy/admin/dashboard/widgets/element_usage.rb
697
+ - app/components/alchemy/admin/dashboard/widgets/greeting.html.erb
698
+ - app/components/alchemy/admin/dashboard/widgets/greeting.rb
699
+ - app/components/alchemy/admin/dashboard/widgets/locked_pages.html.erb
700
+ - app/components/alchemy/admin/dashboard/widgets/locked_pages.rb
701
+ - app/components/alchemy/admin/dashboard/widgets/online_users.html.erb
702
+ - app/components/alchemy/admin/dashboard/widgets/online_users.rb
703
+ - app/components/alchemy/admin/dashboard/widgets/page_counts.rb
704
+ - app/components/alchemy/admin/dashboard/widgets/page_usage.rb
705
+ - app/components/alchemy/admin/dashboard/widgets/picture_counts.rb
706
+ - app/components/alchemy/admin/dashboard/widgets/recent_pages.html.erb
707
+ - app/components/alchemy/admin/dashboard/widgets/recent_pages.rb
708
+ - app/components/alchemy/admin/dashboard/widgets/sites.html.erb
709
+ - app/components/alchemy/admin/dashboard/widgets/sites.rb
710
+ - app/components/alchemy/admin/dashboard/widgets/stat_widget.html.erb
711
+ - app/components/alchemy/admin/dashboard/widgets/stat_widget.rb
712
+ - app/components/alchemy/admin/dashboard/widgets/system_info.html.erb
713
+ - app/components/alchemy/admin/dashboard/widgets/system_info.rb
714
+ - app/components/alchemy/admin/dashboard/widgets/usage_widget.html.erb
715
+ - app/components/alchemy/admin/dashboard/widgets/usage_widget.rb
716
+ - app/components/alchemy/admin/dashboard/widgets/user_counts.rb
687
717
  - app/components/alchemy/admin/element_editor.html.erb
688
718
  - app/components/alchemy/admin/element_editor.rb
719
+ - app/components/alchemy/admin/element_schedule_timestamps.rb
689
720
  - app/components/alchemy/admin/element_select.rb
690
721
  - app/components/alchemy/admin/icon.rb
691
722
  - app/components/alchemy/admin/ingredient_editor.rb
@@ -701,7 +732,11 @@ files:
701
732
  - app/components/alchemy/admin/node_select.rb
702
733
  - app/components/alchemy/admin/page_node.html.erb
703
734
  - app/components/alchemy/admin/page_node.rb
735
+ - app/components/alchemy/admin/page_publication_fields.html.erb
736
+ - app/components/alchemy/admin/page_publication_fields.rb
704
737
  - app/components/alchemy/admin/page_select.rb
738
+ - app/components/alchemy/admin/page_status_indicators.html.erb
739
+ - app/components/alchemy/admin/page_status_indicators.rb
705
740
  - app/components/alchemy/admin/picture_description_select.rb
706
741
  - app/components/alchemy/admin/picture_thumbnail.rb
707
742
  - app/components/alchemy/admin/preview_time_select.rb
@@ -760,6 +795,7 @@ files:
760
795
  - app/controllers/alchemy/admin/attachments_controller.rb
761
796
  - app/controllers/alchemy/admin/base_controller.rb
762
797
  - app/controllers/alchemy/admin/clipboard_controller.rb
798
+ - app/controllers/alchemy/admin/dashboard/widgets_controller.rb
763
799
  - app/controllers/alchemy/admin/dashboard_controller.rb
764
800
  - app/controllers/alchemy/admin/elements_controller.rb
765
801
  - app/controllers/alchemy/admin/ingredients_controller.rb
@@ -809,7 +845,6 @@ files:
809
845
  - app/helpers/alchemy/url_helper.rb
810
846
  - app/javascript/alchemy_admin.js
811
847
  - app/javascript/alchemy_admin/components/action.js
812
- - app/javascript/alchemy_admin/components/alchemy_html_element.js
813
848
  - app/javascript/alchemy_admin/components/attachment_select.js
814
849
  - app/javascript/alchemy_admin/components/auto_submit.js
815
850
  - app/javascript/alchemy_admin/components/button.js
@@ -877,6 +912,7 @@ files:
877
912
  - app/javascript/alchemy_admin/templates/node_folder.hbs
878
913
  - app/javascript/alchemy_admin/utils/ajax.js
879
914
  - app/javascript/alchemy_admin/utils/debounce.js
915
+ - app/javascript/alchemy_admin/utils/dispatch_page_dirty_event.js
880
916
  - app/javascript/alchemy_admin/utils/dom_helpers.js
881
917
  - app/javascript/alchemy_admin/utils/events.js
882
918
  - app/javascript/alchemy_admin/utils/format.js
@@ -887,6 +923,7 @@ files:
887
923
  - app/javascript/tinymce/plugins/alchemy_link/index.js
888
924
  - app/jobs/alchemy/base_job.rb
889
925
  - app/jobs/alchemy/delete_picture_job.rb
926
+ - app/jobs/alchemy/invalidate_elements_cache_job.rb
890
927
  - app/jobs/alchemy/publish_page_job.rb
891
928
  - app/jobs/alchemy/storage_adapter/active_storage/sanitize_svg_job.rb
892
929
  - app/mailers/alchemy/base_mailer.rb
@@ -990,6 +1027,7 @@ files:
990
1027
  - app/services/alchemy/dragonfly_to_image_processing.rb
991
1028
  - app/services/alchemy/duplicate_element.rb
992
1029
  - app/services/alchemy/element_preloader.rb
1030
+ - app/services/alchemy/page_finder.rb
993
1031
  - app/services/alchemy/page_tree_preloader.rb
994
1032
  - app/services/alchemy/tag_validations.rb
995
1033
  - app/services/alchemy/update_checker.rb
@@ -1003,6 +1041,7 @@ files:
1003
1041
  - app/stylesheets/alchemy/_themes.scss
1004
1042
  - app/stylesheets/alchemy/_variables.scss
1005
1043
  - app/stylesheets/alchemy/admin.scss
1044
+ - app/stylesheets/alchemy/admin/_tom-select.scss
1006
1045
  - app/stylesheets/alchemy/admin/archive.scss
1007
1046
  - app/stylesheets/alchemy/admin/attachment-select.scss
1008
1047
  - app/stylesheets/alchemy/admin/attachments.scss
@@ -1059,6 +1098,7 @@ files:
1059
1098
  - app/stylesheets/tinymce/skins/ui/alchemy/content.scss
1060
1099
  - app/stylesheets/tinymce/skins/ui/alchemy/fonts/tinymce-mobile.woff
1061
1100
  - app/stylesheets/tinymce/skins/ui/alchemy/skin.scss
1101
+ - app/types/alchemy/wildcard_url_type.rb
1062
1102
  - app/views/alchemy/_edit_mode.html.erb
1063
1103
  - app/views/alchemy/_menubar.html.erb
1064
1104
  - app/views/alchemy/_preview_mode_code.html.erb
@@ -1087,22 +1127,21 @@ files:
1087
1127
  - app/views/alchemy/admin/clipboard/remove.turbo_stream.erb
1088
1128
  - app/views/alchemy/admin/crop.html.erb
1089
1129
  - app/views/alchemy/admin/dashboard/_dashboard.html.erb
1090
- - app/views/alchemy/admin/dashboard/_left_column.html.erb
1091
- - app/views/alchemy/admin/dashboard/_right_column.html.erb
1130
+ - app/views/alchemy/admin/dashboard/_footer.html.erb
1131
+ - app/views/alchemy/admin/dashboard/_stats.html.erb
1092
1132
  - app/views/alchemy/admin/dashboard/_top.html.erb
1133
+ - app/views/alchemy/admin/dashboard/_widgets.html.erb
1093
1134
  - app/views/alchemy/admin/dashboard/help.html.erb
1094
1135
  - app/views/alchemy/admin/dashboard/index.html.erb
1095
1136
  - app/views/alchemy/admin/dashboard/info.html.erb
1096
- - app/views/alchemy/admin/dashboard/widgets/_locked_pages.html.erb
1097
- - app/views/alchemy/admin/dashboard/widgets/_recent_pages.html.erb
1098
- - app/views/alchemy/admin/dashboard/widgets/_sites.html.erb
1099
- - app/views/alchemy/admin/dashboard/widgets/_users.html.erb
1137
+ - app/views/alchemy/admin/dashboard/widgets/show.html.erb
1100
1138
  - app/views/alchemy/admin/elements/_add_nested_element_form.html.erb
1101
1139
  - app/views/alchemy/admin/elements/_fixed_element.html.erb
1102
1140
  - app/views/alchemy/admin/elements/_footer.html.erb
1103
1141
  - app/views/alchemy/admin/elements/_form.html.erb
1104
1142
  - app/views/alchemy/admin/elements/_header.html.erb
1105
1143
  - app/views/alchemy/admin/elements/_schedule.html.erb
1144
+ - app/views/alchemy/admin/elements/_schedule_fields.html.erb
1106
1145
  - app/views/alchemy/admin/elements/_toolbar.html.erb
1107
1146
  - app/views/alchemy/admin/elements/create.turbo_stream.erb
1108
1147
  - app/views/alchemy/admin/elements/index.html.erb
@@ -1119,9 +1158,7 @@ files:
1119
1158
  - app/views/alchemy/admin/ingredients/update.turbo_stream.erb
1120
1159
  - app/views/alchemy/admin/languages/_form.html.erb
1121
1160
  - app/views/alchemy/admin/languages/_table.html.erb
1122
- - app/views/alchemy/admin/languages/edit.html.erb
1123
1161
  - app/views/alchemy/admin/languages/index.html.erb
1124
- - app/views/alchemy/admin/languages/new.html.erb
1125
1162
  - app/views/alchemy/admin/layoutpages/_layoutpage.html.erb
1126
1163
  - app/views/alchemy/admin/layoutpages/edit.html.erb
1127
1164
  - app/views/alchemy/admin/layoutpages/index.html.erb
@@ -1214,9 +1251,7 @@ files:
1214
1251
  - app/views/alchemy/admin/resources/index.html.erb
1215
1252
  - app/views/alchemy/admin/resources/new.html.erb
1216
1253
  - app/views/alchemy/admin/sites/_form.html.erb
1217
- - app/views/alchemy/admin/sites/edit.html.erb
1218
1254
  - app/views/alchemy/admin/sites/index.html.erb
1219
- - app/views/alchemy/admin/sites/new.html.erb
1220
1255
  - app/views/alchemy/admin/styleguide/index.html.erb
1221
1256
  - app/views/alchemy/admin/tags/_radio_tag.html.erb
1222
1257
  - app/views/alchemy/admin/tags/edit.html.erb
@@ -1306,6 +1341,7 @@ files:
1306
1341
  - lib/alchemy/configuration/string_option.rb
1307
1342
  - lib/alchemy/configuration/symbol_option.rb
1308
1343
  - lib/alchemy/configuration_methods.rb
1344
+ - lib/alchemy/configurations/dashboard.rb
1309
1345
  - lib/alchemy/configurations/default_language.rb
1310
1346
  - lib/alchemy/configurations/default_site.rb
1311
1347
  - lib/alchemy/configurations/format_matchers.rb
@@ -1342,6 +1378,7 @@ files:
1342
1378
  - lib/alchemy/routing_constraints.rb
1343
1379
  - lib/alchemy/seeder.rb
1344
1380
  - lib/alchemy/shell.rb
1381
+ - lib/alchemy/sprockets/skip_builds_compression.rb
1345
1382
  - lib/alchemy/svg_scrubber.rb
1346
1383
  - lib/alchemy/taggable.rb
1347
1384
  - lib/alchemy/tasks/tidy.rb
@@ -1438,6 +1475,7 @@ files:
1438
1475
  - vendor/javascript/clipboard.min.js
1439
1476
  - vendor/javascript/cropperjs.min.js
1440
1477
  - vendor/javascript/flatpickr.min.js
1478
+ - vendor/javascript/floating-ui.min.js
1441
1479
  - vendor/javascript/handlebars.min.js
1442
1480
  - vendor/javascript/jquery.min.js
1443
1481
  - vendor/javascript/keymaster.min.js
@@ -1446,6 +1484,7 @@ files:
1446
1484
  - vendor/javascript/shoelace.min.js
1447
1485
  - vendor/javascript/sortable.min.js
1448
1486
  - vendor/javascript/tinymce.min.js
1487
+ - vendor/javascript/tom-select.min.js
1449
1488
  - vendor/javascript/ungap-custom-elements.min.js
1450
1489
  homepage: https://alchemy-cms.com
1451
1490
  licenses:
@@ -1,129 +0,0 @@
1
- import { toCamelCase } from "alchemy_admin/utils/string_conversions"
2
-
3
- export class AlchemyHTMLElement extends HTMLElement {
4
- static properties = {}
5
-
6
- /**
7
- * create the list of observed attributes
8
- * this function is a requirement for the `attributeChangedCallback` - method
9
- * @returns {string[]}
10
- * @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Components#reference
11
- */
12
- static get observedAttributes() {
13
- return Object.keys(this.properties)
14
- }
15
-
16
- constructor(options = {}) {
17
- super()
18
-
19
- this.options = options
20
- this.changeComponent = true
21
- this.initialContent = this.innerHTML // store the inner content of the component
22
- }
23
-
24
- /**
25
- * run when the component will be initialized by the Browser
26
- * this is a default function
27
- * @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Components#reference
28
- */
29
- async connectedCallback() {
30
- // parse the properties object and register property with the default values
31
- Object.keys(this.constructor.properties).forEach((name) => {
32
- // if the options was given via the constructor, they should be prefer (e.g. new <WebComponentName>({title: "Foo"}))
33
- this[name] =
34
- this.options[name] ?? this.constructor.properties[name].default
35
- })
36
-
37
- // then process the attributes
38
- this.getAttributeNames().forEach((name) => this._updateFromAttribute(name))
39
-
40
- // render the component
41
- this._updateComponent()
42
- await this.connected()
43
- }
44
-
45
- /**
46
- * disconnected callback if the component is removed from the DOM
47
- * this is currently only a Proxy to the disconnected - callback to use the same callback structure
48
- * as for the connected - callback
49
- * @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Components#reference
50
- */
51
- disconnectedCallback() {
52
- this.disconnected()
53
- }
54
-
55
- /**
56
- * triggered by the browser, if one of the observed attributes is changing
57
- * @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Components#reference
58
- */
59
- attributeChangedCallback(name) {
60
- this._updateFromAttribute(name)
61
- this._updateComponent()
62
- }
63
-
64
- /**
65
- * a connected method to make it easier to overwrite the connection callback
66
- */
67
- async connected() {}
68
-
69
- /**
70
- * a disconnected method to make it easier to overwrite the disconnection callback
71
- */
72
- disconnected() {}
73
-
74
- /**
75
- * empty method container to allow the child component to put the rendered string into this method
76
- * @returns {String}
77
- */
78
- render() {
79
- return this.initialContent
80
- }
81
-
82
- /**
83
- * after render callback
84
- * the function will be triggered after the DOM was updated
85
- */
86
- afterRender() {}
87
-
88
- /**
89
- * Dispatches a custom event with given name
90
- * @param {string} name The name of the custom event
91
- * @param {object} detail Optional event details
92
- */
93
- dispatchCustomEvent(name, detail = {}) {
94
- const event = new CustomEvent(`Alchemy.${name}`, { bubbles: true, detail })
95
- this.dispatchEvent(event)
96
- }
97
-
98
- /**
99
- * (re)render the component content inside the component container
100
- * @private
101
- */
102
- _updateComponent() {
103
- if (this.changeComponent) {
104
- this.innerHTML = this.render()
105
- this.changeComponent = false
106
- this.afterRender()
107
- }
108
- }
109
-
110
- /**
111
- * update the value from the given attribute
112
- *
113
- * @param {string} name
114
- * @private
115
- */
116
- _updateFromAttribute(name) {
117
- const attributeValue = this.getAttribute(name)
118
- const propertyName = toCamelCase(name)
119
- const isBooleanValue =
120
- attributeValue.length === 0 || attributeValue === "true"
121
-
122
- const value = isBooleanValue ? true : attributeValue
123
-
124
- if (this[propertyName] !== value) {
125
- this[propertyName] = value
126
- this.changeComponent = true
127
- }
128
- }
129
- }
@@ -1,4 +0,0 @@
1
- <div class="column left">
2
- <%= render 'alchemy/admin/dashboard/widgets/locked_pages' %>
3
- <%= render 'alchemy/admin/dashboard/widgets/recent_pages' %>
4
- </div>
@@ -1,9 +0,0 @@
1
- <div class="column right">
2
- <% if @online_users.try(:any?) %>
3
- <%= render 'alchemy/admin/dashboard/widgets/users' %>
4
- <% end %>
5
-
6
- <% if multi_site? %>
7
- <%= render 'alchemy/admin/dashboard/widgets/sites' %>
8
- <% end %>
9
- </div>
@@ -1,52 +0,0 @@
1
- <% colspan = multi_site? ? 5 : 4 %>
2
- <div class="widget">
3
- <table class="list">
4
- <tr>
5
- <th colspan="<%= colspan %>"><%= Alchemy.t('Currently locked pages') %></th>
6
- </tr>
7
- <% if @all_locked_pages.blank? %>
8
- <tr>
9
- <td colspan="<%= colspan %>"><%= Alchemy.t('no pages') %></td>
10
- </tr>
11
- <% else %>
12
- <% @all_locked_pages.each do |page| %>
13
- <tr class="<%= cycle('even', 'odd', name: 'locked_pages') %>">
14
- <td>
15
- <% if current_alchemy_user.id == page.locked_by %>
16
- <%= link_to(page.name, alchemy.edit_admin_page_path(page)) %>
17
- <% else %>
18
- <%= page.name %>
19
- <% end %>
20
- </td>
21
- <% if multi_site? %>
22
- <td>
23
- <small><%= page.site_name %></small>
24
- </td>
25
- <% end %>
26
- <td>
27
- <% if page.site_languages.many? %>
28
- <small><%= page.language.code.upcase %></small>
29
- <% end %>
30
- </td>
31
- <td>
32
- <% if current_alchemy_user.id == page.locked_by %>
33
- <small><%= Alchemy.t(:me) %></small>
34
- <% else %>
35
- <small><%= page.locker_name %></small>
36
- <% end %>
37
- </td>
38
- <td>
39
- <% if (current_alchemy_user.id == page.locked_by) || can?(:manage, Alchemy::Current.site) %>
40
- <%= form_tag(alchemy.unlock_admin_page_path(page, :redirect_to => alchemy.admin_dashboard_path)) do %>
41
- <button class="icon_button small" title="<%= Alchemy.t(:explain_unlocking) %>">
42
- <%= render_icon(:close, size: '1x') %>
43
- </button>
44
- <% end %>
45
- <% end %>
46
- </td>
47
- </tr>
48
- <% end %>
49
- <% end %>
50
- </table>
51
- </div>
52
- <% reset_cycle('locked_pages') %>
@@ -1,34 +0,0 @@
1
- <div class="widget">
2
- <table class="list">
3
- <tr>
4
- <th colspan="4"><%= Alchemy.t('Your last updated pages') %></th>
5
- </tr>
6
- <% if @last_edited_pages.blank? %>
7
- <tr class="even">
8
- <td colspan="4"><%= Alchemy.t('no pages') %></td>
9
- </tr>
10
- <% else %>
11
- <% @last_edited_pages.each do |page| %>
12
- <tr class="<%= cycle('even', 'odd', :name => 'edited_pages') %>">
13
- <td>
14
- <%= link_to_if((page.locked_by.blank? || page.locked_by == current_alchemy_user.id), page.name, edit_admin_page_path(page)) %>
15
- </td>
16
- <% if multi_site? %>
17
- <td>
18
- <small><%= page.site_name %></small>
19
- </td>
20
- <% end %>
21
- <td>
22
- <% if page.site_languages.many? %>
23
- <small><%= page.language.code.upcase %></small>
24
- <% end %>
25
- </td>
26
- <td>
27
- <small><%= l(page.updated_at, format: :'alchemy.short_datetime') %></small>
28
- </td>
29
- </tr>
30
- <% end %>
31
- <% end %>
32
- </table>
33
- </div>
34
- <% reset_cycle('edited_pages') %>
@@ -1,25 +0,0 @@
1
- <div class="widget sites">
2
- <table class="list">
3
- <tr>
4
- <th colspan="2"><%= Alchemy::Site.model_name.human(count: 2) %></th>
5
- </tr>
6
- <% @sites.each do |site| %>
7
- <tr class="<%= cycle('even', 'odd', name: 'sites') %>">
8
- <td>
9
- <% if alchemy.respond_to?(:login_url) %>
10
- <%= link_to_unless site == Alchemy::Current.site,
11
- site.name,
12
- alchemy.login_url(
13
- protocol: 'http://',
14
- host: site.host,
15
- user: {login: current_alchemy_user.try(:login)}
16
- ), target: '_blank' %>
17
- <% else %>
18
- <%= site.name %>
19
- <% end %>
20
- </td>
21
- <td><small><%= site.host %></small></td>
22
- </tr>
23
- <% end %>
24
- </table>
25
- </div>
@@ -1,21 +0,0 @@
1
- <div class="widget users">
2
- <table class="list">
3
- <tr>
4
- <th colspan="2"><%= Alchemy.t('Who else is online') %></th>
5
- </tr>
6
- <% if @online_users.blank? %>
7
- <tr>
8
- <td colspan="2"><%= Alchemy.t('no users') %></td>
9
- </tr>
10
- <% else %>
11
- <% @online_users.each do |user| %>
12
- <tr class="<%= cycle('even', 'odd') %>">
13
- <td><%= user.name %></td>
14
- <td>
15
- <small><%= user.human_roles_string %></small>
16
- </td>
17
- </tr>
18
- <% end %>
19
- <% end %>
20
- </table>
21
- </div>
@@ -1 +0,0 @@
1
- <%= render 'form', language: @language %>