plutonium 0.50.0 → 0.51.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/plutonium/SKILL.md +85 -102
  3. data/.claude/skills/plutonium-app/SKILL.md +572 -0
  4. data/.claude/skills/plutonium-auth/SKILL.md +163 -300
  5. data/.claude/skills/plutonium-behavior/SKILL.md +838 -0
  6. data/.claude/skills/plutonium-resource/SKILL.md +1176 -0
  7. data/.claude/skills/plutonium-tenancy/SKILL.md +655 -0
  8. data/.claude/skills/plutonium-testing/SKILL.md +6 -5
  9. data/.claude/skills/plutonium-ui/SKILL.md +900 -0
  10. data/CHANGELOG.md +27 -2
  11. data/Rakefile +2 -1
  12. data/app/assets/plutonium.css +1 -11
  13. data/app/assets/plutonium.js +1009 -1214
  14. data/app/assets/plutonium.js.map +3 -3
  15. data/app/assets/plutonium.min.js +52 -51
  16. data/app/assets/plutonium.min.js.map +3 -3
  17. data/docs/.vitepress/config.ts +37 -27
  18. data/docs/getting-started/index.md +22 -29
  19. data/docs/getting-started/installation.md +37 -80
  20. data/docs/getting-started/tutorial/index.md +4 -5
  21. data/docs/guides/adding-resources.md +66 -377
  22. data/docs/guides/authentication.md +94 -463
  23. data/docs/guides/authorization.md +124 -370
  24. data/docs/guides/creating-packages.md +94 -296
  25. data/docs/guides/custom-actions.md +121 -441
  26. data/docs/guides/index.md +22 -42
  27. data/docs/guides/multi-tenancy.md +116 -187
  28. data/docs/guides/nested-resources.md +103 -431
  29. data/docs/guides/search-filtering.md +123 -240
  30. data/docs/guides/testing.md +5 -4
  31. data/docs/guides/theming.md +157 -407
  32. data/docs/guides/troubleshooting.md +5 -3
  33. data/docs/guides/user-invites.md +106 -425
  34. data/docs/guides/user-profile.md +76 -243
  35. data/docs/index.md +1 -1
  36. data/docs/reference/app/generators.md +517 -0
  37. data/docs/reference/app/index.md +158 -0
  38. data/docs/reference/app/packages.md +146 -0
  39. data/docs/reference/app/portals.md +377 -0
  40. data/docs/reference/auth/accounts.md +230 -0
  41. data/docs/reference/auth/index.md +88 -0
  42. data/docs/reference/auth/profile.md +185 -0
  43. data/docs/reference/behavior/controllers.md +395 -0
  44. data/docs/reference/behavior/index.md +22 -0
  45. data/docs/reference/behavior/interactions.md +341 -0
  46. data/docs/reference/behavior/policies.md +417 -0
  47. data/docs/reference/index.md +56 -49
  48. data/docs/reference/resource/actions.md +423 -0
  49. data/docs/reference/resource/definition.md +508 -0
  50. data/docs/reference/resource/index.md +50 -0
  51. data/docs/reference/resource/model.md +348 -0
  52. data/docs/reference/resource/query.md +305 -0
  53. data/docs/reference/tenancy/entity-scoping.md +361 -0
  54. data/docs/reference/tenancy/index.md +36 -0
  55. data/docs/reference/tenancy/invites.md +393 -0
  56. data/docs/reference/tenancy/nested-resources.md +267 -0
  57. data/docs/reference/testing/index.md +287 -0
  58. data/docs/reference/ui/assets.md +400 -0
  59. data/docs/reference/ui/components.md +165 -0
  60. data/docs/reference/ui/displays.md +104 -0
  61. data/docs/reference/ui/forms.md +284 -0
  62. data/docs/reference/ui/index.md +30 -0
  63. data/docs/reference/ui/layouts.md +106 -0
  64. data/docs/reference/ui/pages.md +189 -0
  65. data/docs/reference/ui/tables.md +117 -0
  66. data/docs/superpowers/specs/2026-05-09-typeahead-endpoint-design.md +203 -0
  67. data/docs/superpowers/specs/2026-05-12-skill-compaction-design.md +99 -0
  68. data/docs/superpowers/specs/2026-05-13-docs-restructure-design.md +186 -0
  69. data/gemfiles/rails_7.gemfile.lock +1 -1
  70. data/gemfiles/rails_8.0.gemfile.lock +1 -1
  71. data/gemfiles/rails_8.1.gemfile.lock +1 -1
  72. data/lib/generators/pu/core/update/update_generator.rb +0 -20
  73. data/lib/generators/pu/invites/install_generator.rb +1 -0
  74. data/lib/plutonium/definition/base.rb +1 -1
  75. data/lib/plutonium/definition/{views.rb → index_views.rb} +21 -20
  76. data/lib/plutonium/helpers/turbo_helper.rb +11 -0
  77. data/lib/plutonium/helpers/turbo_stream_actions_helper.rb +14 -0
  78. data/lib/plutonium/resource/controller.rb +1 -0
  79. data/lib/plutonium/resource/controllers/crud_actions.rb +19 -1
  80. data/lib/plutonium/resource/controllers/typeahead.rb +180 -0
  81. data/lib/plutonium/resource/policy.rb +7 -0
  82. data/lib/plutonium/routing/mapper_extensions.rb +15 -0
  83. data/lib/plutonium/ui/component/methods.rb +4 -0
  84. data/lib/plutonium/ui/form/base.rb +6 -2
  85. data/lib/plutonium/ui/form/components/json.rb +58 -0
  86. data/lib/plutonium/ui/form/components/resource_select.rb +62 -8
  87. data/lib/plutonium/ui/form/components/secure_association.rb +98 -22
  88. data/lib/plutonium/ui/form/concerns/typeahead_attributes.rb +83 -0
  89. data/lib/plutonium/ui/form/resource.rb +0 -4
  90. data/lib/plutonium/ui/grid/resource.rb +1 -1
  91. data/lib/plutonium/ui/layout/base.rb +1 -0
  92. data/lib/plutonium/ui/page/base.rb +0 -7
  93. data/lib/plutonium/ui/page/index.rb +4 -4
  94. data/lib/plutonium/ui/table/resource.rb +1 -1
  95. data/lib/plutonium/version.rb +1 -1
  96. data/lib/plutonium.rb +8 -0
  97. data/lib/tasks/release.rake +15 -1
  98. data/package.json +10 -10
  99. data/src/css/slim_select.css +4 -0
  100. data/src/js/controllers/slim_select_controller.js +61 -0
  101. data/src/js/turbo/turbo_actions.js +33 -0
  102. data/yarn.lock +553 -543
  103. metadata +44 -33
  104. data/.claude/skills/plutonium-assets/SKILL.md +0 -512
  105. data/.claude/skills/plutonium-controller/SKILL.md +0 -396
  106. data/.claude/skills/plutonium-create-resource/SKILL.md +0 -303
  107. data/.claude/skills/plutonium-definition/SKILL.md +0 -1223
  108. data/.claude/skills/plutonium-entity-scoping/SKILL.md +0 -317
  109. data/.claude/skills/plutonium-forms/SKILL.md +0 -465
  110. data/.claude/skills/plutonium-installation/SKILL.md +0 -331
  111. data/.claude/skills/plutonium-interaction/SKILL.md +0 -413
  112. data/.claude/skills/plutonium-invites/SKILL.md +0 -408
  113. data/.claude/skills/plutonium-model/SKILL.md +0 -440
  114. data/.claude/skills/plutonium-nested-resources/SKILL.md +0 -360
  115. data/.claude/skills/plutonium-package/SKILL.md +0 -198
  116. data/.claude/skills/plutonium-policy/SKILL.md +0 -456
  117. data/.claude/skills/plutonium-portal/SKILL.md +0 -410
  118. data/.claude/skills/plutonium-views/SKILL.md +0 -651
  119. data/docs/reference/assets/index.md +0 -496
  120. data/docs/reference/controller/index.md +0 -412
  121. data/docs/reference/definition/actions.md +0 -462
  122. data/docs/reference/definition/fields.md +0 -383
  123. data/docs/reference/definition/index.md +0 -326
  124. data/docs/reference/definition/query.md +0 -351
  125. data/docs/reference/generators/index.md +0 -648
  126. data/docs/reference/interaction/index.md +0 -449
  127. data/docs/reference/model/features.md +0 -248
  128. data/docs/reference/model/index.md +0 -218
  129. data/docs/reference/policy/index.md +0 -456
  130. data/docs/reference/portal/index.md +0 -379
  131. data/docs/reference/views/forms.md +0 -411
  132. data/docs/reference/views/index.md +0 -544
@@ -1,7 +1,7 @@
1
- (()=>{var Wg=Object.create;var mu=Object.defineProperty;var Gg=Object.getOwnPropertyDescriptor;var Kg=Object.getOwnPropertyNames;var Xg=Object.getPrototypeOf,Yg=Object.prototype.hasOwnProperty;var xe=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Zg=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Kg(e))!Yg.call(i,s)&&s!==t&&mu(i,s,{get:()=>e[s],enumerable:!(r=Gg(e,s))||r.enumerable});return i};var ye=(i,e,t)=>(t=i!=null?Wg(Xg(i)):{},Zg(e||!i||!i.__esModule?mu(t,"default",{value:i,enumerable:!0}):t,i));var Do=xe((hC,Kp)=>{function fw(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}Kp.exports=fw});var Yp=xe((uC,Xp)=>{var mw=typeof global=="object"&&global&&global.Object===Object&&global;Xp.exports=mw});var Vc=xe((dC,Zp)=>{var gw=Yp(),bw=typeof self=="object"&&self&&self.Object===Object&&self,yw=gw||bw||Function("return this")();Zp.exports=yw});var Jp=xe((pC,Qp)=>{var vw=Vc(),ww=function(){return vw.Date.now()};Qp.exports=ww});var tf=xe((fC,ef)=>{var Sw=/\s/;function Ew(i){for(var e=i.length;e--&&Sw.test(i.charAt(e)););return e}ef.exports=Ew});var sf=xe((mC,rf)=>{var Tw=tf(),xw=/^\s+/;function kw(i){return i&&i.slice(0,Tw(i)+1).replace(xw,"")}rf.exports=kw});var Wc=xe((gC,nf)=>{var _w=Vc(),Aw=_w.Symbol;nf.exports=Aw});var cf=xe((bC,lf)=>{var of=Wc(),af=Object.prototype,Cw=af.hasOwnProperty,Pw=af.toString,qs=of?of.toStringTag:void 0;function Fw(i){var e=Cw.call(i,qs),t=i[qs];try{i[qs]=void 0;var r=!0}catch{}var s=Pw.call(i);return r&&(e?i[qs]=t:delete i[qs]),s}lf.exports=Fw});var uf=xe((yC,hf)=>{var Ow=Object.prototype,Rw=Ow.toString;function Mw(i){return Rw.call(i)}hf.exports=Mw});var mf=xe((vC,ff)=>{var df=Wc(),Lw=cf(),Iw=uf(),Dw="[object Null]",Nw="[object Undefined]",pf=df?df.toStringTag:void 0;function Bw(i){return i==null?i===void 0?Nw:Dw:pf&&pf in Object(i)?Lw(i):Iw(i)}ff.exports=Bw});var bf=xe((wC,gf)=>{function Uw(i){return i!=null&&typeof i=="object"}gf.exports=Uw});var vf=xe((SC,yf)=>{var zw=mf(),Hw=bf(),jw="[object Symbol]";function qw(i){return typeof i=="symbol"||Hw(i)&&zw(i)==jw}yf.exports=qw});var Tf=xe((EC,Ef)=>{var $w=sf(),wf=Do(),Vw=vf(),Sf=NaN,Ww=/^[-+]0x[0-9a-f]+$/i,Gw=/^0b[01]+$/i,Kw=/^0o[0-7]+$/i,Xw=parseInt;function Yw(i){if(typeof i=="number")return i;if(Vw(i))return Sf;if(wf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=wf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=$w(i);var t=Gw.test(i);return t||Kw.test(i)?Xw(i.slice(2),t?2:8):Ww.test(i)?Sf:+i}Ef.exports=Yw});var Kc=xe((TC,kf)=>{var Zw=Do(),Gc=Jp(),xf=Tf(),Qw="Expected a function",Jw=Math.max,e1=Math.min;function t1(i,e,t){var r,s,n,o,a,l,u=0,f=!1,m=!1,v=!0;if(typeof i!="function")throw new TypeError(Qw);e=xf(e)||0,Zw(t)&&(f=!!t.leading,m="maxWait"in t,n=m?Jw(xf(t.maxWait)||0,e):n,v="trailing"in t?!!t.trailing:v);function b(A){var O=r,N=s;return r=s=void 0,u=A,o=i.apply(N,O),o}function k(A){return u=A,a=setTimeout(R,e),f?b(A):o}function P(A){var O=A-l,N=A-u,z=e-O;return m?e1(z,n-N):z}function F(A){var O=A-l,N=A-u;return l===void 0||O>=e||O<0||m&&N>=n}function R(){var A=Gc();if(F(A))return _(A);a=setTimeout(R,P(A))}function _(A){return a=void 0,v&&r?b(A):(r=s=void 0,o)}function C(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function S(){return a===void 0?o:_(Gc())}function E(){var A=Gc(),O=F(A);if(r=arguments,s=this,l=A,O){if(a===void 0)return k(l);if(m)return clearTimeout(a),a=setTimeout(R,e),b(l)}return a===void 0&&(a=setTimeout(R,e)),o}return E.cancel=C,E.flush=S,E}kf.exports=t1});var Af=xe((xC,_f)=>{var i1=Kc(),r1=Do(),s1="Expected a function";function n1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(s1);return r1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),i1(i,e,{leading:r,maxWait:e,trailing:s})}_f.exports=n1});var Pf=xe((kC,Cf)=>{Cf.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,u,f,m,v){var b=r(o);b.length&&s(o,b,[a,l,u,f,m,v])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var u=this._fns[o],f=0,m=u?u.length:0;for(f;f<m;f++)u[f]!==a&&l.push(u[f])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],u=Object.keys(t),f=0,m=u.length;for(f;f<m;f++){var v=u[f];if(v==="*"&&(o=o.concat(t[v])),l.length===2&&l[0]===v){o=o.concat(t[v]);break}}return o}function s(n,o,a){var l=0,u=o.length;for(l;l<u&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var No=xe((FC,Rf)=>{"use strict";Rf.exports=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=Math.abs(e);if(t&&(r=-r),r===0)return"0 B";let s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),o=Number(r/1024**n),a=s[n];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${a}`}});var If=xe((OC,Lf)=>{"use strict";function Mf(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}Mf.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};Lf.exports=function(i,e,t){var r=new Mf(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var Nf=xe((RC,Df)=>{var l1=If(),c1=/[\/\+\.]/;Df.exports=function(i,e){function t(r){var s=l1(r,i,c1);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var ut=xe((j5,qo)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof qo<"u"&&qo.exports?(e.default=e,qo.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Zf=xe((C2,ih)=>{"use strict";var D1=Object.prototype.hasOwnProperty,dt="~";function Xs(){}Object.create&&(Xs.prototype=Object.create(null),new Xs().__proto__||(dt=!1));function N1(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function Yf(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new N1(t,r||i,s),o=dt?dt+e:e;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function Zo(i,e){--i._eventsCount===0?i._events=new Xs:delete i._events[e]}function et(){this._events=new Xs,this._eventsCount=0}et.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)D1.call(t,r)&&e.push(dt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};et.prototype.listeners=function(e){var t=dt?dt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s<n;s++)o[s]=r[s].fn;return o};et.prototype.listenerCount=function(e){var t=dt?dt+e:e,r=this._events[t];return r?r.fn?1:r.length:0};et.prototype.emit=function(e,t,r,s,n,o){var a=dt?dt+e:e;if(!this._events[a])return!1;var l=this._events[a],u=arguments.length,f,m;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(m=1,f=new Array(u-1);m<u;m++)f[m-1]=arguments[m];l.fn.apply(l.context,f)}else{var v=l.length,b;for(m=0;m<v;m++)switch(l[m].once&&this.removeListener(e,l[m].fn,void 0,!0),u){case 1:l[m].fn.call(l[m].context);break;case 2:l[m].fn.call(l[m].context,t);break;case 3:l[m].fn.call(l[m].context,t,r);break;case 4:l[m].fn.call(l[m].context,t,r,s);break;default:if(!f)for(b=1,f=new Array(u-1);b<u;b++)f[b-1]=arguments[b];l[m].fn.apply(l[m].context,f)}}return!0};et.prototype.on=function(e,t,r){return Yf(this,e,t,r,!1)};et.prototype.once=function(e,t,r){return Yf(this,e,t,r,!0)};et.prototype.removeListener=function(e,t,r,s){var n=dt?dt+e:e;if(!this._events[n])return this;if(!t)return Zo(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&Zo(this,n);else{for(var a=0,l=[],u=o.length;a<u;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:Zo(this,n)}return this};et.prototype.removeAllListeners=function(e){var t;return e?(t=dt?dt+e:e,this._events[t]&&Zo(this,t)):(this._events=new Xs,this._eventsCount=0),this};et.prototype.off=et.prototype.removeListener;et.prototype.addListener=et.prototype.on;et.prefixed=dt;et.EventEmitter=et;typeof ih<"u"&&(ih.exports=et)});var bg=xe((eu,tu)=>{(function(i,e){typeof eu=="object"&&typeof tu<"u"?tu.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(eu,function(){"use strict";function i(g,h){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(g);h&&(d=d.filter(function(x){return Object.getOwnPropertyDescriptor(g,x).enumerable})),p.push.apply(p,d)}return p}function e(g){for(var h=1;h<arguments.length;h++){var p=arguments[h]!=null?arguments[h]:{};h%2?i(Object(p),!0).forEach(function(d){l(g,d,p[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(p)):i(Object(p)).forEach(function(d){Object.defineProperty(g,d,Object.getOwnPropertyDescriptor(p,d))})}return g}function t(g,h){if(typeof g!="object"||!g)return g;var p=g[Symbol.toPrimitive];if(p!==void 0){var d=p.call(g,h||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(g)}function r(g){var h=t(g,"string");return typeof h=="symbol"?h:h+""}function s(g){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},s(g)}function n(g,h){if(!(g instanceof h))throw new TypeError("Cannot call a class as a function")}function o(g,h){for(var p=0;p<h.length;p++){var d=h[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(g,r(d.key),d)}}function a(g,h,p){return h&&o(g.prototype,h),p&&o(g,p),Object.defineProperty(g,"prototype",{writable:!1}),g}function l(g,h,p){return h=r(h),h in g?Object.defineProperty(g,h,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[h]=p,g}function u(g){return f(g)||m(g)||v(g)||k()}function f(g){if(Array.isArray(g))return b(g)}function m(g){if(typeof Symbol<"u"&&g[Symbol.iterator]!=null||g["@@iterator"]!=null)return Array.from(g)}function v(g,h){if(g){if(typeof g=="string")return b(g,h);var p=Object.prototype.toString.call(g).slice(8,-1);if(p==="Object"&&g.constructor&&(p=g.constructor.name),p==="Map"||p==="Set")return Array.from(g);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return b(g,h)}}function b(g,h){(h==null||h>g.length)&&(h=g.length);for(var p=0,d=new Array(h);p<h;p++)d[p]=g[p];return d}function k(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var P=typeof window<"u"&&typeof window.document<"u",F=P?window:{},R=P&&F.document.documentElement?"ontouchstart"in F.document.documentElement:!1,_=P?"PointerEvent"in F:!1,C="cropper",S="all",E="crop",A="move",O="zoom",N="e",z="w",$="s",j="n",X="ne",te="nw",ie="se",je="sw",ge="".concat(C,"-crop"),De="".concat(C,"-disabled"),de="".concat(C,"-hidden"),tt="".concat(C,"-hide"),At="".concat(C,"-invisible"),re="".concat(C,"-modal"),ft="".concat(C,"-move"),se="".concat(C,"Action"),Ke="".concat(C,"Preview"),Q="crop",it="move",Ct="none",be="crop",Zt="cropend",li="cropmove",Qt="cropstart",qi="dblclick",Bt=R?"touchstart":"mousedown",Ai=R?"touchmove":"mousemove",Ut=R?"touchend touchcancel":"mouseup",ci=_?"pointerdown":Bt,hi=_?"pointermove":Ai,zt=_?"pointerup pointercancel":Ut,ui="ready",rt="resize",Jt="wheel",di="zoom",$i="image/jpeg",pi=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,ei=/^data:/,Ht=/^data:image\/jpeg;base64,/,st=/^img|canvas$/i,fi=200,Jr=100,es={viewMode:0,dragMode:Q,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:fi,minContainerHeight:Jr,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ts='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',Tn=Number.isNaN||F.isNaN;function Y(g){return typeof g=="number"&&!Tn(g)}var Vi=function(h){return h>0&&h<1/0};function Et(g){return typeof g>"u"}function mt(g){return s(g)==="object"&&g!==null}var is=Object.prototype.hasOwnProperty;function ti(g){if(!mt(g))return!1;try{var h=g.constructor,p=h.prototype;return h&&p&&is.call(p,"isPrototypeOf")}catch{return!1}}function Qe(g){return typeof g=="function"}var wr=Array.prototype.slice;function Wi(g){return Array.from?Array.from(g):wr.call(g)}function Se(g,h){return g&&Qe(h)&&(Array.isArray(g)||Y(g.length)?Wi(g).forEach(function(p,d){h.call(g,p,d,g)}):mt(g)&&Object.keys(g).forEach(function(p){h.call(g,g[p],p,g)})),g}var ne=Object.assign||function(h){for(var p=arguments.length,d=new Array(p>1?p-1:0),x=1;x<p;x++)d[x-1]=arguments[x];return mt(h)&&d.length>0&&d.forEach(function(y){mt(y)&&Object.keys(y).forEach(function(T){h[T]=y[T]})}),h},za=/\.\d*(?:0|9){12}\d*$/;function Ci(g){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return za.test(g)?Math.round(g*h)/h:g}var Ae=/^width|height|left|top|marginLeft|marginTop$/;function nt(g,h){var p=g.style;Se(h,function(d,x){Ae.test(x)&&Y(d)&&(d="".concat(d,"px")),p[x]=d})}function Ha(g,h){return g.classList?g.classList.contains(h):g.className.indexOf(h)>-1}function Ce(g,h){if(h){if(Y(g.length)){Se(g,function(d){Ce(d,h)});return}if(g.classList){g.classList.add(h);return}var p=g.className.trim();p?p.indexOf(h)<0&&(g.className="".concat(p," ").concat(h)):g.className=h}}function gt(g,h){if(h){if(Y(g.length)){Se(g,function(p){gt(p,h)});return}if(g.classList){g.classList.remove(h);return}g.className.indexOf(h)>=0&&(g.className=g.className.replace(h,""))}}function mi(g,h,p){if(h){if(Y(g.length)){Se(g,function(d){mi(d,h,p)});return}p?Ce(g,h):gt(g,h)}}var xn=/([a-z\d])([A-Z])/g;function rs(g){return g.replace(xn,"$1-$2").toLowerCase()}function bt(g,h){return mt(g[h])?g[h]:g.dataset?g.dataset[h]:g.getAttribute("data-".concat(rs(h)))}function Tt(g,h,p){mt(p)?g[h]=p:g.dataset?g.dataset[h]=p:g.setAttribute("data-".concat(rs(h)),p)}function kn(g,h){if(mt(g[h]))try{delete g[h]}catch{g[h]=void 0}else if(g.dataset)try{delete g.dataset[h]}catch{g.dataset[h]=void 0}else g.removeAttribute("data-".concat(rs(h)))}var ss=/\s\s*/,Sr=function(){var g=!1;if(P){var h=!1,p=function(){},d=Object.defineProperty({},"once",{get:function(){return g=!0,h},set:function(y){h=y}});F.addEventListener("test",p,d),F.removeEventListener("test",p,d)}return g}();function yt(g,h,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=p;h.trim().split(ss).forEach(function(y){if(!Sr){var T=g.listeners;T&&T[y]&&T[y][p]&&(x=T[y][p],delete T[y][p],Object.keys(T[y]).length===0&&delete T[y],Object.keys(T).length===0&&delete g.listeners)}g.removeEventListener(y,x,d)})}function Ee(g,h,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=p;h.trim().split(ss).forEach(function(y){if(d.once&&!Sr){var T=g.listeners,M=T===void 0?{}:T;x=function(){delete M[y][p],g.removeEventListener(y,x,d);for(var D=arguments.length,L=new Array(D),I=0;I<D;I++)L[I]=arguments[I];p.apply(g,L)},M[y]||(M[y]={}),M[y][p]&&g.removeEventListener(y,M[y][p],d),M[y][p]=x,g.listeners=M}g.addEventListener(y,x,d)})}function gi(g,h,p){var d;return Qe(Event)&&Qe(CustomEvent)?d=new CustomEvent(h,{detail:p,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(h,!0,!0,p)),g.dispatchEvent(d)}function ns(g){var h=g.getBoundingClientRect();return{left:h.left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)}}var Er=F.location,_n=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function An(g){var h=g.match(_n);return h!==null&&(h[1]!==Er.protocol||h[2]!==Er.hostname||h[3]!==Er.port)}function G(g){var h="timestamp=".concat(new Date().getTime());return g+(g.indexOf("?")===-1?"?":"&")+h}function w(g){var h=g.rotate,p=g.scaleX,d=g.scaleY,x=g.translateX,y=g.translateY,T=[];Y(x)&&x!==0&&T.push("translateX(".concat(x,"px)")),Y(y)&&y!==0&&T.push("translateY(".concat(y,"px)")),Y(h)&&h!==0&&T.push("rotate(".concat(h,"deg)")),Y(p)&&p!==1&&T.push("scaleX(".concat(p,")")),Y(d)&&d!==1&&T.push("scaleY(".concat(d,")"));var M=T.length?T.join(" "):"none";return{WebkitTransform:M,msTransform:M,transform:M}}function U(g){var h=e({},g),p=0;return Se(g,function(d,x){delete h[x],Se(h,function(y){var T=Math.abs(d.startX-y.startX),M=Math.abs(d.startY-y.startY),H=Math.abs(d.endX-y.endX),D=Math.abs(d.endY-y.endY),L=Math.sqrt(T*T+M*M),I=Math.sqrt(H*H+D*D),B=(I-L)/L;Math.abs(B)>Math.abs(p)&&(p=B)})}),p}function W(g,h){var p=g.pageX,d=g.pageY,x={endX:p,endY:d};return h?x:e({startX:p,startY:d},x)}function ue(g){var h=0,p=0,d=0;return Se(g,function(x){var y=x.startX,T=x.startY;h+=y,p+=T,d+=1}),h/=d,p/=d,{pageX:h,pageY:p}}function pe(g){var h=g.aspectRatio,p=g.height,d=g.width,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",y=Vi(d),T=Vi(p);if(y&&T){var M=p*h;x==="contain"&&M>d||x==="cover"&&M<d?p=d/h:d=p*h}else y?p=d/h:T&&(d=p*h);return{width:d,height:p}}function Te(g){var h=g.width,p=g.height,d=g.degree;if(d=Math.abs(d)%180,d===90)return{width:p,height:h};var x=d%90*Math.PI/180,y=Math.sin(x),T=Math.cos(x),M=h*T+p*y,H=h*y+p*T;return d>90?{width:H,height:M}:{width:M,height:H}}function Je(g,h,p,d){var x=h.aspectRatio,y=h.naturalWidth,T=h.naturalHeight,M=h.rotate,H=M===void 0?0:M,D=h.scaleX,L=D===void 0?1:D,I=h.scaleY,B=I===void 0?1:I,ee=p.aspectRatio,J=p.naturalWidth,fe=p.naturalHeight,oe=d.fillColor,Be=oe===void 0?"transparent":oe,qe=d.imageSmoothingEnabled,Oe=qe===void 0?!0:qe,bi=d.imageSmoothingQuality,xt=bi===void 0?"low":bi,q=d.maxWidth,ae=q===void 0?1/0:q,Ue=d.maxHeight,Ft=Ue===void 0?1/0:Ue,yi=d.minWidth,Gi=yi===void 0?0:yi,Ki=d.minHeight,Fi=Ki===void 0?0:Ki,ii=document.createElement("canvas"),vt=ii.getContext("2d"),Xi=pe({aspectRatio:ee,width:ae,height:Ft}),Fn=pe({aspectRatio:ee,width:Gi,height:Fi},"cover"),ja=Math.min(Xi.width,Math.max(Fn.width,J)),qa=Math.min(Xi.height,Math.max(Fn.height,fe)),uu=pe({aspectRatio:x,width:ae,height:Ft}),du=pe({aspectRatio:x,width:Gi,height:Fi},"cover"),pu=Math.min(uu.width,Math.max(du.width,y)),fu=Math.min(uu.height,Math.max(du.height,T)),$g=[-pu/2,-fu/2,pu,fu];return ii.width=Ci(ja),ii.height=Ci(qa),vt.fillStyle=Be,vt.fillRect(0,0,ja,qa),vt.save(),vt.translate(ja/2,qa/2),vt.rotate(H*Math.PI/180),vt.scale(L,B),vt.imageSmoothingEnabled=Oe,vt.imageSmoothingQuality=xt,vt.drawImage.apply(vt,[g].concat(u($g.map(function(Vg){return Math.floor(Ci(Vg))})))),vt.restore(),ii}var Pt=String.fromCharCode;function Pi(g,h,p){var d="";p+=h;for(var x=h;x<p;x+=1)d+=Pt(g.getUint8(x));return d}var os=/^data:.*,/;function Ne(g){var h=g.replace(os,""),p=atob(h),d=new ArrayBuffer(p.length),x=new Uint8Array(d);return Se(x,function(y,T){x[T]=p.charCodeAt(T)}),d}function Cn(g,h){for(var p=[],d=8192,x=new Uint8Array(g);x.length>0;)p.push(Pt.apply(null,Wi(x.subarray(0,d)))),x=x.subarray(d);return"data:".concat(h,";base64,").concat(btoa(p.join("")))}function Pn(g){var h=new DataView(g),p;try{var d,x,y;if(h.getUint8(0)===255&&h.getUint8(1)===216)for(var T=h.byteLength,M=2;M+1<T;){if(h.getUint8(M)===255&&h.getUint8(M+1)===225){x=M;break}M+=1}if(x){var H=x+4,D=x+10;if(Pi(h,H,4)==="Exif"){var L=h.getUint16(D);if(d=L===18761,(d||L===19789)&&h.getUint16(D+2,d)===42){var I=h.getUint32(D+4,d);I>=8&&(y=D+I)}}}if(y){var B=h.getUint16(y,d),ee,J;for(J=0;J<B;J+=1)if(ee=y+J*12+2,h.getUint16(ee,d)===274){ee+=8,p=h.getUint16(ee,d),h.setUint16(ee,1,d);break}}}catch{p=1}return p}function Dg(g){var h=0,p=1,d=1;switch(g){case 2:p=-1;break;case 3:h=-180;break;case 4:d=-1;break;case 5:h=90,d=-1;break;case 6:h=90;break;case 7:h=90,p=-1;break;case 8:h=-90;break}return{rotate:h,scaleX:p,scaleY:d}}var Ng={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var h=this.element,p=this.options,d=this.container,x=this.cropper,y=Number(p.minContainerWidth),T=Number(p.minContainerHeight);Ce(x,de),gt(h,de);var M={width:Math.max(d.offsetWidth,y>=0?y:fi),height:Math.max(d.offsetHeight,T>=0?T:Jr)};this.containerData=M,nt(x,{width:M.width,height:M.height}),Ce(h,de),gt(x,de)},initCanvas:function(){var h=this.containerData,p=this.imageData,d=this.options.viewMode,x=Math.abs(p.rotate)%180===90,y=x?p.naturalHeight:p.naturalWidth,T=x?p.naturalWidth:p.naturalHeight,M=y/T,H=h.width,D=h.height;h.height*M>h.width?d===3?H=h.height*M:D=h.width/M:d===3?D=h.width/M:H=h.height*M;var L={aspectRatio:M,naturalWidth:y,naturalHeight:T,width:H,height:D};this.canvasData=L,this.limited=d===1||d===2,this.limitCanvas(!0,!0),L.width=Math.min(Math.max(L.width,L.minWidth),L.maxWidth),L.height=Math.min(Math.max(L.height,L.minHeight),L.maxHeight),L.left=(h.width-L.width)/2,L.top=(h.height-L.height)/2,L.oldLeft=L.left,L.oldTop=L.top,this.initialCanvasData=ne({},L)},limitCanvas:function(h,p){var d=this.options,x=this.containerData,y=this.canvasData,T=this.cropBoxData,M=d.viewMode,H=y.aspectRatio,D=this.cropped&&T;if(h){var L=Number(d.minCanvasWidth)||0,I=Number(d.minCanvasHeight)||0;M>1?(L=Math.max(L,x.width),I=Math.max(I,x.height),M===3&&(I*H>L?L=I*H:I=L/H)):M>0&&(L?L=Math.max(L,D?T.width:0):I?I=Math.max(I,D?T.height:0):D&&(L=T.width,I=T.height,I*H>L?L=I*H:I=L/H));var B=pe({aspectRatio:H,width:L,height:I});L=B.width,I=B.height,y.minWidth=L,y.minHeight=I,y.maxWidth=1/0,y.maxHeight=1/0}if(p)if(M>(D?0:1)){var ee=x.width-y.width,J=x.height-y.height;y.minLeft=Math.min(0,ee),y.minTop=Math.min(0,J),y.maxLeft=Math.max(0,ee),y.maxTop=Math.max(0,J),D&&this.limited&&(y.minLeft=Math.min(T.left,T.left+(T.width-y.width)),y.minTop=Math.min(T.top,T.top+(T.height-y.height)),y.maxLeft=T.left,y.maxTop=T.top,M===2&&(y.width>=x.width&&(y.minLeft=Math.min(0,ee),y.maxLeft=Math.max(0,ee)),y.height>=x.height&&(y.minTop=Math.min(0,J),y.maxTop=Math.max(0,J))))}else y.minLeft=-y.width,y.minTop=-y.height,y.maxLeft=x.width,y.maxTop=x.height},renderCanvas:function(h,p){var d=this.canvasData,x=this.imageData;if(p){var y=Te({width:x.naturalWidth*Math.abs(x.scaleX||1),height:x.naturalHeight*Math.abs(x.scaleY||1),degree:x.rotate||0}),T=y.width,M=y.height,H=d.width*(T/d.naturalWidth),D=d.height*(M/d.naturalHeight);d.left-=(H-d.width)/2,d.top-=(D-d.height)/2,d.width=H,d.height=D,d.aspectRatio=T/M,d.naturalWidth=T,d.naturalHeight=M,this.limitCanvas(!0,!1)}(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCanvas(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,nt(this.canvas,ne({width:d.width,height:d.height},w({translateX:d.left,translateY:d.top}))),this.renderImage(h),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(h){var p=this.canvasData,d=this.imageData,x=d.naturalWidth*(p.width/p.naturalWidth),y=d.naturalHeight*(p.height/p.naturalHeight);ne(d,{width:x,height:y,left:(p.width-x)/2,top:(p.height-y)/2}),nt(this.image,ne({width:d.width,height:d.height},w(ne({translateX:d.left,translateY:d.top},d)))),h&&this.output()},initCropBox:function(){var h=this.options,p=this.canvasData,d=h.aspectRatio||h.initialAspectRatio,x=Number(h.autoCropArea)||.8,y={width:p.width,height:p.height};d&&(p.height*d>p.width?y.height=y.width/d:y.width=y.height*d),this.cropBoxData=y,this.limitCropBox(!0,!0),y.width=Math.min(Math.max(y.width,y.minWidth),y.maxWidth),y.height=Math.min(Math.max(y.height,y.minHeight),y.maxHeight),y.width=Math.max(y.minWidth,y.width*x),y.height=Math.max(y.minHeight,y.height*x),y.left=p.left+(p.width-y.width)/2,y.top=p.top+(p.height-y.height)/2,y.oldLeft=y.left,y.oldTop=y.top,this.initialCropBoxData=ne({},y)},limitCropBox:function(h,p){var d=this.options,x=this.containerData,y=this.canvasData,T=this.cropBoxData,M=this.limited,H=d.aspectRatio;if(h){var D=Number(d.minCropBoxWidth)||0,L=Number(d.minCropBoxHeight)||0,I=M?Math.min(x.width,y.width,y.width+y.left,x.width-y.left):x.width,B=M?Math.min(x.height,y.height,y.height+y.top,x.height-y.top):x.height;D=Math.min(D,x.width),L=Math.min(L,x.height),H&&(D&&L?L*H>D?L=D/H:D=L*H:D?L=D/H:L&&(D=L*H),B*H>I?B=I/H:I=B*H),T.minWidth=Math.min(D,I),T.minHeight=Math.min(L,B),T.maxWidth=I,T.maxHeight=B}p&&(M?(T.minLeft=Math.max(0,y.left),T.minTop=Math.max(0,y.top),T.maxLeft=Math.min(x.width,y.left+y.width)-T.width,T.maxTop=Math.min(x.height,y.top+y.height)-T.height):(T.minLeft=0,T.minTop=0,T.maxLeft=x.width-T.width,T.maxTop=x.height-T.height))},renderCropBox:function(){var h=this.options,p=this.containerData,d=this.cropBoxData;(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCropBox(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,h.movable&&h.cropBoxMovable&&Tt(this.face,se,d.width>=p.width&&d.height>=p.height?A:S),nt(this.cropBox,ne({width:d.width,height:d.height},w({translateX:d.left,translateY:d.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),gi(this.element,be,this.getData())}},Bg={initPreview:function(){var h=this.element,p=this.crossOrigin,d=this.options.preview,x=p?this.crossOriginUrl:this.url,y=h.alt||"The image to preview",T=document.createElement("img");if(p&&(T.crossOrigin=p),T.src=x,T.alt=y,this.viewBox.appendChild(T),this.viewBoxImage=T,!!d){var M=d;typeof d=="string"?M=h.ownerDocument.querySelectorAll(d):d.querySelector&&(M=[d]),this.previews=M,Se(M,function(H){var D=document.createElement("img");Tt(H,Ke,{width:H.offsetWidth,height:H.offsetHeight,html:H.innerHTML}),p&&(D.crossOrigin=p),D.src=x,D.alt=y,D.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',H.innerHTML="",H.appendChild(D)})}},resetPreview:function(){Se(this.previews,function(h){var p=bt(h,Ke);nt(h,{width:p.width,height:p.height}),h.innerHTML=p.html,kn(h,Ke)})},preview:function(){var h=this.imageData,p=this.canvasData,d=this.cropBoxData,x=d.width,y=d.height,T=h.width,M=h.height,H=d.left-p.left-h.left,D=d.top-p.top-h.top;!this.cropped||this.disabled||(nt(this.viewBoxImage,ne({width:T,height:M},w(ne({translateX:-H,translateY:-D},h)))),Se(this.previews,function(L){var I=bt(L,Ke),B=I.width,ee=I.height,J=B,fe=ee,oe=1;x&&(oe=B/x,fe=y*oe),y&&fe>ee&&(oe=ee/y,J=x*oe,fe=ee),nt(L,{width:J,height:fe}),nt(L.getElementsByTagName("img")[0],ne({width:T*oe,height:M*oe},w(ne({translateX:-H*oe,translateY:-D*oe},h))))}))}},Ug={bind:function(){var h=this.element,p=this.options,d=this.cropper;Qe(p.cropstart)&&Ee(h,Qt,p.cropstart),Qe(p.cropmove)&&Ee(h,li,p.cropmove),Qe(p.cropend)&&Ee(h,Zt,p.cropend),Qe(p.crop)&&Ee(h,be,p.crop),Qe(p.zoom)&&Ee(h,di,p.zoom),Ee(d,ci,this.onCropStart=this.cropStart.bind(this)),p.zoomable&&p.zoomOnWheel&&Ee(d,Jt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&Ee(d,qi,this.onDblclick=this.dblclick.bind(this)),Ee(h.ownerDocument,hi,this.onCropMove=this.cropMove.bind(this)),Ee(h.ownerDocument,zt,this.onCropEnd=this.cropEnd.bind(this)),p.responsive&&Ee(window,rt,this.onResize=this.resize.bind(this))},unbind:function(){var h=this.element,p=this.options,d=this.cropper;Qe(p.cropstart)&&yt(h,Qt,p.cropstart),Qe(p.cropmove)&&yt(h,li,p.cropmove),Qe(p.cropend)&&yt(h,Zt,p.cropend),Qe(p.crop)&&yt(h,be,p.crop),Qe(p.zoom)&&yt(h,di,p.zoom),yt(d,ci,this.onCropStart),p.zoomable&&p.zoomOnWheel&&yt(d,Jt,this.onWheel,{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&yt(d,qi,this.onDblclick),yt(h.ownerDocument,hi,this.onCropMove),yt(h.ownerDocument,zt,this.onCropEnd),p.responsive&&yt(window,rt,this.onResize)}},zg={resize:function(){if(!this.disabled){var h=this.options,p=this.container,d=this.containerData,x=p.offsetWidth/d.width,y=p.offsetHeight/d.height,T=Math.abs(x-1)>Math.abs(y-1)?x:y;if(T!==1){var M,H;h.restore&&(M=this.getCanvasData(),H=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(Se(M,function(D,L){M[L]=D*T})),this.setCropBoxData(Se(H,function(D,L){H[L]=D*T})))}}},dblclick:function(){this.disabled||this.options.dragMode===Ct||this.setDragMode(Ha(this.dragBox,ge)?it:Q)},wheel:function(h){var p=this,d=Number(this.options.wheelZoomRatio)||.1,x=1;this.disabled||(h.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){p.wheeling=!1},50),h.deltaY?x=h.deltaY>0?1:-1:h.wheelDelta?x=-h.wheelDelta/120:h.detail&&(x=h.detail>0?1:-1),this.zoom(-x*d,h)))},cropStart:function(h){var p=h.buttons,d=h.button;if(!(this.disabled||(h.type==="mousedown"||h.type==="pointerdown"&&h.pointerType==="mouse")&&(Y(p)&&p!==1||Y(d)&&d!==0||h.ctrlKey))){var x=this.options,y=this.pointers,T;h.changedTouches?Se(h.changedTouches,function(M){y[M.identifier]=W(M)}):y[h.pointerId||0]=W(h),Object.keys(y).length>1&&x.zoomable&&x.zoomOnTouch?T=O:T=bt(h.target,se),pi.test(T)&&gi(this.element,Qt,{originalEvent:h,action:T})!==!1&&(h.preventDefault(),this.action=T,this.cropping=!1,T===E&&(this.cropping=!0,Ce(this.dragBox,re)))}},cropMove:function(h){var p=this.action;if(!(this.disabled||!p)){var d=this.pointers;h.preventDefault(),gi(this.element,li,{originalEvent:h,action:p})!==!1&&(h.changedTouches?Se(h.changedTouches,function(x){ne(d[x.identifier]||{},W(x,!0))}):ne(d[h.pointerId||0]||{},W(h,!0)),this.change(h))}},cropEnd:function(h){if(!this.disabled){var p=this.action,d=this.pointers;h.changedTouches?Se(h.changedTouches,function(x){delete d[x.identifier]}):delete d[h.pointerId||0],p&&(h.preventDefault(),Object.keys(d).length||(this.action=""),this.cropping&&(this.cropping=!1,mi(this.dragBox,re,this.cropped&&this.options.modal)),gi(this.element,Zt,{originalEvent:h,action:p}))}}},Hg={change:function(h){var p=this.options,d=this.canvasData,x=this.containerData,y=this.cropBoxData,T=this.pointers,M=this.action,H=p.aspectRatio,D=y.left,L=y.top,I=y.width,B=y.height,ee=D+I,J=L+B,fe=0,oe=0,Be=x.width,qe=x.height,Oe=!0,bi;!H&&h.shiftKey&&(H=I&&B?I/B:1),this.limited&&(fe=y.minLeft,oe=y.minTop,Be=fe+Math.min(x.width,d.width,d.left+d.width),qe=oe+Math.min(x.height,d.height,d.top+d.height));var xt=T[Object.keys(T)[0]],q={x:xt.endX-xt.startX,y:xt.endY-xt.startY},ae=function(Ft){switch(Ft){case N:ee+q.x>Be&&(q.x=Be-ee);break;case z:D+q.x<fe&&(q.x=fe-D);break;case j:L+q.y<oe&&(q.y=oe-L);break;case $:J+q.y>qe&&(q.y=qe-J);break}};switch(M){case S:D+=q.x,L+=q.y;break;case N:if(q.x>=0&&(ee>=Be||H&&(L<=oe||J>=qe))){Oe=!1;break}ae(N),I+=q.x,I<0&&(M=z,I=-I,D-=I),H&&(B=I/H,L+=(y.height-B)/2);break;case j:if(q.y<=0&&(L<=oe||H&&(D<=fe||ee>=Be))){Oe=!1;break}ae(j),B-=q.y,L+=q.y,B<0&&(M=$,B=-B,L-=B),H&&(I=B*H,D+=(y.width-I)/2);break;case z:if(q.x<=0&&(D<=fe||H&&(L<=oe||J>=qe))){Oe=!1;break}ae(z),I-=q.x,D+=q.x,I<0&&(M=N,I=-I,D-=I),H&&(B=I/H,L+=(y.height-B)/2);break;case $:if(q.y>=0&&(J>=qe||H&&(D<=fe||ee>=Be))){Oe=!1;break}ae($),B+=q.y,B<0&&(M=j,B=-B,L-=B),H&&(I=B*H,D+=(y.width-I)/2);break;case X:if(H){if(q.y<=0&&(L<=oe||ee>=Be)){Oe=!1;break}ae(j),B-=q.y,L+=q.y,I=B*H}else ae(j),ae(N),q.x>=0?ee<Be?I+=q.x:q.y<=0&&L<=oe&&(Oe=!1):I+=q.x,q.y<=0?L>oe&&(B-=q.y,L+=q.y):(B-=q.y,L+=q.y);I<0&&B<0?(M=je,B=-B,I=-I,L-=B,D-=I):I<0?(M=te,I=-I,D-=I):B<0&&(M=ie,B=-B,L-=B);break;case te:if(H){if(q.y<=0&&(L<=oe||D<=fe)){Oe=!1;break}ae(j),B-=q.y,L+=q.y,I=B*H,D+=y.width-I}else ae(j),ae(z),q.x<=0?D>fe?(I-=q.x,D+=q.x):q.y<=0&&L<=oe&&(Oe=!1):(I-=q.x,D+=q.x),q.y<=0?L>oe&&(B-=q.y,L+=q.y):(B-=q.y,L+=q.y);I<0&&B<0?(M=ie,B=-B,I=-I,L-=B,D-=I):I<0?(M=X,I=-I,D-=I):B<0&&(M=je,B=-B,L-=B);break;case je:if(H){if(q.x<=0&&(D<=fe||J>=qe)){Oe=!1;break}ae(z),I-=q.x,D+=q.x,B=I/H}else ae($),ae(z),q.x<=0?D>fe?(I-=q.x,D+=q.x):q.y>=0&&J>=qe&&(Oe=!1):(I-=q.x,D+=q.x),q.y>=0?J<qe&&(B+=q.y):B+=q.y;I<0&&B<0?(M=X,B=-B,I=-I,L-=B,D-=I):I<0?(M=ie,I=-I,D-=I):B<0&&(M=te,B=-B,L-=B);break;case ie:if(H){if(q.x>=0&&(ee>=Be||J>=qe)){Oe=!1;break}ae(N),I+=q.x,B=I/H}else ae($),ae(N),q.x>=0?ee<Be?I+=q.x:q.y>=0&&J>=qe&&(Oe=!1):I+=q.x,q.y>=0?J<qe&&(B+=q.y):B+=q.y;I<0&&B<0?(M=te,B=-B,I=-I,L-=B,D-=I):I<0?(M=je,I=-I,D-=I):B<0&&(M=X,B=-B,L-=B);break;case A:this.move(q.x,q.y),Oe=!1;break;case O:this.zoom(U(T),h),Oe=!1;break;case E:if(!q.x||!q.y){Oe=!1;break}bi=ns(this.cropper),D=xt.startX-bi.left,L=xt.startY-bi.top,I=y.minWidth,B=y.minHeight,q.x>0?M=q.y>0?ie:X:q.x<0&&(D-=I,M=q.y>0?je:te),q.y<0&&(L-=B),this.cropped||(gt(this.cropBox,de),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Oe&&(y.width=I,y.height=B,y.left=D,y.top=L,this.action=M,this.renderCropBox()),Se(T,function(Ue){Ue.startX=Ue.endX,Ue.startY=Ue.endY})}},jg={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ce(this.dragBox,re),gt(this.cropBox,de),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=ne({},this.initialImageData),this.canvasData=ne({},this.initialCanvasData),this.cropBoxData=ne({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(ne(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),gt(this.dragBox,re),Ce(this.cropBox,de)),this},replace:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&h&&(this.isImg&&(this.element.src=h),p?(this.url=h,this.image.src=h,this.ready&&(this.viewBoxImage.src=h,Se(this.previews,function(d){d.getElementsByTagName("img")[0].src=h}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(h))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,gt(this.cropper,De)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ce(this.cropper,De)),this},destroy:function(){var h=this.element;return h[C]?(h[C]=void 0,this.isImg&&this.replaced&&(h.src=this.originalUrl),this.uncreate(),this):this},move:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,d=this.canvasData,x=d.left,y=d.top;return this.moveTo(Et(h)?h:x+Number(h),Et(p)?p:y+Number(p))},moveTo:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,d=this.canvasData,x=!1;return h=Number(h),p=Number(p),this.ready&&!this.disabled&&this.options.movable&&(Y(h)&&(d.left=h,x=!0),Y(p)&&(d.top=p,x=!0),x&&this.renderCanvas(!0)),this},zoom:function(h,p){var d=this.canvasData;return h=Number(h),h<0?h=1/(1-h):h=1+h,this.zoomTo(d.width*h/d.naturalWidth,null,p)},zoomTo:function(h,p,d){var x=this.options,y=this.canvasData,T=y.width,M=y.height,H=y.naturalWidth,D=y.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&x.zoomable){var L=H*h,I=D*h;if(gi(this.element,di,{ratio:h,oldRatio:T/H,originalEvent:d})===!1)return this;if(d){var B=this.pointers,ee=ns(this.cropper),J=B&&Object.keys(B).length?ue(B):{pageX:d.pageX,pageY:d.pageY};y.left-=(L-T)*((J.pageX-ee.left-y.left)/T),y.top-=(I-M)*((J.pageY-ee.top-y.top)/M)}else ti(p)&&Y(p.x)&&Y(p.y)?(y.left-=(L-T)*((p.x-y.left)/T),y.top-=(I-M)*((p.y-y.top)/M)):(y.left-=(L-T)/2,y.top-=(I-M)/2);y.width=L,y.height=I,this.renderCanvas(!0)}return this},rotate:function(h){return this.rotateTo((this.imageData.rotate||0)+Number(h))},rotateTo:function(h){return h=Number(h),Y(h)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=h%360,this.renderCanvas(!0,!0)),this},scaleX:function(h){var p=this.imageData.scaleY;return this.scale(h,Y(p)?p:1)},scaleY:function(h){var p=this.imageData.scaleX;return this.scale(Y(p)?p:1,h)},scale:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,d=this.imageData,x=!1;return h=Number(h),p=Number(p),this.ready&&!this.disabled&&this.options.scalable&&(Y(h)&&(d.scaleX=h,x=!0),Y(p)&&(d.scaleY=p,x=!0),x&&this.renderCanvas(!0,!0)),this},getData:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,p=this.options,d=this.imageData,x=this.canvasData,y=this.cropBoxData,T;if(this.ready&&this.cropped){T={x:y.left-x.left,y:y.top-x.top,width:y.width,height:y.height};var M=d.width/d.naturalWidth;if(Se(T,function(L,I){T[I]=L/M}),h){var H=Math.round(T.y+T.height),D=Math.round(T.x+T.width);T.x=Math.round(T.x),T.y=Math.round(T.y),T.width=D-T.x,T.height=H-T.y}}else T={x:0,y:0,width:0,height:0};return p.rotatable&&(T.rotate=d.rotate||0),p.scalable&&(T.scaleX=d.scaleX||1,T.scaleY=d.scaleY||1),T},setData:function(h){var p=this.options,d=this.imageData,x=this.canvasData,y={};if(this.ready&&!this.disabled&&ti(h)){var T=!1;p.rotatable&&Y(h.rotate)&&h.rotate!==d.rotate&&(d.rotate=h.rotate,T=!0),p.scalable&&(Y(h.scaleX)&&h.scaleX!==d.scaleX&&(d.scaleX=h.scaleX,T=!0),Y(h.scaleY)&&h.scaleY!==d.scaleY&&(d.scaleY=h.scaleY,T=!0)),T&&this.renderCanvas(!0,!0);var M=d.width/d.naturalWidth;Y(h.x)&&(y.left=h.x*M+x.left),Y(h.y)&&(y.top=h.y*M+x.top),Y(h.width)&&(y.width=h.width*M),Y(h.height)&&(y.height=h.height*M),this.setCropBoxData(y)}return this},getContainerData:function(){return this.ready?ne({},this.containerData):{}},getImageData:function(){return this.sized?ne({},this.imageData):{}},getCanvasData:function(){var h=this.canvasData,p={};return this.ready&&Se(["left","top","width","height","naturalWidth","naturalHeight"],function(d){p[d]=h[d]}),p},setCanvasData:function(h){var p=this.canvasData,d=p.aspectRatio;return this.ready&&!this.disabled&&ti(h)&&(Y(h.left)&&(p.left=h.left),Y(h.top)&&(p.top=h.top),Y(h.width)?(p.width=h.width,p.height=h.width/d):Y(h.height)&&(p.height=h.height,p.width=h.height*d),this.renderCanvas(!0)),this},getCropBoxData:function(){var h=this.cropBoxData,p;return this.ready&&this.cropped&&(p={left:h.left,top:h.top,width:h.width,height:h.height}),p||{}},setCropBoxData:function(h){var p=this.cropBoxData,d=this.options.aspectRatio,x,y;return this.ready&&this.cropped&&!this.disabled&&ti(h)&&(Y(h.left)&&(p.left=h.left),Y(h.top)&&(p.top=h.top),Y(h.width)&&h.width!==p.width&&(x=!0,p.width=h.width),Y(h.height)&&h.height!==p.height&&(y=!0,p.height=h.height),d&&(x?p.height=p.width/d:y&&(p.width=p.height*d)),this.renderCropBox()),this},getCroppedCanvas:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var p=this.canvasData,d=Je(this.image,this.imageData,p,h);if(!this.cropped)return d;var x=this.getData(h.rounded),y=x.x,T=x.y,M=x.width,H=x.height,D=d.width/Math.floor(p.naturalWidth);D!==1&&(y*=D,T*=D,M*=D,H*=D);var L=M/H,I=pe({aspectRatio:L,width:h.maxWidth||1/0,height:h.maxHeight||1/0}),B=pe({aspectRatio:L,width:h.minWidth||0,height:h.minHeight||0},"cover"),ee=pe({aspectRatio:L,width:h.width||(D!==1?d.width:M),height:h.height||(D!==1?d.height:H)}),J=ee.width,fe=ee.height;J=Math.min(I.width,Math.max(B.width,J)),fe=Math.min(I.height,Math.max(B.height,fe));var oe=document.createElement("canvas"),Be=oe.getContext("2d");oe.width=Ci(J),oe.height=Ci(fe),Be.fillStyle=h.fillColor||"transparent",Be.fillRect(0,0,J,fe);var qe=h.imageSmoothingEnabled,Oe=qe===void 0?!0:qe,bi=h.imageSmoothingQuality;Be.imageSmoothingEnabled=Oe,bi&&(Be.imageSmoothingQuality=bi);var xt=d.width,q=d.height,ae=y,Ue=T,Ft,yi,Gi,Ki,Fi,ii;ae<=-M||ae>xt?(ae=0,Ft=0,Gi=0,Fi=0):ae<=0?(Gi=-ae,ae=0,Ft=Math.min(xt,M+ae),Fi=Ft):ae<=xt&&(Gi=0,Ft=Math.min(M,xt-ae),Fi=Ft),Ft<=0||Ue<=-H||Ue>q?(Ue=0,yi=0,Ki=0,ii=0):Ue<=0?(Ki=-Ue,Ue=0,yi=Math.min(q,H+Ue),ii=yi):Ue<=q&&(Ki=0,yi=Math.min(H,q-Ue),ii=yi);var vt=[ae,Ue,Ft,yi];if(Fi>0&&ii>0){var Xi=J/M;vt.push(Gi*Xi,Ki*Xi,Fi*Xi,ii*Xi)}return Be.drawImage.apply(Be,[d].concat(u(vt.map(function(Fn){return Math.floor(Ci(Fn))})))),oe},setAspectRatio:function(h){var p=this.options;return!this.disabled&&!Et(h)&&(p.aspectRatio=Math.max(0,h)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(h){var p=this.options,d=this.dragBox,x=this.face;if(this.ready&&!this.disabled){var y=h===Q,T=p.movable&&h===it;h=y||T?h:Ct,p.dragMode=h,Tt(d,se,h),mi(d,ge,y),mi(d,ft,T),p.cropBoxMovable||(Tt(x,se,h),mi(x,ge,y),mi(x,ft,T))}return this}},qg=F.Cropper,hu=function(){function g(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,g),!h||!st.test(h.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=h,this.options=ne({},es,ti(p)&&p),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(g,[{key:"init",value:function(){var p=this.element,d=p.tagName.toLowerCase(),x;if(!p[C]){if(p[C]=this,d==="img"){if(this.isImg=!0,x=p.getAttribute("src")||"",this.originalUrl=x,!x)return;x=p.src}else d==="canvas"&&window.HTMLCanvasElement&&(x=p.toDataURL());this.load(x)}}},{key:"load",value:function(p){var d=this;if(p){this.url=p,this.imageData={};var x=this.element,y=this.options;if(!y.rotatable&&!y.scalable&&(y.checkOrientation=!1),!y.checkOrientation||!window.ArrayBuffer){this.clone();return}if(ei.test(p)){Ht.test(p)?this.read(Ne(p)):this.clone();return}var T=new XMLHttpRequest,M=this.clone.bind(this);this.reloading=!0,this.xhr=T,T.onabort=M,T.onerror=M,T.ontimeout=M,T.onprogress=function(){T.getResponseHeader("content-type")!==$i&&T.abort()},T.onload=function(){d.read(T.response)},T.onloadend=function(){d.reloading=!1,d.xhr=null},y.checkCrossOrigin&&An(p)&&x.crossOrigin&&(p=G(p)),T.open("GET",p,!0),T.responseType="arraybuffer",T.withCredentials=x.crossOrigin==="use-credentials",T.send()}}},{key:"read",value:function(p){var d=this.options,x=this.imageData,y=Pn(p),T=0,M=1,H=1;if(y>1){this.url=Cn(p,$i);var D=Dg(y);T=D.rotate,M=D.scaleX,H=D.scaleY}d.rotatable&&(x.rotate=T),d.scalable&&(x.scaleX=M,x.scaleY=H),this.clone()}},{key:"clone",value:function(){var p=this.element,d=this.url,x=p.crossOrigin,y=d;this.options.checkCrossOrigin&&An(d)&&(x||(x="anonymous"),y=G(d)),this.crossOrigin=x,this.crossOriginUrl=y;var T=document.createElement("img");x&&(T.crossOrigin=x),T.src=y||d,T.alt=p.alt||"The image to crop",this.image=T,T.onload=this.start.bind(this),T.onerror=this.stop.bind(this),Ce(T,tt),p.parentNode.insertBefore(T,p.nextSibling)}},{key:"start",value:function(){var p=this,d=this.image;d.onload=null,d.onerror=null,this.sizing=!0;var x=F.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(F.navigator.userAgent),y=function(D,L){ne(p.imageData,{naturalWidth:D,naturalHeight:L,aspectRatio:D/L}),p.initialImageData=ne({},p.imageData),p.sizing=!1,p.sized=!0,p.build()};if(d.naturalWidth&&!x){y(d.naturalWidth,d.naturalHeight);return}var T=document.createElement("img"),M=document.body||document.documentElement;this.sizingImage=T,T.onload=function(){y(T.width,T.height),x||M.removeChild(T)},T.src=d.src,x||(T.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",M.appendChild(T))}},{key:"stop",value:function(){var p=this.image;p.onload=null,p.onerror=null,p.parentNode.removeChild(p),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var p=this.element,d=this.options,x=this.image,y=p.parentNode,T=document.createElement("div");T.innerHTML=ts;var M=T.querySelector(".".concat(C,"-container")),H=M.querySelector(".".concat(C,"-canvas")),D=M.querySelector(".".concat(C,"-drag-box")),L=M.querySelector(".".concat(C,"-crop-box")),I=L.querySelector(".".concat(C,"-face"));this.container=y,this.cropper=M,this.canvas=H,this.dragBox=D,this.cropBox=L,this.viewBox=M.querySelector(".".concat(C,"-view-box")),this.face=I,H.appendChild(x),Ce(p,de),y.insertBefore(M,p.nextSibling),gt(x,tt),this.initPreview(),this.bind(),d.initialAspectRatio=Math.max(0,d.initialAspectRatio)||NaN,d.aspectRatio=Math.max(0,d.aspectRatio)||NaN,d.viewMode=Math.max(0,Math.min(3,Math.round(d.viewMode)))||0,Ce(L,de),d.guides||Ce(L.getElementsByClassName("".concat(C,"-dashed")),de),d.center||Ce(L.getElementsByClassName("".concat(C,"-center")),de),d.background&&Ce(M,"".concat(C,"-bg")),d.highlight||Ce(I,At),d.cropBoxMovable&&(Ce(I,ft),Tt(I,se,S)),d.cropBoxResizable||(Ce(L.getElementsByClassName("".concat(C,"-line")),de),Ce(L.getElementsByClassName("".concat(C,"-point")),de)),this.render(),this.ready=!0,this.setDragMode(d.dragMode),d.autoCrop&&this.crop(),this.setData(d.data),Qe(d.ready)&&Ee(p,ui,d.ready,{once:!0}),gi(p,ui)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var p=this.cropper.parentNode;p&&p.removeChild(this.cropper),gt(this.element,de)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=qg,g}},{key:"setDefaults",value:function(p){ne(es,ti(p)&&p)}}])}();return ne(hu.prototype,Ng,Bg,Ug,zg,Hg,jg),hu})});var xr={eager:"eager",lazy:"lazy"},Rt=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return Qg(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Qg(i){switch(i.toLowerCase()){case"lazy":return xr.lazy;default:return xr.eager}}var Jg={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function cs(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=Au();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,eb(e,i),e}}function eb(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function tb(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function ve(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function gu(i){i.preventDefault(),i.stopImmediatePropagation()}function as(){return document.visibilityState==="hidden"?Tu():Eu()}function Eu(){return new Promise(i=>requestAnimationFrame(()=>i()))}function Tu(){return new Promise(i=>setTimeout(()=>i(),0))}function xu(i=""){return new DOMParser().parseFromString(i,"text/html")}function ku(i,...e){let t=ib(i,e).replace(/^\n/,"").split(`
1
+ (()=>{var Yg=Object.create;var vh=Object.defineProperty;var Zg=Object.getOwnPropertyDescriptor;var Qg=Object.getOwnPropertyNames;var Jg=Object.getPrototypeOf,eb=Object.prototype.hasOwnProperty;var Te=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var tb=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Qg(e))!eb.call(i,s)&&s!==t&&vh(i,s,{get:()=>e[s],enumerable:!(r=Zg(e,s))||r.enumerable});return i};var ye=(i,e,t)=>(t=i!=null?Yg(Jg(i)):{},tb(e||!i||!i.__esModule?vh(t,"default",{value:i,enumerable:!0}):t,i));var qo=Te((TC,rf)=>{function Aw(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}rf.exports=Aw});var nf=Te((xC,sf)=>{var Cw=typeof global=="object"&&global&&global.Object===Object&&global;sf.exports=Cw});var Yc=Te((kC,of)=>{var Fw=nf(),Pw=typeof self=="object"&&self&&self.Object===Object&&self,Ow=Fw||Pw||Function("return this")();of.exports=Ow});var lf=Te((_C,af)=>{var Rw=Yc(),Mw=function(){return Rw.Date.now()};af.exports=Mw});var uf=Te((AC,cf)=>{var Lw=/\s/;function Iw(i){for(var e=i.length;e--&&Lw.test(i.charAt(e)););return e}cf.exports=Iw});var df=Te((CC,hf)=>{var Dw=uf(),Nw=/^\s+/;function Bw(i){return i&&i.slice(0,Dw(i)+1).replace(Nw,"")}hf.exports=Bw});var Zc=Te((FC,pf)=>{var Uw=Yc(),zw=Uw.Symbol;pf.exports=zw});var bf=Te((PC,gf)=>{var ff=Zc(),mf=Object.prototype,Hw=mf.hasOwnProperty,jw=mf.toString,Zs=ff?ff.toStringTag:void 0;function qw(i){var e=Hw.call(i,Zs),t=i[Zs];try{i[Zs]=void 0;var r=!0}catch{}var s=jw.call(i);return r&&(e?i[Zs]=t:delete i[Zs]),s}gf.exports=qw});var vf=Te((OC,yf)=>{var $w=Object.prototype,Vw=$w.toString;function Ww(i){return Vw.call(i)}yf.exports=Ww});var Tf=Te((RC,Ef)=>{var wf=Zc(),Gw=bf(),Kw=vf(),Xw="[object Null]",Yw="[object Undefined]",Sf=wf?wf.toStringTag:void 0;function Zw(i){return i==null?i===void 0?Yw:Xw:Sf&&Sf in Object(i)?Gw(i):Kw(i)}Ef.exports=Zw});var kf=Te((MC,xf)=>{function Qw(i){return i!=null&&typeof i=="object"}xf.exports=Qw});var Af=Te((LC,_f)=>{var Jw=Tf(),e1=kf(),t1="[object Symbol]";function i1(i){return typeof i=="symbol"||e1(i)&&Jw(i)==t1}_f.exports=i1});var Of=Te((IC,Pf)=>{var r1=df(),Cf=qo(),s1=Af(),Ff=NaN,n1=/^[-+]0x[0-9a-f]+$/i,o1=/^0b[01]+$/i,a1=/^0o[0-7]+$/i,l1=parseInt;function c1(i){if(typeof i=="number")return i;if(s1(i))return Ff;if(Cf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Cf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=r1(i);var t=o1.test(i);return t||a1.test(i)?l1(i.slice(2),t?2:8):n1.test(i)?Ff:+i}Pf.exports=c1});var Jc=Te((DC,Mf)=>{var u1=qo(),Qc=lf(),Rf=Of(),h1="Expected a function",d1=Math.max,p1=Math.min;function f1(i,e,t){var r,s,n,o,a,l,h=0,f=!1,m=!1,w=!0;if(typeof i!="function")throw new TypeError(h1);e=Rf(e)||0,u1(t)&&(f=!!t.leading,m="maxWait"in t,n=m?d1(Rf(t.maxWait)||0,e):n,w="trailing"in t?!!t.trailing:w);function y(A){var P=r,N=s;return r=s=void 0,h=A,o=i.apply(N,P),o}function k(A){return h=A,a=setTimeout(R,e),f?y(A):o}function C(A){var P=A-l,N=A-h,z=e-P;return m?p1(z,n-N):z}function O(A){var P=A-l,N=A-h;return l===void 0||P>=e||P<0||m&&N>=n}function R(){var A=Qc();if(O(A))return _(A);a=setTimeout(R,C(A))}function _(A){return a=void 0,w&&r?y(A):(r=s=void 0,o)}function F(){a!==void 0&&clearTimeout(a),h=0,r=l=s=a=void 0}function x(){return a===void 0?o:_(Qc())}function S(){var A=Qc(),P=O(A);if(r=arguments,s=this,l=A,P){if(a===void 0)return k(l);if(m)return clearTimeout(a),a=setTimeout(R,e),y(l)}return a===void 0&&(a=setTimeout(R,e)),o}return S.cancel=F,S.flush=x,S}Mf.exports=f1});var If=Te((NC,Lf)=>{var m1=Jc(),g1=qo(),b1="Expected a function";function y1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(b1);return g1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),m1(i,e,{leading:r,maxWait:e,trailing:s})}Lf.exports=y1});var Nf=Te((BC,Df)=>{Df.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,h,f,m,w){var y=r(o);y.length&&s(o,y,[a,l,h,f,m,w])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var h=this._fns[o],f=0,m=h?h.length:0;for(f;f<m;f++)h[f]!==a&&l.push(h[f])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],h=Object.keys(t),f=0,m=h.length;for(f;f<m;f++){var w=h[f];if(w==="*"&&(o=o.concat(t[w])),l.length===2&&l[0]===w){o=o.concat(t[w]);break}}return o}function s(n,o,a){var l=0,h=o.length;for(l;l<h&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var $o=Te((qC,zf)=>{"use strict";zf.exports=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=Math.abs(e);if(t&&(r=-r),r===0)return"0 B";let s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),o=Number(r/1024**n),a=s[n];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${a}`}});var qf=Te(($C,jf)=>{"use strict";function Hf(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}Hf.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};jf.exports=function(i,e,t){var r=new Hf(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var Vf=Te((VC,$f)=>{var S1=qf(),E1=/[\/\+\.]/;$f.exports=function(i,e){function t(r){var s=S1(r,i,E1);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var ut=Te((e2,Yo)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof Yo<"u"&&Yo.exports?(e.default=e,Yo.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var nm=Te((z2,au)=>{"use strict";var X1=Object.prototype.hasOwnProperty,ht="~";function sn(){}Object.create&&(sn.prototype=Object.create(null),new sn().__proto__||(ht=!1));function Y1(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function sm(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new Y1(t,r||i,s),o=ht?ht+e:e;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function sa(i,e){--i._eventsCount===0?i._events=new sn:delete i._events[e]}function st(){this._events=new sn,this._eventsCount=0}st.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)X1.call(t,r)&&e.push(ht?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};st.prototype.listeners=function(e){var t=ht?ht+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s<n;s++)o[s]=r[s].fn;return o};st.prototype.listenerCount=function(e){var t=ht?ht+e:e,r=this._events[t];return r?r.fn?1:r.length:0};st.prototype.emit=function(e,t,r,s,n,o){var a=ht?ht+e:e;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,f,m;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(m=1,f=new Array(h-1);m<h;m++)f[m-1]=arguments[m];l.fn.apply(l.context,f)}else{var w=l.length,y;for(m=0;m<w;m++)switch(l[m].once&&this.removeListener(e,l[m].fn,void 0,!0),h){case 1:l[m].fn.call(l[m].context);break;case 2:l[m].fn.call(l[m].context,t);break;case 3:l[m].fn.call(l[m].context,t,r);break;case 4:l[m].fn.call(l[m].context,t,r,s);break;default:if(!f)for(y=1,f=new Array(h-1);y<h;y++)f[y-1]=arguments[y];l[m].fn.apply(l[m].context,f)}}return!0};st.prototype.on=function(e,t,r){return sm(this,e,t,r,!1)};st.prototype.once=function(e,t,r){return sm(this,e,t,r,!0)};st.prototype.removeListener=function(e,t,r,s){var n=ht?ht+e:e;if(!this._events[n])return this;if(!t)return sa(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&sa(this,n);else{for(var a=0,l=[],h=o.length;a<h;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:sa(this,n)}return this};st.prototype.removeAllListeners=function(e){var t;return e?(t=ht?ht+e:e,this._events[t]&&sa(this,t)):(this._events=new sn,this._eventsCount=0),this};st.prototype.off=st.prototype.removeListener;st.prototype.addListener=st.prototype.on;st.prefixed=ht;st.EventEmitter=st;typeof au<"u"&&(au.exports=st)});var kg=Te((sh,nh)=>{(function(i,e){typeof sh=="object"&&typeof nh<"u"?nh.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(sh,(function(){"use strict";function i(g,u){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(g);u&&(d=d.filter(function(T){return Object.getOwnPropertyDescriptor(g,T).enumerable})),p.push.apply(p,d)}return p}function e(g){for(var u=1;u<arguments.length;u++){var p=arguments[u]!=null?arguments[u]:{};u%2?i(Object(p),!0).forEach(function(d){l(g,d,p[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(p)):i(Object(p)).forEach(function(d){Object.defineProperty(g,d,Object.getOwnPropertyDescriptor(p,d))})}return g}function t(g,u){if(typeof g!="object"||!g)return g;var p=g[Symbol.toPrimitive];if(p!==void 0){var d=p.call(g,u||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(g)}function r(g){var u=t(g,"string");return typeof u=="symbol"?u:u+""}function s(g){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},s(g)}function n(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function o(g,u){for(var p=0;p<u.length;p++){var d=u[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(g,r(d.key),d)}}function a(g,u,p){return u&&o(g.prototype,u),p&&o(g,p),Object.defineProperty(g,"prototype",{writable:!1}),g}function l(g,u,p){return u=r(u),u in g?Object.defineProperty(g,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[u]=p,g}function h(g){return f(g)||m(g)||w(g)||k()}function f(g){if(Array.isArray(g))return y(g)}function m(g){if(typeof Symbol<"u"&&g[Symbol.iterator]!=null||g["@@iterator"]!=null)return Array.from(g)}function w(g,u){if(g){if(typeof g=="string")return y(g,u);var p=Object.prototype.toString.call(g).slice(8,-1);if(p==="Object"&&g.constructor&&(p=g.constructor.name),p==="Map"||p==="Set")return Array.from(g);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return y(g,u)}}function y(g,u){(u==null||u>g.length)&&(u=g.length);for(var p=0,d=new Array(u);p<u;p++)d[p]=g[p];return d}function k(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var C=typeof window<"u"&&typeof window.document<"u",O=C?window:{},R=C&&O.document.documentElement?"ontouchstart"in O.document.documentElement:!1,_=C?"PointerEvent"in O:!1,F="cropper",x="all",S="crop",A="move",P="zoom",N="e",z="w",q="s",$="n",Z="ne",K="nw",ie="se",Ae="sw",de="".concat(F,"-crop"),Ue="".concat(F,"-disabled"),fe="".concat(F,"-hidden"),nt="".concat(F,"-hide"),Pt="".concat(F,"-invisible"),St="".concat(F,"-modal"),pt="".concat(F,"-move"),re="".concat(F,"Action"),Ye="".concat(F,"Preview"),se="crop",Ot="move",ne="none",Se="crop",Rt="cropend",ft="cropmove",ni="cropstart",Ai="dblclick",Ki=R?"touchstart":"mousedown",xr=R?"touchmove":"mousemove",Kt=R?"touchend touchcancel":"mouseup",Xt=_?"pointerdown":Ki,Et=_?"pointermove":xr,Ci=_?"pointerup pointercancel":Kt,Fi="ready",Ze="resize",Mt="wheel",Yt="zoom",Pi="image/jpeg",Oi=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Xi=/^data:/,Ri=/^data:image\/jpeg;base64,/,oi=/^img|canvas$/i,Lt=200,Tt=100,kr={viewMode:0,dragMode:se,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Lt,minContainerHeight:Tt,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},On='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',Rn=Number.isNaN||O.isNaN;function Q(g){return typeof g=="number"&&!Rn(g)}var hs=function(u){return u>0&&u<1/0};function Mi(g){return typeof g>"u"}function It(g){return s(g)==="object"&&g!==null}var Dt=Object.prototype.hasOwnProperty;function xt(g){if(!It(g))return!1;try{var u=g.constructor,p=u.prototype;return u&&p&&Dt.call(p,"isPrototypeOf")}catch{return!1}}function $e(g){return typeof g=="function"}var ds=Array.prototype.slice;function Mn(g){return Array.from?Array.from(g):ds.call(g)}function me(g,u){return g&&$e(u)&&(Array.isArray(g)||Q(g.length)?Mn(g).forEach(function(p,d){u.call(g,p,d,g)}):It(g)&&Object.keys(g).forEach(function(p){u.call(g,g[p],p,g)})),g}var he=Object.assign||function(u){for(var p=arguments.length,d=new Array(p>1?p-1:0),T=1;T<p;T++)d[T-1]=arguments[T];return It(u)&&d.length>0&&d.forEach(function(v){It(v)&&Object.keys(v).forEach(function(E){u[E]=v[E]})}),u},Ga=/\.\d*(?:0|9){12}\d*$/;function Nt(g){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Ga.test(g)?Math.round(g*u)/u:g}var Ka=/^width|height|left|top|marginLeft|marginTop$/;function ai(g,u){var p=g.style;me(u,function(d,T){Ka.test(T)&&Q(d)&&(d="".concat(d,"px")),p[T]=d})}function Ce(g,u){return g.classList?g.classList.contains(u):g.className.indexOf(u)>-1}function pe(g,u){if(u){if(Q(g.length)){me(g,function(d){pe(d,u)});return}if(g.classList){g.classList.add(u);return}var p=g.className.trim();p?p.indexOf(u)<0&&(g.className="".concat(p," ").concat(u)):g.className=u}}function Bt(g,u){if(u){if(Q(g.length)){me(g,function(p){Bt(p,u)});return}if(g.classList){g.classList.remove(u);return}g.className.indexOf(u)>=0&&(g.className=g.className.replace(u,""))}}function mi(g,u,p){if(u){if(Q(g.length)){me(g,function(d){mi(d,u,p)});return}p?pe(g,u):Bt(g,u)}}var ps=/([a-z\d])([A-Z])/g;function _r(g){return g.replace(ps,"$1-$2").toLowerCase()}function Ar(g,u){return It(g[u])?g[u]:g.dataset?g.dataset[u]:g.getAttribute("data-".concat(_r(u)))}function Yi(g,u,p){It(p)?g[u]=p:g.dataset?g.dataset[u]=p:g.setAttribute("data-".concat(_r(u)),p)}function kt(g,u){if(It(g[u]))try{delete g[u]}catch{g[u]=void 0}else if(g.dataset)try{delete g.dataset[u]}catch{g.dataset[u]=void 0}else g.removeAttribute("data-".concat(_r(u)))}var li=/\s\s*/,fs=(function(){var g=!1;if(C){var u=!1,p=function(){},d=Object.defineProperty({},"once",{get:function(){return g=!0,u},set:function(v){u=v}});O.addEventListener("test",p,d),O.removeEventListener("test",p,d)}return g})();function mt(g,u,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},T=p;u.trim().split(li).forEach(function(v){if(!fs){var E=g.listeners;E&&E[v]&&E[v][p]&&(T=E[v][p],delete E[v][p],Object.keys(E[v]).length===0&&delete E[v],Object.keys(E).length===0&&delete g.listeners)}g.removeEventListener(v,T,d)})}function it(g,u,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},T=p;u.trim().split(li).forEach(function(v){if(d.once&&!fs){var E=g.listeners,M=E===void 0?{}:E;T=function(){delete M[v][p],g.removeEventListener(v,T,d);for(var B=arguments.length,L=new Array(B),I=0;I<B;I++)L[I]=arguments[I];p.apply(g,L)},M[v]||(M[v]={}),M[v][p]&&g.removeEventListener(v,M[v][p],d),M[v][p]=T,g.listeners=M}g.addEventListener(v,T,d)})}function ci(g,u,p){var d;return $e(Event)&&$e(CustomEvent)?d=new CustomEvent(u,{detail:p,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(u,!0,!0,p)),g.dispatchEvent(d)}function Ut(g){var u=g.getBoundingClientRect();return{left:u.left+(window.pageXOffset-document.documentElement.clientLeft),top:u.top+(window.pageYOffset-document.documentElement.clientTop)}}var Cr=O.location,Ln=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function In(g){var u=g.match(Ln);return u!==null&&(u[1]!==Cr.protocol||u[2]!==Cr.hostname||u[3]!==Cr.port)}function ms(g){var u="timestamp=".concat(new Date().getTime());return g+(g.indexOf("?")===-1?"?":"&")+u}function Li(g){var u=g.rotate,p=g.scaleX,d=g.scaleY,T=g.translateX,v=g.translateY,E=[];Q(T)&&T!==0&&E.push("translateX(".concat(T,"px)")),Q(v)&&v!==0&&E.push("translateY(".concat(v,"px)")),Q(u)&&u!==0&&E.push("rotate(".concat(u,"deg)")),Q(p)&&p!==1&&E.push("scaleX(".concat(p,")")),Q(d)&&d!==1&&E.push("scaleY(".concat(d,")"));var M=E.length?E.join(" "):"none";return{WebkitTransform:M,msTransform:M,transform:M}}function gs(g){var u=e({},g),p=0;return me(g,function(d,T){delete u[T],me(u,function(v){var E=Math.abs(d.startX-v.startX),M=Math.abs(d.startY-v.startY),H=Math.abs(d.endX-v.endX),B=Math.abs(d.endY-v.endY),L=Math.sqrt(E*E+M*M),I=Math.sqrt(H*H+B*B),U=(I-L)/L;Math.abs(U)>Math.abs(p)&&(p=U)})}),p}function gi(g,u){var p=g.pageX,d=g.pageY,T={endX:p,endY:d};return u?T:e({startX:p,startY:d},T)}function G(g){var u=0,p=0,d=0;return me(g,function(T){var v=T.startX,E=T.startY;u+=v,p+=E,d+=1}),u/=d,p/=d,{pageX:u,pageY:p}}function b(g){var u=g.aspectRatio,p=g.height,d=g.width,T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",v=hs(d),E=hs(p);if(v&&E){var M=p*u;T==="contain"&&M>d||T==="cover"&&M<d?p=d/u:d=p*u}else v?p=d/u:E&&(d=p*u);return{width:d,height:p}}function D(g){var u=g.width,p=g.height,d=g.degree;if(d=Math.abs(d)%180,d===90)return{width:p,height:u};var T=d%90*Math.PI/180,v=Math.sin(T),E=Math.cos(T),M=u*E+p*v,H=u*v+p*E;return d>90?{width:H,height:M}:{width:M,height:H}}function W(g,u,p,d){var T=u.aspectRatio,v=u.naturalWidth,E=u.naturalHeight,M=u.rotate,H=M===void 0?0:M,B=u.scaleX,L=B===void 0?1:B,I=u.scaleY,U=I===void 0?1:I,te=p.aspectRatio,ee=p.naturalWidth,ge=p.naturalHeight,oe=d.fillColor,ze=oe===void 0?"transparent":oe,Ve=d.imageSmoothingEnabled,Me=Ve===void 0?!0:Ve,bi=d.imageSmoothingQuality,At=bi===void 0?"low":bi,j=d.maxWidth,ae=j===void 0?1/0:j,He=d.maxHeight,zt=He===void 0?1/0:He,yi=d.minWidth,Zi=yi===void 0?0:yi,Qi=d.minHeight,Ii=Qi===void 0?0:Qi,ui=document.createElement("canvas"),bt=ui.getContext("2d"),Ji=b({aspectRatio:te,width:ae,height:zt}),Bn=b({aspectRatio:te,width:Zi,height:Ii},"cover"),Xa=Math.min(Ji.width,Math.max(Bn.width,ee)),Ya=Math.min(Ji.height,Math.max(Bn.height,ge)),mh=b({aspectRatio:T,width:ae,height:zt}),gh=b({aspectRatio:T,width:Zi,height:Ii},"cover"),bh=Math.min(mh.width,Math.max(gh.width,v)),yh=Math.min(mh.height,Math.max(gh.height,E)),Kg=[-bh/2,-yh/2,bh,yh];return ui.width=Nt(Xa),ui.height=Nt(Ya),bt.fillStyle=ze,bt.fillRect(0,0,Xa,Ya),bt.save(),bt.translate(Xa/2,Ya/2),bt.rotate(H*Math.PI/180),bt.scale(L,U),bt.imageSmoothingEnabled=Me,bt.imageSmoothingQuality=At,bt.drawImage.apply(bt,[g].concat(h(Kg.map(function(Xg){return Math.floor(Nt(Xg))})))),bt.restore(),ui}var J=String.fromCharCode;function Oe(g,u,p){var d="";p+=u;for(var T=u;T<p;T+=1)d+=J(g.getUint8(T));return d}var Ee=/^data:.*,/;function rt(g){var u=g.replace(Ee,""),p=atob(u),d=new ArrayBuffer(p.length),T=new Uint8Array(d);return me(T,function(v,E){T[E]=p.charCodeAt(E)}),d}function gt(g,u){for(var p=[],d=8192,T=new Uint8Array(g);T.length>0;)p.push(J.apply(null,Mn(T.subarray(0,d)))),T=T.subarray(d);return"data:".concat(u,";base64,").concat(btoa(p.join("")))}function _t(g){var u=new DataView(g),p;try{var d,T,v;if(u.getUint8(0)===255&&u.getUint8(1)===216)for(var E=u.byteLength,M=2;M+1<E;){if(u.getUint8(M)===255&&u.getUint8(M+1)===225){T=M;break}M+=1}if(T){var H=T+4,B=T+10;if(Oe(u,H,4)==="Exif"){var L=u.getUint16(B);if(d=L===18761,(d||L===19789)&&u.getUint16(B+2,d)===42){var I=u.getUint32(B+4,d);I>=8&&(v=B+I)}}}if(v){var U=u.getUint16(v,d),te,ee;for(ee=0;ee<U;ee+=1)if(te=v+ee*12+2,u.getUint16(te,d)===274){te+=8,p=u.getUint16(te,d),u.setUint16(te,1,d);break}}}catch{p=1}return p}function bs(g){var u=0,p=1,d=1;switch(g){case 2:p=-1;break;case 3:u=-180;break;case 4:d=-1;break;case 5:u=90,d=-1;break;case 6:u=90;break;case 7:u=90,p=-1;break;case 8:u=-90;break}return{rotate:u,scaleX:p,scaleY:d}}var Re={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var u=this.element,p=this.options,d=this.container,T=this.cropper,v=Number(p.minContainerWidth),E=Number(p.minContainerHeight);pe(T,fe),Bt(u,fe);var M={width:Math.max(d.offsetWidth,v>=0?v:Lt),height:Math.max(d.offsetHeight,E>=0?E:Tt)};this.containerData=M,ai(T,{width:M.width,height:M.height}),pe(u,fe),Bt(T,fe)},initCanvas:function(){var u=this.containerData,p=this.imageData,d=this.options.viewMode,T=Math.abs(p.rotate)%180===90,v=T?p.naturalHeight:p.naturalWidth,E=T?p.naturalWidth:p.naturalHeight,M=v/E,H=u.width,B=u.height;u.height*M>u.width?d===3?H=u.height*M:B=u.width/M:d===3?B=u.width/M:H=u.height*M;var L={aspectRatio:M,naturalWidth:v,naturalHeight:E,width:H,height:B};this.canvasData=L,this.limited=d===1||d===2,this.limitCanvas(!0,!0),L.width=Math.min(Math.max(L.width,L.minWidth),L.maxWidth),L.height=Math.min(Math.max(L.height,L.minHeight),L.maxHeight),L.left=(u.width-L.width)/2,L.top=(u.height-L.height)/2,L.oldLeft=L.left,L.oldTop=L.top,this.initialCanvasData=he({},L)},limitCanvas:function(u,p){var d=this.options,T=this.containerData,v=this.canvasData,E=this.cropBoxData,M=d.viewMode,H=v.aspectRatio,B=this.cropped&&E;if(u){var L=Number(d.minCanvasWidth)||0,I=Number(d.minCanvasHeight)||0;M>1?(L=Math.max(L,T.width),I=Math.max(I,T.height),M===3&&(I*H>L?L=I*H:I=L/H)):M>0&&(L?L=Math.max(L,B?E.width:0):I?I=Math.max(I,B?E.height:0):B&&(L=E.width,I=E.height,I*H>L?L=I*H:I=L/H));var U=b({aspectRatio:H,width:L,height:I});L=U.width,I=U.height,v.minWidth=L,v.minHeight=I,v.maxWidth=1/0,v.maxHeight=1/0}if(p)if(M>(B?0:1)){var te=T.width-v.width,ee=T.height-v.height;v.minLeft=Math.min(0,te),v.minTop=Math.min(0,ee),v.maxLeft=Math.max(0,te),v.maxTop=Math.max(0,ee),B&&this.limited&&(v.minLeft=Math.min(E.left,E.left+(E.width-v.width)),v.minTop=Math.min(E.top,E.top+(E.height-v.height)),v.maxLeft=E.left,v.maxTop=E.top,M===2&&(v.width>=T.width&&(v.minLeft=Math.min(0,te),v.maxLeft=Math.max(0,te)),v.height>=T.height&&(v.minTop=Math.min(0,ee),v.maxTop=Math.max(0,ee))))}else v.minLeft=-v.width,v.minTop=-v.height,v.maxLeft=T.width,v.maxTop=T.height},renderCanvas:function(u,p){var d=this.canvasData,T=this.imageData;if(p){var v=D({width:T.naturalWidth*Math.abs(T.scaleX||1),height:T.naturalHeight*Math.abs(T.scaleY||1),degree:T.rotate||0}),E=v.width,M=v.height,H=d.width*(E/d.naturalWidth),B=d.height*(M/d.naturalHeight);d.left-=(H-d.width)/2,d.top-=(B-d.height)/2,d.width=H,d.height=B,d.aspectRatio=E/M,d.naturalWidth=E,d.naturalHeight=M,this.limitCanvas(!0,!1)}(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCanvas(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,ai(this.canvas,he({width:d.width,height:d.height},Li({translateX:d.left,translateY:d.top}))),this.renderImage(u),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(u){var p=this.canvasData,d=this.imageData,T=d.naturalWidth*(p.width/p.naturalWidth),v=d.naturalHeight*(p.height/p.naturalHeight);he(d,{width:T,height:v,left:(p.width-T)/2,top:(p.height-v)/2}),ai(this.image,he({width:d.width,height:d.height},Li(he({translateX:d.left,translateY:d.top},d)))),u&&this.output()},initCropBox:function(){var u=this.options,p=this.canvasData,d=u.aspectRatio||u.initialAspectRatio,T=Number(u.autoCropArea)||.8,v={width:p.width,height:p.height};d&&(p.height*d>p.width?v.height=v.width/d:v.width=v.height*d),this.cropBoxData=v,this.limitCropBox(!0,!0),v.width=Math.min(Math.max(v.width,v.minWidth),v.maxWidth),v.height=Math.min(Math.max(v.height,v.minHeight),v.maxHeight),v.width=Math.max(v.minWidth,v.width*T),v.height=Math.max(v.minHeight,v.height*T),v.left=p.left+(p.width-v.width)/2,v.top=p.top+(p.height-v.height)/2,v.oldLeft=v.left,v.oldTop=v.top,this.initialCropBoxData=he({},v)},limitCropBox:function(u,p){var d=this.options,T=this.containerData,v=this.canvasData,E=this.cropBoxData,M=this.limited,H=d.aspectRatio;if(u){var B=Number(d.minCropBoxWidth)||0,L=Number(d.minCropBoxHeight)||0,I=M?Math.min(T.width,v.width,v.width+v.left,T.width-v.left):T.width,U=M?Math.min(T.height,v.height,v.height+v.top,T.height-v.top):T.height;B=Math.min(B,T.width),L=Math.min(L,T.height),H&&(B&&L?L*H>B?L=B/H:B=L*H:B?L=B/H:L&&(B=L*H),U*H>I?U=I/H:I=U*H),E.minWidth=Math.min(B,I),E.minHeight=Math.min(L,U),E.maxWidth=I,E.maxHeight=U}p&&(M?(E.minLeft=Math.max(0,v.left),E.minTop=Math.max(0,v.top),E.maxLeft=Math.min(T.width,v.left+v.width)-E.width,E.maxTop=Math.min(T.height,v.top+v.height)-E.height):(E.minLeft=0,E.minTop=0,E.maxLeft=T.width-E.width,E.maxTop=T.height-E.height))},renderCropBox:function(){var u=this.options,p=this.containerData,d=this.cropBoxData;(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCropBox(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,u.movable&&u.cropBoxMovable&&Yi(this.face,re,d.width>=p.width&&d.height>=p.height?A:x),ai(this.cropBox,he({width:d.width,height:d.height},Li({translateX:d.left,translateY:d.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ci(this.element,Se,this.getData())}},Dn={initPreview:function(){var u=this.element,p=this.crossOrigin,d=this.options.preview,T=p?this.crossOriginUrl:this.url,v=u.alt||"The image to preview",E=document.createElement("img");if(p&&(E.crossOrigin=p),E.src=T,E.alt=v,this.viewBox.appendChild(E),this.viewBoxImage=E,!!d){var M=d;typeof d=="string"?M=u.ownerDocument.querySelectorAll(d):d.querySelector&&(M=[d]),this.previews=M,me(M,function(H){var B=document.createElement("img");Yi(H,Ye,{width:H.offsetWidth,height:H.offsetHeight,html:H.innerHTML}),p&&(B.crossOrigin=p),B.src=T,B.alt=v,B.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',H.innerHTML="",H.appendChild(B)})}},resetPreview:function(){me(this.previews,function(u){var p=Ar(u,Ye);ai(u,{width:p.width,height:p.height}),u.innerHTML=p.html,kt(u,Ye)})},preview:function(){var u=this.imageData,p=this.canvasData,d=this.cropBoxData,T=d.width,v=d.height,E=u.width,M=u.height,H=d.left-p.left-u.left,B=d.top-p.top-u.top;!this.cropped||this.disabled||(ai(this.viewBoxImage,he({width:E,height:M},Li(he({translateX:-H,translateY:-B},u)))),me(this.previews,function(L){var I=Ar(L,Ye),U=I.width,te=I.height,ee=U,ge=te,oe=1;T&&(oe=U/T,ge=v*oe),v&&ge>te&&(oe=te/v,ee=T*oe,ge=te),ai(L,{width:ee,height:ge}),ai(L.getElementsByTagName("img")[0],he({width:E*oe,height:M*oe},Li(he({translateX:-H*oe,translateY:-B*oe},u))))}))}},Nn={bind:function(){var u=this.element,p=this.options,d=this.cropper;$e(p.cropstart)&&it(u,ni,p.cropstart),$e(p.cropmove)&&it(u,ft,p.cropmove),$e(p.cropend)&&it(u,Rt,p.cropend),$e(p.crop)&&it(u,Se,p.crop),$e(p.zoom)&&it(u,Yt,p.zoom),it(d,Xt,this.onCropStart=this.cropStart.bind(this)),p.zoomable&&p.zoomOnWheel&&it(d,Mt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&it(d,Ai,this.onDblclick=this.dblclick.bind(this)),it(u.ownerDocument,Et,this.onCropMove=this.cropMove.bind(this)),it(u.ownerDocument,Ci,this.onCropEnd=this.cropEnd.bind(this)),p.responsive&&it(window,Ze,this.onResize=this.resize.bind(this))},unbind:function(){var u=this.element,p=this.options,d=this.cropper;$e(p.cropstart)&&mt(u,ni,p.cropstart),$e(p.cropmove)&&mt(u,ft,p.cropmove),$e(p.cropend)&&mt(u,Rt,p.cropend),$e(p.crop)&&mt(u,Se,p.crop),$e(p.zoom)&&mt(u,Yt,p.zoom),mt(d,Xt,this.onCropStart),p.zoomable&&p.zoomOnWheel&&mt(d,Mt,this.onWheel,{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&mt(d,Ai,this.onDblclick),mt(u.ownerDocument,Et,this.onCropMove),mt(u.ownerDocument,Ci,this.onCropEnd),p.responsive&&mt(window,Ze,this.onResize)}},$g={resize:function(){if(!this.disabled){var u=this.options,p=this.container,d=this.containerData,T=p.offsetWidth/d.width,v=p.offsetHeight/d.height,E=Math.abs(T-1)>Math.abs(v-1)?T:v;if(E!==1){var M,H;u.restore&&(M=this.getCanvasData(),H=this.getCropBoxData()),this.render(),u.restore&&(this.setCanvasData(me(M,function(B,L){M[L]=B*E})),this.setCropBoxData(me(H,function(B,L){H[L]=B*E})))}}},dblclick:function(){this.disabled||this.options.dragMode===ne||this.setDragMode(Ce(this.dragBox,de)?Ot:se)},wheel:function(u){var p=this,d=Number(this.options.wheelZoomRatio)||.1,T=1;this.disabled||(u.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){p.wheeling=!1},50),u.deltaY?T=u.deltaY>0?1:-1:u.wheelDelta?T=-u.wheelDelta/120:u.detail&&(T=u.detail>0?1:-1),this.zoom(-T*d,u)))},cropStart:function(u){var p=u.buttons,d=u.button;if(!(this.disabled||(u.type==="mousedown"||u.type==="pointerdown"&&u.pointerType==="mouse")&&(Q(p)&&p!==1||Q(d)&&d!==0||u.ctrlKey))){var T=this.options,v=this.pointers,E;u.changedTouches?me(u.changedTouches,function(M){v[M.identifier]=gi(M)}):v[u.pointerId||0]=gi(u),Object.keys(v).length>1&&T.zoomable&&T.zoomOnTouch?E=P:E=Ar(u.target,re),Oi.test(E)&&ci(this.element,ni,{originalEvent:u,action:E})!==!1&&(u.preventDefault(),this.action=E,this.cropping=!1,E===S&&(this.cropping=!0,pe(this.dragBox,St)))}},cropMove:function(u){var p=this.action;if(!(this.disabled||!p)){var d=this.pointers;u.preventDefault(),ci(this.element,ft,{originalEvent:u,action:p})!==!1&&(u.changedTouches?me(u.changedTouches,function(T){he(d[T.identifier]||{},gi(T,!0))}):he(d[u.pointerId||0]||{},gi(u,!0)),this.change(u))}},cropEnd:function(u){if(!this.disabled){var p=this.action,d=this.pointers;u.changedTouches?me(u.changedTouches,function(T){delete d[T.identifier]}):delete d[u.pointerId||0],p&&(u.preventDefault(),Object.keys(d).length||(this.action=""),this.cropping&&(this.cropping=!1,mi(this.dragBox,St,this.cropped&&this.options.modal)),ci(this.element,Rt,{originalEvent:u,action:p}))}}},Vg={change:function(u){var p=this.options,d=this.canvasData,T=this.containerData,v=this.cropBoxData,E=this.pointers,M=this.action,H=p.aspectRatio,B=v.left,L=v.top,I=v.width,U=v.height,te=B+I,ee=L+U,ge=0,oe=0,ze=T.width,Ve=T.height,Me=!0,bi;!H&&u.shiftKey&&(H=I&&U?I/U:1),this.limited&&(ge=v.minLeft,oe=v.minTop,ze=ge+Math.min(T.width,d.width,d.left+d.width),Ve=oe+Math.min(T.height,d.height,d.top+d.height));var At=E[Object.keys(E)[0]],j={x:At.endX-At.startX,y:At.endY-At.startY},ae=function(zt){switch(zt){case N:te+j.x>ze&&(j.x=ze-te);break;case z:B+j.x<ge&&(j.x=ge-B);break;case $:L+j.y<oe&&(j.y=oe-L);break;case q:ee+j.y>Ve&&(j.y=Ve-ee);break}};switch(M){case x:B+=j.x,L+=j.y;break;case N:if(j.x>=0&&(te>=ze||H&&(L<=oe||ee>=Ve))){Me=!1;break}ae(N),I+=j.x,I<0&&(M=z,I=-I,B-=I),H&&(U=I/H,L+=(v.height-U)/2);break;case $:if(j.y<=0&&(L<=oe||H&&(B<=ge||te>=ze))){Me=!1;break}ae($),U-=j.y,L+=j.y,U<0&&(M=q,U=-U,L-=U),H&&(I=U*H,B+=(v.width-I)/2);break;case z:if(j.x<=0&&(B<=ge||H&&(L<=oe||ee>=Ve))){Me=!1;break}ae(z),I-=j.x,B+=j.x,I<0&&(M=N,I=-I,B-=I),H&&(U=I/H,L+=(v.height-U)/2);break;case q:if(j.y>=0&&(ee>=Ve||H&&(B<=ge||te>=ze))){Me=!1;break}ae(q),U+=j.y,U<0&&(M=$,U=-U,L-=U),H&&(I=U*H,B+=(v.width-I)/2);break;case Z:if(H){if(j.y<=0&&(L<=oe||te>=ze)){Me=!1;break}ae($),U-=j.y,L+=j.y,I=U*H}else ae($),ae(N),j.x>=0?te<ze?I+=j.x:j.y<=0&&L<=oe&&(Me=!1):I+=j.x,j.y<=0?L>oe&&(U-=j.y,L+=j.y):(U-=j.y,L+=j.y);I<0&&U<0?(M=Ae,U=-U,I=-I,L-=U,B-=I):I<0?(M=K,I=-I,B-=I):U<0&&(M=ie,U=-U,L-=U);break;case K:if(H){if(j.y<=0&&(L<=oe||B<=ge)){Me=!1;break}ae($),U-=j.y,L+=j.y,I=U*H,B+=v.width-I}else ae($),ae(z),j.x<=0?B>ge?(I-=j.x,B+=j.x):j.y<=0&&L<=oe&&(Me=!1):(I-=j.x,B+=j.x),j.y<=0?L>oe&&(U-=j.y,L+=j.y):(U-=j.y,L+=j.y);I<0&&U<0?(M=ie,U=-U,I=-I,L-=U,B-=I):I<0?(M=Z,I=-I,B-=I):U<0&&(M=Ae,U=-U,L-=U);break;case Ae:if(H){if(j.x<=0&&(B<=ge||ee>=Ve)){Me=!1;break}ae(z),I-=j.x,B+=j.x,U=I/H}else ae(q),ae(z),j.x<=0?B>ge?(I-=j.x,B+=j.x):j.y>=0&&ee>=Ve&&(Me=!1):(I-=j.x,B+=j.x),j.y>=0?ee<Ve&&(U+=j.y):U+=j.y;I<0&&U<0?(M=Z,U=-U,I=-I,L-=U,B-=I):I<0?(M=ie,I=-I,B-=I):U<0&&(M=K,U=-U,L-=U);break;case ie:if(H){if(j.x>=0&&(te>=ze||ee>=Ve)){Me=!1;break}ae(N),I+=j.x,U=I/H}else ae(q),ae(N),j.x>=0?te<ze?I+=j.x:j.y>=0&&ee>=Ve&&(Me=!1):I+=j.x,j.y>=0?ee<Ve&&(U+=j.y):U+=j.y;I<0&&U<0?(M=K,U=-U,I=-I,L-=U,B-=I):I<0?(M=Ae,I=-I,B-=I):U<0&&(M=Z,U=-U,L-=U);break;case A:this.move(j.x,j.y),Me=!1;break;case P:this.zoom(gs(E),u),Me=!1;break;case S:if(!j.x||!j.y){Me=!1;break}bi=Ut(this.cropper),B=At.startX-bi.left,L=At.startY-bi.top,I=v.minWidth,U=v.minHeight,j.x>0?M=j.y>0?ie:Z:j.x<0&&(B-=I,M=j.y>0?Ae:K),j.y<0&&(L-=U),this.cropped||(Bt(this.cropBox,fe),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Me&&(v.width=I,v.height=U,v.left=B,v.top=L,this.action=M,this.renderCropBox()),me(E,function(He){He.startX=He.endX,He.startY=He.endY})}},Wg={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&pe(this.dragBox,St),Bt(this.cropBox,fe),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=he({},this.initialImageData),this.canvasData=he({},this.initialCanvasData),this.cropBoxData=he({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(he(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Bt(this.dragBox,St),pe(this.cropBox,fe)),this},replace:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&u&&(this.isImg&&(this.element.src=u),p?(this.url=u,this.image.src=u,this.ready&&(this.viewBoxImage.src=u,me(this.previews,function(d){d.getElementsByTagName("img")[0].src=u}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(u))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Bt(this.cropper,Ue)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,pe(this.cropper,Ue)),this},destroy:function(){var u=this.element;return u[F]?(u[F]=void 0,this.isImg&&this.replaced&&(u.src=this.originalUrl),this.uncreate(),this):this},move:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.canvasData,T=d.left,v=d.top;return this.moveTo(Mi(u)?u:T+Number(u),Mi(p)?p:v+Number(p))},moveTo:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.canvasData,T=!1;return u=Number(u),p=Number(p),this.ready&&!this.disabled&&this.options.movable&&(Q(u)&&(d.left=u,T=!0),Q(p)&&(d.top=p,T=!0),T&&this.renderCanvas(!0)),this},zoom:function(u,p){var d=this.canvasData;return u=Number(u),u<0?u=1/(1-u):u=1+u,this.zoomTo(d.width*u/d.naturalWidth,null,p)},zoomTo:function(u,p,d){var T=this.options,v=this.canvasData,E=v.width,M=v.height,H=v.naturalWidth,B=v.naturalHeight;if(u=Number(u),u>=0&&this.ready&&!this.disabled&&T.zoomable){var L=H*u,I=B*u;if(ci(this.element,Yt,{ratio:u,oldRatio:E/H,originalEvent:d})===!1)return this;if(d){var U=this.pointers,te=Ut(this.cropper),ee=U&&Object.keys(U).length?G(U):{pageX:d.pageX,pageY:d.pageY};v.left-=(L-E)*((ee.pageX-te.left-v.left)/E),v.top-=(I-M)*((ee.pageY-te.top-v.top)/M)}else xt(p)&&Q(p.x)&&Q(p.y)?(v.left-=(L-E)*((p.x-v.left)/E),v.top-=(I-M)*((p.y-v.top)/M)):(v.left-=(L-E)/2,v.top-=(I-M)/2);v.width=L,v.height=I,this.renderCanvas(!0)}return this},rotate:function(u){return this.rotateTo((this.imageData.rotate||0)+Number(u))},rotateTo:function(u){return u=Number(u),Q(u)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=u%360,this.renderCanvas(!0,!0)),this},scaleX:function(u){var p=this.imageData.scaleY;return this.scale(u,Q(p)?p:1)},scaleY:function(u){var p=this.imageData.scaleX;return this.scale(Q(p)?p:1,u)},scale:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.imageData,T=!1;return u=Number(u),p=Number(p),this.ready&&!this.disabled&&this.options.scalable&&(Q(u)&&(d.scaleX=u,T=!0),Q(p)&&(d.scaleY=p,T=!0),T&&this.renderCanvas(!0,!0)),this},getData:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,p=this.options,d=this.imageData,T=this.canvasData,v=this.cropBoxData,E;if(this.ready&&this.cropped){E={x:v.left-T.left,y:v.top-T.top,width:v.width,height:v.height};var M=d.width/d.naturalWidth;if(me(E,function(L,I){E[I]=L/M}),u){var H=Math.round(E.y+E.height),B=Math.round(E.x+E.width);E.x=Math.round(E.x),E.y=Math.round(E.y),E.width=B-E.x,E.height=H-E.y}}else E={x:0,y:0,width:0,height:0};return p.rotatable&&(E.rotate=d.rotate||0),p.scalable&&(E.scaleX=d.scaleX||1,E.scaleY=d.scaleY||1),E},setData:function(u){var p=this.options,d=this.imageData,T=this.canvasData,v={};if(this.ready&&!this.disabled&&xt(u)){var E=!1;p.rotatable&&Q(u.rotate)&&u.rotate!==d.rotate&&(d.rotate=u.rotate,E=!0),p.scalable&&(Q(u.scaleX)&&u.scaleX!==d.scaleX&&(d.scaleX=u.scaleX,E=!0),Q(u.scaleY)&&u.scaleY!==d.scaleY&&(d.scaleY=u.scaleY,E=!0)),E&&this.renderCanvas(!0,!0);var M=d.width/d.naturalWidth;Q(u.x)&&(v.left=u.x*M+T.left),Q(u.y)&&(v.top=u.y*M+T.top),Q(u.width)&&(v.width=u.width*M),Q(u.height)&&(v.height=u.height*M),this.setCropBoxData(v)}return this},getContainerData:function(){return this.ready?he({},this.containerData):{}},getImageData:function(){return this.sized?he({},this.imageData):{}},getCanvasData:function(){var u=this.canvasData,p={};return this.ready&&me(["left","top","width","height","naturalWidth","naturalHeight"],function(d){p[d]=u[d]}),p},setCanvasData:function(u){var p=this.canvasData,d=p.aspectRatio;return this.ready&&!this.disabled&&xt(u)&&(Q(u.left)&&(p.left=u.left),Q(u.top)&&(p.top=u.top),Q(u.width)?(p.width=u.width,p.height=u.width/d):Q(u.height)&&(p.height=u.height,p.width=u.height*d),this.renderCanvas(!0)),this},getCropBoxData:function(){var u=this.cropBoxData,p;return this.ready&&this.cropped&&(p={left:u.left,top:u.top,width:u.width,height:u.height}),p||{}},setCropBoxData:function(u){var p=this.cropBoxData,d=this.options.aspectRatio,T,v;return this.ready&&this.cropped&&!this.disabled&&xt(u)&&(Q(u.left)&&(p.left=u.left),Q(u.top)&&(p.top=u.top),Q(u.width)&&u.width!==p.width&&(T=!0,p.width=u.width),Q(u.height)&&u.height!==p.height&&(v=!0,p.height=u.height),d&&(T?p.height=p.width/d:v&&(p.width=p.height*d)),this.renderCropBox()),this},getCroppedCanvas:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var p=this.canvasData,d=W(this.image,this.imageData,p,u);if(!this.cropped)return d;var T=this.getData(u.rounded),v=T.x,E=T.y,M=T.width,H=T.height,B=d.width/Math.floor(p.naturalWidth);B!==1&&(v*=B,E*=B,M*=B,H*=B);var L=M/H,I=b({aspectRatio:L,width:u.maxWidth||1/0,height:u.maxHeight||1/0}),U=b({aspectRatio:L,width:u.minWidth||0,height:u.minHeight||0},"cover"),te=b({aspectRatio:L,width:u.width||(B!==1?d.width:M),height:u.height||(B!==1?d.height:H)}),ee=te.width,ge=te.height;ee=Math.min(I.width,Math.max(U.width,ee)),ge=Math.min(I.height,Math.max(U.height,ge));var oe=document.createElement("canvas"),ze=oe.getContext("2d");oe.width=Nt(ee),oe.height=Nt(ge),ze.fillStyle=u.fillColor||"transparent",ze.fillRect(0,0,ee,ge);var Ve=u.imageSmoothingEnabled,Me=Ve===void 0?!0:Ve,bi=u.imageSmoothingQuality;ze.imageSmoothingEnabled=Me,bi&&(ze.imageSmoothingQuality=bi);var At=d.width,j=d.height,ae=v,He=E,zt,yi,Zi,Qi,Ii,ui;ae<=-M||ae>At?(ae=0,zt=0,Zi=0,Ii=0):ae<=0?(Zi=-ae,ae=0,zt=Math.min(At,M+ae),Ii=zt):ae<=At&&(Zi=0,zt=Math.min(M,At-ae),Ii=zt),zt<=0||He<=-H||He>j?(He=0,yi=0,Qi=0,ui=0):He<=0?(Qi=-He,He=0,yi=Math.min(j,H+He),ui=yi):He<=j&&(Qi=0,yi=Math.min(H,j-He),ui=yi);var bt=[ae,He,zt,yi];if(Ii>0&&ui>0){var Ji=ee/M;bt.push(Zi*Ji,Qi*Ji,Ii*Ji,ui*Ji)}return ze.drawImage.apply(ze,[d].concat(h(bt.map(function(Bn){return Math.floor(Nt(Bn))})))),oe},setAspectRatio:function(u){var p=this.options;return!this.disabled&&!Mi(u)&&(p.aspectRatio=Math.max(0,u)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(u){var p=this.options,d=this.dragBox,T=this.face;if(this.ready&&!this.disabled){var v=u===se,E=p.movable&&u===Ot;u=v||E?u:ne,p.dragMode=u,Yi(d,re,u),mi(d,de,v),mi(d,pt,E),p.cropBoxMovable||(Yi(T,re,u),mi(T,de,v),mi(T,pt,E))}return this}},Gg=O.Cropper,fh=(function(){function g(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,g),!u||!oi.test(u.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=u,this.options=he({},kr,xt(p)&&p),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(g,[{key:"init",value:function(){var p=this.element,d=p.tagName.toLowerCase(),T;if(!p[F]){if(p[F]=this,d==="img"){if(this.isImg=!0,T=p.getAttribute("src")||"",this.originalUrl=T,!T)return;T=p.src}else d==="canvas"&&window.HTMLCanvasElement&&(T=p.toDataURL());this.load(T)}}},{key:"load",value:function(p){var d=this;if(p){this.url=p,this.imageData={};var T=this.element,v=this.options;if(!v.rotatable&&!v.scalable&&(v.checkOrientation=!1),!v.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Xi.test(p)){Ri.test(p)?this.read(rt(p)):this.clone();return}var E=new XMLHttpRequest,M=this.clone.bind(this);this.reloading=!0,this.xhr=E,E.onabort=M,E.onerror=M,E.ontimeout=M,E.onprogress=function(){E.getResponseHeader("content-type")!==Pi&&E.abort()},E.onload=function(){d.read(E.response)},E.onloadend=function(){d.reloading=!1,d.xhr=null},v.checkCrossOrigin&&In(p)&&T.crossOrigin&&(p=ms(p)),E.open("GET",p,!0),E.responseType="arraybuffer",E.withCredentials=T.crossOrigin==="use-credentials",E.send()}}},{key:"read",value:function(p){var d=this.options,T=this.imageData,v=_t(p),E=0,M=1,H=1;if(v>1){this.url=gt(p,Pi);var B=bs(v);E=B.rotate,M=B.scaleX,H=B.scaleY}d.rotatable&&(T.rotate=E),d.scalable&&(T.scaleX=M,T.scaleY=H),this.clone()}},{key:"clone",value:function(){var p=this.element,d=this.url,T=p.crossOrigin,v=d;this.options.checkCrossOrigin&&In(d)&&(T||(T="anonymous"),v=ms(d)),this.crossOrigin=T,this.crossOriginUrl=v;var E=document.createElement("img");T&&(E.crossOrigin=T),E.src=v||d,E.alt=p.alt||"The image to crop",this.image=E,E.onload=this.start.bind(this),E.onerror=this.stop.bind(this),pe(E,nt),p.parentNode.insertBefore(E,p.nextSibling)}},{key:"start",value:function(){var p=this,d=this.image;d.onload=null,d.onerror=null,this.sizing=!0;var T=O.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(O.navigator.userAgent),v=function(B,L){he(p.imageData,{naturalWidth:B,naturalHeight:L,aspectRatio:B/L}),p.initialImageData=he({},p.imageData),p.sizing=!1,p.sized=!0,p.build()};if(d.naturalWidth&&!T){v(d.naturalWidth,d.naturalHeight);return}var E=document.createElement("img"),M=document.body||document.documentElement;this.sizingImage=E,E.onload=function(){v(E.width,E.height),T||M.removeChild(E)},E.src=d.src,T||(E.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",M.appendChild(E))}},{key:"stop",value:function(){var p=this.image;p.onload=null,p.onerror=null,p.parentNode.removeChild(p),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var p=this.element,d=this.options,T=this.image,v=p.parentNode,E=document.createElement("div");E.innerHTML=On;var M=E.querySelector(".".concat(F,"-container")),H=M.querySelector(".".concat(F,"-canvas")),B=M.querySelector(".".concat(F,"-drag-box")),L=M.querySelector(".".concat(F,"-crop-box")),I=L.querySelector(".".concat(F,"-face"));this.container=v,this.cropper=M,this.canvas=H,this.dragBox=B,this.cropBox=L,this.viewBox=M.querySelector(".".concat(F,"-view-box")),this.face=I,H.appendChild(T),pe(p,fe),v.insertBefore(M,p.nextSibling),Bt(T,nt),this.initPreview(),this.bind(),d.initialAspectRatio=Math.max(0,d.initialAspectRatio)||NaN,d.aspectRatio=Math.max(0,d.aspectRatio)||NaN,d.viewMode=Math.max(0,Math.min(3,Math.round(d.viewMode)))||0,pe(L,fe),d.guides||pe(L.getElementsByClassName("".concat(F,"-dashed")),fe),d.center||pe(L.getElementsByClassName("".concat(F,"-center")),fe),d.background&&pe(M,"".concat(F,"-bg")),d.highlight||pe(I,Pt),d.cropBoxMovable&&(pe(I,pt),Yi(I,re,x)),d.cropBoxResizable||(pe(L.getElementsByClassName("".concat(F,"-line")),fe),pe(L.getElementsByClassName("".concat(F,"-point")),fe)),this.render(),this.ready=!0,this.setDragMode(d.dragMode),d.autoCrop&&this.crop(),this.setData(d.data),$e(d.ready)&&it(p,Fi,d.ready,{once:!0}),ci(p,Fi)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var p=this.cropper.parentNode;p&&p.removeChild(this.cropper),Bt(this.element,fe)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=Gg,g}},{key:"setDefaults",value:function(p){he(kr,xt(p)&&p)}}])})();return he(fh.prototype,Re,Dn,Nn,$g,Vg,Wg),fh}))});var Pr={eager:"eager",lazy:"lazy"},jt=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return ib(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function ib(i){return i.toLowerCase()==="lazy"?Pr.lazy:Pr.eager}var rb={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function ws(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=Oh();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,sb(e,i),e}}function sb(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function nb(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function ve(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function wh(i){i.preventDefault(),i.stopImmediatePropagation()}function ys(){return document.visibilityState==="hidden"?Ah():_h()}function _h(){return new Promise(i=>requestAnimationFrame(()=>i()))}function Ah(){return new Promise(i=>setTimeout(()=>i(),0))}function Ch(i=""){return new DOMParser().parseFromString(i,"text/html")}function Fh(i,...e){let t=ob(i,e).replace(/^\n/,"").split(`
3
3
  `),r=t[0].match(/^\s+/),s=r?r[0].length:0;return t.map(n=>n.slice(s)).join(`
4
- `)}function ib(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function Ri(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join("")}function Mn(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function rb(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function Ln(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function In(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function sb(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function _u(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function nb(i){return i=="advance"||i=="replace"||i=="restore"}function Qi(...i){let e=Mn("data-turbo-action",...i);return nb(e)?e:null}function wl(i){return document.querySelector(`meta[name="${i}"]`)}function Dn(i){let e=wl(i);return e&&e.content}function Au(){let i=wl("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function ob(i,e){let t=wl(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function _r(i,e){if(i instanceof Element)return i.closest(e)||_r(i.assignedSlot||i.getRootNode()?.host,e)}function Sl(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function Cu(i){return Array.from(i.querySelectorAll("[autofocus]")).find(Sl)}async function ab(i,e){let t=e();i(),await Eu();let r=e();return[t,r]}function Pu(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Fu(i){let e=_r(i,"a[href], a[xlink\\:href]");if(!e||e.href.startsWith("#")||e.hasAttribute("download"))return null;let t=e.getAttribute("target");return t&&t!=="_self"?null:e}function lb(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var cb={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",gu)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",gu)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},$a=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=cb[e]||e}},hb=new $a({mode:"on",submitter:"disabled"}),$e={drive:Jg,forms:hb};function Xe(i){return new URL(i.toString(),document.baseURI)}function ls(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function El(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return Xe(t)}function ub(i){return(mb(i).match(/\.[^.]*$/)||[])[0]||""}function db(i,e){let t=bu(e.origin+e.pathname);return bu(i.href)===t||i.href.startsWith(t)}function Oi(i,e){return db(i,e)&&!$e.drive.unvisitableExtensions.has(ub(i))}function Ou(i){return Xe(i.getAttribute("href")||"")}function pb(i){let e=ls(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function Rn(i){return pb(i)}function Ru(i,e){return Xe(i).href==Xe(e).href}function fb(i){return i.pathname.split("/").slice(1)}function mb(i){return fb(i).slice(-1)[0]}function bu(i){return i.endsWith("/")?i:i+"/"}var hs=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Xe(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},Va=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Mu=new Va(20);function Lu(i,e={}){let t=new Headers(e.headers||{}),r=Ri();return Mu.add(r),t.append("X-Turbo-Request-Id",r),window.fetch(i,{...e,headers:t})}function Tl(i){switch(i.toLowerCase()){case"get":return Ot.get;case"post":return Ot.post;case"put":return Ot.put;case"patch":return Ot.patch;case"delete":return Ot.delete}}var Ot={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function gb(i){switch(i.toLowerCase()){case Zi.multipart:return Zi.multipart;case Zi.plain:return Zi.plain;default:return Zi.urlEncoded}}var Zi={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Ji=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=Zi.urlEncoded){let[a,l]=yu(Xe(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Tl(e)||Ot.get;this.url.search="";let[s,n]=yu(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Lu(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new hs(e);return ve("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return xl(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=ve("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!ve("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function xl(i){return Tl(i)==Ot.get}function yu(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(Iu(t)):i.searchParams;return xl(e)?[bb(i,s),null]:r==Zi.urlEncoded?[i,s]:[i,t]}function Iu(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function bb(i,e){let t=new URLSearchParams(Iu(e));return i.search=t.toString(),i}var Wa=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},Mi=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(tb(e)):e}constructor(e){this.fragment=yb(e)}};function yb(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(cs(r));e.replaceWith(t)}return i}var vb=i=>i,Nn=class{keys=[];entries={};#e;constructor(e,t=vb){this.size=e,this.#e=t}has(e){return this.#e(e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[this.#e(e)]}write(e,t){this.entries[this.#e(e)]=t}touch(e){e=this.#e(e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},wb=100,Ga=class extends Nn{#e=null;#t={};constructor(e=1,t=wb){super(e,Rn),this.prefetchDelay=t}putLater(e,t,r){this.#e=setTimeout(()=>{t.perform(),this.put(e,t,r),this.#e=null},this.prefetchDelay)}put(e,t,r=Du){super.put(e,t),this.#t[Rn(e)]=new Date(new Date().getTime()+r)}clear(){super.clear(),this.#e&&clearTimeout(this.#e)}evict(e){super.evict(e),delete this.#t[e]}has(e){if(super.has(e)){let t=this.#t[Rn(e)];return t&&t>Date.now()}else return!1}},Du=10*1e3,kr=new Ga,Tr={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Bn=class i{state=Tr.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=_b(t,r),o=kb(xb(t,r),n),a=Sb(t,r),l=Ab(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new Ji(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=Xe(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Tr,r=Mn("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof $e.forms.confirm=="function"?$e.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Tr;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=Eb(Dn("csrf-param"))||Dn("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Mi.contentType)}requestStarted(e){this.state=Tr.waiting,this.submitter&&$e.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Ln(this.formElement),ve("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){kr.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(kr.clear(),this.requestMustRedirect(e)&&Tb(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Tr.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Tr.stopped,this.submitter&&$e.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),In(this.formElement),ve("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||rb("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Sb(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function Eb(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Tb(i){return i.statusCode==200&&!i.redirected}function xb(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function kb(i,e){let t=Xe(i);return xl(e)&&(t.search=""),t}function _b(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return Tl(t.toLowerCase())||Ot.get}function Ab(i,e){return gb(e?.getAttribute("formenctype")||i.enctype)}var Cr=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Cu(this.element)}get permanentElements(){return Bu(this.element)}getPermanentElementById(e){return Nu(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function Nu(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function Bu(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var us=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Cb(t,r)&&Pb(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Cb(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function Pb(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return Pu(t)}var Un=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(ls(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(f=>this.#e=f),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(f=>this.#t=f),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Ka=class extends Un{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Cr(this.element)}},zn=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=Fu(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},Hn=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Fu(t);if(r&&Pu(r.target)){let s=Ou(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},jn=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Hn(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[m,v]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:m,value:v}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=Qi(e);l&&r.setAttribute("data-turbo-action",l);let u=e.getAttribute("data-turbo-confirm");u&&r.setAttribute("data-turbo-confirm",u),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},qn=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Fb(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Fb(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var ds=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await qn.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},ps=class extends ds{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await as(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await as(),this.focusFirstAutofocusableElement(),await as(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Ob(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Rb(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=cs(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Ob(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function Rb(i,e){return i=="auto"||i=="smooth"?i:e}var Mb=function(){let i=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:v=>v.getAttribute("im-preserve")==="true",shouldReAppend:v=>v.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function t(v,b,k={}){v=f(v);let P=m(b),F=u(v,P,k),R=s(F,()=>a(F,v,P,_=>_.morphStyle==="innerHTML"?(n(_,v,P),Array.from(v.childNodes)):r(_,v,P)));return F.pantry.remove(),R}function r(v,b,k){let P=m(b);return n(v,P,k,b,b.nextSibling),Array.from(P.childNodes)}function s(v,b){if(!v.config.restoreFocus)return b();let k=document.activeElement;if(!(k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement))return b();let{id:P,selectionStart:F,selectionEnd:R}=k,_=b();return P&&P!==document.activeElement?.getAttribute("id")&&(k=v.target.querySelector(`[id="${P}"]`),k?.focus()),k&&!k.selectionEnd&&R&&k.setSelectionRange(F,R),_}let n=function(){function v(S,E,A,O=null,N=null){E instanceof HTMLTemplateElement&&A instanceof HTMLTemplateElement&&(E=E.content,A=A.content),O||=E.firstChild;for(let z of A.childNodes){if(O&&O!=N){let j=k(S,z,O,N);if(j){j!==O&&F(S,O,j),o(j,z,S),O=j.nextSibling;continue}}if(z instanceof Element){let j=z.getAttribute("id");if(S.persistentIds.has(j)){let X=R(E,j,O,S);o(X,z,S),O=X.nextSibling;continue}}let $=b(E,z,O,S);$&&(O=$.nextSibling)}for(;O&&O!=N;){let z=O;O=O.nextSibling,P(S,z)}}function b(S,E,A,O){if(O.callbacks.beforeNodeAdded(E)===!1)return null;if(O.idMap.has(E)){let N=document.createElement(E.tagName);return S.insertBefore(N,A),o(N,E,O),O.callbacks.afterNodeAdded(N),N}else{let N=document.importNode(E,!0);return S.insertBefore(N,A),O.callbacks.afterNodeAdded(N),N}}let k=function(){function S(O,N,z,$){let j=null,X=N.nextSibling,te=0,ie=z;for(;ie&&ie!=$;){if(A(ie,N)){if(E(O,ie,N))return ie;j===null&&(O.idMap.has(ie)||(j=ie))}if(j===null&&X&&A(ie,X)&&(te++,X=X.nextSibling,te>=2&&(j=void 0)),O.activeElementAndParents.includes(ie))break;ie=ie.nextSibling}return j||null}function E(O,N,z){let $=O.idMap.get(N),j=O.idMap.get(z);if(!j||!$)return!1;for(let X of $)if(j.has(X))return!0;return!1}function A(O,N){let z=O,$=N;return z.nodeType===$.nodeType&&z.tagName===$.tagName&&(!z.getAttribute?.("id")||z.getAttribute?.("id")===$.getAttribute?.("id"))}return S}();function P(S,E){if(S.idMap.has(E))C(S.pantry,E,null);else{if(S.callbacks.beforeNodeRemoved(E)===!1)return;E.parentNode?.removeChild(E),S.callbacks.afterNodeRemoved(E)}}function F(S,E,A){let O=E;for(;O&&O!==A;){let N=O;O=O.nextSibling,P(S,N)}return O}function R(S,E,A,O){let N=O.target.getAttribute?.("id")===E&&O.target||O.target.querySelector(`[id="${E}"]`)||O.pantry.querySelector(`[id="${E}"]`);return _(N,O),C(S,N,A),N}function _(S,E){let A=S.getAttribute("id");for(;S=S.parentNode;){let O=E.idMap.get(S);O&&(O.delete(A),O.size||E.idMap.delete(S))}}function C(S,E,A){if(S.moveBefore)try{S.moveBefore(E,A)}catch{S.insertBefore(E,A)}else S.insertBefore(E,A)}return v}(),o=function(){function v(_,C,S){return S.ignoreActive&&_===document.activeElement?null:(S.callbacks.beforeNodeMorphed(_,C)===!1||(_ instanceof HTMLHeadElement&&S.head.ignore||(_ instanceof HTMLHeadElement&&S.head.style!=="morph"?l(_,C,S):(b(_,C,S),R(_,S)||n(S,_,C))),S.callbacks.afterNodeMorphed(_,C)),_)}function b(_,C,S){let E=C.nodeType;if(E===1){let A=_,O=C,N=A.attributes,z=O.attributes;for(let $ of z)F($.name,A,"update",S)||A.getAttribute($.name)!==$.value&&A.setAttribute($.name,$.value);for(let $=N.length-1;0<=$;$--){let j=N[$];if(j&&!O.hasAttribute(j.name)){if(F(j.name,A,"remove",S))continue;A.removeAttribute(j.name)}}R(A,S)||k(A,O,S)}(E===8||E===3)&&_.nodeValue!==C.nodeValue&&(_.nodeValue=C.nodeValue)}function k(_,C,S){if(_ instanceof HTMLInputElement&&C instanceof HTMLInputElement&&C.type!=="file"){let E=C.value,A=_.value;P(_,C,"checked",S),P(_,C,"disabled",S),C.hasAttribute("value")?A!==E&&(F("value",_,"update",S)||(_.setAttribute("value",E),_.value=E)):F("value",_,"remove",S)||(_.value="",_.removeAttribute("value"))}else if(_ instanceof HTMLOptionElement&&C instanceof HTMLOptionElement)P(_,C,"selected",S);else if(_ instanceof HTMLTextAreaElement&&C instanceof HTMLTextAreaElement){let E=C.value,A=_.value;if(F("value",_,"update",S))return;E!==A&&(_.value=E),_.firstChild&&_.firstChild.nodeValue!==E&&(_.firstChild.nodeValue=E)}}function P(_,C,S,E){let A=C[S],O=_[S];if(A!==O){let N=F(S,_,"update",E);N||(_[S]=C[S]),A?N||_.setAttribute(S,""):F(S,_,"remove",E)||_.removeAttribute(S)}}function F(_,C,S,E){return _==="value"&&E.ignoreActiveValue&&C===document.activeElement?!0:E.callbacks.beforeAttributeUpdated(_,C,S)===!1}function R(_,C){return!!C.ignoreActiveValue&&_===document.activeElement&&_!==document.body}return v}();function a(v,b,k,P){if(v.head.block){let F=b.querySelector("head"),R=k.querySelector("head");if(F&&R){let _=l(F,R,v);return Promise.all(_).then(()=>{let C=Object.assign(v,{head:{block:!1,ignore:!0}});return P(C)})}}return P(v)}function l(v,b,k){let P=[],F=[],R=[],_=[],C=new Map;for(let E of b.children)C.set(E.outerHTML,E);for(let E of v.children){let A=C.has(E.outerHTML),O=k.head.shouldReAppend(E),N=k.head.shouldPreserve(E);A||N?O?F.push(E):(C.delete(E.outerHTML),R.push(E)):k.head.style==="append"?O&&(F.push(E),_.push(E)):k.head.shouldRemove(E)!==!1&&F.push(E)}_.push(...C.values());let S=[];for(let E of _){let A=document.createRange().createContextualFragment(E.outerHTML).firstChild;if(k.callbacks.beforeNodeAdded(A)!==!1){if("href"in A&&A.href||"src"in A&&A.src){let O,N=new Promise(function(z){O=z});A.addEventListener("load",function(){O()}),S.push(N)}v.appendChild(A),k.callbacks.afterNodeAdded(A),P.push(A)}}for(let E of F)k.callbacks.beforeNodeRemoved(E)!==!1&&(v.removeChild(E),k.callbacks.afterNodeRemoved(E));return k.head.afterHeadMorphed(v,{added:P,kept:R,removed:F}),S}let u=function(){function v(S,E,A){let{persistentIds:O,idMap:N}=_(S,E),z=b(A),$=z.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes($))throw`Do not understand how to morph style ${$}`;return{target:S,newContent:E,config:z,morphStyle:$,ignoreActive:z.ignoreActive,ignoreActiveValue:z.ignoreActiveValue,restoreFocus:z.restoreFocus,idMap:N,persistentIds:O,pantry:k(),activeElementAndParents:P(S),callbacks:z.callbacks,head:z.head}}function b(S){let E=Object.assign({},e);return Object.assign(E,S),E.callbacks=Object.assign({},e.callbacks,S.callbacks),E.head=Object.assign({},e.head,S.head),E}function k(){let S=document.createElement("div");return S.hidden=!0,document.body.insertAdjacentElement("afterend",S),S}function P(S){let E=[],A=document.activeElement;if(A?.tagName!=="BODY"&&S.contains(A))for(;A&&(E.push(A),A!==S);)A=A.parentElement;return E}function F(S){let E=Array.from(S.querySelectorAll("[id]"));return S.getAttribute?.("id")&&E.push(S),E}function R(S,E,A,O){for(let N of O){let z=N.getAttribute("id");if(E.has(z)){let $=N;for(;$;){let j=S.get($);if(j==null&&(j=new Set,S.set($,j)),j.add(z),$===A)break;$=$.parentElement}}}}function _(S,E){let A=F(S),O=F(E),N=C(A,O),z=new Map;R(z,N,S,A);let $=E.__idiomorphRoot||E;return R(z,N,$,O),{persistentIds:N,idMap:z}}function C(S,E){let A=new Set,O=new Map;for(let{id:z,tagName:$}of S)O.has(z)?A.add(z):O.set(z,$);let N=new Set;for(let{id:z,tagName:$}of E)N.has(z)?A.add(z):O.get(z)===$&&N.add(z);for(let z of A)N.delete(z);return N}return v}(),{normalizeElement:f,normalizeParent:m}=function(){let v=new WeakSet;function b(R){return R instanceof Document?R.documentElement:R}function k(R){if(R==null)return document.createElement("div");if(typeof R=="string")return k(F(R));if(v.has(R))return R;if(R instanceof Node){if(R.parentNode)return new P(R);{let _=document.createElement("div");return _.append(R),_}}else{let _=document.createElement("div");for(let C of[...R])_.append(C);return _}}class P{constructor(_){this.originalNode=_,this.realParentNode=_.parentNode,this.previousSibling=_.previousSibling,this.nextSibling=_.nextSibling}get childNodes(){let _=[],C=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;C&&C!=this.nextSibling;)_.push(C),C=C.nextSibling;return _}querySelectorAll(_){return this.childNodes.reduce((C,S)=>{if(S instanceof Element){S.matches(_)&&C.push(S);let E=S.querySelectorAll(_);for(let A=0;A<E.length;A++)C.push(E[A])}return C},[])}insertBefore(_,C){return this.realParentNode.insertBefore(_,C)}moveBefore(_,C){return this.realParentNode.moveBefore(_,C)}get __idiomorphRoot(){return this.originalNode}}function F(R){let _=new DOMParser,C=R.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(C.match(/<\/html>/)||C.match(/<\/head>/)||C.match(/<\/body>/)){let S=_.parseFromString(R,"text/html");if(C.match(/<\/html>/))return v.add(S),S;{let E=S.firstChild;return E&&v.add(E),E}}else{let E=_.parseFromString("<body><template>"+R+"</template></body>","text/html").body.querySelector("template").content;return v.add(E),E}}return{normalizeElement:b,normalizeParent:k}}();return{morph:t,defaults:e}}();function Wn(i,e,{callbacks:t,...r}={}){Mb.morph(i,e,{...r,callbacks:new Xa(t)})}function kl(i,e,t={}){Wn(i,e.childNodes,{...t,morphStyle:"innerHTML"})}function Uu(i,e){return i instanceof Rt&&i.shouldReloadWithMorph&&(!e||Lb(i,e))&&!i.closest("[data-turbo-permanent]")}function Lb(i,e){return e instanceof Element&&e.nodeName==="TURBO-FRAME"&&i.id===e.id&&(!e.getAttribute("src")||Ru(i.src,e.getAttribute("src")))}function zu(i){return i.parentElement.closest("turbo-frame[src][refresh=morph]")}var Xa=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!ve("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!ve("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&ve("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},$n=class extends ps{static renderElement(e,t){ve("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),kl(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>Uu(r,s)&&zu(r)===e?(r.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},Ya=class i{static animationDuration=300;static get defaultCSS(){return ku`
4
+ `)}function ob(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function Ni(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join("")}function Hn(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function ab(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function jn(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function qn(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function lb(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function Ph(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function cb(i){return i=="advance"||i=="replace"||i=="restore"}function ir(...i){let e=Hn("data-turbo-action",...i);return cb(e)?e:null}function Al(i){return document.querySelector(`meta[name="${i}"]`)}function $n(i){let e=Al(i);return e&&e.content}function Oh(){let i=Al("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function ub(i,e){let t=Al(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function Rr(i,e){if(i instanceof Element)return i.closest(e)||Rr(i.assignedSlot||i.getRootNode()?.host,e)}function Cl(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function Rh(i){return Array.from(i.querySelectorAll("[autofocus]")).find(Cl)}async function hb(i,e){let t=e();i(),await _h();let r=e();return[t,r]}function Mh(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Lh(i){let e=Rr(i,"a[href], a[xlink\\:href]");if(!e||e.href.startsWith("#")||e.hasAttribute("download"))return null;let t=e.getAttribute("target");return t&&t!=="_self"?null:e}function db(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var pb={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",wh)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",wh)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},Za=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=pb[e]||e}},fb=new Za({mode:"on",submitter:"disabled"}),We={drive:rb,forms:fb};function Qe(i){return new URL(i.toString(),document.baseURI)}function vs(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function Fl(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return Qe(t)}function mb(i){return(vb(i).match(/\.[^.]*$/)||[])[0]||""}function gb(i,e){let t=Sh(e.origin+e.pathname);return Sh(i.href)===t||i.href.startsWith(t)}function Di(i,e){return gb(i,e)&&!We.drive.unvisitableExtensions.has(mb(i))}function Ih(i){return Qe(i.getAttribute("href")||"")}function bb(i){let e=vs(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function zn(i){return bb(i)}function Dh(i,e){return Qe(i).href==Qe(e).href}function yb(i){return i.pathname.split("/").slice(1)}function vb(i){return yb(i).slice(-1)[0]}function Sh(i){return i.endsWith("/")?i:i+"/"}var Ss=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Qe(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},Qa=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Nh=new Qa(20);function Bh(i,e={}){let t=new Headers(e.headers||{}),r=Ni();return Nh.add(r),t.append("X-Turbo-Request-Id",r),window.fetch(i,{...e,headers:t})}function Pl(i){switch(i.toLowerCase()){case"get":return Ht.get;case"post":return Ht.post;case"put":return Ht.put;case"patch":return Ht.patch;case"delete":return Ht.delete}}var Ht={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function wb(i){switch(i.toLowerCase()){case tr.multipart:return tr.multipart;case tr.plain:return tr.plain;default:return tr.urlEncoded}}var tr={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},rr=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=tr.urlEncoded){let[a,l]=Eh(Qe(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Pl(e)||Ht.get;this.url.search="";let[s,n]=Eh(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Bh(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Ss(e);return ve("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Ol(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=ve("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!ve("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Ol(i){return Pl(i)==Ht.get}function Eh(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(Uh(t)):i.searchParams;return Ol(e)?[Sb(i,s),null]:r==tr.urlEncoded?[i,s]:[i,t]}function Uh(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function Sb(i,e){let t=new URLSearchParams(Uh(e));return i.search=t.toString(),i}var Ja=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},Bi=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(nb(e)):e}constructor(e){this.fragment=Eb(e)}};function Eb(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(ws(r));e.replaceWith(t)}return i}var Tb=i=>i,Vn=class{keys=[];entries={};#e;constructor(e,t=Tb){this.size=e,this.#e=t}has(e){return this.#e(e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[this.#e(e)]}write(e,t){this.entries[this.#e(e)]=t}touch(e){e=this.#e(e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},xb=100,el=class extends Vn{#e=null;#t={};constructor(e=1,t=xb){super(e,zn),this.prefetchDelay=t}putLater(e,t,r){this.#e=setTimeout(()=>{t.perform(),this.put(e,t,r),this.#e=null},this.prefetchDelay)}put(e,t,r=zh){super.put(e,t),this.#t[zn(e)]=new Date(new Date().getTime()+r)}clear(){super.clear(),this.#e&&clearTimeout(this.#e)}evict(e){super.evict(e),delete this.#t[e]}has(e){if(super.has(e)){let t=this.#t[zn(e)];return t&&t>Date.now()}else return!1}},zh=10*1e3,Or=new el,Fr={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Wn=class i{state=Fr.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=Pb(t,r),o=Fb(Cb(t,r),n),a=kb(t,r),l=Ob(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new rr(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=Qe(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Fr,r=Hn("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof We.forms.confirm=="function"?We.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Fr;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=_b($n("csrf-param"))||$n("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Bi.contentType)}requestStarted(e){this.state=Fr.waiting,this.submitter&&We.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),jn(this.formElement),ve("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Or.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Or.clear(),this.requestMustRedirect(e)&&Ab(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Fr.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Fr.stopped,this.submitter&&We.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),qn(this.formElement),ve("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||ab("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function kb(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function _b(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Ab(i){return i.statusCode==200&&!i.redirected}function Cb(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function Fb(i,e){let t=Qe(i);return Ol(e)&&(t.search=""),t}function Pb(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return Pl(t.toLowerCase())||Ht.get}function Ob(i,e){return wb(e?.getAttribute("formenctype")||i.enctype)}var Lr=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Rh(this.element)}get permanentElements(){return jh(this.element)}getPermanentElementById(e){return Hh(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function Hh(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function jh(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var Es=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Rb(t,r)&&Mb(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Rb(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function Mb(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return Mh(t)}var Gn=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(vs(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(f=>this.#e=f),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(f=>this.#t=f),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},tl=class extends Gn{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Lr(this.element)}},Kn=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=Lh(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},Xn=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Lh(t);if(r&&Mh(r.target)){let s=Ih(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},Yn=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Xn(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[m,w]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:m,value:w}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=ir(e);l&&r.setAttribute("data-turbo-action",l);let h=e.getAttribute("data-turbo-confirm");h&&r.setAttribute("data-turbo-confirm",h),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},Zn=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Lb(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Lb(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var Ts=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Zn.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},xs=class extends Ts{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await ys(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await ys(),this.focusFirstAutofocusableElement(),await ys(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Ib(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Db(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=ws(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Ib(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function Db(i,e){return i=="auto"||i=="smooth"?i:e}var Nb=(function(){let i=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:w=>w.getAttribute("im-preserve")==="true",shouldReAppend:w=>w.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function t(w,y,k={}){w=f(w);let C=m(y),O=h(w,C,k),R=s(O,()=>a(O,w,C,_=>_.morphStyle==="innerHTML"?(n(_,w,C),Array.from(w.childNodes)):r(_,w,C)));return O.pantry.remove(),R}function r(w,y,k){let C=m(y);return n(w,C,k,y,y.nextSibling),Array.from(C.childNodes)}function s(w,y){if(!w.config.restoreFocus)return y();let k=document.activeElement;if(!(k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement))return y();let{id:C,selectionStart:O,selectionEnd:R}=k,_=y();return C&&C!==document.activeElement?.getAttribute("id")&&(k=w.target.querySelector(`[id="${C}"]`),k?.focus()),k&&!k.selectionEnd&&R&&k.setSelectionRange(O,R),_}let n=(function(){function w(x,S,A,P=null,N=null){S instanceof HTMLTemplateElement&&A instanceof HTMLTemplateElement&&(S=S.content,A=A.content),P||=S.firstChild;for(let z of A.childNodes){if(P&&P!=N){let $=k(x,z,P,N);if($){$!==P&&O(x,P,$),o($,z,x),P=$.nextSibling;continue}}if(z instanceof Element){let $=z.getAttribute("id");if(x.persistentIds.has($)){let Z=R(S,$,P,x);o(Z,z,x),P=Z.nextSibling;continue}}let q=y(S,z,P,x);q&&(P=q.nextSibling)}for(;P&&P!=N;){let z=P;P=P.nextSibling,C(x,z)}}function y(x,S,A,P){if(P.callbacks.beforeNodeAdded(S)===!1)return null;if(P.idMap.has(S)){let N=document.createElement(S.tagName);return x.insertBefore(N,A),o(N,S,P),P.callbacks.afterNodeAdded(N),N}else{let N=document.importNode(S,!0);return x.insertBefore(N,A),P.callbacks.afterNodeAdded(N),N}}let k=(function(){function x(P,N,z,q){let $=null,Z=N.nextSibling,K=0,ie=z;for(;ie&&ie!=q;){if(A(ie,N)){if(S(P,ie,N))return ie;$===null&&(P.idMap.has(ie)||($=ie))}if($===null&&Z&&A(ie,Z)&&(K++,Z=Z.nextSibling,K>=2&&($=void 0)),P.activeElementAndParents.includes(ie))break;ie=ie.nextSibling}return $||null}function S(P,N,z){let q=P.idMap.get(N),$=P.idMap.get(z);if(!$||!q)return!1;for(let Z of q)if($.has(Z))return!0;return!1}function A(P,N){let z=P,q=N;return z.nodeType===q.nodeType&&z.tagName===q.tagName&&(!z.getAttribute?.("id")||z.getAttribute?.("id")===q.getAttribute?.("id"))}return x})();function C(x,S){if(x.idMap.has(S))F(x.pantry,S,null);else{if(x.callbacks.beforeNodeRemoved(S)===!1)return;S.parentNode?.removeChild(S),x.callbacks.afterNodeRemoved(S)}}function O(x,S,A){let P=S;for(;P&&P!==A;){let N=P;P=P.nextSibling,C(x,N)}return P}function R(x,S,A,P){let N=P.target.getAttribute?.("id")===S&&P.target||P.target.querySelector(`[id="${S}"]`)||P.pantry.querySelector(`[id="${S}"]`);return _(N,P),F(x,N,A),N}function _(x,S){let A=x.getAttribute("id");for(;x=x.parentNode;){let P=S.idMap.get(x);P&&(P.delete(A),P.size||S.idMap.delete(x))}}function F(x,S,A){if(x.moveBefore)try{x.moveBefore(S,A)}catch{x.insertBefore(S,A)}else x.insertBefore(S,A)}return w})(),o=(function(){function w(_,F,x){return x.ignoreActive&&_===document.activeElement?null:(x.callbacks.beforeNodeMorphed(_,F)===!1||(_ instanceof HTMLHeadElement&&x.head.ignore||(_ instanceof HTMLHeadElement&&x.head.style!=="morph"?l(_,F,x):(y(_,F,x),R(_,x)||n(x,_,F))),x.callbacks.afterNodeMorphed(_,F)),_)}function y(_,F,x){let S=F.nodeType;if(S===1){let A=_,P=F,N=A.attributes,z=P.attributes;for(let q of z)O(q.name,A,"update",x)||A.getAttribute(q.name)!==q.value&&A.setAttribute(q.name,q.value);for(let q=N.length-1;0<=q;q--){let $=N[q];if($&&!P.hasAttribute($.name)){if(O($.name,A,"remove",x))continue;A.removeAttribute($.name)}}R(A,x)||k(A,P,x)}(S===8||S===3)&&_.nodeValue!==F.nodeValue&&(_.nodeValue=F.nodeValue)}function k(_,F,x){if(_ instanceof HTMLInputElement&&F instanceof HTMLInputElement&&F.type!=="file"){let S=F.value,A=_.value;C(_,F,"checked",x),C(_,F,"disabled",x),F.hasAttribute("value")?A!==S&&(O("value",_,"update",x)||(_.setAttribute("value",S),_.value=S)):O("value",_,"remove",x)||(_.value="",_.removeAttribute("value"))}else if(_ instanceof HTMLOptionElement&&F instanceof HTMLOptionElement)C(_,F,"selected",x);else if(_ instanceof HTMLTextAreaElement&&F instanceof HTMLTextAreaElement){let S=F.value,A=_.value;if(O("value",_,"update",x))return;S!==A&&(_.value=S),_.firstChild&&_.firstChild.nodeValue!==S&&(_.firstChild.nodeValue=S)}}function C(_,F,x,S){let A=F[x],P=_[x];if(A!==P){let N=O(x,_,"update",S);N||(_[x]=F[x]),A?N||_.setAttribute(x,""):O(x,_,"remove",S)||_.removeAttribute(x)}}function O(_,F,x,S){return _==="value"&&S.ignoreActiveValue&&F===document.activeElement?!0:S.callbacks.beforeAttributeUpdated(_,F,x)===!1}function R(_,F){return!!F.ignoreActiveValue&&_===document.activeElement&&_!==document.body}return w})();function a(w,y,k,C){if(w.head.block){let O=y.querySelector("head"),R=k.querySelector("head");if(O&&R){let _=l(O,R,w);return Promise.all(_).then(()=>{let F=Object.assign(w,{head:{block:!1,ignore:!0}});return C(F)})}}return C(w)}function l(w,y,k){let C=[],O=[],R=[],_=[],F=new Map;for(let S of y.children)F.set(S.outerHTML,S);for(let S of w.children){let A=F.has(S.outerHTML),P=k.head.shouldReAppend(S),N=k.head.shouldPreserve(S);A||N?P?O.push(S):(F.delete(S.outerHTML),R.push(S)):k.head.style==="append"?P&&(O.push(S),_.push(S)):k.head.shouldRemove(S)!==!1&&O.push(S)}_.push(...F.values());let x=[];for(let S of _){let A=document.createRange().createContextualFragment(S.outerHTML).firstChild;if(k.callbacks.beforeNodeAdded(A)!==!1){if("href"in A&&A.href||"src"in A&&A.src){let P,N=new Promise(function(z){P=z});A.addEventListener("load",function(){P()}),x.push(N)}w.appendChild(A),k.callbacks.afterNodeAdded(A),C.push(A)}}for(let S of O)k.callbacks.beforeNodeRemoved(S)!==!1&&(w.removeChild(S),k.callbacks.afterNodeRemoved(S));return k.head.afterHeadMorphed(w,{added:C,kept:R,removed:O}),x}let h=(function(){function w(x,S,A){let{persistentIds:P,idMap:N}=_(x,S),z=y(A),q=z.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(q))throw`Do not understand how to morph style ${q}`;return{target:x,newContent:S,config:z,morphStyle:q,ignoreActive:z.ignoreActive,ignoreActiveValue:z.ignoreActiveValue,restoreFocus:z.restoreFocus,idMap:N,persistentIds:P,pantry:k(),activeElementAndParents:C(x),callbacks:z.callbacks,head:z.head}}function y(x){let S=Object.assign({},e);return Object.assign(S,x),S.callbacks=Object.assign({},e.callbacks,x.callbacks),S.head=Object.assign({},e.head,x.head),S}function k(){let x=document.createElement("div");return x.hidden=!0,document.body.insertAdjacentElement("afterend",x),x}function C(x){let S=[],A=document.activeElement;if(A?.tagName!=="BODY"&&x.contains(A))for(;A&&(S.push(A),A!==x);)A=A.parentElement;return S}function O(x){let S=Array.from(x.querySelectorAll("[id]"));return x.getAttribute?.("id")&&S.push(x),S}function R(x,S,A,P){for(let N of P){let z=N.getAttribute("id");if(S.has(z)){let q=N;for(;q;){let $=x.get(q);if($==null&&($=new Set,x.set(q,$)),$.add(z),q===A)break;q=q.parentElement}}}}function _(x,S){let A=O(x),P=O(S),N=F(A,P),z=new Map;R(z,N,x,A);let q=S.__idiomorphRoot||S;return R(z,N,q,P),{persistentIds:N,idMap:z}}function F(x,S){let A=new Set,P=new Map;for(let{id:z,tagName:q}of x)P.has(z)?A.add(z):P.set(z,q);let N=new Set;for(let{id:z,tagName:q}of S)N.has(z)?A.add(z):P.get(z)===q&&N.add(z);for(let z of A)N.delete(z);return N}return w})(),{normalizeElement:f,normalizeParent:m}=(function(){let w=new WeakSet;function y(R){return R instanceof Document?R.documentElement:R}function k(R){if(R==null)return document.createElement("div");if(typeof R=="string")return k(O(R));if(w.has(R))return R;if(R instanceof Node){if(R.parentNode)return new C(R);{let _=document.createElement("div");return _.append(R),_}}else{let _=document.createElement("div");for(let F of[...R])_.append(F);return _}}class C{constructor(_){this.originalNode=_,this.realParentNode=_.parentNode,this.previousSibling=_.previousSibling,this.nextSibling=_.nextSibling}get childNodes(){let _=[],F=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;F&&F!=this.nextSibling;)_.push(F),F=F.nextSibling;return _}querySelectorAll(_){return this.childNodes.reduce((F,x)=>{if(x instanceof Element){x.matches(_)&&F.push(x);let S=x.querySelectorAll(_);for(let A=0;A<S.length;A++)F.push(S[A])}return F},[])}insertBefore(_,F){return this.realParentNode.insertBefore(_,F)}moveBefore(_,F){return this.realParentNode.moveBefore(_,F)}get __idiomorphRoot(){return this.originalNode}}function O(R){let _=new DOMParser,F=R.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(F.match(/<\/html>/)||F.match(/<\/head>/)||F.match(/<\/body>/)){let x=_.parseFromString(R,"text/html");if(F.match(/<\/html>/))return w.add(x),x;{let S=x.firstChild;return S&&w.add(S),S}}else{let S=_.parseFromString("<body><template>"+R+"</template></body>","text/html").body.querySelector("template").content;return w.add(S),S}}return{normalizeElement:y,normalizeParent:k}})();return{morph:t,defaults:e}})();function eo(i,e,{callbacks:t,...r}={}){Nb.morph(i,e,{...r,callbacks:new il(t)})}function Rl(i,e,t={}){eo(i,e.childNodes,{...t,morphStyle:"innerHTML"})}function qh(i,e){return i instanceof jt&&i.shouldReloadWithMorph&&(!e||Bb(i,e))&&!i.closest("[data-turbo-permanent]")}function Bb(i,e){return e instanceof Element&&e.nodeName==="TURBO-FRAME"&&i.id===e.id&&(!e.getAttribute("src")||Dh(i.src,e.getAttribute("src")))}function $h(i){return i.parentElement.closest("turbo-frame[src][refresh=morph]")}var il=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!ve("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!ve("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&ve("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},Qn=class extends xs{static renderElement(e,t){ve("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Rl(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>qh(r,s)&&$h(r)===e?(r.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},rl=class i{static animationDuration=300;static get defaultCSS(){return Fh`
5
5
  .turbo-progress-bar {
6
6
  position: fixed;
7
7
  display: block;
@@ -15,7 +15,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
15
15
  opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in;
16
16
  transform: translate3d(0, 0, 0);
17
17
  }
18
- `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Au();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},Za=class extends Cr{detailsByOuterHTML=this.children.filter(e=>!Bb(e)).map(e=>Hb(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:Ib(t),tracked:Db(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return zb(s,e)?s:t},void 0|void 0)}};function Ib(i){if(Nb(i))return"script";if(Ub(i))return"stylesheet"}function Db(i){return i.getAttribute("data-turbo-track")=="reload"}function Nb(i){return i.localName=="script"}function Bb(i){return i.localName=="noscript"}function Ub(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function zb(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Hb(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var jt=class i extends Cr{static fromHTMLString(e=""){return this.fromDocument(xu(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new Za(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Xe(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Qa=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},jb={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},On={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},vi={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Ar={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},qb={advance:"forward",restore:"back",replace:"none"},Ja=class{identifier=Ri();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=vi.initialized;viewTransitioner=new Qa;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Ri();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:u,response:f,visitCachedSnapshot:m,willRender:v,updateHistory:b,shouldCacheSnapshot:k,acceptsStreamResponse:P,direction:F,refresh:R}={...jb,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=u,this.response=f,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=v,this.updateHistory=b,this.scrolled=!v,this.shouldCacheSnapshot=k,this.acceptsStreamResponse=P,this.direction=F||qb[n],this.refresh=R}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==vi.initialized&&(this.recordTimingMetric(On.visitStart),this.state=vi.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==vi.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=vi.canceled)}complete(){this.state==vi.started&&(this.recordTimingMetric(On.visitEnd),this.adapter.visitCompleted(this),this.state=vi.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==vi.started&&(this.state=vi.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=_u(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Ji(this,Ot.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(On.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;vu(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(On.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,vu(e)&&t!=null){let r=jt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(jt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ls(this.location)||e.hasAnchor(ls(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return jt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Mi.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Ar.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Ar.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Ar.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=ls(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function vu(i){return i>=200&&i<300}var el=class{progressBar=new Ya;constructor(e){this.session=e}visitProposedToLocation(e,t){Oi(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Ri(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Ar.networkFailure:case Ar.timeoutFailure:case Ar.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){ve("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},tl=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},il=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new zn(this,t),this.formSubmitObserver=new us(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=El(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Xe(s?.content??"/");return this.#t(e,t)&&Oi(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof Rt)return s}}},rl=class{location;restorationIdentifier=Ri();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Ri()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},sl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!0};#i=e=>{if(Dn("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=Ou(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new Ji(this,Ot.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",kr.putLater(n,o,this.#s)}}};#r=e=>{e.target===this.#e&&this.#n()};#n=()=>{kr.clear(),this.#e=null};#o=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=kr.get(e.detail.url);t&&(e.detail.fetchRequest=t),kr.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#s(){return Number(Dn("turbo-prefetch-cache-time"))||Du}#l(e){return!(!e.getAttribute("href")||$b(e)||Vb(e)||Wb(e)||Gb(e)||Xb(e))}},$b=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Vb=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Wb=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=_r(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Gb=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||Kb(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Kb=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Xb=i=>ve("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,nl=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new Ja(this,Xe(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Bn(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=jt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return Qi(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Yi={initial:0,loading:1,interactive:2,complete:3},ol=class{stage=Yi.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Yi.initial&&(this.stage=Yi.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Yi.loading&&(this.stage=Yi.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Yi.interactive&&(this.stage=Yi.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},al=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},ll=class{render({fragment:e}){qn.preservingPermanentElements(this,Yb(e),()=>{Zb(e,()=>{Qb(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Yb(i){let e=Bu(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=Nu(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function Zb(i,e){let t=`turbo-stream-autofocus-${Ri()}`,r=i.querySelectorAll("turbo-stream"),s=Jb(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await as(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Sl(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function Qb(i){let[e,t]=await ab(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Sl(s)&&s!=t&&s.focus()}}function Jb(i){for(let e of i){let t=Cu(e.templateElement.content);if(t)return t}return null}var cl=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=ey(e);t&&ty(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Mi.wrap(e))}};function ey(i){let e=i.detail?.fetchResponse;if(e instanceof hs)return e}function ty(i){return(i.contentType??"").startsWith(Mi.contentType)}var hl=class extends ds{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=cs(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},fs=class extends ds{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(sb(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(cs(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=cs(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},Vn=class extends fs{static renderElement(e,t){Wn(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>Uu(r,s)&&!zu(r)?(r.reload(),!1):!0}}),ve("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},ul=class extends Nn{constructor(e){super(e,Rn)}get snapshots(){return this.entries}},dl=class extends Un{snapshotCache=new ul(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?Vn:fs,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new hl(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Tu();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return jt.fromElement(this.element)}},pl=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Ji(this,Ot.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=jt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},fl=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){ob("turbo-cache-control",e)}},ml=class{navigator=new nl(this);history=new rl(this);view=new dl(this,document.documentElement);adapter=new el(this);pageObserver=new ol(this);cacheObserver=new tl;linkPrefetchObserver=new sl(this,document);linkClickObserver=new Hn(this,window);formSubmitObserver=new us(this,document);scrollObserver=new al(this);streamObserver=new cl(this);formLinkClickObserver=new jn(this,document.documentElement);frameRedirector=new il(this,document.documentElement);streamMessageRenderer=new ll;cache=new fl(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new pl(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof Rt){let s=t.action||Qi(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Xe(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Mi.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){$e.drive.progressBarDelay=e}get progressBarDelay(){return $e.drive.progressBarDelay}set drive(e){$e.drive.enabled=e}get drive(){return $e.drive.enabled}set formMode(e){$e.forms.mode=e}get formMode(){return $e.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=lb(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||_r(e,"turbo-frame:not([disabled])");if(t||r||n instanceof Rt)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Oi(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Oi(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Oi(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&Oi(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){wu(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Ln(document.documentElement),this.view.markVisitDirection(e.direction)),wu(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),In(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=El(e,t);return this.submissionIsNavigatable(e,t)&&Oi(Xe(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return ve("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return ve("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return ve("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return ve("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return ve("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return ve("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return ve("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return ve("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return ve("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if($e.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return $e.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=_r(e,"[data-turbo]"),r=_r(e,"turbo-frame");return $e.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Qi(e)||"advance"}get snapshot(){return this.view.snapshot}};function wu(i){Object.defineProperties(i,iy)}var iy={absoluteURL:{get(){return this.toString()}}},Re=new ml(Mu),{cache:ry,navigator:sy}=Re;function Hu(){Re.start()}function ny(i){Re.registerAdapter(i)}function oy(i,e){Re.visit(i,e)}function ju(i){Re.connectStreamSource(i)}function qu(i){Re.disconnectStreamSource(i)}function ay(i){Re.renderStreamMessage(i)}function ly(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.drive.progressBarDelay=i}function cy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.forms.confirm=i}function hy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.forms.mode=i}function uy(i,e){Vn.renderElement(i,e)}function dy(i,e){$n.renderElement(i,e)}var py=Object.freeze({__proto__:null,navigator:sy,session:Re,cache:ry,PageRenderer:fs,PageSnapshot:jt,FrameRenderer:ps,fetch:Lu,config:$e,start:Hu,registerAdapter:ny,visit:oy,connectStreamSource:ju,disconnectStreamSource:qu,renderStreamMessage:ay,setProgressBarDelay:ly,setConfirmMethod:cy,setFormMode:hy,morphBodyElements:uy,morphTurboFrameElements:dy,morphChildren:kl,morphElements:Wn}),gl=class extends Error{},bl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#n=new Set;#o=!1;action=null;constructor(e){this.element=e,this.view=new Ka(this,this.element),this.appearanceObserver=new Wa(this,this.element),this.formLinkClickObserver=new jn(this,this.element),this.linkInterceptor=new zn(this,this.element),this.restorationIdentifier=Ri(),this.formSubmitObserver=new us(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==xr.lazy?this.appearanceObserver.start():this.#s(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==xr.eager&&this.#s()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==xr.eager||this.#r)&&this.#s())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#o=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==xr.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#s())}async#s(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(Xe(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=xu(t);jt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#o=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,Qi(e)),this.#s()}willSubmitFormLinkToLocation(e){return this.#b(e)}submittedFormLinkToLocation(e,t,r){let s=this.#d(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#b(e)}linkClickIntercepted(e,t){this.#f(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#b(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Bn(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#d(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Mi.contentType)}requestStarted(e){Ln(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){In(this.element)}formSubmissionStarted({formElement:e}){Ln(e,this.#d(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#d(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,Qi(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Re.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Re.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){In(e,this.#d(e))}allowsImmediateRender({element:e},t){let r=ve("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Re.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#o?$n:ps;if(r){let n=new Cr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Re.frameRendered(e,this.element),Re.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#u(e)&&this.#h(e)}async#a(e){let t=new Ji(this,Ot.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#f(e,t,r){let s=this.#d(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,Qi(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=jt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,f={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(f.action=this.action),Re.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=_u(this.action);Re.history.update(e,Xe(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#g(e.response)}#u(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#g(n):Re.visit(n,o)};return!ve("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#h(e){this.view.missing(),this.#p(e)}#p(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new gl(t)}async#g(e){let t=new hs(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Re.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#d(e,t){let r=Mn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#m(r);return s instanceof Rt?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Su(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Su(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new Rt}return null}#w(e,t){let r=El(e,t);return Oi(Xe(r),this.rootLocation)}#b(e,t){let r=Mn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#w(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#m(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Re.elementIsNavigatable(e)||t&&!Re.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Xe(t)}#y(e){return this.#n.has(e)}#T(e,t){this.#n.add(e),t(),this.#n.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#m(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof Rt)return t}}};function Su(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Ru(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof Rt)return i.connectedCallback(),i.disconnectedCallback(),i}}var $u={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Wn(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?kl(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Re.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},yl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await as(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=$u[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},vl=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),ju(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),qu(this.streamSource))}get src(){return this.getAttribute("src")||""}};Rt.delegateConstructor=bl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",Rt);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",yl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",vl);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(ku`
18
+ `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Oh();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},sl=class extends Lr{detailsByOuterHTML=this.children.filter(e=>!jb(e)).map(e=>Vb(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:Ub(t),tracked:zb(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return $b(s,e)?s:t},void 0|void 0)}};function Ub(i){if(Hb(i))return"script";if(qb(i))return"stylesheet"}function zb(i){return i.getAttribute("data-turbo-track")=="reload"}function Hb(i){return i.localName=="script"}function jb(i){return i.localName=="noscript"}function qb(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function $b(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Vb(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Zt=class i extends Lr{static fromHTMLString(e=""){return this.fromDocument(Ch(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new sl(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Qe(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},nl=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Wb={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},Un={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},vi={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Mr={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Gb={advance:"forward",restore:"back",replace:"none"},ol=class{identifier=Ni();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=vi.initialized;viewTransitioner=new nl;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Ni();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:h,response:f,visitCachedSnapshot:m,willRender:w,updateHistory:y,shouldCacheSnapshot:k,acceptsStreamResponse:C,direction:O,refresh:R}={...Wb,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=h,this.response=f,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=w,this.updateHistory=y,this.scrolled=!w,this.shouldCacheSnapshot=k,this.acceptsStreamResponse=C,this.direction=O||Gb[n],this.refresh=R}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==vi.initialized&&(this.recordTimingMetric(Un.visitStart),this.state=vi.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==vi.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=vi.canceled)}complete(){this.state==vi.started&&(this.recordTimingMetric(Un.visitEnd),this.adapter.visitCompleted(this),this.state=vi.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==vi.started&&(this.state=vi.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Ph(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new rr(this,Ht.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Un.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Th(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Un.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Th(e)&&t!=null){let r=Zt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Zt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!vs(this.location)||e.hasAnchor(vs(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Zt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Bi.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Mr.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Mr.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Mr.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=vs(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Th(i){return i>=200&&i<300}var al=class{progressBar=new rl;constructor(e){this.session=e}visitProposedToLocation(e,t){Di(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Ni(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Mr.networkFailure:case Mr.timeoutFailure:case Mr.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){ve("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},ll=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},cl=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Kn(this,t),this.formSubmitObserver=new Es(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Fl(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Qe(s?.content??"/");return this.#t(e,t)&&Di(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof jt)return s}}},ul=class{location;restorationIdentifier=Ni();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Ni()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},hl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!0};#i=e=>{if($n("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=Ih(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new rr(this,Ht.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",Or.putLater(n,o,this.#n)}}};#r=e=>{e.target===this.#e&&this.#s()};#s=()=>{Or.clear(),this.#e=null};#o=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Or.get(e.detail.url);t&&(e.detail.fetchRequest=t),Or.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#n(){return Number($n("turbo-prefetch-cache-time"))||zh}#l(e){return!(!e.getAttribute("href")||Kb(e)||Xb(e)||Yb(e)||Zb(e)||Jb(e))}},Kb=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Xb=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Yb=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=Rr(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Zb=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||Qb(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Qb=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Jb=i=>ve("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,dl=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new ol(this,Qe(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Wn(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=Zt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return ir(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},er={initial:0,loading:1,interactive:2,complete:3},pl=class{stage=er.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==er.initial&&(this.stage=er.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==er.loading&&(this.stage=er.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==er.interactive&&(this.stage=er.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},fl=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},ml=class{render({fragment:e}){Zn.preservingPermanentElements(this,ey(e),()=>{ty(e,()=>{iy(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function ey(i){let e=jh(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=Hh(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function ty(i,e){let t=`turbo-stream-autofocus-${Ni()}`,r=i.querySelectorAll("turbo-stream"),s=ry(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await ys(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Cl(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function iy(i){let[e,t]=await hb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Cl(s)&&s!=t&&s.focus()}}function ry(i){for(let e of i){let t=Rh(e.templateElement.content);if(t)return t}return null}var gl=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=sy(e);t&&ny(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Bi.wrap(e))}};function sy(i){let e=i.detail?.fetchResponse;if(e instanceof Ss)return e}function ny(i){return(i.contentType??"").startsWith(Bi.contentType)}var bl=class extends Ts{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=ws(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ks=class extends Ts{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(lb(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(ws(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=ws(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},Jn=class extends ks{static renderElement(e,t){eo(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>qh(r,s)&&!$h(r)?(r.reload(),!1):!0}}),ve("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},yl=class extends Vn{constructor(e){super(e,zn)}get snapshots(){return this.entries}},vl=class extends Gn{snapshotCache=new yl(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?Jn:ks,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new bl(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Ah();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return Zt.fromElement(this.element)}},wl=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new rr(this,Ht.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=Zt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},Sl=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){ub("turbo-cache-control",e)}},El=class{navigator=new dl(this);history=new ul(this);view=new vl(this,document.documentElement);adapter=new al(this);pageObserver=new pl(this);cacheObserver=new ll;linkPrefetchObserver=new hl(this,document);linkClickObserver=new Xn(this,window);formSubmitObserver=new Es(this,document);scrollObserver=new fl(this);streamObserver=new gl(this);formLinkClickObserver=new Yn(this,document.documentElement);frameRedirector=new cl(this,document.documentElement);streamMessageRenderer=new ml;cache=new Sl(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new wl(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof jt){let s=t.action||ir(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Qe(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Bi.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){We.drive.progressBarDelay=e}get progressBarDelay(){return We.drive.progressBarDelay}set drive(e){We.drive.enabled=e}get drive(){return We.drive.enabled}set formMode(e){We.forms.mode=e}get formMode(){return We.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=db(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||Rr(e,"turbo-frame:not([disabled])");if(t||r||n instanceof jt)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Di(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Di(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Di(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&Di(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){xh(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(jn(document.documentElement),this.view.markVisitDirection(e.direction)),xh(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),qn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Fl(e,t);return this.submissionIsNavigatable(e,t)&&Di(Qe(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return ve("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return ve("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return ve("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return ve("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return ve("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return ve("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return ve("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return ve("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return ve("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(We.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return We.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Rr(e,"[data-turbo]"),r=Rr(e,"turbo-frame");return We.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return ir(e)||"advance"}get snapshot(){return this.view.snapshot}};function xh(i){Object.defineProperties(i,oy)}var oy={absoluteURL:{get(){return this.toString()}}},Le=new El(Nh),{cache:ay,navigator:ly}=Le;function Vh(){Le.start()}function cy(i){Le.registerAdapter(i)}function uy(i,e){Le.visit(i,e)}function Wh(i){Le.connectStreamSource(i)}function Gh(i){Le.disconnectStreamSource(i)}function hy(i){Le.renderStreamMessage(i)}function dy(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.drive.progressBarDelay=i}function py(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.confirm=i}function fy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.mode=i}function my(i,e){Jn.renderElement(i,e)}function gy(i,e){Qn.renderElement(i,e)}var by=Object.freeze({__proto__:null,navigator:ly,session:Le,cache:ay,PageRenderer:ks,PageSnapshot:Zt,FrameRenderer:xs,fetch:Bh,config:We,start:Vh,registerAdapter:cy,visit:uy,connectStreamSource:Wh,disconnectStreamSource:Gh,renderStreamMessage:hy,setProgressBarDelay:dy,setConfirmMethod:py,setFormMode:fy,morphBodyElements:my,morphTurboFrameElements:gy,morphChildren:Rl,morphElements:eo}),Tl=class extends Error{},xl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#s=new Set;#o=!1;action=null;constructor(e){this.element=e,this.view=new tl(this,this.element),this.appearanceObserver=new Ja(this,this.element),this.formLinkClickObserver=new Yn(this,this.element),this.linkInterceptor=new Kn(this,this.element),this.restorationIdentifier=Ni(),this.formSubmitObserver=new Es(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Pr.lazy?this.appearanceObserver.start():this.#n(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Pr.eager&&this.#n()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Pr.eager||this.#r)&&this.#n())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#o=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Pr.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#n())}async#n(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(Qe(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Ch(t);Zt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#o=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,ir(e)),this.#n()}willSubmitFormLinkToLocation(e){return this.#b(e)}submittedFormLinkToLocation(e,t,r){let s=this.#d(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#b(e)}linkClickIntercepted(e,t){this.#f(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#b(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Wn(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#d(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Bi.contentType)}requestStarted(e){jn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){qn(this.element)}formSubmissionStarted({formElement:e}){jn(e,this.#d(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#d(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,ir(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Le.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Le.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){qn(e,this.#d(e))}allowsImmediateRender({element:e},t){let r=ve("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Le.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#o?Qn:xs;if(r){let n=new Lr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Le.frameRendered(e,this.element),Le.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#h(e)&&this.#u(e)}async#a(e){let t=new rr(this,Ht.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#f(e,t,r){let s=this.#d(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,ir(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=Zt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,f={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(f.action=this.action),Le.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=Ph(this.action);Le.history.update(e,Qe(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#g(e.response)}#h(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#g(n):Le.visit(n,o)};return!ve("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#p(e)}#p(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Tl(t)}async#g(e){let t=new Ss(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Le.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#d(e,t){let r=Hn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#m(r);return s instanceof jt?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=kh(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=kh(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new jt}return null}#w(e,t){let r=Fl(e,t);return Di(Qe(r),this.rootLocation)}#b(e,t){let r=Hn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#w(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#m(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Le.elementIsNavigatable(e)||t&&!Le.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Qe(t)}#y(e){return this.#s.has(e)}#T(e,t){this.#s.add(e),t(),this.#s.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#m(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof jt)return t}}};function kh(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Dh(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof jt)return i.connectedCallback(),i.disconnectedCallback(),i}}var Kh={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?eo(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Rl(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Le.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},kl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await ys(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=Kh[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},_l=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Wh(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Gh(this.streamSource))}get src(){return this.getAttribute("src")||""}};jt.delegateConstructor=xl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",jt);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",kl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",_l);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(Fh`
19
19
  You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
20
20
 
21
21
  Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
@@ -24,56 +24,57 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24
24
 
25
25
  ——
26
26
  Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
27
- `,i.outerHTML);e=e.parentElement}})();window.Turbo={...py,StreamActions:$u};Hu();var _l=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=fy(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,s=t.index;return r<s?-1:r>s?1:0})}};function fy(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Al=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),o=s.get(n);return o||(o=this.createEventListener(e,t,r),s.set(n,o)),o}createEventListener(e,t,r){let s=new _l(e,t,r);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(s=>{r.push(`${t[s]?"":"!"}${s}`)}),r.join(":")}},my={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},gy=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function by(i){let t=i.trim().match(gy)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:yy(t[4]),eventName:r,eventOptions:t[7]?vy(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function yy(i){if(i=="window")return window;if(i=="document")return document}function vy(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function wy(i){if(i==window)return"window";if(i==document)return"document"}function Xl(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Cl(i){return Xl(i.replace(/--/g,"-").replace(/__/g,"_"))}function gs(i){return i.charAt(0).toUpperCase()+i.slice(1)}function ed(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Sy(i){return i.match(/[^\s]+/g)||[]}function Vu(i){return i!=null}function Pl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var Wu=["meta","ctrl","alt","shift"],Fl=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Ey(e)||Gn("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||Gn("missing identifier"),this.methodName=r.methodName||Gn("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,by(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(s=>!Wu.includes(s))[0];return r?(Pl(this.keyMappings,r)||Gn(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:s}of Array.from(this.element.attributes)){let n=r.match(t),o=n&&n[1];o&&(e[Xl(o)]=Ty(s))}return e}get eventTargetName(){return wy(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=Wu.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Gu={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Ey(i){let e=i.tagName.toLowerCase();if(e in Gu)return Gu[e](i)}function Gn(i){throw new Error(i)}function Ty(i){try{return JSON.parse(i)}catch{return i}}var Ol=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];n=n&&l({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:l}=this,u={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(s,`invoking action "${this.action}"`,u)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},Kn=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},Xn=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new Kn(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function xy(i,e,t){td(i,e).add(t)}function ky(i,e,t){td(i,e).delete(t),_y(i,e)}function td(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function _y(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var wi=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){xy(this.valuesByKey,e,t)}delete(e,t){ky(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var Rl=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new Kn(e,this),this.delegate=r,this.matchesByElement=new wi}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let s=this.matchElement(e),n=this.matchesByElement.has(r,e);s&&!n?this.selectorMatched(e,r):!s&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},Ml=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},Yn=class{constructor(e,t,r){this.attributeObserver=new Xn(e,t,this),this.delegate=r,this.tokensByElement=new wi}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=Cy(t,r).findIndex(([n,o])=>!Py(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return Ay(r,e,t)}};function Ay(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function Cy(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function Py(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var Zn=class{constructor(e,t,r){this.tokenListObserver=new Yn(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},Ll=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Zn(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new Ol(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Fl.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},Il=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Ml(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let s=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${gs(t.name)}`;return this.receiver[r]}},Dl=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new wi}start(){this.tokenListObserver||(this.tokenListObserver=new Yn(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function bs(i,e){let t=id(i);return Array.from(t.reduce((r,s)=>(Oy(s,e).forEach(n=>r.add(n)),r),new Set))}function Fy(i,e){return id(i).reduce((r,s)=>(r.push(...Ry(s,e)),r),[])}function id(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function Oy(i,e){let t=i[e];return Array.isArray(t)?t:[]}function Ry(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var Nl=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new wi,this.outletElementsByName=new wi,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){let s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?s&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new Rl(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new Xn(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new wi;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;bs(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},Bl=class{constructor(e,t){this.logDebugActivity=(r,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,r,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Ll(this,this.dispatcher),this.valueObserver=new Il(this,this.controller),this.targetObserver=new Dl(this,this),this.outletObserver=new Nl(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:s,controller:n,element:o}=this;r=Object.assign({identifier:s,controller:n,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${Cl(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Cl(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function My(i){return Ly(i,Iy(i))}function Ly(i,e){let t=Uy(i),r=Dy(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function Iy(i){return bs(i,"blessings").reduce((t,r)=>{let s=r(i);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function Dy(i,e){return By(e).reduce((t,r)=>{let s=Ny(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function Ny(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var By=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,Uy=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function zy(i){return{identifier:i.identifier,controllerConstructor:My(i.controllerConstructor)}}var Ul=class{constructor(e,t){this.application=e,this.definition=zy(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new Bl(this,e),this.contextsByScope.set(e,t)),t}},zl=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return Sy(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Hl=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${ed(e)}`}},jl=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}};function ql(i,e){return`[${i}~="${e}"]`}var $l=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return ql(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return ql(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Vl=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,r){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}},Wl=class i{constructor(e,t,r,s){this.targets=new $l(this),this.classes=new zl(this),this.data=new Hl(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new jl(s),this.outlets=new Vl(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return ql(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},Gl=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new Zn(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),s=r.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,s)),s}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},Kl=class{constructor(e){this.application=e,this.scopeObserver=new Gl(this.element,this.schema,this),this.scopesByIdentifier=new wi,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new Ul(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new Wl(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},Hy={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Ku("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),Ku("0123456789".split("").map(i=>[i,i])))};function Ku(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var Qn=class{constructor(e=document.documentElement,t=Hy){this.logger=console,this.debug=!1,this.logDebugActivity=(r,s,n={})=>{this.debug&&this.logFormattedMessage(r,s,n)},this.element=e,this.schema=t,this.dispatcher=new Al(this),this.router=new Kl(this),this.actionDescriptorFilters=Object.assign({},my)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await jy(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error(`%s
27
+ `,i.outerHTML);e=e.parentElement}})();window.Turbo={...by,StreamActions:Kh};Vh();var Ml=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=yy(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,s=t.index;return r<s?-1:r>s?1:0})}};function yy(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Ll=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),o=s.get(n);return o||(o=this.createEventListener(e,t,r),s.set(n,o)),o}createEventListener(e,t,r){let s=new Ml(e,t,r);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(s=>{r.push(`${t[s]?"":"!"}${s}`)}),r.join(":")}},vy={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},wy=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Sy(i){let t=i.trim().match(wy)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Ey(t[4]),eventName:r,eventOptions:t[7]?Ty(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Ey(i){if(i=="window")return window;if(i=="document")return document}function Ty(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function xy(i){if(i==window)return"window";if(i==document)return"document"}function ic(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Il(i){return ic(i.replace(/--/g,"-").replace(/__/g,"_"))}function As(i){return i.charAt(0).toUpperCase()+i.slice(1)}function sd(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function ky(i){return i.match(/[^\s]+/g)||[]}function Xh(i){return i!=null}function Dl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var Yh=["meta","ctrl","alt","shift"],Nl=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||_y(e)||to("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||to("missing identifier"),this.methodName=r.methodName||to("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,Sy(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(s=>!Yh.includes(s))[0];return r?(Dl(this.keyMappings,r)||to(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:s}of Array.from(this.element.attributes)){let n=r.match(t),o=n&&n[1];o&&(e[ic(o)]=Ay(s))}return e}get eventTargetName(){return xy(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=Yh.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Zh={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function _y(i){let e=i.tagName.toLowerCase();if(e in Zh)return Zh[e](i)}function to(i){throw new Error(i)}function Ay(i){try{return JSON.parse(i)}catch{return i}}var Bl=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];n=n&&l({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:l}=this,h={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(s,`invoking action "${this.action}"`,h)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},io=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},ro=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new io(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Cy(i,e,t){nd(i,e).add(t)}function Fy(i,e,t){nd(i,e).delete(t),Py(i,e)}function nd(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function Py(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var wi=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){Cy(this.valuesByKey,e,t)}delete(e,t){Fy(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var Ul=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new io(e,this),this.delegate=r,this.matchesByElement=new wi}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let s=this.matchElement(e),n=this.matchesByElement.has(r,e);s&&!n?this.selectorMatched(e,r):!s&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},zl=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},so=class{constructor(e,t,r){this.attributeObserver=new ro(e,t,this),this.delegate=r,this.tokensByElement=new wi}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=Ry(t,r).findIndex(([n,o])=>!My(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return Oy(r,e,t)}};function Oy(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function Ry(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function My(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var no=class{constructor(e,t,r){this.tokenListObserver=new so(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},Hl=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new no(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new Bl(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Nl.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},jl=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new zl(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let s=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${As(t.name)}`;return this.receiver[r]}},ql=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new wi}start(){this.tokenListObserver||(this.tokenListObserver=new so(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Cs(i,e){let t=od(i);return Array.from(t.reduce((r,s)=>(Iy(s,e).forEach(n=>r.add(n)),r),new Set))}function Ly(i,e){return od(i).reduce((r,s)=>(r.push(...Dy(s,e)),r),[])}function od(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function Iy(i,e){let t=i[e];return Array.isArray(t)?t:[]}function Dy(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var $l=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new wi,this.outletElementsByName=new wi,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){let s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?s&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new Ul(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new ro(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new wi;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;Cs(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},Vl=class{constructor(e,t){this.logDebugActivity=(r,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,r,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Hl(this,this.dispatcher),this.valueObserver=new jl(this,this.controller),this.targetObserver=new ql(this,this),this.outletObserver=new $l(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:s,controller:n,element:o}=this;r=Object.assign({identifier:s,controller:n,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${Il(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Il(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function Ny(i){return By(i,Uy(i))}function By(i,e){let t=qy(i),r=zy(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function Uy(i){return Cs(i,"blessings").reduce((t,r)=>{let s=r(i);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function zy(i,e){return jy(e).reduce((t,r)=>{let s=Hy(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function Hy(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var jy=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,qy=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function $y(i){return{identifier:i.identifier,controllerConstructor:Ny(i.controllerConstructor)}}var Wl=class{constructor(e,t){this.application=e,this.definition=$y(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new Vl(this,e),this.contextsByScope.set(e,t)),t}},Gl=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return ky(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Kl=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${sd(e)}`}},Xl=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}};function Yl(i,e){return`[${i}~="${e}"]`}var Zl=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return Yl(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return Yl(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Ql=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,r){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}},Jl=class i{constructor(e,t,r,s){this.targets=new Zl(this),this.classes=new Gl(this),this.data=new Kl(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new Xl(s),this.outlets=new Ql(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return Yl(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},ec=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new no(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),s=r.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,s)),s}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},tc=class{constructor(e){this.application=e,this.scopeObserver=new ec(this.element,this.schema,this),this.scopesByIdentifier=new wi,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new Wl(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new Jl(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},Vy={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Qh("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),Qh("0123456789".split("").map(i=>[i,i])))};function Qh(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var oo=class{constructor(e=document.documentElement,t=Vy){this.logger=console,this.debug=!1,this.logDebugActivity=(r,s,n={})=>{this.debug&&this.logFormattedMessage(r,s,n)},this.element=e,this.schema=t,this.dispatcher=new Ll(this),this.router=new tc(this),this.actionDescriptorFilters=Object.assign({},vy)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await Wy(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error(`%s
28
28
 
29
29
  %o
30
30
 
31
- %o`,t,e,r),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function jy(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function qy(i){return bs(i,"classes").reduce((t,r)=>Object.assign(t,$y(r)),{})}function $y(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${gs(i)}Class`]:{get(){return this.classes.has(i)}}}}function Vy(i){return bs(i,"outlets").reduce((t,r)=>Object.assign(t,Wy(r)),{})}function Xu(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function Yu(i,e,t){let r=Xu(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=Xu(i,e,t),r))return r}function Wy(i){let e=Cl(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=Yu(this,t,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let s=Yu(this,r,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${gs(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function Gy(i){return bs(i,"targets").reduce((t,r)=>Object.assign(t,Ky(r)),{})}function Ky(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${gs(i)}Target`]:{get(){return this.targets.has(i)}}}}function Xy(i){let e=Fy(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=rd(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,Yy(s)),t)}function Yy(i,e){let t=rd(i,e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(r);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${gs(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function rd([i,e],t){return ev({controller:t,token:i,typeDefinition:e})}function Jn(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function ms(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function Zy(i){let{controller:e,token:t,typeObject:r}=i,s=Vu(r.type),n=Vu(r.default),o=s&&n,a=s&&!n,l=!s&&n,u=Jn(r.type),f=ms(i.typeObject.default);if(a)return u;if(l)return f;if(u!==f){let m=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${m}" must match the defined type "${u}". The provided default value of "${r.default}" is of type "${f}".`)}if(o)return u}function Qy(i){let{controller:e,token:t,typeDefinition:r}=i,n=Zy({controller:e,token:t,typeObject:r}),o=ms(r),a=Jn(r),l=n||o||a;if(l)return l;let u=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${u}" for "${t}" value`)}function Jy(i){let e=Jn(i);if(e)return Zu[e];let t=Pl(i,"default"),r=Pl(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=Jn(n);if(o)return Zu[o]}return i}function ev(i){let{token:e,typeDefinition:t}=i,r=`${ed(e)}-value`,s=Qy(i);return{type:s,key:r,name:Xl(r),get defaultValue(){return Jy(t)},get hasCustomDefaultValue(){return ms(t)!==void 0},reader:tv[s],writer:Qu[s]||Qu.default}}var Zu={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},tv={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${ms(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${ms(e)}"`);return e},string(i){return i}},Qu={default:iv,array:Ju,object:Ju};function Ju(i){return JSON.stringify(i)}function iv(i){return`${i}`}var V=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};V.blessings=[qy,Gy,Xy,Vy];V.targets=[];V.outlets=[];V.values={};var eo=class extends V{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#r(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!0):this.#n(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!1):this.#n(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#r(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#n(i,e){let t=this.#r(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#o(i,e){this.#n(i,e)}};var to=class extends V{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord!==void 0)e.remove();else{e.style.display="none",e.classList.remove(...e.classList);let r=e.querySelector("input[name*='_destroy']");r.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var io=class extends V{connect(){}preSubmit(){let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var ke="top",ze="bottom",Me="right",Pe="left",ro="auto",Li=[ke,ze,Me,Pe],Si="start",er="end",sd="clippingParents",so="viewport",Pr="popper",nd="reference",Yl=Li.reduce(function(i,e){return i.concat([e+"-"+Si,e+"-"+er])},[]),no=[].concat(Li,[ro]).reduce(function(i,e){return i.concat([e,e+"-"+Si,e+"-"+er])},[]),rv="beforeRead",sv="read",nv="afterRead",ov="beforeMain",av="main",lv="afterMain",cv="beforeWrite",hv="write",uv="afterWrite",od=[rv,sv,nv,ov,av,lv,cv,hv,uv];function Ve(i){return i?(i.nodeName||"").toLowerCase():null}function me(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function Mt(i){var e=me(i).Element;return i instanceof e||i instanceof Element}function He(i){var e=me(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function Fr(i){if(typeof ShadowRoot>"u")return!1;var e=me(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function dv(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!He(n)||!Ve(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function pv(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,u){return l[u]="",l},{});!He(s)||!Ve(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var ad={name:"applyStyles",enabled:!0,phase:"write",fn:dv,effect:pv,requires:["computeStyles"]};function We(i){return i.split("-")[0]}var qt=Math.max,tr=Math.min,Ei=Math.round;function Or(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ys(){return!/^((?!chrome|android).)*safari/i.test(Or())}function Lt(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&He(i)&&(s=i.offsetWidth>0&&Ei(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Ei(r.height)/i.offsetHeight||1);var o=Mt(i)?me(i):window,a=o.visualViewport,l=!ys()&&t,u=(r.left+(l&&a?a.offsetLeft:0))/s,f=(r.top+(l&&a?a.offsetTop:0))/n,m=r.width/s,v=r.height/n;return{width:m,height:v,top:f,right:u+m,bottom:f+v,left:u,x:u,y:f}}function ir(i){var e=Lt(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function vs(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&Fr(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ot(i){return me(i).getComputedStyle(i)}function Zl(i){return["table","td","th"].indexOf(Ve(i))>=0}function Ye(i){return((Mt(i)?i.ownerDocument:i.document)||window.document).documentElement}function Ti(i){return Ve(i)==="html"?i:i.assignedSlot||i.parentNode||(Fr(i)?i.host:null)||Ye(i)}function ld(i){return!He(i)||ot(i).position==="fixed"?null:i.offsetParent}function fv(i){var e=/firefox/i.test(Or()),t=/Trident/i.test(Or());if(t&&He(i)){var r=ot(i);if(r.position==="fixed")return null}var s=Ti(i);for(Fr(s)&&(s=s.host);He(s)&&["html","body"].indexOf(Ve(s))<0;){var n=ot(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function $t(i){for(var e=me(i),t=ld(i);t&&Zl(t)&&ot(t).position==="static";)t=ld(t);return t&&(Ve(t)==="html"||Ve(t)==="body"&&ot(t).position==="static")?e:t||fv(i)||e}function rr(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function sr(i,e,t){return qt(i,tr(e,t))}function cd(i,e,t){var r=sr(i,e,t);return r>t?t:r}function ws(){return{top:0,right:0,bottom:0,left:0}}function Ss(i){return Object.assign({},ws(),i)}function Es(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var mv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ss(typeof e!="number"?e:Es(e,Li))};function gv(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=We(t.placement),l=rr(a),u=[Pe,Me].indexOf(a)>=0,f=u?"height":"width";if(!(!n||!o)){var m=mv(s.padding,t),v=ir(n),b=l==="y"?ke:Pe,k=l==="y"?ze:Me,P=t.rects.reference[f]+t.rects.reference[l]-o[l]-t.rects.popper[f],F=o[l]-t.rects.reference[l],R=$t(n),_=R?l==="y"?R.clientHeight||0:R.clientWidth||0:0,C=P/2-F/2,S=m[b],E=_-v[f]-m[k],A=_/2-v[f]/2+C,O=sr(S,A,E),N=l;t.modifiersData[r]=(e={},e[N]=O,e.centerOffset=O-A,e)}}function bv(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||vs(e.elements.popper,s)&&(e.elements.arrow=s))}var hd={name:"arrow",enabled:!0,phase:"main",fn:gv,effect:bv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function It(i){return i.split("-")[1]}var yv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function vv(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Ei(t*s)/s||0,y:Ei(r*s)/s||0}}function ud(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,u=i.adaptive,f=i.roundOffsets,m=i.isFixed,v=o.x,b=v===void 0?0:v,k=o.y,P=k===void 0?0:k,F=typeof f=="function"?f({x:b,y:P}):{x:b,y:P};b=F.x,P=F.y;var R=o.hasOwnProperty("x"),_=o.hasOwnProperty("y"),C=Pe,S=ke,E=window;if(u){var A=$t(t),O="clientHeight",N="clientWidth";if(A===me(t)&&(A=Ye(t),ot(A).position!=="static"&&a==="absolute"&&(O="scrollHeight",N="scrollWidth")),A=A,s===ke||(s===Pe||s===Me)&&n===er){S=ze;var z=m&&A===E&&E.visualViewport?E.visualViewport.height:A[O];P-=z-r.height,P*=l?1:-1}if(s===Pe||(s===ke||s===ze)&&n===er){C=Me;var $=m&&A===E&&E.visualViewport?E.visualViewport.width:A[N];b-=$-r.width,b*=l?1:-1}}var j=Object.assign({position:a},u&&yv),X=f===!0?vv({x:b,y:P},me(t)):{x:b,y:P};if(b=X.x,P=X.y,l){var te;return Object.assign({},j,(te={},te[S]=_?"0":"",te[C]=R?"0":"",te.transform=(E.devicePixelRatio||1)<=1?"translate("+b+"px, "+P+"px)":"translate3d("+b+"px, "+P+"px, 0)",te))}return Object.assign({},j,(e={},e[S]=_?P+"px":"",e[C]=R?b+"px":"",e.transform="",e))}function wv(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,l=a===void 0?!0:a,u={placement:We(e.placement),variation:It(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ud(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ud(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var dd={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:wv,data:{}};var oo={passive:!0};function Sv(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,l=me(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&u.forEach(function(f){f.addEventListener("scroll",t.update,oo)}),a&&l.addEventListener("resize",t.update,oo),function(){n&&u.forEach(function(f){f.removeEventListener("scroll",t.update,oo)}),a&&l.removeEventListener("resize",t.update,oo)}}var pd={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Sv,data:{}};var Ev={left:"right",right:"left",bottom:"top",top:"bottom"};function Rr(i){return i.replace(/left|right|bottom|top/g,function(e){return Ev[e]})}var Tv={start:"end",end:"start"};function ao(i){return i.replace(/start|end/g,function(e){return Tv[e]})}function nr(i){var e=me(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function or(i){return Lt(Ye(i)).left+nr(i).scrollLeft}function Ql(i,e){var t=me(i),r=Ye(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var u=ys();(u||!u&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+or(i),y:l}}function Jl(i){var e,t=Ye(i),r=nr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=qt(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=qt(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+or(i),l=-r.scrollTop;return ot(s||t).direction==="rtl"&&(a+=qt(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function ar(i){var e=ot(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function lo(i){return["html","body","#document"].indexOf(Ve(i))>=0?i.ownerDocument.body:He(i)&&ar(i)?i:lo(Ti(i))}function Ii(i,e){var t;e===void 0&&(e=[]);var r=lo(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=me(r),o=s?[n].concat(n.visualViewport||[],ar(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(Ii(Ti(o)))}function Mr(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function xv(i,e){var t=Lt(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function fd(i,e,t){return e===so?Mr(Ql(i,t)):Mt(e)?xv(e,t):Mr(Jl(Ye(i)))}function kv(i){var e=Ii(Ti(i)),t=["absolute","fixed"].indexOf(ot(i).position)>=0,r=t&&He(i)?$t(i):i;return Mt(r)?e.filter(function(s){return Mt(s)&&vs(s,r)&&Ve(s)!=="body"}):[]}function ec(i,e,t,r){var s=e==="clippingParents"?kv(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,u){var f=fd(i,u,r);return l.top=qt(f.top,l.top),l.right=tr(f.right,l.right),l.bottom=tr(f.bottom,l.bottom),l.left=qt(f.left,l.left),l},fd(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ts(i){var e=i.reference,t=i.element,r=i.placement,s=r?We(r):null,n=r?It(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case ke:l={x:o,y:e.y-t.height};break;case ze:l={x:o,y:e.y+e.height};break;case Me:l={x:e.x+e.width,y:a};break;case Pe:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var u=s?rr(s):null;if(u!=null){var f=u==="y"?"height":"width";switch(n){case Si:l[u]=l[u]-(e[f]/2-t[f]/2);break;case er:l[u]=l[u]+(e[f]/2-t[f]/2);break;default:}}return l}function Vt(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,o=n===void 0?i.strategy:n,a=t.boundary,l=a===void 0?sd:a,u=t.rootBoundary,f=u===void 0?so:u,m=t.elementContext,v=m===void 0?Pr:m,b=t.altBoundary,k=b===void 0?!1:b,P=t.padding,F=P===void 0?0:P,R=Ss(typeof F!="number"?F:Es(F,Li)),_=v===Pr?nd:Pr,C=i.rects.popper,S=i.elements[k?_:v],E=ec(Mt(S)?S:S.contextElement||Ye(i.elements.popper),l,f,o),A=Lt(i.elements.reference),O=Ts({reference:A,element:C,strategy:"absolute",placement:s}),N=Mr(Object.assign({},C,O)),z=v===Pr?N:A,$={top:E.top-z.top+R.top,bottom:z.bottom-E.bottom+R.bottom,left:E.left-z.left+R.left,right:z.right-E.right+R.right},j=i.modifiersData.offset;if(v===Pr&&j){var X=j[s];Object.keys($).forEach(function(te){var ie=[Me,ze].indexOf(te)>=0?1:-1,je=[ke,ze].indexOf(te)>=0?"y":"x";$[te]+=X[je]*ie})}return $}function tc(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,u=l===void 0?no:l,f=It(r),m=f?a?Yl:Yl.filter(function(k){return It(k)===f}):Li,v=m.filter(function(k){return u.indexOf(k)>=0});v.length===0&&(v=m);var b=v.reduce(function(k,P){return k[P]=Vt(i,{placement:P,boundary:s,rootBoundary:n,padding:o})[We(P)],k},{});return Object.keys(b).sort(function(k,P){return b[k]-b[P]})}function _v(i){if(We(i)===ro)return[];var e=Rr(i);return[ao(i),e,ao(e)]}function Av(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,u=t.padding,f=t.boundary,m=t.rootBoundary,v=t.altBoundary,b=t.flipVariations,k=b===void 0?!0:b,P=t.allowedAutoPlacements,F=e.options.placement,R=We(F),_=R===F,C=l||(_||!k?[Rr(F)]:_v(F)),S=[F].concat(C).reduce(function(Ke,Q){return Ke.concat(We(Q)===ro?tc(e,{placement:Q,boundary:f,rootBoundary:m,padding:u,flipVariations:k,allowedAutoPlacements:P}):Q)},[]),E=e.rects.reference,A=e.rects.popper,O=new Map,N=!0,z=S[0],$=0;$<S.length;$++){var j=S[$],X=We(j),te=It(j)===Si,ie=[ke,ze].indexOf(X)>=0,je=ie?"width":"height",ge=Vt(e,{placement:j,boundary:f,rootBoundary:m,altBoundary:v,padding:u}),De=ie?te?Me:Pe:te?ze:ke;E[je]>A[je]&&(De=Rr(De));var de=Rr(De),tt=[];if(n&&tt.push(ge[X]<=0),a&&tt.push(ge[De]<=0,ge[de]<=0),tt.every(function(Ke){return Ke})){z=j,N=!1;break}O.set(j,tt)}if(N)for(var At=k?3:1,re=function(Q){var it=S.find(function(Ct){var be=O.get(Ct);if(be)return be.slice(0,Q).every(function(Zt){return Zt})});if(it)return z=it,"break"},ft=At;ft>0;ft--){var se=re(ft);if(se==="break")break}e.placement!==z&&(e.modifiersData[r]._skip=!0,e.placement=z,e.reset=!0)}}var md={name:"flip",enabled:!0,phase:"main",fn:Av,requiresIfExists:["offset"],data:{_skip:!1}};function gd(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function bd(i){return[ke,Me,ze,Pe].some(function(e){return i[e]>=0})}function Cv(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=Vt(e,{elementContext:"reference"}),a=Vt(e,{altBoundary:!0}),l=gd(o,r),u=gd(a,s,n),f=bd(l),m=bd(u);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:f,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}var yd={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Cv};function Pv(i,e,t){var r=We(i),s=[Pe,ke].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[Pe,Me].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Fv(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=no.reduce(function(f,m){return f[m]=Pv(m,e.rects,n),f},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}var vd={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Fv};function Ov(i){var e=i.state,t=i.name;e.modifiersData[t]=Ts({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var wd={name:"popperOffsets",enabled:!0,phase:"read",fn:Ov,data:{}};function ic(i){return i==="x"?"y":"x"}function Rv(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,u=t.rootBoundary,f=t.altBoundary,m=t.padding,v=t.tether,b=v===void 0?!0:v,k=t.tetherOffset,P=k===void 0?0:k,F=Vt(e,{boundary:l,rootBoundary:u,padding:m,altBoundary:f}),R=We(e.placement),_=It(e.placement),C=!_,S=rr(R),E=ic(S),A=e.modifiersData.popperOffsets,O=e.rects.reference,N=e.rects.popper,z=typeof P=="function"?P(Object.assign({},e.rects,{placement:e.placement})):P,$=typeof z=="number"?{mainAxis:z,altAxis:z}:Object.assign({mainAxis:0,altAxis:0},z),j=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,X={x:0,y:0};if(A){if(n){var te,ie=S==="y"?ke:Pe,je=S==="y"?ze:Me,ge=S==="y"?"height":"width",De=A[S],de=De+F[ie],tt=De-F[je],At=b?-N[ge]/2:0,re=_===Si?O[ge]:N[ge],ft=_===Si?-N[ge]:-O[ge],se=e.elements.arrow,Ke=b&&se?ir(se):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ws(),it=Q[ie],Ct=Q[je],be=sr(0,O[ge],Ke[ge]),Zt=C?O[ge]/2-At-be-it-$.mainAxis:re-be-it-$.mainAxis,li=C?-O[ge]/2+At+be+Ct+$.mainAxis:ft+be+Ct+$.mainAxis,Qt=e.elements.arrow&&$t(e.elements.arrow),qi=Qt?S==="y"?Qt.clientTop||0:Qt.clientLeft||0:0,Bt=(te=j?.[S])!=null?te:0,Ai=De+Zt-Bt-qi,Ut=De+li-Bt,ci=sr(b?tr(de,Ai):de,De,b?qt(tt,Ut):tt);A[S]=ci,X[S]=ci-De}if(a){var hi,zt=S==="x"?ke:Pe,ui=S==="x"?ze:Me,rt=A[E],Jt=E==="y"?"height":"width",di=rt+F[zt],$i=rt-F[ui],pi=[ke,Pe].indexOf(R)!==-1,ei=(hi=j?.[E])!=null?hi:0,Ht=pi?di:rt-O[Jt]-N[Jt]-ei+$.altAxis,st=pi?rt+O[Jt]+N[Jt]-ei-$.altAxis:$i,fi=b&&pi?cd(Ht,rt,st):sr(b?Ht:di,rt,b?st:$i);A[E]=fi,X[E]=fi-rt}e.modifiersData[r]=X}}var Sd={name:"preventOverflow",enabled:!0,phase:"main",fn:Rv,requiresIfExists:["offset"]};function rc(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function sc(i){return i===me(i)||!He(i)?nr(i):rc(i)}function Mv(i){var e=i.getBoundingClientRect(),t=Ei(e.width)/i.offsetWidth||1,r=Ei(e.height)/i.offsetHeight||1;return t!==1||r!==1}function nc(i,e,t){t===void 0&&(t=!1);var r=He(e),s=He(e)&&Mv(e),n=Ye(e),o=Lt(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Ve(e)!=="body"||ar(n))&&(a=sc(e)),He(e)?(l=Lt(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=or(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Lv(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function oc(i){var e=Lv(i);return od.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function ac(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function lc(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Ed={placement:"bottom",modifiers:[],strategy:"absolute"};function Td(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function xd(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?Ed:s;return function(a,l,u){u===void 0&&(u=n);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ed,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},m=[],v=!1,b={state:f,setOptions:function(R){var _=typeof R=="function"?R(f.options):R;P(),f.options=Object.assign({},n,f.options,_),f.scrollParents={reference:Mt(a)?Ii(a):a.contextElement?Ii(a.contextElement):[],popper:Ii(l)};var C=oc(lc([].concat(r,f.options.modifiers)));return f.orderedModifiers=C.filter(function(S){return S.enabled}),k(),b.update()},forceUpdate:function(){if(!v){var R=f.elements,_=R.reference,C=R.popper;if(Td(_,C)){f.rects={reference:nc(_,$t(C),f.options.strategy==="fixed"),popper:ir(C)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function($){return f.modifiersData[$.name]=Object.assign({},$.data)});for(var S=0;S<f.orderedModifiers.length;S++){if(f.reset===!0){f.reset=!1,S=-1;continue}var E=f.orderedModifiers[S],A=E.fn,O=E.options,N=O===void 0?{}:O,z=E.name;typeof A=="function"&&(f=A({state:f,options:N,name:z,instance:b})||f)}}}},update:ac(function(){return new Promise(function(F){b.forceUpdate(),F(f)})}),destroy:function(){P(),v=!0}};if(!Td(a,l))return b;b.setOptions(u).then(function(F){!v&&u.onFirstUpdate&&u.onFirstUpdate(F)});function k(){f.orderedModifiers.forEach(function(F){var R=F.name,_=F.options,C=_===void 0?{}:_,S=F.effect;if(typeof S=="function"){var E=S({state:f,name:R,instance:b,options:C}),A=function(){};m.push(E||A)}})}function P(){m.forEach(function(F){return F()}),m=[]}return b}}var Iv=[pd,wd,dd,ad,vd,md,Sd,hd,yd],cc=xd({defaultModifiers:Iv});var co=class extends V{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.popperInstance=cc(this.triggerTarget,this.menuTarget,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["bottom-end","bottom-start","top","top-end","top-start"],boundary:"viewport"}},{name:"preventOverflow",options:{boundary:"viewport",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.popperInstance.destroy(),this.initialized=!1)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{i.type==="click"?this.toggle():setTimeout(()=>{this.show()},this.options.delay)},this.hoverShowMenuHandler=()=>{this.show()},this.hoverHideHandler=()=>{setTimeout(()=>{this.menuTarget.matches(":hover")||this.hide()},this.options.delay)},this.options.triggerType==="click"?this.triggerTarget.addEventListener("click",this.clickHandler):this.options.triggerType==="hover"&&(this.triggerTarget.addEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.addEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.addEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.addEventListener("mouseleave",this.hoverHideHandler))}setupClickOutsideListener(){this.clickOutsideHandler=i=>{let e=i.target,t=this.options.ignoreClickOutsideClass,r=!1;t&&document.querySelectorAll(`.${t}`).forEach(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menuTarget&&!this.menuTarget.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&this.visible&&this.hide()},document.body.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&document.body.removeEventListener("click",this.clickOutsideHandler,!0)}toggle(){this.visible?this.hide():this.show()}show(){this.menuTarget.classList.remove("hidden"),this.menuTarget.classList.add("block"),this.menuTarget.removeAttribute("aria-hidden"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!0}]})),this.setupClickOutsideListener(),this.popperInstance.update(),this.visible=!0}hide(){this.menuTarget.classList.remove("block"),this.menuTarget.classList.add("hidden"),this.menuTarget.setAttribute("aria-hidden","true"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!1}]})),this.removeClickOutsideListener(),this.visible=!1}};var ho=class extends V{static targets=["trigger","menu"];connect(){this.element.hasAttribute("data-visible")||this.element.setAttribute("data-visible","false"),this.#e()}toggle(){let i=this.element.getAttribute("data-visible")==="true";this.element.setAttribute("data-visible",(!i).toString()),this.#e()}#e(){this.element.getAttribute("data-visible")==="true"?(this.menuTarget.classList.remove("hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.dispatch("expand")):(this.menuTarget.classList.add("hidden"),this.triggerTarget.setAttribute("aria-expanded","false"),this.dispatch("collapse"))}};var uo=class extends V{static values={after:Number};connect(){this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var po=class extends V{static targets=["frame","refreshButton","backButton","homeButton","maximizeLink"];connect(){this.#t(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){if(i){let t=i.target.closest("a, form")?.dataset?.turboFrame;if(t&&t!==this.frameTarget.id)return}this.#t()}frameFailed(i){this.#i()}frameLoaded(i){this.#i();let e=i.target.src;this.#e(e)}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.srcHistory=[this.originalFrameSrc],this.#r(),this._homeRequested=!0,this.frameTarget.src=this.originalFrameSrc,this.frameTarget.reload()}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(i){this._homeRequested?(this._homeRequested=!1,this.srcHistory=[i],this.originalFrameSrc=i):i==this.currentSrc||(i==this.originalFrameSrc?this.srcHistory=[i]:this.srcHistory.push(i)),this.#r(),this.hasMaximizeLinkTarget&&(this.maximizeLinkTarget.href=i)}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#i(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#r(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var fo=["auto","light","dark"],mo=class extends V{static values={current:String};connect(){this.applyMode(this.readMode()),this.handleStorageChange=i=>{i.key==="theme"&&this.applyMode(this.readMode())},window.addEventListener("storage",this.handleStorageChange),this.mq=window.matchMedia("(prefers-color-scheme: dark)"),this.handleMqChange=()=>{this.readMode()==="auto"&&this.applyMode("auto")},this.mq.addEventListener("change",this.handleMqChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange),this.mq&&this.mq.removeEventListener("change",this.handleMqChange)}toggleMode(){let i=this.readMode(),e=fo[(fo.indexOf(i)+1)%fo.length];this.setMode(e)}setMode(i){localStorage.setItem("theme",i),this.applyMode(i)}applyMode(i){let e=this.effectiveMode(i);document.documentElement.classList.toggle("dark",e==="dark"),this.currentValue=i,this.toggleIcons(i)}readMode(){let i=localStorage.getItem("theme");return fo.includes(i)?i:"auto"}effectiveMode(i){return i==="light"||i==="dark"?i:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}toggleIcons(i){let e={auto:this.element.querySelector(".color-mode-icon-auto"),light:this.element.querySelector(".color-mode-icon-light"),dark:this.element.querySelector(".color-mode-icon-dark")};for(let[t,r]of Object.entries(e))r&&r.classList.toggle("hidden",t!==i)}};var{entries:Md,setPrototypeOf:kd,isFrozen:Dv,getPrototypeOf:Nv,getOwnPropertyDescriptor:Bv}=Object,{freeze:lt,seal:Dt,create:gc}=Object,{apply:bc,construct:yc}=typeof Reflect<"u"&&Reflect;lt||(lt=function(e){return e});Dt||(Dt=function(e){return e});bc||(bc=function(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return e.apply(t,s)});yc||(yc=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return new e(...r)});var go=ct(Array.prototype.forEach),Uv=ct(Array.prototype.lastIndexOf),_d=ct(Array.prototype.pop),xs=ct(Array.prototype.push),zv=ct(Array.prototype.splice),yo=ct(String.prototype.toLowerCase),hc=ct(String.prototype.toString),uc=ct(String.prototype.match),ks=ct(String.prototype.replace),Hv=ct(String.prototype.indexOf),jv=ct(String.prototype.trim),Wt=ct(Object.prototype.hasOwnProperty),at=ct(RegExp.prototype.test),_s=qv(TypeError);function ct(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return bc(i,e,r)}}function qv(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return yc(i,t)}}function Z(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;kd&&kd(i,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(Dv(e)||(e[r]=n),s=n)}i[s]=!0}return i}function $v(i){for(let e=0;e<i.length;e++)Wt(i,e)||(i[e]=null);return i}function ri(i){let e=gc(null);for(let[t,r]of Md(i))Wt(i,t)&&(Array.isArray(r)?e[t]=$v(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=ri(r):e[t]=r);return e}function As(i,e){for(;i!==null;){let r=Bv(i,e);if(r){if(r.get)return ct(r.get);if(typeof r.value=="function")return ct(r.value)}i=Nv(i)}function t(){return null}return t}var Ad=lt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),dc=lt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pc=lt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Vv=lt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fc=lt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wv=lt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cd=lt(["#text"]),Pd=lt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),mc=lt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fd=lt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),bo=lt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gv=Dt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Kv=Dt(/<%[\w\W]*|[\w\W]*%>/gm),Xv=Dt(/\$\{[\w\W]*/gm),Yv=Dt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zv=Dt(/^aria-[\-\w]+$/),Ld=Dt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qv=Dt(/^(?:\w+script|data):/i),Jv=Dt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Id=Dt(/^html$/i),e0=Dt(/^[a-z][.\w]*(-[.\w]+)+$/i),Od=Object.freeze({__proto__:null,ARIA_ATTR:Zv,ATTR_WHITESPACE:Jv,CUSTOM_ELEMENT:e0,DATA_ATTR:Yv,DOCTYPE_NAME:Id,ERB_EXPR:Kv,IS_ALLOWED_URI:Ld,IS_SCRIPT_OR_DATA:Qv,MUSTACHE_EXPR:Gv,TMPLIT_EXPR:Xv}),Cs={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},t0=function(){return typeof window>"u"?null:window},i0=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(r=t.getAttribute(s));let n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},Rd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Dd(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t0(),e=G=>Dd(G);if(e.version="3.3.1",e.removed=[],!i||!i.document||i.document.nodeType!==Cs.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i,r=t,s=r.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:u,NamedNodeMap:f=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:m,DOMParser:v,trustedTypes:b}=i,k=l.prototype,P=As(k,"cloneNode"),F=As(k,"remove"),R=As(k,"nextSibling"),_=As(k,"childNodes"),C=As(k,"parentNode");if(typeof o=="function"){let G=t.createElement("template");G.content&&G.content.ownerDocument&&(t=G.content.ownerDocument)}let S,E="",{implementation:A,createNodeIterator:O,createDocumentFragment:N,getElementsByTagName:z}=t,{importNode:$}=r,j=Rd();e.isSupported=typeof Md=="function"&&typeof C=="function"&&A&&A.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:X,ERB_EXPR:te,TMPLIT_EXPR:ie,DATA_ATTR:je,ARIA_ATTR:ge,IS_SCRIPT_OR_DATA:De,ATTR_WHITESPACE:de,CUSTOM_ELEMENT:tt}=Od,{IS_ALLOWED_URI:At}=Od,re=null,ft=Z({},[...Ad,...dc,...pc,...fc,...Cd]),se=null,Ke=Z({},[...Pd,...mc,...Fd,...bo]),Q=Object.seal(gc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),it=null,Ct=null,be=Object.seal(gc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Zt=!0,li=!0,Qt=!1,qi=!0,Bt=!1,Ai=!0,Ut=!1,ci=!1,hi=!1,zt=!1,ui=!1,rt=!1,Jt=!0,di=!1,$i="user-content-",pi=!0,ei=!1,Ht={},st=null,fi=Z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Jr=null,es=Z({},["audio","video","img","source","image","track"]),ts=null,Tn=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Y="http://www.w3.org/1998/Math/MathML",Vi="http://www.w3.org/2000/svg",Et="http://www.w3.org/1999/xhtml",mt=Et,is=!1,ti=null,Qe=Z({},[Y,Vi,Et],hc),wr=Z({},["mi","mo","mn","ms","mtext"]),Wi=Z({},["annotation-xml"]),Se=Z({},["title","style","font","a","script"]),ne=null,za=["application/xhtml+xml","text/html"],Ci="text/html",Ae=null,nt=null,Ha=t.createElement("form"),Ce=function(w){return w instanceof RegExp||w instanceof Function},gt=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(nt&&nt===w)){if((!w||typeof w!="object")&&(w={}),w=ri(w),ne=za.indexOf(w.PARSER_MEDIA_TYPE)===-1?Ci:w.PARSER_MEDIA_TYPE,Ae=ne==="application/xhtml+xml"?hc:yo,re=Wt(w,"ALLOWED_TAGS")?Z({},w.ALLOWED_TAGS,Ae):ft,se=Wt(w,"ALLOWED_ATTR")?Z({},w.ALLOWED_ATTR,Ae):Ke,ti=Wt(w,"ALLOWED_NAMESPACES")?Z({},w.ALLOWED_NAMESPACES,hc):Qe,ts=Wt(w,"ADD_URI_SAFE_ATTR")?Z(ri(Tn),w.ADD_URI_SAFE_ATTR,Ae):Tn,Jr=Wt(w,"ADD_DATA_URI_TAGS")?Z(ri(es),w.ADD_DATA_URI_TAGS,Ae):es,st=Wt(w,"FORBID_CONTENTS")?Z({},w.FORBID_CONTENTS,Ae):fi,it=Wt(w,"FORBID_TAGS")?Z({},w.FORBID_TAGS,Ae):ri({}),Ct=Wt(w,"FORBID_ATTR")?Z({},w.FORBID_ATTR,Ae):ri({}),Ht=Wt(w,"USE_PROFILES")?w.USE_PROFILES:!1,Zt=w.ALLOW_ARIA_ATTR!==!1,li=w.ALLOW_DATA_ATTR!==!1,Qt=w.ALLOW_UNKNOWN_PROTOCOLS||!1,qi=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Bt=w.SAFE_FOR_TEMPLATES||!1,Ai=w.SAFE_FOR_XML!==!1,Ut=w.WHOLE_DOCUMENT||!1,zt=w.RETURN_DOM||!1,ui=w.RETURN_DOM_FRAGMENT||!1,rt=w.RETURN_TRUSTED_TYPE||!1,hi=w.FORCE_BODY||!1,Jt=w.SANITIZE_DOM!==!1,di=w.SANITIZE_NAMED_PROPS||!1,pi=w.KEEP_CONTENT!==!1,ei=w.IN_PLACE||!1,At=w.ALLOWED_URI_REGEXP||Ld,mt=w.NAMESPACE||Et,wr=w.MATHML_TEXT_INTEGRATION_POINTS||wr,Wi=w.HTML_INTEGRATION_POINTS||Wi,Q=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&Ce(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&Ce(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Bt&&(li=!1),ui&&(zt=!0),Ht&&(re=Z({},Cd),se=[],Ht.html===!0&&(Z(re,Ad),Z(se,Pd)),Ht.svg===!0&&(Z(re,dc),Z(se,mc),Z(se,bo)),Ht.svgFilters===!0&&(Z(re,pc),Z(se,mc),Z(se,bo)),Ht.mathMl===!0&&(Z(re,fc),Z(se,Fd),Z(se,bo))),w.ADD_TAGS&&(typeof w.ADD_TAGS=="function"?be.tagCheck=w.ADD_TAGS:(re===ft&&(re=ri(re)),Z(re,w.ADD_TAGS,Ae))),w.ADD_ATTR&&(typeof w.ADD_ATTR=="function"?be.attributeCheck=w.ADD_ATTR:(se===Ke&&(se=ri(se)),Z(se,w.ADD_ATTR,Ae))),w.ADD_URI_SAFE_ATTR&&Z(ts,w.ADD_URI_SAFE_ATTR,Ae),w.FORBID_CONTENTS&&(st===fi&&(st=ri(st)),Z(st,w.FORBID_CONTENTS,Ae)),w.ADD_FORBID_CONTENTS&&(st===fi&&(st=ri(st)),Z(st,w.ADD_FORBID_CONTENTS,Ae)),pi&&(re["#text"]=!0),Ut&&Z(re,["html","head","body"]),re.table&&(Z(re,["tbody"]),delete it.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw _s('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _s('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=w.TRUSTED_TYPES_POLICY,E=S.createHTML("")}else S===void 0&&(S=i0(b,s)),S!==null&&typeof E=="string"&&(E=S.createHTML(""));lt&&lt(w),nt=w}},mi=Z({},[...dc,...pc,...Vv]),xn=Z({},[...fc,...Wv]),rs=function(w){let U=C(w);(!U||!U.tagName)&&(U={namespaceURI:mt,tagName:"template"});let W=yo(w.tagName),ue=yo(U.tagName);return ti[w.namespaceURI]?w.namespaceURI===Vi?U.namespaceURI===Et?W==="svg":U.namespaceURI===Y?W==="svg"&&(ue==="annotation-xml"||wr[ue]):!!mi[W]:w.namespaceURI===Y?U.namespaceURI===Et?W==="math":U.namespaceURI===Vi?W==="math"&&Wi[ue]:!!xn[W]:w.namespaceURI===Et?U.namespaceURI===Vi&&!Wi[ue]||U.namespaceURI===Y&&!wr[ue]?!1:!xn[W]&&(Se[W]||!mi[W]):!!(ne==="application/xhtml+xml"&&ti[w.namespaceURI]):!1},bt=function(w){xs(e.removed,{element:w});try{C(w).removeChild(w)}catch{F(w)}},Tt=function(w,U){try{xs(e.removed,{attribute:U.getAttributeNode(w),from:U})}catch{xs(e.removed,{attribute:null,from:U})}if(U.removeAttribute(w),w==="is")if(zt||ui)try{bt(U)}catch{}else try{U.setAttribute(w,"")}catch{}},kn=function(w){let U=null,W=null;if(hi)w="<remove></remove>"+w;else{let Te=uc(w,/^[\r\n\t ]+/);W=Te&&Te[0]}ne==="application/xhtml+xml"&&mt===Et&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");let ue=S?S.createHTML(w):w;if(mt===Et)try{U=new v().parseFromString(ue,ne)}catch{}if(!U||!U.documentElement){U=A.createDocument(mt,"template",null);try{U.documentElement.innerHTML=is?E:ue}catch{}}let pe=U.body||U.documentElement;return w&&W&&pe.insertBefore(t.createTextNode(W),pe.childNodes[0]||null),mt===Et?z.call(U,Ut?"html":"body")[0]:Ut?U.documentElement:pe},ss=function(w){return O.call(w.ownerDocument||w,w,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Sr=function(w){return w instanceof m&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof f)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},yt=function(w){return typeof a=="function"&&w instanceof a};function Ee(G,w,U){go(G,W=>{W.call(e,w,U,nt)})}let gi=function(w){let U=null;if(Ee(j.beforeSanitizeElements,w,null),Sr(w))return bt(w),!0;let W=Ae(w.nodeName);if(Ee(j.uponSanitizeElement,w,{tagName:W,allowedTags:re}),Ai&&w.hasChildNodes()&&!yt(w.firstElementChild)&&at(/<[/\w!]/g,w.innerHTML)&&at(/<[/\w!]/g,w.textContent)||w.nodeType===Cs.progressingInstruction||Ai&&w.nodeType===Cs.comment&&at(/<[/\w]/g,w.data))return bt(w),!0;if(!(be.tagCheck instanceof Function&&be.tagCheck(W))&&(!re[W]||it[W])){if(!it[W]&&Er(W)&&(Q.tagNameCheck instanceof RegExp&&at(Q.tagNameCheck,W)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(W)))return!1;if(pi&&!st[W]){let ue=C(w)||w.parentNode,pe=_(w)||w.childNodes;if(pe&&ue){let Te=pe.length;for(let Je=Te-1;Je>=0;--Je){let Pt=P(pe[Je],!0);Pt.__removalCount=(w.__removalCount||0)+1,ue.insertBefore(Pt,R(w))}}}return bt(w),!0}return w instanceof l&&!rs(w)||(W==="noscript"||W==="noembed"||W==="noframes")&&at(/<\/no(script|embed|frames)/i,w.innerHTML)?(bt(w),!0):(Bt&&w.nodeType===Cs.text&&(U=w.textContent,go([X,te,ie],ue=>{U=ks(U,ue," ")}),w.textContent!==U&&(xs(e.removed,{element:w.cloneNode()}),w.textContent=U)),Ee(j.afterSanitizeElements,w,null),!1)},ns=function(w,U,W){if(Jt&&(U==="id"||U==="name")&&(W in t||W in Ha))return!1;if(!(li&&!Ct[U]&&at(je,U))){if(!(Zt&&at(ge,U))){if(!(be.attributeCheck instanceof Function&&be.attributeCheck(U,w))){if(!se[U]||Ct[U]){if(!(Er(w)&&(Q.tagNameCheck instanceof RegExp&&at(Q.tagNameCheck,w)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(w))&&(Q.attributeNameCheck instanceof RegExp&&at(Q.attributeNameCheck,U)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(U,w))||U==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&at(Q.tagNameCheck,W)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(W))))return!1}else if(!ts[U]){if(!at(At,ks(W,de,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&w!=="script"&&Hv(W,"data:")===0&&Jr[w])){if(!(Qt&&!at(De,ks(W,de,"")))){if(W)return!1}}}}}}}return!0},Er=function(w){return w!=="annotation-xml"&&uc(w,tt)},_n=function(w){Ee(j.beforeSanitizeAttributes,w,null);let{attributes:U}=w;if(!U||Sr(w))return;let W={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},ue=U.length;for(;ue--;){let pe=U[ue],{name:Te,namespaceURI:Je,value:Pt}=pe,Pi=Ae(Te),os=Pt,Ne=Te==="value"?os:jv(os);if(W.attrName=Pi,W.attrValue=Ne,W.keepAttr=!0,W.forceKeepAttr=void 0,Ee(j.uponSanitizeAttribute,w,W),Ne=W.attrValue,di&&(Pi==="id"||Pi==="name")&&(Tt(Te,w),Ne=$i+Ne),Ai&&at(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){Tt(Te,w);continue}if(Pi==="attributename"&&uc(Ne,"href")){Tt(Te,w);continue}if(W.forceKeepAttr)continue;if(!W.keepAttr){Tt(Te,w);continue}if(!qi&&at(/\/>/i,Ne)){Tt(Te,w);continue}Bt&&go([X,te,ie],Pn=>{Ne=ks(Ne,Pn," ")});let Cn=Ae(w.nodeName);if(!ns(Cn,Pi,Ne)){Tt(Te,w);continue}if(S&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!Je)switch(b.getAttributeType(Cn,Pi)){case"TrustedHTML":{Ne=S.createHTML(Ne);break}case"TrustedScriptURL":{Ne=S.createScriptURL(Ne);break}}if(Ne!==os)try{Je?w.setAttributeNS(Je,Te,Ne):w.setAttribute(Te,Ne),Sr(w)?bt(w):_d(e.removed)}catch{Tt(Te,w)}}Ee(j.afterSanitizeAttributes,w,null)},An=function G(w){let U=null,W=ss(w);for(Ee(j.beforeSanitizeShadowDOM,w,null);U=W.nextNode();)Ee(j.uponSanitizeShadowNode,U,null),gi(U),_n(U),U.content instanceof n&&G(U.content);Ee(j.afterSanitizeShadowDOM,w,null)};return e.sanitize=function(G){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,W=null,ue=null,pe=null;if(is=!G,is&&(G="<!-->"),typeof G!="string"&&!yt(G))if(typeof G.toString=="function"){if(G=G.toString(),typeof G!="string")throw _s("dirty is not a string, aborting")}else throw _s("toString is not a function");if(!e.isSupported)return G;if(ci||gt(w),e.removed=[],typeof G=="string"&&(ei=!1),ei){if(G.nodeName){let Pt=Ae(G.nodeName);if(!re[Pt]||it[Pt])throw _s("root node is forbidden and cannot be sanitized in-place")}}else if(G instanceof a)U=kn("<!---->"),W=U.ownerDocument.importNode(G,!0),W.nodeType===Cs.element&&W.nodeName==="BODY"||W.nodeName==="HTML"?U=W:U.appendChild(W);else{if(!zt&&!Bt&&!Ut&&G.indexOf("<")===-1)return S&&rt?S.createHTML(G):G;if(U=kn(G),!U)return zt?null:rt?E:""}U&&hi&&bt(U.firstChild);let Te=ss(ei?G:U);for(;ue=Te.nextNode();)gi(ue),_n(ue),ue.content instanceof n&&An(ue.content);if(ei)return G;if(zt){if(ui)for(pe=N.call(U.ownerDocument);U.firstChild;)pe.appendChild(U.firstChild);else pe=U;return(se.shadowroot||se.shadowrootmode)&&(pe=$.call(r,pe,!0)),pe}let Je=Ut?U.outerHTML:U.innerHTML;return Ut&&re["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&at(Id,U.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
32
- `+Je),Bt&&go([X,te,ie],Pt=>{Je=ks(Je,Pt," ")}),S&&rt?S.createHTML(Je):Je},e.setConfig=function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};gt(G),ci=!0},e.clearConfig=function(){nt=null,ci=!1},e.isValidAttribute=function(G,w,U){nt||gt({});let W=Ae(G),ue=Ae(w);return ns(W,ue,U)},e.addHook=function(G,w){typeof w=="function"&&xs(j[G],w)},e.removeHook=function(G,w){if(w!==void 0){let U=Uv(j[G],w);return U===-1?void 0:zv(j[G],U,1)[0]}return _d(j[G])},e.removeHooks=function(G){j[G]=[]},e.removeAllHooks=function(){j=Rd()},e}var Lr=Dd();function Sc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var cr=Sc();function jd(i){cr=i}var Os={exec:()=>null};function ce(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(ht.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var ht={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},r0=/^(?:[ \t]*(?:\n|$))+/,s0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,n0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ms=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,o0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ec=/(?:[*+-]|\d{1,9}[.)])/,qd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$d=ce(qd).replace(/bull/g,Ec).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),a0=ce(qd).replace(/bull/g,Ec).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Tc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,l0=/^[^\n]+/,xc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,c0=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),h0=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ec).getRegex(),So="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",kc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,u0=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",kc).replace("tag",So).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Vd=ce(Tc).replace("hr",Ms).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",So).getRegex(),d0=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Vd).getRegex(),_c={blockquote:d0,code:s0,def:c0,fences:n0,heading:o0,hr:Ms,html:u0,lheading:$d,list:h0,newline:r0,paragraph:Vd,table:Os,text:l0},Nd=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ms).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",So).getRegex(),p0={..._c,lheading:a0,table:Nd,paragraph:ce(Tc).replace("hr",Ms).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Nd).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",So).getRegex()},f0={..._c,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",kc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Os,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Tc).replace("hr",Ms).replace("heading",` *#{1,6} *[^
33
- ]`).replace("lheading",$d).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},m0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,g0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Wd=/^( {2,}|\\)\n(?!\s*$)/,b0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Eo=/[\p{P}\p{S}]/u,Ac=/[\s\p{P}\p{S}]/u,Gd=/[^\s\p{P}\p{S}]/u,y0=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ac).getRegex(),Kd=/(?!~)[\p{P}\p{S}]/u,v0=/(?!~)[\s\p{P}\p{S}]/u,w0=/(?:[^\s\p{P}\p{S}]|~)/u,S0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Xd=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,E0=ce(Xd,"u").replace(/punct/g,Eo).getRegex(),T0=ce(Xd,"u").replace(/punct/g,Kd).getRegex(),Yd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",x0=ce(Yd,"gu").replace(/notPunctSpace/g,Gd).replace(/punctSpace/g,Ac).replace(/punct/g,Eo).getRegex(),k0=ce(Yd,"gu").replace(/notPunctSpace/g,w0).replace(/punctSpace/g,v0).replace(/punct/g,Kd).getRegex(),_0=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Gd).replace(/punctSpace/g,Ac).replace(/punct/g,Eo).getRegex(),A0=ce(/\\(punct)/,"gu").replace(/punct/g,Eo).getRegex(),C0=ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),P0=ce(kc).replace("(?:-->|$)","-->").getRegex(),F0=ce("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",P0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,O0=ce(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",wo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Zd=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",wo).replace("ref",xc).getRegex(),Qd=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",xc).getRegex(),R0=ce("reflink|nolink(?!\\()","g").replace("reflink",Zd).replace("nolink",Qd).getRegex(),Cc={_backpedal:Os,anyPunctuation:A0,autolink:C0,blockSkip:S0,br:Wd,code:g0,del:Os,emStrongLDelim:E0,emStrongRDelimAst:x0,emStrongRDelimUnd:_0,escape:m0,link:O0,nolink:Qd,punctuation:y0,reflink:Zd,reflinkSearch:R0,tag:F0,text:b0,url:Os},M0={...Cc,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",wo).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wo).getRegex()},vc={...Cc,emStrongRDelimAst:k0,emStrongLDelim:T0,url:ce(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},L0={...vc,br:ce(Wd).replace("{2,}","*").getRegex(),text:ce(vc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vo={normal:_c,gfm:p0,pedantic:f0},Ps={normal:Cc,gfm:vc,breaks:L0,pedantic:M0},I0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Bd=i=>I0[i];function si(i,e){if(e){if(ht.escapeTest.test(i))return i.replace(ht.escapeReplace,Bd)}else if(ht.escapeTestNoEncode.test(i))return i.replace(ht.escapeReplaceNoEncode,Bd);return i}function Ud(i){try{i=encodeURI(i).replace(ht.percentDecode,"%")}catch{return null}return i}function zd(i,e){let t=i.replace(ht.findPipe,(n,o,a)=>{let l=!1,u=o;for(;--u>=0&&a[u]==="\\";)l=!l;return l?"|":" |"}),r=t.split(ht.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(ht.slashPipe,"|");return r}function Fs(i,e,t){let r=i.length;if(r===0)return"";let s=0;for(;s<r&&i.charAt(r-s-1)===e;)s++;return i.slice(0,r-s)}function D0(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<i.length;r++)if(i[r]==="\\")r++;else if(i[r]===e[0])t++;else if(i[r]===e[1]&&(t--,t<0))return r;return-1}function Hd(i,e,t,r,s){let n=e.href,o=e.title||null,a=i[1].replace(s.other.outputLinkReplace,"$1");if(i[0].charAt(0)!=="!"){r.state.inLink=!0;let l={type:"link",raw:t,href:n,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:o,text:a}}function N0(i,e,t){let r=i.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
31
+ %o`,t,e,r),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function Wy(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function Gy(i){return Cs(i,"classes").reduce((t,r)=>Object.assign(t,Ky(r)),{})}function Ky(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${As(i)}Class`]:{get(){return this.classes.has(i)}}}}function Xy(i){return Cs(i,"outlets").reduce((t,r)=>Object.assign(t,Yy(r)),{})}function Jh(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function ed(i,e,t){let r=Jh(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=Jh(i,e,t),r))return r}function Yy(i){let e=Il(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=ed(this,t,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let s=ed(this,r,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${As(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function Zy(i){return Cs(i,"targets").reduce((t,r)=>Object.assign(t,Qy(r)),{})}function Qy(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${As(i)}Target`]:{get(){return this.targets.has(i)}}}}function Jy(i){let e=Ly(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=ad(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,ev(s)),t)}function ev(i,e){let t=ad(i,e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(r);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${As(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function ad([i,e],t){return sv({controller:t,token:i,typeDefinition:e})}function ao(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function _s(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function tv(i){let{controller:e,token:t,typeObject:r}=i,s=Xh(r.type),n=Xh(r.default),o=s&&n,a=s&&!n,l=!s&&n,h=ao(r.type),f=_s(i.typeObject.default);if(a)return h;if(l)return f;if(h!==f){let m=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${m}" must match the defined type "${h}". The provided default value of "${r.default}" is of type "${f}".`)}if(o)return h}function iv(i){let{controller:e,token:t,typeDefinition:r}=i,n=tv({controller:e,token:t,typeObject:r}),o=_s(r),a=ao(r),l=n||o||a;if(l)return l;let h=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${h}" for "${t}" value`)}function rv(i){let e=ao(i);if(e)return td[e];let t=Dl(i,"default"),r=Dl(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=ao(n);if(o)return td[o]}return i}function sv(i){let{token:e,typeDefinition:t}=i,r=`${sd(e)}-value`,s=iv(i);return{type:s,key:r,name:ic(r),get defaultValue(){return rv(t)},get hasCustomDefaultValue(){return _s(t)!==void 0},reader:nv[s],writer:id[s]||id.default}}var td={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},nv={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${_s(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${_s(e)}"`);return e},string(i){return i}},id={default:ov,array:rd,object:rd};function rd(i){return JSON.stringify(i)}function ov(i){return`${i}`}var V=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};V.blessings=[Gy,Zy,Jy,Xy];V.targets=[];V.outlets=[];V.values={};var lo=class extends V{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#r(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!0):this.#s(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!1):this.#s(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#r(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#s(i,e){let t=this.#r(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#o(i,e){this.#s(i,e)}};var co=class extends V{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord!==void 0)e.remove();else{e.style.display="none",e.classList.remove(...e.classList);let r=e.querySelector("input[name*='_destroy']");r.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var uo=class extends V{connect(){}preSubmit(){let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var xe="top",je="bottom",Ie="right",Fe="left",ho="auto",Ui=[xe,je,Ie,Fe],Si="start",sr="end",ld="clippingParents",po="viewport",Ir="popper",cd="reference",rc=Ui.reduce(function(i,e){return i.concat([e+"-"+Si,e+"-"+sr])},[]),fo=[].concat(Ui,[ho]).reduce(function(i,e){return i.concat([e,e+"-"+Si,e+"-"+sr])},[]),av="beforeRead",lv="read",cv="afterRead",uv="beforeMain",hv="main",dv="afterMain",pv="beforeWrite",fv="write",mv="afterWrite",ud=[av,lv,cv,uv,hv,dv,pv,fv,mv];function Ge(i){return i?(i.nodeName||"").toLowerCase():null}function be(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function qt(i){var e=be(i).Element;return i instanceof e||i instanceof Element}function qe(i){var e=be(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function Dr(i){if(typeof ShadowRoot>"u")return!1;var e=be(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function gv(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!qe(n)||!Ge(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function bv(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,h){return l[h]="",l},{});!qe(s)||!Ge(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var hd={name:"applyStyles",enabled:!0,phase:"write",fn:gv,effect:bv,requires:["computeStyles"]};function Ke(i){return i.split("-")[0]}var Qt=Math.max,nr=Math.min,Ei=Math.round;function Nr(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Fs(){return!/^((?!chrome|android).)*safari/i.test(Nr())}function $t(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&qe(i)&&(s=i.offsetWidth>0&&Ei(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Ei(r.height)/i.offsetHeight||1);var o=qt(i)?be(i):window,a=o.visualViewport,l=!Fs()&&t,h=(r.left+(l&&a?a.offsetLeft:0))/s,f=(r.top+(l&&a?a.offsetTop:0))/n,m=r.width/s,w=r.height/n;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function or(i){var e=$t(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Ps(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&Dr(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ot(i){return be(i).getComputedStyle(i)}function sc(i){return["table","td","th"].indexOf(Ge(i))>=0}function Je(i){return((qt(i)?i.ownerDocument:i.document)||window.document).documentElement}function Ti(i){return Ge(i)==="html"?i:i.assignedSlot||i.parentNode||(Dr(i)?i.host:null)||Je(i)}function dd(i){return!qe(i)||ot(i).position==="fixed"?null:i.offsetParent}function yv(i){var e=/firefox/i.test(Nr()),t=/Trident/i.test(Nr());if(t&&qe(i)){var r=ot(i);if(r.position==="fixed")return null}var s=Ti(i);for(Dr(s)&&(s=s.host);qe(s)&&["html","body"].indexOf(Ge(s))<0;){var n=ot(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function Jt(i){for(var e=be(i),t=dd(i);t&&sc(t)&&ot(t).position==="static";)t=dd(t);return t&&(Ge(t)==="html"||Ge(t)==="body"&&ot(t).position==="static")?e:t||yv(i)||e}function ar(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function lr(i,e,t){return Qt(i,nr(e,t))}function pd(i,e,t){var r=lr(i,e,t);return r>t?t:r}function Os(){return{top:0,right:0,bottom:0,left:0}}function Rs(i){return Object.assign({},Os(),i)}function Ms(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var vv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Rs(typeof e!="number"?e:Ms(e,Ui))};function wv(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Ke(t.placement),l=ar(a),h=[Fe,Ie].indexOf(a)>=0,f=h?"height":"width";if(!(!n||!o)){var m=vv(s.padding,t),w=or(n),y=l==="y"?xe:Fe,k=l==="y"?je:Ie,C=t.rects.reference[f]+t.rects.reference[l]-o[l]-t.rects.popper[f],O=o[l]-t.rects.reference[l],R=Jt(n),_=R?l==="y"?R.clientHeight||0:R.clientWidth||0:0,F=C/2-O/2,x=m[y],S=_-w[f]-m[k],A=_/2-w[f]/2+F,P=lr(x,A,S),N=l;t.modifiersData[r]=(e={},e[N]=P,e.centerOffset=P-A,e)}}function Sv(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||Ps(e.elements.popper,s)&&(e.elements.arrow=s))}var fd={name:"arrow",enabled:!0,phase:"main",fn:wv,effect:Sv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Vt(i){return i.split("-")[1]}var Ev={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Tv(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Ei(t*s)/s||0,y:Ei(r*s)/s||0}}function md(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,h=i.adaptive,f=i.roundOffsets,m=i.isFixed,w=o.x,y=w===void 0?0:w,k=o.y,C=k===void 0?0:k,O=typeof f=="function"?f({x:y,y:C}):{x:y,y:C};y=O.x,C=O.y;var R=o.hasOwnProperty("x"),_=o.hasOwnProperty("y"),F=Fe,x=xe,S=window;if(h){var A=Jt(t),P="clientHeight",N="clientWidth";if(A===be(t)&&(A=Je(t),ot(A).position!=="static"&&a==="absolute"&&(P="scrollHeight",N="scrollWidth")),A=A,s===xe||(s===Fe||s===Ie)&&n===sr){x=je;var z=m&&A===S&&S.visualViewport?S.visualViewport.height:A[P];C-=z-r.height,C*=l?1:-1}if(s===Fe||(s===xe||s===je)&&n===sr){F=Ie;var q=m&&A===S&&S.visualViewport?S.visualViewport.width:A[N];y-=q-r.width,y*=l?1:-1}}var $=Object.assign({position:a},h&&Ev),Z=f===!0?Tv({x:y,y:C},be(t)):{x:y,y:C};if(y=Z.x,C=Z.y,l){var K;return Object.assign({},$,(K={},K[x]=_?"0":"",K[F]=R?"0":"",K.transform=(S.devicePixelRatio||1)<=1?"translate("+y+"px, "+C+"px)":"translate3d("+y+"px, "+C+"px, 0)",K))}return Object.assign({},$,(e={},e[x]=_?C+"px":"",e[F]=R?y+"px":"",e.transform="",e))}function xv(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,l=a===void 0?!0:a,h={placement:Ke(e.placement),variation:Vt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,md(Object.assign({},h,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,md(Object.assign({},h,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var gd={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:xv,data:{}};var mo={passive:!0};function kv(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,l=be(e.elements.popper),h=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&h.forEach(function(f){f.addEventListener("scroll",t.update,mo)}),a&&l.addEventListener("resize",t.update,mo),function(){n&&h.forEach(function(f){f.removeEventListener("scroll",t.update,mo)}),a&&l.removeEventListener("resize",t.update,mo)}}var bd={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:kv,data:{}};var _v={left:"right",right:"left",bottom:"top",top:"bottom"};function Br(i){return i.replace(/left|right|bottom|top/g,function(e){return _v[e]})}var Av={start:"end",end:"start"};function go(i){return i.replace(/start|end/g,function(e){return Av[e]})}function cr(i){var e=be(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function ur(i){return $t(Je(i)).left+cr(i).scrollLeft}function nc(i,e){var t=be(i),r=Je(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var h=Fs();(h||!h&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+ur(i),y:l}}function oc(i){var e,t=Je(i),r=cr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=Qt(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Qt(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+ur(i),l=-r.scrollTop;return ot(s||t).direction==="rtl"&&(a+=Qt(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function hr(i){var e=ot(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function bo(i){return["html","body","#document"].indexOf(Ge(i))>=0?i.ownerDocument.body:qe(i)&&hr(i)?i:bo(Ti(i))}function zi(i,e){var t;e===void 0&&(e=[]);var r=bo(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=be(r),o=s?[n].concat(n.visualViewport||[],hr(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(zi(Ti(o)))}function Ur(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function Cv(i,e){var t=$t(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function yd(i,e,t){return e===po?Ur(nc(i,t)):qt(e)?Cv(e,t):Ur(oc(Je(i)))}function Fv(i){var e=zi(Ti(i)),t=["absolute","fixed"].indexOf(ot(i).position)>=0,r=t&&qe(i)?Jt(i):i;return qt(r)?e.filter(function(s){return qt(s)&&Ps(s,r)&&Ge(s)!=="body"}):[]}function ac(i,e,t,r){var s=e==="clippingParents"?Fv(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,h){var f=yd(i,h,r);return l.top=Qt(f.top,l.top),l.right=nr(f.right,l.right),l.bottom=nr(f.bottom,l.bottom),l.left=Qt(f.left,l.left),l},yd(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ls(i){var e=i.reference,t=i.element,r=i.placement,s=r?Ke(r):null,n=r?Vt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case xe:l={x:o,y:e.y-t.height};break;case je:l={x:o,y:e.y+e.height};break;case Ie:l={x:e.x+e.width,y:a};break;case Fe:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var h=s?ar(s):null;if(h!=null){var f=h==="y"?"height":"width";switch(n){case Si:l[h]=l[h]-(e[f]/2-t[f]/2);break;case sr:l[h]=l[h]+(e[f]/2-t[f]/2);break;default:}}return l}function ei(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,o=n===void 0?i.strategy:n,a=t.boundary,l=a===void 0?ld:a,h=t.rootBoundary,f=h===void 0?po:h,m=t.elementContext,w=m===void 0?Ir:m,y=t.altBoundary,k=y===void 0?!1:y,C=t.padding,O=C===void 0?0:C,R=Rs(typeof O!="number"?O:Ms(O,Ui)),_=w===Ir?cd:Ir,F=i.rects.popper,x=i.elements[k?_:w],S=ac(qt(x)?x:x.contextElement||Je(i.elements.popper),l,f,o),A=$t(i.elements.reference),P=Ls({reference:A,element:F,strategy:"absolute",placement:s}),N=Ur(Object.assign({},F,P)),z=w===Ir?N:A,q={top:S.top-z.top+R.top,bottom:z.bottom-S.bottom+R.bottom,left:S.left-z.left+R.left,right:z.right-S.right+R.right},$=i.modifiersData.offset;if(w===Ir&&$){var Z=$[s];Object.keys(q).forEach(function(K){var ie=[Ie,je].indexOf(K)>=0?1:-1,Ae=[xe,je].indexOf(K)>=0?"y":"x";q[K]+=Z[Ae]*ie})}return q}function lc(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,h=l===void 0?fo:l,f=Vt(r),m=f?a?rc:rc.filter(function(k){return Vt(k)===f}):Ui,w=m.filter(function(k){return h.indexOf(k)>=0});w.length===0&&(w=m);var y=w.reduce(function(k,C){return k[C]=ei(i,{placement:C,boundary:s,rootBoundary:n,padding:o})[Ke(C)],k},{});return Object.keys(y).sort(function(k,C){return y[k]-y[C]})}function Pv(i){if(Ke(i)===ho)return[];var e=Br(i);return[go(i),e,go(e)]}function Ov(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,h=t.padding,f=t.boundary,m=t.rootBoundary,w=t.altBoundary,y=t.flipVariations,k=y===void 0?!0:y,C=t.allowedAutoPlacements,O=e.options.placement,R=Ke(O),_=R===O,F=l||(_||!k?[Br(O)]:Pv(O)),x=[O].concat(F).reduce(function(Ye,se){return Ye.concat(Ke(se)===ho?lc(e,{placement:se,boundary:f,rootBoundary:m,padding:h,flipVariations:k,allowedAutoPlacements:C}):se)},[]),S=e.rects.reference,A=e.rects.popper,P=new Map,N=!0,z=x[0],q=0;q<x.length;q++){var $=x[q],Z=Ke($),K=Vt($)===Si,ie=[xe,je].indexOf(Z)>=0,Ae=ie?"width":"height",de=ei(e,{placement:$,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),Ue=ie?K?Ie:Fe:K?je:xe;S[Ae]>A[Ae]&&(Ue=Br(Ue));var fe=Br(Ue),nt=[];if(n&&nt.push(de[Z]<=0),a&&nt.push(de[Ue]<=0,de[fe]<=0),nt.every(function(Ye){return Ye})){z=$,N=!1;break}P.set($,nt)}if(N)for(var Pt=k?3:1,St=function(se){var Ot=x.find(function(ne){var Se=P.get(ne);if(Se)return Se.slice(0,se).every(function(Rt){return Rt})});if(Ot)return z=Ot,"break"},pt=Pt;pt>0;pt--){var re=St(pt);if(re==="break")break}e.placement!==z&&(e.modifiersData[r]._skip=!0,e.placement=z,e.reset=!0)}}var vd={name:"flip",enabled:!0,phase:"main",fn:Ov,requiresIfExists:["offset"],data:{_skip:!1}};function wd(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function Sd(i){return[xe,Ie,je,Fe].some(function(e){return i[e]>=0})}function Rv(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=ei(e,{elementContext:"reference"}),a=ei(e,{altBoundary:!0}),l=wd(o,r),h=wd(a,s,n),f=Sd(l),m=Sd(h);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}var Ed={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Rv};function Mv(i,e,t){var r=Ke(i),s=[Fe,xe].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[Fe,Ie].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Lv(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=fo.reduce(function(f,m){return f[m]=Mv(m,e.rects,n),f},{}),a=o[e.placement],l=a.x,h=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=h),e.modifiersData[r]=o}var Td={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Lv};function Iv(i){var e=i.state,t=i.name;e.modifiersData[t]=Ls({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var xd={name:"popperOffsets",enabled:!0,phase:"read",fn:Iv,data:{}};function cc(i){return i==="x"?"y":"x"}function Dv(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,h=t.rootBoundary,f=t.altBoundary,m=t.padding,w=t.tether,y=w===void 0?!0:w,k=t.tetherOffset,C=k===void 0?0:k,O=ei(e,{boundary:l,rootBoundary:h,padding:m,altBoundary:f}),R=Ke(e.placement),_=Vt(e.placement),F=!_,x=ar(R),S=cc(x),A=e.modifiersData.popperOffsets,P=e.rects.reference,N=e.rects.popper,z=typeof C=="function"?C(Object.assign({},e.rects,{placement:e.placement})):C,q=typeof z=="number"?{mainAxis:z,altAxis:z}:Object.assign({mainAxis:0,altAxis:0},z),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Z={x:0,y:0};if(A){if(n){var K,ie=x==="y"?xe:Fe,Ae=x==="y"?je:Ie,de=x==="y"?"height":"width",Ue=A[x],fe=Ue+O[ie],nt=Ue-O[Ae],Pt=y?-N[de]/2:0,St=_===Si?P[de]:N[de],pt=_===Si?-N[de]:-P[de],re=e.elements.arrow,Ye=y&&re?or(re):{width:0,height:0},se=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Os(),Ot=se[ie],ne=se[Ae],Se=lr(0,P[de],Ye[de]),Rt=F?P[de]/2-Pt-Se-Ot-q.mainAxis:St-Se-Ot-q.mainAxis,ft=F?-P[de]/2+Pt+Se+ne+q.mainAxis:pt+Se+ne+q.mainAxis,ni=e.elements.arrow&&Jt(e.elements.arrow),Ai=ni?x==="y"?ni.clientTop||0:ni.clientLeft||0:0,Ki=(K=$?.[x])!=null?K:0,xr=Ue+Rt-Ki-Ai,Kt=Ue+ft-Ki,Xt=lr(y?nr(fe,xr):fe,Ue,y?Qt(nt,Kt):nt);A[x]=Xt,Z[x]=Xt-Ue}if(a){var Et,Ci=x==="x"?xe:Fe,Fi=x==="x"?je:Ie,Ze=A[S],Mt=S==="y"?"height":"width",Yt=Ze+O[Ci],Pi=Ze-O[Fi],Oi=[xe,Fe].indexOf(R)!==-1,Xi=(Et=$?.[S])!=null?Et:0,Ri=Oi?Yt:Ze-P[Mt]-N[Mt]-Xi+q.altAxis,oi=Oi?Ze+P[Mt]+N[Mt]-Xi-q.altAxis:Pi,Lt=y&&Oi?pd(Ri,Ze,oi):lr(y?Ri:Yt,Ze,y?oi:Pi);A[S]=Lt,Z[S]=Lt-Ze}e.modifiersData[r]=Z}}var kd={name:"preventOverflow",enabled:!0,phase:"main",fn:Dv,requiresIfExists:["offset"]};function uc(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function hc(i){return i===be(i)||!qe(i)?cr(i):uc(i)}function Nv(i){var e=i.getBoundingClientRect(),t=Ei(e.width)/i.offsetWidth||1,r=Ei(e.height)/i.offsetHeight||1;return t!==1||r!==1}function dc(i,e,t){t===void 0&&(t=!1);var r=qe(e),s=qe(e)&&Nv(e),n=Je(e),o=$t(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Ge(e)!=="body"||hr(n))&&(a=hc(e)),qe(e)?(l=$t(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=ur(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Bv(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function pc(i){var e=Bv(i);return ud.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function fc(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function mc(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var _d={placement:"bottom",modifiers:[],strategy:"absolute"};function Ad(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Cd(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?_d:s;return function(a,l,h){h===void 0&&(h=n);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},_d,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(R){var _=typeof R=="function"?R(f.options):R;C(),f.options=Object.assign({},n,f.options,_),f.scrollParents={reference:qt(a)?zi(a):a.contextElement?zi(a.contextElement):[],popper:zi(l)};var F=pc(mc([].concat(r,f.options.modifiers)));return f.orderedModifiers=F.filter(function(x){return x.enabled}),k(),y.update()},forceUpdate:function(){if(!w){var R=f.elements,_=R.reference,F=R.popper;if(Ad(_,F)){f.rects={reference:dc(_,Jt(F),f.options.strategy==="fixed"),popper:or(F)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(q){return f.modifiersData[q.name]=Object.assign({},q.data)});for(var x=0;x<f.orderedModifiers.length;x++){if(f.reset===!0){f.reset=!1,x=-1;continue}var S=f.orderedModifiers[x],A=S.fn,P=S.options,N=P===void 0?{}:P,z=S.name;typeof A=="function"&&(f=A({state:f,options:N,name:z,instance:y})||f)}}}},update:fc(function(){return new Promise(function(O){y.forceUpdate(),O(f)})}),destroy:function(){C(),w=!0}};if(!Ad(a,l))return y;y.setOptions(h).then(function(O){!w&&h.onFirstUpdate&&h.onFirstUpdate(O)});function k(){f.orderedModifiers.forEach(function(O){var R=O.name,_=O.options,F=_===void 0?{}:_,x=O.effect;if(typeof x=="function"){var S=x({state:f,name:R,instance:y,options:F}),A=function(){};m.push(S||A)}})}function C(){m.forEach(function(O){return O()}),m=[]}return y}}var Uv=[bd,xd,gd,hd,Td,vd,kd,fd,Ed],gc=Cd({defaultModifiers:Uv});var yo=class extends V{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.popperInstance=gc(this.triggerTarget,this.menuTarget,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["bottom-end","bottom-start","top","top-end","top-start"],boundary:"viewport"}},{name:"preventOverflow",options:{boundary:"viewport",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.popperInstance.destroy(),this.initialized=!1)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{i.type==="click"?this.toggle():setTimeout(()=>{this.show()},this.options.delay)},this.hoverShowMenuHandler=()=>{this.show()},this.hoverHideHandler=()=>{setTimeout(()=>{this.menuTarget.matches(":hover")||this.hide()},this.options.delay)},this.options.triggerType==="click"?this.triggerTarget.addEventListener("click",this.clickHandler):this.options.triggerType==="hover"&&(this.triggerTarget.addEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.addEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.addEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.addEventListener("mouseleave",this.hoverHideHandler))}setupClickOutsideListener(){this.clickOutsideHandler=i=>{let e=i.target,t=this.options.ignoreClickOutsideClass,r=!1;t&&document.querySelectorAll(`.${t}`).forEach(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menuTarget&&!this.menuTarget.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&this.visible&&this.hide()},document.body.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&document.body.removeEventListener("click",this.clickOutsideHandler,!0)}toggle(){this.visible?this.hide():this.show()}show(){this.menuTarget.classList.remove("hidden"),this.menuTarget.classList.add("block"),this.menuTarget.removeAttribute("aria-hidden"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!0}]})),this.setupClickOutsideListener(),this.popperInstance.update(),this.visible=!0}hide(){this.menuTarget.classList.remove("block"),this.menuTarget.classList.add("hidden"),this.menuTarget.setAttribute("aria-hidden","true"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!1}]})),this.removeClickOutsideListener(),this.visible=!1}};var vo=class extends V{static targets=["trigger","menu"];connect(){this.element.hasAttribute("data-visible")||this.element.setAttribute("data-visible","false"),this.#e()}toggle(){let i=this.element.getAttribute("data-visible")==="true";this.element.setAttribute("data-visible",(!i).toString()),this.#e()}#e(){this.element.getAttribute("data-visible")==="true"?(this.menuTarget.classList.remove("hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.dispatch("expand")):(this.menuTarget.classList.add("hidden"),this.triggerTarget.setAttribute("aria-expanded","false"),this.dispatch("collapse"))}};var wo=class extends V{static values={after:Number};connect(){this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var So=class extends V{static targets=["frame","refreshButton","backButton","homeButton","maximizeLink"];connect(){this.#t(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){if(i){let t=i.target.closest("a, form")?.dataset?.turboFrame;if(t&&t!==this.frameTarget.id)return}this.#t()}frameFailed(i){this.#i()}frameLoaded(i){this.#i();let e=i.target.src;this.#e(e)}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.srcHistory=[this.originalFrameSrc],this.#r(),this._homeRequested=!0,this.frameTarget.src=this.originalFrameSrc,this.frameTarget.reload()}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(i){this._homeRequested?(this._homeRequested=!1,this.srcHistory=[i],this.originalFrameSrc=i):i==this.currentSrc||(i==this.originalFrameSrc?this.srcHistory=[i]:this.srcHistory.push(i)),this.#r(),this.hasMaximizeLinkTarget&&(this.maximizeLinkTarget.href=i)}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#i(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#r(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var Eo=["auto","light","dark"],To=class extends V{static values={current:String};connect(){this.applyMode(this.readMode()),this.handleStorageChange=i=>{i.key==="theme"&&this.applyMode(this.readMode())},window.addEventListener("storage",this.handleStorageChange),this.mq=window.matchMedia("(prefers-color-scheme: dark)"),this.handleMqChange=()=>{this.readMode()==="auto"&&this.applyMode("auto")},this.mq.addEventListener("change",this.handleMqChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange),this.mq&&this.mq.removeEventListener("change",this.handleMqChange)}toggleMode(){let i=this.readMode(),e=Eo[(Eo.indexOf(i)+1)%Eo.length];this.setMode(e)}setMode(i){localStorage.setItem("theme",i),this.applyMode(i)}applyMode(i){let e=this.effectiveMode(i);document.documentElement.classList.toggle("dark",e==="dark"),this.currentValue=i,this.toggleIcons(i)}readMode(){let i=localStorage.getItem("theme");return Eo.includes(i)?i:"auto"}effectiveMode(i){return i==="light"||i==="dark"?i:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}toggleIcons(i){let e={auto:this.element.querySelector(".color-mode-icon-auto"),light:this.element.querySelector(".color-mode-icon-light"),dark:this.element.querySelector(".color-mode-icon-dark")};for(let[t,r]of Object.entries(e))r&&r.classList.toggle("hidden",t!==i)}};function Fd(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}function zv(i){if(Array.isArray(i))return i}function Hv(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,o,a=[],l=!0,h=!1;try{if(n=(t=t.call(i)).next,e!==0)for(;!(l=(r=n.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(f){h=!0,s=f}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(h)throw s}}return a}}function jv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
32
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qv(i,e){return zv(i)||Hv(i,e)||$v(i,e)||jv()}function $v(i,e){if(i){if(typeof i=="string")return Fd(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Fd(i,e):void 0}}var jd=Object.entries,Pd=Object.setPrototypeOf,Vv=Object.isFrozen,Wv=Object.getPrototypeOf,Gv=Object.getOwnPropertyDescriptor,lt=Object.freeze,Wt=Object.seal,$r=Object.create,qd=typeof Reflect<"u"&&Reflect,Ec=qd.apply,Tc=qd.construct;lt||(lt=function(e){return e});Wt||(Wt=function(e){return e});Ec||(Ec=function(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return e.apply(t,s)});Tc||(Tc=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return new e(...r)});var zr=De(Array.prototype.forEach),Kv=De(Array.prototype.lastIndexOf),Od=De(Array.prototype.pop),Hr=De(Array.prototype.push),Xv=De(Array.prototype.splice),at=Array.isArray,Ds=De(String.prototype.toLowerCase),bc=De(String.prototype.toString),Rd=De(String.prototype.match),jr=De(String.prototype.replace),Md=De(String.prototype.indexOf),Yv=De(String.prototype.trim),Zv=De(Number.prototype.toString),Qv=De(Boolean.prototype.toString),Ld=typeof BigInt>"u"?null:De(BigInt.prototype.toString),Id=typeof Symbol>"u"?null:De(Symbol.prototype.toString),ke=De(Object.prototype.hasOwnProperty),Is=De(Object.prototype.toString),et=De(RegExp.prototype.test),xo=Jv(TypeError);function De(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return Ec(i,e,r)}}function Jv(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Tc(i,t)}}function Y(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ds;if(Pd&&Pd(i,null),!at(e))return i;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(Vv(e)||(e[r]=n),s=n)}i[s]=!0}return i}function e0(i){for(let e=0;e<i.length;e++)ke(i,e)||(i[e]=null);return i}function yt(i){let e=$r(null);for(let r of jd(i)){var t=qv(r,2);let s=t[0],n=t[1];ke(i,s)&&(at(n)?e[s]=e0(n):n&&typeof n=="object"&&n.constructor===Object?e[s]=yt(n):e[s]=n)}return e}function t0(i){switch(typeof i){case"string":return i;case"number":return Zv(i);case"boolean":return Qv(i);case"bigint":return Ld?Ld(i):"0";case"symbol":return Id?Id(i):"Symbol()";case"undefined":return Is(i);case"function":case"object":{if(i===null)return Is(i);let e=i,t=Vr(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:Is(r)}return Is(i)}default:return Is(i)}}function Vr(i,e){for(;i!==null;){let r=Gv(i,e);if(r){if(r.get)return De(r.get);if(typeof r.value=="function")return De(r.value)}i=Wv(i)}function t(){return null}return t}function i0(i){try{return et(i,""),!0}catch{return!1}}var Dd=lt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yc=lt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vc=lt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),r0=lt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wc=lt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),s0=lt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Nd=lt(["#text"]),Bd=lt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Sc=lt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ud=lt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ko=lt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),n0=Wt(/{{[\w\W]*|^[\w\W]*}}/g),o0=Wt(/<%[\w\W]*|^[\w\W]*%>/g),a0=Wt(/\${[\w\W]*/g),l0=Wt(/^data-[\-\w.\u00B7-\uFFFF]+$/),c0=Wt(/^aria-[\-\w]+$/),zd=Wt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),u0=Wt(/^(?:\w+script|data):/i),h0=Wt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),d0=Wt(/^html$/i),p0=Wt(/^[a-z][.\w]*(-[.\w]+)+$/i),qr={element:1,text:3,progressingInstruction:7,comment:8,document:9},f0=function(){return typeof window>"u"?null:window},m0=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(r=t.getAttribute(s));let n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},Hd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $d(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f0(),e=G=>$d(G);if(e.version="3.4.3",e.removed=[],!i||!i.document||i.document.nodeType!==qr.document||!i.Element)return e.isSupported=!1,e;let t=i.document,r=t,s=r.currentScript,n=i.DocumentFragment,o=i.HTMLTemplateElement,a=i.Node,l=i.Element,h=i.NodeFilter,f=i.NamedNodeMap,m=f===void 0?i.NamedNodeMap||i.MozNamedAttrMap:f,w=i.HTMLFormElement,y=i.DOMParser,k=i.trustedTypes,C=l.prototype,O=Vr(C,"cloneNode"),R=Vr(C,"remove"),_=Vr(C,"nextSibling"),F=Vr(C,"childNodes"),x=Vr(C,"parentNode");if(typeof o=="function"){let G=t.createElement("template");G.content&&G.content.ownerDocument&&(t=G.content.ownerDocument)}let S,A="",P=t,N=P.implementation,z=P.createNodeIterator,q=P.createDocumentFragment,$=P.getElementsByTagName,Z=r.importNode,K=Hd();e.isSupported=typeof jd=="function"&&typeof x=="function"&&N&&N.createHTMLDocument!==void 0;let ie=n0,Ae=o0,de=a0,Ue=l0,fe=c0,nt=u0,Pt=h0,St=p0,pt=zd,re=null,Ye=Y({},[...Dd,...yc,...vc,...wc,...Nd]),se=null,Ot=Y({},[...Bd,...Sc,...Ud,...ko]),ne=Object.seal($r(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,Rt=null,ft=Object.seal($r(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ni=!0,Ai=!0,Ki=!1,xr=!0,Kt=!1,Xt=!0,Et=!1,Ci=!1,Fi=!1,Ze=!1,Mt=!1,Yt=!1,Pi=!0,Oi=!1,Xi="user-content-",Ri=!0,oi=!1,Lt={},Tt=null,kr=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),On=null,Rn=Y({},["audio","video","img","source","image","track"]),Q=null,hs=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Mi="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Dt="http://www.w3.org/1999/xhtml",xt=Dt,$e=!1,ds=null,Mn=Y({},[Mi,It,Dt],bc),me=Y({},["mi","mo","mn","ms","mtext"]),he=Y({},["annotation-xml"]),Ga=Y({},["title","style","font","a","script"]),Nt=null,Ka=["application/xhtml+xml","text/html"],ai="text/html",Ce=null,pe=null,Bt=t.createElement("form"),mi=function(b){return b instanceof RegExp||b instanceof Function},ps=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pe&&pe===b)return;(!b||typeof b!="object")&&(b={}),b=yt(b),Nt=Ka.indexOf(b.PARSER_MEDIA_TYPE)===-1?ai:b.PARSER_MEDIA_TYPE,Ce=Nt==="application/xhtml+xml"?bc:Ds,re=ke(b,"ALLOWED_TAGS")&&at(b.ALLOWED_TAGS)?Y({},b.ALLOWED_TAGS,Ce):Ye,se=ke(b,"ALLOWED_ATTR")&&at(b.ALLOWED_ATTR)?Y({},b.ALLOWED_ATTR,Ce):Ot,ds=ke(b,"ALLOWED_NAMESPACES")&&at(b.ALLOWED_NAMESPACES)?Y({},b.ALLOWED_NAMESPACES,bc):Mn,Q=ke(b,"ADD_URI_SAFE_ATTR")&&at(b.ADD_URI_SAFE_ATTR)?Y(yt(hs),b.ADD_URI_SAFE_ATTR,Ce):hs,On=ke(b,"ADD_DATA_URI_TAGS")&&at(b.ADD_DATA_URI_TAGS)?Y(yt(Rn),b.ADD_DATA_URI_TAGS,Ce):Rn,Tt=ke(b,"FORBID_CONTENTS")&&at(b.FORBID_CONTENTS)?Y({},b.FORBID_CONTENTS,Ce):kr,Se=ke(b,"FORBID_TAGS")&&at(b.FORBID_TAGS)?Y({},b.FORBID_TAGS,Ce):yt({}),Rt=ke(b,"FORBID_ATTR")&&at(b.FORBID_ATTR)?Y({},b.FORBID_ATTR,Ce):yt({}),Lt=ke(b,"USE_PROFILES")?b.USE_PROFILES&&typeof b.USE_PROFILES=="object"?yt(b.USE_PROFILES):b.USE_PROFILES:!1,ni=b.ALLOW_ARIA_ATTR!==!1,Ai=b.ALLOW_DATA_ATTR!==!1,Ki=b.ALLOW_UNKNOWN_PROTOCOLS||!1,xr=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Kt=b.SAFE_FOR_TEMPLATES||!1,Xt=b.SAFE_FOR_XML!==!1,Et=b.WHOLE_DOCUMENT||!1,Ze=b.RETURN_DOM||!1,Mt=b.RETURN_DOM_FRAGMENT||!1,Yt=b.RETURN_TRUSTED_TYPE||!1,Fi=b.FORCE_BODY||!1,Pi=b.SANITIZE_DOM!==!1,Oi=b.SANITIZE_NAMED_PROPS||!1,Ri=b.KEEP_CONTENT!==!1,oi=b.IN_PLACE||!1,pt=i0(b.ALLOWED_URI_REGEXP)?b.ALLOWED_URI_REGEXP:zd,xt=typeof b.NAMESPACE=="string"?b.NAMESPACE:Dt,me=ke(b,"MATHML_TEXT_INTEGRATION_POINTS")&&b.MATHML_TEXT_INTEGRATION_POINTS&&typeof b.MATHML_TEXT_INTEGRATION_POINTS=="object"?yt(b.MATHML_TEXT_INTEGRATION_POINTS):Y({},["mi","mo","mn","ms","mtext"]),he=ke(b,"HTML_INTEGRATION_POINTS")&&b.HTML_INTEGRATION_POINTS&&typeof b.HTML_INTEGRATION_POINTS=="object"?yt(b.HTML_INTEGRATION_POINTS):Y({},["annotation-xml"]);let D=ke(b,"CUSTOM_ELEMENT_HANDLING")&&b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING=="object"?yt(b.CUSTOM_ELEMENT_HANDLING):$r(null);if(ne=$r(null),ke(D,"tagNameCheck")&&mi(D.tagNameCheck)&&(ne.tagNameCheck=D.tagNameCheck),ke(D,"attributeNameCheck")&&mi(D.attributeNameCheck)&&(ne.attributeNameCheck=D.attributeNameCheck),ke(D,"allowCustomizedBuiltInElements")&&typeof D.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=D.allowCustomizedBuiltInElements),Kt&&(Ai=!1),Mt&&(Ze=!0),Lt&&(re=Y({},Nd),se=$r(null),Lt.html===!0&&(Y(re,Dd),Y(se,Bd)),Lt.svg===!0&&(Y(re,yc),Y(se,Sc),Y(se,ko)),Lt.svgFilters===!0&&(Y(re,vc),Y(se,Sc),Y(se,ko)),Lt.mathMl===!0&&(Y(re,wc),Y(se,Ud),Y(se,ko))),ft.tagCheck=null,ft.attributeCheck=null,ke(b,"ADD_TAGS")&&(typeof b.ADD_TAGS=="function"?ft.tagCheck=b.ADD_TAGS:at(b.ADD_TAGS)&&(re===Ye&&(re=yt(re)),Y(re,b.ADD_TAGS,Ce))),ke(b,"ADD_ATTR")&&(typeof b.ADD_ATTR=="function"?ft.attributeCheck=b.ADD_ATTR:at(b.ADD_ATTR)&&(se===Ot&&(se=yt(se)),Y(se,b.ADD_ATTR,Ce))),ke(b,"ADD_URI_SAFE_ATTR")&&at(b.ADD_URI_SAFE_ATTR)&&Y(Q,b.ADD_URI_SAFE_ATTR,Ce),ke(b,"FORBID_CONTENTS")&&at(b.FORBID_CONTENTS)&&(Tt===kr&&(Tt=yt(Tt)),Y(Tt,b.FORBID_CONTENTS,Ce)),ke(b,"ADD_FORBID_CONTENTS")&&at(b.ADD_FORBID_CONTENTS)&&(Tt===kr&&(Tt=yt(Tt)),Y(Tt,b.ADD_FORBID_CONTENTS,Ce)),Ri&&(re["#text"]=!0),Et&&Y(re,["html","head","body"]),re.table&&(Y(re,["tbody"]),delete Se.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw xo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=b.TRUSTED_TYPES_POLICY,A=S.createHTML("")}else S===void 0&&(S=m0(k,s)),S!==null&&typeof A=="string"&&(A=S.createHTML(""));lt&&lt(b),pe=b},_r=Y({},[...yc,...vc,...r0]),Ar=Y({},[...wc,...s0]),Yi=function(b){let D=x(b);(!D||!D.tagName)&&(D={namespaceURI:xt,tagName:"template"});let W=Ds(b.tagName),J=Ds(D.tagName);return ds[b.namespaceURI]?b.namespaceURI===It?D.namespaceURI===Dt?W==="svg":D.namespaceURI===Mi?W==="svg"&&(J==="annotation-xml"||me[J]):!!_r[W]:b.namespaceURI===Mi?D.namespaceURI===Dt?W==="math":D.namespaceURI===It?W==="math"&&he[J]:!!Ar[W]:b.namespaceURI===Dt?D.namespaceURI===It&&!he[J]||D.namespaceURI===Mi&&!me[J]?!1:!Ar[W]&&(Ga[W]||!_r[W]):!!(Nt==="application/xhtml+xml"&&ds[b.namespaceURI]):!1},kt=function(b){Hr(e.removed,{element:b});try{x(b).removeChild(b)}catch{R(b)}},li=function(b,D){try{Hr(e.removed,{attribute:D.getAttributeNode(b),from:D})}catch{Hr(e.removed,{attribute:null,from:D})}if(D.removeAttribute(b),b==="is")if(Ze||Mt)try{kt(D)}catch{}else try{D.setAttribute(b,"")}catch{}},fs=function(b){let D=null,W=null;if(Fi)b="<remove></remove>"+b;else{let Ee=Rd(b,/^[\r\n\t ]+/);W=Ee&&Ee[0]}Nt==="application/xhtml+xml"&&xt===Dt&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");let J=S?S.createHTML(b):b;if(xt===Dt)try{D=new y().parseFromString(J,Nt)}catch{}if(!D||!D.documentElement){D=N.createDocument(xt,"template",null);try{D.documentElement.innerHTML=$e?A:J}catch{}}let Oe=D.body||D.documentElement;return b&&W&&Oe.insertBefore(t.createTextNode(W),Oe.childNodes[0]||null),xt===Dt?$.call(D,Et?"html":"body")[0]:Et?D.documentElement:Oe},mt=function(b){return z.call(b.ownerDocument||b,b,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},it=function(b){return b instanceof w&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof m)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ci=function(b){return typeof a=="function"&&b instanceof a};function Ut(G,b,D){zr(G,W=>{W.call(e,b,D,pe)})}let Cr=function(b){let D=null;if(Ut(K.beforeSanitizeElements,b,null),it(b))return kt(b),!0;let W=Ce(b.nodeName);if(Ut(K.uponSanitizeElement,b,{tagName:W,allowedTags:re}),Xt&&b.hasChildNodes()&&!ci(b.firstElementChild)&&et(/<[/\w!]/g,b.innerHTML)&&et(/<[/\w!]/g,b.textContent)||Xt&&b.namespaceURI===Dt&&W==="style"&&ci(b.firstElementChild)||b.nodeType===qr.progressingInstruction||Xt&&b.nodeType===qr.comment&&et(/<[/\w]/g,b.data))return kt(b),!0;if(Se[W]||!(ft.tagCheck instanceof Function&&ft.tagCheck(W))&&!re[W]){if(!Se[W]&&ms(W)&&(ne.tagNameCheck instanceof RegExp&&et(ne.tagNameCheck,W)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(W)))return!1;if(Ri&&!Tt[W]){let J=x(b)||b.parentNode,Oe=F(b)||b.childNodes;if(Oe&&J){let Ee=Oe.length;for(let rt=Ee-1;rt>=0;--rt){let gt=O(Oe[rt],!0);J.insertBefore(gt,_(b))}}}return kt(b),!0}return b instanceof l&&!Yi(b)||(W==="noscript"||W==="noembed"||W==="noframes")&&et(/<\/no(script|embed|frames)/i,b.innerHTML)?(kt(b),!0):(Kt&&b.nodeType===qr.text&&(D=b.textContent,zr([ie,Ae,de],J=>{D=jr(D,J," ")}),b.textContent!==D&&(Hr(e.removed,{element:b.cloneNode()}),b.textContent=D)),Ut(K.afterSanitizeElements,b,null),!1)},Ln=function(b,D,W){if(Rt[D]||Pi&&(D==="id"||D==="name")&&(W in t||W in Bt))return!1;let J=se[D]||ft.attributeCheck instanceof Function&&ft.attributeCheck(D,b);if(!(Ai&&!Rt[D]&&et(Ue,D))){if(!(ni&&et(fe,D))){if(!J||Rt[D]){if(!(ms(b)&&(ne.tagNameCheck instanceof RegExp&&et(ne.tagNameCheck,b)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(b))&&(ne.attributeNameCheck instanceof RegExp&&et(ne.attributeNameCheck,D)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(D,b))||D==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&et(ne.tagNameCheck,W)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(W))))return!1}else if(!Q[D]){if(!et(pt,jr(W,Pt,""))){if(!((D==="src"||D==="xlink:href"||D==="href")&&b!=="script"&&Md(W,"data:")===0&&On[b])){if(!(Ki&&!et(nt,jr(W,Pt,"")))){if(W)return!1}}}}}}return!0},In=Y({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ms=function(b){return!In[Ds(b)]&&et(St,b)},Li=function(b){Ut(K.beforeSanitizeAttributes,b,null);let D=b.attributes;if(!D||it(b))return;let W={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},J=D.length;for(;J--;){let Oe=D[J],Ee=Oe.name,rt=Oe.namespaceURI,gt=Oe.value,_t=Ce(Ee),bs=gt,Re=Ee==="value"?bs:Yv(bs);if(W.attrName=_t,W.attrValue=Re,W.keepAttr=!0,W.forceKeepAttr=void 0,Ut(K.uponSanitizeAttribute,b,W),Re=W.attrValue,Oi&&(_t==="id"||_t==="name")&&Md(Re,Xi)!==0&&(li(Ee,b),Re=Xi+Re),Xt&&et(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Re)){li(Ee,b);continue}if(_t==="attributename"&&Rd(Re,"href")){li(Ee,b);continue}if(W.forceKeepAttr)continue;if(!W.keepAttr){li(Ee,b);continue}if(!xr&&et(/\/>/i,Re)){li(Ee,b);continue}Kt&&zr([ie,Ae,de],Nn=>{Re=jr(Re,Nn," ")});let Dn=Ce(b.nodeName);if(!Ln(Dn,_t,Re)){li(Ee,b);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!rt)switch(k.getAttributeType(Dn,_t)){case"TrustedHTML":{Re=S.createHTML(Re);break}case"TrustedScriptURL":{Re=S.createScriptURL(Re);break}}if(Re!==bs)try{rt?b.setAttributeNS(rt,Ee,Re):b.setAttribute(Ee,Re),it(b)?kt(b):Od(e.removed)}catch{li(Ee,b)}}Ut(K.afterSanitizeAttributes,b,null)},gs=function(b){let D=null,W=mt(b);for(Ut(K.beforeSanitizeShadowDOM,b,null);D=W.nextNode();)Ut(K.uponSanitizeShadowNode,D,null),Cr(D),Li(D),D.content instanceof n&&gs(D.content);Ut(K.afterSanitizeShadowDOM,b,null)},gi=function(b){if(b.nodeType===qr.element&&b.shadowRoot instanceof n){let J=b.shadowRoot;gi(J),gs(J)}let D=b.childNodes;if(!D)return;let W=[];zr(D,J=>{Hr(W,J)});for(let J of W)gi(J)};return e.sanitize=function(G){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D=null,W=null,J=null,Oe=null;if($e=!G,$e&&(G="<!-->"),typeof G!="string"&&!ci(G)&&(G=t0(G),typeof G!="string"))throw xo("dirty is not a string, aborting");if(!e.isSupported)return G;if(Ci||ps(b),e.removed=[],typeof G=="string"&&(oi=!1),oi){let gt=G.nodeName;if(typeof gt=="string"){let _t=Ce(gt);if(!re[_t]||Se[_t])throw xo("root node is forbidden and cannot be sanitized in-place")}gi(G)}else if(G instanceof a)D=fs("<!---->"),W=D.ownerDocument.importNode(G,!0),W.nodeType===qr.element&&W.nodeName==="BODY"||W.nodeName==="HTML"?D=W:D.appendChild(W),gi(W);else{if(!Ze&&!Kt&&!Et&&G.indexOf("<")===-1)return S&&Yt?S.createHTML(G):G;if(D=fs(G),!D)return Ze?null:Yt?A:""}D&&Fi&&kt(D.firstChild);let Ee=mt(oi?G:D);for(;J=Ee.nextNode();)Cr(J),Li(J),J.content instanceof n&&gs(J.content);if(oi)return G;if(Ze){if(Kt){D.normalize();let gt=D.innerHTML;zr([ie,Ae,de],_t=>{gt=jr(gt,_t," ")}),D.innerHTML=gt}if(Mt)for(Oe=q.call(D.ownerDocument);D.firstChild;)Oe.appendChild(D.firstChild);else Oe=D;return(se.shadowroot||se.shadowrootmode)&&(Oe=Z.call(r,Oe,!0)),Oe}let rt=Et?D.outerHTML:D.innerHTML;return Et&&re["!doctype"]&&D.ownerDocument&&D.ownerDocument.doctype&&D.ownerDocument.doctype.name&&et(d0,D.ownerDocument.doctype.name)&&(rt="<!DOCTYPE "+D.ownerDocument.doctype.name+`>
33
+ `+rt),Kt&&zr([ie,Ae,de],gt=>{rt=jr(rt,gt," ")}),S&&Yt?S.createHTML(rt):rt},e.setConfig=function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ps(G),Ci=!0},e.clearConfig=function(){pe=null,Ci=!1},e.isValidAttribute=function(G,b,D){pe||ps({});let W=Ce(G),J=Ce(b);return Ln(W,J,D)},e.addHook=function(G,b){typeof b=="function"&&Hr(K[G],b)},e.removeHook=function(G,b){if(b!==void 0){let D=Kv(K[G],b);return D===-1?void 0:Xv(K[G],D,1)[0]}return Od(K[G])},e.removeHooks=function(G){K[G]=[]},e.removeAllHooks=function(){K=Hd()},e}var Wr=$d();function _c(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var pr=_c();function Yd(i){pr=i}var Us={exec:()=>null};function ce(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(ct.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var ct={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},g0=/^(?:[ \t]*(?:\n|$))+/,b0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,y0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,v0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ac=/(?:[*+-]|\d{1,9}[.)])/,Zd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qd=ce(Zd).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),w0=ce(Zd).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Cc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,S0=/^[^\n]+/,Fc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,E0=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),T0=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ac).getRegex(),Co="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Pc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,x0=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Pc).replace("tag",Co).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Jd=ce(Cc).replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Co).getRegex(),k0=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Jd).getRegex(),Oc={blockquote:k0,code:b0,def:E0,fences:y0,heading:v0,hr:Hs,html:x0,lheading:Qd,list:T0,newline:g0,paragraph:Jd,table:Us,text:S0},Vd=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Co).getRegex(),_0={...Oc,lheading:w0,table:Vd,paragraph:ce(Cc).replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vd).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Co).getRegex()},A0={...Oc,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Us,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Cc).replace("hr",Hs).replace("heading",` *#{1,6} *[^
34
+ ]`).replace("lheading",Qd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},C0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,F0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ep=/^( {2,}|\\)\n(?!\s*$)/,P0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fo=/[\p{P}\p{S}]/u,Rc=/[\s\p{P}\p{S}]/u,tp=/[^\s\p{P}\p{S}]/u,O0=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Rc).getRegex(),ip=/(?!~)[\p{P}\p{S}]/u,R0=/(?!~)[\s\p{P}\p{S}]/u,M0=/(?:[^\s\p{P}\p{S}]|~)/u,L0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,rp=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,I0=ce(rp,"u").replace(/punct/g,Fo).getRegex(),D0=ce(rp,"u").replace(/punct/g,ip).getRegex(),sp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",N0=ce(sp,"gu").replace(/notPunctSpace/g,tp).replace(/punctSpace/g,Rc).replace(/punct/g,Fo).getRegex(),B0=ce(sp,"gu").replace(/notPunctSpace/g,M0).replace(/punctSpace/g,R0).replace(/punct/g,ip).getRegex(),U0=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,tp).replace(/punctSpace/g,Rc).replace(/punct/g,Fo).getRegex(),z0=ce(/\\(punct)/,"gu").replace(/punct/g,Fo).getRegex(),H0=ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),j0=ce(Pc).replace("(?:-->|$)","-->").getRegex(),q0=ce("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",j0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ao=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$0=ce(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ao).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),np=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",Ao).replace("ref",Fc).getRegex(),op=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fc).getRegex(),V0=ce("reflink|nolink(?!\\()","g").replace("reflink",np).replace("nolink",op).getRegex(),Mc={_backpedal:Us,anyPunctuation:z0,autolink:H0,blockSkip:L0,br:ep,code:F0,del:Us,emStrongLDelim:I0,emStrongRDelimAst:N0,emStrongRDelimUnd:U0,escape:C0,link:$0,nolink:op,punctuation:O0,reflink:np,reflinkSearch:V0,tag:q0,text:P0,url:Us},W0={...Mc,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",Ao).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ao).getRegex()},xc={...Mc,emStrongRDelimAst:B0,emStrongLDelim:D0,url:ce(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},G0={...xc,br:ce(ep).replace("{2,}","*").getRegex(),text:ce(xc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_o={normal:Oc,gfm:_0,pedantic:A0},Ns={normal:Mc,gfm:xc,breaks:G0,pedantic:W0},K0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Wd=i=>K0[i];function hi(i,e){if(e){if(ct.escapeTest.test(i))return i.replace(ct.escapeReplace,Wd)}else if(ct.escapeTestNoEncode.test(i))return i.replace(ct.escapeReplaceNoEncode,Wd);return i}function Gd(i){try{i=encodeURI(i).replace(ct.percentDecode,"%")}catch{return null}return i}function Kd(i,e){let t=i.replace(ct.findPipe,(n,o,a)=>{let l=!1,h=o;for(;--h>=0&&a[h]==="\\";)l=!l;return l?"|":" |"}),r=t.split(ct.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(ct.slashPipe,"|");return r}function Bs(i,e,t){let r=i.length;if(r===0)return"";let s=0;for(;s<r&&i.charAt(r-s-1)===e;)s++;return i.slice(0,r-s)}function X0(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<i.length;r++)if(i[r]==="\\")r++;else if(i[r]===e[0])t++;else if(i[r]===e[1]&&(t--,t<0))return r;return-1}function Xd(i,e,t,r,s){let n=e.href,o=e.title||null,a=i[1].replace(s.other.outputLinkReplace,"$1");if(i[0].charAt(0)!=="!"){r.state.inLink=!0;let l={type:"link",raw:t,href:n,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:o,text:a}}function Y0(i,e,t){let r=i.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
34
35
  `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=s.length?n.slice(s.length):n}).join(`
35
- `)}var Dr=class{options;rules;lexer;constructor(e){this.options=e||cr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Fs(r,`
36
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=N0(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let s=Fs(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Fs(t[0],`
37
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Fs(t[0],`
36
+ `)}var Kr=class{options;rules;lexer;constructor(e){this.options=e||pr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Bs(r,`
37
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=Y0(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let s=Bs(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Bs(t[0],`
38
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Bs(t[0],`
38
39
  `).split(`
39
- `),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],u;for(u=0;u<r.length;u++)if(this.rules.other.blockquoteStart.test(r[u]))l.push(r[u]),a=!0;else if(!a)l.push(r[u]);else break;r=r.slice(u);let f=l.join(`
40
+ `),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))l.push(r[h]),a=!0;else if(!a)l.push(r[h]);else break;r=r.slice(h);let f=l.join(`
40
41
  `),m=f.replace(this.rules.other.blockquoteSetextReplace,`
41
42
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
42
43
  ${f}`:f,n=n?`${n}
43
- ${m}`:m;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=v,r.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let k=b,P=k.raw+`
44
+ ${m}`:m;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=w,r.length===0)break;let y=o.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){let k=y,C=k.raw+`
44
45
  `+r.join(`
45
- `),F=this.blockquote(P);o[o.length-1]=F,s=s.substring(0,s.length-k.raw.length)+F.raw,n=n.substring(0,n.length-k.text.length)+F.text;break}else if(b?.type==="list"){let k=b,P=k.raw+`
46
+ `),O=this.blockquote(C);o[o.length-1]=O,s=s.substring(0,s.length-k.raw.length)+O.raw,n=n.substring(0,n.length-k.text.length)+O.text;break}else if(y?.type==="list"){let k=y,C=k.raw+`
46
47
  `+r.join(`
47
- `),F=this.list(P);o[o.length-1]=F,s=s.substring(0,s.length-b.raw.length)+F.raw,n=n.substring(0,n.length-k.raw.length)+F.raw,r=P.substring(o.at(-1).raw.length).split(`
48
- `);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let u=!1,f="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let v=t[2].split(`
49
- `,1)[0].replace(this.rules.other.listReplaceTabs,_=>" ".repeat(3*_.length)),b=e.split(`
50
- `,1)[0],k=!v.trim(),P=0;if(this.options.pedantic?(P=2,m=v.trimStart()):k?P=t[1].length+1:(P=t[2].search(this.rules.other.nonSpaceChar),P=P>4?1:P,m=v.slice(P),P+=t[1].length),k&&this.rules.other.blankLine.test(b)&&(f+=b+`
51
- `,e=e.substring(b.length+1),u=!0),!u){let _=this.rules.other.nextBulletRegex(P),C=this.rules.other.hrRegex(P),S=this.rules.other.fencesBeginRegex(P),E=this.rules.other.headingBeginRegex(P),A=this.rules.other.htmlBeginRegex(P);for(;e;){let O=e.split(`
52
- `,1)[0],N;if(b=O,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),N=b):N=b.replace(this.rules.other.tabCharGlobal," "),S.test(b)||E.test(b)||A.test(b)||_.test(b)||C.test(b))break;if(N.search(this.rules.other.nonSpaceChar)>=P||!b.trim())m+=`
53
- `+N.slice(P);else{if(k||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(v)||E.test(v)||C.test(v))break;m+=`
54
- `+b}!k&&!b.trim()&&(k=!0),f+=O+`
55
- `,e=e.substring(O.length+1),v=N.slice(P)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0));let F=null,R;this.options.gfm&&(F=this.rules.other.listIsTask.exec(m),F&&(R=F[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:f,task:!!F,checked:R,loose:!1,text:m,tokens:[]}),n.raw+=f}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let u=0;u<n.items.length;u++)if(this.lexer.state.top=!1,n.items[u].tokens=this.lexer.blockTokens(n.items[u].text,[]),!n.loose){let f=n.items[u].tokens.filter(v=>v.type==="space"),m=f.length>0&&f.some(v=>this.rules.other.anyLine.test(v.raw));n.loose=m}if(n.loose)for(let u=0;u<n.items.length;u++)n.items[u].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=zd(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
56
- `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(let a of n)o.rows.push(zd(a,o.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[u]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
57
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Fs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=D0(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),Hd(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return Hd(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...s[0]].length-1,a,l,u=o,f=0,m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(s=m.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=[...a].length,s[3]||s[4]){u+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){f+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+f);let v=[...s[0]][0].length,b=e.slice(0,o+s.index+v+l);if(Math.min(o,l)%2){let P=b.slice(1,-1);return{type:"em",raw:b,text:P,tokens:this.lexer.inlineTokens(P)}}let k=b.slice(2,-2);return{type:"strong",raw:b,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},Gt=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||cr,this.options.tokenizer=this.options.tokenizer||new Dr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ht,block:vo.normal,inline:Ps.normal};this.options.pedantic?(t.block=vo.pedantic,t.inline=Ps.pedantic):this.options.gfm&&(t.block=vo.gfm,this.options.breaks?t.inline=Ps.breaks:t.inline=Ps.gfm),this.tokenizer.rules=t}static get rules(){return{block:vo,inline:Ps}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(ht.carriageReturn,`
58
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(ht.tabCharGlobal," ").replace(ht.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
48
+ `),O=this.list(C);o[o.length-1]=O,s=s.substring(0,s.length-y.raw.length)+O.raw,n=n.substring(0,n.length-k.raw.length)+O.raw,r=C.substring(o.at(-1).raw.length).split(`
49
+ `);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let h=!1,f="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let w=t[2].split(`
50
+ `,1)[0].replace(this.rules.other.listReplaceTabs,_=>" ".repeat(3*_.length)),y=e.split(`
51
+ `,1)[0],k=!w.trim(),C=0;if(this.options.pedantic?(C=2,m=w.trimStart()):k?C=t[1].length+1:(C=t[2].search(this.rules.other.nonSpaceChar),C=C>4?1:C,m=w.slice(C),C+=t[1].length),k&&this.rules.other.blankLine.test(y)&&(f+=y+`
52
+ `,e=e.substring(y.length+1),h=!0),!h){let _=this.rules.other.nextBulletRegex(C),F=this.rules.other.hrRegex(C),x=this.rules.other.fencesBeginRegex(C),S=this.rules.other.headingBeginRegex(C),A=this.rules.other.htmlBeginRegex(C);for(;e;){let P=e.split(`
53
+ `,1)[0],N;if(y=P,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),N=y):N=y.replace(this.rules.other.tabCharGlobal," "),x.test(y)||S.test(y)||A.test(y)||_.test(y)||F.test(y))break;if(N.search(this.rules.other.nonSpaceChar)>=C||!y.trim())m+=`
54
+ `+N.slice(C);else{if(k||w.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||x.test(w)||S.test(w)||F.test(w))break;m+=`
55
+ `+y}!k&&!y.trim()&&(k=!0),f+=P+`
56
+ `,e=e.substring(P.length+1),w=N.slice(C)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0));let O=null,R;this.options.gfm&&(O=this.rules.other.listIsTask.exec(m),O&&(R=O[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:f,task:!!O,checked:R,loose:!1,text:m,tokens:[]}),n.raw+=f}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let h=0;h<n.items.length;h++)if(this.lexer.state.top=!1,n.items[h].tokens=this.lexer.blockTokens(n.items[h].text,[]),!n.loose){let f=n.items[h].tokens.filter(w=>w.type==="space"),m=f.length>0&&f.some(w=>this.rules.other.anyLine.test(w.raw));n.loose=m}if(n.loose)for(let h=0;h<n.items.length;h++)n.items[h].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=Kd(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
57
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(let a of n)o.rows.push(Kd(a,o.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[h]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
58
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Bs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=X0(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),Xd(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return Xd(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...s[0]].length-1,a,l,h=o,f=0,m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(s=m.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=[...a].length,s[3]||s[4]){h+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){f+=l;continue}if(h-=l,h>0)continue;l=Math.min(l,l+h+f);let w=[...s[0]][0].length,y=e.slice(0,o+s.index+w+l);if(Math.min(o,l)%2){let C=y.slice(1,-1);return{type:"em",raw:y,text:C,tokens:this.lexer.inlineTokens(C)}}let k=y.slice(2,-2);return{type:"strong",raw:y,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},ti=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||pr,this.options.tokenizer=this.options.tokenizer||new Kr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ct,block:_o.normal,inline:Ns.normal};this.options.pedantic?(t.block=_o.pedantic,t.inline=Ns.pedantic):this.options.gfm&&(t.block=_o.gfm,this.options.breaks?t.inline=Ns.breaks:t.inline=Ns.gfm),this.tokenizer.rules=t}static get rules(){return{block:_o,inline:Ns}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(ct.carriageReturn,`
59
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(ct.tabCharGlobal," ").replace(ct.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
59
60
  `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
60
61
  `+s.raw,o.text+=`
61
62
  `+s.text,this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
62
63
  `+s.raw,o.text+=`
63
- `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let n=e;if(this.options.extensions?.startBlock){let o=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(u=>{l=u.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(n=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(n))){let o=t.at(-1);r&&o?.type==="paragraph"?(o.raw+=`
64
+ `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let n=e;if(this.options.extensions?.startBlock){let o=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(n=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(n))){let o=t.at(-1);r&&o?.type==="paragraph"?(o.raw+=`
64
65
  `+s.raw,o.text+=`
65
66
  `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s),r=n.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=`
66
67
  `+s.raw,o.text+=`
67
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,o="";for(;e;){n||(o=""),n=!1;let a;if(this.options.extensions?.inline?.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let u=t.at(-1);a.type==="text"&&u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let u=1/0,f=e.slice(1),m;this.options.extensions.startInline.forEach(v=>{m=v.call({lexer:this},f),typeof m=="number"&&m>=0&&(u=Math.min(u,m))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),n=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},Nr=class{options;parser;constructor(e){this.options=e||cr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(ht.notSpaceStart)?.[0],n=e.replace(ht.endingNewline,"")+`
68
- `;return s?'<pre><code class="language-'+si(s)+'">'+(r?n:si(n,!0))+`</code></pre>
69
- `:"<pre><code>"+(r?n:si(n,!0))+`</code></pre>
68
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,o="";for(;e;){n||(o=""),n=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let h=1/0,f=e.slice(1),m;this.options.extensions.startInline.forEach(w=>{m=w.call({lexer:this},f),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),n=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},Xr=class{options;parser;constructor(e){this.options=e||pr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(ct.notSpaceStart)?.[0],n=e.replace(ct.endingNewline,"")+`
69
+ `;return s?'<pre><code class="language-'+hi(s)+'">'+(r?n:hi(n,!0))+`</code></pre>
70
+ `:"<pre><code>"+(r?n:hi(n,!0))+`</code></pre>
70
71
  `}blockquote({tokens:e}){return`<blockquote>
71
72
  ${this.parser.parse(e)}</blockquote>
72
73
  `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
73
74
  `}hr(e){return`<hr>
74
75
  `}list(e){let t=e.ordered,r=e.start,s="";for(let a=0;a<e.items.length;a++){let l=e.items[a];s+=this.listitem(l)}let n=t?"ol":"ul",o=t&&r!==1?' start="'+r+'"':"";return"<"+n+o+`>
75
76
  `+s+"</"+n+`>
76
- `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+si(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
77
+ `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+hi(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
77
78
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
78
79
  `}table(e){let t="",r="";for(let n=0;n<e.header.length;n++)r+=this.tablecell(e.header[n]);t+=this.tablerow({text:r});let s="";for(let n=0;n<e.rows.length;n++){let o=e.rows[n];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
79
80
  <thead>
@@ -82,26 +83,26 @@ ${this.parser.parse(e)}</blockquote>
82
83
  `}tablerow({text:e}){return`<tr>
83
84
  ${e}</tr>
84
85
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
85
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${si(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=Ud(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+si(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=Ud(e);if(s===null)return si(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${si(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:si(e.text)}},Rs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Kt=class i{options;renderer;textRenderer;constructor(e){this.options=e||cr,this.options.renderer=this.options.renderer||new Nr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rs}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
86
- `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Ir=class{options;block;constructor(e){this.options=e||cr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Gt.lex:Gt.lexInline}provideParser(){return this.block?Kt.parse:Kt.parseInline}},wc=class{defaults=Sc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Kt;Renderer=Nr;TextRenderer=Rs;Lexer=Gt;Tokenizer=Dr;Hooks=Ir;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new Nr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],u=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=u.apply(n,f)),m||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Dr(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],u=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=u.apply(n,f)),m}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Ir;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],u=n[a];Ir.passThroughHooks.has(o)?n[a]=f=>{if(this.defaults.async)return Promise.resolve(l.call(n,f)).then(v=>u.call(n,v));let m=l.call(n,f);return u.call(n,m)}:n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=u.apply(n,f)),m}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Gt.lex(e,t??this.defaults)}parser(e,t){return Kt.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?Gt.lex:Gt.lexInline,u=o.hooks?o.hooks.provideParser():e?Kt.parse:Kt.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(f=>l(f,o)).then(f=>o.hooks?o.hooks.processAllTokens(f):f).then(f=>o.walkTokens?Promise.all(this.walkTokens(f,o.walkTokens)).then(()=>f):f).then(f=>u(f,o)).then(f=>o.hooks?o.hooks.postprocess(f):f).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let f=l(r,o);o.hooks&&(f=o.hooks.processAllTokens(f)),o.walkTokens&&this.walkTokens(f,o.walkTokens);let m=u(f,o);return o.hooks&&(m=o.hooks.postprocess(m)),m}catch(f){return a(f)}}}onError(e,t){return r=>{if(r.message+=`
87
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+si(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},lr=new wc;function le(i,e){return lr.parse(i,e)}le.options=le.setOptions=function(i){return lr.setOptions(i),le.defaults=lr.defaults,jd(le.defaults),le};le.getDefaults=Sc;le.defaults=cr;le.use=function(...i){return lr.use(...i),le.defaults=lr.defaults,jd(le.defaults),le};le.walkTokens=function(i,e){return lr.walkTokens(i,e)};le.parseInline=lr.parseInline;le.Parser=Kt;le.parser=Kt.parse;le.Renderer=Nr;le.TextRenderer=Rs;le.Lexer=Gt;le.lexer=Gt.lex;le.Tokenizer=Dr;le.Hooks=Ir;le.parse=le;var Y_=le.options,Z_=le.setOptions,Q_=le.use,J_=le.walkTokens,eA=le.parseInline;var tA=Kt.parse,iA=Gt.lex;var To=class extends V{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Lr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=le(t);return Lr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var xo=class extends V{connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#t(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let t=this.element.parentNode;getComputedStyle(t).position==="static"&&(t.style.position="relative",this.modifiedSelectWrapper=t),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}this.slimSelect=new SlimSelect({select:this.element,settings:i}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#i()}#t(){this.element.isConnected&&(this.#i(),this.#e())}#i(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var ko=class extends V{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,u=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${u}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var _o=class extends V{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};var Ao=class extends V{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var Co=class extends V{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function B0(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function Jd(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=B0(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var U0=i=>{throw new Error(`missing string: ${i}`)},hr=class{locale;constructor(e,{onMissingKey:t=U0}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return Jd(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return Jd(r,t)}};var Di=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new hr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Pc(i){return i<10?`0${i}`:i.toString()}function Br(){let i=new Date,e=Pc(i.getHours()),t=Pc(i.getMinutes()),r=Pc(i.getSeconds());return`${e}:${t}:${r}`}var ep={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Br()}]`,...i)},tp={debug:(...i)=>console.debug(`[Uppy] [${Br()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Br()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Br()}]`,...i)};function Ls(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function z0(i,e=document){return typeof i=="string"?e.querySelector(i):Ls(i)?i:null}var ip=z0;function H0(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var Po=H0;var Ns,K,ap,j0,ur,rp,lp,cp,hp,Mc,Fc,Oc,q0,Ds={},up=[],$0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Bs=Array.isArray;function ni(i,e){for(var t in e)i[t]=e[t];return i}function Lc(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function xi(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Ns.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Is(i,o,r,s,null)}function Is(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++ap,__i:-1,__u:0};return s==null&&K.vnode!=null&&K.vnode(n),n}function Ro(){return{current:null}}function _e(i){return i.children}function we(i,e){this.props=i,this.context=e}function Ur(i,e){if(e==null)return i.__?Ur(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Ur(i):null}function dp(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return dp(i)}}function sp(i){(!i.__d&&(i.__d=!0)&&ur.push(i)&&!Oo.__r++||rp!=K.debounceRendering)&&((rp=K.debounceRendering)||lp)(Oo)}function Oo(){for(var i,e,t,r,s,n,o,a=1;ur.length;)ur.length>a&&ur.sort(cp),i=ur.shift(),a=ur.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=ni({},r)).__v=r.__v+1,K.vnode&&K.vnode(t),Ic(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Ur(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,mp(n,t,o),r.__e=r.__=null,t.__e!=s&&dp(t)));Oo.__r=0}function pp(i,e,t,r,s,n,o,a,l,u,f){var m,v,b,k,P,F,R,_=r&&r.__k||up,C=e.length;for(l=V0(t,e,_,l,C),m=0;m<C;m++)(b=t.__k[m])!=null&&(v=b.__i==-1?Ds:_[b.__i]||Ds,b.__i=m,F=Ic(i,b,v,s,n,o,a,l,u,f),k=b.__e,b.ref&&v.ref!=b.ref&&(v.ref&&Dc(v.ref,null,b),f.push(b.ref,b.__c||k,b)),P==null&&k!=null&&(P=k),(R=!!(4&b.__u))||v.__k===b.__k?l=fp(b,l,i,R):typeof b.type=="function"&&F!==void 0?l=F:k&&(l=k.nextSibling),b.__u&=-7);return t.__e=P,l}function V0(i,e,t,r,s){var n,o,a,l,u,f=t.length,m=f,v=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=Is(null,o,null,null,null):Bs(o)?o=i.__k[n]=Is(_e,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=Is(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+v,o.__=i,o.__b=i.__b+1,a=null,(u=o.__i=W0(o,t,l,m))!=-1&&(m--,(a=t[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(s>f?v--:s<f&&v++),typeof o.type!="function"&&(o.__u|=4)):u!=l&&(u==l-1?v--:u==l+1?v++:(u>l?v--:v++,o.__u|=4))):i.__k[n]=null;if(m)for(n=0;n<f;n++)(a=t[n])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Ur(a)),bp(a,a));return r}function fp(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=fp(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=Ur(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function wt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Bs(i)?i.some(function(t){wt(t,e)}):e.push(i)),e}function W0(i,e,t,r){var s,n,o,a=i.key,l=i.type,u=e[t],f=u!=null&&(2&u.__u)==0;if(u===null&&a==null||f&&a==u.key&&l==u.type)return t;if(r>(f?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((u=e[o=s>=0?s--:n++])!=null&&!(2&u.__u)&&a==u.key&&l==u.type)return o}return-1}function np(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||$0.test(e)?t:t+"px"}function Fo(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||np(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||np(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(hp,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=Mc,i.addEventListener(e,n?Oc:Fc,n)):i.removeEventListener(e,n?Oc:Fc,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function op(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=Mc++;else if(e.t<t.u)return;return t(K.event?K.event(e):e)}}}function Ic(i,e,t,r,s,n,o,a,l,u){var f,m,v,b,k,P,F,R,_,C,S,E,A,O,N,z,$,j=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(f=K.__b)&&f(e);e:if(typeof j=="function")try{if(R=e.props,_="prototype"in j&&j.prototype.render,C=(f=j.contextType)&&r[f.__c],S=f?C?C.props.value:f.__:r,t.__c?F=(m=e.__c=t.__c).__=m.__E:(_?e.__c=m=new j(R,S):(e.__c=m=new we(R,S),m.constructor=j,m.render=K0),C&&C.sub(m),m.state||(m.state={}),m.__n=r,v=m.__d=!0,m.__h=[],m._sb=[]),_&&m.__s==null&&(m.__s=m.state),_&&j.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=ni({},m.__s)),ni(m.__s,j.getDerivedStateFromProps(R,m.__s))),b=m.props,k=m.state,m.__v=e,v)_&&j.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),_&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(_&&j.getDerivedStateFromProps==null&&R!==b&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(R,S),e.__v==t.__v||!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(R,m.__s,S)===!1){for(e.__v!=t.__v&&(m.props=R,m.state=m.__s,m.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(X){X&&(X.__=e)}),E=0;E<m._sb.length;E++)m.__h.push(m._sb[E]);m._sb=[],m.__h.length&&o.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(R,m.__s,S),_&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(b,k,P)})}if(m.context=S,m.props=R,m.__P=i,m.__e=!1,A=K.__r,O=0,_){for(m.state=m.__s,m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),N=0;N<m._sb.length;N++)m.__h.push(m._sb[N]);m._sb=[]}else do m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++O<25);m.state=m.__s,m.getChildContext!=null&&(r=ni(ni({},r),m.getChildContext())),_&&!v&&m.getSnapshotBeforeUpdate!=null&&(P=m.getSnapshotBeforeUpdate(b,k)),z=f,f!=null&&f.type===_e&&f.key==null&&(z=gp(f.props.children)),a=pp(i,Bs(z)?z:[z],e,t,r,s,n,o,a,l,u),m.base=e.__e,e.__u&=-161,m.__h.length&&o.push(m),F&&(m.__E=m.__=null)}catch(X){if(e.__v=null,l||n!=null)if(X.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for($=n.length;$--;)Lc(n[$]);Rc(e)}else e.__e=t.__e,e.__k=t.__k,X.then||Rc(e);K.__e(X,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=G0(t.__e,e,t,r,s,n,o,l,u);return(f=K.diffed)&&f(e),128&e.__u?void 0:a}function Rc(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(Rc)}function mp(i,e,t){for(var r=0;r<t.length;r++)Dc(t[r],t[++r],t[++r]);K.__c&&K.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){K.__e(n,s.__v)}})}function gp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Bs(i)?i.map(gp):ni({},i)}function G0(i,e,t,r,s,n,o,a,l){var u,f,m,v,b,k,P,F=t.props||Ds,R=e.props,_=e.type;if(_=="svg"?s="http://www.w3.org/2000/svg":_=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(u=0;u<n.length;u++)if((b=n[u])&&"setAttribute"in b==!!_&&(_?b.localName==_:b.nodeType==3)){i=b,n[u]=null;break}}if(i==null){if(_==null)return document.createTextNode(R);i=document.createElementNS(s,_,R.is&&R),a&&(K.__m&&K.__m(e,n),a=!1),n=null}if(_==null)F===R||a&&i.data==R||(i.data=R);else{if(n=n&&Ns.call(i.childNodes),!a&&n!=null)for(F={},u=0;u<i.attributes.length;u++)F[(b=i.attributes[u]).name]=b.value;for(u in F)if(b=F[u],u!="children"){if(u=="dangerouslySetInnerHTML")m=b;else if(!(u in R)){if(u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R)continue;Fo(i,u,null,b,s)}}for(u in R)b=R[u],u=="children"?v=b:u=="dangerouslySetInnerHTML"?f=b:u=="value"?k=b:u=="checked"?P=b:a&&typeof b!="function"||F[u]===b||Fo(i,u,b,F[u],s);if(f)a||m&&(f.__html==m.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(m&&(i.innerHTML=""),pp(e.type=="template"?i.content:i,Bs(v)?v:[v],e,t,r,_=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Ur(t,0),a,l),n!=null)for(u=n.length;u--;)Lc(n[u]);a||(u="value",_=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[u]||_=="progress"&&!k||_=="option"&&k!=F[u])&&Fo(i,u,k,F[u],s),u="checked",P!=null&&P!=i[u]&&Fo(i,u,P,F[u],s))}return i}function Dc(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){K.__e(s,t)}}function bp(i,e,t){var r,s;if(K.unmount&&K.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Dc(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){K.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&bp(r[s],e,t||typeof i.type!="function");t||Lc(i.__e),i.__c=i.__=i.__e=void 0}function K0(i,e,t){return this.constructor(i,t)}function yp(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),K.__&&K.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],Ic(e,i=(!r&&t||e).__k=xi(_e,null,[i]),s||Ds,Ds,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Ns.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),mp(n,i,o)}function Us(i,e,t){var r,s,n,o,a=ni({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Ns.call(arguments,2):t),Is(i.type,a,r||i.key,s||i.ref,null)}Ns=up.slice,K={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},ap=0,j0=function(i){return i!=null&&i.constructor===void 0},we.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ni({},this.state),typeof i=="function"&&(i=i(ni({},t),this.props)),i&&ni(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),sp(this))},we.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),sp(this))},we.prototype.render=_e,ur=[],lp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,cp=function(i,e){return i.__v.__b-e.__v.__b},Oo.__r=0,hp=/(PointerCapture)$|Capture$/i,Mc=0,Fc=op(!1),Oc=op(!0),q0=0;var zs,Fe,Nc,vp,Hs=0,Ap=[],Le=K,wp=Le.__b,Sp=Le.__r,Ep=Le.diffed,Tp=Le.__c,xp=Le.unmount,kp=Le.__;function Uc(i,e){Le.__h&&Le.__h(Fe,i,Hs||e),Hs=0;var t=Fe.__H||(Fe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Nt(i){return Hs=1,Cp(Fp,i)}function Cp(i,e,t){var r=Uc(zs++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Fp(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,a);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Fe,!Fe.__f)){var s=function(a,l,u){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(v){return!!v.__c});if(f.every(function(v){return!v.__N}))return!n||n.call(this,a,l,u);var m=r.__c.props!==a;return f.forEach(function(v){if(v.__N){var b=v.__[0];v.__=v.__N,v.__N=void 0,b!==v.__[0]&&(m=!0)}}),n&&n.call(this,a,l,u)||m};Fe.__f=!0;var n=Fe.shouldComponentUpdate,o=Fe.componentWillUpdate;Fe.componentWillUpdate=function(a,l,u){if(this.__e){var f=n;n=void 0,s(a,l,u),n=f}o&&o.call(this,a,l,u)},Fe.shouldComponentUpdate=s}return r.__N||r.__}function Xt(i,e){var t=Uc(zs++,3);!Le.__s&&Pp(t.__H,e)&&(t.__=i,t.u=e,Fe.__H.__h.push(t))}function Ni(i){return Hs=5,Bi(function(){return{current:i}},[])}function Bi(i,e){var t=Uc(zs++,7);return Pp(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Ui(i,e){return Hs=8,Bi(function(){return i},e)}function X0(){for(var i;i=Ap.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Mo),i.__H.__h.forEach(Bc),i.__H.__h=[]}catch(e){i.__H.__h=[],Le.__e(e,i.__v)}}Le.__b=function(i){Fe=null,wp&&wp(i)},Le.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),kp&&kp(i,e)},Le.__r=function(i){Sp&&Sp(i),zs=0;var e=(Fe=i.__c).__H;e&&(Nc===Fe?(e.__h=[],Fe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Mo),e.__h.forEach(Bc),e.__h=[],zs=0)),Nc=Fe},Le.diffed=function(i){Ep&&Ep(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Ap.push(e)!==1&&vp===Le.requestAnimationFrame||((vp=Le.requestAnimationFrame)||Y0)(X0)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Nc=Fe=null},Le.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Mo),t.__h=t.__h.filter(function(r){return!r.__||Bc(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Le.__e(r,t.__v)}}),Tp&&Tp(i,e)},Le.unmount=function(i){xp&&xp(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{Mo(r)}catch(s){e=s}}),t.__H=void 0,e&&Le.__e(e,t.__v))};var _p=typeof requestAnimationFrame=="function";function Y0(i){var e,t=function(){clearTimeout(r),_p&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);_p&&(e=requestAnimationFrame(t))}function Mo(i){var e=Fe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Fe=e}function Bc(i){var e=Fe;i.__c=i.__(),Fe=e}function Pp(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function Fp(i,e){return typeof e=="function"?e(i):e}function Q0(i,e){for(var t in e)i[t]=e[t];return i}function Op(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function Rp(i,e){this.props=i,this.context=e}(Rp.prototype=new we).isPureReactComponent=!0,Rp.prototype.shouldComponentUpdate=function(i,e){return Op(this.props,i)||Op(this.state,e)};var Mp=K.__b;K.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),Mp&&Mp(i)};var VA=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var J0=K.__e;K.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}J0(i,e,t,r)};var Lp=K.unmount;function zp(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=Q0({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return zp(r,e,t)})),i}function Hp(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return Hp(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function zc(){this.__u=0,this.o=null,this.__b=null}function jp(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Lo(){this.i=null,this.l=null}K.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),Lp&&Lp(i)},(zc.prototype=new we).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=jp(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Hp(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.o.pop();)u.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},zc.prototype.componentWillUnmount=function(){this.o=[]},zc.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=zp(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&xi(_e,null,i.fallback);return s&&(s.__u&=-33),[xi(_e,null,e.__a?null:i.children),s]};var Ip=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Lo.prototype=new we).__a=function(i){var e=this,t=jp(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),Ip(e,i,r)):s()};t?t(n):n()}},Lo.prototype.render=function(i){this.i=null,this.l=new Map;var e=wt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Lo.prototype.componentDidUpdate=Lo.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){Ip(i,t,e)})};var ew=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,tw=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,iw=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,rw=/[A-Z0-9]/g,sw=typeof document<"u",nw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function Hc(i,e,t){return e.__k==null&&(e.textContent=""),yp(i,e),typeof t=="function"&&t(),i?i.__c:null}we.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(we.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var Dp=K.event;function ow(){}function aw(){return this.cancelBubble}function lw(){return this.defaultPrevented}K.event=function(i){return Dp&&(i=Dp(i)),i.persist=ow,i.isPropagationStopped=aw,i.isDefaultPrevented=lw,i.nativeEvent=i};var qp,cw={enumerable:!1,configurable:!0,get:function(){return this.class}},Np=K.vnode;K.vnode=function(i){typeof i.type=="string"&&function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||sw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||nw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":iw.test(o)&&(o=l):l=o="oninput":n&&tw.test(o)?o=o.replace(rw,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=wt(t.children).forEach(function(u){u.props.selected=s.value.indexOf(u.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=wt(t.children).forEach(function(u){u.props.selected=s.multiple?s.defaultValue.indexOf(u.props.value)!=-1:s.defaultValue==u.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",cw)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(i),i.$$typeof=ew,Np&&Np(i)};var Bp=K.__r;K.__r=function(i){Bp&&Bp(i),qp=i.__c};var Up=K.diffed;K.diffed=function(i){Up&&Up(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),qp=null};function hw(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var jc=class i extends Di{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=ip(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=hw(l=>{this.uppy.getPlugin(this.id)&&(Hc(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Hc(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||Po(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},Yt=jc;var $p={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var qc=class{static VERSION=$p.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},Vp=qc;function dr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var $c={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function js(i){if(i.type)return i.type;let e=i.name?dr(i.name).extension?.toLowerCase():null;return e&&e in $c?$c[e]:"application/octet-stream"}function dw(i){return i.charCodeAt(0).toString(32)}function Wp(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${dw(t)}`,"/"))+e}function Gp(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Wp(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Wp(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function pw(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Io(i,e){if(pw(i))return i.id;let t=js(i);return Gp({...i,type:t},e)}var zf=ye(Af(),1),Hf=ye(Pf(),1);var o1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var zi=(i=21)=>{let e="",t=i|0;for(;t--;)e+=o1[Math.random()*64|0];return e};var Ff={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function Xc(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var Of={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var $s=ye(No(),1),Bf=ye(Nf(),1),Uf={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},St=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Bo=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new St(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new St(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,$s.default)(r),size:(0,$s.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,Bf.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new St(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new St(this.getI18n()("exceedsSize",{size:(0,$s.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new St(this.getI18n()("inferiorSize",{size:(0,$s.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new St(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new St(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function Yc(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var Uo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},Zc=class i{static VERSION=Ff.version;#e=Object.create(null);#t;#i;#r=(0,Hf.default)();#n=new Set;#o=new Set;#s=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=Of;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Uf,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new Vp,logger:ep,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=tp),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Uo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Yc(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Bo(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new hr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Uo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Uo,files:{}})}addPreProcessor(e){this.#n.add(e)}removePreProcessor(e){return this.#n.delete(e)}addPostProcessor(e){this.#s.add(e)}removePostProcessor(e){return this.#s.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],u=[],f=[],m=[],v=[],b=[];for(let k of s){let{progress:P}=k;!P.uploadComplete&&P.uploadStarted&&(n.push(k),k.isPaused||v.push(k)),P.uploadStarted||o.push(k),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(k),P.uploadStarted&&l.push(k),k.isPaused&&u.push(k),P.uploadComplete&&f.push(k),k.error&&m.push(k),(P.preprocess||P.postprocess)&&b.push(k)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:u,completeFiles:f,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:v,processingFiles:b,isUploadStarted:l.length>0,isAllComplete:t===100&&f.length===s.length&&b.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&u.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#f(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new St(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#u(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=js(t),s=Xc(r,t),n=dr(s).extension,o=Io(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#h(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#p(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#u(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let u=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!u&&this.checkIfFileAlreadyExists(a.id))throw new St(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(u===!1&&!l)throw new St("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof u=="object"&&u!==null&&(a=u),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#h(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
86
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${hi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=Gd(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+hi(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=Gd(e);if(s===null)return hi(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${hi(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:hi(e.text)}},zs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ii=class i{options;renderer;textRenderer;constructor(e){this.options=e||pr,this.options.renderer=this.options.renderer||new Xr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zs}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
87
+ `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Gr=class{options;block;constructor(e){this.options=e||pr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ti.lex:ti.lexInline}provideParser(){return this.block?ii.parse:ii.parseInline}},kc=class{defaults=_c();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ii;Renderer=Xr;TextRenderer=zs;Lexer=ti;Tokenizer=Kr;Hooks=Gr;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new Xr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Kr(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Gr;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],h=n[a];Gr.passThroughHooks.has(o)?n[a]=f=>{if(this.defaults.async)return Promise.resolve(l.call(n,f)).then(w=>h.call(n,w));let m=l.call(n,f);return h.call(n,m)}:n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ti.lex(e,t??this.defaults)}parser(e,t){return ii.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?ti.lex:ti.lexInline,h=o.hooks?o.hooks.provideParser():e?ii.parse:ii.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(f=>l(f,o)).then(f=>o.hooks?o.hooks.processAllTokens(f):f).then(f=>o.walkTokens?Promise.all(this.walkTokens(f,o.walkTokens)).then(()=>f):f).then(f=>h(f,o)).then(f=>o.hooks?o.hooks.postprocess(f):f).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let f=l(r,o);o.hooks&&(f=o.hooks.processAllTokens(f)),o.walkTokens&&this.walkTokens(f,o.walkTokens);let m=h(f,o);return o.hooks&&(m=o.hooks.postprocess(m)),m}catch(f){return a(f)}}}onError(e,t){return r=>{if(r.message+=`
88
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+hi(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},dr=new kc;function le(i,e){return dr.parse(i,e)}le.options=le.setOptions=function(i){return dr.setOptions(i),le.defaults=dr.defaults,Yd(le.defaults),le};le.getDefaults=_c;le.defaults=pr;le.use=function(...i){return dr.use(...i),le.defaults=dr.defaults,Yd(le.defaults),le};le.walkTokens=function(i,e){return dr.walkTokens(i,e)};le.parseInline=dr.parseInline;le.Parser=ii;le.parser=ii.parse;le.Renderer=Xr;le.TextRenderer=zs;le.Lexer=ti;le.lexer=ti.lex;le.Tokenizer=Kr;le.Hooks=Gr;le.parse=le;var cA=le.options,uA=le.setOptions,hA=le.use,dA=le.walkTokens,pA=le.parseInline;var fA=ii.parse,mA=ti.lex;var Po=class extends V{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Wr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=le(t);return Wr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var Oo=class extends V{static values={typeaheadUrl:String,typeaheadDebounceMs:{type:Number,default:200}};connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#r(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let r=this.element.parentNode;getComputedStyle(r).position==="static"&&(r.style.position="relative",this.modifiedSelectWrapper=r),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}let t={};this.hasTypeaheadUrlValue&&this.typeaheadUrlValue&&(t.search=(r,s)=>this.#t(r,s)),this.slimSelect=new SlimSelect({select:this.element,settings:i,events:t}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#s()}#t(i,e){return this._typeaheadDebounce&&clearTimeout(this._typeaheadDebounce),this._typeaheadAbort&&this._typeaheadAbort.abort(),new Promise(t=>{this._typeaheadDebounce=setTimeout(()=>{this._typeaheadAbort=new AbortController,this.#i(i,this._typeaheadAbort.signal).then(t)},this.typeaheadDebounceMsValue)})}async#i(i,e){let t=new URL(this.typeaheadUrlValue,window.location.origin);t.searchParams.set("q",i||"");try{let r=await fetch(t.toString(),{headers:{Accept:"application/json"},signal:e});if(!r.ok)return"Search failed";let s=await r.json();return(Array.isArray(s.results)?s.results:[]).map(o=>({value:String(o.value??""),text:String(o.label??"")}))}catch(r){return r.name==="AbortError"?[]:(console.warn("[slim-select] typeahead error",r),"Search failed")}}#r(){this.element.isConnected&&(this.#s(),this.#e())}#s(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Ro=class extends V{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,h=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${h}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var Mo=class extends V{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};var Lo=class extends V{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var Io=class extends V{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function Z0(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function ap(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=Z0(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var Q0=i=>{throw new Error(`missing string: ${i}`)},fr=class{locale;constructor(e,{onMissingKey:t=Q0}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return ap(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return ap(r,t)}};var Hi=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new fr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Lc(i){return i<10?`0${i}`:i.toString()}function Yr(){let i=new Date,e=Lc(i.getHours()),t=Lc(i.getMinutes()),r=Lc(i.getSeconds());return`${e}:${t}:${r}`}var lp={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Yr()}]`,...i)},cp={debug:(...i)=>console.debug(`[Uppy] [${Yr()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Yr()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Yr()}]`,...i)};function js(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function J0(i,e=document){return typeof i=="string"?e.querySelector(i):js(i)?i:null}var up=J0;function ew(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var Do=ew;var Vs,X,mp,tw,mr,hp,gp,bp,yp,Bc,Ic,Dc,iw,$s={},vp=[],rw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ws=Array.isArray;function di(i,e){for(var t in e)i[t]=e[t];return i}function Uc(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function xi(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Vs.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return qs(i,o,r,s,null)}function qs(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++mp,__i:-1,__u:0};return s==null&&X.vnode!=null&&X.vnode(n),n}function Uo(){return{current:null}}function _e(i){return i.children}function we(i,e){this.props=i,this.context=e}function Zr(i,e){if(e==null)return i.__?Zr(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Zr(i):null}function wp(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return wp(i)}}function dp(i){(!i.__d&&(i.__d=!0)&&mr.push(i)&&!Bo.__r++||hp!=X.debounceRendering)&&((hp=X.debounceRendering)||gp)(Bo)}function Bo(){for(var i,e,t,r,s,n,o,a=1;mr.length;)mr.length>a&&mr.sort(bp),i=mr.shift(),a=mr.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=di({},r)).__v=r.__v+1,X.vnode&&X.vnode(t),zc(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Zr(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Tp(n,t,o),r.__e=r.__=null,t.__e!=s&&wp(t)));Bo.__r=0}function Sp(i,e,t,r,s,n,o,a,l,h,f){var m,w,y,k,C,O,R,_=r&&r.__k||vp,F=e.length;for(l=sw(t,e,_,l,F),m=0;m<F;m++)(y=t.__k[m])!=null&&(w=y.__i==-1?$s:_[y.__i]||$s,y.__i=m,O=zc(i,y,w,s,n,o,a,l,h,f),k=y.__e,y.ref&&w.ref!=y.ref&&(w.ref&&Hc(w.ref,null,y),f.push(y.ref,y.__c||k,y)),C==null&&k!=null&&(C=k),(R=!!(4&y.__u))||w.__k===y.__k?l=Ep(y,l,i,R):typeof y.type=="function"&&O!==void 0?l=O:k&&(l=k.nextSibling),y.__u&=-7);return t.__e=C,l}function sw(i,e,t,r,s){var n,o,a,l,h,f=t.length,m=f,w=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=qs(null,o,null,null,null):Ws(o)?o=i.__k[n]=qs(_e,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=qs(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+w,o.__=i,o.__b=i.__b+1,a=null,(h=o.__i=nw(o,t,l,m))!=-1&&(m--,(a=t[h])&&(a.__u|=2)),a==null||a.__v==null?(h==-1&&(s>f?w--:s<f&&w++),typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?w--:h==l+1?w++:(h>l?w--:w++,o.__u|=4))):i.__k[n]=null;if(m)for(n=0;n<f;n++)(a=t[n])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=Zr(a)),kp(a,a));return r}function Ep(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=Ep(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=Zr(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function vt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Ws(i)?i.some(function(t){vt(t,e)}):e.push(i)),e}function nw(i,e,t,r){var s,n,o,a=i.key,l=i.type,h=e[t],f=h!=null&&(2&h.__u)==0;if(h===null&&a==null||f&&a==h.key&&l==h.type)return t;if(r>(f?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((h=e[o=s>=0?s--:n++])!=null&&(2&h.__u)==0&&a==h.key&&l==h.type)return o}return-1}function pp(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||rw.test(e)?t:t+"px"}function No(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||pp(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||pp(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(yp,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=Bc,i.addEventListener(e,n?Dc:Ic,n)):i.removeEventListener(e,n?Dc:Ic,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function fp(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=Bc++;else if(e.t<t.u)return;return t(X.event?X.event(e):e)}}}function zc(i,e,t,r,s,n,o,a,l,h){var f,m,w,y,k,C,O,R,_,F,x,S,A,P,N,z,q,$=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(f=X.__b)&&f(e);e:if(typeof $=="function")try{if(R=e.props,_="prototype"in $&&$.prototype.render,F=(f=$.contextType)&&r[f.__c],x=f?F?F.props.value:f.__:r,t.__c?O=(m=e.__c=t.__c).__=m.__E:(_?e.__c=m=new $(R,x):(e.__c=m=new we(R,x),m.constructor=$,m.render=aw),F&&F.sub(m),m.state||(m.state={}),m.__n=r,w=m.__d=!0,m.__h=[],m._sb=[]),_&&m.__s==null&&(m.__s=m.state),_&&$.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=di({},m.__s)),di(m.__s,$.getDerivedStateFromProps(R,m.__s))),y=m.props,k=m.state,m.__v=e,w)_&&$.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),_&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(_&&$.getDerivedStateFromProps==null&&R!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(R,x),e.__v==t.__v||!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(R,m.__s,x)===!1){for(e.__v!=t.__v&&(m.props=R,m.state=m.__s,m.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Z){Z&&(Z.__=e)}),S=0;S<m._sb.length;S++)m.__h.push(m._sb[S]);m._sb=[],m.__h.length&&o.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(R,m.__s,x),_&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,k,C)})}if(m.context=x,m.props=R,m.__P=i,m.__e=!1,A=X.__r,P=0,_){for(m.state=m.__s,m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),N=0;N<m._sb.length;N++)m.__h.push(m._sb[N]);m._sb=[]}else do m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++P<25);m.state=m.__s,m.getChildContext!=null&&(r=di(di({},r),m.getChildContext())),_&&!w&&m.getSnapshotBeforeUpdate!=null&&(C=m.getSnapshotBeforeUpdate(y,k)),z=f,f!=null&&f.type===_e&&f.key==null&&(z=xp(f.props.children)),a=Sp(i,Ws(z)?z:[z],e,t,r,s,n,o,a,l,h),m.base=e.__e,e.__u&=-161,m.__h.length&&o.push(m),O&&(m.__E=m.__=null)}catch(Z){if(e.__v=null,l||n!=null)if(Z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for(q=n.length;q--;)Uc(n[q]);Nc(e)}else e.__e=t.__e,e.__k=t.__k,Z.then||Nc(e);X.__e(Z,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=ow(t.__e,e,t,r,s,n,o,l,h);return(f=X.diffed)&&f(e),128&e.__u?void 0:a}function Nc(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(Nc)}function Tp(i,e,t){for(var r=0;r<t.length;r++)Hc(t[r],t[++r],t[++r]);X.__c&&X.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){X.__e(n,s.__v)}})}function xp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Ws(i)?i.map(xp):di({},i)}function ow(i,e,t,r,s,n,o,a,l){var h,f,m,w,y,k,C,O=t.props||$s,R=e.props,_=e.type;if(_=="svg"?s="http://www.w3.org/2000/svg":_=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(h=0;h<n.length;h++)if((y=n[h])&&"setAttribute"in y==!!_&&(_?y.localName==_:y.nodeType==3)){i=y,n[h]=null;break}}if(i==null){if(_==null)return document.createTextNode(R);i=document.createElementNS(s,_,R.is&&R),a&&(X.__m&&X.__m(e,n),a=!1),n=null}if(_==null)O===R||a&&i.data==R||(i.data=R);else{if(n=n&&Vs.call(i.childNodes),!a&&n!=null)for(O={},h=0;h<i.attributes.length;h++)O[(y=i.attributes[h]).name]=y.value;for(h in O)if(y=O[h],h!="children"){if(h=="dangerouslySetInnerHTML")m=y;else if(!(h in R)){if(h=="value"&&"defaultValue"in R||h=="checked"&&"defaultChecked"in R)continue;No(i,h,null,y,s)}}for(h in R)y=R[h],h=="children"?w=y:h=="dangerouslySetInnerHTML"?f=y:h=="value"?k=y:h=="checked"?C=y:a&&typeof y!="function"||O[h]===y||No(i,h,y,O[h],s);if(f)a||m&&(f.__html==m.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(m&&(i.innerHTML=""),Sp(e.type=="template"?i.content:i,Ws(w)?w:[w],e,t,r,_=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Zr(t,0),a,l),n!=null)for(h=n.length;h--;)Uc(n[h]);a||(h="value",_=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[h]||_=="progress"&&!k||_=="option"&&k!=O[h])&&No(i,h,k,O[h],s),h="checked",C!=null&&C!=i[h]&&No(i,h,C,O[h],s))}return i}function Hc(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){X.__e(s,t)}}function kp(i,e,t){var r,s;if(X.unmount&&X.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Hc(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){X.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&kp(r[s],e,t||typeof i.type!="function");t||Uc(i.__e),i.__c=i.__=i.__e=void 0}function aw(i,e,t){return this.constructor(i,t)}function _p(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),X.__&&X.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],zc(e,i=(!r&&t||e).__k=xi(_e,null,[i]),s||$s,$s,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Vs.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Tp(n,i,o)}function Gs(i,e,t){var r,s,n,o,a=di({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Vs.call(arguments,2):t),qs(i.type,a,r||i.key,s||i.ref,null)}Vs=vp.slice,X={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},mp=0,tw=function(i){return i!=null&&i.constructor===void 0},we.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=di({},this.state),typeof i=="function"&&(i=i(di({},t),this.props)),i&&di(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),dp(this))},we.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),dp(this))},we.prototype.render=_e,mr=[],gp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,bp=function(i,e){return i.__v.__b-e.__v.__b},Bo.__r=0,yp=/(PointerCapture)$|Capture$/i,Bc=0,Ic=fp(!1),Dc=fp(!0),iw=0;var Ks,Pe,jc,Ap,Xs=0,Ip=[],Ne=X,Cp=Ne.__b,Fp=Ne.__r,Pp=Ne.diffed,Op=Ne.__c,Rp=Ne.unmount,Mp=Ne.__;function $c(i,e){Ne.__h&&Ne.__h(Pe,i,Xs||e),Xs=0;var t=Pe.__H||(Pe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Gt(i){return Xs=1,Dp(Bp,i)}function Dp(i,e,t){var r=$c(Ks++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Bp(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],h=r.t(l,a);l!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=Pe,!Pe.__f)){var s=function(a,l,h){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(w){return!!w.__c});if(f.every(function(w){return!w.__N}))return!n||n.call(this,a,l,h);var m=r.__c.props!==a;return f.forEach(function(w){if(w.__N){var y=w.__[0];w.__=w.__N,w.__N=void 0,y!==w.__[0]&&(m=!0)}}),n&&n.call(this,a,l,h)||m};Pe.__f=!0;var n=Pe.shouldComponentUpdate,o=Pe.componentWillUpdate;Pe.componentWillUpdate=function(a,l,h){if(this.__e){var f=n;n=void 0,s(a,l,h),n=f}o&&o.call(this,a,l,h)},Pe.shouldComponentUpdate=s}return r.__N||r.__}function ri(i,e){var t=$c(Ks++,3);!Ne.__s&&Np(t.__H,e)&&(t.__=i,t.u=e,Pe.__H.__h.push(t))}function ji(i){return Xs=5,qi(function(){return{current:i}},[])}function qi(i,e){var t=$c(Ks++,7);return Np(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function $i(i,e){return Xs=8,qi(function(){return i},e)}function lw(){for(var i;i=Ip.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(zo),i.__H.__h.forEach(qc),i.__H.__h=[]}catch(e){i.__H.__h=[],Ne.__e(e,i.__v)}}Ne.__b=function(i){Pe=null,Cp&&Cp(i)},Ne.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Mp&&Mp(i,e)},Ne.__r=function(i){Fp&&Fp(i),Ks=0;var e=(Pe=i.__c).__H;e&&(jc===Pe?(e.__h=[],Pe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(zo),e.__h.forEach(qc),e.__h=[],Ks=0)),jc=Pe},Ne.diffed=function(i){Pp&&Pp(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Ip.push(e)!==1&&Ap===Ne.requestAnimationFrame||((Ap=Ne.requestAnimationFrame)||cw)(lw)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),jc=Pe=null},Ne.__c=function(i,e){e.some(function(t){try{t.__h.forEach(zo),t.__h=t.__h.filter(function(r){return!r.__||qc(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ne.__e(r,t.__v)}}),Op&&Op(i,e)},Ne.unmount=function(i){Rp&&Rp(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{zo(r)}catch(s){e=s}}),t.__H=void 0,e&&Ne.__e(e,t.__v))};var Lp=typeof requestAnimationFrame=="function";function cw(i){var e,t=function(){clearTimeout(r),Lp&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);Lp&&(e=requestAnimationFrame(t))}function zo(i){var e=Pe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Pe=e}function qc(i){var e=Pe;i.__c=i.__(),Pe=e}function Np(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function Bp(i,e){return typeof e=="function"?e(i):e}function hw(i,e){for(var t in e)i[t]=e[t];return i}function Up(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function zp(i,e){this.props=i,this.context=e}(zp.prototype=new we).isPureReactComponent=!0,zp.prototype.shouldComponentUpdate=function(i,e){return Up(this.props,i)||Up(this.state,e)};var Hp=X.__b;X.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),Hp&&Hp(i)};var sC=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var dw=X.__e;X.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}dw(i,e,t,r)};var jp=X.unmount;function Kp(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=hw({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return Kp(r,e,t)})),i}function Xp(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return Xp(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function Vc(){this.__u=0,this.o=null,this.__b=null}function Yp(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Ho(){this.i=null,this.l=null}X.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),jp&&jp(i)},(Vc.prototype=new we).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=Yp(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Xp(l,l.__c.__P,l.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},Vc.prototype.componentWillUnmount=function(){this.o=[]},Vc.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Kp(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&xi(_e,null,i.fallback);return s&&(s.__u&=-33),[xi(_e,null,e.__a?null:i.children),s]};var qp=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Ho.prototype=new we).__a=function(i){var e=this,t=Yp(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),qp(e,i,r)):s()};t?t(n):n()}},Ho.prototype.render=function(i){this.i=null,this.l=new Map;var e=vt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Ho.prototype.componentDidUpdate=Ho.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){qp(i,t,e)})};var pw=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,fw=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,mw=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,gw=/[A-Z0-9]/g,bw=typeof document<"u",yw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function Wc(i,e,t){return e.__k==null&&(e.textContent=""),_p(i,e),typeof t=="function"&&t(),i?i.__c:null}we.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(we.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var $p=X.event;function vw(){}function ww(){return this.cancelBubble}function Sw(){return this.defaultPrevented}X.event=function(i){return $p&&(i=$p(i)),i.persist=vw,i.isPropagationStopped=ww,i.isDefaultPrevented=Sw,i.nativeEvent=i};var Zp,Ew={enumerable:!1,configurable:!0,get:function(){return this.class}},Vp=X.vnode;X.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||bw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||yw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":mw.test(o)&&(o=l):l=o="oninput":n&&fw.test(o)?o=o.replace(gw,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=vt(t.children).forEach(function(h){h.props.selected=s.value.indexOf(h.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=vt(t.children).forEach(function(h){h.props.selected=s.multiple?s.defaultValue.indexOf(h.props.value)!=-1:s.defaultValue==h.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Ew)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=pw,Vp&&Vp(i)};var Wp=X.__r;X.__r=function(i){Wp&&Wp(i),Zp=i.__c};var Gp=X.diffed;X.diffed=function(i){Gp&&Gp(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Zp=null};function Tw(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var Gc=class i extends Hi{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=up(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=Tw(l=>{this.uppy.getPlugin(this.id)&&(Wc(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Wc(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||Do(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},si=Gc;var Qp={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var Kc=class{static VERSION=Qp.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},Jp=Kc;function gr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var Xc={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Ys(i){if(i.type)return i.type;let e=i.name?gr(i.name).extension?.toLowerCase():null;return e&&e in Xc?Xc[e]:"application/octet-stream"}function kw(i){return i.charCodeAt(0).toString(32)}function ef(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${kw(t)}`,"/"))+e}function tf(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${ef(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${ef(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function _w(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function jo(i,e){if(_w(i))return i.id;let t=Ys(i);return tf({...i,type:t},e)}var Kf=ye(If(),1),Xf=ye(Nf(),1);var v1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Vi=(i=21)=>{let e="",t=i|0;for(;t--;)e+=v1[Math.random()*64|0];return e};var Bf={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function eu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var Uf={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var Qs=ye($o(),1),Wf=ye(Vf(),1),Gf={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},wt=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Vo=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new wt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new wt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Qs.default)(r),size:(0,Qs.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,Wf.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new wt(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new wt(this.getI18n()("exceedsSize",{size:(0,Qs.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new wt(this.getI18n()("inferiorSize",{size:(0,Qs.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new wt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new wt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function tu(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var Wo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},iu=class i{static VERSION=Bf.version;#e=Object.create(null);#t;#i;#r=(0,Xf.default)();#s=new Set;#o=new Set;#n=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=Uf;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Gf,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new Jp,logger:lp,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=cp),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Wo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:tu(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Vo(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new fr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Wo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Wo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#n.add(e)}removePostProcessor(e){return this.#n.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],h=[],f=[],m=[],w=[],y=[];for(let k of s){let{progress:C}=k;!C.uploadComplete&&C.uploadStarted&&(n.push(k),k.isPaused||w.push(k)),C.uploadStarted||o.push(k),(C.uploadStarted||C.preprocess||C.postprocess)&&a.push(k),C.uploadStarted&&l.push(k),k.isPaused&&h.push(k),C.uploadComplete&&f.push(k),k.error&&m.push(k),(C.preprocess||C.postprocess)&&y.push(k)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:h,completeFiles:f,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:w,processingFiles:y,isUploadStarted:l.length>0,isAllComplete:t===100&&f.length===s.length&&y.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&h.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#f(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new wt(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#h(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=Ys(t),s=eu(r,t),n=gr(s).extension,o=jo(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#u(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#p(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#h(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let h=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(a.id))throw new wt(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(h===!1&&!l)throw new wt("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof h=="object"&&h!==null&&(a=h),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#u(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
88
89
  `;if(o.forEach(l=>{a+=`
89
90
  * ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{let l=new Error(a);throw l.errors=o,l}}this.setState({files:t}),r.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(a=>{this.log(`Added file: ${a.name}
90
91
  id: ${a.id}
91
- type: ${a.type}`)}),r.length>0&&this.#h()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(f=>{t[f]&&(o[f]=t[f],delete s[f])});function a(f){return o[f]===void 0}Object.keys(n).forEach(f=>{let m=r[f].fileIDs.filter(a);if(m.length===0){delete n[f];return}let{capabilities:v}=this.getState();if(m.length!==r[f].fileIDs.length&&!v.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:m}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.#y();let u=Object.keys(o);u.forEach(f=>{this.emit("file-removed",o[f])}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#g(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#d(){let e=this.#g(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#v(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#d();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Uo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#v([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#w=(e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#y()};#b(){let e=this.#T(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#y=(0,zf.default)(()=>this.#b(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#b()}#T(){let t=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(t.length===0)return 0;if(t.every(l=>l.progress.uploadComplete))return 1;let r=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,s=t.filter(r),n=t.filter(l=>!r(l));if(s.every(l=>l.progress.uploadComplete)&&n.length>0&&!n.every(l=>l.progress.uploadComplete))return null;let o=s.reduce((l,u)=>l+(u.progress.bytesTotal??0),0),a=s.reduce((l,u)=>l+(u.progress.bytesUploaded||0),0);return o===0?0:a/o}#S(){let e=(s,n,o)=>{let a=s.message||"Unknown error";s.details&&(a+=` ${s.details}`),this.setState({error:a}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(s,n,o)=>{if(e(n,s,o),typeof n=="object"&&n.message){this.log(n.message,"error");let a=new Error(this.i18n("failedToUpload",{file:s?.name??""}));a.isUserFacing=!0,a.details=n.message,n.details&&(a.details+=` ${n.details}`),this.#l([a])}else this.#l([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:o}=s,a=n.map(l=>l.meta.name).join(", ");t||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=s=>{let n=s.filter(a=>{let l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a?.id}`),l}),o=Object.fromEntries(n.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",this.#w),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let o=this.getFile(s.id).progress;this.setFileState(s.id,{progress:{...o,postprocess:this.#s.size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||o.bytesTotal}),this.#y()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.postprocess,this.setState({files:n})}),this.on("restored",()=>{this.#y()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#m),window.addEventListener("offline",this.#m),setTimeout(this.#m,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#m=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let o=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
92
- Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#m),window.removeEventListener("offline",this.#m))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#v(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=zi();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#v(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#n,...this.#o,...this.#s];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(u=>{let f=this.getFile(u);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let o=r.fileIDs.map(u=>this.getFile(u)),a=o.filter(u=>!u.error),l=o.filter(u=>u.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#g().length>0){let s=await this.#d();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#f(e))throw new St(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(u=>u.fileIDs),o=[];Object.keys(e).forEach(u=>{let f=this.getFile(u);!f.progress.uploadStarted&&n.indexOf(u)===-1&&o.push(f.id)});let a=this.#v(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},zo=Zc;var h1=0,JC=Array.isArray;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var u={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--h1,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return K.vnode&&K.vnode(u),u}var jf={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var qf=300,Vs=class extends we{ref=Ro();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,qf)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,qf)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function d1(i,e){return Object.assign(i,e)}function p1(i,e){return i?.key??e}function f1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function Ws(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=p1(i[t],t.toString(36));e[r]=i[t]}return e}function m1(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var g1=i=>i,Ho=class extends we{constructor(e,t){super(e,t),this.refs={},this.state={children:Ws(wt(wt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=Ws(wt(e.children)||[]),r=this.state.children;this.setState(n=>({children:m1(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ws(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ws(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=Ws(wt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=d1({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:u,...f},{children:m}){let v=Object.entries(m).map(([b,k])=>{if(!k)return;let P=f1(this,b);return Us(e(k),{ref:P,key:b})}).filter(Boolean);return xi(u,f,v)}};Ho.defaultProps={component:"span",childFactory:g1};var $f=Ho;var zr=class extends Yt{static VERSION=jf.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c($f,{children:e.info.map(t=>c(Vs,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
92
+ type: ${a.type}`)}),r.length>0&&this.#u()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(f=>{t[f]&&(o[f]=t[f],delete s[f])});function a(f){return o[f]===void 0}Object.keys(n).forEach(f=>{let m=r[f].fileIDs.filter(a);if(m.length===0){delete n[f];return}let{capabilities:w}=this.getState();if(m.length!==r[f].fileIDs.length&&!w.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:m}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.#y();let h=Object.keys(o);h.forEach(f=>{this.emit("file-removed",o[f])}),h.length>5?this.log(`Removed ${h.length} files`):this.log(`Removed files: ${h.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#g(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#d(){let e=this.#g(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#v(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#d();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Wo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#v([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#w=(e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#y()};#b(){let e=this.#T(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#y=(0,Kf.default)(()=>this.#b(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#b()}#T(){let t=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(t.length===0)return 0;if(t.every(l=>l.progress.uploadComplete))return 1;let r=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,s=t.filter(r),n=t.filter(l=>!r(l));if(s.every(l=>l.progress.uploadComplete)&&n.length>0&&!n.every(l=>l.progress.uploadComplete))return null;let o=s.reduce((l,h)=>l+(h.progress.bytesTotal??0),0),a=s.reduce((l,h)=>l+(h.progress.bytesUploaded||0),0);return o===0?0:a/o}#S(){let e=(s,n,o)=>{let a=s.message||"Unknown error";s.details&&(a+=` ${s.details}`),this.setState({error:a}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(s,n,o)=>{if(e(n,s,o),typeof n=="object"&&n.message){this.log(n.message,"error");let a=new Error(this.i18n("failedToUpload",{file:s?.name??""}));a.isUserFacing=!0,a.details=n.message,n.details&&(a.details+=` ${n.details}`),this.#l([a])}else this.#l([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:o}=s,a=n.map(l=>l.meta.name).join(", ");t||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=s=>{let n=s.filter(a=>{let l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a?.id}`),l}),o=Object.fromEntries(n.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",this.#w),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let o=this.getFile(s.id).progress;this.setFileState(s.id,{progress:{...o,postprocess:this.#n.size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||o.bytesTotal}),this.#y()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.postprocess,this.setState({files:n})}),this.on("restored",()=>{this.#y()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#m),window.addEventListener("offline",this.#m),setTimeout(this.#m,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#m=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let o=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
93
+ Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#m),window.removeEventListener("offline",this.#m))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#v(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=Vi();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#v(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#s,...this.#o,...this.#n];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(h=>{let f=this.getFile(h);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let o=r.fileIDs.map(h=>this.getFile(h)),a=o.filter(h=>!h.error),l=o.filter(h=>h.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#g().length>0){let s=await this.#d();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#f(e))throw new wt(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(h=>h.fileIDs),o=[];Object.keys(e).forEach(h=>{let f=this.getFile(h);!f.progress.uploadStarted&&n.indexOf(h)===-1&&o.push(f.id)});let a=this.#v(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},Go=iu;var T1=0;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--T1,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return X.vnode&&X.vnode(h),h}var Yf={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Zf=300,Js=class extends we{ref=Uo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,Zf)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,Zf)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function k1(i,e){return Object.assign(i,e)}function _1(i,e){return i?.key??e}function A1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function en(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=_1(i[t],t.toString(36));e[r]=i[t]}return e}function C1(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var F1=i=>i,Ko=class extends we{constructor(e,t){super(e,t),this.refs={},this.state={children:en(vt(vt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=en(vt(e.children)||[]),r=this.state.children;this.setState(n=>({children:C1(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=en(vt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=en(vt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=en(vt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=k1({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:h,...f},{children:m}){let w=Object.entries(m).map(([y,k])=>{if(!k)return;let C=A1(this,y);return Gs(e(k),{ref:C,key:y})}).filter(Boolean);return xi(h,f,w)}};Ko.defaultProps={component:"span",childFactory:F1};var Qf=Ko;var Qr=class extends si{static VERSION=Yf.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c(Qf,{children:e.info.map(t=>c(Js,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
93
94
 
94
- ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function b1(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function y1({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Ui(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(b1,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var v1=({pluginName:i,i18n:e,onAuth:t})=>c(y1,{pluginName:i,i18n:e,onAuth:t});function jo({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=v1}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function Gs(i){return{...i,type:i.mimeType,extension:i.name?dr(i.name).extension:null}}var am=ye(ut(),1);var $o={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var S1={position:"relative",width:"100%",minHeight:"100%"},E1={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},Qc=class extends we{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),u=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),u+=s);let f=l+u+4,m=e.slice(l,f),v={...S1,height:e.length*t},b={...E1,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:v,children:c("div",{role:"presentation",style:b,children:m.map(r)})})})}},Vo=Qc;var Vf=ye(ut(),1);function T1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function x1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function k1(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function Hr({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(T1,{});case"folder":return c(x1,{});case"video":return c(k1,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function _1({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(Hr,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var Jc=_1;function eh({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Hr,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Hr,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function th(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,u=!!l&&o.status!=="checked",f={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,Vf.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":u},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:u,restrictionError:l};switch(e){case"grid":return c(Jc,{...f});case"list":return c(eh,{...f});case"unsplash":return c(Jc,{...f,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function A1(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:u,virtualList:f,utmSource:m}=i,[v,b]=Nt(!1);if(Xt(()=>{let P=R=>{R.key==="Shift"&&b(!1)},F=R=>{R.key==="Shift"&&b(!0)};return document.addEventListener("keyup",P),document.addEventListener("keydown",F),()=>{document.removeEventListener("keyup",P),document.removeEventListener("keydown",F)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:u});let k=P=>c(th,{viewType:t,toggleCheckbox:F=>{F.stopPropagation(),F.preventDefault(),document.getSelection()?.removeAllRanges(),r(P,v)},showTitles:n,i18n:o,openFolder:l,file:P,utmSource:m},P.id);return f?c("div",{className:"uppy-ProviderBrowser-body",children:c(Vo,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}var Wo=A1;var Wf=ye(ut(),1);var C1=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,Go=C1;function Ks({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=Bi(()=>s(r),[r,s]),o=Bi(()=>Go(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,Wf.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function P1({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:u=""}){let f=b=>{e(b.target.value)},m=Ui(b=>{b.preventDefault(),t()},[t]),[v]=Nt(()=>{let b=document.createElement("form");return b.setAttribute("tabindex","-1"),b.id=zi(),b});return Xt(()=>(document.body.appendChild(v),v.addEventListener("submit",m),()=>{v.removeEventListener("submit",m),document.body.removeChild(v)}),[v,m]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:f,form:v.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${u}`,type:"submit",form:v.id,children:l})]})}var jr=P1;var F1=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),Gf=F1;var O1=(i,e,t)=>{let r=i.map(o=>Gf(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Io(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},Ko=O1;var R1=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},Xo=R1;var M1=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},ki=M1;var L1=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},Kf=L1;var Xf=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...Xf(i,s.parentId,t),s];return t[r]=n,n},I1=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=Xf(i,s.id,e),o=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),a=n.slice(o),l=`/${n.map(f=>f.data.name).join("/")}`,u=a.length===1?void 0:a.map(f=>f.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:u}})},Yo=I1;var rh=ye(Zf(),1);var Ys=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},sh=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Qf=i=>globalThis.DOMException===void 0?new sh(i):new DOMException(i),Jf=i=>{let e=i.reason===void 0?Qf("This operation was aborted."):i.reason;return e instanceof Error?e:Qf(e)};function nh(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,u=new Promise((f,m)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:b}=e;b.aborted&&m(Jf(b)),a=()=>{m(Jf(b))},b.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(f,m);return}let v=new Ys;o=n.setTimeout.call(void 0,()=>{if(r){try{f(r())}catch(b){m(b)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?f():s instanceof Error?m(s):(v.message=s??`Promise timed out after ${t} milliseconds`,m(v))},t),(async()=>{try{f(await i)}catch(b){m(b)}})()}).finally(()=>{u.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return u.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},u}function oh(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var Zs=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=oh(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var Qs=class extends rh.default{#e;#t;#i=0;#r;#n;#o=0;#s;#l;#a;#f;#c=0;#u;#h;#p;#g=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Zs,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#n=e.interval,this.#a=new e.queueClass,this.#f=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=e.throwOnTimeout===!0,this.#h=e.autoStart===!1}get#d(){return this.#t||this.#i<this.#r}get#w(){return this.#c<this.#u}#b(){this.#c--,this.#S(),this.emit("next")}#y(){this.#x(),this.#m(),this.#l=void 0}get#T(){let e=Date.now();if(this.#s===void 0){let t=this.#o-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#h){let e=!this.#T;if(this.#d&&this.#w){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#m(),!0):!1}}return!1}#m(){this.#t||this.#s!==void 0||(this.#s=setInterval(()=>{this.#x()},this.#n),this.#o=Date.now()+this.#n)}#x(){this.#i===0&&this.#c===0&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#i=this.#e?this.#c:0,this.#v()}#v(){for(;this.#S(););}get concurrency(){return this.#u}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#v()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#g++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=nh(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof Ys&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#b()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#h?(this.#h=!1,this.#v(),this):this}pause(){this.#h=!0}clear(){this.#a=new this.#f}async onEmpty(){this.#a.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#E("next",()=>this.#a.size<e)}async onIdle(){this.#c===0&&this.#a.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#h}};var B1=i=>i.map(e=>({...e})),Qo=B1;var em=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let m=await r(o);n=n.concat(m.items),o=m.nextPagePath}let a=n.filter(m=>m.isFolder===!0),l=n.filter(m=>m.isFolder===!1),u=a.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),f=l.map(m=>{let v=s(m);return{type:"file",id:m.requestPath,restrictionError:v,status:v?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...f,...u),u.forEach(async m=>{i.add(()=>em(i,e,m,r,s))})},U1=async(i,e,t,r)=>{let s=new Qs({concurrency:6}),n=Qo(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>em(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},tm=U1;var z1=(i,e,t,r,s)=>{let n=e.filter(b=>b.isFolder===!0),o=e.filter(b=>b.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(b=>({type:"folder",id:b.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:b})),u=o.map(b=>{let k=s(b);return{type:"file",id:b.requestPath,restrictionError:k,status:a&&!k?"checked":"unchecked",parentId:t.id,data:b}}),f={...t,cached:!0,nextPagePath:r};return[...i.map(b=>b.id===f.id?f:b),...l,...u]},im=z1;var H1=(i,e,t,r,s)=>{let n=i.find(k=>k.id===e),o=t.filter(k=>k.isFolder===!0),a=t.filter(k=>k.isFolder===!1),l={...n,nextPagePath:r},u=i.map(k=>k.id===l.id?l:k),f=l.type==="folder"&&l.status==="checked",m=o.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:l.id,data:k})),v=a.map(k=>{let P=s(k);return{type:"file",id:k.requestPath,restrictionError:P,status:f&&!P?"checked":"unchecked",parentId:l.id,data:k}});return[...u,...m,...v]},rm=H1;var ah=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",ah(i,s.id,t)})},lh=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",lh(i,t.parentId)},j1=(i,e)=>{let t=Qo(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{ah(t,s.id,!0)}),lh(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",ah(t,r.id,r.status==="checked"),lh(t,r.parentId)}return t},sm=j1;var pr={afterOpenFolder:im,afterScrollFolder:rm,afterToggleCheckbox:sm,afterFill:tm};var q1=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},Jo=q1;var nm=ye(ut(),1);function ch(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(_e,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function hh({i18n:i,logout:e,username:t}){return c(_e,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function uh(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,nm.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(ch,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(hh,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function en(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var om=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),Js=class{static VERSION=$o.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(om(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:u,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=u,o=o.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=pr.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...om(this.plugin.rootFolderId),authenticated:!1})}}).catch(ki(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);Jo(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=pr.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(ki(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=Gs(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await pr.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=Yo(r);Ko(n,this.plugin,this.provider),this.resetPluginState()}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Xo(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=pr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return Kf(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return Go(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||en;if(o===!1)return c(jo,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:u,username:f,searchString:m}=this.plugin.getPluginState(),v=this.getBreadcrumbs();return c("div",{className:(0,am.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(uh,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:v,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&c(jr,{searchString:m,setSearchString:b=>{this.plugin.setPluginState({searchString:b})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(Wo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(Ks,{partialTree:u,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var lm=ye(ut(),1);var $1={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},V1={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},tn=class{static VERSION=$o.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...V1,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState($1)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){ki(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(Jo(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(u=>u.type!=="root"),l=[o,...a,...n.items.map(u=>({type:"file",id:u.requestPath,status:"unchecked",parentId:null,data:u}))];this.plugin.setPluginState({partialTree:l})}catch(n){ki(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=Yo(e);Ko(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Xo(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=pr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=Gs(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(jr,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,lm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(jr,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(Wo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(Ks,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function ea(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var cm={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var hm={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var kt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var yh=ye(ut(),1);var fh=ye(No(),1);function dh(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function ph(i){let e=dh(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var mh=ye(ut(),1);var G1="\xB7",um=()=>` ${G1} `;function dm(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,mh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===kt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),u=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:u})}function pm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function fm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function mm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function gm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function bm(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function ym(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(bm,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function K1(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,fh.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&um(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,fh.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),um(),n!=null&&o("xTimeLeft",{time:ph(n)})]})]})}function vm(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function X1(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,mh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function wm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:u,complete:f,totalUploadedSize:m,totalSize:v,totalETA:b,startUpload:k}=i,P=l&&n;if(!n||o)return null;let F=e(a?"paused":"uploading");function R(){return!a&&!P&&s?t?c(K1,{numUploads:u,complete:f,totalUploadedSize:m,totalSize:v,totalETA:b,i18n:e}):c(vm,{i18n:e,complete:f,numUploads:u}):null}return c("div",{className:"uppy-StatusBar-content",title:F,children:[a?null:c(bm,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${F}: ${r}%`:F}),R(),P?c(X1,{i18n:e,newFiles:l,startUpload:k}):null]})]})}function Sm(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function Em(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
95
+ ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function P1(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function O1({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=$i(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(P1,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var R1=({pluginName:i,i18n:e,onAuth:t})=>c(O1,{pluginName:i,i18n:e,onAuth:t});function Xo({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=R1}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function tn(i){return{...i,type:i.mimeType,extension:i.name?gr(i.name).extension:null}}var mm=ye(ut(),1);var Zo={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var L1={position:"relative",width:"100%",minHeight:"100%"},I1={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},ru=class extends we{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),h=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),h+=s);let f=l+h+4,m=e.slice(l,f),w={...L1,height:e.length*t},y={...I1,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:w,children:c("div",{role:"presentation",style:y,children:m.map(r)})})})}},Qo=ru;var Jf=ye(ut(),1);function D1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function N1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function B1(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function Jr({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(D1,{});case"folder":return c(N1,{});case"video":return c(B1,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function U1({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(Jr,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var su=U1;function nu({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Jr,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Jr,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function ou(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,h=!!l&&o.status!=="checked",f={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,Jf.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":h},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:h,restrictionError:l};switch(e){case"grid":return c(su,{...f});case"list":return c(nu,{...f});case"unsplash":return c(su,{...f,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function z1(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:h,virtualList:f,utmSource:m}=i,[w,y]=Gt(!1);if(ri(()=>{let C=R=>{R.key==="Shift"&&y(!1)},O=R=>{R.key==="Shift"&&y(!0)};return document.addEventListener("keyup",C),document.addEventListener("keydown",O),()=>{document.removeEventListener("keyup",C),document.removeEventListener("keydown",O)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:h});let k=C=>c(ou,{viewType:t,toggleCheckbox:O=>{O.stopPropagation(),O.preventDefault(),document.getSelection()?.removeAllRanges(),r(C,w)},showTitles:n,i18n:o,openFolder:l,file:C,utmSource:m},C.id);return f?c("div",{className:"uppy-ProviderBrowser-body",children:c(Qo,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}var Jo=z1;var em=ye(ut(),1);var H1=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,ea=H1;function rn({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=qi(()=>s(r),[r,s]),o=qi(()=>ea(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,em.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function j1({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:h=""}){let f=y=>{e(y.target.value)},m=$i(y=>{y.preventDefault(),t()},[t]),[w]=Gt(()=>{let y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Vi(),y});return ri(()=>(document.body.appendChild(w),w.addEventListener("submit",m),()=>{w.removeEventListener("submit",m),document.body.removeChild(w)}),[w,m]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:f,form:w.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${h}`,type:"submit",form:w.id,children:l})]})}var es=j1;var q1=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),tm=q1;var $1=(i,e,t)=>{let r=i.map(o=>tm(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(jo(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},ta=$1;var V1=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},ia=V1;var W1=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},ki=W1;var G1=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},im=G1;var rm=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...rm(i,s.parentId,t),s];return t[r]=n,n},K1=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=rm(i,s.id,e),o=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),a=n.slice(o),l=`/${n.map(f=>f.data.name).join("/")}`,h=a.length===1?void 0:a.map(f=>f.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:h}})},ra=K1;var lu=ye(nm(),1);var nn=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},cu=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},om=i=>globalThis.DOMException===void 0?new cu(i):new DOMException(i),am=i=>{let e=i.reason===void 0?om("This operation was aborted."):i.reason;return e instanceof Error?e:om(e)};function uu(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,h=new Promise((f,m)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:y}=e;y.aborted&&m(am(y)),a=()=>{m(am(y))},y.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(f,m);return}let w=new nn;o=n.setTimeout.call(void 0,()=>{if(r){try{f(r())}catch(y){m(y)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?f():s instanceof Error?m(s):(w.message=s??`Promise timed out after ${t} milliseconds`,m(w))},t),(async()=>{try{f(await i)}catch(y){m(y)}})()}).finally(()=>{h.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return h.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},h}function hu(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var on=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=hu(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var an=class extends lu.default{#e;#t;#i=0;#r;#s;#o=0;#n;#l;#a;#f;#c=0;#h;#u;#p;#g=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:on,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#s=e.interval,this.#a=new e.queueClass,this.#f=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=e.throwOnTimeout===!0,this.#u=e.autoStart===!1}get#d(){return this.#t||this.#i<this.#r}get#w(){return this.#c<this.#h}#b(){this.#c--,this.#S(),this.emit("next")}#y(){this.#x(),this.#m(),this.#l=void 0}get#T(){let e=Date.now();if(this.#n===void 0){let t=this.#o-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#u){let e=!this.#T;if(this.#d&&this.#w){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#m(),!0):!1}}return!1}#m(){this.#t||this.#n!==void 0||(this.#n=setInterval(()=>{this.#x()},this.#s),this.#o=Date.now()+this.#s)}#x(){this.#i===0&&this.#c===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#i=this.#e?this.#c:0,this.#v()}#v(){for(;this.#S(););}get concurrency(){return this.#h}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#h=e,this.#v()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#g++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=uu(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof nn&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#b()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#u?(this.#u=!1,this.#v(),this):this}pause(){this.#u=!0}clear(){this.#a=new this.#f}async onEmpty(){this.#a.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#E("next",()=>this.#a.size<e)}async onIdle(){this.#c===0&&this.#a.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#u}};var Z1=i=>i.map(e=>({...e})),na=Z1;var lm=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let m=await r(o);n=n.concat(m.items),o=m.nextPagePath}let a=n.filter(m=>m.isFolder===!0),l=n.filter(m=>m.isFolder===!1),h=a.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),f=l.map(m=>{let w=s(m);return{type:"file",id:m.requestPath,restrictionError:w,status:w?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...f,...h),h.forEach(async m=>{i.add(()=>lm(i,e,m,r,s))})},Q1=async(i,e,t,r)=>{let s=new an({concurrency:6}),n=na(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>lm(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},cm=Q1;var J1=(i,e,t,r,s)=>{let n=e.filter(y=>y.isFolder===!0),o=e.filter(y=>y.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(y=>({type:"folder",id:y.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:y})),h=o.map(y=>{let k=s(y);return{type:"file",id:y.requestPath,restrictionError:k,status:a&&!k?"checked":"unchecked",parentId:t.id,data:y}}),f={...t,cached:!0,nextPagePath:r};return[...i.map(y=>y.id===f.id?f:y),...l,...h]},um=J1;var eS=(i,e,t,r,s)=>{let n=i.find(k=>k.id===e),o=t.filter(k=>k.isFolder===!0),a=t.filter(k=>k.isFolder===!1),l={...n,nextPagePath:r},h=i.map(k=>k.id===l.id?l:k),f=l.type==="folder"&&l.status==="checked",m=o.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:l.id,data:k})),w=a.map(k=>{let C=s(k);return{type:"file",id:k.requestPath,restrictionError:C,status:f&&!C?"checked":"unchecked",parentId:l.id,data:k}});return[...h,...m,...w]},hm=eS;var du=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",du(i,s.id,t)})},pu=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",pu(i,t.parentId)},tS=(i,e)=>{let t=na(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{du(t,s.id,!0)}),pu(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",du(t,r.id,r.status==="checked"),pu(t,r.parentId)}return t},dm=tS;var br={afterOpenFolder:um,afterScrollFolder:hm,afterToggleCheckbox:dm,afterFill:cm};var iS=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},oa=iS;var pm=ye(ut(),1);function fu(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(_e,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function mu({i18n:i,logout:e,username:t}){return c(_e,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function gu(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,pm.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(fu,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(mu,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function cn(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var fm=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),ln=class{static VERSION=Zo.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(fm(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:h,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=h,o=o.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=br.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...fm(this.plugin.rootFolderId),authenticated:!1})}}).catch(ki(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);oa(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=br.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(ki(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=tn(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await br.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=ra(r);ta(n,this.plugin,this.provider),this.resetPluginState()}).catch(ki(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ia(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=br.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return im(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return ea(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||cn;if(o===!1)return c(Xo,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:h,username:f,searchString:m}=this.plugin.getPluginState(),w=this.getBreadcrumbs();return c("div",{className:(0,mm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(gu,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:w,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&c(es,{searchString:m,setSearchString:y=>{this.plugin.setPluginState({searchString:y})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(Jo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(rn,{partialTree:h,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var gm=ye(ut(),1);var rS={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},sS={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},un=class{static VERSION=Zo.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...sS,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(rS)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){ki(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(oa(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(h=>h.type!=="root"),l=[o,...a,...n.items.map(h=>({type:"file",id:h.requestPath,status:"unchecked",parentId:null,data:h}))];this.plugin.setPluginState({partialTree:l})}catch(n){ki(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=ra(e);ta(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ia(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=br.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=tn(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(es,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,gm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(es,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(Jo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(rn,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function aa(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var bm={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var ym={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var Ct={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Tu=ye(ut(),1);var vu=ye($o(),1);function bu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function yu(i){let e=bu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var wu=ye(ut(),1);var oS="\xB7",vm=()=>` ${oS} `;function wm(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,wu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===Ct.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),h=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:h})}function Sm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function Em(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function Tm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function xm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function km(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function _m(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(km,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function aS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,vu.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&vm(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,vu.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),vm(),n!=null&&o("xTimeLeft",{time:yu(n)})]})]})}function Am(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function lS(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,wu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function Cm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,startUpload:k}=i,C=l&&n;if(!n||o)return null;let O=e(a?"paused":"uploading");function R(){return!a&&!C&&s?t?c(aS,{numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,i18n:e}):c(Am,{i18n:e,complete:f,numUploads:h}):null}return c("div",{className:"uppy-StatusBar-content",title:O,children:[a?null:c(km,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${O}: ${r}%`:O}),R(),C?c(lS,{i18n:e,newFiles:l,startUpload:k}):null]})]})}function Fm(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function Pm(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
95
96
 
96
- ${e}`;alert(o)}return c("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),c("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),c(vm,{i18n:t,complete:r,numUploads:s})]})]})}function rn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var{STATE_ERROR:Tm,STATE_WAITING:Y1,STATE_PREPROCESSING:gh,STATE_UPLOADING:ta,STATE_POSTPROCESSING:bh,STATE_COMPLETE:ia}=kt;function vh({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:o=void 0,hidePauseResumeButton:a=!1,hideCancelButton:l=!1,hideRetryButton:u=!1,recoveredState:f,uploadState:m,totalProgress:v,files:b,supportsUploadProgress:k,hideAfterFinish:P=!1,isSomeGhost:F,doneButtonHandler:R=void 0,isUploadStarted:_,i18n:C,startUpload:S,uppy:E,isAllComplete:A,showProgressDetails:O=void 0,numUploads:N,complete:z,totalSize:$,totalETA:j,totalUploadedSize:X}){function te(){switch(m){case bh:case gh:{let be=rn(b);return be.mode==="determinate"?be.value*100:v}case Tm:return null;case ta:return k?v:null;default:return v}}function ie(){switch(m){case bh:case gh:{let{mode:be}=rn(b);return be==="indeterminate"}case ta:return!k;default:return!1}}let je=te(),ge=je??100,De=!n&&i&&(!t&&!r||f)&&e&&!o,de=!l&&m!==Y1&&m!==ia,tt=s&&!a&&m===ta,At=n&&!A&&!u,re=R&&m===ia,ft=(0,yh.default)("uppy-StatusBar-progress",{"is-indeterminate":ie()}),se=(0,yh.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":F}),Ke=(()=>{switch(m){case gh:case bh:return c(ym,{progress:rn(b)});case ia:return c(Sm,{i18n:C});case Tm:return c(Em,{error:n,i18n:C,numUploads:N,complete:z});case ta:return c(wm,{i18n:C,supportsUploadProgress:k,totalProgress:v,showProgressDetails:O,isUploadStarted:_,isAllComplete:A,isAllPaused:r,newFiles:i,numUploads:N,complete:z,totalUploadedSize:X,totalSize:$,totalETA:j,startUpload:S});default:return null}})();return!(De||At||tt||de||re)&&!Ke||m===ia&&P?null:c("div",{className:se,children:[c("div",{className:ft,style:{width:`${ge}%`},role:"progressbar","aria-label":`${ge}%`,"aria-valuetext":`${ge}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":je}),Ke,c("div",{className:"uppy-StatusBar-actions",children:[De?c(dm,{newFiles:i,isUploadStarted:_,recoveredState:f,i18n:C,isSomeGhost:F,startUpload:S,uploadState:m}):null,At?c(pm,{i18n:C,uppy:E}):null,tt?c(mm,{isAllPaused:r,i18n:C,isAllComplete:A,resumableUploads:s,uppy:E}):null,de?c(fm,{i18n:C,uppy:E}):null,re?c(gm,{i18n:C,doneButtonHandler:R}):null]})]})}var Z1=2e3,Q1=2e3;function J1(i,e,t,r){if(i)return kt.STATE_ERROR;if(e)return kt.STATE_COMPLETE;if(t)return kt.STATE_WAITING;let s=kt.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return kt.STATE_UPLOADING;a.preprocess&&(s=kt.STATE_PREPROCESSING),a.postprocess&&s!==kt.STATE_PREPROCESSING&&(s=kt.STATE_POSTPROCESSING)}return s}var eS={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},qr=class extends Yt{static VERSION=cm.version;#e;#t;#i;#r;constructor(e,t){super(e,{...eS,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=hm,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#n(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,o=this.#i==null?n:ea(n,this.#i,Z1,r);this.#i=o;let a=t/o,l=Math.max(this.#r-r,0),u=this.#r==null?a:ea(a,l,Q1,r);return this.#r=u,this.#e=performance.now(),Math.round(u/100)/10}startUpload=()=>this.uppy.upload().catch(()=>{});render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:u,completeFiles:f,isUploadStarted:m,isAllComplete:v,isAllPaused:b,isUploadInProgress:k,isSomeGhost:P}=this.uppy.getObjectOfFilesPerState(),F=a?Object.values(r):l,R=!!t.resumableUploads,_=t.uploadProgress!==!1,C=null,S=0;u.every(A=>A.progress.bytesTotal!=null&&A.progress.bytesTotal!==0)?(C=0,u.forEach(A=>{C+=A.progress.bytesTotal||0,S+=A.progress.bytesUploaded||0})):u.forEach(A=>{S+=A.progress.bytesUploaded||0});let E=this.#n({uploaded:S,total:C});return vh({error:o,uploadState:J1(o,v,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:C,totalUploadedSize:S,isAllComplete:!1,isAllPaused:b,isUploadStarted:m,isUploadInProgress:k,isSomeGhost:P,recoveredState:a,complete:f.length,newFiles:F.length,numUploads:u.length,totalETA:E,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:_,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Po(e)||(e.dir="ltr")}#o=()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0};install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#o),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#o)}};var tS=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function iS(i,e,t){let r=tS.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let o=atob(decodeURIComponent(r[3])),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);n=[a]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}var xm=iS;function ra(i){return i.startsWith("blob:")}function sa(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function he(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var Mm=typeof self<"u"?self:global,an=typeof navigator<"u",rS=an&&typeof HTMLImageElement>"u",km=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),Lm=Mm.Buffer,Im=!!Lm,sS=i=>i!==void 0;function Dm(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(sS).length===0)}function Ge(i){let e=new Error(i);throw delete e.stack,e}function _m(i){let e=function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048}(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var wh=i=>String.fromCharCode.apply(null,i),Am=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,mr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Ge("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Ge("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Ge("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),Am?Am.decode(s):Im?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(wh(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return wh(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return wh(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Eh(i,e){Ge(`${i} '${e}' was not loaded, try using full build of exifr.`)}var ln=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Eh(this.kind,e),t&&(e in t||function(r,s){Ge(`Unknown ${r} '${s}'.`)}(this.kind,e),t[e].enabled||Eh(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},ca=new ln("file parser"),_t=new ln("segment parser"),un=new ln("file reader"),nS=Mm.fetch;function Cm(i,e){return(t=i).startsWith("data:")||t.length>1e4?xh(i,e,"base64"):km&&i.includes("://")?Th(i,e,"url",na):km?xh(i,e,"fs"):an?Th(i,e,"url",na):void Ge("Invalid input argument");var t}async function Th(i,e,t,r){return un.has(t)?xh(i,e,t):r?async function(s,n){let o=await n(s);return new mr(o)}(i,r):void Ge(`Parser ${t} is not loaded`)}async function xh(i,e,t){let r=new(un.get(t))(i,e);return await r.read(),r}var na=i=>nS(i).then(e=>e.arrayBuffer()),cn=i=>new Promise((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)}),kh=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function Nm(i,e,t){let r=new kh;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function Bm(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var dn=new Map,Fh=new Map,Oh=new Map,$r=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],ha=["jfif","xmp","icc","iptc","ihdr"],hn=["tiff",...ha],Ie=["ifd0","ifd1","exif","gps","interop"],Vr=[...hn,...Ie],Wr=["makerNote","userComment"],ua=["translateKeys","translateValues","reviveValues","multiSegment"],Gr=[...ua,"sanitize","mergeOutput","silentErrors"],oa=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},fr=class extends oa{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),he(this,"enabled",!1),he(this,"skip",new Set),he(this,"pick",new Set),he(this,"deps",new Set),he(this,"translateKeys",!1),he(this,"translateValues",!1),he(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Ie.includes(e),this.canBeFiltered&&(this.dict=dn.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Ge(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of ua)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,aa(this.pick,this.deps)):this.enabled&&this.pick.size>0&&aa(this.pick,this.deps)}},pt={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},Pm=new Map,gr=class extends oa{static useCached(e){let t=Pm.get(e);return t!==void 0||(t=new this(e),Pm.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Ge(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=an?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of $r)this[e]=pt[e];for(e of Gr)this[e]=pt[e];for(e of Wr)this[e]=pt[e];for(e of Vr)this[e]=new fr(e,pt[e],void 0,this)}setupFromTrue(){let e;for(e of $r)this[e]=pt[e];for(e of Gr)this[e]=pt[e];for(e of Wr)this[e]=!0;for(e of Vr)this[e]=new fr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of $r)this[t]=pt[t];for(t of Gr)this[t]=pt[t];for(t of Wr)this[t]=pt[t];for(t of Vr)this[t]=new fr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Ie)}setupFromObject(e){let t;for(t of(Ie.ifd0=Ie.ifd0||Ie.image,Ie.ifd1=Ie.ifd1||Ie.thumbnail,Object.assign(this,e),$r))this[t]=Sh(e[t],pt[t]);for(t of Gr)this[t]=Sh(e[t],pt[t]);for(t of Wr)this[t]=Sh(e[t],pt[t]);for(t of hn)this[t]=new fr(t,pt[t],e[t],this);for(t of Ie)this[t]=new fr(t,pt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Ie,Vr),e.tiff===!0?this.batchEnableWithBool(Ie,!0):e.tiff===!1?this.batchEnableWithUserValue(Ie,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Ie):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Ie)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=Fm(e,r);for(let[o,a]of n)aa(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=Fm(t,r);for(let[o,a]of n)aa(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Ie.some(n=>this[n].enabled===!0)||this.makerNote||this.userComment;for(let n of Ie)this[n].finalizeFilters()}get onlyTiff(){return!ha.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of hn)this[e].enabled&&!_t.has(e)&&Eh("segment parser",e)}};function Fm(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=dn.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function Sh(i,e){return i!==void 0?i:e!==void 0?e:void 0}function aa(i,e){for(let t of e)i.add(t)}he(gr,"default",pt);var Kr=class{constructor(e){he(this,"parsers",{}),he(this,"output",{}),he(this,"errors",[]),he(this,"pushToErrors",t=>this.errors.push(t)),this.options=gr.useCached(e)}async read(e){this.file=await function(t,r){return typeof t=="string"?Cm(t,r):an&&!rS&&t instanceof HTMLImageElement?Cm(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new mr(t):an&&t instanceof Blob?Th(t,r,"blob",cn):void Ge("Invalid input argument")}(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of ca)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Ge("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),Dm(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async r=>{let s=await r.parse();r.assignToOutput(e,s)});this.options.silentErrors&&(t=t.map(r=>r.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=_t.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function Um(i,e){let t=new Kr(e);return await t.read(i),t.parse()}var oS=Object.freeze({__proto__:null,parse:Um,Exifr:Kr,fileParsers:ca,segmentParsers:_t,fileReaders:un,tagKeys:dn,tagValues:Fh,tagRevivers:Oh,createDictionary:Nm,extendDictionary:Bm,fetchUrlAsArrayBuffer:na,readBlobAsArrayBuffer:cn,chunkedProps:$r,otherSegments:ha,segments:hn,tiffBlocks:Ie,segmentsAndBlocks:Vr,tiffExtractables:Wr,inheritables:ua,allFormatters:Gr,Options:gr}),Hi=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new gr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof mr?e:new mr(e)}constructor(e,t={},r){he(this,"errors",[]),he(this,"raw",new Map),he(this,"handleError",s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)}),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Oh.get(t),s=Fh.get(t),n=dn.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,u=o.translateKeys&&!!n,f={};for(let[m,v]of e)a&&r.has(m)?v=r.get(m)(v):l&&s.has(m)&&(v=this.translateValue(v,s.get(m))),u&&n.has(m)&&(m=n.get(m)||m),f[m]=v;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};he(Hi,"headerLength",4),he(Hi,"type",void 0),he(Hi,"multiSegment",!1),he(Hi,"canHandle",()=>!1);function aS(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function lS(i){return i>=224&&i<=239}function cS(i,e,t){for(let[r,s]of _t)if(s.canHandle(i,e,t))return r}var la=class extends class{constructor(e,t,r){he(this,"errors",[]),he(this,"ensureSegmentChunk",async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){Ge(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):Ge("Segment unreachable: "+JSON.stringify(s));return s.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(_t.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),he(this,"appSegments",[]),he(this,"jpegSegments",[]),he(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(_t.keyList())):(e=e===void 0?_t.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&_t.has(t)),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some(a=>{let l=_t.get(a),u=this.options[a];return l.multiSegment&&u.multiSegment}),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,u=this.appSegments.some(f=>!this.file.available(f.offset||f.start,f.length||f.size));if(a=e>l&&!u?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:u,findAll:f,wanted:m,remaining:v,options:b}=this;for(;e<t;e++)if(u.getUint8(e)===255){if(r=u.getUint8(e+1),lS(r)){if(s=u.getUint16(e+2),n=cS(u,e,s),n&&m.has(n)&&(o=_t.get(n),a=o.findPosition(u,e),l=b[n],a.type=n,this.appSegments.push(a),!f&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||v.delete(n)):v.delete(n),v.size===0)))break;b.recordUnknownSegments&&(a=Hi.findPosition(u,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(aS(r)){if(s=u.getUint16(e+2),r===218&&b.stopAfterSos!==!1)return;b.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,r])=>{let s=_t.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]})}getSegment(e){return this.appSegments.find(t=>t.type===e)}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};he(la,"type","jpeg"),ca.set("jpeg",la);var hS=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],_h=class extends Hi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let u=0;u<l;u++){let f=this.chunk.getUint16(e);if(o){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!a&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=hS[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Ge(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Ge(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=function(u){for(;u.endsWith("\0");)u=u.slice(0,-1);return u}(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let u=new(function(m){switch(m){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(n))(o),f=a;for(let m=0;m<o;m++)u[m]=this.parseTagValue(n,e),e+=f;return u}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Ge(`Invalid tiff type ${e}`)}}},on=class extends _h{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Ge("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ge(`IFD0 offset points to outside of file.
97
- this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,_m(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,_m(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Om(...e.get(2),e.get(1))),e.set("longitude",Om(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Ie)if(e=this[t],!Dm(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function Om(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}he(on,"type","tiff"),he(on,"headerLength",10),_t.set("tiff",on);var FF=Object.freeze({__proto__:null,default:oS,Exifr:Kr,fileParsers:ca,segmentParsers:_t,fileReaders:un,tagKeys:dn,tagValues:Fh,tagRevivers:Oh,createDictionary:Nm,extendDictionary:Bm,fetchUrlAsArrayBuffer:na,readBlobAsArrayBuffer:cn,chunkedProps:$r,otherSegments:ha,segments:hn,tiffBlocks:Ie,segmentsAndBlocks:Vr,tiffExtractables:Wr,inheritables:ua,allFormatters:Gr,Options:gr,parse:Um}),Rh={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},OF=Object.assign({},Rh,{firstChunkSize:4e4,gps:[1,2,3,4]});var RF=Object.assign({},Rh,{tiff:!1,ifd1:!0,mergeOutput:!1});var uS=Object.assign({},Rh,{firstChunkSize:4e4,ifd0:[274]});async function dS(i){let e=new Kr(uS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var pS=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),sn=!0,nn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;sn=Number(t)+.1*Number(r)<13.4,nn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);sn=nn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);sn=nn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);sn=nn=Number(e)<77}}async function zm(i){let e=await dS(i);return Object.assign({canvas:sn,css:nn},pS[e])}var Ah=class extends mr{constructor(...e){super(...e),he(this,"ranges",new Ch),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=Im?Lm.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Ch=class{constructor(){he(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter(o=>Rm(e,o.offset,s)||Rm(e,o.end,s));if(n.length>0){e=Math.min(e,...n.map(a=>a.offset)),s=Math.max(s,...n.map(a=>a.end)),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter(a=>!n.includes(a))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some(s=>s.offset<=e&&r<=s.end)}};function Rm(i,e,t){return i<=e&&e<=t}var Ph=class extends Ah{constructor(e,t){super(0),he(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};un.set("blob",class extends Ph{async readWhole(){this.chunked=!1;let i=await cn(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await cn(r);return this.set(s,i,!0)}});var Hm={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var jm={strings:{generatingThumbnails:"Generating thumbnails..."}};function mS(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>xm(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function gS(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function bS(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var yS={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},pn=class extends Yt{static VERSION=Hm.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...yS,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=jm,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let u=new Image;u.src=s,u.addEventListener("load",()=>{URL.revokeObjectURL(s),a(u)}),u.addEventListener("error",f=>{URL.revokeObjectURL(s),l(f.error||new Error("Could not create thumbnail"))})}),o=zm(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let u=this.getProportionalDimensions(a,t,r,l.deg),f=gS(a,l),m=this.resizeImage(f,u.width,u.height);return mS(m,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=bS(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let u=document.createElement("canvas");u.width=o,u.height=a,u.getContext("2d").drawImage(s,0,0,o,a),s=u,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return sa(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&sa(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&ra(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||ra(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function vS(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Ls(i)?[i]:null}var Mh=vS;var ji=Array.from;function Lh(i){let e=ji(i.files);return Promise.resolve(e)}function da(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{da(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function qm(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{da(t,[],e,{onSuccess:n=>s(n.map(o=>qm(o,e)))})})},isSameEntry:void 0}}async function*$m(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*$m(s,e?r():i.name);else t!=null&&(yield t)}async function*Ih(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=qm(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*$m(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function Dh(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of Ih(i,t))r.push(s);return r}catch{return Lh(i)}}var Vm={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function Nh(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var cg=ye(ut(),1);var Bh=class extends we{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(_e,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],u=l.splice(n.length-2,n.length);return c(_e,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:f,elements:m})=>c(_e,{children:m},f)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:u.map(({key:f,elements:m})=>c(_e,{children:m},f))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},pa=Bh;var Wm=ye(ut(),1);var SS=i=>c("div",{className:(0,Wm.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(pa,{...i})]}),Gm=SS;var Km=ye(ut(),1);function ES(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,Km.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var Xm=ES;var Ym=ye(ut(),1);function TS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function xS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function kS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function _S(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function AS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function CS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function PS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function br(i){let e={color:"#838999",icon:CS()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:PS()}:t==="image"?{color:"#686de0",icon:TS()}:t==="audio"?{color:"#068dbb",icon:xS()}:t==="video"?{color:"#19af67",icon:kS()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:_S()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:AS()}:e}function FS(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var oi=FS;function fn(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=br(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function Uh(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,u=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:f=>r(f,a.id),fieldCSSClasses:o,required:u,form:s.id},xi):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:u,value:n[a.id],placeholder:a.placeholder,onInput:f=>r(f.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function zh(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:u,className:f,canEditFile:m}=i,v=()=>typeof n=="function"?n(e[t]):n,b=e[t],k=v()??[],P=m(b),F={};k.forEach(O=>{F[O.id]=b.meta[O.id]??""});let[R,_]=Nt(F),C=Ui(O=>{O.preventDefault(),s(R,t)},[s,R,t]),S=(O,N)=>{_({...R,[N]:O})},E=()=>{r(!1)},[A]=Nt(()=>{let O=document.createElement("form");return O.setAttribute("tabindex","-1"),O.id=zi(),O});return Xt(()=>(document.body.appendChild(A),A.addEventListener("submit",C),()=>{A.removeEventListener("submit",C),document.body.removeChild(A)}),[A,C]),c("div",{className:(0,Ym.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:oi,onDragLeave:oi,onDrop:oi,onPaste:oi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:u("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:b.meta?b.meta.name:b.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:A.id,title:l("finishEditingFile"),onClick:E,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:br(b.type).color},children:[c(fn,{file:b}),P&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:O=>{C(O),a(b)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c(Uh,{computedMetaFields:k,requiredMetaFields:o,updateMeta:S,form:A,formState:R})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:A.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:E,form:A.id,children:l("cancel")})]})]})]})}var eg=ye(ut(),1);function Zm(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function Hh(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function OS({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function RS({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function MS({file:i,uppy:e,i18n:t}){let r=s=>{Hh(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function jh(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:u,openFileEditor:f}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c(OS,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?u(!0,t.id):f(t)}}),o&&t.uploadURL?c(MS,{file:t,uppy:e,i18n:l}):null,a?c(RS,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var Qm=ye(No(),1);var qh="...";function fa(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=qh.length+1)return`${i.slice(0,e-1)}\u2026`;let t=e-qh.length,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+qh+i.slice(-s)}var LS=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function mn(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>LS(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var IS=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:fa(t,r())})},DS=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:fa(e.name,13)}),t?c(_e,{children:[` ${r} `,t,` ${r} `]}):null]}):null},NS=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,Qm.default)(i.file.size)}),BS=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),US=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function $h(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[IS({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(US,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[DS({file:e}),NS({file:e}),BS({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(mn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function Vh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":br(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(fn,{file:e}),c(mn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function zS(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function Jm(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Wh(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":Jm(i),title:Jm(i),onClick:()=>zS(i),children:i.children})})}function ma({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function Gh({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function Kh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(ma,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(Wh,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(Wh,{...i,children:c(ma,{children:[c(Gh,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(Wh,{...i,children:c(ma,{children:[c(Gh,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(ma,{children:c(Gh,{progress:i.file.progress.percentage})})})})}var gn=class extends we{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Zm(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let u=(0,eg.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:u,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(Vh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(Kh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c($h,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(jh,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function HS(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function Xh({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:u,metaFields:f,isSingleFile:m,toggleFileCard:v,handleRequestThumbnail:b,handleCancelThumbnail:k,recoveredState:P,individualCancellation:F,itemsPerRow:R,openFileEditor:_,canEditFile:C,toggleAddFilesPanel:S,containerWidth:E,containerHeight:A}){let O=R===1?71:200,N=Bi(()=>{let $=(X,te)=>Number(r[te].isGhost)-Number(r[X].isGhost),j=Object.keys(r);return P&&j.sort($),HS(j,R)},[r,R,P]),z=$=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:$.map(j=>c(gn,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:F,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:u,metaFields:f,recoveredState:P,isSingleFile:m,containerWidth:E,containerHeight:A,toggleFileCard:v,handleRequestThumbnail:b,handleCancelThumbnail:k,role:"listitem",openFileEditor:_,canEditFile:C,toggleAddFilesPanel:S,file:r[j]},j))},$[0]);return m?c("div",{class:"uppy-Dashboard-files",children:z(N[0])}):c(Vo,{class:"uppy-Dashboard-files",role:"list",data:N,renderRow:z,rowHeight:O})}var tg=ye(ut(),1);function jS({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=Ni(null);return c("div",{className:(0,tg.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:oi,onDragLeave:oi,onDrop:oi,onPaste:oi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var ig=jS;var ai={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function qS(i,e,t,r={}){if(i)return ai.STATE_ERROR;if(e)return ai.STATE_COMPLETE;if(t)return ai.STATE_PAUSED;let s=ai.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return ai.STATE_UPLOADING;a.preprocess&&s!==ai.STATE_UPLOADING&&(s=ai.STATE_PREPROCESSING),a.postprocess&&s!==ai.STATE_UPLOADING&&s!==ai.STATE_PREPROCESSING&&(s=ai.STATE_POSTPROCESSING)}return s}function $S({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(qS(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function VS(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c($S,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var rg=VS;var ng=ye(ut(),1);var Xr="uppy-transition-slideDownUp",sg=250;function WS({children:i}){let[e,t]=Nt(null),[r,s]=Nt(""),n=Ni(),o=Ni(),a=Ni(),l=()=>{s(`${Xr}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${Xr}-enter ${Xr}-enter-active`),n.current=setTimeout(()=>{s("")},sg)})},u=()=>{s(`${Xr}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${Xr}-leave ${Xr}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},sg)})};return Xt(()=>{let f=wt(i)[0];e!==f&&(f&&!e?l():e&&!f&&!o.current&&u(),t(f))},[i,e]),Xt(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Us(e,{className:(0,ng.default)(r,e.props.className)}):null}var bn=WS;var og=900,ag=700,Yh=576,lg=330;function Zh(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>Yh,s=i.containerHeight>lg,n=(0,cg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>Yh,"uppy-size--lg":i.containerWidth>ag,"uppy-size--xl":i.containerWidth>og,"uppy-size--height-md":i.containerHeight>lg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>og?o=5:i.containerWidth>ag?o=4:i.containerWidth>Yh&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,u=i.files?Object.keys(i.files).filter(v=>i.files[v].isGhost).length:0,f=()=>u>0?i.i18n("recoveredXFiles",{smart_count:u}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Nh(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(rg,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),a?c(Xh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(pa,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(bn,{children:i.showAddFilesPanel?c(Gm,{...i,isSizeMD:r},"AddFiles"):null}),c(bn,{children:i.fileCardFor?c(zh,{...i},"FileCard"):null}),c(bn,{children:i.activePickerPanel?c(ig,{...i},"Picker"):null}),c(bn,{children:i.showFileEditor?c(Xm,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(v=>i.uppy.getPlugin(v.id).render(i.state))})]})]})]})}var hg={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var ga=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var ug=ye(Kc(),1);function yn(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function Qh(){let i=!1;return(0,ug.default)((t,r)=>{let s=yn(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(ga)?.focus({preventScroll:!0}),i=!1))},260)}function dg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function GS(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function KS(i){return i.contains(document.activeElement)}function Jh(i,e,t){let r=yn(t,e),s=ji(r.querySelectorAll(ga)),n=s.indexOf(document.activeElement);KS(r)?i.shiftKey&&n===0?GS(i,s):!i.shiftKey&&n===s.length-1&&dg(i,s):dg(i,s)}function pg(i,e,t){e===null||Jh(i,e,t)}var fg=9,YS=27;function mg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var ZS={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:en,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},yr=class extends Yt{static VERSION=Vm.version;#e;modalName=`uppy-Dashboard-${zi()}`;superFocus=Qh();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...ZS,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=hg,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=mg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=mg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??ji(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===YS&&this.requestCloseModal(),e.keyCode===fg&&Jh(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=ji(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=ji(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await Dh(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===fg&&pg(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=Mh(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=Mh(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#n=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#o=e=>e.filter(t=>t.type==="acquirer"&&this.#n(t)).map(this.#r);#s=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:u,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:v,isUploadStarted:b,isAllComplete:k,isAllPaused:P}=this.uppy.getObjectOfFilesPerState(),F=this.#o(t.targets),R=this.#s(t.targets),_=this.#l(t.targets),C;return this.opts.theme==="auto"?C=s.darkMode?"dark":"light":C=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),Zh({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:u,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:v,isUploadStarted:b,isAllComplete:k,isAllPaused:P,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:F,theme:C,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:_,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#a=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#f=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#u(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#h(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#p(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#g())?.setOptions(this.#u()),this.uppy.getPlugin(this.#d())?.setOptions(this.#h())}#g(){return`${this.id}:StatusBar`}#d(){return`${this.id}:ThumbnailGenerator`}#w(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(qr,{id:this.#g(),target:this,...this.#u()}),this.opts.disableInformer||this.uppy.use(zr,{id:this.#w(),target:this,...this.#p()}),this.opts.disableThumbnailGenerator||this.uppy.use(pn,{id:this.#d(),...this.#h()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#f(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var gg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Eg=ye(bg(),1);function JS(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var yg=JS;function eE(i){return i*(Math.PI/180)}function tE(i,e,t){let r=Math.abs(eE(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var vg=tE;function iE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var wg=iE;function rE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Sg=rE;var vn=class extends we{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Eg.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=wg(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Sg(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=yg(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=vg(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Tg={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var xg={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},kg={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},sE={quality:.8,actions:kg,cropperOptions:xg},Yr=class extends Yt{static VERSION=gg.version;cropper;constructor(e,t){super(e,{...sE,...t,actions:{...kg,...t?.actions},cropperOptions:{...xg,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Tg,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(vn,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var wn=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function nE(i){return new Error("Cancelled",{cause:i})}function _g(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var ba=class{#e=0;#t=[];#i=!1;#r;#n=1;#o;#s;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},done:()=>{t||(t=!0,this.#e-=1,this.#a())}}}#a(){queueMicrotask(()=>this.#f())}#f(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#u(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#u(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:_g,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,u;try{u=Promise.resolve(e(...r))}catch(f){u=Promise.reject(f)}return u.then(f=>{l?a(l):(s.done(),o(f))},f=>{l?a(l):(s.done(),a(f))}),f=>{l=nE(f)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=_g,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#a()}#h=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#h,e))}rateLimit(e){clearTimeout(this.#s),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#n,this.#s=setTimeout(this.#p,e))}#p=()=>{if(this.#i){this.#s=setTimeout(this.#p,0);return}this.#n=this.limit,this.limit=Math.ceil((this.#o+this.#n)/2);for(let e=this.#n;e<=this.limit;e++)this.#a();this.#o-this.#n>3?this.#s=setTimeout(this.#p,2e3):this.#n=Math.floor(this.#n/2)};get isPaused(){return this.#i}},ya=Symbol("__queue");var iu=class extends Error{cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},Sn=iu;function oE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var Ag=oE;var ru=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Cg=ru;var va=()=>{};function Pg(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=va,onUploadProgress:o=va,shouldRetry:a=()=>!0,onAfterResponse:l=va,onTimeout:u=va,responseType:f,retries:m=3,signal:v=null,timeout:b=3e4,withCredentials:k=!1}=e,P=_=>.3*2**(_-1)*1e3,F=new Cg(b,u);function R(_=0){return new Promise(async(C,S)=>{let E=new XMLHttpRequest,A=O=>{a(E)&&_<m?setTimeout(()=>{R(_+1).then(C,S)},P(_)):(F.done(),S(O))};E.open(s,i,!0),E.withCredentials=k,f&&(E.responseType=f),v?.addEventListener("abort",()=>{E.abort(),S(new DOMException("Aborted","AbortError"))}),E.onload=async()=>{try{await l(E,_)}catch(O){O.request=E,A(O);return}E.status>=200&&E.status<300?(F.done(),C(E)):a(E)&&_<m?setTimeout(()=>{R(_+1).then(C,S)},P(_)):(F.done(),S(new Sn(E.statusText,E)))},E.onerror=()=>A(new Sn(E.statusText,E)),E.upload.onprogress=O=>{F.progress(),o(O)},r&&Object.keys(r).forEach(O=>{E.setRequestHeader(O,r[O])}),await n(E,_),E.send(t)})}return R()}function Fg(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function Og(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function wa(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var Rg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function _i(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var aE=0;function Qr(i){return"__private_"+aE+++"_"+i}var lE={version:"4.3.3"};function cE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Ag(i)?(t=new Sn(t,i),t):(t.request=i,t)}function Mg(i){return i.data.slice(0,i.data.size,i.meta.type)}var hE={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},vr=Qr("getFetcher"),ou=Qr("uploadLocalFile"),su=Qr("uploadBundle"),au=Qr("getCompanionClientArgs"),nu=Qr("uploadFiles"),En=Qr("handleUpload"),Zr=class extends Di{constructor(e,t){if(super(e,{...hE,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,nu,{value:fE}),Object.defineProperty(this,au,{value:pE}),Object.defineProperty(this,su,{value:dE}),Object.defineProperty(this,ou,{value:uE}),Object.defineProperty(this,vr,{writable:!0,value:void 0}),Object.defineProperty(this,En,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[ya]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=Fg(s),o=Og(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await _i(this,su)[su](n)}else await _i(this,nu)[nu](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=Rg,this.i18nInit(),ya in this.opts?this.requests=this.opts[ya]:this.requests=new ba(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),_i(this,vr)[vr]=r=>async(s,n)=>{try{var o,a,l;let m=await Pg(s,{...n,onBeforeRequest:(k,P)=>{var F,R;return(F=(R=this.opts).onBeforeRequest)==null?void 0:F.call(R,k,P,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:k=>{let P=Math.ceil(k/1e3),F=new Error(this.i18n("uploadStalled",{seconds:P}));this.uppy.emit("upload-stalled",F,r)},onUploadProgress:k=>{if(k.lengthComputable)for(let{id:F}of r){var P;let R=this.uppy.getFile(F);this.uppy.emit("upload-progress",R,{uploadStarted:(P=R.progress.uploadStarted)!=null?P:0,bytesUploaded:k.loaded/k.total*R.size,bytesTotal:R.size})}}}),v=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,m));if(m.responseType==="json"){var u;(u=v)!=null||(v=m.response)}else try{var f;(f=v)!=null||(v=JSON.parse(m.responseText))}catch(k){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:k})}let b=typeof((l=v)==null?void 0:l.url)=="string"?v.url:void 0;for(let{id:k}of r)this.uppy.emit("upload-success",this.uppy.getFile(k),{status:m.status,body:v,uploadURL:b});return m}catch(m){if(m.name==="AbortError")return;let v=m.request;for(let b of r)this.uppy.emit("upload-error",this.uppy.getFile(b.id),cE(v,m),v);throw m}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){wa(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Mg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=Mg(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(_i(this,En)[En])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(_i(this,En)[En])}};async function uE(i){let e=new wn(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=_i(this,vr)[vr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function dE(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=_i(this,vr)[vr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function pE(i){var e;let t=this.getOptions(i),r=wa(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function fE(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,_i(this,au)[au](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return _i(this,ou)[ou](e)}))}Zr.VERSION=lE.version;var Ze=class{static fromTemplate(i){if(Lr.isSupported)return Lr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return mE(e)}}};function mE(i){return gE(i),Lg(i),i}function gE(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function bE(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function yE(i){let e=i.attributes;for(let{name:t,value:r}of e)bE(t,r)&&i.removeAttribute(t)}function Lg(i){let e=i.children;for(let t of e)yE(t),Lg(t)}var Sa=class extends V{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#s(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#s())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#s()}attachmentPreviewOutletDisconnected(i,e){this.#s()}configureUppy(){this.uppy=new zo({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(yr,{inline:!1,closeAfterFinish:!0}).use(Yr,{target:yr}),this.#i(),this.#r()}#i(){this.uppy.use(Zr,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#o.bind(this))}#n(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#h.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#h.openModal()}#o(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#s(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#a(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#a(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=Ze.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
97
+ ${e}`;alert(o)}return c("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),c("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),c(Am,{i18n:t,complete:r,numUploads:s})]})]})}function hn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var{STATE_ERROR:Om,STATE_WAITING:cS,STATE_PREPROCESSING:Su,STATE_UPLOADING:la,STATE_POSTPROCESSING:Eu,STATE_COMPLETE:ca}=Ct;function xu({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:o=void 0,hidePauseResumeButton:a=!1,hideCancelButton:l=!1,hideRetryButton:h=!1,recoveredState:f,uploadState:m,totalProgress:w,files:y,supportsUploadProgress:k,hideAfterFinish:C=!1,isSomeGhost:O,doneButtonHandler:R=void 0,isUploadStarted:_,i18n:F,startUpload:x,uppy:S,isAllComplete:A,showProgressDetails:P=void 0,numUploads:N,complete:z,totalSize:q,totalETA:$,totalUploadedSize:Z}){function K(){switch(m){case Eu:case Su:{let Se=hn(y);return Se.mode==="determinate"?Se.value*100:w}case Om:return null;case la:return k?w:null;default:return w}}function ie(){switch(m){case Eu:case Su:{let{mode:Se}=hn(y);return Se==="indeterminate"}case la:return!k;default:return!1}}let Ae=K(),de=Ae??100,Ue=!n&&i&&(!t&&!r||f)&&e&&!o,fe=!l&&m!==cS&&m!==ca,nt=s&&!a&&m===la,Pt=n&&!A&&!h,St=R&&m===ca,pt=(0,Tu.default)("uppy-StatusBar-progress",{"is-indeterminate":ie()}),re=(0,Tu.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":O}),Ye=(()=>{switch(m){case Su:case Eu:return c(_m,{progress:hn(y)});case ca:return c(Fm,{i18n:F});case Om:return c(Pm,{error:n,i18n:F,numUploads:N,complete:z});case la:return c(Cm,{i18n:F,supportsUploadProgress:k,totalProgress:w,showProgressDetails:P,isUploadStarted:_,isAllComplete:A,isAllPaused:r,newFiles:i,numUploads:N,complete:z,totalUploadedSize:Z,totalSize:q,totalETA:$,startUpload:x});default:return null}})();return!(Ue||Pt||nt||fe||St)&&!Ye||m===ca&&C?null:c("div",{className:re,children:[c("div",{className:pt,style:{width:`${de}%`},role:"progressbar","aria-label":`${de}%`,"aria-valuetext":`${de}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Ae}),Ye,c("div",{className:"uppy-StatusBar-actions",children:[Ue?c(wm,{newFiles:i,isUploadStarted:_,recoveredState:f,i18n:F,isSomeGhost:O,startUpload:x,uploadState:m}):null,Pt?c(Sm,{i18n:F,uppy:S}):null,nt?c(Tm,{isAllPaused:r,i18n:F,isAllComplete:A,resumableUploads:s,uppy:S}):null,fe?c(Em,{i18n:F,uppy:S}):null,St?c(xm,{i18n:F,doneButtonHandler:R}):null]})]})}var uS=2e3,hS=2e3;function dS(i,e,t,r){if(i)return Ct.STATE_ERROR;if(e)return Ct.STATE_COMPLETE;if(t)return Ct.STATE_WAITING;let s=Ct.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return Ct.STATE_UPLOADING;a.preprocess&&(s=Ct.STATE_PREPROCESSING),a.postprocess&&s!==Ct.STATE_PREPROCESSING&&(s=Ct.STATE_POSTPROCESSING)}return s}var pS={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},ts=class extends si{static VERSION=bm.version;#e;#t;#i;#r;constructor(e,t){super(e,{...pS,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=ym,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#s(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,o=this.#i==null?n:aa(n,this.#i,uS,r);this.#i=o;let a=t/o,l=Math.max(this.#r-r,0),h=this.#r==null?a:aa(a,l,hS,r);return this.#r=h,this.#e=performance.now(),Math.round(h/100)/10}startUpload=()=>this.uppy.upload().catch((()=>{}));render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:h,completeFiles:f,isUploadStarted:m,isAllComplete:w,isAllPaused:y,isUploadInProgress:k,isSomeGhost:C}=this.uppy.getObjectOfFilesPerState(),O=a?Object.values(r):l,R=!!t.resumableUploads,_=t.uploadProgress!==!1,F=null,x=0;h.every(A=>A.progress.bytesTotal!=null&&A.progress.bytesTotal!==0)?(F=0,h.forEach(A=>{F+=A.progress.bytesTotal||0,x+=A.progress.bytesUploaded||0})):h.forEach(A=>{x+=A.progress.bytesUploaded||0});let S=this.#s({uploaded:x,total:F});return xu({error:o,uploadState:dS(o,w,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:F,totalUploadedSize:x,isAllComplete:!1,isAllPaused:y,isUploadStarted:m,isUploadInProgress:k,isSomeGhost:C,recoveredState:a,complete:f.length,newFiles:O.length,numUploads:h.length,totalETA:S,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:_,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Do(e)||(e.dir="ltr")}#o=()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0};install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#o),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#o)}};var fS=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function mS(i,e,t){let r=fS.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let o=atob(decodeURIComponent(r[3])),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);n=[a]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}var Rm=mS;function ua(i){return i.startsWith("blob:")}function ha(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function ue(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var Hm=typeof self<"u"?self:global,mn=typeof navigator<"u",gS=mn&&typeof HTMLImageElement>"u",Mm=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),jm=Hm.Buffer,qm=!!jm,bS=i=>i!==void 0;function $m(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(bS).length===0)}function Xe(i){let e=new Error(i);throw delete e.stack,e}function Lm(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var ku=i=>String.fromCharCode.apply(null,i),Im=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,vr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Xe("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Xe("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Xe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),Im?Im.decode(s):qm?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(ku(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return ku(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return ku(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Au(i,e){Xe(`${i} '${e}' was not loaded, try using full build of exifr.`)}var gn=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Au(this.kind,e),t&&(e in t||(function(r,s){Xe(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||Au(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},ga=new gn("file parser"),Ft=new gn("segment parser"),vn=new gn("file reader"),yS=Hm.fetch;function Dm(i,e){return(t=i).startsWith("data:")||t.length>1e4?Fu(i,e,"base64"):Mm&&i.includes("://")?Cu(i,e,"url",da):Mm?Fu(i,e,"fs"):mn?Cu(i,e,"url",da):void Xe("Invalid input argument");var t}async function Cu(i,e,t,r){return vn.has(t)?Fu(i,e,t):r?(async function(s,n){let o=await n(s);return new vr(o)})(i,r):void Xe(`Parser ${t} is not loaded`)}async function Fu(i,e,t){let r=new(vn.get(t))(i,e);return await r.read(),r}var da=i=>yS(i).then((e=>e.arrayBuffer())),bn=i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),Pu=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function Vm(i,e,t){let r=new Pu;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function Wm(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var wn=new Map,Iu=new Map,Du=new Map,is=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],ba=["jfif","xmp","icc","iptc","ihdr"],yn=["tiff",...ba],Be=["ifd0","ifd1","exif","gps","interop"],rs=[...yn,...Be],ss=["makerNote","userComment"],ya=["translateKeys","translateValues","reviveValues","multiSegment"],ns=[...ya,"sanitize","mergeOutput","silentErrors"],pa=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},yr=class extends pa{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),ue(this,"enabled",!1),ue(this,"skip",new Set),ue(this,"pick",new Set),ue(this,"deps",new Set),ue(this,"translateKeys",!1),ue(this,"translateValues",!1),ue(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Be.includes(e),this.canBeFiltered&&(this.dict=wn.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Xe(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of ya)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,fa(this.pick,this.deps)):this.enabled&&this.pick.size>0&&fa(this.pick,this.deps)}},dt={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},Nm=new Map,wr=class extends pa{static useCached(e){let t=Nm.get(e);return t!==void 0||(t=new this(e),Nm.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Xe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=mn?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of is)this[e]=dt[e];for(e of ns)this[e]=dt[e];for(e of ss)this[e]=dt[e];for(e of rs)this[e]=new yr(e,dt[e],void 0,this)}setupFromTrue(){let e;for(e of is)this[e]=dt[e];for(e of ns)this[e]=dt[e];for(e of ss)this[e]=!0;for(e of rs)this[e]=new yr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of is)this[t]=dt[t];for(t of ns)this[t]=dt[t];for(t of ss)this[t]=dt[t];for(t of rs)this[t]=new yr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Be)}setupFromObject(e){let t;for(t of(Be.ifd0=Be.ifd0||Be.image,Be.ifd1=Be.ifd1||Be.thumbnail,Object.assign(this,e),is))this[t]=_u(e[t],dt[t]);for(t of ns)this[t]=_u(e[t],dt[t]);for(t of ss)this[t]=_u(e[t],dt[t]);for(t of yn)this[t]=new yr(t,dt[t],e[t],this);for(t of Be)this[t]=new yr(t,dt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Be,rs),e.tiff===!0?this.batchEnableWithBool(Be,!0):e.tiff===!1?this.batchEnableWithUserValue(Be,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Be):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Be)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=Bm(e,r);for(let[o,a]of n)fa(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=Bm(t,r);for(let[o,a]of n)fa(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Be.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Be)this[n].finalizeFilters()}get onlyTiff(){return!ba.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of yn)this[e].enabled&&!Ft.has(e)&&Au("segment parser",e)}};function Bm(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=wn.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function _u(i,e){return i!==void 0?i:e!==void 0?e:void 0}function fa(i,e){for(let t of e)i.add(t)}ue(wr,"default",dt);var os=class{constructor(e){ue(this,"parsers",{}),ue(this,"output",{}),ue(this,"errors",[]),ue(this,"pushToErrors",(t=>this.errors.push(t))),this.options=wr.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?Dm(t,r):mn&&!gS&&t instanceof HTMLImageElement?Dm(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new vr(t):mn&&t instanceof Blob?Cu(t,r,"blob",bn):void Xe("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of ga)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Xe("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),$m(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=Ft.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function Gm(i,e){let t=new os(e);return await t.read(i),t.parse()}var vS=Object.freeze({__proto__:null,parse:Gm,Exifr:os,fileParsers:ga,segmentParsers:Ft,fileReaders:vn,tagKeys:wn,tagValues:Iu,tagRevivers:Du,createDictionary:Vm,extendDictionary:Wm,fetchUrlAsArrayBuffer:da,readBlobAsArrayBuffer:bn,chunkedProps:is,otherSegments:ba,segments:yn,tiffBlocks:Be,segmentsAndBlocks:rs,tiffExtractables:ss,inheritables:ya,allFormatters:ns,Options:wr}),Wi=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new wr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof vr?e:new vr(e)}constructor(e,t={},r){ue(this,"errors",[]),ue(this,"raw",new Map),ue(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Du.get(t),s=Iu.get(t),n=wn.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,h=o.translateKeys&&!!n,f={};for(let[m,w]of e)a&&r.has(m)?w=r.get(m)(w):l&&s.has(m)&&(w=this.translateValue(w,s.get(m))),h&&n.has(m)&&(m=n.get(m)||m),f[m]=w;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};ue(Wi,"headerLength",4),ue(Wi,"type",void 0),ue(Wi,"multiSegment",!1),ue(Wi,"canHandle",(()=>!1));function wS(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function SS(i){return i>=224&&i<=239}function ES(i,e,t){for(let[r,s]of Ft)if(s.canHandle(i,e,t))return r}var ma=class extends class{constructor(e,t,r){ue(this,"errors",[]),ue(this,"ensureSegmentChunk",(async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){Xe(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):Xe("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(Ft.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),ue(this,"appSegments",[]),ue(this,"jpegSegments",[]),ue(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Ft.keyList())):(e=e===void 0?Ft.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&Ft.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((a=>{let l=Ft.get(a),h=this.options[a];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,h=this.appSegments.some((f=>!this.file.available(f.offset||f.start,f.length||f.size)));if(a=e>l&&!h?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:h,findAll:f,wanted:m,remaining:w,options:y}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(r=h.getUint8(e+1),SS(r)){if(s=h.getUint16(e+2),n=ES(h,e,s),n&&m.has(n)&&(o=Ft.get(n),a=o.findPosition(h,e),l=y[n],a.type=n,this.appSegments.push(a),!f&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||w.delete(n)):w.delete(n),w.size===0)))break;y.recordUnknownSegments&&(a=Wi.findPosition(h,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(wS(r)){if(s=h.getUint16(e+2),r===218&&y.stopAfterSos!==!1)return;y.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=Ft.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};ue(ma,"type","jpeg"),ga.set("jpeg",ma);var TS=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Ou=class extends Wi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let f=this.chunk.getUint16(e);if(o){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!a&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=TS[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Xe(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Xe(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=(function(h){for(;h.endsWith("\0");)h=h.slice(0,-1);return h})(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let h=new((function(m){switch(m){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(o),f=a;for(let m=0;m<o;m++)h[m]=this.parseTagValue(n,e),e+=f;return h}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Xe(`Invalid tiff type ${e}`)}}},fn=class extends Ou{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Xe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Xe(`IFD0 offset points to outside of file.
98
+ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Lm(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Lm(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Um(...e.get(2),e.get(1))),e.set("longitude",Um(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Be)if(e=this[t],!$m(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function Um(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}ue(fn,"type","tiff"),ue(fn,"headerLength",10),Ft.set("tiff",fn);var jP=Object.freeze({__proto__:null,default:vS,Exifr:os,fileParsers:ga,segmentParsers:Ft,fileReaders:vn,tagKeys:wn,tagValues:Iu,tagRevivers:Du,createDictionary:Vm,extendDictionary:Wm,fetchUrlAsArrayBuffer:da,readBlobAsArrayBuffer:bn,chunkedProps:is,otherSegments:ba,segments:yn,tiffBlocks:Be,segmentsAndBlocks:rs,tiffExtractables:ss,inheritables:ya,allFormatters:ns,Options:wr,parse:Gm}),Nu={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},qP=Object.assign({},Nu,{firstChunkSize:4e4,gps:[1,2,3,4]});var $P=Object.assign({},Nu,{tiff:!1,ifd1:!0,mergeOutput:!1});var xS=Object.assign({},Nu,{firstChunkSize:4e4,ifd0:[274]});async function kS(i){let e=new os(xS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var _S=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),dn=!0,pn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;dn=Number(t)+.1*Number(r)<13.4,pn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);dn=pn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);dn=pn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);dn=pn=Number(e)<77}}async function Km(i){let e=await kS(i);return Object.assign({canvas:dn,css:pn},_S[e])}var Ru=class extends vr{constructor(...e){super(...e),ue(this,"ranges",new Mu),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=qm?jm.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Mu=class{constructor(){ue(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((o=>zm(e,o.offset,s)||zm(e,o.end,s)));if(n.length>0){e=Math.min(e,...n.map((a=>a.offset))),s=Math.max(s,...n.map((a=>a.end))),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter((a=>!n.includes(a)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function zm(i,e,t){return i<=e&&e<=t}var Lu=class extends Ru{constructor(e,t){super(0),ue(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};vn.set("blob",class extends Lu{async readWhole(){this.chunked=!1;let i=await bn(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await bn(r);return this.set(s,i,!0)}});var Xm={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var Ym={strings:{generatingThumbnails:"Generating thumbnails..."}};function CS(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Rm(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function FS(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function PS(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var OS={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Sn=class extends si{static VERSION=Xm.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...OS,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=Ym,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let h=new Image;h.src=s,h.addEventListener("load",()=>{URL.revokeObjectURL(s),a(h)}),h.addEventListener("error",f=>{URL.revokeObjectURL(s),l(f.error||new Error("Could not create thumbnail"))})}),o=Km(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let h=this.getProportionalDimensions(a,t,r,l.deg),f=FS(a,l),m=this.resizeImage(f,h.width,h.height);return CS(m,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=PS(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let h=document.createElement("canvas");h.width=o,h.height=a,h.getContext("2d").drawImage(s,0,0,o,a),s=h,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return ha(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&ha(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&ua(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||ua(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function RS(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&js(i)?[i]:null}var Bu=RS;var Gi=Array.from;function Uu(i){let e=Gi(i.files);return Promise.resolve(e)}function va(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{va(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function Zm(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{va(t,[],e,{onSuccess:n=>s(n.map(o=>Zm(o,e)))})})},isSameEntry:void 0}}async function*Qm(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*Qm(s,e?r():i.name);else t!=null&&(yield t)}async function*zu(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=Zm(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*Qm(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function Hu(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of zu(i,t))r.push(s);return r}catch{return Uu(i)}}var Jm={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function ju(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var bg=ye(ut(),1);var qu=class extends we{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(_e,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],h=l.splice(n.length-2,n.length);return c(_e,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:f,elements:m})=>c(_e,{children:m},f)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:h.map(({key:f,elements:m})=>c(_e,{children:m},f))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},wa=qu;var eg=ye(ut(),1);var LS=i=>c("div",{className:(0,eg.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(wa,{...i})]}),tg=LS;var ig=ye(ut(),1);function IS(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,ig.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var rg=IS;var sg=ye(ut(),1);function DS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function NS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function BS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function US(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function zS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function HS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function jS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function Sr(i){let e={color:"#838999",icon:HS()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:jS()}:t==="image"?{color:"#686de0",icon:DS()}:t==="audio"?{color:"#068dbb",icon:NS()}:t==="video"?{color:"#19af67",icon:BS()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:US()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:zS()}:e}function qS(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var pi=qS;function En(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Sr(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function $u(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,h=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:f=>r(f,a.id),fieldCSSClasses:o,required:h,form:s.id},xi):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:h,value:n[a.id],placeholder:a.placeholder,onInput:f=>r(f.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function Vu(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:h,className:f,canEditFile:m}=i,w=()=>typeof n=="function"?n(e[t]):n,y=e[t],k=w()??[],C=m(y),O={};k.forEach(P=>{O[P.id]=y.meta[P.id]??""});let[R,_]=Gt(O),F=$i(P=>{P.preventDefault(),s(R,t)},[s,R,t]),x=(P,N)=>{_({...R,[N]:P})},S=()=>{r(!1)},[A]=Gt(()=>{let P=document.createElement("form");return P.setAttribute("tabindex","-1"),P.id=Vi(),P});return ri(()=>(document.body.appendChild(A),A.addEventListener("submit",F),()=>{A.removeEventListener("submit",F),document.body.removeChild(A)}),[A,F]),c("div",{className:(0,sg.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:pi,onDragLeave:pi,onDrop:pi,onPaste:pi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:h("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:y.meta?y.meta.name:y.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:A.id,title:l("finishEditingFile"),onClick:S,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Sr(y.type).color},children:[c(En,{file:y}),C&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:P=>{F(P),a(y)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c($u,{computedMetaFields:k,requiredMetaFields:o,updateMeta:x,form:A,formState:R})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:A.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:S,form:A.id,children:l("cancel")})]})]})]})}var lg=ye(ut(),1);function ng(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function Wu(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function $S({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function VS({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function WS({file:i,uppy:e,i18n:t}){let r=s=>{Wu(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function Gu(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:h,openFileEditor:f}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c($S,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?h(!0,t.id):f(t)}}),o&&t.uploadURL?c(WS,{file:t,uppy:e,i18n:l}):null,a?c(VS,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var og=ye($o(),1);function Sa(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}var GS=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function Tn(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>GS(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var KS=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:Sa(t,r())})},XS=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Sa(e.name,13)}),t?c(_e,{children:[` ${r} `,t,` ${r} `]}):null]}):null},YS=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,og.default)(i.file.size)}),ZS=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),QS=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function Ku(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[KS({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(QS,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[XS({file:e}),YS({file:e}),ZS({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(Tn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function Xu(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":Sr(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(En,{file:e}),c(Tn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function JS(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function ag(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Yu(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":ag(i),title:ag(i),onClick:()=>JS(i),children:i.children})})}function Ea({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function Zu({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function Qu(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(Ea,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(Yu,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(Yu,{...i,children:c(Ea,{children:[c(Zu,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(Yu,{...i,children:c(Ea,{children:[c(Zu,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(Ea,{children:c(Zu,{progress:i.file.progress.percentage})})})})}var xn=class extends we{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!ng(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let h=(0,lg.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:h,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(Xu,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(Qu,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c(Ku,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(Gu,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function eE(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function Ju({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,isSingleFile:m,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,recoveredState:C,individualCancellation:O,itemsPerRow:R,openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,containerWidth:S,containerHeight:A}){let P=R===1?71:200,N=qi(()=>{let q=(Z,K)=>Number(r[K].isGhost)-Number(r[Z].isGhost),$=Object.keys(r);return C&&$.sort(q),eE($,R)},[r,R,C]),z=q=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:q.map($=>c(xn,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:O,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,recoveredState:C,isSingleFile:m,containerWidth:S,containerHeight:A,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,role:"listitem",openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,file:r[$]},$))},q[0]);return m?c("div",{class:"uppy-Dashboard-files",children:z(N[0])}):c(Qo,{class:"uppy-Dashboard-files",role:"list",data:N,renderRow:z,rowHeight:P})}var cg=ye(ut(),1);function tE({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=ji(null);return c("div",{className:(0,cg.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:pi,onDragLeave:pi,onDrop:pi,onPaste:pi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var ug=tE;var fi={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function iE(i,e,t,r={}){if(i)return fi.STATE_ERROR;if(e)return fi.STATE_COMPLETE;if(t)return fi.STATE_PAUSED;let s=fi.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return fi.STATE_UPLOADING;a.preprocess&&s!==fi.STATE_UPLOADING&&(s=fi.STATE_PREPROCESSING),a.postprocess&&s!==fi.STATE_UPLOADING&&s!==fi.STATE_PREPROCESSING&&(s=fi.STATE_POSTPROCESSING)}return s}function rE({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(iE(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function sE(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c(rE,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var hg=sE;var pg=ye(ut(),1);var as="uppy-transition-slideDownUp",dg=250;function nE({children:i}){let[e,t]=Gt(null),[r,s]=Gt(""),n=ji(),o=ji(),a=ji(),l=()=>{s(`${as}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${as}-enter ${as}-enter-active`),n.current=setTimeout(()=>{s("")},dg)})},h=()=>{s(`${as}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${as}-leave ${as}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},dg)})};return ri(()=>{let f=vt(i)[0];e!==f&&(f&&!e?l():e&&!f&&!o.current&&h(),t(f))},[i,e]),ri(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Gs(e,{className:(0,pg.default)(r,e.props.className)}):null}var kn=nE;var fg=900,mg=700,eh=576,gg=330;function th(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>eh,s=i.containerHeight>gg,n=(0,bg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>eh,"uppy-size--lg":i.containerWidth>mg,"uppy-size--xl":i.containerWidth>fg,"uppy-size--height-md":i.containerHeight>gg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>fg?o=5:i.containerWidth>mg?o=4:i.containerWidth>eh&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(w=>i.files[w].isGhost).length:0,f=()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&ju(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(hg,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),a?c(Ju,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(wa,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(kn,{children:i.showAddFilesPanel?c(tg,{...i,isSizeMD:r},"AddFiles"):null}),c(kn,{children:i.fileCardFor?c(Vu,{...i},"FileCard"):null}),c(kn,{children:i.activePickerPanel?c(ug,{...i},"Picker"):null}),c(kn,{children:i.showFileEditor?c(rg,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(w=>i.uppy.getPlugin(w.id).render(i.state))})]})]})]})}var yg={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var Ta=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var vg=ye(Jc(),1);function _n(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function ih(){let i=!1;return(0,vg.default)((t,r)=>{let s=_n(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(Ta)?.focus({preventScroll:!0}),i=!1))},260)}function wg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function oE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function aE(i){return i.contains(document.activeElement)}function rh(i,e,t){let r=_n(t,e),s=Gi(r.querySelectorAll(Ta)),n=s.indexOf(document.activeElement);aE(r)?i.shiftKey&&n===0?oE(i,s):!i.shiftKey&&n===s.length-1&&wg(i,s):wg(i,s)}function Sg(i,e,t){e===null||rh(i,e,t)}var Eg=9,cE=27;function Tg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var uE={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:cn,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},Er=class extends si{static VERSION=Jm.version;#e;modalName=`uppy-Dashboard-${Vi()}`;superFocus=ih();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...uE,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=yg,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=Tg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=Tg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??Gi(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===cE&&this.requestCloseModal(),e.keyCode===Eg&&rh(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=Gi(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=Gi(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await Hu(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===Eg&&Sg(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=Bu(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=Bu(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#s=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#o=e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#r);#n=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C}=this.uppy.getObjectOfFilesPerState(),O=this.#o(t.targets),R=this.#n(t.targets),_=this.#l(t.targets),F;return this.opts.theme==="auto"?F=s.darkMode?"dark":"light":F=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),th({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:O,theme:F,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:_,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#a=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#f=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#h(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#u(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#p(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#g())?.setOptions(this.#h()),this.uppy.getPlugin(this.#d())?.setOptions(this.#u())}#g(){return`${this.id}:StatusBar`}#d(){return`${this.id}:ThumbnailGenerator`}#w(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(ts,{id:this.#g(),target:this,...this.#h()}),this.opts.disableInformer||this.uppy.use(Qr,{id:this.#w(),target:this,...this.#p()}),this.opts.disableThumbnailGenerator||this.uppy.use(Sn,{id:this.#d(),...this.#u()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#f(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var xg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Pg=ye(kg(),1);function dE(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var _g=dE;function pE(i){return i*(Math.PI/180)}function fE(i,e,t){let r=Math.abs(pE(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var Ag=fE;function mE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var Cg=mE;function gE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Fg=gE;var An=class extends we{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Pg.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Cg(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Fg(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=_g(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=Ag(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Og={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var Rg={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Mg={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},bE={quality:.8,actions:Mg,cropperOptions:Rg},ls=class extends si{static VERSION=xg.version;cropper;constructor(e,t){super(e,{...bE,...t,actions:{...Mg,...t?.actions},cropperOptions:{...Rg,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Og,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(An,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var Cn=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function yE(i){return new Error("Cancelled",{cause:i})}function Lg(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var xa=class{#e=0;#t=[];#i=!1;#r;#s=1;#o;#n;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},done:()=>{t||(t=!0,this.#e-=1,this.#a())}}}#a(){queueMicrotask(()=>this.#f())}#f(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#h(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#h(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Lg,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,h;try{h=Promise.resolve(e(...r))}catch(f){h=Promise.reject(f)}return h.then(f=>{l?a(l):(s.done(),o(f))},f=>{l?a(l):(s.done(),a(f))}),f=>{l=yE(f)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=Lg,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#a()}#u=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#u,e))}rateLimit(e){clearTimeout(this.#n),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#s,this.#n=setTimeout(this.#p,e))}#p=()=>{if(this.#i){this.#n=setTimeout(this.#p,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#o+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#a();this.#o-this.#s>3?this.#n=setTimeout(this.#p,2e3):this.#s=Math.floor(this.#s/2)};get isPaused(){return this.#i}},ka=Symbol("__queue");var oh=class extends Error{cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},Fn=oh;function vE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var Ig=vE;var ah=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Dg=ah;var _a=()=>{};function Ng(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=_a,onUploadProgress:o=_a,shouldRetry:a=()=>!0,onAfterResponse:l=_a,onTimeout:h=_a,responseType:f,retries:m=3,signal:w=null,timeout:y=3e4,withCredentials:k=!1}=e,C=_=>.3*2**(_-1)*1e3,O=new Dg(y,h);function R(_=0){return new Promise(async(F,x)=>{let S=new XMLHttpRequest,A=P=>{a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(P))};S.open(s,i,!0),S.withCredentials=k,f&&(S.responseType=f),w?.addEventListener("abort",()=>{S.abort(),x(new DOMException("Aborted","AbortError"))}),S.onload=async()=>{try{await l(S,_)}catch(P){P.request=S,A(P);return}S.status>=200&&S.status<300?(O.done(),F(S)):a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(new Fn(S.statusText,S)))},S.onerror=()=>A(new Fn(S.statusText,S)),S.upload.onprogress=P=>{O.progress(),o(P)},r&&Object.keys(r).forEach(P=>{S.setRequestHeader(P,r[P])}),await n(S,_),S.send(t)})}return R()}function Bg(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function Ug(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function Aa(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var zg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function _i(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var wE=0;function us(i){return"__private_"+wE+++"_"+i}var SE={version:"4.3.3"};function EE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Ig(i)?(t=new Fn(t,i),t):(t.request=i,t)}function Hg(i){return i.data.slice(0,i.data.size,i.meta.type)}var TE={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},Tr=us("getFetcher"),uh=us("uploadLocalFile"),lh=us("uploadBundle"),hh=us("getCompanionClientArgs"),ch=us("uploadFiles"),Pn=us("handleUpload"),cs=class extends Hi{constructor(e,t){if(super(e,{...TE,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,ch,{value:AE}),Object.defineProperty(this,hh,{value:_E}),Object.defineProperty(this,lh,{value:kE}),Object.defineProperty(this,uh,{value:xE}),Object.defineProperty(this,Tr,{writable:!0,value:void 0}),Object.defineProperty(this,Pn,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[ka]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=Bg(s),o=Ug(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await _i(this,lh)[lh](n)}else await _i(this,ch)[ch](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=zg,this.i18nInit(),ka in this.opts?this.requests=this.opts[ka]:this.requests=new xa(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),_i(this,Tr)[Tr]=r=>async(s,n)=>{try{var o,a,l;let m=await Ng(s,{...n,onBeforeRequest:(k,C)=>{var O,R;return(O=(R=this.opts).onBeforeRequest)==null?void 0:O.call(R,k,C,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:k=>{let C=Math.ceil(k/1e3),O=new Error(this.i18n("uploadStalled",{seconds:C}));this.uppy.emit("upload-stalled",O,r)},onUploadProgress:k=>{if(k.lengthComputable)for(let{id:O}of r){var C;let R=this.uppy.getFile(O);this.uppy.emit("upload-progress",R,{uploadStarted:(C=R.progress.uploadStarted)!=null?C:0,bytesUploaded:k.loaded/k.total*R.size,bytesTotal:R.size})}}}),w=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,m));if(m.responseType==="json"){var h;(h=w)!=null||(w=m.response)}else try{var f;(f=w)!=null||(w=JSON.parse(m.responseText))}catch(k){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:k})}let y=typeof((l=w)==null?void 0:l.url)=="string"?w.url:void 0;for(let{id:k}of r)this.uppy.emit("upload-success",this.uppy.getFile(k),{status:m.status,body:w,uploadURL:y});return m}catch(m){if(m.name==="AbortError")return;let w=m.request;for(let y of r)this.uppy.emit("upload-error",this.uppy.getFile(y.id),EE(w,m),w);throw m}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Aa(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Hg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=Hg(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(_i(this,Pn)[Pn])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(_i(this,Pn)[Pn])}};async function xE(i){let e=new Cn(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=_i(this,Tr)[Tr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function kE(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=_i(this,Tr)[Tr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function _E(i){var e;let t=this.getOptions(i),r=Aa(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function AE(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,_i(this,hh)[hh](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return _i(this,uh)[uh](e)}))}cs.VERSION=SE.version;var tt=class{static fromTemplate(i){if(Wr.isSupported)return Wr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return CE(e)}}};function CE(i){return FE(i),jg(i),i}function FE(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function PE(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function OE(i){let e=i.attributes;for(let{name:t,value:r}of e)PE(t,r)&&i.removeAttribute(t)}function jg(i){let e=i.children;for(let t of e)OE(t),jg(t)}var Ca=class extends V{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#n()}attachmentPreviewOutletDisconnected(i,e){this.#n()}configureUppy(){this.uppy=new Go({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(Er,{inline:!1,closeAfterFinish:!0}).use(ls,{target:Er}),this.#i(),this.#r()}#i(){this.uppy.use(cs,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#o.bind(this))}#s(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#u.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#u.openModal()}#o(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#n(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#a(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#a(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=tt.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
98
99
  <svg class="w-4 h-4 mr-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
99
100
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"/>
100
101
  </svg>
101
102
  ${i}
102
- </button>`,!1),this.uploadTrigger.addEventListener("click",this.#n.bind(this))}#f(){this.deleteAllTrigger=Ze.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
103
+ </button>`,!1),this.uploadTrigger.addEventListener("click",this.#s.bind(this))}#f(){this.deleteAllTrigger=tt.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
103
104
  Delete ${this.attachmentPreviewOutlets.length}
104
- </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=Ze.fromTemplate(this.#u(t,r,n,e,a)),u=Ze.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return u.value=JSON.stringify(i),l.appendChild(u),l}#u(i,e,t,r,s){return`
105
+ </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=tt.fromTemplate(this.#h(t,r,n,e,a)),h=tt.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return h.value=JSON.stringify(i),l.appendChild(h),l}#h(i,e,t,r,s){return`
105
106
  <div class="${this.identifierValue} attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md transition-all duration-300"
106
107
  data-controller="attachment-preview"
107
108
  data-attachment-preview-mime-type-value="${t}"
@@ -123,7 +124,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
123
124
  Delete
124
125
  </button>
125
126
  </div>
126
- `}get#h(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function vE(){return Ze.fromTemplate(`
127
+ `}get#u(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function RE(){return tt.fromTemplate(`
127
128
  <svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
128
129
  <g fill="#686DE0" fillRule="evenodd">
129
130
  <path d="M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z" fillRule="nonzero" />
@@ -131,36 +132,36 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
131
132
  <circle cx="7.5" cy="9.5" r="1.5" />
132
133
  </g>
133
134
  </svg>
134
- `)}function wE(){return Ze.fromTemplate(`
135
+ `)}function ME(){return tt.fromTemplate(`
135
136
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
136
137
  <path d="M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z" fill="#049BCF" fillRule="nonzero" />
137
138
  </svg>
138
- `)}function SE(){return Ze.fromTemplate(`
139
+ `)}function LE(){return tt.fromTemplate(`
139
140
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
140
141
  <path d="M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z" fill="#19AF67" fillRule="nonzero" />
141
142
  </svg>
142
- `)}function EE(){return Ze.fromTemplate(`
143
+ `)}function IE(){return tt.fromTemplate(`
143
144
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
144
145
  <path d="M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z" fill="#E2514A" fillRule="nonzero" />
145
146
  </svg>
146
- `)}function TE(){return Ze.fromTemplate(`
147
+ `)}function DE(){return tt.fromTemplate(`
147
148
  <svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
148
149
  <path d="M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z" fill="#00C469" fillRule="nonzero" />
149
150
  </svg>
150
- `)}function xE(){return Ze.fromTemplate(`
151
+ `)}function NE(){return tt.fromTemplate(`
151
152
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
152
153
  <g fill="#A7AFB7" fillRule="nonzero">
153
154
  <path d="M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z" />
154
155
  <path d="M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z" />
155
156
  </g>
156
157
  </svg>
157
- `)}function kE(){return Ze.fromTemplate(`
158
+ `)}function BE(){return tt.fromTemplate(`
158
159
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
159
160
  <path d="M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z" fill="#5A5E69" fillRule="nonzero" />
160
161
  </svg>
161
- `)}function lu(i){let e={color:"#838999",icon:xE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:kE()}:t==="image"?{color:"#686de0",icon:vE()}:t==="audio"?{color:"#068dbb",icon:wE()}:t==="video"?{color:"#19af67",icon:SE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:EE()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:TE()}:e}var Ea=class extends V{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=Ze.fromTemplate(`
162
+ `)}function dh(i){let e={color:"#838999",icon:NE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:BE()}:t==="image"?{color:"#686de0",icon:RE()}:t==="audio"?{color:"#068dbb",icon:ME()}:t==="video"?{color:"#19af67",icon:LE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:IE()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:DE()}:e}var Fa=class extends V{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=tt.fromTemplate(`
162
163
  <img src="${this.thumbnailUrlValue}" class="w-full h-full object-cover" />
163
- `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=lu(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Ta=class extends V{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var Ig=0,xa=class extends V{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(Ig=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=Ig)}};var ka=class extends V{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var _a=class extends V{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,document.body.style.overflow="hidden",this.element.showModal(),this.element.addEventListener("close",this.handleClose.bind(this))}close(){this.element.close(),this.restoreBodyState()}disconnect(){this.element.removeEventListener("close",this.handleClose),this.restoreBodyState()}handleClose(){this.restoreBodyState()}restoreBodyState(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var Aa=class extends V{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Ca=class extends V{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var Pa=class extends V{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Fa=class extends V{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var Oa=class extends V{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var Ra=class extends V{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){localStorage.getItem(this.storageKeyValue)==="true"&&document.body.classList.add("pu-rail-pinned")}togglePin(){let i=document.body.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var Ma=class extends V{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8);i.style.top=`${parseFloat(i.style.top)-s}px`}})}};var La=class extends V{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var Ia=class extends V{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var Da=class extends V{connect(){"value"in this.element&&(this.element.value=window.location.href)}};var Na=class extends V{click(i){i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]")||this.element.querySelector('[data-row-click-target="show"]')?.click()}};var Ba=class extends V{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=60*60*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var Ua=class extends V{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};function cu(i){i.register("password-visibility",ka),i.register("sidebar",xa),i.register("resource-header",eo),i.register("nested-resource-form-fields",to),i.register("form",io),i.register("resource-drop-down",co),i.register("resource-collapse",ho),i.register("resource-dismiss",uo),i.register("frame-navigator",po),i.register("color-mode",mo),i.register("easymde",To),i.register("slim-select",xo),i.register("flatpickr",ko),i.register("intl-tel-input",_o),i.register("select-navigator",Ao),i.register("resource-tab-list",Co),i.register("attachment-input",Sa),i.register("attachment-preview",Ea),i.register("attachment-preview-container",Ta),i.register("remote-modal",_a),i.register("key-value-store",Aa),i.register("bulk-actions",Ca),i.register("filter-panel",Pa),i.register("textarea-autogrow",Fa),i.register("clipboard",Oa),i.register("icon-rail",Ra),i.register("icon-rail-flyout",Ma),i.register("table-header",La),i.register("table-column-menu",Ia),i.register("capture-url",Da),i.register("row-click",Na),i.register("view-switcher",Ba),i.register("autosubmit",Ua)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};var _E=Qn.start();cu(_E);})();
164
+ `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=dh(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Pa=class extends V{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var qg=0,Oa=class extends V{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(qg=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=qg)}};var Ra=class extends V{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var Ma=class extends V{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,document.body.style.overflow="hidden",this.element.showModal(),this.element.addEventListener("close",this.handleClose.bind(this))}close(){this.element.close(),this.restoreBodyState()}disconnect(){this.element.removeEventListener("close",this.handleClose),this.restoreBodyState()}handleClose(){this.restoreBodyState()}restoreBodyState(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var La=class extends V{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Ia=class extends V{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var Da=class extends V{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Na=class extends V{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var Ba=class extends V{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var Ua=class extends V{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){localStorage.getItem(this.storageKeyValue)==="true"&&document.body.classList.add("pu-rail-pinned")}togglePin(){let i=document.body.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var za=class extends V{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8);i.style.top=`${parseFloat(i.style.top)-s}px`}})}};var Ha=class extends V{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var ja=class extends V{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var qa=class extends V{connect(){"value"in this.element&&(this.element.value=window.location.href)}};var $a=class extends V{click(i){i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]")||this.element.querySelector('[data-row-click-target="show"]')?.click()}};var Va=class extends V{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=3600*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var Wa=class extends V{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};function ph(i){i.register("password-visibility",Ra),i.register("sidebar",Oa),i.register("resource-header",lo),i.register("nested-resource-form-fields",co),i.register("form",uo),i.register("resource-drop-down",yo),i.register("resource-collapse",vo),i.register("resource-dismiss",wo),i.register("frame-navigator",So),i.register("color-mode",To),i.register("easymde",Po),i.register("slim-select",Oo),i.register("flatpickr",Ro),i.register("intl-tel-input",Mo),i.register("select-navigator",Lo),i.register("resource-tab-list",Io),i.register("attachment-input",Ca),i.register("attachment-preview",Fa),i.register("attachment-preview-container",Pa),i.register("remote-modal",Ma),i.register("key-value-store",La),i.register("bulk-actions",Ia),i.register("filter-panel",Da),i.register("textarea-autogrow",Na),i.register("clipboard",Ba),i.register("icon-rail",Ua),i.register("icon-rail-flyout",za),i.register("table-header",Ha),i.register("table-column-menu",ja),i.register("capture-url",qa),i.register("row-click",$a),i.register("view-switcher",Va),i.register("autosubmit",Wa)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};Turbo.StreamActions.close_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);if(!e)return;let t=e.querySelector("dialog");t&&typeof t.close=="function"&&t.close(),e.innerHTML="",e.removeAttribute("src")};Turbo.StreamActions.reload_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);!e||typeof e.reload!="function"||e.reload()};var UE=oo.start();ph(UE);})();
164
165
  /*!
165
166
  * Sanitize an HTML node
166
167
  */
@@ -191,7 +192,7 @@ cropperjs/dist/cropper.js:
191
192
  *)
192
193
 
193
194
  dompurify/dist/purify.es.mjs:
194
- (*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)
195
+ (*! @license DOMPurify 3.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.3/LICENSE *)
195
196
 
196
197
  @uppy/utils/lib/Translator.js:
197
198
  (**