@@ -0,0 +1,2455 @@
1+(() => {
2+ // output/Control.Semigroupoid/index.js
3+ var semigroupoidFn = {
4+ compose: function(f) {
5+ return function(g) {
6+ return function(x) {
7+ return f(g(x));
8+ };
9+ };
10+ }
11+ };
12+
13+ // output/Control.Category/index.js
14+ var identity = function(dict) {
15+ return dict.identity;
16+ };
17+ var categoryFn = {
18+ identity: function(x) {
19+ return x;
20+ },
21+ Semigroupoid0: function() {
22+ return semigroupoidFn;
23+ }
24+ };
25+
26+ // output/Data.Function/index.js
27+ var flip = function(f) {
28+ return function(b) {
29+ return function(a) {
30+ return f(a)(b);
31+ };
32+ };
33+ };
34+
35+ // output/Data.Functor/foreign.js
36+ var arrayMap = function(f) {
37+ return function(arr) {
38+ var l = arr.length;
39+ var result = new Array(l);
40+ for (var i = 0; i < l; i++) {
41+ result[i] = f(arr[i]);
42+ }
43+ return result;
44+ };
45+ };
46+
47+ // output/Data.Unit/foreign.js
48+ var unit = void 0;
49+
50+ // output/Type.Proxy/index.js
51+ var $$Proxy = /* @__PURE__ */ function() {
52+ function $$Proxy2() {
53+ }
54+ ;
55+ $$Proxy2.value = new $$Proxy2();
56+ return $$Proxy2;
57+ }();
58+
59+ // output/Data.Functor/index.js
60+ var map = function(dict) {
61+ return dict.map;
62+ };
63+ var functorArray = {
64+ map: arrayMap
65+ };
66+
67+ // output/Control.Apply/index.js
68+ var apply = function(dict) {
69+ return dict.apply;
70+ };
71+
72+ // output/Control.Applicative/index.js
73+ var pure = function(dict) {
74+ return dict.pure;
75+ };
76+ var liftA1 = function(dictApplicative) {
77+ var apply2 = apply(dictApplicative.Apply0());
78+ var pure1 = pure(dictApplicative);
79+ return function(f) {
80+ return function(a) {
81+ return apply2(pure1(f))(a);
82+ };
83+ };
84+ };
85+
86+ // output/Control.Bind/foreign.js
87+ var arrayBind = typeof Array.prototype.flatMap === "function" ? function(arr) {
88+ return function(f) {
89+ return arr.flatMap(f);
90+ };
91+ } : function(arr) {
92+ return function(f) {
93+ var result = [];
94+ var l = arr.length;
95+ for (var i = 0; i < l; i++) {
96+ var xs = f(arr[i]);
97+ var k = xs.length;
98+ for (var j = 0; j < k; j++) {
99+ result.push(xs[j]);
100+ }
101+ }
102+ return result;
103+ };
104+ };
105+
106+ // output/Control.Bind/index.js
107+ var discard = function(dict) {
108+ return dict.discard;
109+ };
110+ var bind = function(dict) {
111+ return dict.bind;
112+ };
113+ var bindFlipped = function(dictBind) {
114+ return flip(bind(dictBind));
115+ };
116+ var discardUnit = {
117+ discard: function(dictBind) {
118+ return bind(dictBind);
119+ }
120+ };
121+
122+ // output/Data.Symbol/index.js
123+ var reflectSymbol = function(dict) {
124+ return dict.reflectSymbol;
125+ };
126+
127+ // output/Record.Unsafe/foreign.js
128+ var unsafeGet = function(label4) {
129+ return function(rec) {
130+ return rec[label4];
131+ };
132+ };
133+ var unsafeSet = function(label4) {
134+ return function(value12) {
135+ return function(rec) {
136+ var copy = {};
137+ for (var key in rec) {
138+ if ({}.hasOwnProperty.call(rec, key)) {
139+ copy[key] = rec[key];
140+ }
141+ }
142+ copy[label4] = value12;
143+ return copy;
144+ };
145+ };
146+ };
147+
148+ // output/Data.Semigroup/foreign.js
149+ var concatArray = function(xs) {
150+ return function(ys) {
151+ if (xs.length === 0) return ys;
152+ if (ys.length === 0) return xs;
153+ return xs.concat(ys);
154+ };
155+ };
156+
157+ // output/Data.Semigroup/index.js
158+ var semigroupUnit = {
159+ append: function(v) {
160+ return function(v1) {
161+ return unit;
162+ };
163+ }
164+ };
165+ var semigroupRecordNil = {
166+ appendRecord: function(v) {
167+ return function(v1) {
168+ return function(v2) {
169+ return {};
170+ };
171+ };
172+ }
173+ };
174+ var semigroupArray = {
175+ append: concatArray
176+ };
177+ var appendRecord = function(dict) {
178+ return dict.appendRecord;
179+ };
180+ var semigroupRecord = function() {
181+ return function(dictSemigroupRecord) {
182+ return {
183+ append: appendRecord(dictSemigroupRecord)($$Proxy.value)
184+ };
185+ };
186+ };
187+ var append = function(dict) {
188+ return dict.append;
189+ };
190+ var semigroupRecordCons = function(dictIsSymbol) {
191+ var reflectSymbol2 = reflectSymbol(dictIsSymbol);
192+ return function() {
193+ return function(dictSemigroupRecord) {
194+ var appendRecord1 = appendRecord(dictSemigroupRecord);
195+ return function(dictSemigroup) {
196+ var append12 = append(dictSemigroup);
197+ return {
198+ appendRecord: function(v) {
199+ return function(ra) {
200+ return function(rb) {
201+ var tail = appendRecord1($$Proxy.value)(ra)(rb);
202+ var key = reflectSymbol2($$Proxy.value);
203+ var insert = unsafeSet(key);
204+ var get = unsafeGet(key);
205+ return insert(append12(get(ra))(get(rb)))(tail);
206+ };
207+ };
208+ }
209+ };
210+ };
211+ };
212+ };
213+ };
214+
215+ // output/Data.Monoid/index.js
216+ var semigroupRecord2 = /* @__PURE__ */ semigroupRecord();
217+ var monoidUnit = {
218+ mempty: unit,
219+ Semigroup0: function() {
220+ return semigroupUnit;
221+ }
222+ };
223+ var monoidRecordNil = {
224+ memptyRecord: function(v) {
225+ return {};
226+ },
227+ SemigroupRecord0: function() {
228+ return semigroupRecordNil;
229+ }
230+ };
231+ var monoidArray = {
232+ mempty: [],
233+ Semigroup0: function() {
234+ return semigroupArray;
235+ }
236+ };
237+ var memptyRecord = function(dict) {
238+ return dict.memptyRecord;
239+ };
240+ var monoidRecord = function() {
241+ return function(dictMonoidRecord) {
242+ var semigroupRecord1 = semigroupRecord2(dictMonoidRecord.SemigroupRecord0());
243+ return {
244+ mempty: memptyRecord(dictMonoidRecord)($$Proxy.value),
245+ Semigroup0: function() {
246+ return semigroupRecord1;
247+ }
248+ };
249+ };
250+ };
251+ var mempty = function(dict) {
252+ return dict.mempty;
253+ };
254+ var monoidRecordCons = function(dictIsSymbol) {
255+ var reflectSymbol2 = reflectSymbol(dictIsSymbol);
256+ var semigroupRecordCons3 = semigroupRecordCons(dictIsSymbol)();
257+ return function(dictMonoid) {
258+ var mempty12 = mempty(dictMonoid);
259+ var Semigroup0 = dictMonoid.Semigroup0();
260+ return function() {
261+ return function(dictMonoidRecord) {
262+ var memptyRecord1 = memptyRecord(dictMonoidRecord);
263+ var semigroupRecordCons1 = semigroupRecordCons3(dictMonoidRecord.SemigroupRecord0())(Semigroup0);
264+ return {
265+ memptyRecord: function(v) {
266+ var tail = memptyRecord1($$Proxy.value);
267+ var key = reflectSymbol2($$Proxy.value);
268+ var insert = unsafeSet(key);
269+ return insert(mempty12)(tail);
270+ },
271+ SemigroupRecord0: function() {
272+ return semigroupRecordCons1;
273+ }
274+ };
275+ };
276+ };
277+ };
278+ };
279+
280+ // output/Effect/foreign.js
281+ var pureE = function(a) {
282+ return function() {
283+ return a;
284+ };
285+ };
286+ var bindE = function(a) {
287+ return function(f) {
288+ return function() {
289+ return f(a())();
290+ };
291+ };
292+ };
293+
294+ // output/Control.Monad/index.js
295+ var ap = function(dictMonad) {
296+ var bind3 = bind(dictMonad.Bind1());
297+ var pure3 = pure(dictMonad.Applicative0());
298+ return function(f) {
299+ return function(a) {
300+ return bind3(f)(function(f$prime) {
301+ return bind3(a)(function(a$prime) {
302+ return pure3(f$prime(a$prime));
303+ });
304+ });
305+ };
306+ };
307+ };
308+
309+ // output/Effect/index.js
310+ var $runtime_lazy = function(name14, moduleName, init) {
311+ var state2 = 0;
312+ var val;
313+ return function(lineNumber) {
314+ if (state2 === 2) return val;
315+ if (state2 === 1) throw new ReferenceError(name14 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
316+ state2 = 1;
317+ val = init();
318+ state2 = 2;
319+ return val;
320+ };
321+ };
322+ var monadEffect = {
323+ Applicative0: function() {
324+ return applicativeEffect;
325+ },
326+ Bind1: function() {
327+ return bindEffect;
328+ }
329+ };
330+ var bindEffect = {
331+ bind: bindE,
332+ Apply0: function() {
333+ return $lazy_applyEffect(0);
334+ }
335+ };
336+ var applicativeEffect = {
337+ pure: pureE,
338+ Apply0: function() {
339+ return $lazy_applyEffect(0);
340+ }
341+ };
342+ var $lazy_functorEffect = /* @__PURE__ */ $runtime_lazy("functorEffect", "Effect", function() {
343+ return {
344+ map: liftA1(applicativeEffect)
345+ };
346+ });
347+ var $lazy_applyEffect = /* @__PURE__ */ $runtime_lazy("applyEffect", "Effect", function() {
348+ return {
349+ apply: ap(monadEffect),
350+ Functor0: function() {
351+ return $lazy_functorEffect(0);
352+ }
353+ };
354+ });
355+ var functorEffect = /* @__PURE__ */ $lazy_functorEffect(20);
356+
357+ // output/Data.Array/foreign.js
358+ var replicateFill = function(count, value12) {
359+ if (count < 1) {
360+ return [];
361+ }
362+ var result = new Array(count);
363+ return result.fill(value12);
364+ };
365+ var replicatePolyfill = function(count, value12) {
366+ var result = [];
367+ var n = 0;
368+ for (var i = 0; i < count; i++) {
369+ result[n++] = value12;
370+ }
371+ return result;
372+ };
373+ var replicateImpl = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
374+
375+ // output/Data.Bounded/foreign.js
376+ var topChar = String.fromCharCode(65535);
377+ var bottomChar = String.fromCharCode(0);
378+ var topNumber = Number.POSITIVE_INFINITY;
379+ var bottomNumber = Number.NEGATIVE_INFINITY;
380+
381+ // output/Data.Show/foreign.js
382+ var showIntImpl = function(n) {
383+ return n.toString();
384+ };
385+ var showNumberImpl = function(n) {
386+ var str = n.toString();
387+ return isNaN(str + ".0") ? str : str + ".0";
388+ };
389+
390+ // output/Data.Show/index.js
391+ var showNumber = {
392+ show: showNumberImpl
393+ };
394+ var showInt = {
395+ show: showIntImpl
396+ };
397+ var show = function(dict) {
398+ return dict.show;
399+ };
400+
401+ // output/Data.Maybe/index.js
402+ var identity2 = /* @__PURE__ */ identity(categoryFn);
403+ var Nothing = /* @__PURE__ */ function() {
404+ function Nothing2() {
405+ }
406+ ;
407+ Nothing2.value = new Nothing2();
408+ return Nothing2;
409+ }();
410+ var Just = /* @__PURE__ */ function() {
411+ function Just2(value0) {
412+ this.value0 = value0;
413+ }
414+ ;
415+ Just2.create = function(value0) {
416+ return new Just2(value0);
417+ };
418+ return Just2;
419+ }();
420+ var maybe = function(v) {
421+ return function(v1) {
422+ return function(v2) {
423+ if (v2 instanceof Nothing) {
424+ return v;
425+ }
426+ ;
427+ if (v2 instanceof Just) {
428+ return v1(v2.value0);
429+ }
430+ ;
431+ throw new Error("Failed pattern match at Data.Maybe (line 237, column 1 - line 237, column 51): " + [v.constructor.name, v1.constructor.name, v2.constructor.name]);
432+ };
433+ };
434+ };
435+ var fromMaybe = function(a) {
436+ return maybe(a)(identity2);
437+ };
438+
439+ // output/Effect.Ref/foreign.js
440+ var _new = function(val) {
441+ return function() {
442+ return { value: val };
443+ };
444+ };
445+ var read = function(ref) {
446+ return function() {
447+ return ref.value;
448+ };
449+ };
450+ var write = function(val) {
451+ return function(ref) {
452+ return function() {
453+ ref.value = val;
454+ };
455+ };
456+ };
457+
458+ // output/Effect.Ref/index.js
459+ var $$new = _new;
460+
461+ // output/Control.Monad.ST.Internal/foreign.js
462+ var map_ = function(f) {
463+ return function(a) {
464+ return function() {
465+ return f(a());
466+ };
467+ };
468+ };
469+ var pure_ = function(a) {
470+ return function() {
471+ return a;
472+ };
473+ };
474+ var bind_ = function(a) {
475+ return function(f) {
476+ return function() {
477+ return f(a())();
478+ };
479+ };
480+ };
481+
482+ // output/Control.Monad.ST.Internal/index.js
483+ var $runtime_lazy2 = function(name14, moduleName, init) {
484+ var state2 = 0;
485+ var val;
486+ return function(lineNumber) {
487+ if (state2 === 2) return val;
488+ if (state2 === 1) throw new ReferenceError(name14 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
489+ state2 = 1;
490+ val = init();
491+ state2 = 2;
492+ return val;
493+ };
494+ };
495+ var functorST = {
496+ map: map_
497+ };
498+ var monadST = {
499+ Applicative0: function() {
500+ return applicativeST;
501+ },
502+ Bind1: function() {
503+ return bindST;
504+ }
505+ };
506+ var bindST = {
507+ bind: bind_,
508+ Apply0: function() {
509+ return $lazy_applyST(0);
510+ }
511+ };
512+ var applicativeST = {
513+ pure: pure_,
514+ Apply0: function() {
515+ return $lazy_applyST(0);
516+ }
517+ };
518+ var $lazy_applyST = /* @__PURE__ */ $runtime_lazy2("applyST", "Control.Monad.ST.Internal", function() {
519+ return {
520+ apply: ap(monadST),
521+ Functor0: function() {
522+ return functorST;
523+ }
524+ };
525+ });
526+
527+ // output/Data.Foldable/foreign.js
528+ var foldrArray = function(f) {
529+ return function(init) {
530+ return function(xs) {
531+ var acc = init;
532+ var len = xs.length;
533+ for (var i = len - 1; i >= 0; i--) {
534+ acc = f(xs[i])(acc);
535+ }
536+ return acc;
537+ };
538+ };
539+ };
540+ var foldlArray = function(f) {
541+ return function(init) {
542+ return function(xs) {
543+ var acc = init;
544+ var len = xs.length;
545+ for (var i = 0; i < len; i++) {
546+ acc = f(acc)(xs[i]);
547+ }
548+ return acc;
549+ };
550+ };
551+ };
552+
553+ // output/Data.Tuple/index.js
554+ var Tuple = /* @__PURE__ */ function() {
555+ function Tuple2(value0, value1) {
556+ this.value0 = value0;
557+ this.value1 = value1;
558+ }
559+ ;
560+ Tuple2.create = function(value0) {
561+ return function(value1) {
562+ return new Tuple2(value0, value1);
563+ };
564+ };
565+ return Tuple2;
566+ }();
567+
568+ // output/Unsafe.Coerce/foreign.js
569+ var unsafeCoerce2 = function(x) {
570+ return x;
571+ };
572+
573+ // output/Data.Foldable/index.js
574+ var foldr = function(dict) {
575+ return dict.foldr;
576+ };
577+ var foldMapDefaultR = function(dictFoldable) {
578+ var foldr2 = foldr(dictFoldable);
579+ return function(dictMonoid) {
580+ var append3 = append(dictMonoid.Semigroup0());
581+ var mempty5 = mempty(dictMonoid);
582+ return function(f) {
583+ return foldr2(function(x) {
584+ return function(acc) {
585+ return append3(f(x))(acc);
586+ };
587+ })(mempty5);
588+ };
589+ };
590+ };
591+ var foldableArray = {
592+ foldr: foldrArray,
593+ foldl: foldlArray,
594+ foldMap: function(dictMonoid) {
595+ return foldMapDefaultR(foldableArray)(dictMonoid);
596+ }
597+ };
598+ var foldMap = function(dict) {
599+ return dict.foldMap;
600+ };
601+
602+ // output/Data.Function.Uncurried/foreign.js
603+ var runFn2 = function(fn) {
604+ return function(a) {
605+ return function(b) {
606+ return fn(a, b);
607+ };
608+ };
609+ };
610+
611+ // output/Data.Array/index.js
612+ var foldMap1 = /* @__PURE__ */ foldMap(foldableArray);
613+ var append2 = /* @__PURE__ */ append(semigroupArray);
614+ var foldMap2 = function(dictMonoid) {
615+ return foldMap1(dictMonoid);
616+ };
617+ var cons = function(x) {
618+ return function(xs) {
619+ return append2([x])(xs);
620+ };
621+ };
622+
623+ // output/Maquette/foreign.js
624+ var NAMESPACE_W3 = "http://www.w3.org/";
625+ var NAMESPACE_SVG = NAMESPACE_W3 + "2000/svg";
626+ var NAMESPACE_XLINK = NAMESPACE_W3 + "1999/xlink";
627+ var emptyArray = [];
628+ var extend2 = function(base, overrides) {
629+ var result = {};
630+ Object.keys(base).forEach(function(key) {
631+ result[key] = base[key];
632+ });
633+ if (overrides) {
634+ Object.keys(overrides).forEach(function(key) {
635+ result[key] = overrides[key];
636+ });
637+ }
638+ return result;
639+ };
640+ var same = function(vnode1, vnode2) {
641+ if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {
642+ return false;
643+ }
644+ if (vnode1.properties && vnode2.properties) {
645+ if (vnode1.properties.key !== vnode2.properties.key) {
646+ return false;
647+ }
648+ return vnode1.properties.bind === vnode2.properties.bind;
649+ }
650+ return !vnode1.properties && !vnode2.properties;
651+ };
652+ var checkStyleValue = function(styleValue) {
653+ if (typeof styleValue !== "string") {
654+ throw new Error("Style values must be strings");
655+ }
656+ };
657+ var findIndexOfChild = function(children, sameAs, start2) {
658+ if (sameAs.vnodeSelector !== "") {
659+ for (var i = start2; i < children.length; i++) {
660+ if (same(children[i], sameAs)) {
661+ return i;
662+ }
663+ }
664+ }
665+ return -1;
666+ };
667+ var checkDistinguishable = function(childNodes, indexToCheck, parentVNode, operation) {
668+ var childNode = childNodes[indexToCheck];
669+ if (childNode.vnodeSelector === "") {
670+ return;
671+ }
672+ var properties = childNode.properties;
673+ var key = properties ? properties.key === void 0 ? properties.bind : properties.key : void 0;
674+ if (!key) {
675+ for (var i = 0; i < childNodes.length; i++) {
676+ if (i !== indexToCheck) {
677+ var node = childNodes[i];
678+ if (same(node, childNode)) {
679+ throw {
680+ error: new Error(parentVNode.vnodeSelector + " had a " + childNode.vnodeSelector + " child " + (operation === "added" ? operation : "removed") + ", but there is now more than one. You must add unique key properties to make them distinguishable."),
681+ parentNode: parentVNode,
682+ childNode
683+ };
684+ }
685+ }
686+ }
687+ }
688+ };
689+ var nodeAdded = function(vNode) {
690+ if (vNode.properties) {
691+ var enterAnimation = vNode.properties.enterAnimation;
692+ if (enterAnimation) {
693+ enterAnimation(vNode.domNode, vNode.properties);
694+ }
695+ }
696+ };
697+ var removedNodes = [];
698+ var requestedIdleCallback = false;
699+ var visitRemovedNode = function(node) {
700+ (node.children || []).forEach(visitRemovedNode);
701+ if (node.properties && node.properties.afterRemoved) {
702+ node.properties.afterRemoved.apply(node.properties.bind || node.properties, [
703+ node.domNode
704+ ]);
705+ }
706+ };
707+ var processPendingNodeRemovals = function() {
708+ requestedIdleCallback = false;
709+ removedNodes.forEach(visitRemovedNode);
710+ removedNodes.length = 0;
711+ };
712+ var scheduleNodeRemoval = function(vNode) {
713+ removedNodes.push(vNode);
714+ if (!requestedIdleCallback) {
715+ requestedIdleCallback = true;
716+ if (typeof window !== "undefined" && "requestIdleCallback" in window) {
717+ window.requestIdleCallback(processPendingNodeRemovals, { timeout: 16 });
718+ } else {
719+ setTimeout(processPendingNodeRemovals, 16);
720+ }
721+ }
722+ };
723+ var nodeToRemove = function(vNode) {
724+ var domNode = vNode.domNode;
725+ if (vNode.properties) {
726+ var exitAnimation = vNode.properties.exitAnimation;
727+ if (exitAnimation) {
728+ domNode.style.pointerEvents = "none";
729+ var removeDomNode = function() {
730+ if (domNode.parentNode) {
731+ domNode.parentNode.removeChild(domNode);
732+ scheduleNodeRemoval(vNode);
733+ }
734+ };
735+ exitAnimation(domNode, removeDomNode, vNode.properties);
736+ return;
737+ }
738+ }
739+ if (domNode.parentNode) {
740+ domNode.parentNode.removeChild(domNode);
741+ scheduleNodeRemoval(vNode);
742+ }
743+ };
744+ var vnodeOnlyProps = [
745+ "afterCreate",
746+ "afterUpdate",
747+ "afterRemoved",
748+ "enterAnimation",
749+ "exitAnimation",
750+ "updateAnimation"
751+ ];
752+ function filterVNodeOnlyProps(name14) {
753+ return !vnodeOnlyProps.includes(name14);
754+ }
755+ var setProperties = function(domNode, properties, projectionOptions) {
756+ if (!properties) {
757+ return;
758+ }
759+ var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;
760+ var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
761+ var propCount = propNames.length;
762+ for (var i = 0; i < propCount; i++) {
763+ var propName = propNames[i];
764+ var propValue = properties[propName];
765+ if (propName === "className") {
766+ throw new Error('Property "className" is not supported, use "class".');
767+ } else if (propName === "class") {
768+ toggleClasses(domNode, propValue, true);
769+ } else if (propName === "classes") {
770+ var classNames = Object.keys(propValue);
771+ var classNameCount = classNames.length;
772+ for (var j = 0; j < classNameCount; j++) {
773+ var className = classNames[j];
774+ if (propValue[className]) {
775+ domNode.classList.add(className);
776+ }
777+ }
778+ } else if (propName === "styles") {
779+ var styleNames = Object.keys(propValue);
780+ var styleCount = styleNames.length;
781+ for (var j = 0; j < styleCount; j++) {
782+ var styleName = styleNames[j];
783+ var styleValue = propValue[styleName];
784+ if (styleValue) {
785+ checkStyleValue(styleValue);
786+ projectionOptions.styleApplyer(domNode, styleName, styleValue);
787+ }
788+ }
789+ } else if (propName === "on" && propValue) {
790+ for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
791+ var _b = _a[_i], key = _b[0], handler = _b[1];
792+ var listener = typeof handler === "function" ? handler : handler.listener;
793+ if (eventHandlerInterceptor) {
794+ listener = eventHandlerInterceptor(key, listener, domNode, properties);
795+ }
796+ if (listener) {
797+ domNode.addEventListener(key, listener, typeof handler === "function" ? void 0 : handler.options);
798+ }
799+ }
800+ } else if (propName !== "key" && propValue !== null && propValue !== void 0) {
801+ var type = typeof propValue;
802+ if (type === "function") {
803+ if (propName.lastIndexOf("on", 0) === 0) {
804+ if (eventHandlerInterceptor) {
805+ propValue = eventHandlerInterceptor(propName, propValue, domNode, properties);
806+ }
807+ }
808+ domNode[propName] = propValue;
809+ } else if (projectionOptions.namespace === NAMESPACE_SVG) {
810+ if (propName === "href") {
811+ domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
812+ } else {
813+ domNode.setAttribute(propName, propValue);
814+ }
815+ } else if (type === "string" && propName !== "value" && propName !== "innerHTML") {
816+ domNode.setAttribute(propName, propValue);
817+ } else {
818+ domNode[propName] = propValue;
819+ }
820+ }
821+ }
822+ };
823+ var addChildren = function(domNode, children, projectionOptions) {
824+ if (!children) {
825+ return;
826+ }
827+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
828+ var child = children_1[_i];
829+ createDom(child, domNode, void 0, projectionOptions);
830+ }
831+ };
832+ var initPropertiesAndChildren = function(domNode, vnode, projectionOptions) {
833+ addChildren(domNode, vnode.children, projectionOptions);
834+ if (vnode.text) {
835+ domNode.textContent = vnode.text;
836+ }
837+ setProperties(domNode, vnode.properties, projectionOptions);
838+ if (vnode.properties && vnode.properties.afterCreate) {
839+ vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [
840+ domNode,
841+ projectionOptions,
842+ vnode.vnodeSelector,
843+ vnode.properties,
844+ vnode.children
845+ ]);
846+ }
847+ };
848+ var createDom = function(vnode, parentNode, insertBefore, projectionOptions) {
849+ var _a;
850+ var domNode;
851+ var start2 = 0;
852+ var vnodeSelector = vnode.vnodeSelector;
853+ var doc = parentNode.ownerDocument;
854+ if (vnodeSelector === "") {
855+ if (vnode.domNode) {
856+ vnode.domNode.nodeValue = vnode.text;
857+ } else {
858+ domNode = vnode.domNode = doc.createTextNode(vnode.text);
859+ if (insertBefore !== void 0) {
860+ parentNode.insertBefore(domNode, insertBefore);
861+ } else {
862+ parentNode.appendChild(domNode);
863+ }
864+ }
865+ } else {
866+ for (var i = 0; i <= vnodeSelector.length; ++i) {
867+ var c = vnodeSelector.charAt(i);
868+ if (i === vnodeSelector.length || c === "." || c === "#") {
869+ var type = vnodeSelector.charAt(start2 - 1);
870+ var found = vnodeSelector.slice(start2, i);
871+ if (type === ".") {
872+ domNode.classList.add(found);
873+ } else if (type === "#") {
874+ domNode.id = found;
875+ } else {
876+ if (found === "svg") {
877+ projectionOptions = extend2(projectionOptions, {
878+ namespace: NAMESPACE_SVG
879+ });
880+ }
881+ if (projectionOptions.namespace !== void 0) {
882+ domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);
883+ } else {
884+ domNode = vnode.domNode = vnode.domNode || (((_a = vnode.properties) === null || _a === void 0 ? void 0 : _a.is) ? doc.createElement(found, { is: vnode.properties.is }) : doc.createElement(found));
885+ if (found === "input" && vnode.properties && vnode.properties.type !== void 0) {
886+ domNode.setAttribute("type", vnode.properties.type);
887+ }
888+ }
889+ if (insertBefore !== void 0) {
890+ parentNode.insertBefore(domNode, insertBefore);
891+ } else if (domNode.parentNode !== parentNode) {
892+ parentNode.appendChild(domNode);
893+ }
894+ }
895+ start2 = i + 1;
896+ }
897+ }
898+ initPropertiesAndChildren(domNode, vnode, projectionOptions);
899+ }
900+ };
901+ var updateDom;
902+ var toggleClasses = function(domNode, classes, on2) {
903+ if (!classes) {
904+ return;
905+ }
906+ classes.split(" ").forEach(function(classToToggle) {
907+ if (classToToggle) {
908+ domNode.classList.toggle(classToToggle, on2);
909+ }
910+ });
911+ };
912+ var updateProperties = function(domNode, previousProperties, properties, projectionOptions) {
913+ if (!properties) {
914+ return;
915+ }
916+ var propertiesUpdated = false;
917+ var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
918+ var propCount = propNames.length;
919+ for (var i = 0; i < propCount; i++) {
920+ var propName = propNames[i];
921+ var propValue = properties[propName];
922+ var previousValue = previousProperties[propName];
923+ if (propName === "class") {
924+ if (previousValue !== propValue) {
925+ toggleClasses(domNode, previousValue, false);
926+ toggleClasses(domNode, propValue, true);
927+ }
928+ } else if (propName === "classes") {
929+ var classList = domNode.classList;
930+ var classNames = Object.keys(propValue);
931+ var classNameCount = classNames.length;
932+ for (var j = 0; j < classNameCount; j++) {
933+ var className = classNames[j];
934+ var on2 = !!propValue[className];
935+ var previousOn = !!previousValue[className];
936+ if (on2 === previousOn) {
937+ continue;
938+ }
939+ propertiesUpdated = true;
940+ if (on2) {
941+ classList.add(className);
942+ } else {
943+ classList.remove(className);
944+ }
945+ }
946+ } else if (propName === "styles") {
947+ var styleNames = Object.keys(propValue);
948+ var styleCount = styleNames.length;
949+ for (var j = 0; j < styleCount; j++) {
950+ var styleName = styleNames[j];
951+ var newStyleValue = propValue[styleName];
952+ var oldStyleValue = previousValue[styleName];
953+ if (newStyleValue === oldStyleValue) {
954+ continue;
955+ }
956+ propertiesUpdated = true;
957+ if (newStyleValue) {
958+ checkStyleValue(newStyleValue);
959+ projectionOptions.styleApplyer(domNode, styleName, newStyleValue);
960+ } else {
961+ projectionOptions.styleApplyer(domNode, styleName, "");
962+ }
963+ }
964+ } else {
965+ if (!propValue && typeof previousValue === "string") {
966+ propValue = "";
967+ }
968+ if (propName === "value") {
969+ var domValue = domNode[propName];
970+ if (domValue !== propValue && // The 'value' in the DOM tree !== newValue
971+ propValue !== previousValue) {
972+ domNode[propName] = propValue;
973+ }
974+ if (propValue !== previousValue) {
975+ propertiesUpdated = true;
976+ }
977+ } else if (propValue !== previousValue) {
978+ var type = typeof propValue;
979+ if (type !== "function" || !projectionOptions.eventHandlerInterceptor) {
980+ if (projectionOptions.namespace === NAMESPACE_SVG) {
981+ if (propName === "href") {
982+ domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
983+ } else {
984+ domNode.setAttribute(propName, propValue);
985+ }
986+ } else if (type === "string" && propName !== "innerHTML") {
987+ if (propName === "role" && propValue === "") {
988+ domNode.removeAttribute(propName);
989+ } else {
990+ domNode.setAttribute(propName, propValue);
991+ }
992+ } else if (domNode[propName] !== propValue) {
993+ domNode[propName] = propValue;
994+ }
995+ propertiesUpdated = true;
996+ }
997+ }
998+ }
999+ }
1000+ return propertiesUpdated;
1001+ };
1002+ var updateChildren = function(vnode, domNode, oldChildren, newChildren, projectionOptions) {
1003+ if (oldChildren === newChildren) {
1004+ return false;
1005+ }
1006+ oldChildren = oldChildren || emptyArray;
1007+ newChildren = newChildren || emptyArray;
1008+ var oldChildrenLength = oldChildren.length;
1009+ var newChildrenLength = newChildren.length;
1010+ var oldIndex = 0;
1011+ var newIndex = 0;
1012+ var i;
1013+ var textUpdated = false;
1014+ while (newIndex < newChildrenLength) {
1015+ var oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : void 0;
1016+ var newChild = newChildren[newIndex];
1017+ if (oldChild !== void 0 && same(oldChild, newChild)) {
1018+ textUpdated = updateDom(oldChild, newChild, projectionOptions, domNode, oldChildren) || textUpdated;
1019+ oldIndex++;
1020+ } else {
1021+ var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);
1022+ if (findOldIndex >= 0) {
1023+ for (i = oldIndex; i < findOldIndex; i++) {
1024+ nodeToRemove(oldChildren[i]);
1025+ checkDistinguishable(oldChildren, i, vnode, "removed");
1026+ }
1027+ textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions, domNode, oldChildren) || textUpdated;
1028+ oldIndex = findOldIndex + 1;
1029+ } else {
1030+ createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : void 0, projectionOptions);
1031+ nodeAdded(newChild);
1032+ checkDistinguishable(newChildren, newIndex, vnode, "added");
1033+ }
1034+ }
1035+ newIndex++;
1036+ }
1037+ if (oldChildrenLength > oldIndex) {
1038+ for (i = oldIndex; i < oldChildrenLength; i++) {
1039+ nodeToRemove(oldChildren[i]);
1040+ checkDistinguishable(oldChildren, i, vnode, "removed");
1041+ }
1042+ }
1043+ return textUpdated;
1044+ };
1045+ updateDom = function(previous, vnode, projectionOptions, parentNode, oldChildren) {
1046+ var domNode = previous.domNode;
1047+ var textUpdated = false;
1048+ if (previous === vnode) {
1049+ return false;
1050+ }
1051+ var updated = false;
1052+ if (vnode.vnodeSelector === "") {
1053+ if (vnode.text !== previous.text) {
1054+ var newTextNode = domNode.ownerDocument.createTextNode(vnode.text);
1055+ try {
1056+ parentNode.replaceChild(newTextNode, domNode);
1057+ } catch (e) {
1058+ parentNode.replaceChild(newTextNode, parentNode.childNodes[oldChildren.indexOf(previous)]);
1059+ }
1060+ vnode.domNode = newTextNode;
1061+ textUpdated = true;
1062+ return textUpdated;
1063+ }
1064+ vnode.domNode = domNode;
1065+ } else {
1066+ if (vnode.vnodeSelector.lastIndexOf("svg", 0) === 0) {
1067+ projectionOptions = extend2(projectionOptions, {
1068+ namespace: NAMESPACE_SVG
1069+ });
1070+ }
1071+ if (previous.text !== vnode.text) {
1072+ updated = true;
1073+ if (vnode.text === void 0) {
1074+ domNode.removeChild(domNode.firstChild);
1075+ } else {
1076+ domNode.textContent = vnode.text;
1077+ }
1078+ }
1079+ vnode.domNode = domNode;
1080+ updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;
1081+ updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;
1082+ if (vnode.properties && vnode.properties.afterUpdate) {
1083+ vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [
1084+ domNode,
1085+ projectionOptions,
1086+ vnode.vnodeSelector,
1087+ vnode.properties,
1088+ vnode.children
1089+ ]);
1090+ }
1091+ }
1092+ if (updated && vnode.properties && vnode.properties.updateAnimation) {
1093+ vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);
1094+ }
1095+ return textUpdated;
1096+ };
1097+ var createProjection = function(vnode, projectionOptions) {
1098+ return {
1099+ getLastRender: function() {
1100+ return vnode;
1101+ },
1102+ update: function(updatedVnode) {
1103+ if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {
1104+ throw new Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");
1105+ }
1106+ var previousVNode = vnode;
1107+ vnode = updatedVnode;
1108+ updateDom(previousVNode, updatedVnode, projectionOptions, previousVNode.domNode.parentNode, [previousVNode]);
1109+ },
1110+ domNode: vnode.domNode
1111+ };
1112+ };
1113+ var DEFAULT_PROJECTION_OPTIONS = {
1114+ namespace: void 0,
1115+ performanceLogger: function() {
1116+ return void 0;
1117+ },
1118+ eventHandlerInterceptor: void 0,
1119+ styleApplyer: function(domNode, styleName, value12) {
1120+ if (styleName.charAt(0) === "-") {
1121+ domNode.style.setProperty(styleName, value12);
1122+ } else {
1123+ domNode.style[styleName] = value12;
1124+ }
1125+ }
1126+ };
1127+ var applyDefaultProjectionOptions = function(projectorOptions) {
1128+ return extend2(DEFAULT_PROJECTION_OPTIONS, projectorOptions);
1129+ };
1130+ var dom = {
1131+ /**
1132+ * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in
1133+ * its [[Projection.domNode|domNode]] property.
1134+ * This is a low-level method. Users will typically use a [[Projector]] instead.
1135+ * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1136+ * objects may only be rendered once.
1137+ * @param projectionOptions - Options to be used to create and update the projection.
1138+ * @returns The [[Projection]] which also contains the DOM Node that was created.
1139+ */
1140+ create: function(vnode, projectionOptions) {
1141+ projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1142+ createDom(vnode, document.createElement("div"), void 0, projectionOptions);
1143+ return createProjection(vnode, projectionOptions);
1144+ },
1145+ /**
1146+ * Appends a new child node to the DOM which is generated from a [[VNode]].
1147+ * This is a low-level method. Users will typically use a [[Projector]] instead.
1148+ * @param parentNode - The parent node for the new child node.
1149+ * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1150+ * objects may only be rendered once.
1151+ * @param projectionOptions - Options to be used to create and update the [[Projection]].
1152+ * @returns The [[Projection]] that was created.
1153+ */
1154+ append: function(parentNode, vnode, projectionOptions) {
1155+ projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1156+ createDom(vnode, parentNode, void 0, projectionOptions);
1157+ return createProjection(vnode, projectionOptions);
1158+ },
1159+ /**
1160+ * Inserts a new DOM node which is generated from a [[VNode]].
1161+ * This is a low-level method. Users wil typically use a [[Projector]] instead.
1162+ * @param beforeNode - The node that the DOM Node is inserted before.
1163+ * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.
1164+ * NOTE: [[VNode]] objects may only be rendered once.
1165+ * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
1166+ * @returns The [[Projection]] that was created.
1167+ */
1168+ insertBefore: function(beforeNode, vnode, projectionOptions) {
1169+ projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1170+ createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);
1171+ return createProjection(vnode, projectionOptions);
1172+ },
1173+ /**
1174+ * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.
1175+ * This means that the virtual DOM and the real DOM will have one overlapping element.
1176+ * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.
1177+ * This is a low-level method. Users wil typically use a [[Projector]] instead.
1178+ * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.
1179+ * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects
1180+ * may only be rendered once.
1181+ * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
1182+ * @returns The [[Projection]] that was created.
1183+ */
1184+ merge: function(element, vnode, projectionOptions) {
1185+ projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1186+ vnode.domNode = element;
1187+ initPropertiesAndChildren(element, vnode, projectionOptions);
1188+ return createProjection(vnode, projectionOptions);
1189+ },
1190+ /**
1191+ * Replaces an existing DOM node with a node generated from a [[VNode]].
1192+ * This is a low-level method. Users will typically use a [[Projector]] instead.
1193+ * @param element - The node for the [[VNode]] to replace.
1194+ * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1195+ * objects may only be rendered once.
1196+ * @param projectionOptions - Options to be used to create and update the [[Projection]].
1197+ * @returns The [[Projection]] that was created.
1198+ */
1199+ replace: function(element, vnode, projectionOptions) {
1200+ projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1201+ createDom(vnode, element.parentNode, element, projectionOptions);
1202+ element.parentNode.removeChild(element);
1203+ return createProjection(vnode, projectionOptions);
1204+ }
1205+ };
1206+ var toTextVNode = function(data) {
1207+ return {
1208+ vnodeSelector: "",
1209+ properties: void 0,
1210+ children: void 0,
1211+ text: data.toString(),
1212+ domNode: null
1213+ };
1214+ };
1215+ var appendChildren = function(parentSelector, insertions, main2) {
1216+ for (var i = 0, length_1 = insertions.length; i < length_1; i++) {
1217+ var item = insertions[i];
1218+ if (Array.isArray(item)) {
1219+ appendChildren(parentSelector, item, main2);
1220+ } else {
1221+ if (item !== null && item !== void 0 && item !== false) {
1222+ if (typeof item === "string") {
1223+ item = toTextVNode(item);
1224+ }
1225+ main2.push(item);
1226+ }
1227+ }
1228+ }
1229+ };
1230+ function h(selector, properties, children) {
1231+ if (Array.isArray(properties)) {
1232+ children = properties;
1233+ properties = void 0;
1234+ } else if (properties && (typeof properties === "string" || properties.vnodeSelector) || children && (typeof children === "string" || children.vnodeSelector)) {
1235+ throw new Error("h called with invalid arguments");
1236+ }
1237+ var text6;
1238+ var flattenedChildren;
1239+ if (children && children.length === 1 && typeof children[0] === "string") {
1240+ text6 = children[0];
1241+ } else if (children) {
1242+ flattenedChildren = [];
1243+ appendChildren(selector, children, flattenedChildren);
1244+ if (flattenedChildren.length === 0) {
1245+ flattenedChildren = void 0;
1246+ }
1247+ }
1248+ return {
1249+ vnodeSelector: selector,
1250+ properties,
1251+ children: flattenedChildren,
1252+ text: text6 === "" ? void 0 : text6,
1253+ domNode: null
1254+ };
1255+ }
1256+ var createParentNodePath = function(node, rootNode) {
1257+ var parentNodePath = [];
1258+ while (node && node !== rootNode) {
1259+ parentNodePath.push(node);
1260+ node = node.parentNode;
1261+ }
1262+ return parentNodePath;
1263+ };
1264+ var find2;
1265+ if (Array.prototype.find) {
1266+ find2 = function(items, predicate) {
1267+ return items.find(predicate);
1268+ };
1269+ } else {
1270+ find2 = function(items, predicate) {
1271+ return items.filter(predicate)[0];
1272+ };
1273+ }
1274+ var findVNodeByParentNodePath = function(vnode, parentNodePath) {
1275+ var result = vnode;
1276+ parentNodePath.forEach(function(node) {
1277+ result = result && result.children ? find2(result.children, function(child) {
1278+ return child.domNode === node;
1279+ }) : void 0;
1280+ });
1281+ return result;
1282+ };
1283+ var createEventHandlerInterceptor = function(projector, getProjection, performanceLogger) {
1284+ return function(propertyName, eventHandler, domNode, properties) {
1285+ return modifiedEventHandler;
1286+ };
1287+ function modifiedEventHandler(evt) {
1288+ var _a, _b;
1289+ performanceLogger("domEvent", evt);
1290+ var projection = getProjection();
1291+ var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
1292+ parentNodePath.reverse();
1293+ var matchingVNode = findVNodeByParentNodePath(projection.getLastRender(), parentNodePath);
1294+ projector.scheduleRender();
1295+ var result;
1296+ if (matchingVNode) {
1297+ var listener = (_b = (_a = matchingVNode.properties["on" + evt.type]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
1298+ result = listener.apply(matchingVNode.properties.bind || this, arguments);
1299+ }
1300+ performanceLogger("domEventProcessed", evt);
1301+ return result;
1302+ }
1303+ };
1304+ var createProjector = function(projectorOptions) {
1305+ var projector;
1306+ var projectionOptions = applyDefaultProjectionOptions(projectorOptions);
1307+ var performanceLogger = projectionOptions.performanceLogger;
1308+ var renderCompleted = true;
1309+ var scheduled;
1310+ var stopped = false;
1311+ var projections = [];
1312+ var renderFunctions = [];
1313+ var addProjection = function(domFunction, node, renderFunction) {
1314+ var projection;
1315+ var getProjection = function() {
1316+ return projection;
1317+ };
1318+ projectionOptions.eventHandlerInterceptor = createEventHandlerInterceptor(projector, getProjection, performanceLogger);
1319+ projection = domFunction(node, renderFunction(), projectionOptions);
1320+ projections.push(projection);
1321+ renderFunctions.push(renderFunction);
1322+ };
1323+ var doRender = function() {
1324+ scheduled = void 0;
1325+ if (!renderCompleted) {
1326+ return;
1327+ }
1328+ renderCompleted = false;
1329+ performanceLogger("renderStart", void 0);
1330+ for (var i = 0; i < projections.length; i++) {
1331+ var updatedVnode = renderFunctions[i]();
1332+ performanceLogger("rendered", void 0);
1333+ projections[i].update(updatedVnode);
1334+ performanceLogger("patched", void 0);
1335+ }
1336+ performanceLogger("renderDone", void 0);
1337+ renderCompleted = true;
1338+ };
1339+ projector = {
1340+ renderNow: doRender,
1341+ scheduleRender: function() {
1342+ if (!scheduled && !stopped) {
1343+ scheduled = requestAnimationFrame(doRender);
1344+ }
1345+ },
1346+ stop: function() {
1347+ if (scheduled) {
1348+ cancelAnimationFrame(scheduled);
1349+ scheduled = void 0;
1350+ }
1351+ stopped = true;
1352+ },
1353+ resume: function() {
1354+ stopped = false;
1355+ renderCompleted = true;
1356+ projector.scheduleRender();
1357+ },
1358+ append: function(parentNode, renderFunction) {
1359+ addProjection(dom.append, parentNode, renderFunction);
1360+ },
1361+ insertBefore: function(beforeNode, renderFunction) {
1362+ addProjection(dom.insertBefore, beforeNode, renderFunction);
1363+ },
1364+ merge: function(domNode, renderFunction) {
1365+ addProjection(dom.merge, domNode, renderFunction);
1366+ },
1367+ replace: function(domNode, renderFunction) {
1368+ addProjection(dom.replace, domNode, renderFunction);
1369+ },
1370+ detach: function(renderFunction) {
1371+ for (var i = 0; i < renderFunctions.length; i++) {
1372+ if (renderFunctions[i] === renderFunction) {
1373+ renderFunctions.splice(i, 1);
1374+ return projections.splice(i, 1)[0];
1375+ }
1376+ }
1377+ throw new Error("renderFunction was not found");
1378+ }
1379+ };
1380+ return projector;
1381+ };
1382+ function _h(selector) {
1383+ return function(properties) {
1384+ return function(children) {
1385+ return h(selector, properties, children);
1386+ };
1387+ };
1388+ }
1389+ function replace(projector) {
1390+ return function(el) {
1391+ return function(render3) {
1392+ return function() {
1393+ projector.replace(el, render3);
1394+ };
1395+ };
1396+ };
1397+ }
1398+
1399+ // output/Maquette/index.js
1400+ var string = unsafeCoerce2;
1401+ var h2 = _h;
1402+
1403+ // output/Foreign.Object/foreign.js
1404+ function _copyST(m) {
1405+ return function() {
1406+ var r = {};
1407+ for (var k in m) {
1408+ if (hasOwnProperty.call(m, k)) {
1409+ r[k] = m[k];
1410+ }
1411+ }
1412+ return r;
1413+ };
1414+ }
1415+ var empty2 = {};
1416+ function runST(f) {
1417+ return f();
1418+ }
1419+ function _foldM(bind3) {
1420+ return function(f) {
1421+ return function(mz) {
1422+ return function(m) {
1423+ var acc = mz;
1424+ function g(k2) {
1425+ return function(z) {
1426+ return f(z)(k2)(m[k2]);
1427+ };
1428+ }
1429+ for (var k in m) {
1430+ if (hasOwnProperty.call(m, k)) {
1431+ acc = bind3(acc)(g(k));
1432+ }
1433+ }
1434+ return acc;
1435+ };
1436+ };
1437+ };
1438+ }
1439+ function toArrayWithKey(f) {
1440+ return function(m) {
1441+ var r = [];
1442+ for (var k in m) {
1443+ if (hasOwnProperty.call(m, k)) {
1444+ r.push(f(k)(m[k]));
1445+ }
1446+ }
1447+ return r;
1448+ };
1449+ }
1450+ var keys = Object.keys || toArrayWithKey(function(k) {
1451+ return function() {
1452+ return k;
1453+ };
1454+ });
1455+
1456+ // output/Foreign.Object.ST/foreign.js
1457+ var newImpl = function() {
1458+ return {};
1459+ };
1460+ function poke2(k) {
1461+ return function(v) {
1462+ return function(m) {
1463+ return function() {
1464+ m[k] = v;
1465+ return m;
1466+ };
1467+ };
1468+ };
1469+ }
1470+
1471+ // output/Foreign.Object/index.js
1472+ var bindFlipped2 = /* @__PURE__ */ bindFlipped(bindST);
1473+ var thawST = _copyST;
1474+ var singleton2 = function(k) {
1475+ return function(v) {
1476+ return runST(bindFlipped2(poke2(k)(v))(newImpl));
1477+ };
1478+ };
1479+ var mutate = function(f) {
1480+ return function(m) {
1481+ return runST(function __do() {
1482+ var s = thawST(m)();
1483+ f(s)();
1484+ return s;
1485+ });
1486+ };
1487+ };
1488+ var foldM = function(dictMonad) {
1489+ var bind1 = bind(dictMonad.Bind1());
1490+ var pure1 = pure(dictMonad.Applicative0());
1491+ return function(f) {
1492+ return function(z) {
1493+ return _foldM(bind1)(f)(pure1(z));
1494+ };
1495+ };
1496+ };
1497+ var foldM1 = /* @__PURE__ */ foldM(monadST);
1498+ var union = function(m) {
1499+ return mutate(function(s) {
1500+ return foldM1(function(s$prime) {
1501+ return function(k) {
1502+ return function(v) {
1503+ return poke2(k)(v)(s$prime);
1504+ };
1505+ };
1506+ })(s)(m);
1507+ });
1508+ };
1509+
1510+ // output/Record.Unsafe.Union/foreign.js
1511+ function unsafeUnionFn(r1, r2) {
1512+ var copy = {};
1513+ for (var k1 in r2) {
1514+ if ({}.hasOwnProperty.call(r2, k1)) {
1515+ copy[k1] = r2[k1];
1516+ }
1517+ }
1518+ for (var k2 in r1) {
1519+ if ({}.hasOwnProperty.call(r1, k2)) {
1520+ copy[k2] = r1[k2];
1521+ }
1522+ }
1523+ return copy;
1524+ }
1525+
1526+ // output/Record.Unsafe.Union/index.js
1527+ var unsafeUnion = /* @__PURE__ */ runFn2(unsafeUnionFn);
1528+
1529+ // output/Plum.View/index.js
1530+ var semigroupRecord3 = /* @__PURE__ */ semigroupRecord();
1531+ var childrenIsSymbol = {
1532+ reflectSymbol: function() {
1533+ return "children";
1534+ }
1535+ };
1536+ var meatIsSymbol = {
1537+ reflectSymbol: function() {
1538+ return "meat";
1539+ }
1540+ };
1541+ var nervesIsSymbol = {
1542+ reflectSymbol: function() {
1543+ return "nerves";
1544+ }
1545+ };
1546+ var semigroupRecordCons2 = /* @__PURE__ */ semigroupRecordCons(childrenIsSymbol)()(/* @__PURE__ */ semigroupRecordCons(meatIsSymbol)()(/* @__PURE__ */ semigroupRecordCons(nervesIsSymbol)()(semigroupRecordNil)(semigroupArray))(semigroupArray));
1547+ var show2 = /* @__PURE__ */ show(showInt);
1548+ var show1 = /* @__PURE__ */ show(showNumber);
1549+ var monoidRecord2 = /* @__PURE__ */ monoidRecord();
1550+ var monoidRecordCons2 = /* @__PURE__ */ monoidRecordCons(childrenIsSymbol);
1551+ var monoidRecordCons1 = /* @__PURE__ */ monoidRecordCons(meatIsSymbol)(monoidArray)()(/* @__PURE__ */ monoidRecordCons(nervesIsSymbol)(monoidArray)()(monoidRecordNil));
1552+ var mempty2 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidRecord2(/* @__PURE__ */ monoidRecordCons2(monoidArray)()(monoidRecordCons1)));
1553+ var append1 = /* @__PURE__ */ append(semigroupArray);
1554+ var mempty1 = /* @__PURE__ */ mempty(monoidArray);
1555+ var map2 = /* @__PURE__ */ map(functorArray);
1556+ var Px = /* @__PURE__ */ function() {
1557+ function Px2(value0) {
1558+ this.value0 = value0;
1559+ }
1560+ ;
1561+ Px2.create = function(value0) {
1562+ return new Px2(value0);
1563+ };
1564+ return Px2;
1565+ }();
1566+ var Fill = /* @__PURE__ */ function() {
1567+ function Fill2() {
1568+ }
1569+ ;
1570+ Fill2.value = new Fill2();
1571+ return Fill2;
1572+ }();
1573+ var Fit = /* @__PURE__ */ function() {
1574+ function Fit2() {
1575+ }
1576+ ;
1577+ Fit2.value = new Fit2();
1578+ return Fit2;
1579+ }();
1580+ var Max2 = /* @__PURE__ */ function() {
1581+ function Max3(value0, value1) {
1582+ this.value0 = value0;
1583+ this.value1 = value1;
1584+ }
1585+ ;
1586+ Max3.create = function(value0) {
1587+ return function(value1) {
1588+ return new Max3(value0, value1);
1589+ };
1590+ };
1591+ return Max3;
1592+ }();
1593+ var Min2 = /* @__PURE__ */ function() {
1594+ function Min3(value0, value1) {
1595+ this.value0 = value0;
1596+ this.value1 = value1;
1597+ }
1598+ ;
1599+ Min3.create = function(value0) {
1600+ return function(value1) {
1601+ return new Min3(value0, value1);
1602+ };
1603+ };
1604+ return Min3;
1605+ }();
1606+ var X = /* @__PURE__ */ function() {
1607+ function X2() {
1608+ }
1609+ ;
1610+ X2.value = new X2();
1611+ return X2;
1612+ }();
1613+ var Y = /* @__PURE__ */ function() {
1614+ function Y2() {
1615+ }
1616+ ;
1617+ Y2.value = new Y2();
1618+ return Y2;
1619+ }();
1620+ var Grid = /* @__PURE__ */ function() {
1621+ function Grid2() {
1622+ }
1623+ ;
1624+ Grid2.value = new Grid2();
1625+ return Grid2;
1626+ }();
1627+ var Flexbox = /* @__PURE__ */ function() {
1628+ function Flexbox2(value0) {
1629+ this.value0 = value0;
1630+ }
1631+ ;
1632+ Flexbox2.create = function(value0) {
1633+ return new Flexbox2(value0);
1634+ };
1635+ return Flexbox2;
1636+ }();
1637+ var Generic = /* @__PURE__ */ function() {
1638+ function Generic2() {
1639+ }
1640+ ;
1641+ Generic2.value = new Generic2();
1642+ return Generic2;
1643+ }();
1644+ var Span = /* @__PURE__ */ function() {
1645+ function Span2() {
1646+ }
1647+ ;
1648+ Span2.value = new Span2();
1649+ return Span2;
1650+ }();
1651+ var Start = /* @__PURE__ */ function() {
1652+ function Start2() {
1653+ }
1654+ ;
1655+ Start2.value = new Start2();
1656+ return Start2;
1657+ }();
1658+ var Center = /* @__PURE__ */ function() {
1659+ function Center2() {
1660+ }
1661+ ;
1662+ Center2.value = new Center2();
1663+ return Center2;
1664+ }();
1665+ var End = /* @__PURE__ */ function() {
1666+ function End2() {
1667+ }
1668+ ;
1669+ End2.value = new End2();
1670+ return End2;
1671+ }();
1672+ var Spacing = /* @__PURE__ */ function() {
1673+ function Spacing2(value0, value1) {
1674+ this.value0 = value0;
1675+ this.value1 = value1;
1676+ }
1677+ ;
1678+ Spacing2.create = function(value0) {
1679+ return function(value1) {
1680+ return new Spacing2(value0, value1);
1681+ };
1682+ };
1683+ return Spacing2;
1684+ }();
1685+ var Explain = /* @__PURE__ */ function() {
1686+ function Explain2() {
1687+ }
1688+ ;
1689+ Explain2.value = new Explain2();
1690+ return Explain2;
1691+ }();
1692+ var Align = /* @__PURE__ */ function() {
1693+ function Align2(value0, value1) {
1694+ this.value0 = value0;
1695+ this.value1 = value1;
1696+ }
1697+ ;
1698+ Align2.create = function(value0) {
1699+ return function(value1) {
1700+ return new Align2(value0, value1);
1701+ };
1702+ };
1703+ return Align2;
1704+ }();
1705+ var Width = /* @__PURE__ */ function() {
1706+ function Width2(value0) {
1707+ this.value0 = value0;
1708+ }
1709+ ;
1710+ Width2.create = function(value0) {
1711+ return new Width2(value0);
1712+ };
1713+ return Width2;
1714+ }();
1715+ var Height = /* @__PURE__ */ function() {
1716+ function Height2(value0) {
1717+ this.value0 = value0;
1718+ }
1719+ ;
1720+ Height2.create = function(value0) {
1721+ return new Height2(value0);
1722+ };
1723+ return Height2;
1724+ }();
1725+ var Wrapped = /* @__PURE__ */ function() {
1726+ function Wrapped2() {
1727+ }
1728+ ;
1729+ Wrapped2.value = new Wrapped2();
1730+ return Wrapped2;
1731+ }();
1732+ var BackgroundColor = /* @__PURE__ */ function() {
1733+ function BackgroundColor2(value0) {
1734+ this.value0 = value0;
1735+ }
1736+ ;
1737+ BackgroundColor2.create = function(value0) {
1738+ return new BackgroundColor2(value0);
1739+ };
1740+ return BackgroundColor2;
1741+ }();
1742+ var Padding = /* @__PURE__ */ function() {
1743+ function Padding2(value0) {
1744+ this.value0 = value0;
1745+ }
1746+ ;
1747+ Padding2.create = function(value0) {
1748+ return new Padding2(value0);
1749+ };
1750+ return Padding2;
1751+ }();
1752+ var Spread = /* @__PURE__ */ function() {
1753+ function Spread2() {
1754+ }
1755+ ;
1756+ Spread2.value = new Spread2();
1757+ return Spread2;
1758+ }();
1759+ var Opacity = /* @__PURE__ */ function() {
1760+ function Opacity2(value0) {
1761+ this.value0 = value0;
1762+ }
1763+ ;
1764+ Opacity2.create = function(value0) {
1765+ return new Opacity2(value0);
1766+ };
1767+ return Opacity2;
1768+ }();
1769+ var Pointer = /* @__PURE__ */ function() {
1770+ function Pointer2() {
1771+ }
1772+ ;
1773+ Pointer2.value = new Pointer2();
1774+ return Pointer2;
1775+ }();
1776+ var Move = /* @__PURE__ */ function() {
1777+ function Move2(value0) {
1778+ this.value0 = value0;
1779+ }
1780+ ;
1781+ Move2.create = function(value0) {
1782+ return new Move2(value0);
1783+ };
1784+ return Move2;
1785+ }();
1786+ var Clip = /* @__PURE__ */ function() {
1787+ function Clip2(value0) {
1788+ this.value0 = value0;
1789+ }
1790+ ;
1791+ Clip2.create = function(value0) {
1792+ return new Clip2(value0);
1793+ };
1794+ return Clip2;
1795+ }();
1796+ var UI = /* @__PURE__ */ function() {
1797+ function UI2(value0, value1) {
1798+ this.value0 = value0;
1799+ this.value1 = value1;
1800+ }
1801+ ;
1802+ UI2.create = function(value0) {
1803+ return function(value1) {
1804+ return new UI2(value0, value1);
1805+ };
1806+ };
1807+ return UI2;
1808+ }();
1809+ var Column = /* @__PURE__ */ function() {
1810+ function Column2(value0) {
1811+ this.value0 = value0;
1812+ }
1813+ ;
1814+ Column2.create = function(value0) {
1815+ return new Column2(value0);
1816+ };
1817+ return Column2;
1818+ }();
1819+ var Row = /* @__PURE__ */ function() {
1820+ function Row2(value0) {
1821+ this.value0 = value0;
1822+ }
1823+ ;
1824+ Row2.create = function(value0) {
1825+ return new Row2(value0);
1826+ };
1827+ return Row2;
1828+ }();
1829+ var Stack = /* @__PURE__ */ function() {
1830+ function Stack2(value0) {
1831+ this.value0 = value0;
1832+ }
1833+ ;
1834+ Stack2.create = function(value0) {
1835+ return new Stack2(value0);
1836+ };
1837+ return Stack2;
1838+ }();
1839+ var Wrapper = /* @__PURE__ */ function() {
1840+ function Wrapper2(value0) {
1841+ this.value0 = value0;
1842+ }
1843+ ;
1844+ Wrapper2.create = function(value0) {
1845+ return new Wrapper2(value0);
1846+ };
1847+ return Wrapper2;
1848+ }();
1849+ var Text = /* @__PURE__ */ function() {
1850+ function Text2(value0) {
1851+ this.value0 = value0;
1852+ }
1853+ ;
1854+ Text2.create = function(value0) {
1855+ return new Text2(value0);
1856+ };
1857+ return Text2;
1858+ }();
1859+ var Link = /* @__PURE__ */ function() {
1860+ function Link2(value0, value1, value22) {
1861+ this.value0 = value0;
1862+ this.value1 = value1;
1863+ this.value2 = value22;
1864+ }
1865+ ;
1866+ Link2.create = function(value0) {
1867+ return function(value1) {
1868+ return function(value22) {
1869+ return new Link2(value0, value1, value22);
1870+ };
1871+ };
1872+ };
1873+ return Link2;
1874+ }();
1875+ var Download = /* @__PURE__ */ function() {
1876+ function Download2(value0, value1, value22) {
1877+ this.value0 = value0;
1878+ this.value1 = value1;
1879+ this.value2 = value22;
1880+ }
1881+ ;
1882+ Download2.create = function(value0) {
1883+ return function(value1) {
1884+ return function(value22) {
1885+ return new Download2(value0, value1, value22);
1886+ };
1887+ };
1888+ };
1889+ return Download2;
1890+ }();
1891+ var Image2 = /* @__PURE__ */ function() {
1892+ function Image3(value0, value1) {
1893+ this.value0 = value0;
1894+ this.value1 = value1;
1895+ }
1896+ ;
1897+ Image3.create = function(value0) {
1898+ return function(value1) {
1899+ return new Image3(value0, value1);
1900+ };
1901+ };
1902+ return Image3;
1903+ }();
1904+ var None = /* @__PURE__ */ function() {
1905+ function None3() {
1906+ }
1907+ ;
1908+ None3.value = new None3();
1909+ return None3;
1910+ }();
1911+ var semigroupUIWith = function(dictSemigroup) {
1912+ var append3 = append(semigroupRecord3(semigroupRecordCons2(dictSemigroup)));
1913+ return function(dictSemigroup1) {
1914+ var append4 = append(dictSemigroup1);
1915+ return {
1916+ append: function(v) {
1917+ return function(v1) {
1918+ return new UI(append3(v.value0)(v1.value0), append4(v.value1)(v1.value1));
1919+ };
1920+ }
1921+ };
1922+ };
1923+ };
1924+ var semigroupSkin = {
1925+ append: function(v) {
1926+ return function(v1) {
1927+ return union(v)(v1);
1928+ };
1929+ }
1930+ };
1931+ var append22 = /* @__PURE__ */ append(semigroupSkin);
1932+ var semigroupMutation = {
1933+ append: function(v) {
1934+ return function(v1) {
1935+ return {
1936+ extraSkin: append22(v.extraSkin)(v1.extraSkin)
1937+ };
1938+ };
1939+ }
1940+ };
1941+ var renderableColor = {
1942+ render: function(v) {
1943+ return "rgba(" + (show2(v.r) + ("," + (show2(v.g) + ("," + (show2(v.b) + ("," + (show1(v.a) + ")")))))));
1944+ }
1945+ };
1946+ var monoidUIWith = function(dictMonoid) {
1947+ var mempty42 = mempty(monoidRecord2(monoidRecordCons2(dictMonoid)()(monoidRecordCons1)));
1948+ var semigroupUIWith1 = semigroupUIWith(dictMonoid.Semigroup0());
1949+ return function(dictMonoid1) {
1950+ var semigroupUIWith2 = semigroupUIWith1(dictMonoid1.Semigroup0());
1951+ return {
1952+ mempty: new UI(mempty42, mempty(dictMonoid1)),
1953+ Semigroup0: function() {
1954+ return semigroupUIWith2;
1955+ }
1956+ };
1957+ };
1958+ };
1959+ var monoidSkin = {
1960+ mempty: empty2,
1961+ Semigroup0: function() {
1962+ return semigroupSkin;
1963+ }
1964+ };
1965+ var mempty22 = /* @__PURE__ */ mempty(monoidSkin);
1966+ var foldMap3 = /* @__PURE__ */ foldMap2(monoidSkin);
1967+ var monoidMutation = {
1968+ mempty: {
1969+ extraSkin: mempty22
1970+ },
1971+ Semigroup0: function() {
1972+ return semigroupMutation;
1973+ }
1974+ };
1975+ var mempty3 = /* @__PURE__ */ mempty(monoidMutation);
1976+ var functorUIWith = {
1977+ map: function(f) {
1978+ return function(v) {
1979+ return new UI(v.value0, f(v.value1));
1980+ };
1981+ }
1982+ };
1983+ var applyUIWith = function(dictMonoid) {
1984+ var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
1985+ return {
1986+ apply: function(v) {
1987+ return function(v1) {
1988+ return new UI(append3(v.value0)(v1.value0), v.value1(v1.value1));
1989+ };
1990+ },
1991+ Functor0: function() {
1992+ return functorUIWith;
1993+ }
1994+ };
1995+ };
1996+ var bindUIWith = function(dictMonoid) {
1997+ var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
1998+ var applyUIWith1 = applyUIWith(dictMonoid);
1999+ return {
2000+ bind: function(v) {
2001+ return function(f) {
2002+ var v1 = f(v.value1);
2003+ return new UI(append3(v.value0)(v1.value0), v1.value1);
2004+ };
2005+ },
2006+ Apply0: function() {
2007+ return applyUIWith1;
2008+ }
2009+ };
2010+ };
2011+ var text = function(s) {
2012+ return function(v) {
2013+ return new UI({
2014+ nerves: mempty2.nerves,
2015+ meat: mempty2.meat,
2016+ children: [{
2017+ meat: v.value0.meat,
2018+ nerves: v.value0.nerves,
2019+ bones: new Text(s)
2020+ }]
2021+ }, v.value1);
2022+ };
2023+ };
2024+ var sk = function(key) {
2025+ return function(val) {
2026+ return singleton2(key)(val);
2027+ };
2028+ };
2029+ var render = function(dict) {
2030+ return dict.render;
2031+ };
2032+ var render1 = /* @__PURE__ */ render(renderableColor);
2033+ var renderableLength = {
2034+ render: function(v) {
2035+ if (v instanceof Px) {
2036+ return show2(v.value0) + "px";
2037+ }
2038+ ;
2039+ if (v instanceof Fit) {
2040+ return "fit-content";
2041+ }
2042+ ;
2043+ if (v instanceof Fill) {
2044+ return "100%";
2045+ }
2046+ ;
2047+ if (v instanceof Max2) {
2048+ return "max(" + (show2(v.value0) + ("px," + (render(renderableLength)(v.value1) + ")")));
2049+ }
2050+ ;
2051+ if (v instanceof Min2) {
2052+ return "min(" + (show2(v.value0) + ("px," + (render(renderableLength)(v.value1) + ")")));
2053+ }
2054+ ;
2055+ throw new Error("Failed pattern match at Plum.View (line 258, column 12 - line 263, column 62): " + [v.constructor.name]);
2056+ }
2057+ };
2058+ var render2 = /* @__PURE__ */ render(renderableLength);
2059+ var skin = function(ctx) {
2060+ return function(v) {
2061+ if (v instanceof Spacing) {
2062+ return sk("gap")(show2(v.value0) + ("px " + (show2(v.value1) + "px")));
2063+ }
2064+ ;
2065+ if (v instanceof Explain) {
2066+ return sk("border")("dashed magenta");
2067+ }
2068+ ;
2069+ if (v instanceof Align) {
2070+ if (ctx instanceof Generic) {
2071+ return mempty22;
2072+ }
2073+ ;
2074+ if (ctx instanceof Span) {
2075+ return mempty22;
2076+ }
2077+ ;
2078+ if (ctx instanceof Grid) {
2079+ return sk(function() {
2080+ if (v.value0 instanceof X) {
2081+ return "justify-items";
2082+ }
2083+ ;
2084+ if (v.value0 instanceof Y) {
2085+ return "align-items";
2086+ }
2087+ ;
2088+ throw new Error("Failed pattern match at Plum.View (line 215, column 9 - line 217, column 29): " + [v.value0.constructor.name]);
2089+ }())(function() {
2090+ if (v.value1 instanceof Start) {
2091+ return "start";
2092+ }
2093+ ;
2094+ if (v.value1 instanceof Center) {
2095+ return "center";
2096+ }
2097+ ;
2098+ if (v.value1 instanceof End) {
2099+ return "end";
2100+ }
2101+ ;
2102+ throw new Error("Failed pattern match at Plum.View (line 219, column 9 - line 222, column 23): " + [v.value1.constructor.name]);
2103+ }());
2104+ }
2105+ ;
2106+ if (ctx instanceof Flexbox) {
2107+ return sk(function() {
2108+ var v1 = new Tuple(ctx.value0, v.value0);
2109+ if (v1.value0 instanceof X && v1.value1 instanceof X) {
2110+ return "justify-content";
2111+ }
2112+ ;
2113+ if (v1.value0 instanceof X && v1.value1 instanceof Y) {
2114+ return "align-items";
2115+ }
2116+ ;
2117+ if (v1.value0 instanceof Y && v1.value1 instanceof X) {
2118+ return "align-items";
2119+ }
2120+ ;
2121+ if (v1.value0 instanceof Y && v1.value1 instanceof Y) {
2122+ return "justify-content";
2123+ }
2124+ ;
2125+ throw new Error("Failed pattern match at Plum.View (line 226, column 9 - line 230, column 38): " + [v1.constructor.name]);
2126+ }())(function() {
2127+ if (v.value1 instanceof Start) {
2128+ return "flex-start";
2129+ }
2130+ ;
2131+ if (v.value1 instanceof Center) {
2132+ return "center";
2133+ }
2134+ ;
2135+ if (v.value1 instanceof End) {
2136+ return "flex-end";
2137+ }
2138+ ;
2139+ throw new Error("Failed pattern match at Plum.View (line 232, column 9 - line 235, column 28): " + [v.value1.constructor.name]);
2140+ }());
2141+ }
2142+ ;
2143+ throw new Error("Failed pattern match at Plum.View (line 211, column 26 - line 236, column 8): " + [ctx.constructor.name]);
2144+ }
2145+ ;
2146+ if (v instanceof Width) {
2147+ return sk("width")(render2(v.value0));
2148+ }
2149+ ;
2150+ if (v instanceof Height) {
2151+ return sk("height")(render2(v.value0));
2152+ }
2153+ ;
2154+ if (v instanceof Wrapped) {
2155+ if (ctx instanceof Flexbox) {
2156+ return sk("flex-wrap")("wrap");
2157+ }
2158+ ;
2159+ return mempty22;
2160+ }
2161+ ;
2162+ if (v instanceof BackgroundColor) {
2163+ return sk("background-color")(render1(v.value0));
2164+ }
2165+ ;
2166+ if (v instanceof Padding) {
2167+ return sk("padding")(show2(v.value0.top) + ("px " + (show2(v.value0.right) + ("px " + (show2(v.value0.bottom) + ("px " + (show2(v.value0.left) + "px")))))));
2168+ }
2169+ ;
2170+ if (v instanceof Spread) {
2171+ if (ctx instanceof Flexbox) {
2172+ return sk("justify-content")("space-between");
2173+ }
2174+ ;
2175+ return mempty22;
2176+ }
2177+ ;
2178+ if (v instanceof Opacity) {
2179+ return sk("opacity")(show1(v.value0));
2180+ }
2181+ ;
2182+ if (v instanceof Pointer) {
2183+ return sk("cursor")("pointer");
2184+ }
2185+ ;
2186+ if (v instanceof Move) {
2187+ return sk("transform")("translate(" + (show2(v.value0.x) + ("px, " + (show2(v.value0.y) + ")"))));
2188+ }
2189+ ;
2190+ if (v instanceof Clip && v.value0 instanceof X) {
2191+ return sk("overflow-x")("hidden");
2192+ }
2193+ ;
2194+ if (v instanceof Clip && v.value0 instanceof Y) {
2195+ return sk("overflow-y")("hidden");
2196+ }
2197+ ;
2198+ throw new Error("Failed pattern match at Plum.View (line 208, column 12 - line 252, column 37): " + [v.constructor.name]);
2199+ };
2200+ };
2201+ var hWith = function(elem2) {
2202+ return function(props) {
2203+ return function(v) {
2204+ return function(children) {
2205+ return h2(elem2)(unsafeUnion(props)({
2206+ styles: v
2207+ }))(children);
2208+ };
2209+ };
2210+ };
2211+ };
2212+ var h3 = function(elem2) {
2213+ return function(v) {
2214+ return function(children) {
2215+ return h2(elem2)({
2216+ styles: v
2217+ })(children);
2218+ };
2219+ };
2220+ };
2221+ var growSkin = function(fire) {
2222+ return function(v) {
2223+ return function(v1) {
2224+ var widthFill = [new Width(Fill.value), new Height(Fill.value)];
2225+ var alignCenter = [new Align(X.value, Center.value), new Align(Y.value, Center.value)];
2226+ var skn = function(ctx) {
2227+ return append22(foldMap3(skin(ctx))(append1(v1.meat)(append1(function() {
2228+ if (ctx instanceof Span) {
2229+ return mempty1;
2230+ }
2231+ ;
2232+ if (ctx instanceof Grid) {
2233+ return widthFill;
2234+ }
2235+ ;
2236+ if (ctx instanceof Flexbox) {
2237+ return widthFill;
2238+ }
2239+ ;
2240+ if (ctx instanceof Generic) {
2241+ return widthFill;
2242+ }
2243+ ;
2244+ throw new Error("Failed pattern match at Plum.View (line 310, column 16 - line 314, column 35): " + [ctx.constructor.name]);
2245+ }())(function() {
2246+ if (ctx instanceof Grid) {
2247+ return alignCenter;
2248+ }
2249+ ;
2250+ if (ctx instanceof Flexbox) {
2251+ return alignCenter;
2252+ }
2253+ ;
2254+ if (ctx instanceof Span) {
2255+ return mempty1;
2256+ }
2257+ ;
2258+ if (ctx instanceof Generic) {
2259+ return alignCenter;
2260+ }
2261+ ;
2262+ throw new Error("Failed pattern match at Plum.View (line 315, column 16 - line 319, column 37): " + [ctx.constructor.name]);
2263+ }()))))(v.extraSkin);
2264+ };
2265+ if (v1.bones instanceof Text) {
2266+ return h3("span")(skn(Span.value))([string(v1.bones.value0)]);
2267+ }
2268+ ;
2269+ if (v1.bones instanceof Wrapper) {
2270+ return h3("div")(append22(skn(new Flexbox(X.value)))(append22(sk("display")("flex"))(sk("flex-direction")("row"))))([growSkin(fire)(mempty3)(v1.bones.value0)]);
2271+ }
2272+ ;
2273+ if (v1.bones instanceof Stack) {
2274+ return h3("div")(append22(skn(Grid.value))(sk("display")("grid")))(map2(growSkin(fire)({
2275+ extraSkin: append22(sk("grid-row")("1"))(sk("grid-column")("1"))
2276+ }))(v1.bones.value0));
2277+ }
2278+ ;
2279+ if (v1.bones instanceof Row) {
2280+ return h3("div")(append22(skn(new Flexbox(X.value)))(append22(sk("display")("flex"))(sk("flex-direction")("row"))))(map2(growSkin(fire)(mempty3))(v1.bones.value0));
2281+ }
2282+ ;
2283+ if (v1.bones instanceof Column) {
2284+ return h3("div")(append22(skn(new Flexbox(Y.value)))(append22(sk("display")("flex"))(sk("flex-direction")("column"))))(map2(growSkin(fire)(mempty3))(v1.bones.value0));
2285+ }
2286+ ;
2287+ if (v1.bones instanceof Link) {
2288+ return hWith("a")({
2289+ href: v1.bones.value0,
2290+ rel: "noopener noreferrer",
2291+ target: function() {
2292+ if (v1.bones.value1.newTab) {
2293+ return "_blank";
2294+ }
2295+ ;
2296+ return "_self";
2297+ }()
2298+ })(append22(skn(new Flexbox(X.value)))(append22(sk("display")("flex"))(sk("flex-direction")("row"))))([growSkin(fire)(mempty3)(v1.bones.value2)]);
2299+ }
2300+ ;
2301+ if (v1.bones instanceof Download) {
2302+ return hWith("a")({
2303+ href: v1.bones.value0,
2304+ download: fromMaybe("")(v1.bones.value1.filename)
2305+ })(append22(skn(new Flexbox(X.value)))(append22(sk("display")("flex"))(sk("flex-direction")("row"))))([growSkin(fire)(mempty3)(v1.bones.value2)]);
2306+ }
2307+ ;
2308+ if (v1.bones instanceof Image2) {
2309+ return hWith("img")({
2310+ src: v1.bones.value0,
2311+ alt: v1.bones.value1.description
2312+ })(skn(Generic.value))([]);
2313+ }
2314+ ;
2315+ if (v1.bones instanceof None) {
2316+ return h3("div")(mempty22)([]);
2317+ }
2318+ ;
2319+ throw new Error("Failed pattern match at Plum.View (line 322, column 5 - line 346, column 32): " + [v1.bones.constructor.name]);
2320+ };
2321+ };
2322+ };
2323+ var grow = function(fire) {
2324+ return function(v) {
2325+ return growSkin(fire)(mempty3)(v);
2326+ };
2327+ };
2328+ var column = function(v) {
2329+ return new UI({
2330+ nerves: mempty2.nerves,
2331+ meat: mempty2.meat,
2332+ children: [{
2333+ meat: v.value0.meat,
2334+ nerves: v.value0.nerves,
2335+ bones: new Column(v.value0.children)
2336+ }]
2337+ }, v.value1);
2338+ };
2339+
2340+ // output/Web.DOM.NonElementParentNode/foreign.js
2341+ function _getElementById(id) {
2342+ return function(node) {
2343+ return function() {
2344+ return node.getElementById(id);
2345+ };
2346+ };
2347+ }
2348+
2349+ // output/Data.Nullable/foreign.js
2350+ function nullable(a, r, f) {
2351+ return a == null ? r : f(a);
2352+ }
2353+
2354+ // output/Data.Nullable/index.js
2355+ var toMaybe = function(n) {
2356+ return nullable(n, Nothing.value, Just.create);
2357+ };
2358+
2359+ // output/Web.DOM.NonElementParentNode/index.js
2360+ var map3 = /* @__PURE__ */ map(functorEffect);
2361+ var getElementById = function(eid) {
2362+ var $2 = map3(toMaybe);
2363+ var $3 = _getElementById(eid);
2364+ return function($4) {
2365+ return $2($3($4));
2366+ };
2367+ };
2368+
2369+ // output/Web.HTML/foreign.js
2370+ var windowImpl = function() {
2371+ return window;
2372+ };
2373+
2374+ // output/Web.HTML.HTMLDocument/index.js
2375+ var toNonElementParentNode = unsafeCoerce2;
2376+
2377+ // output/Web.HTML.Window/foreign.js
2378+ function document2(window2) {
2379+ return function() {
2380+ return window2.document;
2381+ };
2382+ }
2383+
2384+ // output/Plum/index.js
2385+ var bind2 = /* @__PURE__ */ bind(bindEffect);
2386+ var map4 = /* @__PURE__ */ map(functorArray);
2387+ var outerStyle = "html,body{height:100%;padding:0;margin:0;}";
2388+ var run3 = function(id) {
2389+ return function(plum2) {
2390+ return function __do() {
2391+ var modelRef = bind2(plum2.init)($$new)();
2392+ var v = bind2(bind2(windowImpl)(document2))(function() {
2393+ var $12 = getElementById(id);
2394+ return function($13) {
2395+ return $12(toNonElementParentNode($13));
2396+ };
2397+ }())();
2398+ if (v instanceof Just) {
2399+ var projector = createProjector();
2400+ return replace(projector)(v.value0)(function __do2() {
2401+ var model = read(modelRef)();
2402+ var el = map4(grow(function(msg) {
2403+ return function __do3() {
2404+ var m = read(modelRef)();
2405+ var m_ = plum2.update(msg)(m)();
2406+ return write(m_)(modelRef)();
2407+ };
2408+ }))(function() {
2409+ var v1 = plum2.view(model);
2410+ return v1.value0.children;
2411+ }());
2412+ return h2("div")({
2413+ styles: {
2414+ height: "100%",
2415+ width: "100%"
2416+ }
2417+ })(cons(h2("style")({})([string(outerStyle)]))(el));
2418+ })();
2419+ }
2420+ ;
2421+ if (v instanceof Nothing) {
2422+ return unit;
2423+ }
2424+ ;
2425+ throw new Error("Failed pattern match at Plum (line 26, column 92 - line 42, column 25): " + [v.constructor.name]);
2426+ };
2427+ };
2428+ };
2429+
2430+ // output/Main/index.js
2431+ var pure2 = /* @__PURE__ */ pure(applicativeEffect);
2432+ var discard2 = /* @__PURE__ */ discard(discardUnit)(/* @__PURE__ */ bindUIWith(monoidArray));
2433+ var mempty4 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidUIWith(monoidUnit)(monoidUnit));
2434+ var plum = {
2435+ init: /* @__PURE__ */ pure2({
2436+ text: "Test"
2437+ }),
2438+ view: function(model) {
2439+ return column(discard2(text("hi")(mempty4))(function() {
2440+ return text("hello")(mempty4);
2441+ }));
2442+ },
2443+ update: function(msg) {
2444+ return function(model) {
2445+ return pure2({
2446+ text: "Button pressed"
2447+ });
2448+ };
2449+ }
2450+ };
2451+ var main = /* @__PURE__ */ run3("plum")(plum);
2452+
2453+ // <stdin>
2454+ main();
2455+})();