alchemy_cms 7.1.0.pre.b1 → 7.1.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/Gemfile +1 -1
  4. data/README.md +2 -2
  5. data/alchemy_cms.gemspec +1 -1
  6. data/app/assets/config/alchemy_manifest.js +3 -4
  7. data/app/assets/images/alchemy/missing-image.svg +1 -1
  8. data/app/assets/javascripts/alchemy/admin.js +0 -4
  9. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +4 -4
  10. data/app/assets/javascripts/tinymce/icons/remixicons/icons.js +93 -0
  11. data/app/assets/javascripts/tinymce/plugins/alchemy_link/plugin.min.js +37 -18
  12. data/app/assets/stylesheets/alchemy/_variables.scss +11 -3
  13. data/app/assets/stylesheets/alchemy/archive.scss +5 -2
  14. data/app/assets/stylesheets/alchemy/buttons.scss +5 -4
  15. data/app/assets/stylesheets/alchemy/dialogs.scss +1 -1
  16. data/app/assets/stylesheets/alchemy/elements.scss +4 -5
  17. data/app/assets/stylesheets/alchemy/filter_field.scss +5 -0
  18. data/app/assets/stylesheets/tinymce/skins/content/alchemy/content.min.scss +69 -0
  19. data/app/assets/stylesheets/tinymce/skins/skintool.json +38 -0
  20. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.css +711 -0
  21. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.inline.css +705 -0
  22. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.inline.min.css +7 -0
  23. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.min.css +7 -0
  24. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.mobile.css +29 -0
  25. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/content.mobile.min.css +7 -0
  26. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/fonts/tinymce-mobile.woff +0 -0
  27. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.min.scss +3803 -0
  28. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.mobile.css +677 -0
  29. data/app/assets/stylesheets/tinymce/skins/ui/alchemy/skin.mobile.min.css +7 -0
  30. data/app/controllers/alchemy/admin/pages_controller.rb +9 -4
  31. data/app/helpers/alchemy/admin/base_helper.rb +23 -10
  32. data/app/helpers/alchemy/base_helper.rb +16 -1
  33. data/app/javascript/alchemy_admin/components/button.js +1 -1
  34. data/app/javascript/alchemy_admin/components/clipboard_button.js +27 -0
  35. data/app/javascript/alchemy_admin/components/element_editor.js +2 -2
  36. data/app/javascript/alchemy_admin/components/tinymce.js +9 -21
  37. data/app/javascript/alchemy_admin/picture_editors.js +4 -2
  38. data/app/javascript/alchemy_admin/utils/debounce.js +10 -0
  39. data/app/javascript/alchemy_admin/utils/max.js +3 -0
  40. data/app/javascript/alchemy_admin.js +4 -10
  41. data/app/models/alchemy/page/page_naming.rb +7 -0
  42. data/app/models/alchemy/page.rb +2 -2
  43. data/app/models/alchemy/picture_variant.rb +11 -2
  44. data/app/models/concerns/alchemy/picture_thumbnails.rb +1 -1
  45. data/app/views/alchemy/admin/attachments/show.html.erb +10 -19
  46. data/app/views/alchemy/admin/crop.html.erb +1 -1
  47. data/app/views/alchemy/admin/nodes/index.html.erb +1 -0
  48. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +0 -1
  49. data/app/views/alchemy/admin/pictures/_archive.html.erb +3 -3
  50. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +16 -3
  51. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -5
  52. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  53. data/app/views/alchemy/admin/resources/_filter.html.erb +1 -1
  54. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +1 -1
  55. data/app/views/alchemy/admin/tinymce/_setup.html.erb +1 -2
  56. data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +2 -2
  57. data/app/views/layouts/alchemy/admin.html.erb +1 -1
  58. data/bundles/shoelace.js +10 -0
  59. data/bundles/tinymce.js +20 -0
  60. data/config/alchemy/config.yml +11 -10
  61. data/config/brakeman.ignore +0 -34
  62. data/config/importmap.rb +9 -14
  63. data/config/initializers/dragonfly.rb +1 -0
  64. data/config/locales/alchemy.en.yml +2 -0
  65. data/eslint.config.js +17 -0
  66. data/lib/alchemy/config.rb +24 -2
  67. data/lib/alchemy/engine.rb +2 -1
  68. data/lib/alchemy/forms/builder.rb +7 -0
  69. data/lib/alchemy/test_support/capybara_helpers.rb +1 -1
  70. data/lib/alchemy/test_support/having_picture_thumbnails_examples.rb +6 -6
  71. data/lib/alchemy/tinymce.rb +13 -2
  72. data/lib/alchemy/version.rb +1 -1
  73. data/package.json +20 -6
  74. data/rollup.config.mjs +65 -0
  75. data/vendor/assets/stylesheets/tinymce/skins/content/default/content.min.css +1 -0
  76. data/vendor/javascript/clipboard.min.js +7 -0
  77. data/vendor/javascript/flatpickr.min.js +1 -0
  78. data/vendor/javascript/keymaster.min.js +1 -0
  79. data/vendor/javascript/rails-ujs.min.js +1 -0
  80. data/vendor/javascript/shoelace.min.js +995 -0
  81. data/vendor/javascript/sortable.min.js +7 -0
  82. data/vendor/javascript/tinymce.min.js +1 -0
  83. data/vendor/javascript/ungap-custom-elements.min.js +3 -0
  84. metadata +31 -39
  85. data/.codeclimate.yml +0 -35
  86. data/.editorconfig +0 -23
  87. data/.github/FUNDING.yml +0 -4
  88. data/.github/ISSUE_TEMPLATE/Bug_report.md +0 -22
  89. data/.github/ISSUE_TEMPLATE/Feature_request.md +0 -17
  90. data/.github/PULL_REQUEST_TEMPLATE.md +0 -18
  91. data/.github/workflows/backport.yml +0 -36
  92. data/.github/workflows/brakeman-analysis.yml +0 -46
  93. data/.github/workflows/lint.yml +0 -37
  94. data/.github/workflows/stale.yml +0 -33
  95. data/.github/workflows/test.yml +0 -125
  96. data/.gitignore +0 -32
  97. data/.hound.yml +0 -9
  98. data/.localeapp/config.rb +0 -8
  99. data/.prettierrc +0 -6
  100. data/.rspec +0 -1
  101. data/.rubocop.yml +0 -7
  102. data/.standard.yml +0 -4
  103. data/.yardopts +0 -5
  104. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +0 -94
  105. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +0 -63
  106. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  107. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  108. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +0 -129
  109. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  110. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  111. data/app/assets/stylesheets/tinymce/skins/alchemy/img/anchor.gif +0 -0
  112. data/app/assets/stylesheets/tinymce/skins/alchemy/img/loader.gif +0 -0
  113. data/app/assets/stylesheets/tinymce/skins/alchemy/img/object.gif +0 -0
  114. data/app/assets/stylesheets/tinymce/skins/alchemy/img/trans.gif +0 -0
  115. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +0 -2077
  116. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +0 -10
  117. data/vendor/assets/javascripts/clipboard.min.js +0 -7
  118. data/vendor/assets/javascripts/keymaster.js +0 -296
  119. data/vendor/assets/javascripts/requestAnimationFrame.js +0 -31
  120. data/vendor/assets/javascripts/tinymce/license.txt +0 -504
  121. data/vendor/assets/javascripts/tinymce/tinymce.min.js +0 -2
@@ -0,0 +1 @@
1
+ !function(e){var n,t={},o={16:!1,18:!1,17:!1,91:!1},r="all",i={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},l={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},f=function(e){return l[e]||e.toUpperCase().charCodeAt(0)},c=[];for(n=1;n<20;n++)l["f"+n]=111+n;function u(e,n){for(var t=e.length;t--;)if(e[t]===n)return t;return-1}function a(e,n){if(e.length!=n.length)return!1;for(var t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}var s={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};function d(e){for(n in o)o[n]=e[s[n]]}function p(e,n,o){var r,i;r=g(e),void 0===o&&(o=n,n="all");for(var l=0;l<r.length;l++)i=[],(e=r[l].split("+")).length>1&&(i=v(e),e=[e[e.length-1]]),e=e[0],(e=f(e))in t||(t[e]=[]),t[e].push({shortcut:r[l],scope:n,method:o,key:r[l],mods:i})}for(n in i)p[n]=!1;function h(){return r||"all"}function g(e){var n;return""==(n=(e=e.replace(/\s/g,"")).split(","))[n.length-1]&&(n[n.length-2]+=","),n}function v(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=i[n[t]];return n}function y(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,(function(){t(window.event)}))}y(document,"keydown",(function(e){!function(e){var n,r,l,f,a,s;if(n=e.keyCode,-1==u(c,n)&&c.push(n),93!=n&&224!=n||(n=91),n in o)for(l in o[n]=!0,i)i[l]==n&&(p[l]=!0);else if(d(e),p.filter.call(this,e)&&n in t)for(s=h(),f=0;f<t[n].length;f++)if((r=t[n][f]).scope==s||"all"==r.scope){for(l in a=r.mods.length>0,o)(!o[l]&&u(r.mods,+l)>-1||o[l]&&-1==u(r.mods,+l))&&(a=!1);(0!=r.mods.length||o[16]||o[18]||o[17]||o[91])&&!a||!1===r.method(e,r)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}(e)})),y(document,"keyup",(function(e){var n,t=e.keyCode,r=u(c,t);if(r>=0&&c.splice(r,1),93!=t&&224!=t||(t=91),t in o)for(n in o[t]=!1,i)i[n]==t&&(p[n]=!1)})),y(window,"focus",(function(){for(n in o)o[n]=!1;for(n in i)p[n]=!1}));var k=e.key;e.key=p,e.key.setScope=function(e){r=e||"all"},e.key.getScope=h,e.key.deleteScope=function(e){var n,o,r;for(n in t)for(o=t[n],r=0;r<o.length;)o[r].scope===e?o.splice(r,1):r++},e.key.filter=function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"==n||"SELECT"==n||"TEXTAREA"==n)},e.key.isPressed=function(e){return"string"==typeof e&&(e=f(e)),-1!=u(c,e)},e.key.getPressedKeyCodes=function(){return c.slice(0)},e.key.noConflict=function(){var n=e.key;return e.key=k,n},e.key.unbind=function(e,n){var o,r,i,l,c,u=[];for(o=g(e),l=0;l<o.length;l++){if((r=o[l].split("+")).length>1&&(u=v(r),e=r[r.length-1]),e=f(e),void 0===n&&(n=h()),!t[e])return;for(i=0;i<t[e].length;i++)(c=t[e][i]).scope===n&&a(c.mods,u)&&(t[e][i]={})}},"undefined"!=typeof module&&(module.exports=p)}(window);
@@ -0,0 +1 @@
1
+ const t="a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",e={selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"},n="select[data-remote], input[data-remote], textarea[data-remote]",a="form:not([data-turbo=true])",o="form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",r="input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",i="input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",u="a[data-disable-with], a[data-disable]",c="button[data-remote][data-disable-with], button[data-remote][data-disable]";let s=null;const l=()=>{const t=document.querySelector("meta[name=csp-nonce]");return s=t&&t.content},d=()=>s||l(),m=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,p=function(t,e){return e.exclude?m.call(t,e.selector)&&!m.call(t,e.exclude):m.call(t,e)},f="_ujsData",b=(t,e)=>t[f]?t[f][e]:void 0,h=function(t,e,n){return t[f]||(t[f]={}),t[f][e]=n},y=t=>Array.prototype.slice.call(document.querySelectorAll(t)),j=function(t){var e=!1;do{if(t.isContentEditable){e=!0;break}t=t.parentElement}while(t);return e},v=()=>{const t=document.querySelector("meta[name=csrf-token]");return t&&t.content},E=()=>{const t=document.querySelector("meta[name=csrf-param]");return t&&t.content},g=t=>{const e=v();if(e)return t.setRequestHeader("X-CSRF-Token",e)},w=()=>{const t=v(),e=E();if(t&&e)return y('form input[name="'+e+'"]').forEach((e=>e.value=t))},x={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},S=t=>{t=k(t);var e=C(t,(function(){const n=T(null!=e.response?e.response:e.responseText,e.getResponseHeader("Content-Type"));return 2===Math.floor(e.status/100)?"function"==typeof t.success&&t.success(n,e.statusText,e):"function"==typeof t.error&&t.error(n,e.statusText,e),"function"==typeof t.complete?t.complete(e,e.statusText):void 0}));return!(t.beforeSend&&!t.beforeSend(e,t))&&(e.readyState===XMLHttpRequest.OPENED?e.send(t.data):void 0)};var k=function(t){return t.url=t.url||location.href,t.type=t.type.toUpperCase(),"GET"===t.type&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data),t.dataType in x||(t.dataType="*"),t.accept=x[t.dataType],"*"!==t.dataType&&(t.accept+=", */*; q=0.01"),t},C=function(t,e){const n=new XMLHttpRequest;return n.open(t.type,t.url,!0),n.setRequestHeader("Accept",t.accept),"string"==typeof t.data&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),t.crossDomain||(n.setRequestHeader("X-Requested-With","XMLHttpRequest"),g(n)),n.withCredentials=!!t.withCredentials,n.onreadystatechange=function(){if(n.readyState===XMLHttpRequest.DONE)return e(n)},n},T=function(t,e){if("string"==typeof t&&"string"==typeof e)if(e.match(/\bjson\b/))try{t=JSON.parse(t)}catch(t){}else if(e.match(/\b(?:java|ecma)script\b/)){const e=document.createElement("script");e.setAttribute("nonce",d()),e.text=t,document.head.appendChild(e).parentNode.removeChild(e)}else if(e.match(/\b(xml|html|svg)\b/)){const n=new DOMParser;e=e.replace(/;.+/,"");try{t=n.parseFromString(t,e)}catch(t){}}return t};const A=function(t){const e=document.createElement("a");e.href=location.href;const n=document.createElement("a");try{return n.href=t,!((!n.protocol||":"===n.protocol)&&!n.host||e.protocol+"//"+e.host==n.protocol+"//"+n.host)}catch(t){return!0}};let D,{CustomEvent:M}=window;"function"!=typeof M&&(M=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n},M.prototype=window.Event.prototype,({preventDefault:D}=M.prototype),M.prototype.preventDefault=function(){const t=D.call(this);return this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:()=>!0}),t});const L=(t,e,n)=>{const a=new M(e,{bubbles:!0,cancelable:!0,detail:n});return t.dispatchEvent(a),!a.defaultPrevented},R=t=>{L(t.target,"ujs:everythingStopped"),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()},q=(t,e,n,a)=>t.addEventListener(n,(function(t){let{target:n}=t;for(;n instanceof Element&&!p(n,e);)n=n.parentNode;n instanceof Element&&!1===a.call(n,t)&&(t.preventDefault(),t.stopPropagation())})),H=t=>Array.prototype.slice.call(t),P=(t,e)=>{let n=[t];p(t,"form")&&(n=H(t.elements));const a=[];return n.forEach((function(t){t.name&&!t.disabled&&(p(t,"fieldset[disabled] *")||(p(t,"select")?H(t.options).forEach((function(e){e.selected&&a.push({name:t.name,value:e.value})})):(t.checked||-1===["radio","checkbox","submit"].indexOf(t.type))&&a.push({name:t.name,value:t.value})))})),e&&a.push(e),a.map((function(t){return t.name?`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`:t})).join("&")},O=(t,e)=>p(t,"form")?H(t.elements).filter((t=>p(t,e))):H(t.querySelectorAll(e));var I=function(t,e){let n;const a=t.getAttribute("data-confirm");if(!a)return!0;let o=!1;if(L(t,"confirm")){try{o=e.confirm(a,t)}catch(t){}n=L(t,"confirm:complete",[o])}return o&&n};const N=function(t){this.disabled&&R(t)},X=t=>{let e;if(t instanceof Event){if(K(t))return;e=t.target}else e=t;if(!j(e))return p(e,u)?F(e):p(e,c)||p(e,i)?z(e):p(e,a)?G(e):void 0},$=t=>{const e=t instanceof Event?t.target:t;if(!j(e))return p(e,u)?_(e):p(e,c)||p(e,r)?U(e):p(e,a)?Q(e):void 0};var _=function(t){if(b(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");return null!=e&&(h(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e),t.addEventListener("click",R),h(t,"ujs:disabled",!0)},F=function(t){const e=b(t,"ujs:enable-with");return null!=e&&(t.innerHTML=e,h(t,"ujs:enable-with",null)),t.removeEventListener("click",R),h(t,"ujs:disabled",null)},Q=t=>O(t,r).forEach(U),U=function(t){if(b(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");return null!=e&&(p(t,"button")?(h(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e):(h(t,"ujs:enable-with",t.value),t.value=e)),t.disabled=!0,h(t,"ujs:disabled",!0)},G=t=>O(t,i).forEach((t=>z(t))),z=function(t){const e=b(t,"ujs:enable-with");return null!=e&&(p(t,"button")?t.innerHTML=e:t.value=e,h(t,"ujs:enable-with",null)),t.disabled=!1,h(t,"ujs:disabled",null)},K=function(t){const e=t.detail?t.detail[0]:void 0;return e&&e.getResponseHeader("X-Xhr-Redirect")};const B=function(t){const e=this,{form:n}=e;if(n)return e.name&&h(n,"ujs:submit-button",{name:e.name,value:e.value}),h(n,"ujs:formnovalidate-button",e.formNoValidate),h(n,"ujs:submit-button-formaction",e.getAttribute("formaction")),h(n,"ujs:submit-button-formmethod",e.getAttribute("formmethod"))},J=function(t){const e=(this.getAttribute("data-method")||"GET").toUpperCase(),n=this.getAttribute("data-params"),a=(t.metaKey||t.ctrlKey)&&"GET"===e&&!n;(null!=t.button&&0!==t.button||a)&&t.stopImmediatePropagation()},V={$:y,ajax:S,buttonClickSelector:e,buttonDisableSelector:c,confirm:(t,e)=>window.confirm(t),cspNonce:d,csrfToken:v,csrfParam:E,CSRFProtection:g,delegate:q,disableElement:$,enableElement:X,fileInputSelector:"input[name][type=file]:not([disabled])",fire:L,formElements:O,formEnableSelector:i,formDisableSelector:r,formInputClickSelector:o,formSubmitButtonClick:B,formSubmitSelector:a,getData:b,handleDisabledElement:N,href:t=>t.href,inputChangeSelector:n,isCrossDomain:A,linkClickSelector:t,linkDisableSelector:u,loadCSPNonce:l,matches:p,preventInsignificantClick:J,refreshCSRFTokens:w,serializeElement:P,setData:h,stopEverything:R},W=(Y=V,function(t){I(this,Y)||R(t)});var Y;V.handleConfirm=W;const Z=(t=>function(e){const n=this,a=n.getAttribute("data-method");if(!a)return;if(j(this))return;const o=t.href(n),r=v(),i=E(),u=document.createElement("form");let c=`<input name='_method' value='${a}' type='hidden' />`;i&&r&&!A(o)&&(c+=`<input name='${i}' value='${r}' type='hidden' />`),c+='<input type="submit" />',u.method="post",u.action=o,u.target=n.target,u.innerHTML=c,u.style.display="none",document.body.appendChild(u),u.querySelector('[type="submit"]').click(),R(e)})(V);V.handleMethod=Z;const tt=(t=>function(o){let r,i,u;const c=this;if(!function(t){const e=t.getAttribute("data-remote");return null!=e&&"false"!==e}(c))return!0;if(!L(c,"ajax:before"))return L(c,"ajax:stopped"),!1;if(j(c))return L(c,"ajax:stopped"),!1;const s=c.getAttribute("data-with-credentials"),l=c.getAttribute("data-type")||"script";if(p(c,a)){const t=b(c,"ujs:submit-button");i=b(c,"ujs:submit-button-formmethod")||c.getAttribute("method")||"get",u=b(c,"ujs:submit-button-formaction")||c.getAttribute("action")||location.href,"GET"===i.toUpperCase()&&(u=u.replace(/\?.*$/,"")),"multipart/form-data"===c.enctype?(r=new FormData(c),null!=t&&r.append(t.name,t.value)):r=P(c,t),h(c,"ujs:submit-button",null),h(c,"ujs:submit-button-formmethod",null),h(c,"ujs:submit-button-formaction",null)}else p(c,e)||p(c,n)?(i=c.getAttribute("data-method"),u=c.getAttribute("data-url"),r=P(c,c.getAttribute("data-params"))):(i=c.getAttribute("data-method"),u=t.href(c),r=c.getAttribute("data-params"));S({type:i||"GET",url:u,data:r,dataType:l,beforeSend:(t,e)=>L(c,"ajax:beforeSend",[t,e])?L(c,"ajax:send",[t]):(L(c,"ajax:stopped"),!1),success:(...t)=>L(c,"ajax:success",t),error:(...t)=>L(c,"ajax:error",t),complete:(...t)=>L(c,"ajax:complete",t),crossDomain:A(u),withCredentials:null!=s&&"false"!==s}),R(o)})(V);V.handleRemote=tt;if(V.start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",(function(){y(i).forEach((function(t){b(t,"ujs:disabled")&&X(t)})),y(u).forEach((function(t){b(t,"ujs:disabled")&&X(t)}))})),q(document,u,"ajax:complete",X),q(document,u,"ajax:stopped",X),q(document,c,"ajax:complete",X),q(document,c,"ajax:stopped",X),q(document,t,"click",J),q(document,t,"click",N),q(document,t,"click",W),q(document,t,"click",$),q(document,t,"click",tt),q(document,t,"click",Z),q(document,e,"click",J),q(document,e,"click",N),q(document,e,"click",W),q(document,e,"click",$),q(document,e,"click",tt),q(document,n,"change",N),q(document,n,"change",W),q(document,n,"change",tt),q(document,a,"submit",N),q(document,a,"submit",W),q(document,a,"submit",tt),q(document,a,"submit",(t=>setTimeout((()=>$(t)),13))),q(document,a,"ajax:send",$),q(document,a,"ajax:complete",X),q(document,o,"click",J),q(document,o,"click",N),q(document,o,"click",W),q(document,o,"click",B),document.addEventListener("DOMContentLoaded",w),document.addEventListener("DOMContentLoaded",l),window._rails_loaded=!0},"undefined"!=typeof jQuery&&jQuery&&jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=V,jQuery.ajaxPrefilter((function(t,e,n){if(!t.crossDomain)return g(n)}))}export{V as default};