. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs");
- if (!previousRef) // When there is no ref on the element, use the new ref directly
- return (0, $63SH6.cloneElement)(element, {
- ref: newRef
- });
- else return (0, $63SH6.cloneElement)(element, {
- ref: (node)=>{
- $f7a4bfd63869de6e$var$setRef(previousRef, node);
- $f7a4bfd63869de6e$var$setRef(newRef, node);
- }
- });
-}
-
-});
-
-
-parcelRegister("3sLVf", function(module, exports) {
-
-$parcel$export(module.exports, "useDragDropManager", () => $2859290093cb30e2$export$49db7e1a057ab0fa);
-
-var $3lJWP = parcelRequire("3lJWP");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $kIdLq = parcelRequire("kIdLq");
-function $2859290093cb30e2$export$49db7e1a057ab0fa() {
- const { dragDropManager: dragDropManager } = (0, $63SH6.useContext)((0, $kIdLq.DndContext));
- (0, $3lJWP.invariant)(dragDropManager != null, "Expected drag drop context");
- return dragDropManager;
-}
-
-});
-
-
-parcelRegister("4FPqt", function(module, exports) {
-
-$parcel$export(module.exports, "useDragSourceMonitor", () => $3672e1e64d6755d6$export$82f95eab323fcd7a);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $2QLHu = parcelRequire("2QLHu");
-
-var $3sLVf = parcelRequire("3sLVf");
-function $3672e1e64d6755d6$export$82f95eab323fcd7a() {
- const manager = (0, $3sLVf.useDragDropManager)();
- return (0, $63SH6.useMemo)(()=>new (0, $2QLHu.DragSourceMonitorImpl)(manager), [
- manager
- ]);
-}
-
-});
-parcelRegister("2QLHu", function(module, exports) {
-
-$parcel$export(module.exports, "DragSourceMonitorImpl", () => $2135706e83be0c29$export$af934094fb48ddf);
-
-var $3lJWP = parcelRequire("3lJWP");
-let $2135706e83be0c29$var$isCallingCanDrag = false;
-let $2135706e83be0c29$var$isCallingIsDragging = false;
-class $2135706e83be0c29$export$af934094fb48ddf {
- receiveHandlerId(sourceId) {
- this.sourceId = sourceId;
- }
- getHandlerId() {
- return this.sourceId;
- }
- canDrag() {
- (0, $3lJWP.invariant)(!$2135706e83be0c29$var$isCallingCanDrag, "You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
- try {
- $2135706e83be0c29$var$isCallingCanDrag = true;
- return this.internalMonitor.canDragSource(this.sourceId);
- } finally{
- $2135706e83be0c29$var$isCallingCanDrag = false;
- }
- }
- isDragging() {
- if (!this.sourceId) return false;
- (0, $3lJWP.invariant)(!$2135706e83be0c29$var$isCallingIsDragging, "You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
- try {
- $2135706e83be0c29$var$isCallingIsDragging = true;
- return this.internalMonitor.isDraggingSource(this.sourceId);
- } finally{
- $2135706e83be0c29$var$isCallingIsDragging = false;
- }
- }
- subscribeToStateChange(listener, options) {
- return this.internalMonitor.subscribeToStateChange(listener, options);
- }
- isDraggingSource(sourceId) {
- return this.internalMonitor.isDraggingSource(sourceId);
- }
- isOverTarget(targetId, options) {
- return this.internalMonitor.isOverTarget(targetId, options);
- }
- getTargetIds() {
- return this.internalMonitor.getTargetIds();
- }
- isSourcePublic() {
- return this.internalMonitor.isSourcePublic();
- }
- getSourceId() {
- return this.internalMonitor.getSourceId();
- }
- subscribeToOffsetChange(listener) {
- return this.internalMonitor.subscribeToOffsetChange(listener);
- }
- canDragSource(sourceId) {
- return this.internalMonitor.canDragSource(sourceId);
- }
- canDropOnTarget(targetId) {
- return this.internalMonitor.canDropOnTarget(targetId);
- }
- getItemType() {
- return this.internalMonitor.getItemType();
- }
- getItem() {
- return this.internalMonitor.getItem();
- }
- getDropResult() {
- return this.internalMonitor.getDropResult();
- }
- didDrop() {
- return this.internalMonitor.didDrop();
- }
- getInitialClientOffset() {
- return this.internalMonitor.getInitialClientOffset();
- }
- getInitialSourceClientOffset() {
- return this.internalMonitor.getInitialSourceClientOffset();
- }
- getSourceClientOffset() {
- return this.internalMonitor.getSourceClientOffset();
- }
- getClientOffset() {
- return this.internalMonitor.getClientOffset();
- }
- getDifferenceFromInitialOffset() {
- return this.internalMonitor.getDifferenceFromInitialOffset();
- }
- constructor(manager){
- this.sourceId = null;
- this.internalMonitor = manager.getMonitor();
- }
-}
-
-});
-
-
-parcelRegister("eeIiw", function(module, exports) {
-
-$parcel$export(module.exports, "useRegisteredDragSource", () => $a5d4bc1758d7dd31$export$1bdd19ff5ac2e03c);
-
-var $eGDnJ = parcelRequire("eGDnJ");
-
-var $3sLVf = parcelRequire("3sLVf");
-
-var $dJ5AF = parcelRequire("dJ5AF");
-
-var $lhS0U = parcelRequire("lhS0U");
-
-var $8vT3E = parcelRequire("8vT3E");
-function $a5d4bc1758d7dd31$export$1bdd19ff5ac2e03c(spec, monitor, connector) {
- const manager = (0, $3sLVf.useDragDropManager)();
- const handler = (0, $lhS0U.useDragSource)(spec, monitor, connector);
- const itemType = (0, $8vT3E.useDragType)(spec);
- (0, $dJ5AF.useIsomorphicLayoutEffect)(function registerDragSource() {
- if (itemType != null) {
- const [handlerId, unregister] = (0, $eGDnJ.registerSource)(itemType, handler, manager);
- monitor.receiveHandlerId(handlerId);
- connector.receiveHandlerId(handlerId);
- return unregister;
- }
- return;
- }, [
- manager,
- monitor,
- connector,
- handler,
- itemType
- ]);
-}
-
-});
-parcelRegister("eGDnJ", function(module, exports) {
-
-$parcel$export(module.exports, "registerTarget", () => $ab138952d5dcf3e9$export$38b18180ae58b09b);
-$parcel$export(module.exports, "registerSource", () => $ab138952d5dcf3e9$export$51c814b9e17958c);
-function $ab138952d5dcf3e9$export$38b18180ae58b09b(type, target, manager) {
- const registry = manager.getRegistry();
- const targetId = registry.addTarget(type, target);
- return [
- targetId,
- ()=>registry.removeTarget(targetId)
- ];
-}
-function $ab138952d5dcf3e9$export$51c814b9e17958c(type, source, manager) {
- const registry = manager.getRegistry();
- const sourceId = registry.addSource(type, source);
- return [
- sourceId,
- ()=>registry.removeSource(sourceId)
- ];
-}
-
-});
-
-parcelRegister("lhS0U", function(module, exports) {
-
-$parcel$export(module.exports, "useDragSource", () => $f7f51583f0a4ec6d$export$cdddb20adb7aad5c);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $9HCk4 = parcelRequire("9HCk4");
-function $f7f51583f0a4ec6d$export$cdddb20adb7aad5c(spec, monitor, connector) {
- const handler = (0, $63SH6.useMemo)(()=>new (0, $9HCk4.DragSourceImpl)(spec, monitor, connector), [
- monitor,
- connector
- ]);
- (0, $63SH6.useEffect)(()=>{
- handler.spec = spec;
- }, [
- spec
- ]);
- return handler;
-}
-
-});
-parcelRegister("9HCk4", function(module, exports) {
-
-$parcel$export(module.exports, "DragSourceImpl", () => $7105db47e9cdc374$export$680f0a3c92f9d645);
-class $7105db47e9cdc374$export$680f0a3c92f9d645 {
- beginDrag() {
- const spec = this.spec;
- const monitor = this.monitor;
- let result = null;
- if (typeof spec.item === "object") result = spec.item;
- else if (typeof spec.item === "function") result = spec.item(monitor);
- else result = {};
- return result !== null && result !== void 0 ? result : null;
- }
- canDrag() {
- const spec = this.spec;
- const monitor = this.monitor;
- if (typeof spec.canDrag === "boolean") return spec.canDrag;
- else if (typeof spec.canDrag === "function") return spec.canDrag(monitor);
- else return true;
- }
- isDragging(globalMonitor, target) {
- const spec = this.spec;
- const monitor = this.monitor;
- const { isDragging: isDragging } = spec;
- return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId();
- }
- endDrag() {
- const spec = this.spec;
- const monitor = this.monitor;
- const connector = this.connector;
- const { end: end } = spec;
- if (end) end(monitor.getItem(), monitor);
- connector.reconnect();
- }
- constructor(spec, monitor, connector){
- this.spec = spec;
- this.monitor = monitor;
- this.connector = connector;
- }
-}
-
-});
-
-
-parcelRegister("8vT3E", function(module, exports) {
-
-$parcel$export(module.exports, "useDragType", () => $632bed4fe0ce8fee$export$dec3a5d742510a3f);
-
-var $3lJWP = parcelRequire("3lJWP");
-
-var $63SH6 = parcelRequire("63SH6");
-function $632bed4fe0ce8fee$export$dec3a5d742510a3f(spec) {
- return (0, $63SH6.useMemo)(()=>{
- const result = spec.type;
- (0, $3lJWP.invariant)(result != null, "spec.type must be defined");
- return result;
- }, [
- spec
- ]);
-}
-
-});
-
-
-
-parcelRegister("8Zz8a", function(module, exports) {
-
-$parcel$export(module.exports, "useDragLayer", () => $68bf4578ea31e4e7$export$d7d88e78e2243a79);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $9wL1D = parcelRequire("9wL1D");
-
-var $3sLVf = parcelRequire("3sLVf");
-function $68bf4578ea31e4e7$export$d7d88e78e2243a79(collect) {
- const dragDropManager = (0, $3sLVf.useDragDropManager)();
- const monitor = dragDropManager.getMonitor();
- const [collected, updateCollected] = (0, $9wL1D.useCollector)(monitor, collect);
- (0, $63SH6.useEffect)(()=>monitor.subscribeToOffsetChange(updateCollected));
- (0, $63SH6.useEffect)(()=>monitor.subscribeToStateChange(updateCollected));
- return collected;
-}
-
-});
-
-parcelRegister("8ewcd", function(module, exports) {
-
-$parcel$export(module.exports, "useDrop", () => $018c027ff91fc48d$export$ccdee5eaf73cf661);
-
-var $NvwFy = parcelRequire("NvwFy");
-
-var $1hEjN = parcelRequire("1hEjN");
-
-var $4yLKL = parcelRequire("4yLKL");
-
-var $fVB9C = parcelRequire("fVB9C");
-
-var $9DlX4 = parcelRequire("9DlX4");
-
-var $bjksr = parcelRequire("bjksr");
-function $018c027ff91fc48d$export$ccdee5eaf73cf661(specArg, deps) {
- const spec = (0, $1hEjN.useOptionalFactory)(specArg, deps);
- const monitor = (0, $9DlX4.useDropTargetMonitor)();
- const connector = (0, $fVB9C.useDropTargetConnector)(spec.options);
- (0, $bjksr.useRegisteredDropTarget)(spec, monitor, connector);
- return [
- (0, $NvwFy.useCollectedProps)(spec.collect, monitor, connector),
- (0, $4yLKL.useConnectDropTarget)(connector)
- ];
-}
-
-});
-parcelRegister("4yLKL", function(module, exports) {
-
-$parcel$export(module.exports, "useConnectDropTarget", () => $351f6132f0222688$export$c914595a34b9504a);
-
-var $63SH6 = parcelRequire("63SH6");
-function $351f6132f0222688$export$c914595a34b9504a(connector) {
- return (0, $63SH6.useMemo)(()=>connector.hooks.dropTarget(), [
- connector
- ]);
-}
-
-});
-
-parcelRegister("fVB9C", function(module, exports) {
-
-$parcel$export(module.exports, "useDropTargetConnector", () => $b988ffed2e950bcb$export$29242ded1aad6df7);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $jYGYG = parcelRequire("jYGYG");
-
-var $3sLVf = parcelRequire("3sLVf");
-
-var $dJ5AF = parcelRequire("dJ5AF");
-function $b988ffed2e950bcb$export$29242ded1aad6df7(options) {
- const manager = (0, $3sLVf.useDragDropManager)();
- const connector = (0, $63SH6.useMemo)(()=>new (0, $jYGYG.TargetConnector)(manager.getBackend()), [
- manager
- ]);
- (0, $dJ5AF.useIsomorphicLayoutEffect)(()=>{
- connector.dropTargetOptions = options || null;
- connector.reconnect();
- return ()=>connector.disconnectDropTarget();
- }, [
- options
- ]);
- return connector;
-}
-
-});
-parcelRegister("jYGYG", function(module, exports) {
-
-$parcel$export(module.exports, "TargetConnector", () => $e8b4f5624b23563c$export$ed6d7b7bc55193cf);
-
-var $gEgm9 = parcelRequire("gEgm9");
-
-var $kV3jj = parcelRequire("kV3jj");
-
-var $lgcrW = parcelRequire("lgcrW");
-class $e8b4f5624b23563c$export$ed6d7b7bc55193cf {
- get connectTarget() {
- return this.dropTarget;
- }
- reconnect() {
- // if nothing has changed then don't resubscribe
- const didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
- if (didChange) this.disconnectDropTarget();
- const dropTarget = this.dropTarget;
- if (!this.handlerId) return;
- if (!dropTarget) {
- this.lastConnectedDropTarget = dropTarget;
- return;
- }
- if (didChange) {
- this.lastConnectedHandlerId = this.handlerId;
- this.lastConnectedDropTarget = dropTarget;
- this.lastConnectedDropTargetOptions = this.dropTargetOptions;
- this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
- }
- }
- receiveHandlerId(newHandlerId) {
- if (newHandlerId === this.handlerId) return;
- this.handlerId = newHandlerId;
- this.reconnect();
- }
- get dropTargetOptions() {
- return this.dropTargetOptionsInternal;
- }
- set dropTargetOptions(options) {
- this.dropTargetOptionsInternal = options;
- }
- didHandlerIdChange() {
- return this.lastConnectedHandlerId !== this.handlerId;
- }
- didDropTargetChange() {
- return this.lastConnectedDropTarget !== this.dropTarget;
- }
- didOptionsChange() {
- return !(0, $gEgm9.shallowEqual)(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
- }
- disconnectDropTarget() {
- if (this.unsubscribeDropTarget) {
- this.unsubscribeDropTarget();
- this.unsubscribeDropTarget = undefined;
- }
- }
- get dropTarget() {
- return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
- }
- clearDropTarget() {
- this.dropTargetRef = null;
- this.dropTargetNode = null;
- }
- constructor(backend){
- this.hooks = (0, $lgcrW.wrapConnectorHooks)({
- dropTarget: (node, options)=>{
- this.clearDropTarget();
- this.dropTargetOptions = options;
- if ((0, $kV3jj.isRef)(node)) this.dropTargetRef = node;
- else this.dropTargetNode = node;
- this.reconnect();
- }
- });
- this.handlerId = null;
- // The drop target may either be attached via ref or connect function
- this.dropTargetRef = null;
- this.dropTargetOptionsInternal = null;
- this.lastConnectedHandlerId = null;
- this.lastConnectedDropTarget = null;
- this.lastConnectedDropTargetOptions = null;
- this.backend = backend;
- }
-}
-
-});
-
-
-parcelRegister("9DlX4", function(module, exports) {
-
-$parcel$export(module.exports, "useDropTargetMonitor", () => $7038c8bdd366327e$export$f0c0ad05844dec3b);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $47xWM = parcelRequire("47xWM");
-
-var $3sLVf = parcelRequire("3sLVf");
-function $7038c8bdd366327e$export$f0c0ad05844dec3b() {
- const manager = (0, $3sLVf.useDragDropManager)();
- return (0, $63SH6.useMemo)(()=>new (0, $47xWM.DropTargetMonitorImpl)(manager), [
- manager
- ]);
-}
-
-});
-parcelRegister("47xWM", function(module, exports) {
-
-$parcel$export(module.exports, "DropTargetMonitorImpl", () => $300226095b6bb44c$export$9fe8834769ae8ddf);
-
-var $3lJWP = parcelRequire("3lJWP");
-let $300226095b6bb44c$var$isCallingCanDrop = false;
-class $300226095b6bb44c$export$9fe8834769ae8ddf {
- receiveHandlerId(targetId) {
- this.targetId = targetId;
- }
- getHandlerId() {
- return this.targetId;
- }
- subscribeToStateChange(listener, options) {
- return this.internalMonitor.subscribeToStateChange(listener, options);
- }
- canDrop() {
- // Cut out early if the target id has not been set. This should prevent errors
- // where the user has an older version of dnd-core like in
- // https://github.com/react-dnd/react-dnd/issues/1310
- if (!this.targetId) return false;
- (0, $3lJWP.invariant)(!$300226095b6bb44c$var$isCallingCanDrop, "You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");
- try {
- $300226095b6bb44c$var$isCallingCanDrop = true;
- return this.internalMonitor.canDropOnTarget(this.targetId);
- } finally{
- $300226095b6bb44c$var$isCallingCanDrop = false;
- }
- }
- isOver(options) {
- if (!this.targetId) return false;
- return this.internalMonitor.isOverTarget(this.targetId, options);
- }
- getItemType() {
- return this.internalMonitor.getItemType();
- }
- getItem() {
- return this.internalMonitor.getItem();
- }
- getDropResult() {
- return this.internalMonitor.getDropResult();
- }
- didDrop() {
- return this.internalMonitor.didDrop();
- }
- getInitialClientOffset() {
- return this.internalMonitor.getInitialClientOffset();
- }
- getInitialSourceClientOffset() {
- return this.internalMonitor.getInitialSourceClientOffset();
- }
- getSourceClientOffset() {
- return this.internalMonitor.getSourceClientOffset();
- }
- getClientOffset() {
- return this.internalMonitor.getClientOffset();
- }
- getDifferenceFromInitialOffset() {
- return this.internalMonitor.getDifferenceFromInitialOffset();
- }
- constructor(manager){
- this.targetId = null;
- this.internalMonitor = manager.getMonitor();
- }
-}
-
-});
-
-
-parcelRegister("bjksr", function(module, exports) {
-
-$parcel$export(module.exports, "useRegisteredDropTarget", () => $83c156861b1ea7f2$export$b31a008bfacf9de1);
-
-var $eGDnJ = parcelRequire("eGDnJ");
-
-var $3sLVf = parcelRequire("3sLVf");
-
-var $dJ5AF = parcelRequire("dJ5AF");
-
-var $9QE9d = parcelRequire("9QE9d");
-
-var $eVNHg = parcelRequire("eVNHg");
-function $83c156861b1ea7f2$export$b31a008bfacf9de1(spec, monitor, connector) {
- const manager = (0, $3sLVf.useDragDropManager)();
- const dropTarget = (0, $eVNHg.useDropTarget)(spec, monitor);
- const accept = (0, $9QE9d.useAccept)(spec);
- (0, $dJ5AF.useIsomorphicLayoutEffect)(function registerDropTarget() {
- const [handlerId, unregister] = (0, $eGDnJ.registerTarget)(accept, dropTarget, manager);
- monitor.receiveHandlerId(handlerId);
- connector.receiveHandlerId(handlerId);
- return unregister;
- }, [
- manager,
- monitor,
- dropTarget,
- connector,
- accept.map((a)=>a.toString()).join("|")
- ]);
-}
-
-});
-parcelRegister("9QE9d", function(module, exports) {
-
-$parcel$export(module.exports, "useAccept", () => $72b81cdd511cbbb8$export$2a5cc7f0ac8651d0);
-
-var $3lJWP = parcelRequire("3lJWP");
-
-var $63SH6 = parcelRequire("63SH6");
-function $72b81cdd511cbbb8$export$2a5cc7f0ac8651d0(spec) {
- const { accept: accept } = spec;
- return (0, $63SH6.useMemo)(()=>{
- (0, $3lJWP.invariant)(spec.accept != null, "accept must be defined");
- return Array.isArray(accept) ? accept : [
- accept
- ];
- }, [
- accept
- ]);
-}
-
-});
-
-parcelRegister("eVNHg", function(module, exports) {
-
-$parcel$export(module.exports, "useDropTarget", () => $adecf055e56a8c5b$export$5967d4bb72ce3c0);
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $51RBJ = parcelRequire("51RBJ");
-function $adecf055e56a8c5b$export$5967d4bb72ce3c0(spec, monitor) {
- const dropTarget = (0, $63SH6.useMemo)(()=>new (0, $51RBJ.DropTargetImpl)(spec, monitor), [
- monitor
- ]);
- (0, $63SH6.useEffect)(()=>{
- dropTarget.spec = spec;
- }, [
- spec
- ]);
- return dropTarget;
-}
-
-});
-parcelRegister("51RBJ", function(module, exports) {
-
-$parcel$export(module.exports, "DropTargetImpl", () => $3a96a113e443e55b$export$f26a17703f5cb233);
-class $3a96a113e443e55b$export$f26a17703f5cb233 {
- canDrop() {
- const spec = this.spec;
- const monitor = this.monitor;
- return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true;
- }
- hover() {
- const spec = this.spec;
- const monitor = this.monitor;
- if (spec.hover) spec.hover(monitor.getItem(), monitor);
- }
- drop() {
- const spec = this.spec;
- const monitor = this.monitor;
- if (spec.drop) return spec.drop(monitor.getItem(), monitor);
- return;
- }
- constructor(spec, monitor){
- this.spec = spec;
- this.monitor = monitor;
- }
-}
-
-});
-
-
-
-
-parcelRegister("lcm7t", function(module, exports) {
-
-$parcel$export(module.exports, "MultiFactory", () => $f6ebe074279425f0$export$4b6d1516b71b1b84);
-
-var $1vP15 = parcelRequire("1vP15");
-const $f6ebe074279425f0$export$4b6d1516b71b1b84 = (manager, context, options)=>{
- return new (0, $1vP15.MultiBackendImpl)(manager, context, options);
-};
-
-});
-parcelRegister("1vP15", function(module, exports) {
-
-$parcel$export(module.exports, "MultiBackendImpl", () => $11a042860fb976a6$export$c19dc7a9c63fbd74);
-
-var $hSpkC = parcelRequire("hSpkC");
-function $11a042860fb976a6$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
- $11a042860fb976a6$var$_checkPrivateRedeclaration(obj, privateMap);
- privateMap.set(obj, value);
-}
-function $11a042860fb976a6$var$_checkPrivateRedeclaration(obj, privateCollection) {
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
-}
-function $11a042860fb976a6$var$_defineProperty(obj, key, value) {
- if (key in obj) Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- else obj[key] = value;
- return obj;
-}
-function $11a042860fb976a6$var$_classPrivateFieldGet(receiver, privateMap) {
- var descriptor = $11a042860fb976a6$var$_classExtractFieldDescriptor(receiver, privateMap, "get");
- return $11a042860fb976a6$var$_classApplyDescriptorGet(receiver, descriptor);
-}
-function $11a042860fb976a6$var$_classApplyDescriptorGet(receiver, descriptor) {
- if (descriptor.get) return descriptor.get.call(receiver);
- return descriptor.value;
-}
-function $11a042860fb976a6$var$_classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = $11a042860fb976a6$var$_classExtractFieldDescriptor(receiver, privateMap, "set");
- $11a042860fb976a6$var$_classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
-function $11a042860fb976a6$var$_classExtractFieldDescriptor(receiver, privateMap, action) {
- if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
- return privateMap.get(receiver);
-}
-function $11a042860fb976a6$var$_classApplyDescriptorSet(receiver, descriptor, value) {
- if (descriptor.set) descriptor.set.call(receiver, value);
- else {
- if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
- descriptor.value = value;
- }
-}
-var $11a042860fb976a6$var$_current = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_previews = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_backends = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_backendsList = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_nodes = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_createBackend = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_addEventListeners = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_removeEventListeners = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_backendSwitcher = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_callBackend = /*#__PURE__*/ new WeakMap();
-var $11a042860fb976a6$var$_connectBackend = /*#__PURE__*/ new WeakMap();
-class $11a042860fb976a6$export$c19dc7a9c63fbd74 {
- /*private*/ /*private*/ /*private*/ /*private*/ /*private*/ constructor(_manager, _context, _options){
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_current, {
- writable: true,
- value: void 0
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_previews, {
- writable: true,
- value: void 0
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_backends, {
- writable: true,
- value: void 0
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_backendsList, {
- writable: true,
- value: void 0
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_nodes, {
- writable: true,
- value: void 0
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_createBackend, {
- writable: true,
- value: (manager, context, backend)=>{
- var _backend$preview, _backend$skipDispatch;
- if (!backend.backend) throw new Error("You must specify a 'backend' property in your Backend entry: ".concat(JSON.stringify(backend)));
- const instance = backend.backend(manager, context, backend.options);
- let id = backend.id; // Try to infer an `id` if one doesn't exist
- const inferName = !backend.id && instance && instance.constructor;
- if (inferName) id = instance.constructor.name;
- if (!id) throw new Error("You must specify an 'id' property in your Backend entry: ".concat(JSON.stringify(backend), "\n see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-5xx"));
- else if (inferName) console.warn("Deprecation notice: You are using a pipeline which doesn't include backends' 'id'.\n This might be unsupported in the future, please specify 'id' explicitely for every backend.");
- if ($11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[id]) throw new Error("You must specify a unique 'id' property in your Backend entry:\n ".concat(JSON.stringify(backend), " (conflicts with: ").concat(JSON.stringify($11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[id]), ")"));
- return {
- id: id,
- instance: instance,
- preview: (_backend$preview = backend.preview) !== null && _backend$preview !== void 0 ? _backend$preview : false,
- transition: backend.transition,
- skipDispatchOnTransition: (_backend$skipDispatch = backend.skipDispatchOnTransition) !== null && _backend$skipDispatch !== void 0 ? _backend$skipDispatch : false
- };
- }
- });
- $11a042860fb976a6$var$_defineProperty(this, "setup", ()=>{
- if (typeof window === "undefined") return;
- if ($11a042860fb976a6$export$c19dc7a9c63fbd74.isSetUp) throw new Error("Cannot have two MultiBackends at the same time.");
- $11a042860fb976a6$export$c19dc7a9c63fbd74.isSetUp = true;
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_addEventListeners).call(this, window);
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)].instance.setup();
- });
- $11a042860fb976a6$var$_defineProperty(this, "teardown", ()=>{
- if (typeof window === "undefined") return;
- $11a042860fb976a6$export$c19dc7a9c63fbd74.isSetUp = false;
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_removeEventListeners).call(this, window);
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)].instance.teardown();
- });
- $11a042860fb976a6$var$_defineProperty(this, "connectDragSource", (sourceId, node, options)=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_connectBackend).call(this, "connectDragSource", sourceId, node, options);
- });
- $11a042860fb976a6$var$_defineProperty(this, "connectDragPreview", (sourceId, node, options)=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_connectBackend).call(this, "connectDragPreview", sourceId, node, options);
- });
- $11a042860fb976a6$var$_defineProperty(this, "connectDropTarget", (sourceId, node, options)=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_connectBackend).call(this, "connectDropTarget", sourceId, node, options);
- });
- $11a042860fb976a6$var$_defineProperty(this, "profile", ()=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)].instance.profile();
- });
- $11a042860fb976a6$var$_defineProperty(this, "previewEnabled", ()=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)].preview;
- });
- $11a042860fb976a6$var$_defineProperty(this, "previewsList", ()=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_previews);
- });
- $11a042860fb976a6$var$_defineProperty(this, "backendsList", ()=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList);
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_addEventListeners, {
- writable: true,
- value: (target)=>{
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList).forEach((backend)=>{
- if (backend.transition) target.addEventListener(backend.transition.event, $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendSwitcher));
- });
- }
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_removeEventListeners, {
- writable: true,
- value: (target)=>{
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList).forEach((backend)=>{
- if (backend.transition) target.removeEventListener(backend.transition.event, $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendSwitcher));
- });
- }
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_backendSwitcher, {
- writable: true,
- value: (event)=>{
- const oldBackend = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current);
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList).some((backend)=>{
- if (backend.id !== $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current) && backend.transition && backend.transition.check(event)) {
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_current, backend.id);
- return true;
- }
- return false;
- });
- if ($11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current) !== oldBackend) {
- var _event$target;
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[oldBackend].instance.teardown();
- Object.keys($11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_nodes)).forEach((id)=>{
- const node = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_nodes)[id];
- node.unsubscribe();
- node.unsubscribe = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_callBackend).call(this, node.func, ...node.args);
- });
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_previews).backendChanged(this);
- const newBackend = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)];
- newBackend.instance.setup();
- if (newBackend.skipDispatchOnTransition) return;
- const Class = event.constructor;
- const newEvent = new Class(event.type, event);
- (_event$target = event.target) === null || _event$target === void 0 || _event$target.dispatchEvent(newEvent);
- }
- }
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_callBackend, {
- writable: true,
- value: (func, sourceId, node, options)=>{
- return $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[$11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_current)].instance[func](sourceId, node, options);
- }
- });
- $11a042860fb976a6$var$_classPrivateFieldInitSpec(this, $11a042860fb976a6$var$_connectBackend, {
- writable: true,
- value: (func, sourceId, node, options)=>{
- const nodeId = "".concat(func, "_").concat(sourceId);
- const unsubscribe = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_callBackend).call(this, func, sourceId, node, options);
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_nodes)[nodeId] = {
- func: func,
- args: [
- sourceId,
- node,
- options
- ],
- unsubscribe: unsubscribe
- };
- return ()=>{
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_nodes)[nodeId].unsubscribe();
- delete $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_nodes)[nodeId];
- };
- }
- });
- if (!_options || !_options.backends || _options.backends.length < 1) throw new Error("You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)\n see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx");
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_previews, new (0, $hSpkC.PreviewListImpl)());
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_backends, {});
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_backendsList, []);
- _options.backends.forEach((backend)=>{
- const backendRecord = $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_createBackend).call(this, _manager, _context, backend);
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backends)[backendRecord.id] = backendRecord;
- $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList).push(backendRecord);
- });
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_current, $11a042860fb976a6$var$_classPrivateFieldGet(this, $11a042860fb976a6$var$_backendsList)[0].id);
- $11a042860fb976a6$var$_classPrivateFieldSet(this, $11a042860fb976a6$var$_nodes, {});
- }
-}
-$11a042860fb976a6$var$_defineProperty($11a042860fb976a6$export$c19dc7a9c63fbd74, "isSetUp", false);
-
-});
-parcelRegister("hSpkC", function(module, exports) {
-
-$parcel$export(module.exports, "PreviewListImpl", () => $d03b2121e2323edf$export$f63d3f8a05a0efd2);
-function $d03b2121e2323edf$var$_defineProperty(obj, key, value) {
- if (key in obj) Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- else obj[key] = value;
- return obj;
-}
-function $d03b2121e2323edf$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
- $d03b2121e2323edf$var$_checkPrivateRedeclaration(obj, privateMap);
- privateMap.set(obj, value);
-}
-function $d03b2121e2323edf$var$_checkPrivateRedeclaration(obj, privateCollection) {
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
-}
-function $d03b2121e2323edf$var$_classPrivateFieldGet(receiver, privateMap) {
- var descriptor = $d03b2121e2323edf$var$_classExtractFieldDescriptor(receiver, privateMap, "get");
- return $d03b2121e2323edf$var$_classApplyDescriptorGet(receiver, descriptor);
-}
-function $d03b2121e2323edf$var$_classApplyDescriptorGet(receiver, descriptor) {
- if (descriptor.get) return descriptor.get.call(receiver);
- return descriptor.value;
-}
-function $d03b2121e2323edf$var$_classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = $d03b2121e2323edf$var$_classExtractFieldDescriptor(receiver, privateMap, "set");
- $d03b2121e2323edf$var$_classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
-function $d03b2121e2323edf$var$_classExtractFieldDescriptor(receiver, privateMap, action) {
- if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
- return privateMap.get(receiver);
-}
-function $d03b2121e2323edf$var$_classApplyDescriptorSet(receiver, descriptor, value) {
- if (descriptor.set) descriptor.set.call(receiver, value);
- else {
- if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
- descriptor.value = value;
- }
-}
-var $d03b2121e2323edf$var$_previews = /*#__PURE__*/ new WeakMap();
-class $d03b2121e2323edf$export$f63d3f8a05a0efd2 {
- /*private*/ constructor(){
- $d03b2121e2323edf$var$_classPrivateFieldInitSpec(this, $d03b2121e2323edf$var$_previews, {
- writable: true,
- value: void 0
- });
- $d03b2121e2323edf$var$_defineProperty(this, "register", (preview)=>{
- $d03b2121e2323edf$var$_classPrivateFieldGet(this, $d03b2121e2323edf$var$_previews).push(preview);
- });
- $d03b2121e2323edf$var$_defineProperty(this, "unregister", (preview)=>{
- let index;
- while((index = $d03b2121e2323edf$var$_classPrivateFieldGet(this, $d03b2121e2323edf$var$_previews).indexOf(preview)) !== -1)$d03b2121e2323edf$var$_classPrivateFieldGet(this, $d03b2121e2323edf$var$_previews).splice(index, 1);
- });
- $d03b2121e2323edf$var$_defineProperty(this, "backendChanged", (backend)=>{
- for (const preview of $d03b2121e2323edf$var$_classPrivateFieldGet(this, $d03b2121e2323edf$var$_previews))preview.backendChanged(backend);
- });
- $d03b2121e2323edf$var$_classPrivateFieldSet(this, $d03b2121e2323edf$var$_previews, []);
- }
-}
-
-});
-
-
-
-parcelRegister("gjRxz", function(module, exports) {
-
-$parcel$export(module.exports, "TouchTransition", () => $be17f3b87de5fbca$export$91e99a52278bf8a5);
-$parcel$export(module.exports, "PointerTransition", () => $be17f3b87de5fbca$export$80b5a78dd0357f61);
-
-var $lVsvE = parcelRequire("lVsvE");
-const $be17f3b87de5fbca$export$91e99a52278bf8a5 = (0, $lVsvE.createTransition)("touchstart", (rawEvent)=>{
- const event = rawEvent;
- return event.touches !== null && event.touches !== undefined;
-});
-const $be17f3b87de5fbca$export$9528ec74b6ffc6f = (0, $lVsvE.createTransition)("dragstart", (event)=>{
- return event.type.indexOf("drag") !== -1 || event.type.indexOf("drop") !== -1;
-});
-const $be17f3b87de5fbca$export$6863e369d9a30d41 = (0, $lVsvE.createTransition)("mousedown", (event)=>{
- return event.type.indexOf("touch") === -1 && event.type.indexOf("mouse") !== -1;
-});
-const $be17f3b87de5fbca$export$80b5a78dd0357f61 = (0, $lVsvE.createTransition)("pointerdown", (rawEvent)=>{
- const event = rawEvent;
- return event.pointerType == "mouse";
-});
-
-});
-parcelRegister("lVsvE", function(module, exports) {
-
-$parcel$export(module.exports, "createTransition", () => $ff650939da7cd9b0$export$b6ba0683d3f993fb);
-const $ff650939da7cd9b0$export$b6ba0683d3f993fb = (event, check)=>{
- return {
- event: event,
- check: check
- };
-};
-
-});
-
-
-parcelRegister("dpOyO", function(module, exports) {
-$parcel$export(module.exports, "TouchBackendImpl", () => (parcelRequire("iix8G")).TouchBackendImpl);
-
-$parcel$export(module.exports, "TouchBackend", () => $9c44d46aa7741a77$export$b4d0180dbe086f87);
-
-var $iix8G = parcelRequire("iix8G");
-
-const $9c44d46aa7741a77$export$b4d0180dbe086f87 = function createBackend(manager, context = {}, options = {}) {
- return new (0, $iix8G.TouchBackendImpl)(manager, context, options);
-};
-
-});
-parcelRegister("iix8G", function(module, exports) {
-
-$parcel$export(module.exports, "TouchBackendImpl", () => $d5239d2bfab118fb$export$d96f7f27c2e7d149);
-
-var $3lJWP = parcelRequire("3lJWP");
-
-var $ja1iH = parcelRequire("ja1iH");
-
-var $bNoD1 = parcelRequire("bNoD1");
-
-var $ebJc7 = parcelRequire("ebJc7");
-
-var $aE4QR = parcelRequire("aE4QR");
-
-var $1LpUN = parcelRequire("1LpUN");
-
-var $7EW53 = parcelRequire("7EW53");
-const $d5239d2bfab118fb$var$eventNames = {
- [(0, $ja1iH.ListenerType).mouse]: {
- start: "mousedown",
- move: "mousemove",
- end: "mouseup",
- contextmenu: "contextmenu"
- },
- [(0, $ja1iH.ListenerType).touch]: {
- start: "touchstart",
- move: "touchmove",
- end: "touchend"
- },
- [(0, $ja1iH.ListenerType).keyboard]: {
- keydown: "keydown"
- }
-};
-class $d5239d2bfab118fb$export$d96f7f27c2e7d149 {
- /**
- * Generate profiling statistics for the HTML5Backend.
- */ profile() {
- var ref;
- return {
- sourceNodes: this.sourceNodes.size,
- sourcePreviewNodes: this.sourcePreviewNodes.size,
- sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size,
- targetNodes: this.targetNodes.size,
- dragOverTargetIds: ((ref = this.dragOverTargetIds) === null || ref === void 0 ? void 0 : ref.length) || 0
- };
- }
- // public for test
- get document() {
- return this.options.document;
- }
- setup() {
- const root = this.options.rootElement;
- if (!root) return;
- (0, $3lJWP.invariant)(!$d5239d2bfab118fb$export$d96f7f27c2e7d149.isSetUp, "Cannot have two Touch backends at the same time.");
- $d5239d2bfab118fb$export$d96f7f27c2e7d149.isSetUp = true;
- this.addEventListener(root, "start", this.getTopMoveStartHandler());
- this.addEventListener(root, "start", this.handleTopMoveStartCapture, true);
- this.addEventListener(root, "move", this.handleTopMove);
- this.addEventListener(root, "move", this.handleTopMoveCapture, true);
- this.addEventListener(root, "end", this.handleTopMoveEndCapture, true);
- if (this.options.enableMouseEvents && !this.options.ignoreContextMenu) this.addEventListener(root, "contextmenu", this.handleTopMoveEndCapture);
- if (this.options.enableKeyboardEvents) this.addEventListener(root, "keydown", this.handleCancelOnEscape, true);
- }
- teardown() {
- const root = this.options.rootElement;
- if (!root) return;
- $d5239d2bfab118fb$export$d96f7f27c2e7d149.isSetUp = false;
- this._mouseClientOffset = {};
- this.removeEventListener(root, "start", this.handleTopMoveStartCapture, true);
- this.removeEventListener(root, "start", this.handleTopMoveStart);
- this.removeEventListener(root, "move", this.handleTopMoveCapture, true);
- this.removeEventListener(root, "move", this.handleTopMove);
- this.removeEventListener(root, "end", this.handleTopMoveEndCapture, true);
- if (this.options.enableMouseEvents && !this.options.ignoreContextMenu) this.removeEventListener(root, "contextmenu", this.handleTopMoveEndCapture);
- if (this.options.enableKeyboardEvents) this.removeEventListener(root, "keydown", this.handleCancelOnEscape, true);
- this.uninstallSourceNodeRemovalObserver();
- }
- addEventListener(subject, event, handler, capture = false) {
- const options = (0, $7EW53.supportsPassive) ? {
- capture: capture,
- passive: false
- } : capture;
- this.listenerTypes.forEach(function(listenerType) {
- const evt = $d5239d2bfab118fb$var$eventNames[listenerType][event];
- if (evt) subject.addEventListener(evt, handler, options);
- });
- }
- removeEventListener(subject, event, handler, capture = false) {
- const options = (0, $7EW53.supportsPassive) ? {
- capture: capture,
- passive: false
- } : capture;
- this.listenerTypes.forEach(function(listenerType) {
- const evt = $d5239d2bfab118fb$var$eventNames[listenerType][event];
- if (evt) subject.removeEventListener(evt, handler, options);
- });
- }
- connectDragSource(sourceId, node) {
- const handleMoveStart = this.handleMoveStart.bind(this, sourceId);
- this.sourceNodes.set(sourceId, node);
- this.addEventListener(node, "start", handleMoveStart);
- return ()=>{
- this.sourceNodes.delete(sourceId);
- this.removeEventListener(node, "start", handleMoveStart);
- };
- }
- connectDragPreview(sourceId, node, options) {
- this.sourcePreviewNodeOptions.set(sourceId, options);
- this.sourcePreviewNodes.set(sourceId, node);
- return ()=>{
- this.sourcePreviewNodes.delete(sourceId);
- this.sourcePreviewNodeOptions.delete(sourceId);
- };
- }
- connectDropTarget(targetId, node) {
- const root = this.options.rootElement;
- if (!this.document || !root) return ()=>{
- /* noop */ };
- const handleMove = (e)=>{
- if (!this.document || !root || !this.monitor.isDragging()) return;
- let coords;
- /**
- * Grab the coordinates for the current mouse/touch position
- */ switch(e.type){
- case $d5239d2bfab118fb$var$eventNames.mouse.move:
- coords = {
- x: e.clientX,
- y: e.clientY
- };
- break;
- case $d5239d2bfab118fb$var$eventNames.touch.move:
- var ref, ref1;
- coords = {
- x: ((ref = e.touches[0]) === null || ref === void 0 ? void 0 : ref.clientX) || 0,
- y: ((ref1 = e.touches[0]) === null || ref1 === void 0 ? void 0 : ref1.clientY) || 0
- };
- break;
- }
- /**
- * Use the coordinates to grab the element the drag ended on.
- * If the element is the same as the target node (or any of it's children) then we have hit a drop target and can handle the move.
- */ const droppedOn = coords != null ? this.document.elementFromPoint(coords.x, coords.y) : undefined;
- const childMatch = droppedOn && node.contains(droppedOn);
- if (droppedOn === node || childMatch) return this.handleMove(e, targetId);
- };
- /**
- * Attaching the event listener to the body so that touchmove will work while dragging over multiple target elements.
- */ this.addEventListener(this.document.body, "move", handleMove);
- this.targetNodes.set(targetId, node);
- return ()=>{
- if (this.document) {
- this.targetNodes.delete(targetId);
- this.removeEventListener(this.document.body, "move", handleMove);
- }
- };
- }
- getTopMoveStartHandler() {
- if (!this.options.delayTouchStart && !this.options.delayMouseStart) return this.handleTopMoveStart;
- return this.handleTopMoveStartDelay;
- }
- installSourceNodeRemovalObserver(node) {
- this.uninstallSourceNodeRemovalObserver();
- this.draggedSourceNode = node;
- this.draggedSourceNodeRemovalObserver = new MutationObserver(()=>{
- if (node && !node.parentElement) {
- this.resurrectSourceNode();
- this.uninstallSourceNodeRemovalObserver();
- }
- });
- if (!node || !node.parentElement) return;
- this.draggedSourceNodeRemovalObserver.observe(node.parentElement, {
- childList: true
- });
- }
- resurrectSourceNode() {
- if (this.document && this.draggedSourceNode) {
- this.draggedSourceNode.style.display = "none";
- this.draggedSourceNode.removeAttribute("data-reactid");
- this.document.body.appendChild(this.draggedSourceNode);
- }
- }
- uninstallSourceNodeRemovalObserver() {
- if (this.draggedSourceNodeRemovalObserver) this.draggedSourceNodeRemovalObserver.disconnect();
- this.draggedSourceNodeRemovalObserver = undefined;
- this.draggedSourceNode = undefined;
- }
- constructor(manager, context, options){
- this.getSourceClientOffset = (sourceId)=>{
- const element = this.sourceNodes.get(sourceId);
- return element && (0, $aE4QR.getNodeClientOffset)(element);
- };
- this.handleTopMoveStartCapture = (e)=>{
- if (!(0, $1LpUN.eventShouldStartDrag)(e)) return;
- this.moveStartSourceIds = [];
- };
- this.handleMoveStart = (sourceId)=>{
- // Just because we received an event doesn't necessarily mean we need to collect drag sources.
- // We only collect start collecting drag sources on touch and left mouse events.
- if (Array.isArray(this.moveStartSourceIds)) this.moveStartSourceIds.unshift(sourceId);
- };
- this.handleTopMoveStart = (e)=>{
- if (!(0, $1LpUN.eventShouldStartDrag)(e)) return;
- // Don't prematurely preventDefault() here since it might:
- // 1. Mess up scrolling
- // 2. Mess up long tap (which brings up context menu)
- // 3. If there's an anchor link as a child, tap won't be triggered on link
- const clientOffset = (0, $aE4QR.getEventClientOffset)(e);
- if (clientOffset) {
- if ((0, $1LpUN.isTouchEvent)(e)) this.lastTargetTouchFallback = e.targetTouches[0];
- this._mouseClientOffset = clientOffset;
- }
- this.waitingForDelay = false;
- };
- this.handleTopMoveStartDelay = (e)=>{
- if (!(0, $1LpUN.eventShouldStartDrag)(e)) return;
- const delay = e.type === $d5239d2bfab118fb$var$eventNames.touch.start ? this.options.delayTouchStart : this.options.delayMouseStart;
- this.timeout = setTimeout(this.handleTopMoveStart.bind(this, e), delay);
- this.waitingForDelay = true;
- };
- this.handleTopMoveCapture = ()=>{
- this.dragOverTargetIds = [];
- };
- this.handleMove = (_evt, targetId)=>{
- if (this.dragOverTargetIds) this.dragOverTargetIds.unshift(targetId);
- };
- this.handleTopMove = (e1)=>{
- if (this.timeout) clearTimeout(this.timeout);
- if (!this.document || this.waitingForDelay) return;
- const { moveStartSourceIds: moveStartSourceIds, dragOverTargetIds: dragOverTargetIds } = this;
- const enableHoverOutsideTarget = this.options.enableHoverOutsideTarget;
- const clientOffset = (0, $aE4QR.getEventClientOffset)(e1, this.lastTargetTouchFallback);
- if (!clientOffset) return;
- // If the touch move started as a scroll, or is is between the scroll angles
- if (this._isScrolling || !this.monitor.isDragging() && (0, $ebJc7.inAngleRanges)(this._mouseClientOffset.x || 0, this._mouseClientOffset.y || 0, clientOffset.x, clientOffset.y, this.options.scrollAngleRanges)) {
- this._isScrolling = true;
- return;
- }
- // If we're not dragging and we've moved a little, that counts as a drag start
- if (!this.monitor.isDragging() && // eslint-disable-next-line no-prototype-builtins
- this._mouseClientOffset.hasOwnProperty("x") && moveStartSourceIds && (0, $ebJc7.distance)(this._mouseClientOffset.x || 0, this._mouseClientOffset.y || 0, clientOffset.x, clientOffset.y) > (this.options.touchSlop ? this.options.touchSlop : 0)) {
- this.moveStartSourceIds = undefined;
- this.actions.beginDrag(moveStartSourceIds, {
- clientOffset: this._mouseClientOffset,
- getSourceClientOffset: this.getSourceClientOffset,
- publishSource: false
- });
- }
- if (!this.monitor.isDragging()) return;
- const sourceNode = this.sourceNodes.get(this.monitor.getSourceId());
- this.installSourceNodeRemovalObserver(sourceNode);
- this.actions.publishDragSource();
- if (e1.cancelable) e1.preventDefault();
- // Get the node elements of the hovered DropTargets
- const dragOverTargetNodes = (dragOverTargetIds || []).map((key)=>this.targetNodes.get(key)).filter((e)=>!!e);
- // Get the a ordered list of nodes that are touched by
- const elementsAtPoint = this.options.getDropTargetElementsAtPoint ? this.options.getDropTargetElementsAtPoint(clientOffset.x, clientOffset.y, dragOverTargetNodes) : this.document.elementsFromPoint(clientOffset.x, clientOffset.y);
- // Extend list with parents that are not receiving elementsFromPoint events (size 0 elements and svg groups)
- const elementsAtPointExtended = [];
- for(const nodeId in elementsAtPoint){
- // eslint-disable-next-line no-prototype-builtins
- if (!elementsAtPoint.hasOwnProperty(nodeId)) continue;
- let currentNode = elementsAtPoint[nodeId];
- if (currentNode != null) elementsAtPointExtended.push(currentNode);
- while(currentNode){
- currentNode = currentNode.parentElement;
- if (currentNode && elementsAtPointExtended.indexOf(currentNode) === -1) elementsAtPointExtended.push(currentNode);
- }
- }
- const orderedDragOverTargetIds = elementsAtPointExtended // Filter off nodes that arent a hovered DropTargets nodes
- .filter((node)=>dragOverTargetNodes.indexOf(node) > -1) // Map back the nodes elements to targetIds
- .map((node)=>this._getDropTargetId(node)) // Filter off possible null rows
- .filter((node)=>!!node).filter((id, index, ids)=>ids.indexOf(id) === index);
- // Invoke hover for drop targets when source node is still over and pointer is outside
- if (enableHoverOutsideTarget) for(const targetId in this.targetNodes){
- const targetNode = this.targetNodes.get(targetId);
- if (sourceNode && targetNode && targetNode.contains(sourceNode) && orderedDragOverTargetIds.indexOf(targetId) === -1) {
- orderedDragOverTargetIds.unshift(targetId);
- break;
- }
- }
- // Reverse order because dnd-core reverse it before calling the DropTarget drop methods
- orderedDragOverTargetIds.reverse();
- this.actions.hover(orderedDragOverTargetIds, {
- clientOffset: clientOffset
- });
- };
- /**
- *
- * visible for testing
- */ this._getDropTargetId = (node)=>{
- const keys = this.targetNodes.keys();
- let next = keys.next();
- while(next.done === false){
- const targetId = next.value;
- if (node === this.targetNodes.get(targetId)) return targetId;
- else next = keys.next();
- }
- return undefined;
- };
- this.handleTopMoveEndCapture = (e)=>{
- this._isScrolling = false;
- this.lastTargetTouchFallback = undefined;
- if (!(0, $1LpUN.eventShouldEndDrag)(e)) return;
- if (!this.monitor.isDragging() || this.monitor.didDrop()) {
- this.moveStartSourceIds = undefined;
- return;
- }
- if (e.cancelable) e.preventDefault();
- this._mouseClientOffset = {};
- this.uninstallSourceNodeRemovalObserver();
- this.actions.drop();
- this.actions.endDrag();
- };
- this.handleCancelOnEscape = (e)=>{
- if (e.key === "Escape" && this.monitor.isDragging()) {
- this._mouseClientOffset = {};
- this.uninstallSourceNodeRemovalObserver();
- this.actions.endDrag();
- }
- };
- this.options = new (0, $bNoD1.OptionsReader)(options, context);
- this.actions = manager.getActions();
- this.monitor = manager.getMonitor();
- this.sourceNodes = new Map();
- this.sourcePreviewNodes = new Map();
- this.sourcePreviewNodeOptions = new Map();
- this.targetNodes = new Map();
- this.listenerTypes = [];
- this._mouseClientOffset = {};
- this._isScrolling = false;
- if (this.options.enableMouseEvents) this.listenerTypes.push((0, $ja1iH.ListenerType).mouse);
- if (this.options.enableTouchEvents) this.listenerTypes.push((0, $ja1iH.ListenerType).touch);
- if (this.options.enableKeyboardEvents) this.listenerTypes.push((0, $ja1iH.ListenerType).keyboard);
- }
-}
-
-});
-parcelRegister("ja1iH", function(module, exports) {
-
-$parcel$export(module.exports, "ListenerType", () => $df2ff5bf2ad802c0$export$77315d8e4e38ac8f);
-var $df2ff5bf2ad802c0$export$77315d8e4e38ac8f;
-(function(ListenerType) {
- ListenerType["mouse"] = "mouse";
- ListenerType["touch"] = "touch";
- ListenerType["keyboard"] = "keyboard";
-})($df2ff5bf2ad802c0$export$77315d8e4e38ac8f || ($df2ff5bf2ad802c0$export$77315d8e4e38ac8f = {}));
-
-});
-
-parcelRegister("bNoD1", function(module, exports) {
-
-$parcel$export(module.exports, "OptionsReader", () => $896760011f02795c$export$2b3a268803e49e64);
-class $896760011f02795c$export$2b3a268803e49e64 {
- get delay() {
- var _delay;
- return (_delay = this.args.delay) !== null && _delay !== void 0 ? _delay : 0;
- }
- get scrollAngleRanges() {
- return this.args.scrollAngleRanges;
- }
- get getDropTargetElementsAtPoint() {
- return this.args.getDropTargetElementsAtPoint;
- }
- get ignoreContextMenu() {
- var _ignoreContextMenu;
- return (_ignoreContextMenu = this.args.ignoreContextMenu) !== null && _ignoreContextMenu !== void 0 ? _ignoreContextMenu : false;
- }
- get enableHoverOutsideTarget() {
- var _enableHoverOutsideTarget;
- return (_enableHoverOutsideTarget = this.args.enableHoverOutsideTarget) !== null && _enableHoverOutsideTarget !== void 0 ? _enableHoverOutsideTarget : false;
- }
- get enableKeyboardEvents() {
- var _enableKeyboardEvents;
- return (_enableKeyboardEvents = this.args.enableKeyboardEvents) !== null && _enableKeyboardEvents !== void 0 ? _enableKeyboardEvents : false;
- }
- get enableMouseEvents() {
- var _enableMouseEvents;
- return (_enableMouseEvents = this.args.enableMouseEvents) !== null && _enableMouseEvents !== void 0 ? _enableMouseEvents : false;
- }
- get enableTouchEvents() {
- var _enableTouchEvents;
- return (_enableTouchEvents = this.args.enableTouchEvents) !== null && _enableTouchEvents !== void 0 ? _enableTouchEvents : true;
- }
- get touchSlop() {
- return this.args.touchSlop || 0;
- }
- get delayTouchStart() {
- var ref, ref1;
- var ref2, ref3;
- return (ref3 = (ref2 = (ref = this.args) === null || ref === void 0 ? void 0 : ref.delayTouchStart) !== null && ref2 !== void 0 ? ref2 : (ref1 = this.args) === null || ref1 === void 0 ? void 0 : ref1.delay) !== null && ref3 !== void 0 ? ref3 : 0;
- }
- get delayMouseStart() {
- var ref, ref4;
- var ref5, ref6;
- return (ref6 = (ref5 = (ref = this.args) === null || ref === void 0 ? void 0 : ref.delayMouseStart) !== null && ref5 !== void 0 ? ref5 : (ref4 = this.args) === null || ref4 === void 0 ? void 0 : ref4.delay) !== null && ref6 !== void 0 ? ref6 : 0;
- }
- get window() {
- if (this.context && this.context.window) return this.context.window;
- else if (typeof window !== "undefined") return window;
- return undefined;
- }
- get document() {
- var ref;
- if ((ref = this.context) === null || ref === void 0 ? void 0 : ref.document) return this.context.document;
- if (this.window) return this.window.document;
- return undefined;
- }
- get rootElement() {
- var ref;
- return ((ref = this.args) === null || ref === void 0 ? void 0 : ref.rootElement) || this.document;
- }
- constructor(args, context){
- this.args = args;
- this.context = context;
- }
-}
-
-});
-
-parcelRegister("ebJc7", function(module, exports) {
-
-$parcel$export(module.exports, "distance", () => $a545266f96d0c06d$export$9f17032d917177de);
-$parcel$export(module.exports, "inAngleRanges", () => $a545266f96d0c06d$export$7c909de71a662f4d);
-function $a545266f96d0c06d$export$9f17032d917177de(x1, y1, x2, y2) {
- return Math.sqrt(Math.pow(Math.abs(x2 - x1), 2) + Math.pow(Math.abs(y2 - y1), 2));
-}
-function $a545266f96d0c06d$export$7c909de71a662f4d(x1, y1, x2, y2, angleRanges) {
- if (!angleRanges) return false;
- const angle = Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI + 180;
- for(let i = 0; i < angleRanges.length; ++i){
- const ar = angleRanges[i];
- if (ar && (ar.start == null || angle >= ar.start) && (ar.end == null || angle <= ar.end)) return true;
- }
- return false;
-}
-
-});
-
-parcelRegister("aE4QR", function(module, exports) {
-
-$parcel$export(module.exports, "getNodeClientOffset", () => $7c01673f3302b37c$export$8419e8612027b1d8);
-$parcel$export(module.exports, "getEventClientOffset", () => $7c01673f3302b37c$export$710c829989c68339);
-
-var $1LpUN = parcelRequire("1LpUN");
-const $7c01673f3302b37c$var$ELEMENT_NODE = 1;
-function $7c01673f3302b37c$export$8419e8612027b1d8(node) {
- const el = node.nodeType === $7c01673f3302b37c$var$ELEMENT_NODE ? node : node.parentElement;
- if (!el) return undefined;
- const { top: top, left: left } = el.getBoundingClientRect();
- return {
- x: left,
- y: top
- };
-}
-function $7c01673f3302b37c$export$149d0d89063ea9ba(e, lastTargetTouchFallback) {
- if (e.targetTouches.length === 1) return $7c01673f3302b37c$export$710c829989c68339(e.targetTouches[0]);
- else if (lastTargetTouchFallback && e.touches.length === 1) {
- if (e.touches[0].target === lastTargetTouchFallback.target) return $7c01673f3302b37c$export$710c829989c68339(e.touches[0]);
- }
- return;
-}
-function $7c01673f3302b37c$export$710c829989c68339(e, lastTargetTouchFallback) {
- if ((0, $1LpUN.isTouchEvent)(e)) return $7c01673f3302b37c$export$149d0d89063ea9ba(e, lastTargetTouchFallback);
- else return {
- x: e.clientX,
- y: e.clientY
- };
-}
-
-});
-parcelRegister("1LpUN", function(module, exports) {
-
-$parcel$export(module.exports, "eventShouldStartDrag", () => $148e487032b5919e$export$c64909add7c8d190);
-$parcel$export(module.exports, "eventShouldEndDrag", () => $148e487032b5919e$export$23bc6ab5d304a5);
-$parcel$export(module.exports, "isTouchEvent", () => $148e487032b5919e$export$c4dfce035d43d1e0);
-// Used for MouseEvent.buttons (note the s on the end).
-const $148e487032b5919e$var$MouseButtons = {
- Left: 1,
- Right: 2,
- Center: 4
-};
-// Used for e.button (note the lack of an s on the end).
-const $148e487032b5919e$var$MouseButton = {
- Left: 0,
- Center: 1,
- Right: 2
-};
-function $148e487032b5919e$export$c64909add7c8d190(e) {
- // For touch events, button will be undefined. If e.button is defined,
- // then it should be MouseButton.Left.
- return e.button === undefined || e.button === $148e487032b5919e$var$MouseButton.Left;
-}
-function $148e487032b5919e$export$23bc6ab5d304a5(e) {
- // Touch events will have buttons be undefined, while mouse events will have e.buttons's left button
- // bit field unset if the left mouse button has been released
- return e.buttons === undefined || (e.buttons & $148e487032b5919e$var$MouseButtons.Left) === 0;
-}
-function $148e487032b5919e$export$c4dfce035d43d1e0(e) {
- return !!e.targetTouches;
-}
-
-});
-
-
-parcelRegister("7EW53", function(module, exports) {
-
-$parcel$export(module.exports, "supportsPassive", () => $5939526cabae8410$export$a8f436d4c8f15a1f);
-const $5939526cabae8410$export$a8f436d4c8f15a1f = (()=>{
- // simular to jQuery's test
- let supported = false;
- try {
- addEventListener("test", ()=>{
- // do nothing
- }, Object.defineProperty({}, "passive", {
- get () {
- supported = true;
- return true;
- }
- }));
- } catch (e) {
- // do nothing
- }
- return supported;
-})();
-
-});
-
-
-
-
-parcelRegister("1ZaBF", function(module, exports) {
-
-$parcel$export(module.exports, "ETreeItemAction", () => $86827fb7d04d0129$export$1042a0fe6c1659e9);
-$parcel$export(module.exports, "Adv", () => $86827fb7d04d0129$export$64313ee137b2e153);
-$parcel$export(module.exports, "Rename", () => $86827fb7d04d0129$export$3906fe1689004653);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $emJmR = parcelRequire("emJmR");
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $dJKat = parcelRequire("dJKat");
-
-var $6QgH2 = parcelRequire("6QgH2");
-
-var $521T4 = parcelRequire("521T4");
-
-var $8QizP = parcelRequire("8QizP");
-
-var $8u89v = parcelRequire("8u89v");
-
-var $aVHaH = parcelRequire("aVHaH");
-const $86827fb7d04d0129$export$1042a0fe6c1659e9 = ({ item: item, mode: mode, isComponent: isComponent, isPropContent: isPropContent, rename: rename, node: node, onClick: onClick })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- let link;
- if (mode === "mobile") {
- const mobile = item.mobile;
- link = mobile?.linktag?.link || "";
- } else link = item.linktag?.link || "";
- if (!p.treeMeta[item.id]) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {});
- const mitem = p.treeMeta[item.id].mitem;
- let canDelete = true;
- const rootComponentID = p.comp?.id;
- let isRootComponent = false;
- if (isComponent && rootComponentID && rootComponentID === item.component?.id) {
- isRootComponent = true;
- canDelete = false;
- }
- if (isPropContent) canDelete = false;
- if (!mitem) canDelete = false;
- let resetJSXProp = null;
- if (!isComponent && mitem) resetJSXProp = (0, $8u89v.findDefaultJSX)(p, mitem);
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex action pl-3 items-center w-[100px] justify-end",
- children: [
- !!link && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Has Link",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: "10",
- height: "10",
- viewBox: "0 0 15 15",
- className: "mr-[3px] text-blue-600",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",
- fill: "currentColor"
- })
- })
- }),
- !isComponent && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$export$64313ee137b2e153, {
- item: item,
- p: p,
- node: node,
- onClick: onClick
- }),
- resetJSXProp && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Reset JSX",
- className: cx("text-purple-600 mx-1"),
- onClick: async ()=>{
- if (mitem) {
- const ijson = mitem.toJSON();
- mitem.doc?.transact(()=>{
- mitem.set("childs", new $aVHaH.Array());
- (0, $8QizP.syncronize)(mitem, {
- ...resetJSXProp,
- name: ijson.name,
- id: ijson.id,
- hidden: false,
- originalId: ijson.originalId
- });
- });
- }
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M8.697.04a.5.5 0 01.296.542L8.09 6h4.41a.5.5 0 01.4.8l-6 8a.5.5 0 01-.893-.382L6.91 9H2.5a.5.5 0 01-.4-.8l6-8a.5.5 0 01.597-.16zM3.5 8h4a.5.5 0 01.493.582L7.33 12.56 11.5 7h-4a.5.5 0 01-.493-.582L7.67 2.44 3.5 8z",
- clipRule: "evenodd"
- })
- })
- })
- ]
- }),
- item.hidden === "all" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Hidden: All",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "mx-1",
- onClick: (e)=>{
- e.stopPropagation();
- const mitem = p.treeMeta[item.id];
- if (mitem && mitem.mitem) mitem.mitem.set("hidden", false);
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$var$HideAll, {})
- })
- }),
- item.hidden === "only-editor" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Hidden: Only Editor",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "mx-1",
- onClick: (e)=>{
- e.stopPropagation();
- const mitem = p.treeMeta[item.id];
- if (mitem && mitem.mitem) mitem.mitem.set("hidden", "all");
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$var$HideEditor, {})
- })
- }),
- rootComponentID !== item.id && isComponent && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Edit Component",
- className: "flex items-center border border-slate-500 bg-white rounded-sm text-[10px] px-[2px]",
- onClick: (e)=>{
- e.stopPropagation();
- (0, $5NYeV.editComp)(p, item.id);
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: "Edit"
- })
- })
- }),
- canDelete && (!isComponent || isComponent && isRootComponent) && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Rename",
- className: "flex items-center p-1 h-full text-blue-700",
- onClick: rename,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$export$3906fe1689004653, {})
- }),
- canDelete && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Duplicate",
- className: "flex items-center p-1 pr-[2px] h-full text-green-700",
- onClick: ()=>{
- if (mitem) mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- const map = (0, $6QgH2.newMap)((0, $dJKat.fillID)(json, (e)=>{
- e.originalId = (0, $521T4.createId)();
- return true;
- }));
- mitem.parent.insert(idx, [
- map
- ]);
- }
- });
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$var$Copy, {})
- })
- }),
- canDelete && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Delete",
- className: "flex items-center p-1 h-full text-red-700",
- onClick: ()=>{
- if (mitem) mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- const map = (0, $6QgH2.newMap)((0, $dJKat.fillID)(json));
- mitem.parent.delete(idx);
- }
- });
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($86827fb7d04d0129$var$Trash, {})
- })
- })
- ]
- });
-};
-const $86827fb7d04d0129$export$64313ee137b2e153 = ({ item: item, p: p, onClick: onClick, node: node })=>{
- const adv = {
- ...item.adv
- };
- const openEditor = (mode)=>{
- p.script.type = mode;
- p.script.active = true;
- onClick(node);
- p.render();
- };
- return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- !!adv.css ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Has CSS",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-green-700 w-[7px] h-[7px] mr-[3px] hover:bg-green-900",
- onClick: (e)=>{
- e.stopPropagation();
- e.preventDefault();
- openEditor("css");
- }
- })
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Click to add CSS",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "pre-action flex items-center",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-green-500 w-[7px] h-[7px] mr-[3px] hover:bg-green-800 opacity-50 hover:opacity-100",
- onClick: (e)=>{
- e.stopPropagation();
- e.preventDefault();
- openEditor("css");
- }
- })
- })
- }),
- !!adv.js && !adv.html ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Has JS",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-orange-600 w-[7px] h-[7px] mr-[3px] hover:bg-orange-800",
- onClick: (e)=>{
- e.stopPropagation();
- e.preventDefault();
- openEditor("js");
- }
- })
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Click to add JS",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "pre-action flex items-center",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: " bg-orange-500 w-[7px] h-[7px] mr-[3px] hover:bg-orange-800 opacity-50 hover:opacity-100 self-center",
- onClick: (e)=>{
- e.stopPropagation();
- e.preventDefault();
- openEditor("js");
- }
- })
- })
- }),
- !!adv.html && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Has HTML",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-blue-600 w-[7px] h-[7px] mr-[3px] hover:bg-blue-800",
- onClick: (e)=>{
- e.stopPropagation();
- e.preventDefault();
- openEditor("html");
- }
- })
- })
- ]
- });
-};
-const $86827fb7d04d0129$var$actionSize = 13;
-const $86827fb7d04d0129$var$Copy = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: $86827fb7d04d0129$var$actionSize,
- height: $86827fb7d04d0129$var$actionSize,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })
- });
-const $86827fb7d04d0129$var$Trash = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: $86827fb7d04d0129$var$actionSize,
- height: $86827fb7d04d0129$var$actionSize,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M5.5 1a.5.5 0 000 1h4a.5.5 0 000-1h-4zM3 3.5a.5.5 0 01.5-.5h8a.5.5 0 010 1H11v8a1 1 0 01-1 1H5a1 1 0 01-1-1V4h-.5a.5.5 0 01-.5-.5zM5 4h5v8H5V4z",
- clipRule: "evenodd"
- })
- });
-const $86827fb7d04d0129$export$3906fe1689004653 = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: $86827fb7d04d0129$var$actionSize,
- height: $86827fb7d04d0129$var$actionSize,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M6.5 1C6.22386 1 6 1.22386 6 1.5C6 1.77614 6.22386 2 6.5 2C7.12671 2 7.45718 2.20028 7.65563 2.47812C7.8781 2.78957 8 3.28837 8 4V11C8 11.7116 7.8781 12.2104 7.65563 12.5219C7.45718 12.7997 7.12671 13 6.5 13C6.22386 13 6 13.2239 6 13.5C6 13.7761 6.22386 14 6.5 14C7.37329 14 8.04282 13.7003 8.46937 13.1031C8.47976 13.0886 8.48997 13.0739 8.5 13.0591C8.51003 13.0739 8.52024 13.0886 8.53063 13.1031C8.95718 13.7003 9.62671 14 10.5 14C10.7761 14 11 13.7761 11 13.5C11 13.2239 10.7761 13 10.5 13C9.87329 13 9.54282 12.7997 9.34437 12.5219C9.1219 12.2104 9 11.7116 9 11V4C9 3.28837 9.1219 2.78957 9.34437 2.47812C9.54282 2.20028 9.87329 2 10.5 2C10.7761 2 11 1.77614 11 1.5C11 1.22386 10.7761 1 10.5 1C9.62671 1 8.95718 1.29972 8.53063 1.89688C8.52024 1.91143 8.51003 1.92611 8.5 1.9409C8.48997 1.92611 8.47976 1.91143 8.46937 1.89688C8.04282 1.29972 7.37329 1 6.5 1ZM14 5H11V4H14C14.5523 4 15 4.44772 15 5V10C15 10.5523 14.5523 11 14 11H11V10H14V5ZM6 4V5H1L1 10H6V11H1C0.447715 11 0 10.5523 0 10V5C0 4.44772 0.447715 4 1 4H6Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })
- });
-const $86827fb7d04d0129$var$HideEditor = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: "13",
- height: "13",
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M14.7649 6.07596C14.9991 6.22231 15.0703 6.53079 14.9239 6.76495C14.4849 7.46743 13.9632 8.10645 13.3702 8.66305L14.5712 9.86406C14.7664 10.0593 14.7664 10.3759 14.5712 10.5712C14.3759 10.7664 14.0593 10.7664 13.8641 10.5712L12.6011 9.30817C11.805 9.90283 10.9089 10.3621 9.93375 10.651L10.383 12.3277C10.4544 12.5944 10.2961 12.8685 10.0294 12.94C9.76267 13.0115 9.4885 12.8532 9.41704 12.5865L8.95917 10.8775C8.48743 10.958 8.00036 10.9999 7.50001 10.9999C6.99965 10.9999 6.51257 10.958 6.04082 10.8775L5.58299 12.5864C5.51153 12.8532 5.23737 13.0115 4.97064 12.94C4.7039 12.8686 4.5456 12.5944 4.61706 12.3277L5.06625 10.651C4.09111 10.3621 3.19503 9.90282 2.3989 9.30815L1.1359 10.5712C0.940638 10.7664 0.624058 10.7664 0.428798 10.5712C0.233537 10.3759 0.233537 10.0593 0.428798 9.86405L1.62982 8.66303C1.03682 8.10643 0.515113 7.46742 0.0760677 6.76495C-0.0702867 6.53079 0.000898544 6.22231 0.235065 6.07596C0.469231 5.9296 0.777703 6.00079 0.924058 6.23496C1.40354 7.00213 1.989 7.68057 2.66233 8.2427C2.67315 8.25096 2.6837 8.25972 2.69397 8.26898C4.00897 9.35527 5.65537 9.99991 7.50001 9.99991C10.3078 9.99991 12.6564 8.5063 14.076 6.23495C14.2223 6.00079 14.5308 5.9296 14.7649 6.07596Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })
- });
-const $86827fb7d04d0129$var$HideAll = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: "13",
- height: "13",
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })
- });
-
-});
-
-parcelRegister("4btpI", function(module, exports) {
-
-$parcel$export(module.exports, "ETreeItem", () => $419ce602944f6032$export$8f388e2a07401196);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $9qryY = parcelRequire("9qryY");
-
-var $bVY3H = parcelRequire("bVY3H");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $emJmR = parcelRequire("emJmR");
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $1ZaBF = parcelRequire("1ZaBF");
-
-var $HeXsJ = parcelRequire("HeXsJ");
-
-var $fZImH = parcelRequire("fZImH");
-
-var $6j5bw = parcelRequire("6j5bw");
-const $419ce602944f6032$export$8f388e2a07401196 = ({ node: node, depth: depth, onToggle: onToggle, isOpen: isOpen, onHover: onHover, onClick: onClick, isActive: isActive, isHover: isHover, onRightClick: onRightClick, mode: mode, editCompId: editCompId })=>{
- if (!node.data) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {});
- const local = (0, $4WfNn.useLocal)({
- renaming: false,
- el: null
- });
- const dragOverProps = (0, $9qryY.useDragOver)(node.id, isOpen, onToggle);
- const item = node.data.meta.item;
- const type = item.type;
- let childs = item.type === "text" ? [] : item.childs;
- let hasChilds = false;
- if (childs && childs.length > 0) hasChilds = true;
- let itemName = item.name;
- let isComponent = !!item.component?.id;
- let isRootComponent = false;
- if (isComponent && item.component?.id === editCompId) {
- isRootComponent = true;
- isComponent = false;
- }
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- (0, $63SH6.useEffect)(()=>{
- if (isActive && local.el && !p.preventTreeScroll) local.el.scrollIntoView();
- if (p.preventTreeScroll) p.preventTreeScroll = false;
- }, [
- isActive
- ]);
- let isSelect = (0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))(p.item.selection, (e)=>e === item.id) ? true : false;
- let loading = !!p.compLoading[item.id];
- if (isComponent) {
- hasChilds = false;
- const id = item.component?.id;
- if (id) {
- const comp = p.comps.doc[id];
- if (!comp) {
- p.compLoading[item.id] = true;
- loading = !!p.compLoading[item.id];
- (0, $5NYeV.loadComponent)(p, id).then(()=>{
- delete p.compLoading[item.id];
- local.render();
- });
- } else {
- const props = comp.getMap("map").get("content_tree")?.get("component")?.get("props")?.toJSON();
- if (props) {
- if (Object.values(props).filter((e)=>e.meta?.type === "content-element").length > 0) hasChilds = true;
- }
- }
- }
- }
- let isPropContent = false;
- const meta = p.treeMeta[item.id];
- if (!meta) return null;
- const mitem = meta.mitem;
- if (mitem && mitem.parent.get("content")) isPropContent = true;
- if (!mitem) return null;
- isRootComponent;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- placement: "right",
- content: $419ce602944f6032$var$bytesToHumanFileSize(JSON.stringify(item).length),
- className: (0, $6j5bw.treeItemStyle)({
- isActive: isActive || p.item.selection.includes(item.id),
- isHover: isHover,
- isComponent: isComponent,
- isSelect: isSelect
- }),
- delay: 0,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-1",
- onClick: ()=>onClick(node),
- onPointerOver: ()=>onHover(node),
- onContextMenu: (e)=>{
- onRightClick(node, e);
- },
- ref: (e)=>{
- local.el = e;
- },
- ...dragOverProps,
- children: loading ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- backdrop: false
- }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $HeXsJ.ETreeItemIndent), {
- depth: depth,
- onToggle: ()=>{
- if (hasChilds) onToggle();
- else onClick(node);
- },
- type: type,
- mitem: mitem,
- isOpen: isOpen,
- onClick: onClick,
- node: node,
- hasChilds: hasChilds,
- isActive: isActive || p.item.selection.includes(item.id),
- isComponent: isComponent
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $fZImH.ETreeItemName), {
- item: item,
- name: itemName,
- renaming: local.renaming,
- isComponent: isComponent,
- doneRenaming: ()=>{
- local.renaming = false;
- local.render();
- }
- }),
- !local.renaming && (!isRootComponent ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1ZaBF.ETreeItemAction), {
- isComponent: isComponent,
- isPropContent: isPropContent,
- mode: mode,
- item: item,
- rename: ()=>{
- local.renaming = true;
- local.render();
- },
- node: node,
- onClick: onClick
- }) : /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex items-center",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1ZaBF.Adv), {
- p: p,
- item: item,
- node: node,
- onClick: onClick
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Rename",
- className: "flex items-center p-1 h-full text-blue-700",
- onClick: ()=>{
- local.renaming = true;
- local.render();
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1ZaBF.Rename), {})
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)($419ce602944f6032$var$RootComponentClose, {
- item: item
- })
- ]
- }))
- ]
- })
- })
- });
-};
-const $419ce602944f6032$var$RootComponentClose = ({ item: item })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex items-center border border-slate-500 bg-white rounded-sm text-[10px] px-[5px] m-1 opacity-50 hover:opacity-100",
- onClick: (e)=>{
- e.stopPropagation();
- (0, $5NYeV.closeEditComp)(p);
- },
- children: p.comp?.last && p.comp?.last.length === 1 ? "Close" : "Back"
- })
- });
-};
-function $419ce602944f6032$var$bytesToHumanFileSize(bytes) {
- const sizes = [
- "bytes",
- "KB",
- "MB",
- "GB",
- "TB"
- ];
- if (bytes === 0) return "0 bytes";
- const i = Math.floor(Math.log(bytes) / Math.log(1024));
- const size = i === 0 ? bytes : (bytes / Math.pow(1024, i)).toFixed(2);
- return `${size} ${sizes[i]}`;
-}
-
-});
-parcelRegister("bVY3H", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200;
-/** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = "Expected a function";
-/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__";
-/** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2;
-/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0;
-/** `Object#toString` result references. */ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
-var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
-/** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g;
-/** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g;
-/** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
-/** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i;
-/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/;
-/** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i;
-/** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/;
-/** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {};
-typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
-typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
-/** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt;
-/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")();
-/** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports;
-/** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module;
-/** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports;
-/** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process;
-/** Used to access faster Node.js helpers. */ var nodeUtil = function() {
- try {
- return freeProcess && freeProcess.binding("util");
- } catch (e) {}
-}();
-/* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
-/**
- * A specialized version of `_.some` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */ function arraySome(array, predicate) {
- var index = -1, length = array ? array.length : 0;
- while(++index < length){
- if (predicate(array[index], index, array)) return true;
- }
- return false;
-}
-/**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while(fromRight ? index-- : ++index < length){
- if (predicate(array[index], index, array)) return index;
- }
- return -1;
-}
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */ function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while(++index < n)result[index] = iteratee(index);
- return result;
-}
-/**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */ function baseUnary(func) {
- return function(value) {
- return func(value);
- };
-}
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */ function getValue(object, key) {
- return object == null ? undefined : object[key];
-}
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */ function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != "function") try {
- result = !!(value + "");
- } catch (e) {}
- return result;
-}
-/**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */ function mapToArray(map) {
- var index = -1, result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [
- key,
- value
- ];
- });
- return result;
-}
-/**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */ function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
-}
-/**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */ function setToArray(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
-}
-/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
-/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"];
-/** Used to detect methods masquerading as native. */ var maskSrcKey = function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
-}();
-/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString;
-/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var objectToString = objectProto.toString;
-/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
-/** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
-/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max;
-/* Built-in method references that are verified to be native. */ var DataView = getNative(root, "DataView"), Map = getNative(root, "Map"), Promise = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
-/** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
-/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Hash(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */ function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
-}
-/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
-}
-/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */ function hashSet(key, value) {
- var data = this.__data__;
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-Hash.prototype.clear = hashClear;
-Hash.prototype["delete"] = hashDelete;
-Hash.prototype.get = hashGet;
-Hash.prototype.has = hashHas;
-Hash.prototype.set = hashSet;
-/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function ListCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */ function listCacheClear() {
- this.__data__ = [];
-}
-/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function listCacheDelete(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) return false;
- var lastIndex = data.length - 1;
- if (index == lastIndex) data.pop();
- else splice.call(data, index, 1);
- return true;
-}
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function listCacheGet(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
-}
-/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */ function listCacheSet(key, value) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) data.push([
- key,
- value
- ]);
- else data[index][1] = value;
- return this;
-}
-// Add methods to `ListCache`.
-ListCache.prototype.clear = listCacheClear;
-ListCache.prototype["delete"] = listCacheDelete;
-ListCache.prototype.get = listCacheGet;
-ListCache.prototype.has = listCacheHas;
-ListCache.prototype.set = listCacheSet;
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function MapCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */ function mapCacheClear() {
- this.__data__ = {
- "hash": new Hash,
- "map": new (Map || ListCache),
- "string": new Hash
- };
-}
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function mapCacheDelete(key) {
- return getMapData(this, key)["delete"](key);
-}
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function mapCacheGet(key) {
- return getMapData(this, key).get(key);
-}
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function mapCacheHas(key) {
- return getMapData(this, key).has(key);
-}
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */ function mapCacheSet(key, value) {
- getMapData(this, key).set(key, value);
- return this;
-}
-// Add methods to `MapCache`.
-MapCache.prototype.clear = mapCacheClear;
-MapCache.prototype["delete"] = mapCacheDelete;
-MapCache.prototype.get = mapCacheGet;
-MapCache.prototype.has = mapCacheHas;
-MapCache.prototype.set = mapCacheSet;
-/**
- *
- * Creates an array cache object to store unique values.
- *
- * @private
- * @constructor
- * @param {Array} [values] The values to cache.
- */ function SetCache(values) {
- var index = -1, length = values ? values.length : 0;
- this.__data__ = new MapCache;
- while(++index < length)this.add(values[index]);
-}
-/**
- * Adds `value` to the array cache.
- *
- * @private
- * @name add
- * @memberOf SetCache
- * @alias push
- * @param {*} value The value to cache.
- * @returns {Object} Returns the cache instance.
- */ function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
-}
-/**
- * Checks if `value` is in the array cache.
- *
- * @private
- * @name has
- * @memberOf SetCache
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
- */ function setCacheHas(value) {
- return this.__data__.has(value);
-}
-// Add methods to `SetCache`.
-SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
-SetCache.prototype.has = setCacheHas;
-/**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Stack(entries) {
- this.__data__ = new ListCache(entries);
-}
-/**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */ function stackClear() {
- this.__data__ = new ListCache;
-}
-/**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function stackDelete(key) {
- return this.__data__["delete"](key);
-}
-/**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function stackGet(key) {
- return this.__data__.get(key);
-}
-/**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function stackHas(key) {
- return this.__data__.has(key);
-}
-/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */ function stackSet(key, value) {
- var cache = this.__data__;
- if (cache instanceof ListCache) {
- var pairs = cache.__data__;
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
- pairs.push([
- key,
- value
- ]);
- return this;
- }
- cache = this.__data__ = new MapCache(pairs);
- }
- cache.set(key, value);
- return this;
-}
-// Add methods to `Stack`.
-Stack.prototype.clear = stackClear;
-Stack.prototype["delete"] = stackDelete;
-Stack.prototype.get = stackGet;
-Stack.prototype.has = stackHas;
-Stack.prototype.set = stackSet;
-/**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */ function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
- var length = result.length, skipIndexes = !!length;
- for(var key in value)if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) result.push(key);
- return result;
-}
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function assocIndexOf(array, key) {
- var length = array.length;
- while(length--){
- if (eq(array[length][0], key)) return length;
- }
- return -1;
-}
-/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */ function baseGet(object, path) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var index = 0, length = path.length;
- while(object != null && index < length)object = object[toKey(path[index++])];
- return index && index == length ? object : undefined;
-}
-/**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ function baseGetTag(value) {
- return objectToString.call(value);
-}
-/**
- * The base implementation of `_.hasIn` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */ function baseHasIn(object, key) {
- return object != null && key in Object(object);
-}
-/**
- * The base implementation of `_.isEqual` which supports partial comparisons
- * and tracks traversed objects.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {boolean} [bitmask] The bitmask of comparison flags.
- * The bitmask may be composed of the following flags:
- * 1 - Unordered comparison
- * 2 - Partial comparison
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */ function baseIsEqual(value, other, customizer, bitmask, stack) {
- if (value === other) return true;
- if (value == null || other == null || !isObject(value) && !isObjectLike(other)) return value !== value && other !== other;
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
-}
-/**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag;
- if (!objIsArr) {
- objTag = getTag(object);
- objTag = objTag == argsTag ? objectTag : objTag;
- }
- if (!othIsArr) {
- othTag = getTag(other);
- othTag = othTag == argsTag ? objectTag : othTag;
- }
- var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack);
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
- }
- if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack);
- return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
- }
- }
- if (!isSameTag) return false;
- stack || (stack = new Stack);
- return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
-}
-/**
- * The base implementation of `_.isMatch` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @param {Array} matchData The property names, values, and compare flags to match.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- */ function baseIsMatch(object, source, matchData, customizer) {
- var index = matchData.length, length = index, noCustomizer = !customizer;
- if (object == null) return !length;
- object = Object(object);
- while(index--){
- var data = matchData[index];
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
- }
- while(++index < length){
- data = matchData[index];
- var key = data[0], objValue = object[key], srcValue = data[1];
- if (noCustomizer && data[2]) {
- if (objValue === undefined && !(key in object)) return false;
- } else {
- var stack = new Stack;
- if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
- if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) return false;
- }
- }
- return true;
-}
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */ function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) return false;
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
-}
-/**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */ function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
-}
-/**
- * The base implementation of `_.iteratee`.
- *
- * @private
- * @param {*} [value=_.identity] The value to convert to an iteratee.
- * @returns {Function} Returns the iteratee.
- */ function baseIteratee(value) {
- // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
- // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
- if (typeof value == "function") return value;
- if (value == null) return identity;
- if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
- return property(value);
-}
-/**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */ function baseKeys(object) {
- if (!isPrototype(object)) return nativeKeys(object);
- var result = [];
- for(var key in Object(object))if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key);
- return result;
-}
-/**
- * The base implementation of `_.matches` which doesn't clone `source`.
- *
- * @private
- * @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatches(source) {
- var matchData = getMatchData(source);
- if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
- return function(object) {
- return object === source || baseIsMatch(object, source, matchData);
- };
-}
-/**
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
- *
- * @private
- * @param {string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatchesProperty(path, srcValue) {
- if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
- return function(object) {
- var objValue = get(object, path);
- return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
- };
-}
-/**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function basePropertyDeep(path) {
- return function(object) {
- return baseGet(object, path);
- };
-}
-/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */ function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == "string") return value;
- if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */ function castPath(value) {
- return isArray(value) ? value : stringToPath(value);
-}
-/**
- * Creates a `_.find` or `_.findLast` function.
- *
- * @private
- * @param {Function} findIndexFunc The function to find the collection index.
- * @returns {Function} Returns the new find function.
- */ function createFind(findIndexFunc) {
- return function(collection, predicate, fromIndex) {
- var iterable = Object(collection);
- if (!isArrayLike(collection)) {
- var iteratee = baseIteratee(predicate, 3);
- collection = keys(collection);
- predicate = function(key) {
- return iteratee(iterable[key], key, iterable);
- };
- }
- var index = findIndexFunc(collection, predicate, fromIndex);
- return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
- };
-}
-/**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `array` and `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(array);
- if (stacked && stack.get(other)) return stacked == other;
- var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache : undefined;
- stack.set(array, other);
- stack.set(other, array);
- // Ignore non-index properties.
- while(++index < arrLength){
- var arrValue = array[index], othValue = other[index];
- if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
- if (compared !== undefined) {
- if (compared) continue;
- result = false;
- break;
- }
- // Recursively compare arrays (susceptible to call stack limits).
- if (seen) {
- if (!arraySome(other, function(othValue, othIndex) {
- if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) return seen.add(othIndex);
- })) {
- result = false;
- break;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
- result = false;
- break;
- }
- }
- stack["delete"](array);
- stack["delete"](other);
- return result;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
- switch(tag){
- case dataViewTag:
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
- object = object.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false;
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- // Coerce booleans to `1` or `0` and dates to milliseconds.
- // Invalid dates are coerced to `NaN`.
- return eq(+object, +other);
- case errorTag:
- return object.name == other.name && object.message == other.message;
- case regexpTag:
- case stringTag:
- // Coerce regexes to strings and treat strings, primitives and objects,
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
- // for more details.
- return object == other + "";
- case mapTag:
- var convert = mapToArray;
- case setTag:
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
- convert || (convert = setToArray);
- if (object.size != other.size && !isPartial) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked) return stacked == other;
- bitmask |= UNORDERED_COMPARE_FLAG;
- // Recursively compare objects (susceptible to call stack limits).
- stack.set(object, other);
- var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
- stack["delete"](object);
- return result;
- case symbolTag:
- if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- return false;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
- if (objLength != othLength && !isPartial) return false;
- var index = objLength;
- while(index--){
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false;
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked && stack.get(other)) return stacked == other;
- var result = true;
- stack.set(object, other);
- stack.set(other, object);
- var skipCtor = isPartial;
- while(++index < objLength){
- key = objProps[index];
- var objValue = object[key], othValue = other[key];
- if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
- // Recursively compare objects (susceptible to call stack limits).
- if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == "constructor");
- }
- if (result && !skipCtor) {
- var objCtor = object.constructor, othCtor = other.constructor;
- // Non `Object` object instances with different constructors are not equal.
- if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
- }
- stack["delete"](object);
- stack["delete"](other);
- return result;
-}
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */ function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
-}
-/**
- * Gets the property names, values, and compare flags of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the match data of `object`.
- */ function getMatchData(object) {
- var result = keys(object), length = result.length;
- while(length--){
- var key = result[length], value = object[key];
- result[length] = [
- key,
- value,
- isStrictComparable(value)
- ];
- }
- return result;
-}
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */ function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
-}
-/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ var getTag = baseGetTag;
-// Fallback for data views, maps, sets, and weak maps in IE 11,
-// for data views in Edge < 14, and promises in Node.js.
-if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap && getTag(new WeakMap) != weakMapTag) getTag = function(value) {
- var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) switch(ctorString){
- case dataViewCtorString:
- return dataViewTag;
- case mapCtorString:
- return mapTag;
- case promiseCtorString:
- return promiseTag;
- case setCtorString:
- return setTag;
- case weakMapCtorString:
- return weakMapTag;
- }
- return result;
-};
-/**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */ function hasPath(object, path, hasFunc) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var result, index = -1, length = path.length;
- while(++index < length){
- var key = toKey(path[index]);
- if (!(result = object != null && hasFunc(object, key))) break;
- object = object[key];
- }
- if (result) return result;
- var length = object ? object.length : 0;
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
-}
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */ function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
-}
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */ function isKey(value, object) {
- if (isArray(value)) return false;
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
-}
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */ function isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
-}
-/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */ function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
-}
-/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */ function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
-}
-/**
- * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` if suitable for strict
- * equality comparisons, else `false`.
- */ function isStrictComparable(value) {
- return value === value && !isObject(value);
-}
-/**
- * A specialized version of `matchesProperty` for source values suitable
- * for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function matchesStrictComparable(key, srcValue) {
- return function(object) {
- if (object == null) return false;
- return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
- };
-}
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */ var stringToPath = memoize(function(string) {
- string = toString(string);
- var result = [];
- if (reLeadingDot.test(string)) result.push("");
- string.replace(rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace(reEscapeChar, "$1") : number || match);
- });
- return result;
-});
-/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */ function toKey(value) {
- if (typeof value == "string" || isSymbol(value)) return value;
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */ function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return func + "";
- } catch (e) {}
- }
- return "";
-}
-/**
- * This method is like `_.find` except that it returns the index of the first
- * element `predicate` returns truthy for instead of the element itself.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the found element, else `-1`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.findIndex(users, function(o) { return o.user == 'barney'; });
- * // => 0
- *
- * // The `_.matches` iteratee shorthand.
- * _.findIndex(users, { 'user': 'fred', 'active': false });
- * // => 1
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findIndex(users, ['active', false]);
- * // => 0
- *
- * // The `_.property` iteratee shorthand.
- * _.findIndex(users, 'active');
- * // => 2
- */ function findIndex(array, predicate, fromIndex) {
- var length = array ? array.length : 0;
- if (!length) return -1;
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) index = nativeMax(length + index, 0);
- return baseFindIndex(array, baseIteratee(predicate, 3), index);
-}
-/**
- * Iterates over elements of `collection`, returning the first element
- * `predicate` returns truthy for. The predicate is invoked with three
- * arguments: (value, index|key, collection).
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {*} Returns the matched element, else `undefined`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false },
- * { 'user': 'pebbles', 'age': 1, 'active': true }
- * ];
- *
- * _.find(users, function(o) { return o.age < 40; });
- * // => object for 'barney'
- *
- * // The `_.matches` iteratee shorthand.
- * _.find(users, { 'age': 1, 'active': true });
- * // => object for 'pebbles'
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.find(users, ['active', false]);
- * // => object for 'fred'
- *
- * // The `_.property` iteratee shorthand.
- * _.find(users, 'active');
- * // => object for 'barney'
- */ var find = createFind(findIndex);
-/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */ function memoize(func, resolver) {
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) return cache.get(key);
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result);
- return result;
- };
- memoized.cache = new (memoize.Cache || MapCache);
- return memoized;
-}
-// Assign cache to `_.memoize`.
-memoize.Cache = MapCache;
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */ function eq(value, other) {
- return value === other || value !== value && other !== other;
-}
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */ function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var isArray = Array.isArray;
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */ function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */ function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : "";
- return tag == funcTag || tag == genTag;
-}
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */ function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */ function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
-}
-/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
-/**
- * Converts `value` to a finite number.
- *
- * @static
- * @memberOf _
- * @since 4.12.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted number.
- * @example
- *
- * _.toFinite(3.2);
- * // => 3.2
- *
- * _.toFinite(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toFinite(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toFinite('3.2');
- * // => 3.2
- */ function toFinite(value) {
- if (!value) return value === 0 ? value : 0;
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
-}
-/**
- * Converts `value` to an integer.
- *
- * **Note:** This method is loosely based on
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3.2);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3.2');
- * // => 3
- */ function toInteger(value) {
- var result = toFinite(value), remainder = result % 1;
- return result === result ? remainder ? result - remainder : result : 0;
-}
-/**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */ function toNumber(value) {
- if (typeof value == "number") return value;
- if (isSymbol(value)) return NAN;
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") return value === 0 ? value : +value;
- value = value.replace(reTrim, "");
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
-}
-/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */ function toString(value) {
- return value == null ? "" : baseToString(value);
-}
-/**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is returned in its place.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */ function get(object, path, defaultValue) {
- var result = object == null ? undefined : baseGet(object, path);
- return result === undefined ? defaultValue : result;
-}
-/**
- * Checks if `path` is a direct or inherited property of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.hasIn(object, 'a');
- * // => true
- *
- * _.hasIn(object, 'a.b');
- * // => true
- *
- * _.hasIn(object, ['a', 'b']);
- * // => true
- *
- * _.hasIn(object, 'b');
- * // => false
- */ function hasIn(object, path) {
- return object != null && hasPath(object, path, baseHasIn);
-}
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */ function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
-}
-/**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */ function identity(value) {
- return value;
-}
-/**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': 2 } },
- * { 'a': { 'b': 1 } }
- * ];
- *
- * _.map(objects, _.property('a.b'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
- * // => [1, 2]
- */ function property(path) {
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
-}
-module.exports = find;
-
-});
-
-parcelRegister("HeXsJ", function(module, exports) {
-
-$parcel$export(module.exports, "ETreeItemIndent", () => $05e153f4f05b550c$export$8b7ad0318ba60199);
-$parcel$export(module.exports, "ChevronRight", () => $05e153f4f05b550c$export$6172d85aadfc9b96);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $h9F9g = parcelRequire("h9F9g");
-const $05e153f4f05b550c$export$8b7ad0318ba60199 = ({ depth: depth, onToggle: onToggle, type: type, hasChilds: hasChilds, isOpen: isOpen, onClick: onClick, node: node, isActive: isActive, isComponent: isComponent, mitem: mitem })=>{
- return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- isActive && !isComponent && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-blue-500 absolute left-0 top-0 bottom-0 w-[3px]"
- }),
- isComponent && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx(isActive ? "bg-blue-400" : "bg-purple-400 bg-opacity-40", " flex items-center justify-center text-white absolute left-0 top-0 bottom-0", depth > 1 ? "w-[16px]" : "w-[7px]"),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: depth > 1 ? "10" : "0",
- height: depth > 1 ? "10" : "0",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M7.289.797a.5.5 0 01.422 0l6 2.8A.5.5 0 0114 4.05v6.9a.5.5 0 01-.289.453l-6 2.8a.5.5 0 01-.422 0l-6-2.8A.5.5 0 011 10.95v-6.9a.5.5 0 01.289-.453l6-2.8zM2 4.806L7 6.93v6.034l-5-2.333V4.806zm6 8.159l5-2.333V4.806L8 6.93v6.034zm-.5-6.908l4.772-2.028L7.5 1.802 2.728 4.029 7.5 6.057z",
- clipRule: "evenodd"
- })
- })
- }),
- mitem.parent.get("content") && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx(isActive ? "bg-blue-400 text-white " : "text-purple-600", " flex items-center justify-center absolute left-0 top-0 bottom-0", depth > 1 ? "w-[16px]" : "w-[7px]"),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: depth > 1 ? "10" : "0",
- height: depth > 1 ? "10" : "0",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M7.289.797a.5.5 0 01.422 0l6 2.8A.5.5 0 0114 4.05v6.9a.5.5 0 01-.289.453l-6 2.8a.5.5 0 01-.422 0l-6-2.8A.5.5 0 011 10.95v-6.9a.5.5 0 01.289-.453l6-2.8zM2 4.806L7 6.93v6.034l-5-2.333V4.806zm6 8.159l5-2.333V4.806L8 6.93v6.034zm-.5-6.908l4.772-2.028L7.5 1.802 2.728 4.029 7.5 6.057z",
- clipRule: "evenodd"
- })
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx(css`
- padding-left: ${Math.round(depth < 3 ? depth * (0, $h9F9g.DEPTH_WIDTH) : 3 * (0, $h9F9g.DEPTH_WIDTH) + (depth - 3) * (0, $h9F9g.DEPTH_WIDTH) / 2)}px;
- `),
- onClick: (e)=>{
- e.stopPropagation();
- onToggle();
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("icon flex justify-center", css`
- width: 25px;
- `),
- onClick: (e)=>{
- e.stopPropagation();
- if (isOpen) onClick(node);
- onToggle();
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "regular-icon",
- children: [
- type === "item" && (hasChilds ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: isOpen ? /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$export$4e3778eb35f54199, {}) : /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$export$6172d85aadfc9b96, {})
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$export$fe32840a055e175b, {})),
- type === "section" && (hasChilds ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: isOpen ? /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$var$SectionDown, {}) : /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$var$SectionRight, {})
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$export$fe32840a055e175b, {})),
- type === "text" && /*#__PURE__*/ (0, $lAN3N.jsx)($05e153f4f05b550c$var$Text, {})
- ]
- })
- })
- ]
- });
-};
-const $05e153f4f05b550c$var$chevronSize = 13;
-const $05e153f4f05b550c$var$elbowSize = 14;
-const $05e153f4f05b550c$var$sectionSize = 17;
-const $05e153f4f05b550c$export$6172d85aadfc9b96 = ({ size: size })=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: size || $05e153f4f05b550c$var$chevronSize,
- height: size || $05e153f4f05b550c$var$chevronSize,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M6.158 3.135a.5.5 0 01.707.023l3.75 4a.5.5 0 010 .684l-3.75 4a.5.5 0 11-.73-.684L9.566 7.5l-3.43-3.658a.5.5 0 01.023-.707z",
- clipRule: "evenodd"
- })
- });
-const $05e153f4f05b550c$export$4e3778eb35f54199 = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: $05e153f4f05b550c$var$chevronSize,
- height: $05e153f4f05b550c$var$chevronSize,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M3.135 6.158a.5.5 0 01.707-.023L7.5 9.565l3.658-3.43a.5.5 0 01.684.73l-4 3.75a.5.5 0 01-.684 0l-4-3.75a.5.5 0 01-.023-.707z",
- clipRule: "evenodd"
- })
- });
-const $05e153f4f05b550c$export$fe32840a055e175b = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: 9,
- height: 9,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M2.857 2h9.286c.473 0 .857.384.857.857v9.286a.857.857 0 01-.857.857H2.857A.857.857 0 012 12.143V2.857C2 2.384 2.384 2 2.857 2zM1 2.857C1 1.831 1.831 1 2.857 1h9.286C13.168 1 14 1.831 14 2.857v9.286A1.857 1.857 0 0112.143 14H2.857A1.857 1.857 0 011 12.143V2.857zM7.5 5a.5.5 0 100-1 .5.5 0 000 1zm-3 6a.5.5 0 100-1 .5.5 0 000 1zM5 7.5a.5.5 0 11-1 0 .5.5 0 011 0zM4.5 5a.5.5 0 100-1 .5.5 0 000 1zm6.5 5.5a.5.5 0 11-1 0 .5.5 0 011 0zM10.5 8a.5.5 0 100-1 .5.5 0 000 1zm.5-3.5a.5.5 0 11-1 0 .5.5 0 011 0zM7.5 11a.5.5 0 100-1 .5.5 0 000 1z",
- clipRule: "evenodd"
- })
- });
-const $05e153f4f05b550c$var$SectionRight = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: $05e153f4f05b550c$var$sectionSize,
- height: $05e153f4f05b550c$var$sectionSize,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- d: "M6 11V4l4.5 3.5L6 11z"
- })
- });
-const $05e153f4f05b550c$var$SectionDown = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- width: $05e153f4f05b550c$var$sectionSize,
- height: $05e153f4f05b550c$var$sectionSize,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- d: "M4 6H11L7.5 10.5L4 6Z",
- fill: "currentColor"
- })
- });
-const $05e153f4f05b550c$var$Text = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "14",
- height: "14",
- fill: "none",
- viewBox: "0 0 15 15",
- className: "opacity-50 mt-[1px] mb-[-1px]",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M3.95 2.95V4.5a.45.45 0 01-.9 0v-2a.45.45 0 01.45-.45h8a.45.45 0 01.45.45v2a.45.45 0 11-.9 0V2.95h-3v9.1h1.204a.45.45 0 010 .9h-3.5a.45.45 0 110-.9H6.95v-9.1h-3z",
- clipRule: "evenodd"
- })
- });
-
-});
-parcelRegister("h9F9g", function(module, exports) {
-
-$parcel$export(module.exports, "DEPTH_WIDTH", () => $fe21af06b97334cc$export$a8273d7d48e89fce);
-$parcel$export(module.exports, "Placeholder", () => $fe21af06b97334cc$export$84712d0562a614b8);
-$parcel$export(module.exports, "DragPreview", () => $fe21af06b97334cc$export$905ab40ac2179daa);
-$parcel$export(module.exports, "onDrop", () => $fe21af06b97334cc$export$c052d596304c05ec);
-$parcel$export(module.exports, "canDrop", () => $fe21af06b97334cc$export$efe8d920831af550);
-$parcel$export(module.exports, "onDragEnd", () => $fe21af06b97334cc$export$8566066e92caa8a);
-$parcel$export(module.exports, "onDragStart", () => $fe21af06b97334cc$export$b00174fdb6a6ab8f);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $lyBVq = parcelRequire("lyBVq");
-
-var $bVY3H = parcelRequire("bVY3H");
-
-var $g4TqW = parcelRequire("g4TqW");
-
-var $cfpVL = parcelRequire("cfpVL");
-
-var $empv1 = parcelRequire("empv1");
-
-var $45PRD = parcelRequire("45PRD");
-
-var $dJKat = parcelRequire("dJKat");
-
-var $6QgH2 = parcelRequire("6QgH2");
-
-var $aQYRt = parcelRequire("aQYRt");
-const $fe21af06b97334cc$export$a8273d7d48e89fce = 8;
-const $fe21af06b97334cc$export$84712d0562a614b8 = ({ params: params })=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("flex items-center bg-blue-50", css`
- height: 10px;
- z-index: 99;
- position: absolute;
- left: ${(params.depth + 1) * $fe21af06b97334cc$export$a8273d7d48e89fce - 3}px;
- transform: translateY(-50%);
- right: 0px;
- `),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("flex-1", css`
- background-color: #1b73e8;
- height: 2px;
- `)
- })
- });
-};
-const $fe21af06b97334cc$export$905ab40ac2179daa = (props)=>{
- const item = props.item;
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("bg-blue-500 text-white px-4 py-[2px] text-sm inline-grid"),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: item.text
- })
- });
-};
-const $fe21af06b97334cc$export$c052d596304c05ec = (p, tree, options, local)=>{
- const { dragSource: dragSource, dropTarget: dropTarget, relativeIndex: relativeIndex } = options;
- if (dragSource?.data && dropTarget) {
- let fromMeta = p.treeMeta[dragSource.id];
- let toMeta = p.treeMeta[dropTarget.id];
- if (fromMeta && toMeta) {
- let to = toMeta.comp ? toMeta.comp.mcomp : toMeta.mitem;
- let from = fromMeta.mitem;
- if (to) to.doc?.transact(()=>{
- if (to && from && typeof relativeIndex === "number") {
- const toChilds = to.get("childs");
- if (toChilds) toChilds.insert(relativeIndex, [
- (0, $6QgH2.newMap)((0, $dJKat.fillID)(from.toJSON()))
- ]);
- from.parent.forEach((e, idx)=>{
- if (from && e.get("id") === from.get("id")) from.parent.delete(idx);
- });
- }
- });
- }
- }
-};
-const $fe21af06b97334cc$export$efe8d920831af550 = (p, arg)=>{
- const { dragSource: dragSource, dragSourceId: dragSourceId, dropTargetId: dropTargetId, dropTarget: dropTarget } = arg;
- try {
- const parentSource = (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(dragSource, "data.meta.item.parent.parent");
- if (parentSource && parentSource.get && parentSource.get("id") === "root") return false;
- if (dropTargetId === "root") {
- const ds = (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(dragSource, "data.meta.item");
- if (ds && ds.type === "section") return true;
- return false;
- } else if (dragSource?.data && dropTarget?.data) {
- const from = dragSource.data.meta.item.type;
- const to = dropTarget.data.meta.item.type;
- let listItem = p.item.selection;
- if (listItem.length) {
- if (typeof dragSourceId === "string") {
- if ((0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))(p.item.selection, (e)=>e === dropTargetId)) return false;
- }
- } else if (typeof dragSourceId === "string") {
- const meta = p.treeMeta[dragSourceId];
- if (meta && meta.mitem) {
- let walkId = (0, $aQYRt.walk)(meta.mitem);
- if ((0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))(walkId, (e)=>e === dropTargetId)) return false;
- }
- }
- if (from === "section" || to === "text") return false;
- else if (from === "item") {
- if (to === "section" || to === "item") {
- if (dropTarget.data.meta.item.type === "item" && dropTarget.data.meta.item.component?.id) {
- if (p.comp) {
- if (p.comp.id === dropTarget.data.meta.comp?.id) return true;
- }
- return false;
- }
- return true;
- } else return false;
- } else if (from === "text") {
- if (to === "item") {
- if (dropTarget.data.meta.item.type === "item" && dropTarget.data.meta.item.component?.id) {
- if (p.comp) {
- if (p.comp.id === dropTarget.data.meta.comp?.id) return true;
- }
- return false;
- }
- return true;
- }
- }
- return false;
- }
- } catch (e) {
- console.log(e);
- return false;
- }
-};
-const $fe21af06b97334cc$export$8566066e92caa8a = (p, node)=>{};
-const $fe21af06b97334cc$export$b00174fdb6a6ab8f = (p, node)=>{};
-const $fe21af06b97334cc$export$2fc307d13d4102e8 = (p, node)=>{
- console.clear();
- const comp = p.comps.doc[p.comp?.id || ""];
- let root = null;
- let listId = p.item.selection || [];
- if (!listId.length) {
- const meta = p.treeMeta[p.item.active];
- if (meta && meta.mitem) listId = $fe21af06b97334cc$var$treeContent(meta.mitem);
- }
- if (comp) root = comp.getMap("map").get("content_tree");
- else if (p.mpage) root = p.mpage.getMap("map").get("content_tree");
- const meta = p.treeMeta[node.id];
- if (meta && meta.mitem) {
- const listItemId = $fe21af06b97334cc$var$treeContent(meta.mitem);
- if ((0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))(listId, (e)=>e === node.id) && p.item.selection.length) listId = listId.filter((e)=>!(0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))(listItemId, (x)=>x === e));
- else listId = (0, (/*@__PURE__*/$parcel$interopDefault($lyBVq)))(listItemId, listId);
- }
- listId = (0, (/*@__PURE__*/$parcel$interopDefault($45PRD)))(listId, (e)=>e);
- p.item.active = "";
- p.item.selection = listId;
-};
-const $fe21af06b97334cc$export$b512051899016d01 = (item)=>{
- const children = item;
- let ls = structuredClone(item);
- let sitem = ls.map((v)=>{
- if (v.type !== "text") v.childs = [];
- return {
- ...v
- };
- });
- let result = [];
- sitem.forEach((v)=>{
- let parent = children.filter((x)=>(0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))((0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(x, "childs"), (x)=>x.id === v.id));
- if ((0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(parent, "length")) {
- let s = sitem.find((e)=>e.id === (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(parent, "[0].id"));
- let childs = s.childs || [];
- let now = [
- v
- ];
- (0, (/*@__PURE__*/$parcel$interopDefault($empv1)))(s, "childs", childs.concat(now));
- } else result.push(v);
- });
- return result;
-};
-const $fe21af06b97334cc$export$e9bd78125d7a888c = (item, root, p)=>{
- item.map((e)=>{
- let obj = root.find((x)=>x.id === e);
- if (obj) {
- let mitem = p.treeMeta[e];
- if (mitem.mitem) {
- let parent = mitem.mitem.parent;
- let childs = parent?.toJSON() || [];
- let idx = (0, (/*@__PURE__*/$parcel$interopDefault($g4TqW)))(childs, (x)=>(0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(x, "id") === e);
- if (typeof idx === "number") parent?.delete(idx);
- }
- }
- });
-};
-const $fe21af06b97334cc$var$treeContent = (item)=>{
- const type = item.get("type");
- let result = [];
- if (type === "text") result.push(item.get("id"));
- else if (type === "section" || type === "item") result = (0, $aQYRt.walk)(item);
- return result;
-};
-
-});
-parcelRegister("lyBVq", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as references for various `Number` constants. */ var $fb1a311787610c9b$var$MAX_SAFE_INTEGER = 9007199254740991;
-/** `Object#toString` result references. */ var $fb1a311787610c9b$var$argsTag = "[object Arguments]", $fb1a311787610c9b$var$funcTag = "[object Function]", $fb1a311787610c9b$var$genTag = "[object GeneratorFunction]";
-/** Detect free variable `global` from Node.js. */ var $fb1a311787610c9b$var$freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var $fb1a311787610c9b$var$freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var $fb1a311787610c9b$var$root = $fb1a311787610c9b$var$freeGlobal || $fb1a311787610c9b$var$freeSelf || Function("return this")();
-/**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */ function $fb1a311787610c9b$var$arrayPush(array, values) {
- var index = -1, length = values.length, offset = array.length;
- while(++index < length)array[offset + index] = values[index];
- return array;
-}
-/** Used for built-in method references. */ var $fb1a311787610c9b$var$objectProto = Object.prototype;
-/** Used to check objects for own properties. */ var $fb1a311787610c9b$var$hasOwnProperty = $fb1a311787610c9b$var$objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var $fb1a311787610c9b$var$objectToString = $fb1a311787610c9b$var$objectProto.toString;
-/** Built-in value references. */ var $fb1a311787610c9b$var$Symbol = $fb1a311787610c9b$var$root.Symbol, $fb1a311787610c9b$var$propertyIsEnumerable = $fb1a311787610c9b$var$objectProto.propertyIsEnumerable, $fb1a311787610c9b$var$spreadableSymbol = $fb1a311787610c9b$var$Symbol ? $fb1a311787610c9b$var$Symbol.isConcatSpreadable : undefined;
-/**
- * The base implementation of `_.flatten` with support for restricting flattening.
- *
- * @private
- * @param {Array} array The array to flatten.
- * @param {number} depth The maximum recursion depth.
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
- * @param {Array} [result=[]] The initial result value.
- * @returns {Array} Returns the new flattened array.
- */ function $fb1a311787610c9b$var$baseFlatten(array, depth, predicate, isStrict, result) {
- var index = -1, length = array.length;
- predicate || (predicate = $fb1a311787610c9b$var$isFlattenable);
- result || (result = []);
- while(++index < length){
- var value = array[index];
- if (depth > 0 && predicate(value)) {
- if (depth > 1) // Recursively flatten arrays (susceptible to call stack limits).
- $fb1a311787610c9b$var$baseFlatten(value, depth - 1, predicate, isStrict, result);
- else $fb1a311787610c9b$var$arrayPush(result, value);
- } else if (!isStrict) result[result.length] = value;
- }
- return result;
-}
-/**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */ function $fb1a311787610c9b$var$copyArray(source, array) {
- var index = -1, length = source.length;
- array || (array = Array(length));
- while(++index < length)array[index] = source[index];
- return array;
-}
-/**
- * Checks if `value` is a flattenable `arguments` object or array.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
- */ function $fb1a311787610c9b$var$isFlattenable(value) {
- return $fb1a311787610c9b$var$isArray(value) || $fb1a311787610c9b$var$isArguments(value) || !!($fb1a311787610c9b$var$spreadableSymbol && value && value[$fb1a311787610c9b$var$spreadableSymbol]);
-}
-/**
- * Creates a new array concatenating `array` with any additional arrays
- * and/or values.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to concatenate.
- * @param {...*} [values] The values to concatenate.
- * @returns {Array} Returns the new concatenated array.
- * @example
- *
- * var array = [1];
- * var other = _.concat(array, 2, [3], [[4]]);
- *
- * console.log(other);
- * // => [1, 2, 3, [4]]
- *
- * console.log(array);
- * // => [1]
- */ function $fb1a311787610c9b$var$concat() {
- var length = arguments.length, args = Array(length ? length - 1 : 0), array = arguments[0], index = length;
- while(index--)args[index - 1] = arguments[index];
- return length ? $fb1a311787610c9b$var$arrayPush($fb1a311787610c9b$var$isArray(array) ? $fb1a311787610c9b$var$copyArray(array) : [
- array
- ], $fb1a311787610c9b$var$baseFlatten(args, 1)) : [];
-}
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */ function $fb1a311787610c9b$var$isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return $fb1a311787610c9b$var$isArrayLikeObject(value) && $fb1a311787610c9b$var$hasOwnProperty.call(value, "callee") && (!$fb1a311787610c9b$var$propertyIsEnumerable.call(value, "callee") || $fb1a311787610c9b$var$objectToString.call(value) == $fb1a311787610c9b$var$argsTag);
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var $fb1a311787610c9b$var$isArray = Array.isArray;
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */ function $fb1a311787610c9b$var$isArrayLike(value) {
- return value != null && $fb1a311787610c9b$var$isLength(value.length) && !$fb1a311787610c9b$var$isFunction(value);
-}
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */ function $fb1a311787610c9b$var$isArrayLikeObject(value) {
- return $fb1a311787610c9b$var$isObjectLike(value) && $fb1a311787610c9b$var$isArrayLike(value);
-}
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function $fb1a311787610c9b$var$isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = $fb1a311787610c9b$var$isObject(value) ? $fb1a311787610c9b$var$objectToString.call(value) : "";
- return tag == $fb1a311787610c9b$var$funcTag || tag == $fb1a311787610c9b$var$genTag;
-}
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */ function $fb1a311787610c9b$var$isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= $fb1a311787610c9b$var$MAX_SAFE_INTEGER;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function $fb1a311787610c9b$var$isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function $fb1a311787610c9b$var$isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-module.exports = $fb1a311787610c9b$var$concat;
-
-});
-
-parcelRegister("g4TqW", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200;
-/** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = "Expected a function";
-/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__";
-/** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2;
-/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0;
-/** `Object#toString` result references. */ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
-var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
-/** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g;
-/** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g;
-/** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
-/** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i;
-/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/;
-/** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i;
-/** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/;
-/** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {};
-typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
-typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
-/** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt;
-/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")();
-/** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports;
-/** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module;
-/** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports;
-/** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process;
-/** Used to access faster Node.js helpers. */ var nodeUtil = function() {
- try {
- return freeProcess && freeProcess.binding("util");
- } catch (e) {}
-}();
-/* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
-/**
- * A specialized version of `_.some` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */ function arraySome(array, predicate) {
- var index = -1, length = array ? array.length : 0;
- while(++index < length){
- if (predicate(array[index], index, array)) return true;
- }
- return false;
-}
-/**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while(fromRight ? index-- : ++index < length){
- if (predicate(array[index], index, array)) return index;
- }
- return -1;
-}
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */ function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while(++index < n)result[index] = iteratee(index);
- return result;
-}
-/**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */ function baseUnary(func) {
- return function(value) {
- return func(value);
- };
-}
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */ function getValue(object, key) {
- return object == null ? undefined : object[key];
-}
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */ function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != "function") try {
- result = !!(value + "");
- } catch (e) {}
- return result;
-}
-/**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */ function mapToArray(map) {
- var index = -1, result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [
- key,
- value
- ];
- });
- return result;
-}
-/**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */ function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
-}
-/**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */ function setToArray(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
-}
-/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
-/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"];
-/** Used to detect methods masquerading as native. */ var maskSrcKey = function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
-}();
-/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString;
-/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var objectToString = objectProto.toString;
-/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
-/** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
-/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max;
-/* Built-in method references that are verified to be native. */ var DataView = getNative(root, "DataView"), Map = getNative(root, "Map"), Promise = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
-/** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
-/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Hash(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */ function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
-}
-/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
-}
-/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */ function hashSet(key, value) {
- var data = this.__data__;
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-Hash.prototype.clear = hashClear;
-Hash.prototype["delete"] = hashDelete;
-Hash.prototype.get = hashGet;
-Hash.prototype.has = hashHas;
-Hash.prototype.set = hashSet;
-/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function ListCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */ function listCacheClear() {
- this.__data__ = [];
-}
-/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function listCacheDelete(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) return false;
- var lastIndex = data.length - 1;
- if (index == lastIndex) data.pop();
- else splice.call(data, index, 1);
- return true;
-}
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function listCacheGet(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
-}
-/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */ function listCacheSet(key, value) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) data.push([
- key,
- value
- ]);
- else data[index][1] = value;
- return this;
-}
-// Add methods to `ListCache`.
-ListCache.prototype.clear = listCacheClear;
-ListCache.prototype["delete"] = listCacheDelete;
-ListCache.prototype.get = listCacheGet;
-ListCache.prototype.has = listCacheHas;
-ListCache.prototype.set = listCacheSet;
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function MapCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */ function mapCacheClear() {
- this.__data__ = {
- "hash": new Hash,
- "map": new (Map || ListCache),
- "string": new Hash
- };
-}
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function mapCacheDelete(key) {
- return getMapData(this, key)["delete"](key);
-}
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function mapCacheGet(key) {
- return getMapData(this, key).get(key);
-}
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function mapCacheHas(key) {
- return getMapData(this, key).has(key);
-}
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */ function mapCacheSet(key, value) {
- getMapData(this, key).set(key, value);
- return this;
-}
-// Add methods to `MapCache`.
-MapCache.prototype.clear = mapCacheClear;
-MapCache.prototype["delete"] = mapCacheDelete;
-MapCache.prototype.get = mapCacheGet;
-MapCache.prototype.has = mapCacheHas;
-MapCache.prototype.set = mapCacheSet;
-/**
- *
- * Creates an array cache object to store unique values.
- *
- * @private
- * @constructor
- * @param {Array} [values] The values to cache.
- */ function SetCache(values) {
- var index = -1, length = values ? values.length : 0;
- this.__data__ = new MapCache;
- while(++index < length)this.add(values[index]);
-}
-/**
- * Adds `value` to the array cache.
- *
- * @private
- * @name add
- * @memberOf SetCache
- * @alias push
- * @param {*} value The value to cache.
- * @returns {Object} Returns the cache instance.
- */ function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
-}
-/**
- * Checks if `value` is in the array cache.
- *
- * @private
- * @name has
- * @memberOf SetCache
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
- */ function setCacheHas(value) {
- return this.__data__.has(value);
-}
-// Add methods to `SetCache`.
-SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
-SetCache.prototype.has = setCacheHas;
-/**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Stack(entries) {
- this.__data__ = new ListCache(entries);
-}
-/**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */ function stackClear() {
- this.__data__ = new ListCache;
-}
-/**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function stackDelete(key) {
- return this.__data__["delete"](key);
-}
-/**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function stackGet(key) {
- return this.__data__.get(key);
-}
-/**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function stackHas(key) {
- return this.__data__.has(key);
-}
-/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */ function stackSet(key, value) {
- var cache = this.__data__;
- if (cache instanceof ListCache) {
- var pairs = cache.__data__;
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
- pairs.push([
- key,
- value
- ]);
- return this;
- }
- cache = this.__data__ = new MapCache(pairs);
- }
- cache.set(key, value);
- return this;
-}
-// Add methods to `Stack`.
-Stack.prototype.clear = stackClear;
-Stack.prototype["delete"] = stackDelete;
-Stack.prototype.get = stackGet;
-Stack.prototype.has = stackHas;
-Stack.prototype.set = stackSet;
-/**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */ function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
- var length = result.length, skipIndexes = !!length;
- for(var key in value)if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) result.push(key);
- return result;
-}
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function assocIndexOf(array, key) {
- var length = array.length;
- while(length--){
- if (eq(array[length][0], key)) return length;
- }
- return -1;
-}
-/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */ function baseGet(object, path) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var index = 0, length = path.length;
- while(object != null && index < length)object = object[toKey(path[index++])];
- return index && index == length ? object : undefined;
-}
-/**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ function baseGetTag(value) {
- return objectToString.call(value);
-}
-/**
- * The base implementation of `_.hasIn` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */ function baseHasIn(object, key) {
- return object != null && key in Object(object);
-}
-/**
- * The base implementation of `_.isEqual` which supports partial comparisons
- * and tracks traversed objects.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {boolean} [bitmask] The bitmask of comparison flags.
- * The bitmask may be composed of the following flags:
- * 1 - Unordered comparison
- * 2 - Partial comparison
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */ function baseIsEqual(value, other, customizer, bitmask, stack) {
- if (value === other) return true;
- if (value == null || other == null || !isObject(value) && !isObjectLike(other)) return value !== value && other !== other;
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
-}
-/**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag;
- if (!objIsArr) {
- objTag = getTag(object);
- objTag = objTag == argsTag ? objectTag : objTag;
- }
- if (!othIsArr) {
- othTag = getTag(other);
- othTag = othTag == argsTag ? objectTag : othTag;
- }
- var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack);
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
- }
- if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack);
- return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
- }
- }
- if (!isSameTag) return false;
- stack || (stack = new Stack);
- return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
-}
-/**
- * The base implementation of `_.isMatch` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @param {Array} matchData The property names, values, and compare flags to match.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- */ function baseIsMatch(object, source, matchData, customizer) {
- var index = matchData.length, length = index, noCustomizer = !customizer;
- if (object == null) return !length;
- object = Object(object);
- while(index--){
- var data = matchData[index];
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
- }
- while(++index < length){
- data = matchData[index];
- var key = data[0], objValue = object[key], srcValue = data[1];
- if (noCustomizer && data[2]) {
- if (objValue === undefined && !(key in object)) return false;
- } else {
- var stack = new Stack;
- if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
- if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) return false;
- }
- }
- return true;
-}
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */ function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) return false;
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
-}
-/**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */ function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
-}
-/**
- * The base implementation of `_.iteratee`.
- *
- * @private
- * @param {*} [value=_.identity] The value to convert to an iteratee.
- * @returns {Function} Returns the iteratee.
- */ function baseIteratee(value) {
- // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
- // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
- if (typeof value == "function") return value;
- if (value == null) return identity;
- if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
- return property(value);
-}
-/**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */ function baseKeys(object) {
- if (!isPrototype(object)) return nativeKeys(object);
- var result = [];
- for(var key in Object(object))if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key);
- return result;
-}
-/**
- * The base implementation of `_.matches` which doesn't clone `source`.
- *
- * @private
- * @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatches(source) {
- var matchData = getMatchData(source);
- if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
- return function(object) {
- return object === source || baseIsMatch(object, source, matchData);
- };
-}
-/**
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
- *
- * @private
- * @param {string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatchesProperty(path, srcValue) {
- if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
- return function(object) {
- var objValue = get(object, path);
- return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
- };
-}
-/**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function basePropertyDeep(path) {
- return function(object) {
- return baseGet(object, path);
- };
-}
-/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */ function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == "string") return value;
- if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */ function castPath(value) {
- return isArray(value) ? value : stringToPath(value);
-}
-/**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `array` and `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(array);
- if (stacked && stack.get(other)) return stacked == other;
- var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache : undefined;
- stack.set(array, other);
- stack.set(other, array);
- // Ignore non-index properties.
- while(++index < arrLength){
- var arrValue = array[index], othValue = other[index];
- if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
- if (compared !== undefined) {
- if (compared) continue;
- result = false;
- break;
- }
- // Recursively compare arrays (susceptible to call stack limits).
- if (seen) {
- if (!arraySome(other, function(othValue, othIndex) {
- if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) return seen.add(othIndex);
- })) {
- result = false;
- break;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
- result = false;
- break;
- }
- }
- stack["delete"](array);
- stack["delete"](other);
- return result;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
- switch(tag){
- case dataViewTag:
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
- object = object.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false;
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- // Coerce booleans to `1` or `0` and dates to milliseconds.
- // Invalid dates are coerced to `NaN`.
- return eq(+object, +other);
- case errorTag:
- return object.name == other.name && object.message == other.message;
- case regexpTag:
- case stringTag:
- // Coerce regexes to strings and treat strings, primitives and objects,
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
- // for more details.
- return object == other + "";
- case mapTag:
- var convert = mapToArray;
- case setTag:
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
- convert || (convert = setToArray);
- if (object.size != other.size && !isPartial) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked) return stacked == other;
- bitmask |= UNORDERED_COMPARE_FLAG;
- // Recursively compare objects (susceptible to call stack limits).
- stack.set(object, other);
- var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
- stack["delete"](object);
- return result;
- case symbolTag:
- if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- return false;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
- if (objLength != othLength && !isPartial) return false;
- var index = objLength;
- while(index--){
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false;
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked && stack.get(other)) return stacked == other;
- var result = true;
- stack.set(object, other);
- stack.set(other, object);
- var skipCtor = isPartial;
- while(++index < objLength){
- key = objProps[index];
- var objValue = object[key], othValue = other[key];
- if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
- // Recursively compare objects (susceptible to call stack limits).
- if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == "constructor");
- }
- if (result && !skipCtor) {
- var objCtor = object.constructor, othCtor = other.constructor;
- // Non `Object` object instances with different constructors are not equal.
- if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
- }
- stack["delete"](object);
- stack["delete"](other);
- return result;
-}
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */ function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
-}
-/**
- * Gets the property names, values, and compare flags of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the match data of `object`.
- */ function getMatchData(object) {
- var result = keys(object), length = result.length;
- while(length--){
- var key = result[length], value = object[key];
- result[length] = [
- key,
- value,
- isStrictComparable(value)
- ];
- }
- return result;
-}
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */ function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
-}
-/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ var getTag = baseGetTag;
-// Fallback for data views, maps, sets, and weak maps in IE 11,
-// for data views in Edge < 14, and promises in Node.js.
-if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap && getTag(new WeakMap) != weakMapTag) getTag = function(value) {
- var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) switch(ctorString){
- case dataViewCtorString:
- return dataViewTag;
- case mapCtorString:
- return mapTag;
- case promiseCtorString:
- return promiseTag;
- case setCtorString:
- return setTag;
- case weakMapCtorString:
- return weakMapTag;
- }
- return result;
-};
-/**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */ function hasPath(object, path, hasFunc) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var result, index = -1, length = path.length;
- while(++index < length){
- var key = toKey(path[index]);
- if (!(result = object != null && hasFunc(object, key))) break;
- object = object[key];
- }
- if (result) return result;
- var length = object ? object.length : 0;
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
-}
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */ function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
-}
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */ function isKey(value, object) {
- if (isArray(value)) return false;
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
-}
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */ function isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
-}
-/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */ function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
-}
-/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */ function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
-}
-/**
- * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` if suitable for strict
- * equality comparisons, else `false`.
- */ function isStrictComparable(value) {
- return value === value && !isObject(value);
-}
-/**
- * A specialized version of `matchesProperty` for source values suitable
- * for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function matchesStrictComparable(key, srcValue) {
- return function(object) {
- if (object == null) return false;
- return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
- };
-}
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */ var stringToPath = memoize(function(string) {
- string = toString(string);
- var result = [];
- if (reLeadingDot.test(string)) result.push("");
- string.replace(rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace(reEscapeChar, "$1") : number || match);
- });
- return result;
-});
-/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */ function toKey(value) {
- if (typeof value == "string" || isSymbol(value)) return value;
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */ function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return func + "";
- } catch (e) {}
- }
- return "";
-}
-/**
- * This method is like `_.find` except that it returns the index of the first
- * element `predicate` returns truthy for instead of the element itself.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the found element, else `-1`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.findIndex(users, function(o) { return o.user == 'barney'; });
- * // => 0
- *
- * // The `_.matches` iteratee shorthand.
- * _.findIndex(users, { 'user': 'fred', 'active': false });
- * // => 1
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findIndex(users, ['active', false]);
- * // => 0
- *
- * // The `_.property` iteratee shorthand.
- * _.findIndex(users, 'active');
- * // => 2
- */ function findIndex(array, predicate, fromIndex) {
- var length = array ? array.length : 0;
- if (!length) return -1;
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) index = nativeMax(length + index, 0);
- return baseFindIndex(array, baseIteratee(predicate, 3), index);
-}
-/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */ function memoize(func, resolver) {
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) return cache.get(key);
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result);
- return result;
- };
- memoized.cache = new (memoize.Cache || MapCache);
- return memoized;
-}
-// Assign cache to `_.memoize`.
-memoize.Cache = MapCache;
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */ function eq(value, other) {
- return value === other || value !== value && other !== other;
-}
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */ function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var isArray = Array.isArray;
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */ function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */ function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : "";
- return tag == funcTag || tag == genTag;
-}
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */ function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */ function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
-}
-/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
-/**
- * Converts `value` to a finite number.
- *
- * @static
- * @memberOf _
- * @since 4.12.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted number.
- * @example
- *
- * _.toFinite(3.2);
- * // => 3.2
- *
- * _.toFinite(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toFinite(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toFinite('3.2');
- * // => 3.2
- */ function toFinite(value) {
- if (!value) return value === 0 ? value : 0;
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
-}
-/**
- * Converts `value` to an integer.
- *
- * **Note:** This method is loosely based on
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3.2);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3.2');
- * // => 3
- */ function toInteger(value) {
- var result = toFinite(value), remainder = result % 1;
- return result === result ? remainder ? result - remainder : result : 0;
-}
-/**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */ function toNumber(value) {
- if (typeof value == "number") return value;
- if (isSymbol(value)) return NAN;
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") return value === 0 ? value : +value;
- value = value.replace(reTrim, "");
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
-}
-/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */ function toString(value) {
- return value == null ? "" : baseToString(value);
-}
-/**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is returned in its place.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */ function get(object, path, defaultValue) {
- var result = object == null ? undefined : baseGet(object, path);
- return result === undefined ? defaultValue : result;
-}
-/**
- * Checks if `path` is a direct or inherited property of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.hasIn(object, 'a');
- * // => true
- *
- * _.hasIn(object, 'a.b');
- * // => true
- *
- * _.hasIn(object, ['a', 'b']);
- * // => true
- *
- * _.hasIn(object, 'b');
- * // => false
- */ function hasIn(object, path) {
- return object != null && hasPath(object, path, baseHasIn);
-}
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */ function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
-}
-/**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */ function identity(value) {
- return value;
-}
-/**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': 2 } },
- * { 'a': { 'b': 1 } }
- * ];
- *
- * _.map(objects, _.property('a.b'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
- * // => [1, 2]
- */ function property(path) {
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
-}
-module.exports = findIndex;
-
-});
-
-parcelRegister("empv1", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as the `TypeError` message for "Functions" methods. */ var $a746e66472bc5bb7$var$FUNC_ERROR_TEXT = "Expected a function";
-/** Used to stand-in for `undefined` hash values. */ var $a746e66472bc5bb7$var$HASH_UNDEFINED = "__lodash_hash_undefined__";
-/** Used as references for various `Number` constants. */ var $a746e66472bc5bb7$var$INFINITY = 1 / 0, $a746e66472bc5bb7$var$MAX_SAFE_INTEGER = 9007199254740991;
-/** `Object#toString` result references. */ var $a746e66472bc5bb7$var$funcTag = "[object Function]", $a746e66472bc5bb7$var$genTag = "[object GeneratorFunction]", $a746e66472bc5bb7$var$symbolTag = "[object Symbol]";
-/** Used to match property names within property paths. */ var $a746e66472bc5bb7$var$reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $a746e66472bc5bb7$var$reIsPlainProp = /^\w*$/, $a746e66472bc5bb7$var$reLeadingDot = /^\./, $a746e66472bc5bb7$var$rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */ var $a746e66472bc5bb7$var$reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to match backslashes in property paths. */ var $a746e66472bc5bb7$var$reEscapeChar = /\\(\\)?/g;
-/** Used to detect host constructors (Safari). */ var $a746e66472bc5bb7$var$reIsHostCtor = /^\[object .+?Constructor\]$/;
-/** Used to detect unsigned integer values. */ var $a746e66472bc5bb7$var$reIsUint = /^(?:0|[1-9]\d*)$/;
-/** Detect free variable `global` from Node.js. */ var $a746e66472bc5bb7$var$freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var $a746e66472bc5bb7$var$freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var $a746e66472bc5bb7$var$root = $a746e66472bc5bb7$var$freeGlobal || $a746e66472bc5bb7$var$freeSelf || Function("return this")();
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */ function $a746e66472bc5bb7$var$getValue(object, key) {
- return object == null ? undefined : object[key];
-}
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */ function $a746e66472bc5bb7$var$isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != "function") try {
- result = !!(value + "");
- } catch (e) {}
- return result;
-}
-/** Used for built-in method references. */ var $a746e66472bc5bb7$var$arrayProto = Array.prototype, $a746e66472bc5bb7$var$funcProto = Function.prototype, $a746e66472bc5bb7$var$objectProto = Object.prototype;
-/** Used to detect overreaching core-js shims. */ var $a746e66472bc5bb7$var$coreJsData = $a746e66472bc5bb7$var$root["__core-js_shared__"];
-/** Used to detect methods masquerading as native. */ var $a746e66472bc5bb7$var$maskSrcKey = function() {
- var uid = /[^.]+$/.exec($a746e66472bc5bb7$var$coreJsData && $a746e66472bc5bb7$var$coreJsData.keys && $a746e66472bc5bb7$var$coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
-}();
-/** Used to resolve the decompiled source of functions. */ var $a746e66472bc5bb7$var$funcToString = $a746e66472bc5bb7$var$funcProto.toString;
-/** Used to check objects for own properties. */ var $a746e66472bc5bb7$var$hasOwnProperty = $a746e66472bc5bb7$var$objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var $a746e66472bc5bb7$var$objectToString = $a746e66472bc5bb7$var$objectProto.toString;
-/** Used to detect if a method is native. */ var $a746e66472bc5bb7$var$reIsNative = RegExp("^" + $a746e66472bc5bb7$var$funcToString.call($a746e66472bc5bb7$var$hasOwnProperty).replace($a746e66472bc5bb7$var$reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
-/** Built-in value references. */ var $a746e66472bc5bb7$var$Symbol = $a746e66472bc5bb7$var$root.Symbol, $a746e66472bc5bb7$var$splice = $a746e66472bc5bb7$var$arrayProto.splice;
-/* Built-in method references that are verified to be native. */ var $a746e66472bc5bb7$var$Map = $a746e66472bc5bb7$var$getNative($a746e66472bc5bb7$var$root, "Map"), $a746e66472bc5bb7$var$nativeCreate = $a746e66472bc5bb7$var$getNative(Object, "create");
-/** Used to convert symbols to primitives and strings. */ var $a746e66472bc5bb7$var$symbolProto = $a746e66472bc5bb7$var$Symbol ? $a746e66472bc5bb7$var$Symbol.prototype : undefined, $a746e66472bc5bb7$var$symbolToString = $a746e66472bc5bb7$var$symbolProto ? $a746e66472bc5bb7$var$symbolProto.toString : undefined;
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $a746e66472bc5bb7$var$Hash(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */ function $a746e66472bc5bb7$var$hashClear() {
- this.__data__ = $a746e66472bc5bb7$var$nativeCreate ? $a746e66472bc5bb7$var$nativeCreate(null) : {};
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $a746e66472bc5bb7$var$hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
-}
-/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $a746e66472bc5bb7$var$hashGet(key) {
- var data = this.__data__;
- if ($a746e66472bc5bb7$var$nativeCreate) {
- var result = data[key];
- return result === $a746e66472bc5bb7$var$HASH_UNDEFINED ? undefined : result;
- }
- return $a746e66472bc5bb7$var$hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $a746e66472bc5bb7$var$hashHas(key) {
- var data = this.__data__;
- return $a746e66472bc5bb7$var$nativeCreate ? data[key] !== undefined : $a746e66472bc5bb7$var$hasOwnProperty.call(data, key);
-}
-/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */ function $a746e66472bc5bb7$var$hashSet(key, value) {
- var data = this.__data__;
- data[key] = $a746e66472bc5bb7$var$nativeCreate && value === undefined ? $a746e66472bc5bb7$var$HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-$a746e66472bc5bb7$var$Hash.prototype.clear = $a746e66472bc5bb7$var$hashClear;
-$a746e66472bc5bb7$var$Hash.prototype["delete"] = $a746e66472bc5bb7$var$hashDelete;
-$a746e66472bc5bb7$var$Hash.prototype.get = $a746e66472bc5bb7$var$hashGet;
-$a746e66472bc5bb7$var$Hash.prototype.has = $a746e66472bc5bb7$var$hashHas;
-$a746e66472bc5bb7$var$Hash.prototype.set = $a746e66472bc5bb7$var$hashSet;
-/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $a746e66472bc5bb7$var$ListCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */ function $a746e66472bc5bb7$var$listCacheClear() {
- this.__data__ = [];
-}
-/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $a746e66472bc5bb7$var$listCacheDelete(key) {
- var data = this.__data__, index = $a746e66472bc5bb7$var$assocIndexOf(data, key);
- if (index < 0) return false;
- var lastIndex = data.length - 1;
- if (index == lastIndex) data.pop();
- else $a746e66472bc5bb7$var$splice.call(data, index, 1);
- return true;
-}
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $a746e66472bc5bb7$var$listCacheGet(key) {
- var data = this.__data__, index = $a746e66472bc5bb7$var$assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
-}
-/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $a746e66472bc5bb7$var$listCacheHas(key) {
- return $a746e66472bc5bb7$var$assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */ function $a746e66472bc5bb7$var$listCacheSet(key, value) {
- var data = this.__data__, index = $a746e66472bc5bb7$var$assocIndexOf(data, key);
- if (index < 0) data.push([
- key,
- value
- ]);
- else data[index][1] = value;
- return this;
-}
-// Add methods to `ListCache`.
-$a746e66472bc5bb7$var$ListCache.prototype.clear = $a746e66472bc5bb7$var$listCacheClear;
-$a746e66472bc5bb7$var$ListCache.prototype["delete"] = $a746e66472bc5bb7$var$listCacheDelete;
-$a746e66472bc5bb7$var$ListCache.prototype.get = $a746e66472bc5bb7$var$listCacheGet;
-$a746e66472bc5bb7$var$ListCache.prototype.has = $a746e66472bc5bb7$var$listCacheHas;
-$a746e66472bc5bb7$var$ListCache.prototype.set = $a746e66472bc5bb7$var$listCacheSet;
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $a746e66472bc5bb7$var$MapCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */ function $a746e66472bc5bb7$var$mapCacheClear() {
- this.__data__ = {
- "hash": new $a746e66472bc5bb7$var$Hash,
- "map": new ($a746e66472bc5bb7$var$Map || $a746e66472bc5bb7$var$ListCache),
- "string": new $a746e66472bc5bb7$var$Hash
- };
-}
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $a746e66472bc5bb7$var$mapCacheDelete(key) {
- return $a746e66472bc5bb7$var$getMapData(this, key)["delete"](key);
-}
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $a746e66472bc5bb7$var$mapCacheGet(key) {
- return $a746e66472bc5bb7$var$getMapData(this, key).get(key);
-}
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $a746e66472bc5bb7$var$mapCacheHas(key) {
- return $a746e66472bc5bb7$var$getMapData(this, key).has(key);
-}
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */ function $a746e66472bc5bb7$var$mapCacheSet(key, value) {
- $a746e66472bc5bb7$var$getMapData(this, key).set(key, value);
- return this;
-}
-// Add methods to `MapCache`.
-$a746e66472bc5bb7$var$MapCache.prototype.clear = $a746e66472bc5bb7$var$mapCacheClear;
-$a746e66472bc5bb7$var$MapCache.prototype["delete"] = $a746e66472bc5bb7$var$mapCacheDelete;
-$a746e66472bc5bb7$var$MapCache.prototype.get = $a746e66472bc5bb7$var$mapCacheGet;
-$a746e66472bc5bb7$var$MapCache.prototype.has = $a746e66472bc5bb7$var$mapCacheHas;
-$a746e66472bc5bb7$var$MapCache.prototype.set = $a746e66472bc5bb7$var$mapCacheSet;
-/**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */ function $a746e66472bc5bb7$var$assignValue(object, key, value) {
- var objValue = object[key];
- if (!($a746e66472bc5bb7$var$hasOwnProperty.call(object, key) && $a746e66472bc5bb7$var$eq(objValue, value)) || value === undefined && !(key in object)) object[key] = value;
-}
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function $a746e66472bc5bb7$var$assocIndexOf(array, key) {
- var length = array.length;
- while(length--){
- if ($a746e66472bc5bb7$var$eq(array[length][0], key)) return length;
- }
- return -1;
-}
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */ function $a746e66472bc5bb7$var$baseIsNative(value) {
- if (!$a746e66472bc5bb7$var$isObject(value) || $a746e66472bc5bb7$var$isMasked(value)) return false;
- var pattern = $a746e66472bc5bb7$var$isFunction(value) || $a746e66472bc5bb7$var$isHostObject(value) ? $a746e66472bc5bb7$var$reIsNative : $a746e66472bc5bb7$var$reIsHostCtor;
- return pattern.test($a746e66472bc5bb7$var$toSource(value));
-}
-/**
- * The base implementation of `_.set`.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {*} value The value to set.
- * @param {Function} [customizer] The function to customize path creation.
- * @returns {Object} Returns `object`.
- */ function $a746e66472bc5bb7$var$baseSet(object, path, value, customizer) {
- if (!$a746e66472bc5bb7$var$isObject(object)) return object;
- path = $a746e66472bc5bb7$var$isKey(path, object) ? [
- path
- ] : $a746e66472bc5bb7$var$castPath(path);
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
- while(nested != null && ++index < length){
- var key = $a746e66472bc5bb7$var$toKey(path[index]), newValue = value;
- if (index != lastIndex) {
- var objValue = nested[key];
- newValue = customizer ? customizer(objValue, key, nested) : undefined;
- if (newValue === undefined) newValue = $a746e66472bc5bb7$var$isObject(objValue) ? objValue : $a746e66472bc5bb7$var$isIndex(path[index + 1]) ? [] : {};
- }
- $a746e66472bc5bb7$var$assignValue(nested, key, newValue);
- nested = nested[key];
- }
- return object;
-}
-/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */ function $a746e66472bc5bb7$var$baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == "string") return value;
- if ($a746e66472bc5bb7$var$isSymbol(value)) return $a746e66472bc5bb7$var$symbolToString ? $a746e66472bc5bb7$var$symbolToString.call(value) : "";
- var result = value + "";
- return result == "0" && 1 / value == -$a746e66472bc5bb7$var$INFINITY ? "-0" : result;
-}
-/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */ function $a746e66472bc5bb7$var$castPath(value) {
- return $a746e66472bc5bb7$var$isArray(value) ? value : $a746e66472bc5bb7$var$stringToPath(value);
-}
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */ function $a746e66472bc5bb7$var$getMapData(map, key) {
- var data = map.__data__;
- return $a746e66472bc5bb7$var$isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
-}
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */ function $a746e66472bc5bb7$var$getNative(object, key) {
- var value = $a746e66472bc5bb7$var$getValue(object, key);
- return $a746e66472bc5bb7$var$baseIsNative(value) ? value : undefined;
-}
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */ function $a746e66472bc5bb7$var$isIndex(value, length) {
- length = length == null ? $a746e66472bc5bb7$var$MAX_SAFE_INTEGER : length;
- return !!length && (typeof value == "number" || $a746e66472bc5bb7$var$reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
-}
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */ function $a746e66472bc5bb7$var$isKey(value, object) {
- if ($a746e66472bc5bb7$var$isArray(value)) return false;
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || $a746e66472bc5bb7$var$isSymbol(value)) return true;
- return $a746e66472bc5bb7$var$reIsPlainProp.test(value) || !$a746e66472bc5bb7$var$reIsDeepProp.test(value) || object != null && value in Object(object);
-}
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */ function $a746e66472bc5bb7$var$isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
-}
-/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */ function $a746e66472bc5bb7$var$isMasked(func) {
- return !!$a746e66472bc5bb7$var$maskSrcKey && $a746e66472bc5bb7$var$maskSrcKey in func;
-}
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */ var $a746e66472bc5bb7$var$stringToPath = $a746e66472bc5bb7$var$memoize(function(string) {
- string = $a746e66472bc5bb7$var$toString(string);
- var result = [];
- if ($a746e66472bc5bb7$var$reLeadingDot.test(string)) result.push("");
- string.replace($a746e66472bc5bb7$var$rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace($a746e66472bc5bb7$var$reEscapeChar, "$1") : number || match);
- });
- return result;
-});
-/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */ function $a746e66472bc5bb7$var$toKey(value) {
- if (typeof value == "string" || $a746e66472bc5bb7$var$isSymbol(value)) return value;
- var result = value + "";
- return result == "0" && 1 / value == -$a746e66472bc5bb7$var$INFINITY ? "-0" : result;
-}
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */ function $a746e66472bc5bb7$var$toSource(func) {
- if (func != null) {
- try {
- return $a746e66472bc5bb7$var$funcToString.call(func);
- } catch (e) {}
- try {
- return func + "";
- } catch (e) {}
- }
- return "";
-}
-/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */ function $a746e66472bc5bb7$var$memoize(func, resolver) {
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError($a746e66472bc5bb7$var$FUNC_ERROR_TEXT);
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) return cache.get(key);
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result);
- return result;
- };
- memoized.cache = new ($a746e66472bc5bb7$var$memoize.Cache || $a746e66472bc5bb7$var$MapCache);
- return memoized;
-}
-// Assign cache to `_.memoize`.
-$a746e66472bc5bb7$var$memoize.Cache = $a746e66472bc5bb7$var$MapCache;
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */ function $a746e66472bc5bb7$var$eq(value, other) {
- return value === other || value !== value && other !== other;
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var $a746e66472bc5bb7$var$isArray = Array.isArray;
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function $a746e66472bc5bb7$var$isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = $a746e66472bc5bb7$var$isObject(value) ? $a746e66472bc5bb7$var$objectToString.call(value) : "";
- return tag == $a746e66472bc5bb7$var$funcTag || tag == $a746e66472bc5bb7$var$genTag;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function $a746e66472bc5bb7$var$isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function $a746e66472bc5bb7$var$isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */ function $a746e66472bc5bb7$var$isSymbol(value) {
- return typeof value == "symbol" || $a746e66472bc5bb7$var$isObjectLike(value) && $a746e66472bc5bb7$var$objectToString.call(value) == $a746e66472bc5bb7$var$symbolTag;
-}
-/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */ function $a746e66472bc5bb7$var$toString(value) {
- return value == null ? "" : $a746e66472bc5bb7$var$baseToString(value);
-}
-/**
- * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
- * it's created. Arrays are created for missing index properties while objects
- * are created for all other missing properties. Use `_.setWith` to customize
- * `path` creation.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.set(object, 'a[0].b.c', 4);
- * console.log(object.a[0].b.c);
- * // => 4
- *
- * _.set(object, ['x', '0', 'y', 'z'], 5);
- * console.log(object.x[0].y.z);
- * // => 5
- */ function $a746e66472bc5bb7$var$set(object, path, value) {
- return object == null ? object : $a746e66472bc5bb7$var$baseSet(object, path, value);
-}
-module.exports = $a746e66472bc5bb7$var$set;
-
-});
-
-parcelRegister("45PRD", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200;
-/** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = "Expected a function";
-/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__";
-/** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2;
-/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991;
-/** `Object#toString` result references. */ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
-var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
-/** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g;
-/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/;
-/** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/;
-/** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {};
-typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
-typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
-/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")();
-/** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports;
-/** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module;
-/** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports;
-/** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process;
-/** Used to access faster Node.js helpers. */ var nodeUtil = function() {
- try {
- return freeProcess && freeProcess.binding("util");
- } catch (e) {}
-}();
-/* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
-/**
- * A specialized version of `_.includes` for arrays without support for
- * specifying an index to search from.
- *
- * @private
- * @param {Array} [array] The array to inspect.
- * @param {*} target The value to search for.
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
- */ function arrayIncludes(array, value) {
- var length = array ? array.length : 0;
- return !!length && baseIndexOf(array, value, 0) > -1;
-}
-/**
- * This function is like `arrayIncludes` except that it accepts a comparator.
- *
- * @private
- * @param {Array} [array] The array to inspect.
- * @param {*} target The value to search for.
- * @param {Function} comparator The comparator invoked per element.
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
- */ function arrayIncludesWith(array, value, comparator) {
- var index = -1, length = array ? array.length : 0;
- while(++index < length){
- if (comparator(value, array[index])) return true;
- }
- return false;
-}
-/**
- * A specialized version of `_.some` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */ function arraySome(array, predicate) {
- var index = -1, length = array ? array.length : 0;
- while(++index < length){
- if (predicate(array[index], index, array)) return true;
- }
- return false;
-}
-/**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while(fromRight ? index-- : ++index < length){
- if (predicate(array[index], index, array)) return index;
- }
- return -1;
-}
-/**
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function baseIndexOf(array, value, fromIndex) {
- if (value !== value) return baseFindIndex(array, baseIsNaN, fromIndex);
- var index = fromIndex - 1, length = array.length;
- while(++index < length){
- if (array[index] === value) return index;
- }
- return -1;
-}
-/**
- * The base implementation of `_.isNaN` without support for number objects.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
- */ function baseIsNaN(value) {
- return value !== value;
-}
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */ function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while(++index < n)result[index] = iteratee(index);
- return result;
-}
-/**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */ function baseUnary(func) {
- return function(value) {
- return func(value);
- };
-}
-/**
- * Checks if a cache value for `key` exists.
- *
- * @private
- * @param {Object} cache The cache to query.
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function cacheHas(cache, key) {
- return cache.has(key);
-}
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */ function getValue(object, key) {
- return object == null ? undefined : object[key];
-}
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */ function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != "function") try {
- result = !!(value + "");
- } catch (e) {}
- return result;
-}
-/**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */ function mapToArray(map) {
- var index = -1, result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [
- key,
- value
- ];
- });
- return result;
-}
-/**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */ function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
-}
-/**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */ function setToArray(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
-}
-/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
-/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"];
-/** Used to detect methods masquerading as native. */ var maskSrcKey = function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
-}();
-/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString;
-/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var objectToString = objectProto.toString;
-/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
-/** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
-/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object);
-/* Built-in method references that are verified to be native. */ var DataView = getNative(root, "DataView"), Map = getNative(root, "Map"), Promise = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
-/** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
-/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Hash(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */ function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
-}
-/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
-}
-/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */ function hashSet(key, value) {
- var data = this.__data__;
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-Hash.prototype.clear = hashClear;
-Hash.prototype["delete"] = hashDelete;
-Hash.prototype.get = hashGet;
-Hash.prototype.has = hashHas;
-Hash.prototype.set = hashSet;
-/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function ListCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */ function listCacheClear() {
- this.__data__ = [];
-}
-/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function listCacheDelete(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) return false;
- var lastIndex = data.length - 1;
- if (index == lastIndex) data.pop();
- else splice.call(data, index, 1);
- return true;
-}
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function listCacheGet(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
-}
-/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */ function listCacheSet(key, value) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) data.push([
- key,
- value
- ]);
- else data[index][1] = value;
- return this;
-}
-// Add methods to `ListCache`.
-ListCache.prototype.clear = listCacheClear;
-ListCache.prototype["delete"] = listCacheDelete;
-ListCache.prototype.get = listCacheGet;
-ListCache.prototype.has = listCacheHas;
-ListCache.prototype.set = listCacheSet;
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function MapCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */ function mapCacheClear() {
- this.__data__ = {
- "hash": new Hash,
- "map": new (Map || ListCache),
- "string": new Hash
- };
-}
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function mapCacheDelete(key) {
- return getMapData(this, key)["delete"](key);
-}
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function mapCacheGet(key) {
- return getMapData(this, key).get(key);
-}
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function mapCacheHas(key) {
- return getMapData(this, key).has(key);
-}
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */ function mapCacheSet(key, value) {
- getMapData(this, key).set(key, value);
- return this;
-}
-// Add methods to `MapCache`.
-MapCache.prototype.clear = mapCacheClear;
-MapCache.prototype["delete"] = mapCacheDelete;
-MapCache.prototype.get = mapCacheGet;
-MapCache.prototype.has = mapCacheHas;
-MapCache.prototype.set = mapCacheSet;
-/**
- *
- * Creates an array cache object to store unique values.
- *
- * @private
- * @constructor
- * @param {Array} [values] The values to cache.
- */ function SetCache(values) {
- var index = -1, length = values ? values.length : 0;
- this.__data__ = new MapCache;
- while(++index < length)this.add(values[index]);
-}
-/**
- * Adds `value` to the array cache.
- *
- * @private
- * @name add
- * @memberOf SetCache
- * @alias push
- * @param {*} value The value to cache.
- * @returns {Object} Returns the cache instance.
- */ function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
-}
-/**
- * Checks if `value` is in the array cache.
- *
- * @private
- * @name has
- * @memberOf SetCache
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
- */ function setCacheHas(value) {
- return this.__data__.has(value);
-}
-// Add methods to `SetCache`.
-SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
-SetCache.prototype.has = setCacheHas;
-/**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function Stack(entries) {
- this.__data__ = new ListCache(entries);
-}
-/**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */ function stackClear() {
- this.__data__ = new ListCache;
-}
-/**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function stackDelete(key) {
- return this.__data__["delete"](key);
-}
-/**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function stackGet(key) {
- return this.__data__.get(key);
-}
-/**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function stackHas(key) {
- return this.__data__.has(key);
-}
-/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */ function stackSet(key, value) {
- var cache = this.__data__;
- if (cache instanceof ListCache) {
- var pairs = cache.__data__;
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
- pairs.push([
- key,
- value
- ]);
- return this;
- }
- cache = this.__data__ = new MapCache(pairs);
- }
- cache.set(key, value);
- return this;
-}
-// Add methods to `Stack`.
-Stack.prototype.clear = stackClear;
-Stack.prototype["delete"] = stackDelete;
-Stack.prototype.get = stackGet;
-Stack.prototype.has = stackHas;
-Stack.prototype.set = stackSet;
-/**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */ function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
- var length = result.length, skipIndexes = !!length;
- for(var key in value)if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) result.push(key);
- return result;
-}
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function assocIndexOf(array, key) {
- var length = array.length;
- while(length--){
- if (eq(array[length][0], key)) return length;
- }
- return -1;
-}
-/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */ function baseGet(object, path) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var index = 0, length = path.length;
- while(object != null && index < length)object = object[toKey(path[index++])];
- return index && index == length ? object : undefined;
-}
-/**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ function baseGetTag(value) {
- return objectToString.call(value);
-}
-/**
- * The base implementation of `_.hasIn` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */ function baseHasIn(object, key) {
- return object != null && key in Object(object);
-}
-/**
- * The base implementation of `_.isEqual` which supports partial comparisons
- * and tracks traversed objects.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {boolean} [bitmask] The bitmask of comparison flags.
- * The bitmask may be composed of the following flags:
- * 1 - Unordered comparison
- * 2 - Partial comparison
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */ function baseIsEqual(value, other, customizer, bitmask, stack) {
- if (value === other) return true;
- if (value == null || other == null || !isObject(value) && !isObjectLike(other)) return value !== value && other !== other;
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
-}
-/**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag;
- if (!objIsArr) {
- objTag = getTag(object);
- objTag = objTag == argsTag ? objectTag : objTag;
- }
- if (!othIsArr) {
- othTag = getTag(other);
- othTag = othTag == argsTag ? objectTag : othTag;
- }
- var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack);
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
- }
- if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack);
- return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
- }
- }
- if (!isSameTag) return false;
- stack || (stack = new Stack);
- return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
-}
-/**
- * The base implementation of `_.isMatch` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to inspect.
- * @param {Object} source The object of property values to match.
- * @param {Array} matchData The property names, values, and compare flags to match.
- * @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
- */ function baseIsMatch(object, source, matchData, customizer) {
- var index = matchData.length, length = index, noCustomizer = !customizer;
- if (object == null) return !length;
- object = Object(object);
- while(index--){
- var data = matchData[index];
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
- }
- while(++index < length){
- data = matchData[index];
- var key = data[0], objValue = object[key], srcValue = data[1];
- if (noCustomizer && data[2]) {
- if (objValue === undefined && !(key in object)) return false;
- } else {
- var stack = new Stack;
- if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
- if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) return false;
- }
- }
- return true;
-}
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */ function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) return false;
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
-}
-/**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */ function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
-}
-/**
- * The base implementation of `_.iteratee`.
- *
- * @private
- * @param {*} [value=_.identity] The value to convert to an iteratee.
- * @returns {Function} Returns the iteratee.
- */ function baseIteratee(value) {
- // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
- // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
- if (typeof value == "function") return value;
- if (value == null) return identity;
- if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
- return property(value);
-}
-/**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */ function baseKeys(object) {
- if (!isPrototype(object)) return nativeKeys(object);
- var result = [];
- for(var key in Object(object))if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key);
- return result;
-}
-/**
- * The base implementation of `_.matches` which doesn't clone `source`.
- *
- * @private
- * @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatches(source) {
- var matchData = getMatchData(source);
- if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
- return function(object) {
- return object === source || baseIsMatch(object, source, matchData);
- };
-}
-/**
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
- *
- * @private
- * @param {string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function baseMatchesProperty(path, srcValue) {
- if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
- return function(object) {
- var objValue = get(object, path);
- return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
- };
-}
-/**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- */ function basePropertyDeep(path) {
- return function(object) {
- return baseGet(object, path);
- };
-}
-/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */ function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == "string") return value;
- if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * The base implementation of `_.uniqBy` without support for iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee] The iteratee invoked per element.
- * @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- */ function baseUniq(array, iteratee, comparator) {
- var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
- if (comparator) {
- isCommon = false;
- includes = arrayIncludesWith;
- } else if (length >= LARGE_ARRAY_SIZE) {
- var set = iteratee ? null : createSet(array);
- if (set) return setToArray(set);
- isCommon = false;
- includes = cacheHas;
- seen = new SetCache;
- } else seen = iteratee ? [] : result;
- outer: while(++index < length){
- var value = array[index], computed = iteratee ? iteratee(value) : value;
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed === computed) {
- var seenIndex = seen.length;
- while(seenIndex--){
- if (seen[seenIndex] === computed) continue outer;
- }
- if (iteratee) seen.push(computed);
- result.push(value);
- } else if (!includes(seen, computed, comparator)) {
- if (seen !== result) seen.push(computed);
- result.push(value);
- }
- }
- return result;
-}
-/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */ function castPath(value) {
- return isArray(value) ? value : stringToPath(value);
-}
-/**
- * Creates a set object of `values`.
- *
- * @private
- * @param {Array} values The values to add to the set.
- * @returns {Object} Returns the new set.
- */ var createSet = !(Set && 1 / setToArray(new Set([
- ,
- -0
-]))[1] == INFINITY) ? noop : function(values) {
- return new Set(values);
-};
-/**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `array` and `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(array);
- if (stacked && stack.get(other)) return stacked == other;
- var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache : undefined;
- stack.set(array, other);
- stack.set(other, array);
- // Ignore non-index properties.
- while(++index < arrLength){
- var arrValue = array[index], othValue = other[index];
- if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
- if (compared !== undefined) {
- if (compared) continue;
- result = false;
- break;
- }
- // Recursively compare arrays (susceptible to call stack limits).
- if (seen) {
- if (!arraySome(other, function(othValue, othIndex) {
- if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) return seen.add(othIndex);
- })) {
- result = false;
- break;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
- result = false;
- break;
- }
- }
- stack["delete"](array);
- stack["delete"](other);
- return result;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
- switch(tag){
- case dataViewTag:
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
- object = object.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false;
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- // Coerce booleans to `1` or `0` and dates to milliseconds.
- // Invalid dates are coerced to `NaN`.
- return eq(+object, +other);
- case errorTag:
- return object.name == other.name && object.message == other.message;
- case regexpTag:
- case stringTag:
- // Coerce regexes to strings and treat strings, primitives and objects,
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
- // for more details.
- return object == other + "";
- case mapTag:
- var convert = mapToArray;
- case setTag:
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
- convert || (convert = setToArray);
- if (object.size != other.size && !isPartial) return false;
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked) return stacked == other;
- bitmask |= UNORDERED_COMPARE_FLAG;
- // Recursively compare objects (susceptible to call stack limits).
- stack.set(object, other);
- var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
- stack["delete"](object);
- return result;
- case symbolTag:
- if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- return false;
-}
-/**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
- * for more details.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
- if (objLength != othLength && !isPartial) return false;
- var index = objLength;
- while(index--){
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false;
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked && stack.get(other)) return stacked == other;
- var result = true;
- stack.set(object, other);
- stack.set(other, object);
- var skipCtor = isPartial;
- while(++index < objLength){
- key = objProps[index];
- var objValue = object[key], othValue = other[key];
- if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
- // Recursively compare objects (susceptible to call stack limits).
- if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == "constructor");
- }
- if (result && !skipCtor) {
- var objCtor = object.constructor, othCtor = other.constructor;
- // Non `Object` object instances with different constructors are not equal.
- if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
- }
- stack["delete"](object);
- stack["delete"](other);
- return result;
-}
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */ function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
-}
-/**
- * Gets the property names, values, and compare flags of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the match data of `object`.
- */ function getMatchData(object) {
- var result = keys(object), length = result.length;
- while(length--){
- var key = result[length], value = object[key];
- result[length] = [
- key,
- value,
- isStrictComparable(value)
- ];
- }
- return result;
-}
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */ function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
-}
-/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */ var getTag = baseGetTag;
-// Fallback for data views, maps, sets, and weak maps in IE 11,
-// for data views in Edge < 14, and promises in Node.js.
-if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap && getTag(new WeakMap) != weakMapTag) getTag = function(value) {
- var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) switch(ctorString){
- case dataViewCtorString:
- return dataViewTag;
- case mapCtorString:
- return mapTag;
- case promiseCtorString:
- return promiseTag;
- case setCtorString:
- return setTag;
- case weakMapCtorString:
- return weakMapTag;
- }
- return result;
-};
-/**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */ function hasPath(object, path, hasFunc) {
- path = isKey(path, object) ? [
- path
- ] : castPath(path);
- var result, index = -1, length = path.length;
- while(++index < length){
- var key = toKey(path[index]);
- if (!(result = object != null && hasFunc(object, key))) break;
- object = object[key];
- }
- if (result) return result;
- var length = object ? object.length : 0;
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
-}
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */ function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
-}
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */ function isKey(value, object) {
- if (isArray(value)) return false;
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
-}
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */ function isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
-}
-/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */ function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
-}
-/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */ function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
-}
-/**
- * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` if suitable for strict
- * equality comparisons, else `false`.
- */ function isStrictComparable(value) {
- return value === value && !isObject(value);
-}
-/**
- * A specialized version of `matchesProperty` for source values suitable
- * for strict equality comparisons, i.e. `===`.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */ function matchesStrictComparable(key, srcValue) {
- return function(object) {
- if (object == null) return false;
- return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
- };
-}
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */ var stringToPath = memoize(function(string) {
- string = toString(string);
- var result = [];
- if (reLeadingDot.test(string)) result.push("");
- string.replace(rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace(reEscapeChar, "$1") : number || match);
- });
- return result;
-});
-/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */ function toKey(value) {
- if (typeof value == "string" || isSymbol(value)) return value;
- var result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
-}
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */ function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return func + "";
- } catch (e) {}
- }
- return "";
-}
-/**
- * This method is like `_.uniq` except that it accepts `iteratee` which is
- * invoked for each element in `array` to generate the criterion by which
- * uniqueness is computed. The iteratee is invoked with one argument: (value).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
- * @returns {Array} Returns the new duplicate free array.
- * @example
- *
- * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
- * // => [2.1, 1.2]
- *
- * // The `_.property` iteratee shorthand.
- * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
- * // => [{ 'x': 1 }, { 'x': 2 }]
- */ function uniqBy(array, iteratee) {
- return array && array.length ? baseUniq(array, baseIteratee(iteratee, 2)) : [];
-}
-/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */ function memoize(func, resolver) {
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) return cache.get(key);
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result);
- return result;
- };
- memoized.cache = new (memoize.Cache || MapCache);
- return memoized;
-}
-// Assign cache to `_.memoize`.
-memoize.Cache = MapCache;
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */ function eq(value, other) {
- return value === other || value !== value && other !== other;
-}
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */ function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var isArray = Array.isArray;
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */ function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */ function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : "";
- return tag == funcTag || tag == genTag;
-}
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */ function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */ function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
-}
-/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
-/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */ function toString(value) {
- return value == null ? "" : baseToString(value);
-}
-/**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is returned in its place.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */ function get(object, path, defaultValue) {
- var result = object == null ? undefined : baseGet(object, path);
- return result === undefined ? defaultValue : result;
-}
-/**
- * Checks if `path` is a direct or inherited property of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.hasIn(object, 'a');
- * // => true
- *
- * _.hasIn(object, 'a.b');
- * // => true
- *
- * _.hasIn(object, ['a', 'b']);
- * // => true
- *
- * _.hasIn(object, 'b');
- * // => false
- */ function hasIn(object, path) {
- return object != null && hasPath(object, path, baseHasIn);
-}
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */ function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
-}
-/**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */ function identity(value) {
- return value;
-}
-/**
- * This method returns `undefined`.
- *
- * @static
- * @memberOf _
- * @since 2.3.0
- * @category Util
- * @example
- *
- * _.times(2, _.noop);
- * // => [undefined, undefined]
- */ function noop() {
-// No operation performed.
-}
-/**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': 2 } },
- * { 'a': { 'b': 1 } }
- * ];
- *
- * _.map(objects, _.property('a.b'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
- * // => [1, 2]
- */ function property(path) {
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
-}
-module.exports = uniqBy;
-
-});
-
-
-
-parcelRegister("fZImH", function(module, exports) {
-
-$parcel$export(module.exports, "ETreeItemName", () => $20fc86ccd041c347$export$3751518b963d0bba);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-const $20fc86ccd041c347$export$3751518b963d0bba = ({ name: name, item: item, renaming: renaming, doneRenaming: doneRenaming, isComponent: isComponent })=>{
- if (renaming) return /*#__PURE__*/ (0, $lAN3N.jsx)($20fc86ccd041c347$var$Renaming, {
- doneRenaming: doneRenaming,
- isComponent: isComponent,
- name: name,
- id: item.id
- });
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("text-sm flex-1 "),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: name
- })
- });
-};
-const $20fc86ccd041c347$var$Renaming = ({ name: name, doneRenaming: doneRenaming, isComponent: isComponent, id: id })=>{
- const local = (0, $4WfNn.useLocal)({
- newname: name
- });
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const item = p.treeMeta[id].mitem;
- if (!item) return null;
- const rootComponentID = p.comp?.id;
- const itemComponent = item.get("component")?.toJSON();
- let isRootComponent = false;
- if (itemComponent && itemComponent.id === rootComponentID) isRootComponent = true;
- return /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- type: "text",
- title: "Rename",
- value: local.newname,
- className: "border px-1 text-sm flex-1 rounded-none outline-none border-2 border-blue-500",
- spellCheck: false,
- onChange: (e)=>{
- local.newname = e.currentTarget.value;
- local.render();
- },
- onFocus: (e)=>{
- e.currentTarget.select();
- },
- onKeyDown: (e)=>{
- if (e.key === "Enter") e.currentTarget.blur();
- },
- onBlur: ()=>{
- doneRenaming();
- if (isComponent) {
- const comp = item.get("component");
- if (comp) comp.set("name", local.newname);
- } else item.set("name", local.newname);
- if (isRootComponent && rootComponentID) {
- const doc = p.comps.doc[rootComponentID];
- if (doc) doc.transact(()=>{
- const comp = doc.getMap("map");
- comp.set("name", local.newname);
- const ctree = comp.get("content_tree");
- if (ctree) {
- ctree.set("name", local.newname);
- const ccomp = ctree.get("component");
- if (ccomp) ccomp.set("name", local.newname);
- }
- });
- }
- },
- autoFocus: true
- });
-};
-
-});
-
-parcelRegister("6j5bw", function(module, exports) {
-
-$parcel$export(module.exports, "treeItemStyle", () => $633451c2c203be88$export$45889fe7f7b90b09);
-const $633451c2c203be88$export$45889fe7f7b90b09 = (arg)=>{
- const { isComponent: isComponent, isActive: isActive, isHover: isHover, isSelect: isSelect } = arg;
- return cx("item flex items-stretch cursor-pointer border-b relative ", // isParentActive && !isActive && !isHover && "bg-blue-100",
- isComponent && !isActive && !isHover && "bg-purple-50", isActive && "bg-blue-100", isHover && "bg-blue-50", isSelect ? "bg-blue-100" : "", css`
- min-height: 28px;
- > div {
- display: flex;
- align-items: center;
- }
-
- .action {
- opacity: 0.2;
- }
-
- .pre-action {
- display: none;
- }
-
- &:hover {
- .pre-action {
- display: flex;
- }
- .action {
- opacity: 1;
- }
- }
- `);
-};
-
-});
-
-
-parcelRegister("3IA4F", function(module, exports) {
-
-$parcel$export(module.exports, "ETreeRightClick", () => $69633c1fb89c9f78$export$179f9672895c87d3);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $521T4 = parcelRequire("521T4");
-
-var $cfpVL = parcelRequire("cfpVL");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $8QizP = parcelRequire("8QizP");
-
-var $aVHaH = parcelRequire("aVHaH");
-
-var $0t7p0 = parcelRequire("0t7p0");
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $dJKat = parcelRequire("dJKat");
-
-var $k9AAW = parcelRequire("k9AAW");
-
-var $6QgH2 = parcelRequire("6QgH2");
-
-var $ax46r = parcelRequire("ax46r");
-
-var $iZtVP = parcelRequire("iZtVP");
-
-var $8u89v = parcelRequire("8u89v");
-const $69633c1fb89c9f78$export$179f9672895c87d3 = ({ node: node, event: event, onClose: onClose })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- clipboardAllowed: false,
- compGroups: {
- list: [],
- choose: null
- }
- });
- const item = node.data?.meta.item;
- const type = item?.type;
- const comp = item.component;
- const rootComp = p.comp;
- const isActiveComponent = rootComp && rootComp.id === item?.id && rootComp.id;
- if (local.compGroups.list && local.compGroups.list.length === 0) db.component_group.findMany({
- where: {
- component_site: {
- some: {
- id_site: p.site.id
- }
- }
- }
- }).then(async (comps)=>{
- if (comps && comps.length === 0) {
- const res = await db.component_group.create({
- data: {
- component_site: {
- create: {
- id_site: p.site?.id || ""
- }
- },
- name: "All"
- }
- });
- local.compGroups.list = [
- res
- ];
- local.render();
- } else {
- local.compGroups.list = comps;
- local.render();
- }
- });
- if (local.compGroups.choose) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.Menu), {
- mouseEvent: event,
- onClose: onClose,
- children: local.compGroups.list.sort((a, b)=>{
- if (a.name < b.name) return -1;
- if (a.name > b.name) return 1;
- return 0;
- }).map((e)=>{
- if (e.name === "__TRASH__") return null;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: e.name,
- onClick: ()=>{
- if (local.compGroups.choose) local.compGroups.choose(e.id);
- local.compGroups.choose = null;
- local.render();
- }
- }, e.id);
- })
- });
- if (!item) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.Menu), {
- mouseEvent: event,
- onClose: onClose,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-gray-400",
- children: "Unavailable"
- })
- })
- });
- const mitem = p.treeMeta[item.id].mitem;
- const mcomp = mitem ? mitem.get("component") : null;
- if (!mitem) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.Menu), {
- mouseEvent: event,
- onClose: onClose,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-gray-400",
- children: "Unavailable"
- })
- })
- });
- let canDelete = true;
- let isPropContent = false;
- if (mitem && mitem.parent.get("content")) isPropContent = true;
- if (isPropContent || rootComp?.id === item.id) canDelete = false;
- navigator.clipboard.readText().then((e)=>{
- local.clipboardAllowed = e.includes("prasi") ? true : false;
- }).catch(()=>{});
- const paste = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: local.clipboardAllowed && (type === "item" || type === "section") ? "Paste" : /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-gray-400",
- children: "Paste"
- }),
- onClick: ()=>{
- if (mitem && (type === "item" || type === "section")) {
- let _mitem = mitem;
- if (comp?.id && rootComp && comp.id === rootComp.id) _mitem = p.comps.doc[comp.id].getMap("map").get("content_tree");
- if (_mitem) {
- if (_mitem.get("childs")) {
- let paste = "";
- try {
- navigator.clipboard.readText().then((e)=>{
- paste = e;
- let desc = paste.replaceAll("_prasi", "");
- let obj = {};
- let jso = JSON.parse(desc);
- const childs = (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(jso, "data");
- if (childs) {
- p.item.selection = [];
- let select = [];
- _mitem.doc?.transact(()=>{
- childs.map((e)=>{
- const nmap = (0, $dJKat.fillID)(e);
- const map = new $aVHaH.Map();
- (0, $8QizP.syncronize)(map, nmap);
- if (map) {
- const childs = _mitem.get("childs");
- if (childs) // console.log("push", map);
- childs.push([
- map
- ]);
- const item = map.toJSON();
- select.push(item.id);
- p.render();
- }
- });
- });
- p.item.active = "";
- p.item.selection = select;
- } else _mitem.doc?.transact(()=>{
- if (jso.type === "section") {
- const newItem = {
- id: (0, $521T4.createId)(),
- name: jso.name,
- type: "item",
- dim: {
- w: "fit",
- h: "fit"
- },
- childs: jso.childs,
- component: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(jso, "component"),
- adv: jso.adv
- };
- obj = newItem;
- } else obj = jso;
- let walkId = [];
- const nmap = (0, $dJKat.fillID)(obj);
- const map = new $aVHaH.Map();
- (0, $8QizP.syncronize)(map, nmap);
- if (map) {
- const childs = _mitem.get("childs");
- if (childs) // console.log("push", map);
- childs.push([
- map
- ]);
- const item = map.toJSON();
- walkId.push(item.id);
- p.render();
- }
- p.item.active = "";
- p.item.selection = walkId;
- });
- (0, $8u89v.rebuildTree)(p, {
- mode: "update",
- note: "paste"
- });
- });
- } catch (error) {}
- }
- }
- }
- }
- });
- if (comp?.id && rootComp && comp.id === rootComp.id) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.Menu), {
- mouseEvent: event,
- onClose: onClose,
- children: paste
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $0t7p0.Menu), {
- mouseEvent: event,
- onClose: onClose,
- children: [
- type === "item" && !isActiveComponent && !item.component?.id && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Attach Component",
- onClick: ()=>{
- const ccid = rootComp?.id;
- p.item.active = item.id;
- const pick = ()=>{
- p.manager.comp = true;
- p.manager.compActionLabel = "Attach";
- p.manager.compCallback = async (comp)=>{
- if (ccid && comp?.id === ccid) {
- alert("WARNING: Failed to add self, preventing recursive component!");
- setTimeout(()=>{
- pick();
- }, 100);
- return;
- }
- if (mitem.doc) {
- let compitem = p.comps.doc[comp.id];
- p.compLoading[item.id] = true;
- p.render();
- if (!compitem) {
- await (0, $5NYeV.loadComponent)(p, comp.id);
- compitem = p.comps.doc[comp.id];
- }
- mitem.doc.transact(()=>{
- const citem = (0, $dJKat.fillID)(compitem.getMap("map").get("content_tree")?.toJSON());
- if (citem) (0, $8QizP.syncronize)(mitem, {
- id: citem.id,
- name: citem.name,
- childs: [],
- component: {
- ...citem.component,
- id: citem.component?.id
- },
- type: "item"
- });
- delete p.compLoading[item.id];
- p.render();
- });
- }
- };
- p.render();
- };
- pick();
- }
- }),
- comp?.id && !isActiveComponent && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Detach",
- onClick: async ()=>{
- if (!(0, $ax46r.jscript).build) await (0, $ax46r.jscript).init();
- if ((0, $ax46r.jscript).build && p.treeMeta[item.id]) (0, $iZtVP.detachComp)(p, item.id, p.treeMeta[item.id].mitem, (0, $ax46r.jscript).build);
- }
- }),
- !comp?.id && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: type === "item" && !isActiveComponent ? "Create Component" : /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-gray-400",
- children: "Create Component"
- }),
- onClick: (e)=>{
- if (type === "item") {
- if (item.id) {
- if (!isActiveComponent) {
- e.stopPropagation();
- e.preventDefault();
- local.compGroups.choose = (group_id)=>{
- p.compLoading[item.id] = true;
- p.render();
- api.comp_create({
- item_id: item.originalId || item.id,
- site_id: p.site.id || "",
- page_id: rootComp ? undefined : p.page?.id,
- comp_id: rootComp ? rootComp.id : undefined,
- group_id: group_id
- }).then(async (e)=>{
- if (e) {
- await (0, $5NYeV.loadComponent)(p, e.id);
- delete p.compLoading[item.id];
- p.softRender.all();
- }
- });
- };
- local.render();
- } else alert(`This item is already a component!`);
- }
- } else alert(`Component type must be an ITEM, not ${item.type?.toUpperCase()}.`);
- }
- }),
- !item.hidden && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Hide",
- onClick: ()=>{
- let listItem = p.item.selection;
- if (listItem.length) {
- // hidden multiple
- const listContent = listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) return meta.mitem.toJSON();
- });
- let res = (0, $k9AAW.flatTree)(listContent);
- res.map((e)=>{
- const meta = p.treeMeta[e.id];
- if (meta && meta.mitem) {
- meta.mitem.set("hidden", "only-editor");
- p.render();
- }
- });
- } else {
- mitem.set("hidden", "only-editor");
- p.render();
- }
- }
- }),
- item.hidden && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Show",
- onClick: ()=>{
- let listItem = p.item.selection;
- if (listItem.length) {
- // hidden multiple
- const listContent = listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) return meta.mitem.toJSON();
- });
- let res = (0, $k9AAW.flatTree)(listContent);
- res.map((e)=>{
- const meta = p.treeMeta[e.id];
- if (meta && meta.mitem) meta.mitem.set("hidden", false);
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- } else {
- mitem.set("hidden", false);
- p.render();
- }
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Clone",
- onClick: ()=>{
- let listItem = p.item.selection;
- if (listItem.length) {
- const listContent = listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) return meta.mitem.toJSON();
- });
- let res = (0, $k9AAW.flatTree)(listContent);
- res.forEach((e)=>{
- let meta = p.treeMeta[e.id];
- if (meta && meta.mitem) {
- const mitem = meta.mitem;
- mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- const map = (0, $6QgH2.newMap)((0, $dJKat.fillID)(json));
- mitem.parent.insert(idx, [
- map
- ]);
- }
- });
- }
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- } else mitem.doc?.transact(()=>{
- mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- const map = (0, $6QgH2.newMap)((0, $dJKat.fillID)(json));
- mitem.parent.insert(idx, [
- map
- ]);
- }
- });
- });
- }
- }),
- canDelete && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Cut",
- onClick: ()=>{
- let clipboardText = "";
- if (p.item.selection.length) {
- let data = p.item.selection.map((id)=>{
- const meta = p.treeMeta[id];
- if (meta && meta.mitem) {
- let jso = meta.mitem.toJSON();
- if (jso.type === "section") {
- const newItem = {
- id: jso.id,
- name: jso.name,
- type: "item",
- dim: {
- w: "fit",
- h: "fit"
- },
- childs: jso.childs,
- component: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(jso, "component"),
- adv: jso.adv
- };
- return newItem;
- }
- return jso;
- }
- });
- data = data.filter((x)=>typeof x !== "string");
- let rootContent = JSON.parse(JSON.stringify({
- data: data
- }));
- let flat = rootContent.data;
- let res = (0, $k9AAW.flatTree)(flat);
- clipboardText = JSON.stringify({
- data: res
- });
- } else clipboardText = JSON.stringify(item);
- let str = clipboardText + "_prasi";
- navigator.clipboard.writeText(str);
- mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) mitem.parent.delete(idx);
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- (0, $8u89v.rebuildTree)(p, {
- mode: "update",
- note: "cut"
- });
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Copy",
- onClick: ()=>{
- let clipboardText = "";
- if (p.item.selection.length) {
- let data = p.item.selection.map((id)=>{
- const meta = p.treeMeta[id];
- if (meta && meta.mitem) {
- let jso = meta.mitem.toJSON();
- if (jso.type === "section") {
- const newItem = {
- id: jso.id,
- name: jso.name,
- type: "item",
- dim: {
- w: "fit",
- h: "fit"
- },
- childs: jso.childs,
- component: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(jso, "component"),
- adv: jso.adv
- };
- return newItem;
- }
- return jso;
- }
- });
- data = data.filter((x)=>typeof x !== "string");
- let rootContent = JSON.parse(JSON.stringify({
- data: data
- }));
- let flat = rootContent.data;
- let res = (0, $k9AAW.flatTree)(flat);
- clipboardText = JSON.stringify({
- data: res
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- } else clipboardText = JSON.stringify(item);
- let str = clipboardText + "_prasi";
- navigator.clipboard.writeText(str);
- }
- }),
- paste,
- (type === "text" || type === "item") && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: `Wrap`,
- onClick: ()=>{
- mitem.doc?.transact(()=>{
- let listItem = p.item.selection;
- if (listItem.length) {
- const listContent = listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) {
- if (meta.mitem.get("type") === "section") {
- const json = meta.mitem.toJSON();
- const newItem = {
- id: json.id,
- name: json.name,
- type: "item",
- dim: {
- w: "fit",
- h: "fit"
- },
- adv: json.adv,
- childs: json.childs || [],
- component: json.component
- };
- return newItem;
- }
- return meta.mitem.toJSON();
- }
- });
- let targetIdx = -1;
- listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) {
- const jso = meta.mitem;
- jso.parent.forEach((e, idx)=>{
- if (e === jso) {
- targetIdx = idx;
- jso.parent.delete(idx);
- }
- });
- }
- });
- let to = p.treeMeta[node.parent];
- if (to && to.mitem) {
- const titem = to.mitem;
- const childs = titem.get("childs");
- let res = (0, $k9AAW.flatTree)(listContent);
- const json = {
- id: (0, $521T4.createId)(),
- name: `Wrapped`,
- type: "item",
- childs: res
- };
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- childs?.insert(targetIdx, [
- map
- ]);
- }
- }
- } else mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = {
- id: (0, $521T4.createId)(),
- name: `Wrapped`,
- type: "item",
- childs: [
- e.toJSON()
- ]
- };
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- mitem.parent.delete(idx);
- mitem.parent.insert(idx, [
- map
- ]);
- }
- }
- });
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- }
- }),
- type === "item" && !mcomp?.get("id") && canDelete && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: `Unwrap`,
- onClick: ()=>{
- mitem.doc?.transact(()=>{
- let listItem = p.item.selection;
- if (listItem.length) {
- const listContent = listItem.map((e)=>{
- let meta = p.treeMeta[e];
- if (meta && meta.mitem) return meta.mitem.toJSON();
- });
- let res = (0, $k9AAW.flatTree)(listContent);
- res.forEach((e)=>{
- let meta = p.treeMeta[e.id];
- if (meta && meta.mitem) {
- const mitem = meta.mitem;
- mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- if (json.type === "item") {
- mitem.parent.delete(idx);
- mitem.parent.insert(idx, json.childs.map((e)=>{
- return (0, $6QgH2.newMap)((0, $dJKat.fillID)(e));
- }));
- }
- }
- });
- }
- });
- } else mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === mitem.get("id")) {
- const json = e.toJSON();
- if (json.type === "item") {
- mitem.parent.delete(idx);
- mitem.parent.insert(idx, json.childs.map((e)=>{
- const map = new $aVHaH.Map();
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(e));
- return map;
- }));
- }
- }
- });
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- }
- }),
- canDelete && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: "Delete",
- onClick: ()=>{
- mitem.doc?.transact(()=>{
- if (p.item.selection.length) ;
- else mitem.parent.forEach((e, idx)=>{
- if (e.get("id") === item.id) mitem.parent.delete(idx);
- });
- });
- p.item.selectMode = "single";
- p.item.selection = [];
- p.render();
- }
- })
- ]
- });
-};
-const $69633c1fb89c9f78$var$walkContent = (item, result)=>{
- const _result = result || [];
- _result.push(item);
- item.get("childs")?.forEach((e)=>{
- $69633c1fb89c9f78$var$walkContent(e, _result);
- });
- return _result;
-};
-const $69633c1fb89c9f78$var$walk = (item, result)=>{
- const _result = result || [];
- _result.push(item.get("id") || "");
- item.get("childs")?.forEach((e)=>{
- $69633c1fb89c9f78$var$walk(e, _result);
- });
- return _result;
-};
-
-});
-parcelRegister("0t7p0", function(module, exports) {
-
-$parcel$export(module.exports, "MenuItem", () => $4a08a98f32358ecf$export$2ce376c2cc3355c8);
-$parcel$export(module.exports, "Menu", () => $4a08a98f32358ecf$export$d9b273488cd8ce6f);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $91fsP = parcelRequire("91fsP");
-var $l2jTt = parcelRequire("l2jTt");
-var $7rwqM = parcelRequire("7rwqM");
-var $l2jTt = parcelRequire("l2jTt");
-
-var $63SH6 = parcelRequire("63SH6");
-
-const $4a08a98f32358ecf$export$2ce376c2cc3355c8 = /*#__PURE__*/ (0, $63SH6.forwardRef)(({ label: label, disabled: disabled, ...props }, ref)=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)("button", {
- ...props,
- className: "MenuItem",
- ref: ref,
- role: "menuitem",
- disabled: disabled,
- onContextMenu: (e)=>{
- e.preventDefault();
- e.stopPropagation();
- },
- children: label
- });
-});
-const $4a08a98f32358ecf$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $63SH6.forwardRef)(({ children: children, mouseEvent: contextMenu, onClose: onClose }, forwardedRef)=>{
- const [activeIndex, setActiveIndex] = (0, $63SH6.useState)(null);
- const [isOpen, setIsOpen] = (0, $63SH6.useState)(false);
- const [init, setInit] = (0, $63SH6.useState)(false);
- const listItemsRef = (0, $63SH6.useRef)([]);
- const listContentRef = (0, $63SH6.useRef)((0, $63SH6.Children).map(children, (child)=>/*#__PURE__*/ (0, $63SH6.isValidElement)(child) ? child.props.label : null));
- const allowMouseUpCloseRef = (0, $63SH6.useRef)(false);
- const { refs: refs, floatingStyles: floatingStyles, context: context } = (0, $7rwqM.useFloating)({
- open: contextMenu ? isOpen : true,
- onOpenChange: setIsOpen,
- middleware: [
- (0, $l2jTt.offset)({
- mainAxis: 5,
- alignmentAxis: 4
- }),
- (0, $l2jTt.flip)({
- fallbackPlacements: [
- "left-start"
- ]
- }),
- (0, $l2jTt.shift)({
- padding: 10
- })
- ],
- placement: "right-start",
- strategy: "fixed",
- whileElementsMounted: (0, $91fsP.autoUpdate)
- });
- const role = (0, $7rwqM.useRole)(context, {
- role: "menu"
- });
- const dismiss = (0, $7rwqM.useDismiss)(context);
- const listNavigation = (0, $7rwqM.useListNavigation)(context, {
- listRef: listItemsRef,
- onNavigate: setActiveIndex,
- activeIndex: activeIndex
- });
- const typeahead = (0, $7rwqM.useTypeahead)(context, {
- enabled: isOpen,
- listRef: listContentRef,
- onMatch: setActiveIndex,
- activeIndex: activeIndex
- });
- const { getFloatingProps: getFloatingProps, getItemProps: getItemProps } = (0, $7rwqM.useInteractions)([
- role,
- dismiss,
- listNavigation,
- typeahead
- ]);
- (0, $63SH6.useEffect)(()=>{
- const e = contextMenu;
- e.preventDefault();
- refs.setPositionReference({
- getBoundingClientRect () {
- return {
- width: 0,
- height: 0,
- x: e.clientX,
- y: e.clientY,
- top: e.clientY,
- right: e.clientX,
- bottom: e.clientY,
- left: e.clientX
- };
- }
- });
- setIsOpen(true);
- allowMouseUpCloseRef.current = false;
- function onMouseUp() {
- if (allowMouseUpCloseRef.current) setIsOpen(false);
- }
- document.addEventListener("mouseup", onMouseUp);
- return ()=>{
- document.removeEventListener("mouseup", onMouseUp);
- };
- }, [
- refs
- ]);
- (0, $63SH6.useEffect)(()=>{
- if (!isOpen) {
- if (!init) {
- setInit(true);
- return;
- }
- if (onClose) onClose();
- }
- }, [
- isOpen
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingPortal), {
- children: isOpen && init && // {
- // e.preventDefault();
- // e.stopPropagation();
- // setIsOpen(false);
- // }}
- // >
- //
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "ContextMenu",
- ref: refs.setFloating,
- style: floatingStyles,
- ...getFloatingProps(),
- onContextMenu: (e)=>{
- e.preventDefault();
- e.stopPropagation();
- setIsOpen(false);
- },
- children: (0, $63SH6.Children).map(children, (child, index)=>/*#__PURE__*/ (0, $63SH6.isValidElement)(child) && /*#__PURE__*/ (0, $63SH6.cloneElement)(child, getItemProps({
- tabIndex: activeIndex === index ? 0 : -1,
- ref (node) {
- listItemsRef.current[index] = node;
- },
- onClick (e) {
- child.props.onClick?.(e);
- if (!e.defaultPrevented) setIsOpen(false);
- }
- })))
- })
- });
-});
-
-});
-
-parcelRegister("k9AAW", function(module, exports) {
-
-$parcel$export(module.exports, "flatTree", () => $74ab60e53b02530f$export$b512051899016d01);
-
-var $bVY3H = parcelRequire("bVY3H");
-
-var $cfpVL = parcelRequire("cfpVL");
-
-var $empv1 = parcelRequire("empv1");
-const $74ab60e53b02530f$export$b512051899016d01 = (item)=>{
- const children = item;
- let ls = structuredClone(item);
- let sitem = ls.map((v)=>{
- if (v.type !== "text") v.childs = [];
- return {
- ...v
- };
- });
- let result = [];
- sitem.forEach((v)=>{
- let parent = children.filter((x)=>(0, (/*@__PURE__*/$parcel$interopDefault($bVY3H)))((0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(x, "childs"), (x)=>x.id === v.id));
- if ((0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(parent, "length")) {
- let s = sitem.find((e)=>e.id === (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(parent, "[0].id"));
- let childs = s.childs || [];
- childs = childs.filter((e)=>(0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(e, "id")) || [];
- let now = [
- v
- ];
- (0, (/*@__PURE__*/$parcel$interopDefault($empv1)))(s, "childs", childs.concat(now));
- } else result.push(v);
- });
- return result;
-};
-
-});
-
-parcelRegister("iZtVP", function(module, exports) {
-
-$parcel$export(module.exports, "detachComp", () => $7f335a0fc9fc572d$export$f724e65743857c5a);
-
-var $dNzBT = parcelRequire("dNzBT");
-
-var $aVHaH = parcelRequire("aVHaH");
-
-var $dJKat = parcelRequire("dJKat");
-
-var $8QizP = parcelRequire("8QizP");
-const $7f335a0fc9fc572d$export$f724e65743857c5a = async (p, id, item, build)=>{
- if (id) {
- const advjs = item.get("adv")?.get("js");
- const js_original = (0, (/*@__PURE__*/$parcel$interopDefault($dNzBT)))(((typeof advjs === "object" ? advjs.toJSON() : advjs)?.trim() || `{children}
`).trim(), ";");
- const pass = {};
- // const doc = p.comps.doc[item.get("component")?.get("id") || ""];
- let newitem = null;
- // const propChild: Record = {};
- // if (doc) {
- // newitem = doc.getMap("map").get("content_tree")?.toJSON() as IItem;
- // const props = item.get("component")?.get("props");
- // props?.forEach((p, k) => {
- // const prop = p.toJSON() as FNCompDef;
- // const cprop = (newitem.component?.props || {})[k];
- // if (prop && cprop) {
- // if (cprop.meta?.type === "content-element") {
- // const content = p.get("content");
- // if (content) {
- // pass[k] = ``;
- // content.set("name", `_${k}_`);
- // propChild[`_${k}_`] = content;
- // }
- // } else {
- // pass[k] = prop.value;
- // }
- // }
- // });
- // }
- let js = "";
- let js_compiled = "";
- if (Object.entries(pass).length > 0) {
- js = `{
- return `${k}={${v}}`;
- }).join(" ")}>${js_original}`;
- js_compiled = await build("element.tsx", `render(${js})`);
- }
- if (!newitem.adv) newitem.adv = {};
- if (newitem.adv) {
- newitem.adv.js = js;
- newitem.adv.jsBuilt = js_compiled;
- }
- // for (const child of Object.values(propChild)) {
- // const citem = child.toJSON() as any;
- // citem.hidden = "all";
- // newitem.childs.unshift(citem);
- // }
- newitem.id = id;
- delete newitem.component;
- item.doc?.transact(()=>{
- item.parent.forEach((e, idx)=>{
- if (e === item) {
- const map = new $aVHaH.Map();
- item.parent.delete(idx);
- item.parent.insert(idx, [
- map
- ]);
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(newitem));
- }
- });
- });
- }
-};
-
-});
-
-
-
-
-
-parcelRegister("6Kcyl", function(module, exports) {
-
-$parcel$export(module.exports, "monacoTypings", () => $51cab3d82fedf1a4$export$7566e3beeced9e4c);
-
-var $3i93m = parcelRequire("3i93m");
-
-var $eLWVm = parcelRequire("eLWVm");
-
-var $4qhY9 = parcelRequire("4qhY9");
-const $51cab3d82fedf1a4$var$map = new WeakMap();
-const $51cab3d82fedf1a4$export$7566e3beeced9e4c = async (p, monaco, prop)=>{
- if (!$51cab3d82fedf1a4$var$map.has(prop.values)) $51cab3d82fedf1a4$var$map.set(prop.values, true);
- else return;
- if ((0, $3i93m.w).prasiApi[p.site.api_url] && (0, $3i93m.w).prasiApi[p.site.api_url].prismaTypes) {
- const prisma = (0, $3i93m.w).prasiApi[p.site.api_url].prismaTypes;
- $51cab3d82fedf1a4$export$6503ec6e8aabbaf(monaco, `\
-declare module "ts:runtime/index" {
- ${prisma["runtime/index.d.ts"]}
-}`, `ts:runtime/index.d.ts`);
- $51cab3d82fedf1a4$export$6503ec6e8aabbaf(monaco, `\
-declare module "ts:runtime/library" {
- ${prisma["runtime/library.d.ts"]}
-}`, `ts:runtime/library.d.ts`);
- $51cab3d82fedf1a4$export$6503ec6e8aabbaf(monaco, `\
-declare module "ts:prisma" {
- ${prisma["prisma.d.ts"].replace(`import * as runtime from './runtime/library';`, `import * as runtime from 'ts:runtime/library';`)}
-}`, `ts:prisma.d.ts`);
- $51cab3d82fedf1a4$export$6503ec6e8aabbaf(monaco, (0, $3i93m.w).prasiApi[p.site.api_url].apiTypes, "ts:api.d.ts");
- }
- monaco.languages.typescript.typescriptDefaults.setExtraLibs([
- {
- filePath: "react.d.ts",
- content: await $51cab3d82fedf1a4$var$loadText("https://cdn.jsdelivr.net/npm/@types/react@18.2.0/index.d.ts")
- },
- {
- filePath: "jsx-runtime.d.ts",
- content: await $51cab3d82fedf1a4$var$loadText("https://cdn.jsdelivr.net/npm/@types/react@18.2.0/jsx-runtime.d.ts")
- },
- {
- filePath: "site.d.ts",
- content: p.site_dts.replaceAll("export declare const", "declare const")
- }
- ]);
- const propText = (0, $4qhY9.extractProp)({
- values: prop.values,
- types: {
- ...prop.types,
- ...p.script.siteTypes
- }
- });
- const apiTypes = (0, $3i93m.w).prasiApi[p.site.api_url] ? (0, $3i93m.w).prasiApi[p.site.api_url].apiTypes : "";
- let apiPath = "app/gen/srv/api/srv";
- if (apiTypes && apiTypes.includes(`export * as srv from "gen/srv/api/srv"`)) apiPath = "gen/srv/api/srv";
- $51cab3d82fedf1a4$export$6503ec6e8aabbaf(monaco, `\
-import React from 'react';
-import prisma from 'ts:prisma';
-
-${$51cab3d82fedf1a4$export$aaadf2ad82889525(apiTypes, `\
-import "./api"
-import type * as SRVAPI from "${apiPath}";`)}
-
-declare global {;
- const db: prisma.PrismaClient;
-
- ${(0, $eLWVm.baseTypings)}
-
- const moko: {nama: string};
- ${propText.join("\n")}
-
- ${$51cab3d82fedf1a4$export$aaadf2ad82889525(apiTypes, `
- type Api = typeof SRVAPI;
- type ApiName = keyof Api;
- const api: { [k in ApiName]: Awaited["_"]["api"] };
- `)}
-}
-
- `, "ts:global.d.ts");
-};
-const $51cab3d82fedf1a4$var$loadText = async (url)=>{
- try {
- const res = await fetch(url);
- return await res.text();
- } catch (e) {
- return "";
- }
-};
-const $51cab3d82fedf1a4$export$aaadf2ad82889525 = (condition, text)=>{
- if (condition) return text;
- return "";
-};
-const $51cab3d82fedf1a4$export$6503ec6e8aabbaf = (monaco, source, uri)=>{
- const model = monaco.editor.getModels().find((e)=>{
- return e.uri.toString() === uri;
- });
- if (model) model.setValue(source);
- else monaco.editor.createModel(source, "typescript", monaco.Uri.parse(uri));
-};
-
-});
-parcelRegister("eLWVm", function(module, exports) {
-
-$parcel$export(module.exports, "baseTypings", () => $31ae3166e1728744$export$79233571713910f2);
-const $31ae3166e1728744$export$79233571713910f2 = `
-type FC = React.FC;
-const Fragment = React.Fragment;
-const ReactNode = React.ReactNode;
-const useCallback = React.useCallback;
-const useMemo = React.useMemo;
-const ReactElement = React.ReactElement;
-const isValidElement = React.isValidElement;
-const useEffect = React.useEffect;
-const useState = React.useState;
-
-const isEditor: boolean;
-const isLayout: boolean;
-const isMobile: boolean;
-const isDesktop: boolean;
-const preload: (pathname: string) => void;
-const apiHeaders: Record;
-const navigate: (url:string) => void;
-const params: any;
-const cx = (...classNames: any[]) => string;
-const css = (
- tag: CSSAttribute | TemplateStringsArray | string,
- ...props: Array
-) => string;
-
-const props: {
- className: string;
- onPointerDown?: () => void;
- onPointerMove?: () => void;
- onPointerLeave?: () => void;
-};
-const children: ReactNode;
-
-const PassProp: FC & {children: React.ReactNode}>;
-const PassChild: FC<{name: string}>;
-const Preload: FC<{url: string[]}>;
-const apiurl: string;
-const prasiPageID: string;
-type ITEM = {
- id: string
- name: string;
- type: 'item' | 'text';
- adv?: {
- js?: string;
- jsBuilt?: string;
- css?: string;
- html?: string;
- },
- text: string,
- html: string,
- component?: { id:string, props: Record},
- childs: ITEM[]
-}
-const newElement: (gen?: (item: ITEM) => ITEM | ITEM[]) => React.ReactNode;
-const Local: >(arg: {
- name: string;
- value: T;
- children: ((local: T & { render: () => void }) => any);
- deps?: any[];
- effect?: (
- local: T & { render: () => void }
- ) => void | (() => void) | Promise void)>;
- hook?: (
- local: T & { render: () => void }
- ) => void | (() => void) | Promise void)>;
- cache?: boolean;
-}) => ReactNode;
-
-`;
-
-});
-
-parcelRegister("4qhY9", function(module, exports) {
-
-$parcel$export(module.exports, "extractProp", () => $35185fa4e1fc10c1$export$7cedd497ebec632a);
-
-var $dNzBT = parcelRequire("dNzBT");
-
-var $63SH6 = parcelRequire("63SH6");
-const $35185fa4e1fc10c1$export$7cedd497ebec632a = (prop)=>{
- const propTypes = [];
- const props = {};
- if (prop) {
- if (prop.values) for (const [k, v] of Object.entries(prop.values)){
- if (!props[k]) props[k] = {};
- if (typeof v === "function") {
- if ($35185fa4e1fc10c1$var$isFunctionalComponent(v)) props[k].type = "React.FC";
- else if ($35185fa4e1fc10c1$var$isClassComponent(v)) props[k].type = "React.Component";
- else props[k].type = "any";
- } else if (v) {
- if (typeof v === "object" && v._jsx) props[k].type = "React.ReactElement;";
- else if (!!v.render && typeof v.$$typeof === "symbol") props[k].type = "React.FC & {ref?:any}>";
- else props[k].val = v;
- }
- }
- }
- if (prop.types) for (const [k, v] of Object.entries(prop.types)){
- if (!props[k]) props[k] = {};
- props[k].type = v;
- }
- for (const [k, v] of Object.entries(props)){
- if (v.type) propTypes.push(`const ${k}: ${(0, (/*@__PURE__*/$parcel$interopDefault($dNzBT)))(v.type, "; \n")};`);
- else if (v.val) {
- if (typeof v.val === "object" && /*#__PURE__*/ (0, $63SH6.isValidElement)(v.val)) propTypes.push(`const ${k}: ReactElement;`);
- else try {
- let val = v.val;
- if (typeof val === "object") {
- if (typeof val.render === "function") val = {
- ...val,
- render: ()=>{}
- };
- propTypes.push(`const ${k}: ${$35185fa4e1fc10c1$var$recurseTypes(val)};`);
- } else propTypes.push(`const ${k}: string;`);
- } catch (e) {}
- }
- }
- return propTypes;
-};
-function $35185fa4e1fc10c1$var$recurseTypes(object) {
- const result = [];
- if (typeof object === "object") {
- if (object === null) return "null";
- if (Array.isArray(object)) return `any[]`;
- for (const [k, v] of Object.entries(object))result.push(`${k}: ${typeof v === "object" && v ? $35185fa4e1fc10c1$var$recurseTypes(v) : typeof v}`);
- return `{
- ${result.join(";\n ")}
-}`;
- }
- return typeof object;
-}
-function $35185fa4e1fc10c1$var$isFunctionalComponent(Component) {
- return typeof Component === "function" && // can be various things
- !(Component.prototype && // native arrows don't have prototypes
- Component.prototype.isReactComponent // special property
- );
-}
-function $35185fa4e1fc10c1$var$isClassComponent(Component) {
- return !!(typeof Component === "function" && Component.prototype && Component.prototype.isReactComponent);
-}
-
-});
-
-
-parcelRegister("iUoON", function(module, exports) {
-
-$parcel$export(module.exports, "MonacoElSnippet", () => $5f8bc9d963ba7421$export$b9b05c5c2cbe3624);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $l802C = parcelRequire("l802C");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $8u89v = parcelRequire("8u89v");
-
-var $emJmR = parcelRequire("emJmR");
-const $5f8bc9d963ba7421$export$b9b05c5c2cbe3624 = ({ doEdit: doEdit })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex items-center space-x-1 pl-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-
- {
-//local effect
-}}
->
-{children}
-
-
- `, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-`, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-
-{(local.list || []).map((item, idx) => (
-
-{children}
-
-))}
-
-`, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-<>{true && {children}
}>
-`, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-<>
-{
-/**if condition */
-true ? (
-/** then */
-{children}
-) : (
-/** else */
-ELSE CONDITION
-)
-}
->
-`, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-`, true);
- },
- children: ""
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-{children}
`, true);
- },
- children: "Reset"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-
-{children}
-
- `, true);
- },
- children: "CSS"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: ()=>{
- doEdit(`\
-
-{children}
-
- `, true);
- },
- children: "ClassName"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $l802C.Button), {
- onClick: async ()=>{
- p.script.active = false;
- p.localReloading = {};
- p.render();
- await (0, $8u89v.rebuildTree)(p, {
- mode: "reset",
- note: "reload"
- });
- setTimeout(()=>{
- p.script.active = true;
- p.render();
- }, 100);
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: "Reload (alt-R)",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "12",
- height: "12",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M1.85 7.5c0-2.835 2.21-5.65 5.65-5.65 2.778 0 4.152 2.056 4.737 3.15H10.5a.5.5 0 000 1h3a.5.5 0 00.5-.5v-3a.5.5 0 00-1 0v1.813C12.296 3.071 10.666.85 7.5.85 3.437.85.85 4.185.85 7.5c0 3.315 2.587 6.65 6.65 6.65 1.944 0 3.562-.77 4.714-1.942a6.77 6.77 0 001.428-2.167.5.5 0 10-.925-.38 5.77 5.77 0 01-1.216 1.846c-.971.99-2.336 1.643-4.001 1.643-3.44 0-5.65-2.815-5.65-5.65z",
- clipRule: "evenodd"
- })
- })
- })
- })
- ]
- });
-};
-
-});
-parcelRegister("l802C", function(module, exports) {
-
-$parcel$export(module.exports, "Button", () => $8eb0ae44775f73f5$export$353f5b6fc5456de1);
-
-var $lAN3N = parcelRequire("lAN3N");
-const $8eb0ae44775f73f5$export$353f5b6fc5456de1 = ({ children: children, appearance: appearance, className: className, onClick: onClick })=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)("button", {
- className: cx("transition-all flex items-center justify-center border select-none outline-none prasi-btn", css`
- height: 25px;
- width: 28px;
- `, className, appearance !== "subtle" ? "bg-white border-[#d1d5db] hover:border-[#ccc] active:bg-[#d1d1d1] focus:border-[#ccc]" : "active:bg-[#d1d1d1] hover:bg-white hover:bg-opacity-50 cursor-pointer border-transparent hover:border-blue-100 focus:border-[#ccc]"),
- onClick: onClick,
- children: children
- });
-};
-
-});
-
-
-parcelRegister("bTIRf", function(module, exports) {
-
-$parcel$export(module.exports, "Popover", () => $d82fd1f9f124e8d2$export$5b6b19405a83ff9d);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $2Dcmu = parcelRequire("2Dcmu");
-var $91fsP = parcelRequire("91fsP");
-var $l2jTt = parcelRequire("l2jTt");
-var $7rwqM = parcelRequire("7rwqM");
-var $l2jTt = parcelRequire("l2jTt");
-
-var $63SH6 = parcelRequire("63SH6");
-function $d82fd1f9f124e8d2$export$542a6fd13ac93354({ initialOpen: initialOpen = false, placement: placement = "bottom", modal: modal, open: controlledOpen, offset: popoverOffset, onOpenChange: setControlledOpen, autoFocus: autoFocus = true, backdrop: backdrop = true } = {}) {
- const arrowRef = $63SH6.useRef(null);
- const [uncontrolledOpen, setUncontrolledOpen] = $63SH6.useState(initialOpen);
- const [labelId, setLabelId] = $63SH6.useState();
- const [descriptionId, setDescriptionId] = $63SH6.useState();
- const open = controlledOpen ?? uncontrolledOpen;
- const setOpen = setControlledOpen ?? setUncontrolledOpen;
- const data = (0, $7rwqM.useFloating)({
- placement: placement,
- open: open,
- onOpenChange: setOpen,
- whileElementsMounted: (0, $91fsP.autoUpdate),
- middleware: [
- (0, $l2jTt.offset)(typeof popoverOffset === "number" ? popoverOffset : 5),
- (0, $l2jTt.flip)({
- fallbackAxisSideDirection: "end",
- padding: 5
- }),
- (0, $l2jTt.shift)({
- padding: 5
- }),
- (0, $2Dcmu.arrow)({
- element: arrowRef
- })
- ]
- });
- const context = data.context;
- const click = (0, $7rwqM.useClick)(context, {
- enabled: controlledOpen == null
- });
- const dismiss = (0, $7rwqM.useDismiss)(context, {});
- const role = (0, $7rwqM.useRole)(context);
- const interactions = (0, $7rwqM.useInteractions)([
- click,
- dismiss,
- role
- ]);
- return $63SH6.useMemo(()=>({
- open: open,
- setOpen: setOpen,
- ...interactions,
- ...data,
- arrowRef: arrowRef,
- modal: modal,
- labelId: labelId,
- descriptionId: descriptionId,
- setLabelId: setLabelId,
- setDescriptionId: setDescriptionId,
- backdrop: backdrop,
- autoFocus: autoFocus
- }), [
- open,
- setOpen,
- interactions,
- data,
- modal,
- labelId,
- descriptionId,
- backdrop,
- autoFocus
- ]);
-}
-function $d82fd1f9f124e8d2$var$mapPlacementSideToCSSProperty(placement) {
- const staticPosition = placement.split("-")[0];
- const staticSide = {
- top: "bottom",
- right: "left",
- bottom: "top",
- left: "right"
- }[staticPosition];
- return staticSide;
-}
-function $d82fd1f9f124e8d2$var$PopoverArrow() {
- const context = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- const { x: arrowX, y: arrowY } = context.middlewareData.arrow || {
- x: 0,
- y: 0
- };
- const staticSide = $d82fd1f9f124e8d2$var$mapPlacementSideToCSSProperty(context.placement);
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- ref: context.arrowRef,
- style: {
- left: arrowX != null ? `${arrowX}px` : "",
- top: arrowY != null ? `${arrowY}px` : "",
- [staticSide]: "-4px",
- transform: "rotate(45deg)"
- },
- className: cx("arrow", css`
- pointer-events: none;
- position: absolute;
- width: 10px;
- height: 10px;
- background: white;
- `)
- });
-}
-const $d82fd1f9f124e8d2$var$PopoverContext = /*#__PURE__*/ $63SH6.createContext(null);
-const $d82fd1f9f124e8d2$export$1468d0761b26e6c8 = ()=>{
- const context = $63SH6.useContext($d82fd1f9f124e8d2$var$PopoverContext);
- if (context == null) throw new Error("Popover components must be wrapped in ");
- return context;
-};
-function $d82fd1f9f124e8d2$export$5b6b19405a83ff9d({ children: children, content: content, className: className, modal: modal = false, popoverClassName: popoverClassName, arrow: arrow, ...restOptions }) {
- const popover = $d82fd1f9f124e8d2$export$542a6fd13ac93354({
- modal: modal,
- ...restOptions
- });
- let _content = content;
- if (!content) _content = /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "w-[300px] h-[150px]"
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)($d82fd1f9f124e8d2$var$PopoverContext.Provider, {
- value: popover,
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($d82fd1f9f124e8d2$export$7dacb05d26466c3, {
- className: className,
- children: children
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)($d82fd1f9f124e8d2$export$d7e1f420b25549ff, {
- className: cx(popoverClassName ? popoverClassName : css`
- background: white;
- padding: 3px 8px;
- box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.15);
- font-size: 12px;
- user-select: none;
- `),
- children: [
- _content,
- (typeof arrow === "undefined" || arrow) && /*#__PURE__*/ (0, $lAN3N.jsx)($d82fd1f9f124e8d2$var$PopoverArrow, {})
- ]
- })
- ]
- });
-}
-const $d82fd1f9f124e8d2$export$7dacb05d26466c3 = /*#__PURE__*/ $63SH6.forwardRef(function PopoverTrigger({ children: children, asChild: asChild = false, ...props }, propRef) {
- const context = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- const childrenRef = children.ref;
- const ref = (0, $7rwqM.useMergeRefs)([
- context.refs.setReference,
- propRef,
- childrenRef
- ]);
- // `asChild` allows the user to pass any element as the anchor
- if (asChild && /*#__PURE__*/ $63SH6.isValidElement(children)) return /*#__PURE__*/ $63SH6.cloneElement(children, context.getReferenceProps({
- ref: ref,
- ...props,
- ...children.props,
- "data-state": context.open ? "open" : "closed"
- }));
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- ref: ref,
- "data-state": context.open ? "open" : "closed",
- ...context.getReferenceProps(props),
- children: children
- });
-});
-const $d82fd1f9f124e8d2$export$d7e1f420b25549ff = /*#__PURE__*/ $63SH6.forwardRef(function PopoverContent(props, propRef) {
- const { context: floatingContext, ...context } = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- const ref = (0, $7rwqM.useMergeRefs)([
- context.refs.setFloating,
- propRef
- ]);
- if (!floatingContext.open) return null;
- const _content = /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- ref: ref,
- style: {
- ...context.floatingStyles,
- ...props.style
- },
- "aria-labelledby": context.labelId,
- "aria-describedby": context.descriptionId,
- ...context.getFloatingProps(props),
- children: props.children
- });
- const content = context.autoFocus ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingFocusManager), {
- context: floatingContext,
- modal: context.modal,
- children: _content
- }) : _content;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingPortal), {
- children: context.backdrop ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingOverlay), {
- lockScroll: true,
- children: content
- }) : content
- });
-});
-const $d82fd1f9f124e8d2$export$4d25df1629c5c0e8 = /*#__PURE__*/ $63SH6.forwardRef(function PopoverHeading({ children: children, ...props }, ref) {
- const { setLabelId: setLabelId } = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- const id = (0, $7rwqM.useId)();
- // Only sets `aria-labelledby` on the Popover root element
- // if this component is mounted inside it.
- $63SH6.useLayoutEffect(()=>{
- setLabelId(id);
- return ()=>setLabelId(undefined);
- }, [
- id,
- setLabelId
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)("h2", {
- ...props,
- ref: ref,
- id: id,
- children: children
- });
-});
-const $d82fd1f9f124e8d2$export$39a373e70f52f23b = /*#__PURE__*/ $63SH6.forwardRef(function PopoverDescription({ children: children, ...props }, ref) {
- const { setDescriptionId: setDescriptionId } = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- const id = (0, $7rwqM.useId)();
- // Only sets `aria-describedby` on the Popover root element
- // if this component is mounted inside it.
- $63SH6.useLayoutEffect(()=>{
- setDescriptionId(id);
- return ()=>setDescriptionId(undefined);
- }, [
- id,
- setDescriptionId
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)("p", {
- ...props,
- ref: ref,
- id: id,
- children: children
- });
-});
-const $d82fd1f9f124e8d2$export$d6ac43ebaa40d53e = /*#__PURE__*/ $63SH6.forwardRef(function PopoverClose(props, ref) {
- const { setOpen: setOpen } = $d82fd1f9f124e8d2$export$1468d0761b26e6c8();
- return /*#__PURE__*/ (0, $lAN3N.jsx)("button", {
- type: "button",
- ref: ref,
- ...props,
- onClick: (event)=>{
- props.onClick?.(event);
- setOpen(false);
- }
- });
-});
-
-});
-
-parcelRegister("i3kSU", function(module, exports) {
-
-$parcel$export(module.exports, "MonacoElHistory", () => $2eb2e511b9af0421$export$b17a5624dfb29ca1);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $7duk0 = parcelRequire("7duk0");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $emJmR = parcelRequire("emJmR");
-const $2eb2e511b9af0421$export$b17a5624dfb29ca1 = ({ store: store, close: close, doEdit: doEdit })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- history: []
- }, async ()=>{
- const listkeys = await (0, $7duk0.keys)(store);
- const meta = p.treeMeta[p.item.active];
- const id = meta.item.originalId || meta.item.id;
- const foundkeys = [];
- if (p.script.prop) {
- for (const key of listkeys)if (key.toString().startsWith(`${id}@${p.script.prop.name}-`)) foundkeys.push(key);
- } else {
- for (const key of listkeys)if (key.toString().startsWith(`${id}:${p.script.type}-`)) foundkeys.push(key);
- }
- const items = await (0, $7duk0.getMany)(foundkeys, store);
- local.history = [];
- for (const [k, src] of Object.entries(items)){
- let ts = "";
- const key = foundkeys[parseInt(k)];
- if (p.script.prop) {
- if (p.script.prop.mode === "instance") {
- if (key.startsWith(`${id}@${p.script.prop.name}-`)) ts = key.substring(`${id}@${p.script.prop.name}-`.length);
- } else if (p.script.prop.mode === "master-visible") {
- if (key.startsWith(`${id}#vis-${p.script.prop.name}-`)) ts = key.substring(`${id}#vis-${p.script.prop.name}-`.length);
- } else if (p.script.prop.mode === "master-option") {
- if (key.startsWith(`${id}#opt-${p.script.prop.name}-`)) ts = key.substring(`${id}#opt-${p.script.prop.name}-`.length);
- } else if (p.script.prop.mode === "master-gen") {
- if (key.startsWith(`${id}#gen-${p.script.prop.name}-`)) ts = key.substring(`${id}#gen-${p.script.prop.name}-`.length);
- } else if (p.script.prop.mode === "master-value") {
- if (key.startsWith(`${id}#val-${p.script.prop.name}-`)) ts = key.substring(`${id}#val-${p.script.prop.name}-`.length);
- }
- } else ts = key.substring(`${id}:${p.script.type}-`.length);
- local.history.push({
- ts: parseInt(ts) * 10000,
- key: key,
- src: src
- });
- }
- local.render();
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "relative overflow-auto w-[200px] h-[250px] -my-[3px] -mx-[8px]",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "p-1",
- children: "Local History:"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "absolute left-0 right-0 h-[1000px] border-t",
- children: local.history.reverse().map((e, idx)=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "font-mono text-[10px] whitespace-pre-wrap",
- children: e.src
- }),
- placement: "left",
- delay: 0,
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "border-b px-2 justify-between flex hover:bg-blue-100 cursor-pointer",
- onClick: async ()=>{
- doEdit(e.src, true);
- close();
- },
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: $2eb2e511b9af0421$var$timeAgo(e.ts).toString()
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: $2eb2e511b9af0421$var$formatBytes(e.src.length)
- })
- ]
- })
- }, idx);
- })
- })
- ]
- });
-};
-const $2eb2e511b9af0421$var$timeAgo = (time)=>{
- switch(typeof time){
- case "number":
- break;
- case "string":
- time = +new Date(time);
- break;
- case "object":
- if (time.constructor === Date) time = time.getTime();
- break;
- default:
- time = +new Date();
- }
- const time_formats = [
- [
- 60,
- "seconds",
- 1
- ],
- [
- 120,
- "1 minute ago",
- "1 minute from now"
- ],
- [
- 3600,
- "minutes",
- 60
- ],
- [
- 7200,
- "1 hour ago",
- "1 hour from now"
- ],
- [
- 86400,
- "hours",
- 3600
- ],
- [
- 172800,
- "yesterday",
- "tomorrow"
- ],
- [
- 604800,
- "days",
- 86400
- ],
- [
- 1209600,
- "last week",
- "next week"
- ],
- [
- 2419200,
- "weeks",
- 604800
- ],
- [
- 4838400,
- "last month",
- "next month"
- ],
- [
- 29030400,
- "months",
- 2419200
- ],
- [
- 58060800,
- "last year",
- "next year"
- ],
- [
- 2903040000,
- "years",
- 29030400
- ],
- [
- 5806080000,
- "last century",
- "next century"
- ],
- [
- 58060800000,
- "centuries",
- 2903040000
- ]
- ];
- /* @ts-ignore */ let seconds = (+new Date() - time) / 1000, token = "ago", list_choice = 1;
- if (seconds == 0) return "Just now";
- if (seconds < 0) {
- seconds = Math.abs(seconds);
- token = "from now";
- list_choice = 2;
- }
- let i = 0, format;
- /* eslint-disable no-cond-assign */ while(format = time_formats[i++])if (seconds < format[0]) {
- if (typeof format[2] == "string") return format[list_choice];
- else return Math.floor(seconds / format[2]) + " " + format[1] + " " + token;
- }
- return time;
-};
-function $2eb2e511b9af0421$var$formatBytes(bytes, decimals) {
- if (bytes == 0) return "0 Bytes";
- var k = 1024, dm = decimals || 2, sizes = [
- "Bytes",
- "KB",
- "MB",
- "GB",
- "TB",
- "PB",
- "EB",
- "ZB",
- "YB"
- ], i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
-}
-
-});
-
-
-
-parcelRegister("eQo3h", function(module, exports) {
-
-$parcel$export(module.exports, "initJS", () => $4861a1685c856436$export$f36cf3004b895856);
-
-const $4861a1685c856436$export$f36cf3004b895856 = async ()=>{
- const { tryToSetCurrentVersion: tryToSetCurrentVersion } = await (parcelRequire("9oKNq"));
- await tryToSetCurrentVersion("latest");
-};
-
-});
-parcelRegister("9oKNq", function(module, exports) {
-
-
-module.exports = (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("jJnCY")).then(()=>parcelRequire("3xnmI"));
-
-});
-
-
-parcelRegister("NRpjz", function(module, exports) {
-
-
-
-
-module.exports = Promise.all([
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("jJnCY")),
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("cb3VD"))
-]).then(()=>parcelRequire("2UmCA"));
-
-});
-
-parcelRegister("aOi4L", function(module, exports) {
-
-
-module.exports = (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("2Dp8T")).then(()=>parcelRequire("iE6Ol"));
-
-});
-
-
-parcelRegister("8IrKh", function(module, exports) {
-
-$parcel$export(module.exports, "EText", () => $a91c4cc7758afdd5$export$87ceb6f7db1d17f4);
-$parcel$export(module.exports, "ETextInternal", () => $a91c4cc7758afdd5$export$834f93c97836d329);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $8u89v = parcelRequire("8u89v");
-
-var $KfUSb = parcelRequire("KfUSb");
-
-var $890fz = parcelRequire("890fz");
-const $a91c4cc7758afdd5$export$87ceb6f7db1d17f4 = ({ id: id, fromProp: fromProp })=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $KfUSb.ErrorBox), {
- id: id,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $890fz.ERender), {
- id: id,
- fromProp: fromProp
- })
- });
-};
-const $a91c4cc7758afdd5$var$currentFocus = {
- id: ""
-};
-const $a91c4cc7758afdd5$export$834f93c97836d329 = ({ p: p, className: className, item: item, _children: _children, elprop: elprop })=>{
- const local = (0, $4WfNn.useLocal)({
- el: null
- });
- (0, $63SH6.useEffect)(()=>{
- if (p.item.active) {
- if (local.el && p.item.active === item.id && $a91c4cc7758afdd5$var$currentFocus.id !== item.id && !p.script.active && !p.script.siteActive) {
- $a91c4cc7758afdd5$var$currentFocus.id = item.id;
- local.el.focus();
- local.render();
- }
- p.item.active, item.id;
- }
- }, [
- p.item.active
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- id: `text-${item.id}`,
- className: cx(className, css`
- user-select: all;
- outline: none;
- min-width: 3px !important;
- min-height: 10px !important;
- `),
- ref: (e)=>{
- if (local.el !== e) local.el = e;
- },
- dangerouslySetInnerHTML: {
- __html: _children || ""
- },
- contentEditable: true,
- spellCheck: false,
- onBlur: async (e)=>{
- p.focused = "";
- if (p.pendingRebuild) {
- p.pendingRebuild = false;
- await (0, $8u89v.rebuildTree)(p, {
- mode: "update",
- note: "blur-text"
- });
- }
- p.render();
- },
- onInput: (e)=>{
- if (p.focused !== item.id) p.focused = item.id;
- const meta = p.treeMeta[item.id];
- if (meta) {
- meta.item.html = e.currentTarget.innerHTML;
- const mitem = meta.mitem;
- if (mitem) {
- if (e.currentTarget.innerText.trim() === "") mitem.set("html", "");
- else mitem.set("html", e.currentTarget.innerHTML);
- if (p.item.active !== item.id) p.item.active = item.id;
- }
- }
- },
- ...elprop
- });
-};
-
-});
-
-
-
-
-
-parcelRegister("kJk2w", function(module, exports) {
-
-$parcel$export(module.exports, "editorStyle", () => $82d83f775d5aad7f$export$73a669021774455f);
-const $82d83f775d5aad7f$export$73a669021774455f = css`
- --border-color: #ddd;
-
- &.editor {
- align-items: stretch;
-
- .editor-content {
- flex: 1;
- display: flex;
- align-items: stretch;
- position: relative;
- }
-
- .editor-active,
- .editor-hover {
- &::after {
- position: absolute;
- border: 2px solid #3c82f6;
- pointer-events: none;
- bottom: 0px;
- top: 0px;
- left: 0px;
- right: 0px;
-
- content: " ";
- }
- }
-
- .editor-hover {
- &::after {
- background: #dbe9fe66;
- }
- }
- .editor-active {
- &::after {
- background: none;
- }
- }
-
- .toolbar {
- height: 35px;
- font-size: 12px;
- align-items: stretch;
- justify-content: space-between;
- border-bottom: 1px solid var(--border-color);
-
- > .toolbar-left {
- }
-
- > .toolbar-mid {
- }
-
- > .toolbar-right {
- }
-
- .toolbar-box {
- display: flex;
- align-items: stretch;
- border-radius: 2px;
- border: 1px solid #ccc;
- margin: 5px 0px 5px 5px;
- padding-left: 5px;
-
- .label {
- display: flex;
- user-select: none;
- align-items: center;
- font-size: 10px;
- margin-top: 1px;
- color: #999;
- text-transform: uppercase;
- }
-
- .items {
- display: flex;
- align-items: stretch;
- margin-left: 5px;
- color: #555;
- border-left: 1px solid transparent;
-
- .item {
- display: flex;
- align-items: center;
- cursor: pointer;
- user-select: none;
- border-right: 1px solid transparent;
- padding: 0px 5px;
- border-radius: 0px;
-
- &:hover {
- background: #ececeb;
- }
-
- &.disabled {
- color: #ccc;
- cursor: default;
- }
- }
-
- .item:last-child {
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
- }
- }
-
- &.no-label {
- padding-left: 0px;
- margin-left: 0px;
- .items {
- margin-left: 0px;
- }
- }
-
- &:hover {
- border: 1px solid black;
-
- .items {
- color: #111;
- border-left: 1px solid #ececeb;
- .item {
- border-right: 1px solid #ececeb;
- }
- }
- }
- }
- }
-
- .editor-box {
- flex: 1;
- flex-direction: row;
- align-items: stretch;
- background: #f1f5f9;
-
- .tree {
- min-width: 250px;
- border-right: 1px solid var(--border-color);
- }
-
- .page-editor {
- flex: 1;
- }
-
- .side {
- border-left: 1px solid var(--border-color);
- min-width: 220px;
- }
- }
- }
-`;
-
-});
-
-parcelRegister("cfPLU", function(module, exports) {
-
-$parcel$export(module.exports, "Toolbar", () => $bc88d59743d348fd$export$4c260019440d418f);
-// import { ToolbarLeft } from "./left/ToolbarLeft";
-// import { ToolbarMid } from "./middle/ToolbarMid";
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $kIFzh = parcelRequire("kIFzh");
-
-var $4U53m = parcelRequire("4U53m");
-
-var $cXVqu = parcelRequire("cXVqu");
-
-var $eoQBx = parcelRequire("eoQBx");
-const $bc88d59743d348fd$export$4c260019440d418f = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({});
- p.softRender.topR = local.render;
- const danger = (p.wsPing < 0 || !p.ws || p.ws && p.ws.readyState !== p.ws.OPEN) && p.status === "ready";
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("toolbar", "flex", danger && "bg-red-500 ", danger && css`
- * {
- color: white;
- }
- `),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $4U53m.ToolbarLeft), {}),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $kIFzh.ToolbarCenter), {}),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $cXVqu.ToolbarRight), {})
- ]
- });
-};
-
-});
-parcelRegister("kIFzh", function(module, exports) {
-
-$parcel$export(module.exports, "ToolbarCenter", () => $9bcbb6f77209e302$export$9707077bd317270a);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $2dQRB = parcelRequire("2dQRB");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $3i93m = parcelRequire("3i93m");
-
-var $9DqRZ = parcelRequire("9DqRZ");
-
-var $axFja = parcelRequire("axFja");
-
-var $bTIRf = parcelRequire("bTIRf");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $3xp7a = parcelRequire("3xp7a");
-
-var $4y8Np = parcelRequire("4y8Np");
-
-var $b9Vws = parcelRequire("b9Vws");
-
-var $gE4I9 = parcelRequire("gE4I9");
-
-var $e7a7b = parcelRequire("e7a7b");
-
-var $7FsMl = parcelRequire("7FsMl");
-
-var $6mM2u = parcelRequire("6mM2u");
-const $9bcbb6f77209e302$export$9707077bd317270a = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- apiConfigOpen: false,
- apiStatus: ""
- });
- const checkApi = async (preventReload)=>{
- local.apiStatus = "";
- local.render();
- if (typeof preventReload === "boolean") {
- if (preventReload) local.apiStatus = "started";
- else {
- delete (0, $3i93m.w).prasiApi[p.site.api_url];
- local.apiStatus = "stopped";
- }
- local.render();
- return;
- }
- if (p.site.api_url) try {
- local.apiStatus = "starting";
- local.render();
- await fetch(p.site.api_url + "/_prasi/_");
- local.apiStatus = "started";
- local.render();
- } catch (e) {
- console.log(e);
- local.apiStatus = "stopped";
- local.render();
- }
- };
- (0, $63SH6.useEffect)(()=>{
- checkApi();
- }, []);
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("toolbar-mid", "flex"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $axFja.Modal), {
- open: p.script.siteActive,
- onOpenChange: (open)=>{
- if (!open) {
- p.script.siteActive = false;
- p.render();
- }
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-white w-[80vw] h-[80vh] flex",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $b9Vws.EScriptCustom), {
- monaco_id: "site",
- src: p.site.js,
- onChange: (src, compiled)=>{
- p.site.js = src;
- p.site.js_compiled = compiled;
- (0, $3xp7a.execSiteJS)(p);
- p.lsite.js = src;
- p.site.js_compiled = compiled;
- localStorage.setItem(`prasi-site-${p.site.id}`, JSON.stringify(p.lsite));
- (0, $4y8Np.wsend)(p, JSON.stringify({
- type: "site-js",
- id_site: p.site.id,
- src: (0, $2dQRB.compress)(JSON.stringify({
- src: src,
- compiled: compiled
- }))
- }));
- },
- propTypes: {
- exports: "Record",
- types: "Record",
- load: "(src: string) => Promise",
- render: "() => void"
- }
- })
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($9bcbb6f77209e302$var$JSIcon, {})
- }),
- onClick () {
- p.script.siteActive = true;
- local.render();
- }
- }
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $gE4I9.AddElement), {}),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "w-[5px] h-1"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- onClick: ()=>{
- local.apiConfigOpen = true;
- local.render();
- },
- className: local.apiStatus !== "" ? cx("border-b-2", local.apiStatus === "stopped" && "border-red-600", local.apiStatus === "starting" && "border-yellow-600", local.apiStatus === "started" && "border-green-600") : undefined,
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- offset: 12,
- open: local.apiConfigOpen,
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6mM2u.APIConfig), {
- checkApi: checkApi,
- status: local.apiStatus,
- close: ()=>{
- local.apiConfigOpen = false;
- local.render();
- }
- }),
- onOpenChange: async (open)=>{
- local.apiConfigOpen = open;
- local.render();
- if (!open && (!p.site.api_prasi || p.site.api_prasi && !p.site.api_prasi.port)) await db.site.update({
- data: {
- config: {
- api_url: p.site.api_url
- }
- },
- where: {
- id: p.site?.id
- }
- });
- checkApi();
- },
- children: "API"
- })
- }
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "w-[5px] h-1"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7FsMl.NPMImport), {}),
- popoverClassName: cx("bg-white shadow-2xl shadow-slate-400 outline-none border border-slate-300"),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($9bcbb6f77209e302$var$NPMIcon, {})
- })
- })
- }
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "w-[5px] h-1"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $e7a7b.Export), {}),
- popoverClassName: cx("bg-white shadow-2xl shadow-slate-400 outline-none border border-slate-300"),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($9bcbb6f77209e302$var$ExportIcon, {})
- })
- }
- ]
- })
- ]
- });
-};
-const $9bcbb6f77209e302$var$JSIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "16",
- height: "16",
- viewBox: "0 0 256 256",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M212.24 83.76l-56-56A6 6 0 00152 26H56a14 14 0 00-14 14v72a6 6 0 0012 0V40a2 2 0 012-2h90v50a6 6 0 006 6h50v122a2 2 0 01-2 2h-24a6 6 0 000 12h24a14 14 0 0014-14V88a6 6 0 00-1.76-4.24zM158 46.48L193.52 82H158zm-12.17 149.58a18.89 18.89 0 01-8.31 13.81c-4.82 3.19-10.87 4.14-16.36 4.14a58.89 58.89 0 01-14.68-2 6 6 0 013.23-11.56c3.71 1 15.58 3.11 21.19-.62a6.85 6.85 0 003-5.34c.58-4.43-2.08-6.26-14.2-9.76-9.31-2.69-23.37-6.75-21.57-20.94a18.61 18.61 0 018.08-13.54c11.11-7.49 29.18-3 31.21-2.48a6 6 0 01-3.06 11.6c-3.78-1-15.85-3-21.45.84a6.59 6.59 0 00-2.88 5.08c-.41 3.22 2.14 4.78 13 7.91 9.89 2.89 24.81 7.2 22.8 22.86zM78 152v38a24 24 0 01-48 0 6 6 0 0112 0 12 12 0 0024 0v-38a6 6 0 0112 0z"
- })
- });
-const $9bcbb6f77209e302$var$APIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M2.15 4a1.85 1.85 0 113.7 0 1.85 1.85 0 01-3.7 0zM4 1.25a2.75 2.75 0 100 5.5 2.75 2.75 0 000-5.5zM5.82 11L2.5 12.837V9.163L5.82 11zM2.64 8.212a.7.7 0 00-1.039.612v4.352a.7.7 0 001.039.613l3.933-2.176a.7.7 0 000-1.225L2.64 8.212zM8.3 9a.7.7 0 01.7-.7h4a.7.7 0 01.7.7v4a.7.7 0 01-.7.7H9a.7.7 0 01-.7-.7V9zm.9.2v3.6h3.6V9.2H9.2zm4.243-7.007a.45.45 0 00-.636-.636L11 3.364 9.193 1.557a.45.45 0 10-.636.636L10.364 4 8.557 5.807a.45.45 0 10.636.636L11 4.636l1.807 1.807a.45.45 0 00.636-.636L11.636 4l1.807-1.807z",
- clipRule: "evenodd"
- })
- });
-const $9bcbb6f77209e302$var$NPMIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "26",
- height: "26",
- viewBox: "0 0 24 24",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- d: "M4 10v4h2v-3h1v3h1v-4H4m5 0v5h2v-1h2v-4H9m3 1v2h-1v-2h1m2-1v4h2v-3h1v3h1v-3h1v3h1v-4h-6M3 9h18v6h-9v1H8v-1H3V9z"
- })
- });
-const $9bcbb6f77209e302$var$ExportIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M6.854 3.854l.8-.8c.644-.645 1.775-1.092 2.898-1.253a5.342 5.342 0 011.504-.02c.443.066.714.196.84.323.127.126.257.397.323.84.064.427.059.95-.02 1.504-.16 1.123-.608 2.254-1.253 2.898L7.5 11.793l-1.146-1.146a.5.5 0 10-.708.707l1.5 1.5a.5.5 0 00.708 0l.547-.548 1.17 1.951a.5.5 0 00.783.097l2-2a.5.5 0 00.141-.425l-.465-3.252.624-.623c.855-.856 1.358-2.225 1.535-3.465.09-.627.1-1.25.019-1.794-.08-.528-.256-1.05-.604-1.399-.349-.348-.871-.525-1.4-.604a6.333 6.333 0 00-1.793.02C9.17.987 7.8 1.49 6.946 2.345l-.623.624-3.252-.465a.5.5 0 00-.425.141l-2 2a.5.5 0 00.097.783l1.95 1.17-.547.547a.5.5 0 000 .708l1.5 1.5a.5.5 0 10.708-.708L3.207 7.5l.647-.646 3-3zm3.245 9.34l-.97-1.617 2.017-2.016.324 2.262-1.37 1.37zM3.423 5.87l2.016-2.016-2.262-.324-1.37 1.37 1.616.97zm-1.07 4.484a.5.5 0 10-.707-.708l-1 1a.5.5 0 10.708.707l1-1zm1.5 1.5a.5.5 0 10-.707-.707l-2 2a.5.5 0 00.708.707l2-2zm1.5 1.5a.5.5 0 10-.707-.708l-1 1a.5.5 0 10.708.707l1-1zM9.5 6.748a1.249 1.249 0 100-2.498 1.249 1.249 0 000 2.498z",
- clipRule: "evenodd"
- })
- });
-
-});
-parcelRegister("9DqRZ", function(module, exports) {
-
-$parcel$export(module.exports, "ToolbarBox", () => $d3abceb5fc059f4c$export$722e774c4f28559d);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $0t7p0 = parcelRequire("0t7p0");
-
-var $emJmR = parcelRequire("emJmR");
-const $d3abceb5fc059f4c$export$722e774c4f28559d = ({ label: label, items: items, className: className, labelMenu: labelMenu })=>{
- const local = (0, $4WfNn.useLocal)({
- labelMouseEvent: null
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("toolbar-box", className, !label && "no-label"),
- children: [
- local.labelMouseEvent && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.Menu), {
- mouseEvent: local.labelMouseEvent,
- onClose: ()=>{
- local.labelMouseEvent = null;
- local.render();
- },
- children: labelMenu?.map((e, idx)=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), {
- label: e.label,
- onClick: e.onClick
- }, idx);
- })
- }),
- label && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("label", !!labelMenu && "hover:bg-[#ececeb] transition-all cursor-pointer rounded-l-[2px] -mx-[5px] px-[5px]"),
- onClick: (e)=>{
- local.labelMouseEvent = e;
- local.render();
- },
- children: label
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("items"),
- children: items.map((e, idx)=>{
- if (!e) return;
- if (/*#__PURE__*/ (0, $63SH6.isValidElement)(e)) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $63SH6.Fragment), {
- children: e
- }, idx);
- const item = e;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- content: item.tooltip,
- className: cx("item transition-all", item.className, item.disabled && "disabled"),
- onClick: item.onClick,
- children: item.content
- }, idx);
- })
- })
- ]
- });
-};
-
-});
-
-parcelRegister("3xp7a", function(module, exports) {
-
-$parcel$export(module.exports, "w", () => $13f861f827a99ada$export$efccba1c4a2ef57b);
-$parcel$export(module.exports, "initEditor", () => $13f861f827a99ada$export$31ab3a746f954a7);
-$parcel$export(module.exports, "execSiteJS", () => $13f861f827a99ada$export$c704aaff1951fb80);
-
-var $cfpVL = parcelRequire("cfpVL");
-
-var $isbAn = parcelRequire("isbAn");
-
-var $ets8e = parcelRequire("ets8e");
-
-var $aC85W = parcelRequire("aC85W");
-
-var $ax46r = parcelRequire("ax46r");
-
-var $iEVTn = parcelRequire("iEVTn");
-const $13f861f827a99ada$export$efccba1c4a2ef57b = window;
-const $13f861f827a99ada$export$31ab3a746f954a7 = async (p, site_id)=>{
- $13f861f827a99ada$export$efccba1c4a2ef57b.isEditor = true;
- if (typeof $13f861f827a99ada$export$efccba1c4a2ef57b.isLayout === "undefined") $13f861f827a99ada$export$efccba1c4a2ef57b.isLayout = false;
- $13f861f827a99ada$export$efccba1c4a2ef57b.isMobile = p.mode === "mobile";
- $13f861f827a99ada$export$efccba1c4a2ef57b.isDesktop = p.mode === "desktop";
- $13f861f827a99ada$export$efccba1c4a2ef57b.apiHeaders = {};
- $13f861f827a99ada$export$efccba1c4a2ef57b.preload = ()=>{};
- $13f861f827a99ada$export$efccba1c4a2ef57b.navigateOverride = (_href)=>{
- if (_href.startsWith("/ed")) return _href;
- return "";
- };
- p.item.active = localStorage.getItem("prasi-item-active-id") || "";
- p.item.activeOriginalId = localStorage.getItem("prasi-item-active-oid") || "";
- const comp = {
- id: localStorage.getItem("prasi-comp-active-id"),
- instance_id: localStorage.getItem("prasi-comp-instance-id"),
- last: localStorage.getItem("prasi-comp-active-last"),
- props: localStorage.getItem("prasi-comp-active-props")
- };
- if (comp.last) comp.last = JSON.parse(comp.last);
- if (comp.props) comp.props = JSON.parse(comp.props);
- if (comp.id) p.comp = comp;
- let site = null;
- try {
- site = JSON.parse(localStorage.getItem(`prasi-site-${site_id}`) || "");
- } catch (e) {}
- const querySite = async ()=>{
- const site = await (0, $ets8e.defaultLoader).site(p, {
- id: site_id
- });
- localStorage.setItem(`prasi-site-${site_id}`, JSON.stringify(site));
- return site;
- };
- const processSite = async (site)=>{
- if (!site || site && !site.id) return;
- if (!$13f861f827a99ada$export$efccba1c4a2ef57b.exports) $13f861f827a99ada$export$efccba1c4a2ef57b.exports = {};
- if (site.cgroup_ids) for (const id of site.cgroup_ids)await (0, $iEVTn.default)(`${serverurl}/npm/site/${id}/site.js`);
- await (0, $iEVTn.default)(`${serverurl}/npm/site/${site.id}/site.js`);
- p.lsite = site;
- p.site.id = site.id;
- p.site.js = site.js || "";
- p.site.js_compiled = site.js_compiled || "";
- p.site.name = site.name;
- p.site.domain = site.domain;
- p.site.responsive = site.responsive;
- p.site.layout = site.layout;
- p.site.layout_id = site.layout_id;
- await (0, $aC85W.validateLayout)(p);
- $13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI = {
- mode: localStorage.getItem(`prasi-ext-api-mode-${p.site.id}`) || "prod",
- devUrl: localStorage.getItem(`prasi-ext-dev-url-${p.site.id}`) || "",
- prodUrl: localStorage.getItem(`prasi-ext-prod-url-${p.site.id}`) || ""
- };
- p.site.api_url = await (0, $isbAn.initApi)(site.config);
- if ($13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.prodUrl !== p.site.api_url) {
- $13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.prodUrl = p.site.api_url;
- localStorage.setItem(`prasi-ext-prod-url-${p.site.id}`, p.site.api_url);
- }
- if ($13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.mode === "dev" && $13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.devUrl) {
- p.site.api_url = $13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.devUrl;
- await (0, $isbAn.reloadDBAPI)($13f861f827a99ada$export$efccba1c4a2ef57b.externalAPI.devUrl);
- }
- $13f861f827a99ada$export$efccba1c4a2ef57b.apiurl = p.site.api_url;
- api.site_dts(p.site.id).then((e)=>{
- p.site_dts = e || "";
- p.render();
- });
- const configLocal = (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(site, "config.prasi");
- if (configLocal) {
- p.site.api_prasi.db = configLocal.dburl ? configLocal.dburl : "";
- p.site.api_prasi.port = configLocal.port ? configLocal.port : "";
- }
- $13f861f827a99ada$export$c704aaff1951fb80(p);
- };
- if (!site || site && !site.id) {
- const site = await querySite();
- if (site) await processSite(site);
- } else {
- await processSite(site);
- querySite();
- }
- p.status = "ready";
- p.render();
- if (!(0, $ax46r.jscript).build) (0, $ax46r.jscript).init();
-};
-const $13f861f827a99ada$export$c704aaff1951fb80 = (p)=>{
- if (p && p.site.api_url) {
- p.script.siteTypes = {};
- const scope = {
- types: p.script.siteTypes,
- exports: window.exports,
- load: (0, $iEVTn.default),
- render: p.render,
- module: {
- exports: {}
- }
- };
- const fn = p.site.js_compiled;
- scope["api"] = (0, $isbAn.createAPI)(p.site.api_url);
- scope["db"] = (0, $isbAn.createDB)(p.site.api_url);
- const f = new Function(...Object.keys(scope), fn);
- try {
- const res = f(...Object.values(scope));
- for (const [k, v] of Object.entries(scope.module.exports))$13f861f827a99ada$export$efccba1c4a2ef57b.exports[k] = v;
- return res;
- } catch (e) {
- console.warn(e);
- }
- }
- return null;
-};
-
-});
-
-parcelRegister("b9Vws", function(module, exports) {
-
-$parcel$export(module.exports, "EScriptCustom", () => $b85ebf8368884494$export$41de7173cff99234);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $13Bdx = parcelRequire("13Bdx");
-
-var $ax46r = parcelRequire("ax46r");
-
-const $b85ebf8368884494$export$41de7173cff99234 = ({ monaco_id: monaco_id, src: src, onChange: onChange, onLoad: onLoad, item_id: item_id, props: props, propTypes: propTypes, wrap: wrap })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal));
- if (!(0, $ax46r.jscript).editor) Promise.all([
- (parcelRequire("aOi4L")).then((e)=>{
- (0, $ax46r.jscript).editor = e.Editor;
- e.loader.config({
- paths: {
- vs: "/min/vs"
- }
- });
- }),
- (0, $ax46r.jscript).init()
- ]).then(()=>{
- p.render();
- });
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("flex flex-1", css`
- .monaco-editor {
- .mtk9 {
- color: #022f62;
- }
- .mtk1 {
- color: #022f62;
- }
- .mtk22 {
- color: #015cc5;
- }
- .mtk8 {
- color: #015cc5;
- }
- .mtk5 {
- color: #55bb8a;
- }
- .monaco-editor.showUnused .squiggly-inline-unnecessary {
- opacity: 0.4;
- }
- .jsx-expression-braces {
- color: #7c3813;
- }
- .jsx-tag-angle-bracket {
- color: #619ac3;
- }
- .jsx-tag-name {
- color: #619ac3;
- }
- .jsx-tag-order-1 {
- color: #23863a;
- }
- .jsx-tag-order-2 {
- color: #4e7ca1;
- }
- .jsx-tag-order-3 {
- color: #020360;
- }
- .jsx-tag-attribute-key {
- color: #6f42c1;
- }
- .jsx-text {
- color: #000000;
- }
- }
- `),
- children: !(0, $ax46r.jscript).editor || !(0, $ax46r.jscript).build ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "script-cst",
- backdrop: false
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $13Bdx.ScriptMonacoCustom), {
- monaco_id: monaco_id,
- Editor: (0, $ax46r.jscript).editor,
- build: (0, $ax46r.jscript).build,
- src: src,
- onLoad: onLoad,
- onChange: onChange,
- props: props,
- propTypes: propTypes,
- wrap: wrap,
- item_id: item_id
- })
- });
-};
-
-});
-parcelRegister("13Bdx", function(module, exports) {
-
-$parcel$export(module.exports, "ScriptMonacoCustom", () => $bec423a37dcc3a3d$export$f3b1d27017ad7ff2);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $l66za = parcelRequire("l66za");
-
-var $6Kcyl = parcelRequire("6Kcyl");
-const $bec423a37dcc3a3d$export$1882bb2e9cba62aa = {};
-const $bec423a37dcc3a3d$export$f3b1d27017ad7ff2 = ({ monaco_id: monaco_id, Editor: Editor, build: build, item_id: item_id, src: src, onLoad: onLoad, onChange: onChange, wrap: wrap, props: props, propTypes: propTypes })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- editor: null
- });
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-1 items-stretch flex-col",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-1 items-stretch flex-col",
- onMouseLeave: ()=>{
- if (local.editor) {
- const editor = local.editor;
- editor.getAction("editor.action.format")?.run();
- }
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)(Editor, {
- options: {
- minimap: {
- enabled: false
- },
- wordWrap: "wordWrapColumn",
- autoClosingBrackets: "always",
- tabSize: 2,
- autoIndent: "full",
- formatOnPaste: true,
- formatOnType: true,
- useTabStops: true
- },
- value: src,
- onMount: async (editor, monaco)=>{
- local.editor = editor;
- editor.focus();
- setTimeout(()=>{
- editor.focus();
- }, 300);
- if (onLoad) onLoad(editor, monaco);
- const value = editor.getValue();
- monaco.editor.getModels().forEach((model)=>{
- if (model.uri.toString().startsWith("inmemory://model")) model.dispose();
- });
- let model = monaco.editor.createModel(value, "typescript", monaco.Uri.parse("ts:_active.tsx"));
- editor.setModel(model);
- if (!$bec423a37dcc3a3d$export$1882bb2e9cba62aa[monaco_id]) editor.trigger("fold", "editor.foldAllMarkerRegions", null);
- else editor.restoreViewState($bec423a37dcc3a3d$export$1882bb2e9cba62aa[monaco_id]);
- await (0, $l66za.jsMount)(p, editor, monaco);
- const propVal = props || {};
- await (0, $6Kcyl.monacoTypings)(p, monaco, {
- values: propVal,
- types: propTypes
- });
- },
- language: "typescript",
- onChange: async (newsrc)=>{
- const src = newsrc || "";
- const compiled = await build("element.tsx", wrap ? wrap(src) : src);
- onChange(src, compiled);
- }
- })
- })
- });
-};
-
-});
-
-
-parcelRegister("gE4I9", function(module, exports) {
-
-$parcel$export(module.exports, "AddElement", () => $15fcde6ce6e66bcd$export$36a8612e585b3c4);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $521T4 = parcelRequire("521T4");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $8QizP = parcelRequire("8QizP");
-
-var $aVHaH = parcelRequire("aVHaH");
-
-var $9DqRZ = parcelRequire("9DqRZ");
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $dJKat = parcelRequire("dJKat");
-const $15fcde6ce6e66bcd$export$36a8612e585b3c4 = ({})=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({});
- p.softRender.addEl = local.render;
- let canAdd = true;
- if (!p.item.active) canAdd = false;
- const item = p.treeMeta[p.item.active];
- let mitem = item ? item.mitem : null;
- const type = mitem?.get("type");
- if (p.item.active && mitem?.get("component")?.get("id")) canAdd = false;
- let disableSection = false;
- if (p.comp?.id) disableSection = true;
- if (disableSection && type !== "text") canAdd = true;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- label: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($15fcde6ce6e66bcd$var$IconPlus, {})
- }),
- items: [
- {
- onClick () {
- const json = {
- id: (0, $521T4.createId)(),
- name: `New Text`,
- type: "text",
- dim: {
- w: "full",
- h: "fit"
- },
- layout: {
- align: "center",
- dir: "col",
- gap: 0
- },
- text: "",
- html: "",
- adv: {
- css: ""
- }
- };
- const { item: item, mitem: mitem } = $15fcde6ce6e66bcd$var$getActive(p);
- const type = mitem?.get("type");
- if (p.item.active && mitem) {
- if (type === "item") {
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- const childs = mitem.get("childs");
- if (childs) childs.push([
- map
- ]);
- const item = map.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- }
- } else if (type === "text") {
- let done = false;
- mitem.parent.forEach((e, idx)=>{
- if (done) return;
- if (e && e.get("id") === p.item.active) {
- const map = new $aVHaH.Map();
- if (map && p.item.active) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- mitem.parent.insert(idx + 1, [
- map
- ]);
- let active = mitem.parent.get(idx + 1);
- const item = active.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- done = true;
- p.render();
- }
- }
- });
- }
- }
- },
- disabled: !canAdd || type === "section",
- tooltip: "Add Text",
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M3.95 2.95V4.5a.45.45 0 01-.9 0v-2a.45.45 0 01.45-.45h8a.45.45 0 01.45.45v2a.45.45 0 11-.9 0V2.95h-3v9.1h1.204a.45.45 0 010 .9h-3.5a.45.45 0 110-.9H6.95v-9.1h-3z",
- clipRule: "evenodd"
- })
- })
- },
- {
- tooltip: "Add Item",
- disabled: !canAdd,
- onClick () {
- const json = {
- id: (0, $521T4.createId)(),
- name: `New Item`,
- type: "item",
- dim: {
- w: "fit",
- h: "fit"
- },
- childs: [],
- adv: {
- css: ""
- }
- };
- const { mitem: mitem } = $15fcde6ce6e66bcd$var$getActive(p);
- if (p.item.active && mitem) {
- if (type !== "text") {
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- const childs = mitem.get("childs");
- if (childs) childs.push([
- map
- ]);
- const item = map.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- p.render();
- }
- } else {
- let done = false;
- mitem.parent.forEach((e, idx)=>{
- if (done) return;
- if (e.get("id") === p.item.active) {
- const map = new $aVHaH.Map();
- if (map && p.item.active) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- mitem.parent.insert(idx + 1, [
- map
- ]);
- let active = mitem.parent.get(idx + 1);
- const item = active.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- done = true;
- p.render();
- }
- }
- });
- }
- }
- },
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M1.5 2a.5.5 0 100-1 .5.5 0 000 1zm3 0a.5.5 0 100-1 .5.5 0 000 1zM8 1.5a.5.5 0 11-1 0 .5.5 0 011 0zm2.5.5a.5.5 0 100-1 .5.5 0 000 1zm3.5-.5a.5.5 0 11-1 0 .5.5 0 011 0zM1.5 14a.5.5 0 100-1 .5.5 0 000 1zm.5-3.5a.5.5 0 11-1 0 .5.5 0 011 0zM1.5 8a.5.5 0 100-1 .5.5 0 000 1zM2 4.5a.5.5 0 11-1 0 .5.5 0 011 0zM13.5 11a.5.5 0 100-1 .5.5 0 000 1zm.5-3.5a.5.5 0 11-1 0 .5.5 0 011 0zM13.5 5a.5.5 0 100-1 .5.5 0 000 1zM5 13.5a.5.5 0 11-1 0 .5.5 0 011 0zm2.5.5a.5.5 0 100-1 .5.5 0 000 1zm3.5-.5a.5.5 0 11-1 0 .5.5 0 011 0zm2.5.5a.5.5 0 100-1 .5.5 0 000 1zM4 5a1 1 0 011-1h5a1 1 0 011 1v5a1 1 0 01-1 1H5a1 1 0 01-1-1V5zm1 0h5v5H5V5z",
- clipRule: "evenodd"
- })
- })
- },
- disableSection ? undefined : {
- tooltip: "Add Section",
- onClick: ()=>{
- const json = {
- id: (0, $521T4.createId)(),
- name: `New Section`,
- type: "section",
- dim: {
- w: "full",
- h: "full"
- },
- childs: [],
- adv: {
- css: ""
- }
- };
- const comp = p.comps.doc[p.comp?.id || ""];
- let root = comp ? comp.getMap("map") : p.mpage?.getMap("map");
- if (root) {
- const ctree = root.get("content_tree");
- const childs = ctree.get("childs");
- if (childs) {
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- childs.push([
- map
- ]);
- const mitem = map.toJSON();
- p.item.active = mitem.id;
- p.item.activeOriginalId = mitem.id;
- p.render();
- }
- }
- }
- },
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M2 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM2 5v5h11V5H2zm0-1a1 1 0 00-1 1v5a1 1 0 001 1h11a1 1 0 001-1V5a1 1 0 00-1-1H2zm-.5 10a.5.5 0 100-1 .5.5 0 000 1zM4 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM3.5 14a.5.5 0 100-1 .5.5 0 000 1zM6 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM5.5 14a.5.5 0 100-1 .5.5 0 000 1zM8 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM7.5 14a.5.5 0 100-1 .5.5 0 000 1zM10 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM9.5 14a.5.5 0 100-1 .5.5 0 000 1zM12 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM11.5 14a.5.5 0 100-1 .5.5 0 000 1zM14 1.5a.5.5 0 11-1 0 .5.5 0 011 0zM13.5 14a.5.5 0 100-1 .5.5 0 000 1z",
- clipRule: "evenodd"
- })
- })
- },
- {
- onClick () {
- p.manager.comp = true;
- p.manager.compActionLabel = "Insert";
- p.manager.compCallback = async (e)=>{
- if (!p.comps.doc[e.id]) await (0, $5NYeV.loadComponent)(p, e.id);
- const comp = p.comps.doc[e.id].getMap("map").get("content_tree")?.toJSON();
- if (!comp) {
- alert("Failed to add component!");
- return;
- }
- const json = {
- ...comp,
- id: (0, $521T4.createId)()
- };
- const { item: item, mitem: mitem } = $15fcde6ce6e66bcd$var$getActive(p);
- if (p.item.active && mitem) {
- if (type !== "text") {
- const map = new $aVHaH.Map();
- if (map) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- const childs = mitem.get("childs");
- if (childs) childs.push([
- map
- ]);
- const item = map.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- p.render();
- }
- } else {
- let done = false;
- mitem.parent.forEach((e, idx)=>{
- if (done) return;
- if (e.get("id") === p.item.active) {
- const map = new $aVHaH.Map();
- if (map && p.item.active) {
- (0, $8QizP.syncronize)(map, (0, $dJKat.fillID)(json));
- mitem.parent.insert(idx + 1, [
- map
- ]);
- let active = mitem.parent.get(idx + 1);
- const item = active.toJSON();
- p.item.active = item.id;
- p.item.activeOriginalId = item.id;
- done = true;
- p.render();
- }
- }
- });
- }
- }
- };
- p.render();
- },
- tooltip: "Add Component",
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M2 1a1 1 0 00-1 1v11a1 1 0 001 1h11a1 1 0 001-1V2a1 1 0 00-1-1H2zm0 1h11v11H2V2zm2.5 2a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h6a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5h-6zm.5 6V5h5v5H5z",
- clipRule: "evenodd"
- })
- })
- })
- }
- ]
- })
- });
-};
-const $15fcde6ce6e66bcd$var$getActive = (p)=>{
- let mitem = null;
- let item = null;
- if (p.comp && p.item.active === p.comp.instance_id) {
- mitem = p.treeMeta[p.comp.instance_id].comp?.mcomp;
- item = p.treeMeta[p.comp.instance_id].item;
- } else {
- let meta = p.treeMeta[p.item.active];
- if (!meta) {
- const flat = p.treeFlat.find((e)=>e.parent === "root");
- if (flat) meta = flat.data.meta;
- }
- if (meta) {
- mitem = meta.mitem;
- item = meta.item;
- }
- }
- return {
- mitem: mitem,
- item: item
- };
-};
-const $15fcde6ce6e66bcd$var$IconPlus = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "12",
- height: "12",
- fill: "none",
- viewBox: "0 0 15 15",
- className: "mb-[2px]",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M8 2.75a.5.5 0 00-1 0V7H2.75a.5.5 0 000 1H7v4.25a.5.5 0 001 0V8h4.25a.5.5 0 000-1H8V2.75z",
- clipRule: "evenodd"
- })
- });
-
-});
-
-parcelRegister("e7a7b", function(module, exports) {
-
-$parcel$export(module.exports, "Export", () => $ce4724a661b7ebe4$export$f883e605db67eacf);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-const $ce4724a661b7ebe4$export$f883e605db67eacf = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const code = `\
-import Prasi from "./Prasi"
-
-export default () => {
- return ;
-}`;
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "w-[450px] p-2 text-sm flex flex-col",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: " flex items-center justify-between",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "Export to React"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex space-x-[1px] items-stretch h-[20px]",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("a", {
- href: `${serverurl}/spa-export/${p.site.id}`,
- className: "bg-blue-500 hover:bg-blue-300 text-white rounded px-2 cursor-pointer rounded-r-none outline-none text-xs flex items-center space-x-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "12",
- height: "12",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M7.5 1.05a.45.45 0 01.45.45v6.914l2.232-2.232a.45.45 0 11.636.636l-3 3a.45.45 0 01-.636 0l-3-3a.45.45 0 11.636-.636L7.05 8.414V1.5a.45.45 0 01.45-.45zM2.5 10a.5.5 0 01.5.5V12c0 .554.446 1 .996 1h7.005A.999.999 0 0012 12v-1.5a.5.5 0 011 0V12c0 1.104-.894 2-1.999 2H3.996A1.997 1.997 0 012 12v-1.5a.5.5 0 01.5-.5z",
- clipRule: "evenodd"
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- children: "Prasi.tsx"
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("a", {
- href: `${serverurl}/spa-export/${p.site.id}?open`,
- target: "_blank",
- className: "bg-blue-500 hover:bg-blue-300 text-white rounded px-2 cursor-pointer rounded-l-none outline-none flex items-center justify-center",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M3 2a1 1 0 00-1 1v9a1 1 0 001 1h9a1 1 0 001-1V8.5a.5.5 0 00-1 0V12H3V3h3.5a.5.5 0 000-1H3zm9.854.146a.5.5 0 01.146.351V5.5a.5.5 0 01-1 0V3.707L6.854 8.854a.5.5 0 11-.708-.708L11.293 3H9.5a.5.5 0 010-1h3a.499.499 0 01.354.146z",
- clipRule: "evenodd"
- })
- })
- })
- ]
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-col items-stretch pt-2 space-y-1 border-t mt-2",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between text-xs",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "Usage"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "bg-slate-400 text-white px-2 rounded flex items-center rounded space-x-1 cursor-pointer",
- onClick: ()=>{
- navigator.clipboard.writeText(code);
- alert("Copied!");
- },
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "Copy"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "11",
- height: "11",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M1 9.5A1.5 1.5 0 002.5 11H4v-1H2.5a.5.5 0 01-.5-.5v-7a.5.5 0 01.5-.5h7a.5.5 0 01.5.5V4H5.5A1.5 1.5 0 004 5.5v7A1.5 1.5 0 005.5 14h7a1.5 1.5 0 001.5-1.5v-7A1.5 1.5 0 0012.5 4H11V2.5A1.5 1.5 0 009.5 1h-7A1.5 1.5 0 001 2.5v7zm4-4a.5.5 0 01.5-.5h7a.5.5 0 01.5.5v7a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5v-7z",
- clipRule: "evenodd"
- })
- })
- ]
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-slate-100 font-mono text-[11px] whitespace-pre-wrap p-2 rounded",
- children: code
- })
- ]
- })
- ]
- });
-};
-
-});
-
-parcelRegister("7FsMl", function(module, exports) {
-
-$parcel$export(module.exports, "NPMImport", () => $449302068b8659d8$export$51fb9aefaf12b8af);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $jhQSY = parcelRequire("jhQSY");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $bTIRf = parcelRequire("bTIRf");
-
-var $emJmR = parcelRequire("emJmR");
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $iEVTn = parcelRequire("iEVTn");
-const $449302068b8659d8$var$algolia = (0, (/*@__PURE__*/$parcel$interopDefault($jhQSY)))("OFCNCOG2CU", "f54e21fa3a2a0160595bb058179bfb1e");
-const $449302068b8659d8$var$npm = $449302068b8659d8$var$algolia.initIndex("npm-search");
-const $449302068b8659d8$var$w = window;
-if (!$449302068b8659d8$var$w.npmImport) $449302068b8659d8$var$w.npmImport = {
- init: false,
- loading: false,
- site: [],
- page: {}
-};
-const $449302068b8659d8$export$51fb9aefaf12b8af = ()=>{
- const local = (0, $4WfNn.useLocal)({});
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- // p.softRender.page();
- // const p = useGlobal(EditorGlobal, "EDITOR");
- if (!p.page) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {});
- if (!$449302068b8659d8$var$w.npmImport.init) {
- $449302068b8659d8$var$w.npmImport.init = true;
- $449302068b8659d8$var$w.npmImport.loading = Promise.all([
- db.npm_site.findMany({
- where: {
- id_site: p.site.id
- }
- }).then((e)=>{
- $449302068b8659d8$var$w.npmImport.site = e;
- }),
- db.npm_page.findMany({
- where: {
- id_page: p.page.id
- }
- }).then((e)=>{
- if (p.page) $449302068b8659d8$var$w.npmImport.page[p.page.id] = e;
- })
- ]);
- }
- if ($449302068b8659d8$var$w.npmImport.loading) $449302068b8659d8$var$w.npmImport.loading.then(()=>{
- $449302068b8659d8$var$w.npmImport.loading = false;
- local.render();
- });
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("text-sm w-[1000px] h-[400px] relative flex items-stretch"),
- children: $449302068b8659d8$var$w.npmImport.loading ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "npm-import",
- backdrop: false
- }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$NPMModule, {
- mode: "site",
- onChange: async (e)=>{
- try {
- const f = await fetch(`https://data.jsdelivr.com/v1/packages/npm/${e.name}`);
- const j = await f.json();
- const version = j.versions[0].version;
- const res = await db.npm_site.create({
- data: {
- id_site: p.site?.id || "",
- module: e.name,
- version: version
- }
- });
- $449302068b8659d8$var$w.npmImport.site.push(res);
- local.render();
- } catch (e) {
- alert("Failed!");
- console.log(e);
- }
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border-r border-slate-300"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$NPMModule, {
- mode: "page",
- onChange: async (e)=>{
- if (p.page) {
- const res = await db.npm_page.create({
- data: {
- id_page: p.page.id || "",
- module: e.name,
- version: e.version
- }
- });
- $449302068b8659d8$var$w.npmImport.page[p.page.id].push(res);
- local.render();
- }
- }
- })
- ]
- })
- });
-};
-const $449302068b8659d8$var$NPMModule = ({ mode: mode, onChange: onChange })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- loading: false,
- search: {
- value: "",
- timeout: null,
- result: []
- },
- searchRef: null,
- bundling: false,
- bundleError: "",
- size: 0
- });
- if (!p.page) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {});
- (0, $63SH6.useEffect)(()=>{
- if (p.page) api.npm_size(mode, mode === "site" ? p.site.id || "" : p.page.id).then((e)=>{
- local.size = parseInt(e) || 0;
- local.render();
- });
- }, []);
- const focus = (0, $63SH6.useCallback)(()=>{
- local.searchRef.focus();
- }, [
- local.searchRef
- ]);
- let list = [];
- if (mode === "site") list = $449302068b8659d8$var$w.npmImport.site;
- else if (mode === "page") {
- if ($449302068b8659d8$var$w.npmImport.page[p.page.id]) list = $449302068b8659d8$var$w.npmImport.page[p.page.id];
- else {
- local.loading = true;
- db.npm_page.findMany({
- where: {
- id_page: p.page.id
- }
- }).then((e)=>{
- if (p.page) {
- $449302068b8659d8$var$w.npmImport.page[p.page.id] = e;
- local.loading = false;
- local.render();
- }
- });
- }
- }
- if (local.loading) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "npm-import2",
- backdrop: false
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("flex flex-col", mode === "site" ? "flex-1" : "w-[53%]"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("border-b border-slate-300 p-2 flex justify-between select-none", css`
- &:hover {
- .bundle {
- opacity: 1;
- }
- }
- `),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "text-slate-600",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "capitalize",
- children: mode
- }),
- " Module"
- ]
- }),
- local.bundling ? /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex relative flex-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "npm-import3",
- backdrop: false
- }),
- "Bundling..."
- ]
- }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- backdrop: false,
- content: /*#__PURE__*/ (0, $lAN3N.jsxs)("pre", {
- className: "font-mono select-text relative w-[800px] h-[300px] overflow-auto whitespace-pre-wrap text-red-500 relative",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "absolute bg-red-500 top-0 right-0 z-10 text-white px-2 cursor-pointer",
- onClick: ()=>{
- local.bundleError = "";
- local.render();
- },
- children: "Close"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "absolute inset-0",
- children: [
- "ERROR:",
- /*#__PURE__*/ (0, $lAN3N.jsx)("hr", {
- className: " border-red-500 my-1"
- }),
- local.bundleError
- ]
- })
- ]
- }),
- open: !!local.bundleError,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-slate-600 text-white hover:bg-blue-500 px-2 cursor-pointer bundle opacity-20 transition-all",
- onClick: async ()=>{
- local.bundling = true;
- local.bundleError = "";
- local.render();
- const res = await api.npm_bundle(mode, mode === "site" ? p.site.id || "" : p.page ? p.page.id : "");
- local.bundleError = "";
- if (typeof res === "object") {
- if (res && res.errors && Array.isArray(res.errors)) {
- const errors = [];
- res.errors.forEach((e)=>{
- errors.push(`${e.text}\n${e.location?.lineText || ""}`);
- });
- local.bundleError = errors.join("\n\n");
- }
- } else local.size = parseInt(res) || 0;
- local.bundling = false;
- list.forEach((e)=>{
- e.bundled = true;
- });
- local.render();
- p.manager.compCallback = async (e)=>{
- if (!p.comps.doc[e.id]) {
- await (0, $5NYeV.loadComponent)(p, e.id);
- if (p.page) {
- await (0, $iEVTn.default)(`${serverurl}/npm/site/${p.site?.id}/site.js`);
- await (0, $iEVTn.default)(`${serverurl}/npm/page/${p.page.id}/page.js`);
- }
- }
- };
- p.render();
- },
- children: "Bundle"
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "font-mono text-[12px]",
- children: $449302068b8659d8$var$formatBytes(local.size)
- })
- ]
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- open: local.search.result.length > 0,
- onOpenChange: (open)=>{
- if (!open) {
- local.search.result = [];
- local.render();
- }
- },
- className: "border-b flex items-stretch",
- arrow: false,
- popoverClassName: "bg-white border max-h-[200px] overflow-auto text-xs -mt-[5px] w-[300px]",
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-sm flex flex-col items-stretch",
- children: local.search.result.map((e)=>{
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("p-1 hover:bg-blue-100 cursor-pointer flex flex-col", css`
- em {
- font-weight: bold;
- text-decoration: underline;
- font-style: normal;
- }
- `),
- onClick: ()=>{
- onChange(e);
- local.search.value = "";
- local.search.result = [];
- local.render();
- focus();
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex space-x-1",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- dangerouslySetInnerHTML: {
- __html: e._highlightResult.name.value
- }
- })
- })
- }, e.objectID);
- })
- }),
- autoFocus: false,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- type: "search",
- placeholder: "+ Add Module",
- value: local.search.value,
- spellCheck: false,
- ref: (e)=>{
- if (e && e.tagName === "INPUT") local.searchRef = e;
- },
- className: "flex flex-1 p-1 outline-none ",
- onChange: async (e)=>{
- local.search.value = e.currentTarget.value;
- if (!local.search.value) {
- local.search.result = [];
- local.render();
- } else {
- local.render();
- clearTimeout(local.search.timeout);
- local.search.timeout = setTimeout(async ()=>{
- const res = await $449302068b8659d8$var$npm.search(local.search.value);
- local.search.result = res.hits;
- local.render();
- }, 300);
- }
- },
- onKeyDown: async (e)=>{
- if (e.key === "Enter") {
- const val = local.search.value;
- local.search.value = "";
- local.render();
- try {
- const f = await fetch(`https://data.jsdelivr.com/v1/packages/npm/${val}`);
- const j = await f.json();
- const version = j.versions[0].version;
- const res = await db.npm_site.create({
- data: {
- id_site: p.site?.id || "",
- module: val,
- version: version
- }
- });
- $449302068b8659d8$var$w.npmImport.site.push(res);
- local.render();
- } catch (e) {
- alert("Failed!");
- console.log(e);
- }
- }
- }
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex-1 flex flex-col relative overflow-auto",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "absolute inset-0 flex flex-col items-stretch",
- children: list.map((e)=>{
- if (!e.id) return null;
- return /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$ImportItem, {
- item: e,
- mode: mode,
- remove: async (e)=>{
- if (mode === "site") {
- await db.npm_site.delete({
- where: {
- id: BigInt(e.id)
- }
- });
- $449302068b8659d8$var$w.npmImport.site = $449302068b8659d8$var$w.npmImport.site.filter((item)=>e.id !== item.id);
- } else if (p.page) {
- await db.npm_page.delete({
- where: {
- id: BigInt(e.id)
- }
- });
- $449302068b8659d8$var$w.npmImport.page[p.page.id] = $449302068b8659d8$var$w.npmImport.page[p.page.id].filter((item)=>e.id !== item.id);
- }
- local.render();
- }
- }, e.id.toString());
- })
- })
- })
- ]
- });
-};
-const $449302068b8659d8$var$ImportItem = ({ item: item, mode: mode, remove: remove })=>{
- const local = (0, $4WfNn.useLocal)({
- show: false
- });
- const import_as = item.import_as;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- open: local.show,
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("px-1", item.bundled ? "bg-green-700 my-1 text-white font-bold" : "-mx-1 text-black"),
- children: item.bundled ? "Already bundled" : "Not bundled yet"
- }),
- delay: 0,
- placement: mode === "site" ? "left" : "right",
- className: cx("flex border-b select-none ", item.bundled ? "bg-green-50 border-l-4 border-l-green-700" : ""),
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("flex items-stretch flex-1 ", import_as.custom ? css`
- .custom {
- color: #3c82f6;
- }
- ` : css`
- .custom {
- opacity: 0;
- }
- &:hover .custom {
- opacity: 1;
- }
- `),
- onMouseEnter: ()=>{
- local.show = true;
- local.render();
- },
- onMouseLeave: ()=>{
- local.show = false;
- local.render();
- },
- onClick: ()=>{
- local.show = false;
- local.render();
- },
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-1 flex-col items-stretch leading-4 py-[6px]",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between px-1 items-end",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$MainImport, {
- item: item,
- render: local.render,
- mode: mode,
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: import_as.main.name ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "pl-1 flex flex-1 items-center hover:text-blue-500 hover:underline cursor-pointer font-bold",
- children: import_as.main.mode === "*" ? /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "text-slate-400 text-right",
- children: "import * as"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "ml-1",
- children: import_as.main.name
- })
- ]
- }) : import_as.main.name
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "pl-1 flex flex-1 items-center text-slate-500 hover:text-blue-500 hover:underline cursor-pointer",
- children: "No default import"
- })
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("a", {
- href: `https://www.npmjs.com/package/${item.module}`,
- target: "_blank",
- className: cx(css`
- &:hover {
- svg {
- width: 14px;
- }
- }
- `, "flex items-center hover:text-blue-500 hover:underline cursor-pointer"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "break-words max-w-[140px] overflow-hidden text-right",
- children: item.module
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- viewBox: "0 0 32 32",
- className: "transition-all link w-0 overflow-hidden",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M5 5v22h22V5zm2 2h18v18H7zm6 3v2h5.563L9.28 21.281l1.438 1.438L20 13.437V19h2v-9z"
- })
- })
- ]
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between px-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("flex items-center"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$NamedImport, {
- item: item,
- render: local.render,
- mode: mode,
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: " pl-1 text-slate-500 hover:text-blue-500 hover:underline cursor-pointer",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("span", {
- className: cx(import_as.names.length > 0 && "text-blue-500 font-bold"),
- children: [
- import_as.names.length === 0 ? "No" : import_as.names.length,
- " ",
- "named"
- ]
- }),
- " ",
- "imports"
- ]
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$CustomImport, {
- item: item,
- render: local.render,
- mode: mode
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex items-end justify-end",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- className: "text-slate-500 text-right outline-none bg-transparent h-[16px] ",
- type: "text",
- value: item.version,
- onChange: (e)=>{
- item.version = e.currentTarget.value;
- local.render();
- }
- })
- })
- ]
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "w-[20px] border-l border-slate-300 ml-1 flex items-center justify-center hover:text-white hover:bg-red-500 cursor-pointer text-slate-500",
- onClick: ()=>{
- if (confirm("Remove this import ?")) remove(item);
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($449302068b8659d8$var$Trash, {})
- })
- ]
- })
- });
-};
-const $449302068b8659d8$var$MainImport = ({ item: item, children: children, render: render, mode: mode })=>{
- const local = (0, $4WfNn.useLocal)({
- open: false
- });
- (0, $63SH6.useEffect)(()=>{
- if (!local.open) {
- if (mode === "site") db.npm_site.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- else db.npm_page.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- }
- }, [
- local.open
- ]);
- const import_as = item.import_as;
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- placement: "left",
- open: local.open,
- popoverClassName: "bg-white shadow-2xl shadow-slate-600 border-2 border-slate-400 px-[8px] py-[5px]",
- onOpenChange: (open)=>{
- local.open = open;
- local.render();
- },
- content: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "text-[12px] flex flex-col font-mono space-y-1 py-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex items-center whitespace-nowrap",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "import"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border ml-1 w-[95px] py-[2px] cursor-pointer hover:bg-blue-500 hover:text-white hover:border-transparent pl-1 whitespace-nowrap",
- onClick: ()=>{
- import_as.main.mode = import_as.main.mode === "*" ? "default" : "*";
- render();
- },
- children: import_as.main.mode === "*" ? "* as " : "default as"
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- autoFocus: true,
- value: import_as.main.name,
- onChange: (e)=>{
- import_as.main.name = e.currentTarget.value;
- item.bundled = false;
- render();
- },
- onKeyDown: (e)=>{
- if (e.key === "Enter") {
- local.open = false;
- local.render();
- }
- },
- spellCheck: false,
- className: "outline-none border p-1 focus:border-blue-500"
- })
- ]
- }),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- onClick: ()=>{
- local.open = true;
- local.render();
- },
- children: children
- })
- });
-};
-const $449302068b8659d8$var$CustomImport = ({ mode: mode, item: item, render: render })=>{
- const local = (0, $4WfNn.useLocal)({
- open: false
- });
- const import_as = item.import_as;
- (0, $63SH6.useEffect)(()=>{
- if (!local.open) {
- if (mode === "site") db.npm_site.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- else db.npm_page.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- }
- }, [
- local.open
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- open: local.open,
- arrow: false,
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("textarea", {
- spellCheck: false,
- className: "h-[300px] font-mono text-[11px] w-[300px] outline-none p-2",
- autoFocus: true,
- value: import_as.custom || "",
- onChange: (e)=>{
- item.bundled = false;
- import_as.custom = e.currentTarget.value || "";
- render();
- }
- }),
- popoverClassName: "bg-white shadow-2xl shadow-slate-600",
- onOpenChange: (open)=>{
- local.open = open;
- local.render();
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "custom transition-all text-slate-500 hover:text-blue-500 border-b border-transparent hover:border-blue-500 cursor-pointer ml-8 flex items-center",
- onClick: ()=>{
- local.open = true;
- local.render();
- },
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- viewBox: "0 0 24 24",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- d: "M15 20a1 1 0 001-1V4H8a1 1 0 00-1 1v11H5V5a3 3 0 013-3h11a3 3 0 013 3v1h-2V5a1 1 0 00-1-1 1 1 0 00-1 1v14a3 3 0 01-3 3H5a3 3 0 01-3-3v-1h11a2 2 0 002 2z"
- })
- }),
- " ",
- "Custom"
- ]
- })
- });
-};
-const $449302068b8659d8$var$NamedImport = ({ mode: mode, item: item, children: children, render: render })=>{
- const import_as = item.import_as;
- const local = (0, $4WfNn.useLocal)({
- new: null,
- focusIdx: -1,
- open: false
- });
- (0, $63SH6.useEffect)(()=>{
- if (!local.open) {
- if (mode === "site") db.npm_site.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- else db.npm_page.update({
- where: {
- id: item.id
- },
- data: {
- import_as: import_as
- }
- });
- }
- }, [
- local.open
- ]);
- const newFocus = (0, $63SH6.useCallback)(()=>{
- local.new.focus();
- }, [
- local.new
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- placement: "left",
- open: local.open,
- popoverClassName: "bg-white shadow-2xl shadow-slate-600 border-2 border-slate-400 px-[8px] py-[5px]",
- onOpenChange: (open)=>{
- local.open = open;
- local.render();
- },
- content: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "text-[12px] flex flex-col font-mono space-y-1 py-1 overflow-y-auto max-h-[400px]",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex items-center",
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- children: [
- "import ",
- "{...}"
- ]
- })
- }),
- import_as.names.map((e, idx)=>{
- const valid = $449302068b8659d8$var$isValidIdentifier(e);
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- open: !valid,
- placement: "right",
- backdrop: false,
- autoFocus: false,
- arrow: false,
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("text-white bg-red-500 px-3 ", css`
- margin: -3px -9px -3px -14px;
- `),
- children: "Invalid Name"
- }),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- ref: (el)=>{
- if (el && local.focusIdx === idx) {
- local.focusIdx = -1;
- el.focus();
- }
- },
- spellCheck: false,
- value: e,
- onKeyDown: (e)=>{
- if (e.key === "Enter" && local.new) local.new.focus();
- },
- onChange: (ev)=>{
- item.bundled = false;
- import_as.names[idx] = ev.currentTarget.value;
- if (!import_as.names[idx]) import_as.names.splice(idx, 1);
- render();
- if (idx < import_as.names.length) local.focusIdx = idx;
- else local.focusIdx = idx - 1;
- if (import_as.names.length === 0) newFocus();
- },
- className: cx("outline-none border p-1", !valid ? "border-red-500" : "focus:border-blue-500")
- })
- }, idx);
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- autoFocus: true,
- spellCheck: false,
- ref: (el)=>{
- local.new = el;
- },
- onKeyDown: (e)=>{
- if (e.key === "Enter") e.currentTarget.blur();
- },
- onBlur: (e)=>{
- if (e.currentTarget.value) {
- const vals = e.currentTarget.value.split(",");
- vals.forEach((e)=>{
- import_as.names.push(e.trim());
- });
- item.bundled = false;
- e.currentTarget.value = "";
- render();
- newFocus();
- }
- },
- placeholder: "New Named Import",
- className: "outline-none border p-1 focus:border-blue-500"
- })
- ]
- }),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- onClick: ()=>{
- local.open = true;
- local.render();
- },
- children: children
- })
- });
-};
-const $449302068b8659d8$var$isValidIdentifier = (str)=>{
- return /^(?!(?:do|if|in|for|let|new|try|var|case|else|enum|eval|null|this|true|void|with|await|break|catch|class|const|false|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$)(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])*$/.test(str);
-};
-const $449302068b8659d8$var$Trash = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: 13,
- height: 13,
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M5.5 1a.5.5 0 000 1h4a.5.5 0 000-1h-4zM3 3.5a.5.5 0 01.5-.5h8a.5.5 0 010 1H11v8a1 1 0 01-1 1H5a1 1 0 01-1-1V4h-.5a.5.5 0 01-.5-.5zM5 4h5v8H5V4z",
- clipRule: "evenodd"
- })
- });
-const $449302068b8659d8$var$camel = function(snakeCased) {
- // Use a regular expression to find the underscores + the next letter
- return snakeCased.replace(/(\W\w)/g, function(match) {
- // Convert to upper case and ignore the first char (=the underscore)
- return match.toUpperCase().substring(1);
- });
-};
-function $449302068b8659d8$var$formatBytes(bytes, decimals) {
- if (bytes == 0) return "0 Bytes";
- var k = 1024, dm = decimals || 2, sizes = [
- "Bytes",
- "KB",
- "MB",
- "GB",
- "TB",
- "PB",
- "EB",
- "ZB",
- "YB"
- ], i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
-}
-
-});
-parcelRegister("jhQSY", function(module, exports) {
-/*! algoliasearch.umd.js | 4.20.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ !function(t, e) {
- module.exports = e();
-}(module.exports, function() {
- "use strict";
- function t(t, e, r) {
- return e in t ? Object.defineProperty(t, e, {
- value: r,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : t[e] = r, t;
- }
- function e(t, e) {
- var r = Object.keys(t);
- if (Object.getOwnPropertySymbols) {
- var n = Object.getOwnPropertySymbols(t);
- e && (n = n.filter(function(e) {
- return Object.getOwnPropertyDescriptor(t, e).enumerable;
- })), r.push.apply(r, n);
- }
- return r;
- }
- function r(r) {
- for(var n = 1; n < arguments.length; n++){
- var a = null != arguments[n] ? arguments[n] : {};
- n % 2 ? e(Object(a), !0).forEach(function(e) {
- t(r, e, a[e]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(a)) : e(Object(a)).forEach(function(t) {
- Object.defineProperty(r, t, Object.getOwnPropertyDescriptor(a, t));
- });
- }
- return r;
- }
- function n(t, e) {
- if (null == t) return {};
- var r, n, a = function(t, e) {
- if (null == t) return {};
- var r, n, a = {}, o = Object.keys(t);
- for(n = 0; n < o.length; n++)r = o[n], e.indexOf(r) >= 0 || (a[r] = t[r]);
- return a;
- }(t, e);
- if (Object.getOwnPropertySymbols) {
- var o = Object.getOwnPropertySymbols(t);
- for(n = 0; n < o.length; n++)r = o[n], e.indexOf(r) >= 0 || Object.prototype.propertyIsEnumerable.call(t, r) && (a[r] = t[r]);
- }
- return a;
- }
- function a(t, e) {
- return function(t) {
- if (Array.isArray(t)) return t;
- }(t) || function(t, e) {
- if (!(Symbol.iterator in Object(t) || "[object Arguments]" === Object.prototype.toString.call(t))) return;
- var r = [], n = !0, a = !1, o = void 0;
- try {
- for(var i, u = t[Symbol.iterator](); !(n = (i = u.next()).done) && (r.push(i.value), !e || r.length !== e); n = !0);
- } catch (t) {
- a = !0, o = t;
- } finally{
- try {
- n || null == u.return || u.return();
- } finally{
- if (a) throw o;
- }
- }
- return r;
- }(t, e) || function() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }();
- }
- function o(t) {
- return function(t) {
- if (Array.isArray(t)) {
- for(var e = 0, r = new Array(t.length); e < t.length; e++)r[e] = t[e];
- return r;
- }
- }(t) || function(t) {
- if (Symbol.iterator in Object(t) || "[object Arguments]" === Object.prototype.toString.call(t)) return Array.from(t);
- }(t) || function() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }();
- }
- function i(t) {
- var e, r = "algoliasearch-client-js-".concat(t.key), n = function() {
- return void 0 === e && (e = t.localStorage || window.localStorage), e;
- }, o = function() {
- return JSON.parse(n().getItem(r) || "{}");
- }, i = function(t) {
- n().setItem(r, JSON.stringify(t));
- }, u = function() {
- var e = t.timeToLive ? 1e3 * t.timeToLive : null, r = o(), n = Object.fromEntries(Object.entries(r).filter(function(t) {
- return void 0 !== a(t, 2)[1].timestamp;
- }));
- if (i(n), e) {
- var u = Object.fromEntries(Object.entries(n).filter(function(t) {
- var r = a(t, 2)[1], n = (new Date).getTime();
- return !(r.timestamp + e < n);
- }));
- i(u);
- }
- };
- return {
- get: function(t, e) {
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
- miss: function() {
- return Promise.resolve();
- }
- };
- return Promise.resolve().then(function() {
- u();
- var e = JSON.stringify(t);
- return o()[e];
- }).then(function(t) {
- return Promise.all([
- t ? t.value : e(),
- void 0 !== t
- ]);
- }).then(function(t) {
- var e = a(t, 2), n = e[0], o = e[1];
- return Promise.all([
- n,
- o || r.miss(n)
- ]);
- }).then(function(t) {
- return a(t, 1)[0];
- });
- },
- set: function(t, e) {
- return Promise.resolve().then(function() {
- var a = o();
- return a[JSON.stringify(t)] = {
- timestamp: (new Date).getTime(),
- value: e
- }, n().setItem(r, JSON.stringify(a)), e;
- });
- },
- delete: function(t) {
- return Promise.resolve().then(function() {
- var e = o();
- delete e[JSON.stringify(t)], n().setItem(r, JSON.stringify(e));
- });
- },
- clear: function() {
- return Promise.resolve().then(function() {
- n().removeItem(r);
- });
- }
- };
- }
- function u(t) {
- var e = o(t.caches), r = e.shift();
- return void 0 === r ? {
- get: function(t, e) {
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
- miss: function() {
- return Promise.resolve();
- }
- }, n = e();
- return n.then(function(t) {
- return Promise.all([
- t,
- r.miss(t)
- ]);
- }).then(function(t) {
- return a(t, 1)[0];
- });
- },
- set: function(t, e) {
- return Promise.resolve(e);
- },
- delete: function(t) {
- return Promise.resolve();
- },
- clear: function() {
- return Promise.resolve();
- }
- } : {
- get: function(t, n) {
- var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
- miss: function() {
- return Promise.resolve();
- }
- };
- return r.get(t, n, a).catch(function() {
- return u({
- caches: e
- }).get(t, n, a);
- });
- },
- set: function(t, n) {
- return r.set(t, n).catch(function() {
- return u({
- caches: e
- }).set(t, n);
- });
- },
- delete: function(t) {
- return r.delete(t).catch(function() {
- return u({
- caches: e
- }).delete(t);
- });
- },
- clear: function() {
- return r.clear().catch(function() {
- return u({
- caches: e
- }).clear();
- });
- }
- };
- }
- function s() {
- var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
- serializable: !0
- }, e = {};
- return {
- get: function(r, n) {
- var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
- miss: function() {
- return Promise.resolve();
- }
- }, o = JSON.stringify(r);
- if (o in e) return Promise.resolve(t.serializable ? JSON.parse(e[o]) : e[o]);
- var i = n(), u = a && a.miss || function() {
- return Promise.resolve();
- };
- return i.then(function(t) {
- return u(t);
- }).then(function() {
- return i;
- });
- },
- set: function(r, n) {
- return e[JSON.stringify(r)] = t.serializable ? JSON.stringify(n) : n, Promise.resolve(n);
- },
- delete: function(t) {
- return delete e[JSON.stringify(t)], Promise.resolve();
- },
- clear: function() {
- return e = {}, Promise.resolve();
- }
- };
- }
- function c(t, e, r) {
- var n = {
- "x-algolia-api-key": r,
- "x-algolia-application-id": e
- };
- return {
- headers: function() {
- return t === m.WithinHeaders ? n : {};
- },
- queryParameters: function() {
- return t === m.WithinQueryParameters ? n : {};
- }
- };
- }
- function f(t) {
- var e = 0;
- return t(function r() {
- return e++, new Promise(function(n) {
- setTimeout(function() {
- n(t(r));
- }, Math.min(100 * e, 1e3));
- });
- });
- }
- function d(t) {
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function(t, e) {
- return Promise.resolve();
- };
- return Object.assign(t, {
- wait: function(r) {
- return d(t.then(function(t) {
- return Promise.all([
- e(t, r),
- t
- ]);
- }).then(function(t) {
- return t[1];
- }));
- }
- });
- }
- function l(t) {
- for(var e = t.length - 1; e > 0; e--){
- var r = Math.floor(Math.random() * (e + 1)), n = t[e];
- t[e] = t[r], t[r] = n;
- }
- return t;
- }
- function p(t, e) {
- return e ? (Object.keys(e).forEach(function(r) {
- t[r] = e[r](t);
- }), t) : t;
- }
- function h(t) {
- for(var e = arguments.length, r = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++)r[n - 1] = arguments[n];
- var a = 0;
- return t.replace(/%s/g, function() {
- return encodeURIComponent(r[a++]);
- });
- }
- var m = {
- WithinQueryParameters: 0,
- WithinHeaders: 1
- };
- function y(t, e) {
- var r = t || {}, n = r.data || {};
- return Object.keys(r).forEach(function(t) {
- -1 === [
- "timeout",
- "headers",
- "queryParameters",
- "data",
- "cacheable"
- ].indexOf(t) && (n[t] = r[t]);
- }), {
- data: Object.entries(n).length > 0 ? n : void 0,
- timeout: r.timeout || e,
- headers: r.headers || {},
- queryParameters: r.queryParameters || {},
- cacheable: r.cacheable
- };
- }
- var g = {
- Read: 1,
- Write: 2,
- Any: 3
- }, v = 1, b = 2, O = 3;
- function P(t) {
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : v;
- return r(r({}, t), {}, {
- status: e,
- lastUpdate: Date.now()
- });
- }
- function w(t) {
- return "string" == typeof t ? {
- protocol: "https",
- url: t,
- accept: g.Any
- } : {
- protocol: t.protocol || "https",
- url: t.url,
- accept: t.accept || g.Any
- };
- }
- var I = "DELETE", j = "GET", x = "POST", D = "PUT";
- function q(t, e) {
- return Promise.all(e.map(function(e) {
- return t.get(e, function() {
- return Promise.resolve(P(e));
- });
- })).then(function(t) {
- var r = t.filter(function(t) {
- return function(t) {
- return t.status === v || Date.now() - t.lastUpdate > 12e4;
- }(t);
- }), n = t.filter(function(t) {
- return function(t) {
- return t.status === O && Date.now() - t.lastUpdate <= 12e4;
- }(t);
- }), a = [].concat(o(r), o(n));
- return {
- getTimeout: function(t, e) {
- return (0 === n.length && 0 === t ? 1 : n.length + 3 + t) * e;
- },
- statelessHosts: a.length > 0 ? a.map(function(t) {
- return w(t);
- }) : e
- };
- });
- }
- function S(t, e, n, a) {
- var i = [], u = function(t, e) {
- if (t.method === j || void 0 === t.data && void 0 === e.data) return;
- var n = Array.isArray(t.data) ? t.data : r(r({}, t.data), e.data);
- return JSON.stringify(n);
- }(n, a), s = function(t, e) {
- var n = r(r({}, t.headers), e.headers), a = {};
- return Object.keys(n).forEach(function(t) {
- var e = n[t];
- a[t.toLowerCase()] = e;
- }), a;
- }(t, a), c = n.method, f = n.method !== j ? {} : r(r({}, n.data), a.data), d = r(r(r({
- "x-algolia-agent": t.userAgent.value
- }, t.queryParameters), f), a.queryParameters), l = 0, p = function e(r, o) {
- var f = r.pop();
- if (void 0 === f) throw {
- name: "RetryError",
- message: "Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",
- transporterStackTrace: R(i)
- };
- var p = {
- data: u,
- headers: s,
- method: c,
- url: N(f, n.path, d),
- connectTimeout: o(l, t.timeouts.connect),
- responseTimeout: o(l, a.timeout)
- }, h = function(t) {
- var e = {
- request: p,
- response: t,
- host: f,
- triesLeft: r.length
- };
- return i.push(e), e;
- }, m = {
- onSuccess: function(t) {
- return function(t) {
- try {
- return JSON.parse(t.content);
- } catch (e) {
- throw function(t, e) {
- return {
- name: "DeserializationError",
- message: t,
- response: e
- };
- }(e.message, t);
- }
- }(t);
- },
- onRetry: function(n) {
- var a = h(n);
- return n.isTimedOut && l++, Promise.all([
- t.logger.info("Retryable failure", A(a)),
- t.hostsCache.set(f, P(f, n.isTimedOut ? O : b))
- ]).then(function() {
- return e(r, o);
- });
- },
- onFail: function(t) {
- throw h(t), function(t, e) {
- var r = t.content, n = t.status, a = r;
- try {
- a = JSON.parse(r).message;
- } catch (t) {}
- return function(t, e, r) {
- return {
- name: "ApiError",
- message: t,
- status: e,
- transporterStackTrace: r
- };
- }(a, n, e);
- }(t, R(i));
- }
- };
- return t.requester.send(p).then(function(t) {
- return function(t, e) {
- return function(t) {
- var e = t.status;
- return t.isTimedOut || function(t) {
- var e = t.isTimedOut, r = t.status;
- return !e && 0 == ~~r;
- }(t) || 2 != ~~(e / 100) && 4 != ~~(e / 100);
- }(t) ? e.onRetry(t) : 2 == ~~(t.status / 100) ? e.onSuccess(t) : e.onFail(t);
- }(t, m);
- });
- };
- return q(t.hostsCache, e).then(function(t) {
- return p(o(t.statelessHosts).reverse(), t.getTimeout);
- });
- }
- function k(t) {
- var e = t.hostsCache, r = t.logger, n = t.requester, o = t.requestsCache, i = t.responsesCache, u = t.timeouts, s = t.userAgent, c = t.hosts, f = t.queryParameters, d = {
- hostsCache: e,
- logger: r,
- requester: n,
- requestsCache: o,
- responsesCache: i,
- timeouts: u,
- userAgent: s,
- headers: t.headers,
- queryParameters: f,
- hosts: c.map(function(t) {
- return w(t);
- }),
- read: function(t, e) {
- var r = y(e, d.timeouts.read), n = function() {
- return S(d, d.hosts.filter(function(t) {
- return 0 != (t.accept & g.Read);
- }), t, r);
- };
- if (!0 !== (void 0 !== r.cacheable ? r.cacheable : t.cacheable)) return n();
- var o = {
- request: t,
- mappedRequestOptions: r,
- transporter: {
- queryParameters: d.queryParameters,
- headers: d.headers
- }
- };
- return d.responsesCache.get(o, function() {
- return d.requestsCache.get(o, function() {
- return d.requestsCache.set(o, n()).then(function(t) {
- return Promise.all([
- d.requestsCache.delete(o),
- t
- ]);
- }, function(t) {
- return Promise.all([
- d.requestsCache.delete(o),
- Promise.reject(t)
- ]);
- }).then(function(t) {
- var e = a(t, 2);
- e[0];
- return e[1];
- });
- });
- }, {
- miss: function(t) {
- return d.responsesCache.set(o, t);
- }
- });
- },
- write: function(t, e) {
- return S(d, d.hosts.filter(function(t) {
- return 0 != (t.accept & g.Write);
- }), t, y(e, d.timeouts.write));
- }
- };
- return d;
- }
- function T(t) {
- var e = {
- value: "Algolia for JavaScript (".concat(t, ")"),
- add: function(t) {
- var r = "; ".concat(t.segment).concat(void 0 !== t.version ? " (".concat(t.version, ")") : "");
- return -1 === e.value.indexOf(r) && (e.value = "".concat(e.value).concat(r)), e;
- }
- };
- return e;
- }
- function N(t, e, r) {
- var n = E(r), a = "".concat(t.protocol, "://").concat(t.url, "/").concat("/" === e.charAt(0) ? e.substr(1) : e);
- return n.length && (a += "?".concat(n)), a;
- }
- function E(t) {
- return Object.keys(t).map(function(e) {
- var r;
- return h("%s=%s", e, (r = t[e], "[object Object]" === Object.prototype.toString.call(r) || "[object Array]" === Object.prototype.toString.call(r) ? JSON.stringify(t[e]) : t[e]));
- }).join("&");
- }
- function R(t) {
- return t.map(function(t) {
- return A(t);
- });
- }
- function A(t) {
- var e = t.request.headers["x-algolia-api-key"] ? {
- "x-algolia-api-key": "*****"
- } : {};
- return r(r({}, t), {}, {
- request: r(r({}, t.request), {}, {
- headers: r(r({}, t.request.headers), e)
- })
- });
- }
- var C = function(t) {
- return function(e, r) {
- return t.transporter.write({
- method: x,
- path: "2/abtests",
- data: e
- }, r);
- };
- }, U = function(t) {
- return function(e, r) {
- return t.transporter.write({
- method: I,
- path: h("2/abtests/%s", e)
- }, r);
- };
- }, z = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("2/abtests/%s", e)
- }, r);
- };
- }, J = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "2/abtests"
- }, e);
- };
- }, F = function(t) {
- return function(e, r) {
- return t.transporter.write({
- method: x,
- path: h("2/abtests/%s/stop", e)
- }, r);
- };
- }, H = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/strategies/personalization"
- }, e);
- };
- }, M = function(t) {
- return function(e, r) {
- return t.transporter.write({
- method: x,
- path: "1/strategies/personalization",
- data: e
- }, r);
- };
- };
- function K(t) {
- return function e(r) {
- return t.request(r).then(function(n) {
- if (void 0 !== t.batch && t.batch(n.hits), !t.shouldStop(n)) return n.cursor ? e({
- cursor: n.cursor
- }) : e({
- page: (r.page || 0) + 1
- });
- });
- }({});
- }
- var W = function(t) {
- return function(e, a) {
- var o = a || {}, i = o.queryParameters, u = n(o, [
- "queryParameters"
- ]), s = r({
- acl: e
- }, void 0 !== i ? {
- queryParameters: i
- } : {});
- return d(t.transporter.write({
- method: x,
- path: "1/keys",
- data: s
- }, u), function(e, r) {
- return f(function(n) {
- return tt(t)(e.key, r).catch(function(t) {
- if (404 !== t.status) throw t;
- return n();
- });
- });
- });
- };
- }, B = function(t) {
- return function(e, r, n) {
- var a = y(n);
- return a.queryParameters["X-Algolia-User-ID"] = e, t.transporter.write({
- method: x,
- path: "1/clusters/mapping",
- data: {
- cluster: r
- }
- }, a);
- };
- }, Q = function(t) {
- return function(e, r, n) {
- return t.transporter.write({
- method: x,
- path: "1/clusters/mapping/batch",
- data: {
- users: e,
- cluster: r
- }
- }, n);
- };
- }, G = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: x,
- path: h("/1/dictionaries/%s/batch", e),
- data: {
- clearExistingDictionaryEntries: !0,
- requests: {
- action: "addEntry",
- body: []
- }
- }
- }, r), function(e, r) {
- return xt(t)(e.taskID, r);
- });
- };
- }, L = function(t) {
- return function(e, r, n) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/operation", e),
- data: {
- operation: "copy",
- destination: r
- }
- }, n), function(r, n) {
- return ut(t)(e, {
- methods: {
- waitTask: de
- }
- }).waitTask(r.taskID, n);
- });
- };
- }, V = function(t) {
- return function(e, n, a) {
- return L(t)(e, n, r(r({}, a), {}, {
- scope: [
- pe.Rules
- ]
- }));
- };
- }, _ = function(t) {
- return function(e, n, a) {
- return L(t)(e, n, r(r({}, a), {}, {
- scope: [
- pe.Settings
- ]
- }));
- };
- }, X = function(t) {
- return function(e, n, a) {
- return L(t)(e, n, r(r({}, a), {}, {
- scope: [
- pe.Synonyms
- ]
- }));
- };
- }, Y = function(t) {
- return function(e, r) {
- return e.method === j ? t.transporter.read(e, r) : t.transporter.write(e, r);
- };
- }, Z = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: I,
- path: h("1/keys/%s", e)
- }, r), function(r, n) {
- return f(function(r) {
- return tt(t)(e, n).then(r).catch(function(t) {
- if (404 !== t.status) throw t;
- });
- });
- });
- };
- }, $ = function(t) {
- return function(e, r, n) {
- var a = r.map(function(t) {
- return {
- action: "deleteEntry",
- body: {
- objectID: t
- }
- };
- });
- return d(t.transporter.write({
- method: x,
- path: h("/1/dictionaries/%s/batch", e),
- data: {
- clearExistingDictionaryEntries: !1,
- requests: a
- }
- }, n), function(e, r) {
- return xt(t)(e.taskID, r);
- });
- };
- }, tt = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/keys/%s", e)
- }, r);
- };
- }, et = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/task/%s", e.toString())
- }, r);
- };
- }, rt = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "/1/dictionaries/*/settings"
- }, e);
- };
- }, nt = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/logs"
- }, e);
- };
- }, at = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/clusters/mapping/top"
- }, e);
- };
- }, ot = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/clusters/mapping/%s", e)
- }, r);
- };
- }, it = function(t) {
- return function(e) {
- var r = e || {}, a = r.retrieveMappings, o = n(r, [
- "retrieveMappings"
- ]);
- return !0 === a && (o.getClusters = !0), t.transporter.read({
- method: j,
- path: "1/clusters/mapping/pending"
- }, o);
- };
- }, ut = function(t) {
- return function(e) {
- var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n = {
- transporter: t.transporter,
- appId: t.appId,
- indexName: e
- };
- return p(n, r.methods);
- };
- }, st = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/keys"
- }, e);
- };
- }, ct = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/clusters"
- }, e);
- };
- }, ft = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/indexes"
- }, e);
- };
- }, dt = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: "1/clusters/mapping"
- }, e);
- };
- }, lt = function(t) {
- return function(e, r, n) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/operation", e),
- data: {
- operation: "move",
- destination: r
- }
- }, n), function(r, n) {
- return ut(t)(e, {
- methods: {
- waitTask: de
- }
- }).waitTask(r.taskID, n);
- });
- };
- }, pt = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: x,
- path: "1/indexes/*/batch",
- data: {
- requests: e
- }
- }, r), function(e, r) {
- return Promise.all(Object.keys(e.taskID).map(function(n) {
- return ut(t)(n, {
- methods: {
- waitTask: de
- }
- }).waitTask(e.taskID[n], r);
- }));
- });
- };
- }, ht = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: x,
- path: "1/indexes/*/objects",
- data: {
- requests: e
- }
- }, r);
- };
- }, mt = function(t) {
- return function(e, n) {
- var a = e.map(function(t) {
- return r(r({}, t), {}, {
- params: E(t.params || {})
- });
- });
- return t.transporter.read({
- method: x,
- path: "1/indexes/*/queries",
- data: {
- requests: a
- },
- cacheable: !0
- }, n);
- };
- }, yt = function(t) {
- return function(e, a) {
- return Promise.all(e.map(function(e) {
- var o = e.params, i = o.facetName, u = o.facetQuery, s = n(o, [
- "facetName",
- "facetQuery"
- ]);
- return ut(t)(e.indexName, {
- methods: {
- searchForFacetValues: ue
- }
- }).searchForFacetValues(i, u, r(r({}, a), s));
- }));
- };
- }, gt = function(t) {
- return function(e, r) {
- var n = y(r);
- return n.queryParameters["X-Algolia-User-ID"] = e, t.transporter.write({
- method: I,
- path: "1/clusters/mapping"
- }, n);
- };
- }, vt = function(t) {
- return function(e, r, n) {
- var a = r.map(function(t) {
- return {
- action: "addEntry",
- body: t
- };
- });
- return d(t.transporter.write({
- method: x,
- path: h("/1/dictionaries/%s/batch", e),
- data: {
- clearExistingDictionaryEntries: !0,
- requests: a
- }
- }, n), function(e, r) {
- return xt(t)(e.taskID, r);
- });
- };
- }, bt = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: x,
- path: h("1/keys/%s/restore", e)
- }, r), function(r, n) {
- return f(function(r) {
- return tt(t)(e, n).catch(function(t) {
- if (404 !== t.status) throw t;
- return r();
- });
- });
- });
- };
- }, Ot = function(t) {
- return function(e, r, n) {
- var a = r.map(function(t) {
- return {
- action: "addEntry",
- body: t
- };
- });
- return d(t.transporter.write({
- method: x,
- path: h("/1/dictionaries/%s/batch", e),
- data: {
- clearExistingDictionaryEntries: !1,
- requests: a
- }
- }, n), function(e, r) {
- return xt(t)(e.taskID, r);
- });
- };
- }, Pt = function(t) {
- return function(e, r, n) {
- return t.transporter.read({
- method: x,
- path: h("/1/dictionaries/%s/search", e),
- data: {
- query: r
- },
- cacheable: !0
- }, n);
- };
- }, wt = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: x,
- path: "1/clusters/mapping/search",
- data: {
- query: e
- }
- }, r);
- };
- }, It = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: D,
- path: "/1/dictionaries/*/settings",
- data: e
- }, r), function(e, r) {
- return xt(t)(e.taskID, r);
- });
- };
- }, jt = function(t) {
- return function(e, r) {
- var a = Object.assign({}, r), o = r || {}, i = o.queryParameters, u = n(o, [
- "queryParameters"
- ]), s = i ? {
- queryParameters: i
- } : {}, c = [
- "acl",
- "indexes",
- "referers",
- "restrictSources",
- "queryParameters",
- "description",
- "maxQueriesPerIPPerHour",
- "maxHitsPerQuery"
- ];
- return d(t.transporter.write({
- method: D,
- path: h("1/keys/%s", e),
- data: s
- }, u), function(r, n) {
- return f(function(r) {
- return tt(t)(e, n).then(function(t) {
- return function(t) {
- return Object.keys(a).filter(function(t) {
- return -1 !== c.indexOf(t);
- }).every(function(e) {
- if (Array.isArray(t[e]) && Array.isArray(a[e])) {
- var r = t[e];
- return r.length === a[e].length && r.every(function(t, r) {
- return t === a[e][r];
- });
- }
- return t[e] === a[e];
- });
- }(t) ? Promise.resolve() : r();
- });
- });
- });
- };
- }, xt = function(t) {
- return function(e, r) {
- return f(function(n) {
- return et(t)(e, r).then(function(t) {
- return "published" !== t.status ? n() : void 0;
- });
- });
- };
- }, Dt = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/batch", t.indexName),
- data: {
- requests: e
- }
- }, r), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, qt = function(t) {
- return function(e) {
- return K(r(r({
- shouldStop: function(t) {
- return void 0 === t.cursor;
- }
- }, e), {}, {
- request: function(r) {
- return t.transporter.read({
- method: x,
- path: h("1/indexes/%s/browse", t.indexName),
- data: r
- }, e);
- }
- }));
- };
- }, St = function(t) {
- return function(e) {
- var n = r({
- hitsPerPage: 1e3
- }, e);
- return K(r(r({
- shouldStop: function(t) {
- return t.hits.length < n.hitsPerPage;
- }
- }, n), {}, {
- request: function(e) {
- return se(t)("", r(r({}, n), e)).then(function(t) {
- return r(r({}, t), {}, {
- hits: t.hits.map(function(t) {
- return delete t._highlightResult, t;
- })
- });
- });
- }
- }));
- };
- }, kt = function(t) {
- return function(e) {
- var n = r({
- hitsPerPage: 1e3
- }, e);
- return K(r(r({
- shouldStop: function(t) {
- return t.hits.length < n.hitsPerPage;
- }
- }, n), {}, {
- request: function(e) {
- return ce(t)("", r(r({}, n), e)).then(function(t) {
- return r(r({}, t), {}, {
- hits: t.hits.map(function(t) {
- return delete t._highlightResult, t;
- })
- });
- });
- }
- }));
- };
- }, Tt = function(t) {
- return function(e, r, a) {
- var o = a || {}, i = o.batchSize, u = n(o, [
- "batchSize"
- ]), s = {
- taskIDs: [],
- objectIDs: []
- };
- return d(function n() {
- var a, o = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, c = [];
- for(a = o; a < e.length && (c.push(e[a]), c.length !== (i || 1e3)); a++);
- return 0 === c.length ? Promise.resolve(s) : Dt(t)(c.map(function(t) {
- return {
- action: r,
- body: t
- };
- }), u).then(function(t) {
- return s.objectIDs = s.objectIDs.concat(t.objectIDs), s.taskIDs.push(t.taskID), a++, n(a);
- });
- }(), function(e, r) {
- return Promise.all(e.taskIDs.map(function(e) {
- return de(t)(e, r);
- }));
- });
- };
- }, Nt = function(t) {
- return function(e) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/clear", t.indexName)
- }, e), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Et = function(t) {
- return function(e) {
- var r = e || {}, a = r.forwardToReplicas, o = y(n(r, [
- "forwardToReplicas"
- ]));
- return a && (o.queryParameters.forwardToReplicas = 1), d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/rules/clear", t.indexName)
- }, o), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Rt = function(t) {
- return function(e) {
- var r = e || {}, a = r.forwardToReplicas, o = y(n(r, [
- "forwardToReplicas"
- ]));
- return a && (o.queryParameters.forwardToReplicas = 1), d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/synonyms/clear", t.indexName)
- }, o), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, At = function(t) {
- return function(e, r) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/deleteByQuery", t.indexName),
- data: e
- }, r), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Ct = function(t) {
- return function(e) {
- return d(t.transporter.write({
- method: I,
- path: h("1/indexes/%s", t.indexName)
- }, e), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Ut = function(t) {
- return function(e, r) {
- return d(zt(t)([
- e
- ], r).then(function(t) {
- return {
- taskID: t.taskIDs[0]
- };
- }), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, zt = function(t) {
- return function(e, r) {
- var n = e.map(function(t) {
- return {
- objectID: t
- };
- });
- return Tt(t)(n, le.DeleteObject, r);
- };
- }, Jt = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.forwardToReplicas, i = y(n(a, [
- "forwardToReplicas"
- ]));
- return o && (i.queryParameters.forwardToReplicas = 1), d(t.transporter.write({
- method: I,
- path: h("1/indexes/%s/rules/%s", t.indexName, e)
- }, i), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Ft = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.forwardToReplicas, i = y(n(a, [
- "forwardToReplicas"
- ]));
- return o && (i.queryParameters.forwardToReplicas = 1), d(t.transporter.write({
- method: I,
- path: h("1/indexes/%s/synonyms/%s", t.indexName, e)
- }, i), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Ht = function(t) {
- return function(e) {
- return Lt(t)(e).then(function() {
- return !0;
- }).catch(function(t) {
- if (404 !== t.status) throw t;
- return !1;
- });
- };
- }, Mt = function(t) {
- return function(e, r, n) {
- return t.transporter.read({
- method: x,
- path: h("1/answers/%s/prediction", t.indexName),
- data: {
- query: e,
- queryLanguages: r
- },
- cacheable: !0
- }, n);
- };
- }, Kt = function(t) {
- return function(e, o) {
- var i = o || {}, u = i.query, s = i.paginate, c = n(i, [
- "query",
- "paginate"
- ]), f = 0;
- return function n() {
- return ie(t)(u || "", r(r({}, c), {}, {
- page: f
- })).then(function(t) {
- for(var r = 0, o = Object.entries(t.hits); r < o.length; r++){
- var i = a(o[r], 2), u = i[0], c = i[1];
- if (e(c)) return {
- object: c,
- position: parseInt(u, 10),
- page: f
- };
- }
- if (f++, !1 === s || f >= t.nbPages) throw {
- name: "ObjectNotFoundError",
- message: "Object not found."
- };
- return n();
- });
- }();
- };
- }, Wt = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/indexes/%s/%s", t.indexName, e)
- }, r);
- };
- }, Bt = function() {
- return function(t, e) {
- for(var r = 0, n = Object.entries(t.hits); r < n.length; r++){
- var o = a(n[r], 2), i = o[0];
- if (o[1].objectID === e) return parseInt(i, 10);
- }
- return -1;
- };
- }, Qt = function(t) {
- return function(e, a) {
- var o = a || {}, i = o.attributesToRetrieve, u = n(o, [
- "attributesToRetrieve"
- ]), s = e.map(function(e) {
- return r({
- indexName: t.indexName,
- objectID: e
- }, i ? {
- attributesToRetrieve: i
- } : {});
- });
- return t.transporter.read({
- method: x,
- path: "1/indexes/*/objects",
- data: {
- requests: s
- }
- }, u);
- };
- }, Gt = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/indexes/%s/rules/%s", t.indexName, e)
- }, r);
- };
- }, Lt = function(t) {
- return function(e) {
- return t.transporter.read({
- method: j,
- path: h("1/indexes/%s/settings", t.indexName),
- data: {
- getVersion: 2
- }
- }, e);
- };
- }, Vt = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/indexes/%s/synonyms/%s", t.indexName, e)
- }, r);
- };
- }, _t = function(t) {
- return function(e, r) {
- return d(Xt(t)([
- e
- ], r).then(function(t) {
- return {
- objectID: t.objectIDs[0],
- taskID: t.taskIDs[0]
- };
- }), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, Xt = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.createIfNotExists, i = n(a, [
- "createIfNotExists"
- ]), u = o ? le.PartialUpdateObject : le.PartialUpdateObjectNoCreate;
- return Tt(t)(e, u, i);
- };
- }, Yt = function(t) {
- return function(e, i) {
- var u = i || {}, s = u.safe, c = u.autoGenerateObjectIDIfNotExist, f = u.batchSize, l = n(u, [
- "safe",
- "autoGenerateObjectIDIfNotExist",
- "batchSize"
- ]), p = function(e, r, n, a) {
- return d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/operation", e),
- data: {
- operation: n,
- destination: r
- }
- }, a), function(e, r) {
- return de(t)(e.taskID, r);
- });
- }, m = Math.random().toString(36).substring(7), y = "".concat(t.indexName, "_tmp_").concat(m), g = ee({
- appId: t.appId,
- transporter: t.transporter,
- indexName: y
- }), v = [], b = p(t.indexName, y, "copy", r(r({}, l), {}, {
- scope: [
- "settings",
- "synonyms",
- "rules"
- ]
- }));
- return v.push(b), d((s ? b.wait(l) : b).then(function() {
- var t = g(e, r(r({}, l), {}, {
- autoGenerateObjectIDIfNotExist: c,
- batchSize: f
- }));
- return v.push(t), s ? t.wait(l) : t;
- }).then(function() {
- var e = p(y, t.indexName, "move", l);
- return v.push(e), s ? e.wait(l) : e;
- }).then(function() {
- return Promise.all(v);
- }).then(function(t) {
- var e = a(t, 3), r = e[0], n = e[1], i = e[2];
- return {
- objectIDs: n.objectIDs,
- taskIDs: [
- r.taskID
- ].concat(o(n.taskIDs), [
- i.taskID
- ])
- };
- }), function(t, e) {
- return Promise.all(v.map(function(t) {
- return t.wait(e);
- }));
- });
- };
- }, Zt = function(t) {
- return function(e, n) {
- return ne(t)(e, r(r({}, n), {}, {
- clearExistingRules: !0
- }));
- };
- }, $t = function(t) {
- return function(e, n) {
- return oe(t)(e, r(r({}, n), {}, {
- clearExistingSynonyms: !0
- }));
- };
- }, te = function(t) {
- return function(e, r) {
- return d(ee(t)([
- e
- ], r).then(function(t) {
- return {
- objectID: t.objectIDs[0],
- taskID: t.taskIDs[0]
- };
- }), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, ee = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.autoGenerateObjectIDIfNotExist, i = n(a, [
- "autoGenerateObjectIDIfNotExist"
- ]), u = o ? le.AddObject : le.UpdateObject;
- if (u === le.UpdateObject) {
- var s = !0, c = !1, f = void 0;
- try {
- for(var l, p = e[Symbol.iterator](); !(s = (l = p.next()).done); s = !0){
- if (void 0 === l.value.objectID) return d(Promise.reject({
- name: "MissingObjectIDError",
- message: "All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."
- }));
- }
- } catch (t) {
- c = !0, f = t;
- } finally{
- try {
- s || null == p.return || p.return();
- } finally{
- if (c) throw f;
- }
- }
- }
- return Tt(t)(e, u, i);
- };
- }, re = function(t) {
- return function(e, r) {
- return ne(t)([
- e
- ], r);
- };
- }, ne = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.forwardToReplicas, i = a.clearExistingRules, u = y(n(a, [
- "forwardToReplicas",
- "clearExistingRules"
- ]));
- return o && (u.queryParameters.forwardToReplicas = 1), i && (u.queryParameters.clearExistingRules = 1), d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/rules/batch", t.indexName),
- data: e
- }, u), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, ae = function(t) {
- return function(e, r) {
- return oe(t)([
- e
- ], r);
- };
- }, oe = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.forwardToReplicas, i = a.clearExistingSynonyms, u = a.replaceExistingSynonyms, s = y(n(a, [
- "forwardToReplicas",
- "clearExistingSynonyms",
- "replaceExistingSynonyms"
- ]));
- return o && (s.queryParameters.forwardToReplicas = 1), (u || i) && (s.queryParameters.replaceExistingSynonyms = 1), d(t.transporter.write({
- method: x,
- path: h("1/indexes/%s/synonyms/batch", t.indexName),
- data: e
- }, s), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, ie = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: x,
- path: h("1/indexes/%s/query", t.indexName),
- data: {
- query: e
- },
- cacheable: !0
- }, r);
- };
- }, ue = function(t) {
- return function(e, r, n) {
- return t.transporter.read({
- method: x,
- path: h("1/indexes/%s/facets/%s/query", t.indexName, e),
- data: {
- facetQuery: r
- },
- cacheable: !0
- }, n);
- };
- }, se = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: x,
- path: h("1/indexes/%s/rules/search", t.indexName),
- data: {
- query: e
- }
- }, r);
- };
- }, ce = function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: x,
- path: h("1/indexes/%s/synonyms/search", t.indexName),
- data: {
- query: e
- }
- }, r);
- };
- }, fe = function(t) {
- return function(e, r) {
- var a = r || {}, o = a.forwardToReplicas, i = y(n(a, [
- "forwardToReplicas"
- ]));
- return o && (i.queryParameters.forwardToReplicas = 1), d(t.transporter.write({
- method: D,
- path: h("1/indexes/%s/settings", t.indexName),
- data: e
- }, i), function(e, r) {
- return de(t)(e.taskID, r);
- });
- };
- }, de = function(t) {
- return function(e, r) {
- return f(function(n) {
- return (function(t) {
- return function(e, r) {
- return t.transporter.read({
- method: j,
- path: h("1/indexes/%s/task/%s", t.indexName, e.toString())
- }, r);
- };
- })(t)(e, r).then(function(t) {
- return "published" !== t.status ? n() : void 0;
- });
- });
- };
- }, le = {
- AddObject: "addObject",
- UpdateObject: "updateObject",
- PartialUpdateObject: "partialUpdateObject",
- PartialUpdateObjectNoCreate: "partialUpdateObjectNoCreate",
- DeleteObject: "deleteObject",
- DeleteIndex: "delete",
- ClearIndex: "clear"
- }, pe = {
- Settings: "settings",
- Synonyms: "synonyms",
- Rules: "rules"
- }, he = 1, me = 2, ye = 3;
- function ge(t, e, n) {
- var a, o = {
- appId: t,
- apiKey: e,
- timeouts: {
- connect: 1,
- read: 2,
- write: 30
- },
- requester: {
- send: function(t) {
- return new Promise(function(e) {
- var r = new XMLHttpRequest;
- r.open(t.method, t.url, !0), Object.keys(t.headers).forEach(function(e) {
- return r.setRequestHeader(e, t.headers[e]);
- });
- var n, a = function(t, n) {
- return setTimeout(function() {
- r.abort(), e({
- status: 0,
- content: n,
- isTimedOut: !0
- });
- }, 1e3 * t);
- }, o = a(t.connectTimeout, "Connection timeout");
- r.onreadystatechange = function() {
- r.readyState > r.OPENED && void 0 === n && (clearTimeout(o), n = a(t.responseTimeout, "Socket timeout"));
- }, r.onerror = function() {
- 0 === r.status && (clearTimeout(o), clearTimeout(n), e({
- content: r.responseText || "Network request failed",
- status: r.status,
- isTimedOut: !1
- }));
- }, r.onload = function() {
- clearTimeout(o), clearTimeout(n), e({
- content: r.responseText,
- status: r.status,
- isTimedOut: !1
- });
- }, r.send(t.data);
- });
- }
- },
- logger: (a = ye, {
- debug: function(t, e) {
- return he >= a && console.debug(t, e), Promise.resolve();
- },
- info: function(t, e) {
- return me >= a && console.info(t, e), Promise.resolve();
- },
- error: function(t, e) {
- return console.error(t, e), Promise.resolve();
- }
- }),
- responsesCache: s(),
- requestsCache: s({
- serializable: !1
- }),
- hostsCache: u({
- caches: [
- i({
- key: "".concat("4.20.0", "-").concat(t)
- }),
- s()
- ]
- }),
- userAgent: T("4.20.0").add({
- segment: "Browser"
- })
- }, f = r(r({}, o), n), d = function() {
- return function(t) {
- return function(t) {
- var e = t.region || "us", n = c(m.WithinHeaders, t.appId, t.apiKey), a = k(r(r({
- hosts: [
- {
- url: "personalization.".concat(e, ".algolia.com")
- }
- ]
- }, t), {}, {
- headers: r(r(r({}, n.headers()), {
- "content-type": "application/json"
- }), t.headers),
- queryParameters: r(r({}, n.queryParameters()), t.queryParameters)
- }));
- return p({
- appId: t.appId,
- transporter: a
- }, t.methods);
- }(r(r(r({}, o), t), {}, {
- methods: {
- getPersonalizationStrategy: H,
- setPersonalizationStrategy: M
- }
- }));
- };
- };
- return function(t) {
- var e = t.appId, n = c(void 0 !== t.authMode ? t.authMode : m.WithinHeaders, e, t.apiKey), a = k(r(r({
- hosts: [
- {
- url: "".concat(e, "-dsn.algolia.net"),
- accept: g.Read
- },
- {
- url: "".concat(e, ".algolia.net"),
- accept: g.Write
- }
- ].concat(l([
- {
- url: "".concat(e, "-1.algolianet.com")
- },
- {
- url: "".concat(e, "-2.algolianet.com")
- },
- {
- url: "".concat(e, "-3.algolianet.com")
- }
- ]))
- }, t), {}, {
- headers: r(r(r({}, n.headers()), {
- "content-type": "application/x-www-form-urlencoded"
- }), t.headers),
- queryParameters: r(r({}, n.queryParameters()), t.queryParameters)
- }));
- return p({
- transporter: a,
- appId: e,
- addAlgoliaAgent: function(t, e) {
- a.userAgent.add({
- segment: t,
- version: e
- });
- },
- clearCache: function() {
- return Promise.all([
- a.requestsCache.clear(),
- a.responsesCache.clear()
- ]).then(function() {});
- }
- }, t.methods);
- }(r(r({}, f), {}, {
- methods: {
- search: mt,
- searchForFacetValues: yt,
- multipleBatch: pt,
- multipleGetObjects: ht,
- multipleQueries: mt,
- copyIndex: L,
- copySettings: _,
- copySynonyms: X,
- copyRules: V,
- moveIndex: lt,
- listIndices: ft,
- getLogs: nt,
- listClusters: ct,
- multipleSearchForFacetValues: yt,
- getApiKey: tt,
- addApiKey: W,
- listApiKeys: st,
- updateApiKey: jt,
- deleteApiKey: Z,
- restoreApiKey: bt,
- assignUserID: B,
- assignUserIDs: Q,
- getUserID: ot,
- searchUserIDs: wt,
- listUserIDs: dt,
- getTopUserIDs: at,
- removeUserID: gt,
- hasPendingMappings: it,
- clearDictionaryEntries: G,
- deleteDictionaryEntries: $,
- getDictionarySettings: rt,
- getAppTask: et,
- replaceDictionaryEntries: vt,
- saveDictionaryEntries: Ot,
- searchDictionaryEntries: Pt,
- setDictionarySettings: It,
- waitAppTask: xt,
- customRequest: Y,
- initIndex: function(t) {
- return function(e) {
- return ut(t)(e, {
- methods: {
- batch: Dt,
- delete: Ct,
- findAnswers: Mt,
- getObject: Wt,
- getObjects: Qt,
- saveObject: te,
- saveObjects: ee,
- search: ie,
- searchForFacetValues: ue,
- waitTask: de,
- setSettings: fe,
- getSettings: Lt,
- partialUpdateObject: _t,
- partialUpdateObjects: Xt,
- deleteObject: Ut,
- deleteObjects: zt,
- deleteBy: At,
- clearObjects: Nt,
- browseObjects: qt,
- getObjectPosition: Bt,
- findObject: Kt,
- exists: Ht,
- saveSynonym: ae,
- saveSynonyms: oe,
- getSynonym: Vt,
- searchSynonyms: ce,
- browseSynonyms: kt,
- deleteSynonym: Ft,
- clearSynonyms: Rt,
- replaceAllObjects: Yt,
- replaceAllSynonyms: $t,
- searchRules: se,
- getRule: Gt,
- deleteRule: Jt,
- saveRule: re,
- saveRules: ne,
- replaceAllRules: Zt,
- browseRules: St,
- clearRules: Et
- }
- });
- };
- },
- initAnalytics: function() {
- return function(t) {
- return function(t) {
- var e = t.region || "us", n = c(m.WithinHeaders, t.appId, t.apiKey), a = k(r(r({
- hosts: [
- {
- url: "analytics.".concat(e, ".algolia.com")
- }
- ]
- }, t), {}, {
- headers: r(r(r({}, n.headers()), {
- "content-type": "application/json"
- }), t.headers),
- queryParameters: r(r({}, n.queryParameters()), t.queryParameters)
- }));
- return p({
- appId: t.appId,
- transporter: a
- }, t.methods);
- }(r(r(r({}, o), t), {}, {
- methods: {
- addABTest: C,
- getABTest: z,
- getABTests: J,
- stopABTest: F,
- deleteABTest: U
- }
- }));
- };
- },
- initPersonalization: d,
- initRecommendation: function() {
- return function(t) {
- return f.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."), d()(t);
- };
- }
- }
- }));
- }
- return ge.version = "4.20.0", ge;
-});
-
-});
-
-
-parcelRegister("6mM2u", function(module, exports) {
-
-$parcel$export(module.exports, "APIConfig", () => $25308c93eeebc03a$export$895241a9bcb8bb6);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $cjHgJ = parcelRequire("cjHgJ");
-
-var $fGSV5 = parcelRequire("fGSV5");
-const $25308c93eeebc03a$export$895241a9bcb8bb6 = ({ close: close, checkApi: checkApi, status: status })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- mode: "",
- creating: false
- });
- if (p.site.api_prasi.db === "" && p.site.api_prasi.port === "" && p.site.api_url) local.mode = "external";
- if (p.site.api_prasi.db !== "" && p.site.api_prasi.port !== "" && p.site.api_url) local.mode = "internal";
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-col py-2 space-y-2 min-w-[350px] min-h-[60px] items-center justify-center",
- children: [
- local.mode === "" && !local.creating && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border-2 border-slate-500 text-blue-5 px-2 py-1 rounded cursor-pointer hover:bg-blue-100 hover:border-blue-500",
- onClick: ()=>{
- local.mode = "external";
- local.render();
- },
- children: "Use Existing API Server"
- })
- }),
- local.creating && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-1 self-stretch",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "api-conf",
- backdrop: false
- })
- }),
- local.mode === "external" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $cjHgJ.ExternalAPI), {
- status: status,
- checkApi: checkApi
- }),
- local.mode === "internal" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $fGSV5.InternalAPI), {
- checkApi: checkApi,
- close: close
- })
- ]
- });
-};
-
-});
-parcelRegister("cjHgJ", function(module, exports) {
-
-$parcel$export(module.exports, "ExternalAPI", () => $31e092bf2549ad7c$export$e33ed1229b2343e5);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $iFjR9 = parcelRequire("iFjR9");
-
-var $3xp7a = parcelRequire("3xp7a");
-
-var $isbAn = parcelRequire("isbAn");
-const $31e092bf2549ad7c$export$e33ed1229b2343e5 = ({ status: status, checkApi: checkApi })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const site = p.site;
- if (!site) return null;
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-col flex-1 items-stretch space-y-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "API URL:"
- }),
- status === "starting" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-blue-600",
- children: "Checking..."
- }),
- status === "started" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-green-600",
- children: "Saved"
- }),
- status === "stopped" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-red-600",
- children: "Invalid Server"
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- type: "text",
- autoFocus: true,
- className: cx("p-1 border min-w-[350px] font-mono text-[11px]", (0, $3xp7a.w).externalAPI.mode === "prod" ? "border-blue-700 bg-blue-50" : ""),
- disabled: status === "starting",
- defaultValue: (0, $3xp7a.w).externalAPI.prodUrl || "",
- onInput: (e)=>{
- const val = e.currentTarget.value;
- (0, $3xp7a.w).externalAPI.prodUrl = val;
- p.site.api_url = val;
- localStorage.setItem(`prasi-ext-prod-url-${p.site.id}`, val);
- p.render();
- },
- onKeyDown: (e)=>{
- if (e.key === "Enter") e.currentTarget.blur();
- },
- onBlur: async ()=>{
- await db.site.update({
- where: {
- id: p.site.id
- },
- data: {
- config: {
- api_url: (0, $3xp7a.w).externalAPI.prodUrl
- }
- }
- });
- const site = JSON.parse(localStorage.getItem(`prasi-site-${p.site.id}`) || "null");
- site.config.api_url = (0, $3xp7a.w).externalAPI.prodUrl;
- localStorage.setItem(`prasi-site-${p.site.id}`, JSON.stringify(site));
- checkApi();
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("flex items-stretch h-[30px] border", (0, $3xp7a.w).externalAPI.mode === "dev" ? "border-green-700 bg-green-50" : ""),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("border cursor-pointer m-1 flex items-center px-2 space-x-1 w-[70px] justify-center", (0, $3xp7a.w).externalAPI.mode === "prod" ? "hover:bg-green-50 hover:border-green-700 hover:text-green-700 text-slate-500 " : "bg-green-700 text-white border-green-700"),
- onClick: async ()=>{
- (0, $3xp7a.w).externalAPI.mode = (0, $3xp7a.w).externalAPI.mode === "dev" ? "prod" : "dev";
- localStorage.setItem(`prasi-ext-api-mode-${p.site.id}`, (0, $3xp7a.w).externalAPI.mode);
- if ((0, $3xp7a.w).externalAPI.mode === "dev") {
- p.site.api_url = (0, $3xp7a.w).externalAPI.devUrl;
- checkApi();
- await (0, $isbAn.reloadDBAPI)((0, $3xp7a.w).externalAPI.devUrl, "dev");
- } else {
- p.site.api_url = (0, $3xp7a.w).externalAPI.prodUrl;
- checkApi();
- await (0, $isbAn.reloadDBAPI)((0, $3xp7a.w).externalAPI.prodUrl, "dev");
- }
- },
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- children: "DEV"
- }),
- " ",
- (0, $3xp7a.w).externalAPI.mode === "dev" && /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "text-white",
- children: "ON"
- }),
- (0, $3xp7a.w).externalAPI.mode === "prod" && /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "text-slate-300",
- children: "OFF"
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("input", {
- type: "text",
- className: "px-1 m-1 border flex-1 font-mono text-[11px]",
- disabled: status === "starting",
- value: (0, $3xp7a.w).externalAPI.devUrl,
- onInput: (e)=>{
- if ((0, $3xp7a.w).externalAPI.mode === "dev") {
- (0, $3xp7a.w).externalAPI.mode = "prod";
- localStorage.setItem(`prasi-ext-api-mode-${p.site.id}`, (0, $3xp7a.w).externalAPI.mode);
- }
- const val = e.currentTarget.value;
- (0, $3xp7a.w).externalAPI.devUrl = val;
- localStorage.setItem(`prasi-ext-dev-url-${p.site.id}`, val);
- p.render();
- },
- onKeyDown: (e)=>{
- if (e.key === "Enter") e.currentTarget.blur();
- },
- onBlur: ()=>{
- checkApi();
- }
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $iFjR9.ExternalDeploy), {})
- ]
- });
-};
-
-});
-parcelRegister("iFjR9", function(module, exports) {
-
-$parcel$export(module.exports, "ExternalDeploy", () => $ab5cbea0edd59e3d$export$f5e2a98d4f6230d3);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $isbAn = parcelRequire("isbAn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $aFghw = parcelRequire("aFghw");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $dNzBT = parcelRequire("dNzBT");
-
-var $fRIDq = parcelRequire("fRIDq");
-
-var $dCfz4 = parcelRequire("dCfz4");
-const $ab5cbea0edd59e3d$var$server = {
- status: "ready"
-};
-const $ab5cbea0edd59e3d$var$DefaultLocal = {
- api: null,
- db: {
- url: ""
- },
- domains: [],
- current: 0,
- now: 0,
- deploys: []
-};
-const $ab5cbea0edd59e3d$export$f5e2a98d4f6230d3 = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)(structuredClone($ab5cbea0edd59e3d$var$DefaultLocal));
- (0, $63SH6.useEffect)(()=>{
- (async ()=>{
- const newlocal = structuredClone($ab5cbea0edd59e3d$var$DefaultLocal);
- for (const [k, v] of Object.entries(newlocal))local[k] = v;
- local.render();
- try {
- local.api = (0, $isbAn.createAPI)(p.site.api_url);
- let res = await local.api._deploy({
- type: "check",
- id_site: p.site.id
- });
- if (res) {
- local.db.url = res.db.url;
- local.now = res.now;
- local.current = res.current;
- local.domains = res.domains;
- local.deploys = res.deploys;
- }
- } catch (e) {}
- local.render();
- })();
- }, [
- p.site.api_url
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("flex flex-col items-stretch -mx-2", css`
- margin-bottom: -10px !important;
-
- .boxed {
- position: relative;
- }
- .boxed:hover {
- &::before {
- position: absolute;
- content: " ";
- top: 0px;
- left: 0px;
- bottom: 0px;
- border-left: 4px solid #3c82f6;
- }
- }
- `),
- children: local.db.url && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)($ab5cbea0edd59e3d$var$ExternalDeployDB, {
- api: local.api,
- url: local.db.url
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)($ab5cbea0edd59e3d$var$ExternalDomainList, {
- api: local.api,
- domains: local.domains
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)($ab5cbea0edd59e3d$var$ExternalDeployList, {
- api: local.api,
- local: local
- })
- ]
- })
- });
-};
-const $ab5cbea0edd59e3d$var$ExternalDeployDB = ({ url: url, api: api })=>{
- const local = (0, $4WfNn.useLocal)({
- url: url
- });
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- (0, $63SH6.useEffect)(()=>{
- local.url = url;
- local.render();
- }, [
- url
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex border-y mt-1 py-2 px-2 border-slate-300 boxed flex flex-col items-stretch",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $aFghw.AutoHeightTextarea), {
- value: local.url,
- className: "text-[12px] border p-2 mb-2 ",
- onChange: (e)=>{
- local.url = e.currentTarget.value;
- local.render();
- },
- onBlur: async ()=>{
- $ab5cbea0edd59e3d$var$server.status = "saving";
- local.render();
- await api._deploy({
- type: "db-update",
- id_site: p.site.id,
- url: local.url
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- local.render();
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-col items-stretch justify-center h-[20px]",
- children: $ab5cbea0edd59e3d$var$server.status === "saving" || $ab5cbea0edd59e3d$var$server.status === "deploying" ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex justify-between",
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "px-2 text-[12px] text-blue-500 capitalize",
- children: [
- $ab5cbea0edd59e3d$var$server.status,
- "..."
- ]
- })
- }) : /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- children: [
- $ab5cbea0edd59e3d$var$server.status !== "pulling" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border rounded-sm px-2 text-[12px] hover:bg-blue-100 cursor-pointer",
- onClick: async ()=>{
- $ab5cbea0edd59e3d$var$server.status = "pulling";
- local.render();
- await api._deploy({
- type: "db-pull",
- id_site: p.site.id
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- local.render();
- alert("DB PULL & GENERATE: OK\nRESTART: OK");
- },
- children: "DB Pull"
- }),
- $ab5cbea0edd59e3d$var$server.status === "pulling" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "px-2 text-[12px] text-blue-500",
- children: "Pulling DB..."
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- children: [
- $ab5cbea0edd59e3d$var$server.status !== "restarting" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border rounded-sm px-2 text-[12px] hover:bg-blue-100 cursor-pointer",
- onClick: async ()=>{
- $ab5cbea0edd59e3d$var$server.status = "restarting";
- local.render();
- await api._deploy({
- type: "restart",
- id_site: p.site.id
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- local.render();
- alert("RESTART: OK");
- },
- children: "Restart Server"
- }),
- $ab5cbea0edd59e3d$var$server.status === "restarting" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "px-2 text-[12px] text-blue-500",
- children: "Restarting..."
- })
- ]
- })
- ]
- })
- })
- ]
- });
-};
-const $ab5cbea0edd59e3d$var$ExternalDomainList = ({ api: api, domains: domains })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex border-b py-2 px-2 border-slate-300 boxed flex items-center space-x-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "Domains:"
- }),
- domains.map((e)=>{
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "border flex items-stretch",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("a", {
- className: "border-r flex items-center px-1 hover:underline hover:text-blue-500",
- href: e,
- target: "_blank",
- children: e
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex items-center px-1 cursor-pointer hover:bg-red-500 hover:text-white text-red-500",
- onClick: async ()=>{
- if (confirm("Remove this domain ?")) {
- $ab5cbea0edd59e3d$var$server.status = "saving";
- p.render();
- await api._deploy({
- type: "domain-del",
- id_site: p.site.id,
- domain: e
- });
- const idx = domains.indexOf(e);
- domains.splice(idx, 1);
- $ab5cbea0edd59e3d$var$server.status = "ready";
- p.render();
- }
- },
- children: "\xd7"
- })
- ]
- }, e);
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "px-1 border cursor-pointer hover:bg-blue-100",
- onClick: async ()=>{
- const name = (0, (/*@__PURE__*/$parcel$interopDefault($dNzBT)))(prompt("New Domain (include https://)", `https://`) || "", "/ ");
- if (name) {
- $ab5cbea0edd59e3d$var$server.status = "saving";
- p.render();
- await api._deploy({
- type: "domain-add",
- id_site: p.site.id,
- domain: name
- });
- domains.push(name);
- $ab5cbea0edd59e3d$var$server.status = "ready";
- p.render();
- }
- },
- children: "+ New"
- })
- ]
- });
-};
-const $ab5cbea0edd59e3d$var$ExternalDeployList = ({ api: api, local: local })=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const { deploys: deploys } = local;
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex border-slate-200 boxed flex flex-col items-stretch",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between py-2 px-2 ",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: "History:"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("px-1 border border-blue-500 text-blue-500 cursor-pointer hover:bg-blue-500 hover:text-white", $ab5cbea0edd59e3d$var$server.status === "deploying" && "opacity-50"),
- onClick: async ()=>{
- if ($ab5cbea0edd59e3d$var$server.status !== "deploying") {
- $ab5cbea0edd59e3d$var$server.status = "deploying";
- p.render();
- const res = await api._deploy({
- type: "deploy",
- id_site: p.site.id,
- dlurl: `${serverurl}/site-export/${p.site.id}`
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- p.render();
- if (res && res.current && Array.isArray(res.deploys)) {
- local.current = res.current;
- local.deploys = res.deploys;
- alert("DEPLOY: OK");
- } else alert("DEPLOY: FAILED");
- }
- },
- children: $ab5cbea0edd59e3d$var$server.status === "deploying" ? "Deploying..." : "Deploy"
- })
- ]
- }),
- deploys.length === 0 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex items-center justify-center pb-4",
- children: "No Deployment"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "overflow-auto h-[200px] relative border-t",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "absolute inset-0",
- children: deploys.sort().reverse().map((e)=>{
- let ago = "";
- let date = "";
- try {
- date = (0, $dCfz4.default)(e, "yyyy-MM-dd HH:mm:ss");
- ago = (0, $fRIDq.default)(e, local.now, {
- addSuffix: true
- });
- } catch (e) {}
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- onClick: async ()=>{
- if (local.current === e) return;
- if ($ab5cbea0edd59e3d$var$server.status !== "deploying" && $ab5cbea0edd59e3d$var$server.status !== "saving") {
- $ab5cbea0edd59e3d$var$server.status = "deploying";
- p.render();
- const res = await api._deploy({
- type: "redeploy",
- id_site: p.site.id,
- ts: e
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- p.render();
- if (res && res.current && Array.isArray(res.deploys)) {
- local.current = res.current;
- local.deploys = res.deploys;
- } else alert("DEPLOY: FAILED");
- }
- },
- className: cx("pr-4 pl-1 py-1 hover:bg-blue-50 border-b flex justify-between items-center h-[30px] font-mono text-[10px]", local.current === e ? "bg-green-50 border-l-4 border-l-green-700" : "border-l-4 border-l-transparent", $ab5cbea0edd59e3d$var$server.status !== "deploying" && $ab5cbea0edd59e3d$var$server.status !== "saving" && local.current !== e ? "cursor-pointer" : "", css`
- &:hover {
- .deploy {
- display: flex;
- }
- }
- `),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "",
- children: [
- date,
- " \xb7 ",
- ago
- ]
- }),
- local.current !== e && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-slate-400 hidden deploy",
- children: "Redeploy"
- }),
- local.current === e ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-green-800",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M11.467 3.727c.289.189.37.576.181.865l-4.25 6.5a.625.625 0 01-.944.12l-2.75-2.5a.625.625 0 01.841-.925l2.208 2.007 3.849-5.886a.625.625 0 01.865-.181z",
- clipRule: "evenodd"
- })
- })
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "text-red-700 hidden deploy px-3 rounded-md hover:bg-red-100 -my-1 py-1 -mr-3 ",
- onClick: async (evt)=>{
- evt.stopPropagation();
- evt.preventDefault();
- if (!confirm("Delete this deploy ?")) return;
- $ab5cbea0edd59e3d$var$server.status = "deploying";
- p.render();
- const res = await api._deploy({
- type: "deploy-del",
- id_site: p.site.id,
- ts: e
- });
- $ab5cbea0edd59e3d$var$server.status = "ready";
- p.render();
- if (res && res.current && Array.isArray(res.deploys)) {
- local.current = res.current;
- local.deploys = res.deploys;
- } else alert("DELETE: FAILED");
- },
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M5.5 1a.5.5 0 000 1h4a.5.5 0 000-1h-4zM3 3.5a.5.5 0 01.5-.5h8a.5.5 0 010 1H11v8a1 1 0 01-1 1H5a1 1 0 01-1-1V4h-.5a.5.5 0 01-.5-.5zM5 4h5v8H5V4z",
- clipRule: "evenodd"
- })
- })
- })
- ]
- }, e);
- })
- })
- })
- ]
- });
-};
-
-});
-parcelRegister("aFghw", function(module, exports) {
-
-$parcel$export(module.exports, "AutoHeightTextarea", () => $68bcce8edebf8216$export$def8fbe0eadc4343);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-function $68bcce8edebf8216$export$def8fbe0eadc4343({ minRows: minRows = 1, ...props }) {
- const ref = (0, $63SH6.useRef)(null);
- const calculateAndSetHeight = (0, $63SH6.useCallback)(()=>{
- if (!ref.current) return;
- const { borderBottomWidth: borderBottomWidth, borderTopWidth: borderTopWidth, boxSizing: boxSizing, lineHeight: lineHeight, paddingBottom: paddingBottom, paddingTop: paddingTop } = window.getComputedStyle(ref.current);
- ref.current.style.height = lineHeight; // set height temporarily to a single row to obtain scrollHeight, disregarding empty space after text (otherwise, scrollHeight would be equal to the height of the element) - this solves auto-shrinking of the textarea (it's not needed for auto-growing it)
- const { scrollHeight: scrollHeight } = ref.current; // scrollHeight = content height + padding top + padding bottom
- if (boxSizing === "border-box") {
- const minHeight = parseFloat(lineHeight) * minRows + parseFloat(paddingTop) + parseFloat(paddingBottom) + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth);
- const allTextHeight = scrollHeight + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth);
- ref.current.style.height = `${Math.max(minHeight, allTextHeight)}px`;
- } else if (boxSizing === "content-box") {
- const minHeight = parseFloat(lineHeight) * minRows;
- const allTextHeight = scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom);
- ref.current.style.height = `${Math.max(minHeight, allTextHeight)}px`;
- } else console.error("Unknown box-sizing value.");
- }, [
- minRows
- ]);
- (0, $63SH6.useEffect)(()=>{
- calculateAndSetHeight();
- }, [
- calculateAndSetHeight
- ]);
- const handleChange = (e)=>{
- calculateAndSetHeight();
- if (props.onChange) props.onChange(e);
- };
- calculateAndSetHeight();
- return /*#__PURE__*/ (0, $lAN3N.jsx)("textarea", {
- ...props,
- onChange: handleChange,
- ref: ref
- });
-}
-
-});
-
-parcelRegister("fRIDq", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $b8ce6dcb1a3a6880$export$2e2bcd8739ae039);
-
-var $bzIGi = parcelRequire("bzIGi");
-
-var $7GJjG = parcelRequire("7GJjG");
-
-var $ctkNf = parcelRequire("ctkNf");
-
-var $7xNX5 = parcelRequire("7xNX5");
-
-var $7x11M = parcelRequire("7x11M");
-
-var $9b910 = parcelRequire("9b910");
-
-var $f1M7l = parcelRequire("f1M7l");
-
-var $1dkI5 = parcelRequire("1dkI5");
-
-var $ipdTe = parcelRequire("ipdTe");
-
-var $k5qMt = parcelRequire("k5qMt");
-var $b8ce6dcb1a3a6880$var$MINUTES_IN_DAY = 1440;
-var $b8ce6dcb1a3a6880$var$MINUTES_IN_ALMOST_TWO_DAYS = 2520;
-var $b8ce6dcb1a3a6880$var$MINUTES_IN_MONTH = 43200;
-var $b8ce6dcb1a3a6880$var$MINUTES_IN_TWO_MONTHS = 86400;
-function $b8ce6dcb1a3a6880$export$2e2bcd8739ae039(dirtyDate, dirtyBaseDate, options) {
- var _ref, _options$locale;
- (0, $k5qMt.default)(2, arguments);
- var defaultOptions = (0, $bzIGi.getDefaultOptions)();
- var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : (0, $7x11M.default);
- if (!locale.formatDistance) throw new RangeError("locale must contain formatDistance property");
- var comparison = (0, $7GJjG.default)(dirtyDate, dirtyBaseDate);
- if (isNaN(comparison)) throw new RangeError("Invalid time value");
- var localizeOptions = (0, $1dkI5.default)((0, $f1M7l.default)(options), {
- addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
- comparison: comparison
- });
- var dateLeft;
- var dateRight;
- if (comparison > 0) {
- dateLeft = (0, $9b910.default)(dirtyBaseDate);
- dateRight = (0, $9b910.default)(dirtyDate);
- } else {
- dateLeft = (0, $9b910.default)(dirtyDate);
- dateRight = (0, $9b910.default)(dirtyBaseDate);
- }
- var seconds = (0, $7xNX5.default)(dateRight, dateLeft);
- var offsetInSeconds = ((0, $ipdTe.default)(dateRight) - (0, $ipdTe.default)(dateLeft)) / 1000;
- var minutes = Math.round((seconds - offsetInSeconds) / 60);
- var months;
- // 0 up to 2 mins
- if (minutes < 2) {
- if (options !== null && options !== void 0 && options.includeSeconds) {
- if (seconds < 5) return locale.formatDistance("lessThanXSeconds", 5, localizeOptions);
- else if (seconds < 10) return locale.formatDistance("lessThanXSeconds", 10, localizeOptions);
- else if (seconds < 20) return locale.formatDistance("lessThanXSeconds", 20, localizeOptions);
- else if (seconds < 40) return locale.formatDistance("halfAMinute", 0, localizeOptions);
- else if (seconds < 60) return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
- else return locale.formatDistance("xMinutes", 1, localizeOptions);
- } else {
- if (minutes === 0) return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
- else return locale.formatDistance("xMinutes", minutes, localizeOptions);
- }
- } else if (minutes < 45) return locale.formatDistance("xMinutes", minutes, localizeOptions);
- else if (minutes < 90) return locale.formatDistance("aboutXHours", 1, localizeOptions);
- else if (minutes < $b8ce6dcb1a3a6880$var$MINUTES_IN_DAY) {
- var hours = Math.round(minutes / 60);
- return locale.formatDistance("aboutXHours", hours, localizeOptions);
- // 1 day up to 1.75 days
- } else if (minutes < $b8ce6dcb1a3a6880$var$MINUTES_IN_ALMOST_TWO_DAYS) return locale.formatDistance("xDays", 1, localizeOptions);
- else if (minutes < $b8ce6dcb1a3a6880$var$MINUTES_IN_MONTH) {
- var days = Math.round(minutes / $b8ce6dcb1a3a6880$var$MINUTES_IN_DAY);
- return locale.formatDistance("xDays", days, localizeOptions);
- // 1 month up to 2 months
- } else if (minutes < $b8ce6dcb1a3a6880$var$MINUTES_IN_TWO_MONTHS) {
- months = Math.round(minutes / $b8ce6dcb1a3a6880$var$MINUTES_IN_MONTH);
- return locale.formatDistance("aboutXMonths", months, localizeOptions);
- }
- months = (0, $ctkNf.default)(dateRight, dateLeft);
- // 2 months up to 12 months
- if (months < 12) {
- var nearestMonth = Math.round(minutes / $b8ce6dcb1a3a6880$var$MINUTES_IN_MONTH);
- return locale.formatDistance("xMonths", nearestMonth, localizeOptions);
- // 1 year up to max Date
- } else {
- var monthsSinceStartOfYear = months % 12;
- var years = Math.floor(months / 12);
- // N years up to 1 years 3 months
- if (monthsSinceStartOfYear < 3) return locale.formatDistance("aboutXYears", years, localizeOptions);
- else if (monthsSinceStartOfYear < 9) return locale.formatDistance("overXYears", years, localizeOptions);
- else return locale.formatDistance("almostXYears", years + 1, localizeOptions);
- }
-}
-
-});
-parcelRegister("bzIGi", function(module, exports) {
-
-$parcel$export(module.exports, "getDefaultOptions", () => $86d59f5edd793475$export$430a3269e24b912e);
-var $86d59f5edd793475$var$defaultOptions = {};
-function $86d59f5edd793475$export$430a3269e24b912e() {
- return $86d59f5edd793475$var$defaultOptions;
-}
-function $86d59f5edd793475$export$95365be1b0704abc(newOptions) {
- $86d59f5edd793475$var$defaultOptions = newOptions;
-}
-
-});
-
-parcelRegister("7GJjG", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $598f9b948d78a5c2$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $598f9b948d78a5c2$export$2e2bcd8739ae039(dirtyDateLeft, dirtyDateRight) {
- (0, $k5qMt.default)(2, arguments);
- var dateLeft = (0, $9b910.default)(dirtyDateLeft);
- var dateRight = (0, $9b910.default)(dirtyDateRight);
- var diff = dateLeft.getTime() - dateRight.getTime();
- if (diff < 0) return -1;
- else if (diff > 0) return 1;
- else return diff;
-}
-
-});
-parcelRegister("9b910", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $6aec2259325e16de$export$2e2bcd8739ae039);
-
-var $cRE0B = parcelRequire("cRE0B");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $6aec2259325e16de$export$2e2bcd8739ae039(argument) {
- (0, $k5qMt.default)(1, arguments);
- var argStr = Object.prototype.toString.call(argument);
- // Clone the date
- if (argument instanceof Date || (0, $cRE0B.default)(argument) === "object" && argStr === "[object Date]") // Prevent the date to lose the milliseconds when passed to new Date() in IE10
- return new Date(argument.getTime());
- else if (typeof argument === "number" || argStr === "[object Number]") return new Date(argument);
- else {
- if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
- // eslint-disable-next-line no-console
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
- // eslint-disable-next-line no-console
- console.warn(new Error().stack);
- }
- return new Date(NaN);
- }
-}
-
-});
-parcelRegister("k5qMt", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $e9f90c6a7e408f71$export$2e2bcd8739ae039);
-function $e9f90c6a7e408f71$export$2e2bcd8739ae039(required, args) {
- if (args.length < required) throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
-}
-
-});
-
-
-
-parcelRegister("ctkNf", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $9148529b3631d0ac$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $229jn = parcelRequire("229jn");
-
-var $7GJjG = parcelRequire("7GJjG");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $1vL6o = parcelRequire("1vL6o");
-function $9148529b3631d0ac$export$2e2bcd8739ae039(dirtyDateLeft, dirtyDateRight) {
- (0, $k5qMt.default)(2, arguments);
- var dateLeft = (0, $9b910.default)(dirtyDateLeft);
- var dateRight = (0, $9b910.default)(dirtyDateRight);
- var sign = (0, $7GJjG.default)(dateLeft, dateRight);
- var difference = Math.abs((0, $229jn.default)(dateLeft, dateRight));
- var result;
- // Check for the difference of less than month
- if (difference < 1) result = 0;
- else {
- if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) // This will check if the date is end of Feb and assign a higher end of month date
- // to compare it with Jan
- dateLeft.setDate(30);
- dateLeft.setMonth(dateLeft.getMonth() - sign * difference);
- // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full
- // If so, result must be decreased by 1 in absolute value
- var isLastMonthNotFull = (0, $7GJjG.default)(dateLeft, dateRight) === -sign;
- // Check for cases of one full calendar month
- if ((0, $1vL6o.default)((0, $9b910.default)(dirtyDateLeft)) && difference === 1 && (0, $7GJjG.default)(dirtyDateLeft, dateRight) === 1) isLastMonthNotFull = false;
- result = sign * (difference - Number(isLastMonthNotFull));
- }
- // Prevent negative zero
- return result === 0 ? 0 : result;
-}
-
-});
-parcelRegister("229jn", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $17b2fdc07659e8b8$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $17b2fdc07659e8b8$export$2e2bcd8739ae039(dirtyDateLeft, dirtyDateRight) {
- (0, $k5qMt.default)(2, arguments);
- var dateLeft = (0, $9b910.default)(dirtyDateLeft);
- var dateRight = (0, $9b910.default)(dirtyDateRight);
- var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
- var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
- return yearDiff * 12 + monthDiff;
-}
-
-});
-
-parcelRegister("1vL6o", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $119d393279e36750$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $ltdkn = parcelRequire("ltdkn");
-
-var $lxiv6 = parcelRequire("lxiv6");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $119d393279e36750$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- return (0, $ltdkn.default)(date).getTime() === (0, $lxiv6.default)(date).getTime();
-}
-
-});
-parcelRegister("ltdkn", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $fa16a5069148ad84$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $fa16a5069148ad84$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- date.setHours(23, 59, 59, 999);
- return date;
-}
-
-});
-
-parcelRegister("lxiv6", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $fadb07e17035bdd8$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $fadb07e17035bdd8$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var month = date.getMonth();
- date.setFullYear(date.getFullYear(), month + 1, 0);
- date.setHours(23, 59, 59, 999);
- return date;
-}
-
-});
-
-
-
-parcelRegister("7xNX5", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $57e25ce5c37fea16$export$2e2bcd8739ae039);
-
-var $XfLCz = parcelRequire("XfLCz");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $8xQvw = parcelRequire("8xQvw");
-function $57e25ce5c37fea16$export$2e2bcd8739ae039(dateLeft, dateRight, options) {
- (0, $k5qMt.default)(2, arguments);
- var diff = (0, $XfLCz.default)(dateLeft, dateRight) / 1000;
- return (0, $8xQvw.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
-}
-
-});
-parcelRegister("XfLCz", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $0b21bdd137fc70e4$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $0b21bdd137fc70e4$export$2e2bcd8739ae039(dateLeft, dateRight) {
- (0, $k5qMt.default)(2, arguments);
- return (0, $9b910.default)(dateLeft).getTime() - (0, $9b910.default)(dateRight).getTime();
-}
-
-});
-
-parcelRegister("8xQvw", function(module, exports) {
-
-$parcel$export(module.exports, "getRoundingMethod", () => $638a22b2385d99a8$export$b6474a47258c1211);
-var $638a22b2385d99a8$var$roundingMap = {
- ceil: Math.ceil,
- round: Math.round,
- floor: Math.floor,
- trunc: function trunc(value) {
- return value < 0 ? Math.ceil(value) : Math.floor(value);
- } // Math.trunc is not supported by IE
-};
-var $638a22b2385d99a8$var$defaultRoundingMethod = "trunc";
-function $638a22b2385d99a8$export$b6474a47258c1211(method) {
- return method ? $638a22b2385d99a8$var$roundingMap[method] : $638a22b2385d99a8$var$roundingMap[$638a22b2385d99a8$var$defaultRoundingMethod];
-}
-
-});
-
-
-parcelRegister("7x11M", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $57bc698a729f9e9f$export$2e2bcd8739ae039);
-
-var $hWZzj = parcelRequire("hWZzj");
-var $57bc698a729f9e9f$export$2e2bcd8739ae039 = (0, $hWZzj.default);
-
-});
-parcelRegister("hWZzj", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $d1179caa59b9598a$export$2e2bcd8739ae039);
-
-var $lOK5t = parcelRequire("lOK5t");
-
-var $cdeN8 = parcelRequire("cdeN8");
-
-var $1FXYb = parcelRequire("1FXYb");
-
-var $gKwai = parcelRequire("gKwai");
-
-var $1HK7n = parcelRequire("1HK7n");
-/**
- * @type {Locale}
- * @category Locales
- * @summary English locale (United States).
- * @language English
- * @iso-639-2 eng
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
- */ var $d1179caa59b9598a$var$locale = {
- code: "en-US",
- formatDistance: (0, $lOK5t.default),
- formatLong: (0, $cdeN8.default),
- formatRelative: (0, $1FXYb.default),
- localize: (0, $gKwai.default),
- match: (0, $1HK7n.default),
- options: {
- weekStartsOn: 0 /* Sunday */ ,
- firstWeekContainsDate: 1
- }
-};
-var $d1179caa59b9598a$export$2e2bcd8739ae039 = $d1179caa59b9598a$var$locale;
-
-});
-parcelRegister("lOK5t", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $fe220477f8dc80be$export$2e2bcd8739ae039);
-var $fe220477f8dc80be$var$formatDistanceLocale = {
- lessThanXSeconds: {
- one: "less than a second",
- other: "less than {{count}} seconds"
- },
- xSeconds: {
- one: "1 second",
- other: "{{count}} seconds"
- },
- halfAMinute: "half a minute",
- lessThanXMinutes: {
- one: "less than a minute",
- other: "less than {{count}} minutes"
- },
- xMinutes: {
- one: "1 minute",
- other: "{{count}} minutes"
- },
- aboutXHours: {
- one: "about 1 hour",
- other: "about {{count}} hours"
- },
- xHours: {
- one: "1 hour",
- other: "{{count}} hours"
- },
- xDays: {
- one: "1 day",
- other: "{{count}} days"
- },
- aboutXWeeks: {
- one: "about 1 week",
- other: "about {{count}} weeks"
- },
- xWeeks: {
- one: "1 week",
- other: "{{count}} weeks"
- },
- aboutXMonths: {
- one: "about 1 month",
- other: "about {{count}} months"
- },
- xMonths: {
- one: "1 month",
- other: "{{count}} months"
- },
- aboutXYears: {
- one: "about 1 year",
- other: "about {{count}} years"
- },
- xYears: {
- one: "1 year",
- other: "{{count}} years"
- },
- overXYears: {
- one: "over 1 year",
- other: "over {{count}} years"
- },
- almostXYears: {
- one: "almost 1 year",
- other: "almost {{count}} years"
- }
-};
-var $fe220477f8dc80be$var$formatDistance = function formatDistance(token, count, options) {
- var result;
- var tokenValue = $fe220477f8dc80be$var$formatDistanceLocale[token];
- if (typeof tokenValue === "string") result = tokenValue;
- else if (count === 1) result = tokenValue.one;
- else result = tokenValue.other.replace("{{count}}", count.toString());
- if (options !== null && options !== void 0 && options.addSuffix) {
- if (options.comparison && options.comparison > 0) return "in " + result;
- else return result + " ago";
- }
- return result;
-};
-var $fe220477f8dc80be$export$2e2bcd8739ae039 = $fe220477f8dc80be$var$formatDistance;
-
-});
-
-parcelRegister("cdeN8", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $8e422c3776eba31f$export$2e2bcd8739ae039);
-
-var $2OfLF = parcelRequire("2OfLF");
-var $8e422c3776eba31f$var$dateFormats = {
- full: "EEEE, MMMM do, y",
- long: "MMMM do, y",
- medium: "MMM d, y",
- short: "MM/dd/yyyy"
-};
-var $8e422c3776eba31f$var$timeFormats = {
- full: "h:mm:ss a zzzz",
- long: "h:mm:ss a z",
- medium: "h:mm:ss a",
- short: "h:mm a"
-};
-var $8e422c3776eba31f$var$dateTimeFormats = {
- full: "{{date}} 'at' {{time}}",
- long: "{{date}} 'at' {{time}}",
- medium: "{{date}}, {{time}}",
- short: "{{date}}, {{time}}"
-};
-var $8e422c3776eba31f$var$formatLong = {
- date: (0, $2OfLF.default)({
- formats: $8e422c3776eba31f$var$dateFormats,
- defaultWidth: "full"
- }),
- time: (0, $2OfLF.default)({
- formats: $8e422c3776eba31f$var$timeFormats,
- defaultWidth: "full"
- }),
- dateTime: (0, $2OfLF.default)({
- formats: $8e422c3776eba31f$var$dateTimeFormats,
- defaultWidth: "full"
- })
-};
-var $8e422c3776eba31f$export$2e2bcd8739ae039 = $8e422c3776eba31f$var$formatLong;
-
-});
-parcelRegister("2OfLF", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $20bc7b6e7f8ceab4$export$2e2bcd8739ae039);
-function $20bc7b6e7f8ceab4$export$2e2bcd8739ae039(args) {
- return function() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- // TODO: Remove String()
- var width = options.width ? String(options.width) : args.defaultWidth;
- var format = args.formats[width] || args.formats[args.defaultWidth];
- return format;
- };
-}
-
-});
-
-
-parcelRegister("1FXYb", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $138823828850e51d$export$2e2bcd8739ae039);
-var $138823828850e51d$var$formatRelativeLocale = {
- lastWeek: "'last' eeee 'at' p",
- yesterday: "'yesterday at' p",
- today: "'today at' p",
- tomorrow: "'tomorrow at' p",
- nextWeek: "eeee 'at' p",
- other: "P"
-};
-var $138823828850e51d$var$formatRelative = function formatRelative(token, _date, _baseDate, _options) {
- return $138823828850e51d$var$formatRelativeLocale[token];
-};
-var $138823828850e51d$export$2e2bcd8739ae039 = $138823828850e51d$var$formatRelative;
-
-});
-
-parcelRegister("gKwai", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $03259433d6be0a40$export$2e2bcd8739ae039);
-
-var $3uX4A = parcelRequire("3uX4A");
-var $03259433d6be0a40$var$eraValues = {
- narrow: [
- "B",
- "A"
- ],
- abbreviated: [
- "BC",
- "AD"
- ],
- wide: [
- "Before Christ",
- "Anno Domini"
- ]
-};
-var $03259433d6be0a40$var$quarterValues = {
- narrow: [
- "1",
- "2",
- "3",
- "4"
- ],
- abbreviated: [
- "Q1",
- "Q2",
- "Q3",
- "Q4"
- ],
- wide: [
- "1st quarter",
- "2nd quarter",
- "3rd quarter",
- "4th quarter"
- ]
-};
-// Note: in English, the names of days of the week and months are capitalized.
-// If you are making a new locale based on this one, check if the same is true for the language you're working on.
-// Generally, formatted dates should look like they are in the middle of a sentence,
-// e.g. in Spanish language the weekdays and months should be in the lowercase.
-var $03259433d6be0a40$var$monthValues = {
- narrow: [
- "J",
- "F",
- "M",
- "A",
- "M",
- "J",
- "J",
- "A",
- "S",
- "O",
- "N",
- "D"
- ],
- abbreviated: [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
- ],
- wide: [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ]
-};
-var $03259433d6be0a40$var$dayValues = {
- narrow: [
- "S",
- "M",
- "T",
- "W",
- "T",
- "F",
- "S"
- ],
- short: [
- "Su",
- "Mo",
- "Tu",
- "We",
- "Th",
- "Fr",
- "Sa"
- ],
- abbreviated: [
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- ],
- wide: [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ]
-};
-var $03259433d6be0a40$var$dayPeriodValues = {
- narrow: {
- am: "a",
- pm: "p",
- midnight: "mi",
- noon: "n",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night"
- },
- abbreviated: {
- am: "AM",
- pm: "PM",
- midnight: "midnight",
- noon: "noon",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night"
- },
- wide: {
- am: "a.m.",
- pm: "p.m.",
- midnight: "midnight",
- noon: "noon",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night"
- }
-};
-var $03259433d6be0a40$var$formattingDayPeriodValues = {
- narrow: {
- am: "a",
- pm: "p",
- midnight: "mi",
- noon: "n",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night"
- },
- abbreviated: {
- am: "AM",
- pm: "PM",
- midnight: "midnight",
- noon: "noon",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night"
- },
- wide: {
- am: "a.m.",
- pm: "p.m.",
- midnight: "midnight",
- noon: "noon",
- morning: "in the morning",
- afternoon: "in the afternoon",
- evening: "in the evening",
- night: "at night"
- }
-};
-var $03259433d6be0a40$var$ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
- var number = Number(dirtyNumber);
- // If ordinal numbers depend on context, for example,
- // if they are different for different grammatical genders,
- // use `options.unit`.
- //
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
- // 'day', 'hour', 'minute', 'second'.
- var rem100 = number % 100;
- if (rem100 > 20 || rem100 < 10) switch(rem100 % 10){
- case 1:
- return number + "st";
- case 2:
- return number + "nd";
- case 3:
- return number + "rd";
- }
- return number + "th";
-};
-var $03259433d6be0a40$var$localize = {
- ordinalNumber: $03259433d6be0a40$var$ordinalNumber,
- era: (0, $3uX4A.default)({
- values: $03259433d6be0a40$var$eraValues,
- defaultWidth: "wide"
- }),
- quarter: (0, $3uX4A.default)({
- values: $03259433d6be0a40$var$quarterValues,
- defaultWidth: "wide",
- argumentCallback: function argumentCallback(quarter) {
- return quarter - 1;
- }
- }),
- month: (0, $3uX4A.default)({
- values: $03259433d6be0a40$var$monthValues,
- defaultWidth: "wide"
- }),
- day: (0, $3uX4A.default)({
- values: $03259433d6be0a40$var$dayValues,
- defaultWidth: "wide"
- }),
- dayPeriod: (0, $3uX4A.default)({
- values: $03259433d6be0a40$var$dayPeriodValues,
- defaultWidth: "wide",
- formattingValues: $03259433d6be0a40$var$formattingDayPeriodValues,
- defaultFormattingWidth: "wide"
- })
-};
-var $03259433d6be0a40$export$2e2bcd8739ae039 = $03259433d6be0a40$var$localize;
-
-});
-parcelRegister("3uX4A", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $28c1ff1df4aad026$export$2e2bcd8739ae039);
-function $28c1ff1df4aad026$export$2e2bcd8739ae039(args) {
- return function(dirtyIndex, options) {
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
- var valuesArray;
- if (context === "formatting" && args.formattingValues) {
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
- } else {
- var _defaultWidth = args.defaultWidth;
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
- valuesArray = args.values[_width] || args.values[_defaultWidth];
- }
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
- // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
- return valuesArray[index];
- };
-}
-
-});
-
-
-parcelRegister("1HK7n", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $13dd94a518b1e799$export$2e2bcd8739ae039);
-
-var $ds0Ew = parcelRequire("ds0Ew");
-
-var $iEiZm = parcelRequire("iEiZm");
-var $13dd94a518b1e799$var$matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
-var $13dd94a518b1e799$var$parseOrdinalNumberPattern = /\d+/i;
-var $13dd94a518b1e799$var$matchEraPatterns = {
- narrow: /^(b|a)/i,
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
- wide: /^(before christ|before common era|anno domini|common era)/i
-};
-var $13dd94a518b1e799$var$parseEraPatterns = {
- any: [
- /^b/i,
- /^(a|c)/i
- ]
-};
-var $13dd94a518b1e799$var$matchQuarterPatterns = {
- narrow: /^[1234]/i,
- abbreviated: /^q[1234]/i,
- wide: /^[1234](th|st|nd|rd)? quarter/i
-};
-var $13dd94a518b1e799$var$parseQuarterPatterns = {
- any: [
- /1/i,
- /2/i,
- /3/i,
- /4/i
- ]
-};
-var $13dd94a518b1e799$var$matchMonthPatterns = {
- narrow: /^[jfmasond]/i,
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
-};
-var $13dd94a518b1e799$var$parseMonthPatterns = {
- narrow: [
- /^j/i,
- /^f/i,
- /^m/i,
- /^a/i,
- /^m/i,
- /^j/i,
- /^j/i,
- /^a/i,
- /^s/i,
- /^o/i,
- /^n/i,
- /^d/i
- ],
- any: [
- /^ja/i,
- /^f/i,
- /^mar/i,
- /^ap/i,
- /^may/i,
- /^jun/i,
- /^jul/i,
- /^au/i,
- /^s/i,
- /^o/i,
- /^n/i,
- /^d/i
- ]
-};
-var $13dd94a518b1e799$var$matchDayPatterns = {
- narrow: /^[smtwf]/i,
- short: /^(su|mo|tu|we|th|fr|sa)/i,
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
-};
-var $13dd94a518b1e799$var$parseDayPatterns = {
- narrow: [
- /^s/i,
- /^m/i,
- /^t/i,
- /^w/i,
- /^t/i,
- /^f/i,
- /^s/i
- ],
- any: [
- /^su/i,
- /^m/i,
- /^tu/i,
- /^w/i,
- /^th/i,
- /^f/i,
- /^sa/i
- ]
-};
-var $13dd94a518b1e799$var$matchDayPeriodPatterns = {
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
-};
-var $13dd94a518b1e799$var$parseDayPeriodPatterns = {
- any: {
- am: /^a/i,
- pm: /^p/i,
- midnight: /^mi/i,
- noon: /^no/i,
- morning: /morning/i,
- afternoon: /afternoon/i,
- evening: /evening/i,
- night: /night/i
- }
-};
-var $13dd94a518b1e799$var$match = {
- ordinalNumber: (0, $iEiZm.default)({
- matchPattern: $13dd94a518b1e799$var$matchOrdinalNumberPattern,
- parsePattern: $13dd94a518b1e799$var$parseOrdinalNumberPattern,
- valueCallback: function valueCallback(value) {
- return parseInt(value, 10);
- }
- }),
- era: (0, $ds0Ew.default)({
- matchPatterns: $13dd94a518b1e799$var$matchEraPatterns,
- defaultMatchWidth: "wide",
- parsePatterns: $13dd94a518b1e799$var$parseEraPatterns,
- defaultParseWidth: "any"
- }),
- quarter: (0, $ds0Ew.default)({
- matchPatterns: $13dd94a518b1e799$var$matchQuarterPatterns,
- defaultMatchWidth: "wide",
- parsePatterns: $13dd94a518b1e799$var$parseQuarterPatterns,
- defaultParseWidth: "any",
- valueCallback: function valueCallback(index) {
- return index + 1;
- }
- }),
- month: (0, $ds0Ew.default)({
- matchPatterns: $13dd94a518b1e799$var$matchMonthPatterns,
- defaultMatchWidth: "wide",
- parsePatterns: $13dd94a518b1e799$var$parseMonthPatterns,
- defaultParseWidth: "any"
- }),
- day: (0, $ds0Ew.default)({
- matchPatterns: $13dd94a518b1e799$var$matchDayPatterns,
- defaultMatchWidth: "wide",
- parsePatterns: $13dd94a518b1e799$var$parseDayPatterns,
- defaultParseWidth: "any"
- }),
- dayPeriod: (0, $ds0Ew.default)({
- matchPatterns: $13dd94a518b1e799$var$matchDayPeriodPatterns,
- defaultMatchWidth: "any",
- parsePatterns: $13dd94a518b1e799$var$parseDayPeriodPatterns,
- defaultParseWidth: "any"
- })
-};
-var $13dd94a518b1e799$export$2e2bcd8739ae039 = $13dd94a518b1e799$var$match;
-
-});
-parcelRegister("ds0Ew", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $9cae6579d2dbbab5$export$2e2bcd8739ae039);
-function $9cae6579d2dbbab5$export$2e2bcd8739ae039(args) {
- return function(string) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var width = options.width;
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
- var matchResult = string.match(matchPattern);
- if (!matchResult) return null;
- var matchedString = matchResult[0];
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
- var key = Array.isArray(parsePatterns) ? $9cae6579d2dbbab5$var$findIndex(parsePatterns, function(pattern) {
- return pattern.test(matchedString);
- }) : $9cae6579d2dbbab5$var$findKey(parsePatterns, function(pattern) {
- return pattern.test(matchedString);
- });
- var value;
- value = args.valueCallback ? args.valueCallback(key) : key;
- value = options.valueCallback ? options.valueCallback(value) : value;
- var rest = string.slice(matchedString.length);
- return {
- value: value,
- rest: rest
- };
- };
-}
-function $9cae6579d2dbbab5$var$findKey(object, predicate) {
- for(var key in object){
- if (object.hasOwnProperty(key) && predicate(object[key])) return key;
- }
- return undefined;
-}
-function $9cae6579d2dbbab5$var$findIndex(array, predicate) {
- for(var key = 0; key < array.length; key++){
- if (predicate(array[key])) return key;
- }
- return undefined;
-}
-
-});
-
-parcelRegister("iEiZm", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $d93ab12cd94468f4$export$2e2bcd8739ae039);
-function $d93ab12cd94468f4$export$2e2bcd8739ae039(args) {
- return function(string) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var matchResult = string.match(args.matchPattern);
- if (!matchResult) return null;
- var matchedString = matchResult[0];
- var parseResult = string.match(args.parsePattern);
- if (!parseResult) return null;
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
- value = options.valueCallback ? options.valueCallback(value) : value;
- var rest = string.slice(matchedString.length);
- return {
- value: value,
- rest: rest
- };
- };
-}
-
-});
-
-
-
-
-parcelRegister("f1M7l", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $af0c4627320ba530$export$2e2bcd8739ae039);
-
-var $1dkI5 = parcelRequire("1dkI5");
-function $af0c4627320ba530$export$2e2bcd8739ae039(object) {
- return (0, $1dkI5.default)({}, object);
-}
-
-});
-parcelRegister("1dkI5", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $0e2711ef54b74712$export$2e2bcd8739ae039);
-function $0e2711ef54b74712$export$2e2bcd8739ae039(target, object) {
- if (target == null) throw new TypeError("assign requires that input parameter not be null or undefined");
- for(var property in object)if (Object.prototype.hasOwnProperty.call(object, property)) target[property] = object[property];
- return target;
-}
-
-});
-
-
-parcelRegister("ipdTe", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $d665560a48df6452$export$2e2bcd8739ae039);
-/**
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
- * They usually appear for dates that denote time before the timezones were introduced
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
- * and GMT+01:00:00 after that date)
- *
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
- * which would lead to incorrect calculations.
- *
- * This function returns the timezone offset in milliseconds that takes seconds in account.
- */ function $d665560a48df6452$export$2e2bcd8739ae039(date) {
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
- utcDate.setUTCFullYear(date.getFullYear());
- return date.getTime() - utcDate.getTime();
-}
-
-});
-
-
-parcelRegister("dCfz4", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $9e9ae5cde5c653ee$export$2e2bcd8739ae039);
-
-var $3swGm = parcelRequire("3swGm");
-
-var $eUi4e = parcelRequire("eUi4e");
-
-var $9b910 = parcelRequire("9b910");
-
-var $dZekR = parcelRequire("dZekR");
-
-var $3oAoR = parcelRequire("3oAoR");
-
-var $ipdTe = parcelRequire("ipdTe");
-
-var $b5PrA = parcelRequire("b5PrA");
-
-var $bc5Aj = parcelRequire("bc5Aj");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $bzIGi = parcelRequire("bzIGi");
-
-var $7x11M = parcelRequire("7x11M");
-// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
-// (one of the certain letters followed by `o`)
-// - (\w)\1* matches any sequences of the same letter
-// - '' matches two quote characters in a row
-// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
-// except a single quote symbol, which ends the sequence.
-// Two quote characters do not end the sequence.
-// If there is no matching single quote
-// then the sequence will continue until the end of the string.
-// - . matches any single character unmatched by previous parts of the RegExps
-var $9e9ae5cde5c653ee$var$formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
-// This RegExp catches symbols escaped by quotes, and also
-// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
-var $9e9ae5cde5c653ee$var$longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
-var $9e9ae5cde5c653ee$var$escapedStringRegExp = /^'([^]*?)'?$/;
-var $9e9ae5cde5c653ee$var$doubleQuoteRegExp = /''/g;
-var $9e9ae5cde5c653ee$var$unescapedLatinCharacterRegExp = /[a-zA-Z]/;
-function $9e9ae5cde5c653ee$export$2e2bcd8739ae039(dirtyDate, dirtyFormatStr, options) {
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
- (0, $k5qMt.default)(2, arguments);
- var formatStr = String(dirtyFormatStr);
- var defaultOptions = (0, $bzIGi.getDefaultOptions)();
- var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : (0, $7x11M.default);
- var firstWeekContainsDate = (0, $bc5Aj.default)((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
- var weekStartsOn = (0, $bc5Aj.default)((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
- if (!locale.localize) throw new RangeError("locale must contain localize property");
- if (!locale.formatLong) throw new RangeError("locale must contain formatLong property");
- var originalDate = (0, $9b910.default)(dirtyDate);
- if (!(0, $3swGm.default)(originalDate)) throw new RangeError("Invalid time value");
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
- // This ensures that when UTC functions will be implemented, locales will be compatible with them.
- // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
- var timezoneOffset = (0, $ipdTe.default)(originalDate);
- var utcDate = (0, $eUi4e.default)(originalDate, timezoneOffset);
- var formatterOptions = {
- firstWeekContainsDate: firstWeekContainsDate,
- weekStartsOn: weekStartsOn,
- locale: locale,
- _originalDate: originalDate
- };
- var result = formatStr.match($9e9ae5cde5c653ee$var$longFormattingTokensRegExp).map(function(substring) {
- var firstCharacter = substring[0];
- if (firstCharacter === "p" || firstCharacter === "P") {
- var longFormatter = (0, $3oAoR.default)[firstCharacter];
- return longFormatter(substring, locale.formatLong);
- }
- return substring;
- }).join("").match($9e9ae5cde5c653ee$var$formattingTokensRegExp).map(function(substring) {
- // Replace two single quote characters with one single quote character
- if (substring === "''") return "'";
- var firstCharacter = substring[0];
- if (firstCharacter === "'") return $9e9ae5cde5c653ee$var$cleanEscapedString(substring);
- var formatter = (0, $dZekR.default)[firstCharacter];
- if (formatter) {
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && (0, $b5PrA.isProtectedWeekYearToken)(substring)) (0, $b5PrA.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate));
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, $b5PrA.isProtectedDayOfYearToken)(substring)) (0, $b5PrA.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate));
- return formatter(utcDate, substring, locale.localize, formatterOptions);
- }
- if (firstCharacter.match($9e9ae5cde5c653ee$var$unescapedLatinCharacterRegExp)) throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
- return substring;
- }).join("");
- return result;
-}
-function $9e9ae5cde5c653ee$var$cleanEscapedString(input) {
- var matched = input.match($9e9ae5cde5c653ee$var$escapedStringRegExp);
- if (!matched) return input;
- return matched[1].replace($9e9ae5cde5c653ee$var$doubleQuoteRegExp, "'");
-}
-
-});
-parcelRegister("3swGm", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $284d56a793777552$export$2e2bcd8739ae039);
-
-var $bpEuo = parcelRequire("bpEuo");
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $284d56a793777552$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- if (!(0, $bpEuo.default)(dirtyDate) && typeof dirtyDate !== "number") return false;
- var date = (0, $9b910.default)(dirtyDate);
- return !isNaN(Number(date));
-}
-
-});
-parcelRegister("bpEuo", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $84f16fcfdf94ea32$export$2e2bcd8739ae039);
-
-var $cRE0B = parcelRequire("cRE0B");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $84f16fcfdf94ea32$export$2e2bcd8739ae039(value) {
- (0, $k5qMt.default)(1, arguments);
- return value instanceof Date || (0, $cRE0B.default)(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
-}
-
-});
-
-
-parcelRegister("eUi4e", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $ada44f71f0ca5356$export$2e2bcd8739ae039);
-
-var $48MNo = parcelRequire("48MNo");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $bc5Aj = parcelRequire("bc5Aj");
-function $ada44f71f0ca5356$export$2e2bcd8739ae039(dirtyDate, dirtyAmount) {
- (0, $k5qMt.default)(2, arguments);
- var amount = (0, $bc5Aj.default)(dirtyAmount);
- return (0, $48MNo.default)(dirtyDate, -amount);
-}
-
-});
-parcelRegister("48MNo", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $303dc29a761b2048$export$2e2bcd8739ae039);
-
-var $bc5Aj = parcelRequire("bc5Aj");
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $303dc29a761b2048$export$2e2bcd8739ae039(dirtyDate, dirtyAmount) {
- (0, $k5qMt.default)(2, arguments);
- var timestamp = (0, $9b910.default)(dirtyDate).getTime();
- var amount = (0, $bc5Aj.default)(dirtyAmount);
- return new Date(timestamp + amount);
-}
-
-});
-parcelRegister("bc5Aj", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $826525aea5249ddc$export$2e2bcd8739ae039);
-function $826525aea5249ddc$export$2e2bcd8739ae039(dirtyNumber) {
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) return NaN;
- var number = Number(dirtyNumber);
- if (isNaN(number)) return number;
- return number < 0 ? Math.ceil(number) : Math.floor(number);
-}
-
-});
-
-
-
-parcelRegister("dZekR", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $a2ec1796ce6ef2a0$export$2e2bcd8739ae039);
-
-var $adSi5 = parcelRequire("adSi5");
-
-var $gE8AU = parcelRequire("gE8AU");
-
-var $3WmpF = parcelRequire("3WmpF");
-
-var $kwqeF = parcelRequire("kwqeF");
-
-var $04uWM = parcelRequire("04uWM");
-
-var $1hDC1 = parcelRequire("1hDC1");
-
-var $gXPe6 = parcelRequire("gXPe6");
-var $a2ec1796ce6ef2a0$var$dayPeriodEnum = {
- am: "am",
- pm: "pm",
- midnight: "midnight",
- noon: "noon",
- morning: "morning",
- afternoon: "afternoon",
- evening: "evening",
- night: "night"
-};
-/*
- * | | Unit | | Unit |
- * |-----|--------------------------------|-----|--------------------------------|
- * | a | AM, PM | A* | Milliseconds in day |
- * | b | AM, PM, noon, midnight | B | Flexible day period |
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
- * | d | Day of month | D | Day of year |
- * | e | Local day of week | E | Day of week |
- * | f | | F* | Day of week in month |
- * | g* | Modified Julian day | G | Era |
- * | h | Hour [1-12] | H | Hour [0-23] |
- * | i! | ISO day of week | I! | ISO week of year |
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
- * | k | Hour [1-24] | K | Hour [0-11] |
- * | l* | (deprecated) | L | Stand-alone month |
- * | m | Minute | M | Month |
- * | n | | N | |
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
- * | p! | Long localized time | P! | Long localized date |
- * | q | Stand-alone quarter | Q | Quarter |
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
- * | s | Second | S | Fraction of second |
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
- * | u | Extended year | U* | Cyclic year |
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
- * | w | Local week of year | W* | Week of month |
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
- * | y | Year (abs) | Y | Local week-numbering year |
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
- *
- * Letters marked by * are not implemented but reserved by Unicode standard.
- *
- * Letters marked by ! are non-standard, but implemented by date-fns:
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
- * i.e. 7 for Sunday, 1 for Monday, etc.
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
- * `R` is supposed to be used in conjunction with `I` and `i`
- * for universal ISO week-numbering date, whereas
- * `Y` is supposed to be used in conjunction with `w` and `e`
- * for week-numbering date specific to the locale.
- * - `P` is long localized date format
- * - `p` is long localized time format
- */ var $a2ec1796ce6ef2a0$var$formatters = {
- // Era
- G: function G(date, token, localize) {
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
- switch(token){
- // AD, BC
- case "G":
- case "GG":
- case "GGG":
- return localize.era(era, {
- width: "abbreviated"
- });
- // A, B
- case "GGGGG":
- return localize.era(era, {
- width: "narrow"
- });
- // Anno Domini, Before Christ
- case "GGGG":
- default:
- return localize.era(era, {
- width: "wide"
- });
- }
- },
- // Year
- y: function y(date, token, localize) {
- // Ordinal number
- if (token === "yo") {
- var signedYear = date.getUTCFullYear();
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
- return localize.ordinalNumber(year, {
- unit: "year"
- });
- }
- return (0, $gXPe6.default).y(date, token);
- },
- // Local week-numbering year
- Y: function Y(date, token, localize, options) {
- var signedWeekYear = (0, $04uWM.default)(date, options);
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
- // Two digit year
- if (token === "YY") {
- var twoDigitYear = weekYear % 100;
- return (0, $1hDC1.default)(twoDigitYear, 2);
- }
- // Ordinal number
- if (token === "Yo") return localize.ordinalNumber(weekYear, {
- unit: "year"
- });
- // Padding
- return (0, $1hDC1.default)(weekYear, token.length);
- },
- // ISO week-numbering year
- R: function R(date, token) {
- var isoWeekYear = (0, $3WmpF.default)(date);
- // Padding
- return (0, $1hDC1.default)(isoWeekYear, token.length);
- },
- // Extended year. This is a single number designating the year of this calendar system.
- // The main difference between `y` and `u` localizers are B.C. years:
- // | Year | `y` | `u` |
- // |------|-----|-----|
- // | AC 1 | 1 | 1 |
- // | BC 1 | 1 | 0 |
- // | BC 2 | 2 | -1 |
- // Also `yy` always returns the last two digits of a year,
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
- u: function u(date, token) {
- var year = date.getUTCFullYear();
- return (0, $1hDC1.default)(year, token.length);
- },
- // Quarter
- Q: function Q(date, token, localize) {
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
- switch(token){
- // 1, 2, 3, 4
- case "Q":
- return String(quarter);
- // 01, 02, 03, 04
- case "QQ":
- return (0, $1hDC1.default)(quarter, 2);
- // 1st, 2nd, 3rd, 4th
- case "Qo":
- return localize.ordinalNumber(quarter, {
- unit: "quarter"
- });
- // Q1, Q2, Q3, Q4
- case "QQQ":
- return localize.quarter(quarter, {
- width: "abbreviated",
- context: "formatting"
- });
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
- case "QQQQQ":
- return localize.quarter(quarter, {
- width: "narrow",
- context: "formatting"
- });
- // 1st quarter, 2nd quarter, ...
- case "QQQQ":
- default:
- return localize.quarter(quarter, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // Stand-alone quarter
- q: function q(date, token, localize) {
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
- switch(token){
- // 1, 2, 3, 4
- case "q":
- return String(quarter);
- // 01, 02, 03, 04
- case "qq":
- return (0, $1hDC1.default)(quarter, 2);
- // 1st, 2nd, 3rd, 4th
- case "qo":
- return localize.ordinalNumber(quarter, {
- unit: "quarter"
- });
- // Q1, Q2, Q3, Q4
- case "qqq":
- return localize.quarter(quarter, {
- width: "abbreviated",
- context: "standalone"
- });
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
- case "qqqqq":
- return localize.quarter(quarter, {
- width: "narrow",
- context: "standalone"
- });
- // 1st quarter, 2nd quarter, ...
- case "qqqq":
- default:
- return localize.quarter(quarter, {
- width: "wide",
- context: "standalone"
- });
- }
- },
- // Month
- M: function M(date, token, localize) {
- var month = date.getUTCMonth();
- switch(token){
- case "M":
- case "MM":
- return (0, $gXPe6.default).M(date, token);
- // 1st, 2nd, ..., 12th
- case "Mo":
- return localize.ordinalNumber(month + 1, {
- unit: "month"
- });
- // Jan, Feb, ..., Dec
- case "MMM":
- return localize.month(month, {
- width: "abbreviated",
- context: "formatting"
- });
- // J, F, ..., D
- case "MMMMM":
- return localize.month(month, {
- width: "narrow",
- context: "formatting"
- });
- // January, February, ..., December
- case "MMMM":
- default:
- return localize.month(month, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // Stand-alone month
- L: function L(date, token, localize) {
- var month = date.getUTCMonth();
- switch(token){
- // 1, 2, ..., 12
- case "L":
- return String(month + 1);
- // 01, 02, ..., 12
- case "LL":
- return (0, $1hDC1.default)(month + 1, 2);
- // 1st, 2nd, ..., 12th
- case "Lo":
- return localize.ordinalNumber(month + 1, {
- unit: "month"
- });
- // Jan, Feb, ..., Dec
- case "LLL":
- return localize.month(month, {
- width: "abbreviated",
- context: "standalone"
- });
- // J, F, ..., D
- case "LLLLL":
- return localize.month(month, {
- width: "narrow",
- context: "standalone"
- });
- // January, February, ..., December
- case "LLLL":
- default:
- return localize.month(month, {
- width: "wide",
- context: "standalone"
- });
- }
- },
- // Local week of year
- w: function w(date, token, localize, options) {
- var week = (0, $kwqeF.default)(date, options);
- if (token === "wo") return localize.ordinalNumber(week, {
- unit: "week"
- });
- return (0, $1hDC1.default)(week, token.length);
- },
- // ISO week of year
- I: function I(date, token, localize) {
- var isoWeek = (0, $gE8AU.default)(date);
- if (token === "Io") return localize.ordinalNumber(isoWeek, {
- unit: "week"
- });
- return (0, $1hDC1.default)(isoWeek, token.length);
- },
- // Day of the month
- d: function d(date, token, localize) {
- if (token === "do") return localize.ordinalNumber(date.getUTCDate(), {
- unit: "date"
- });
- return (0, $gXPe6.default).d(date, token);
- },
- // Day of year
- D: function D(date, token, localize) {
- var dayOfYear = (0, $adSi5.default)(date);
- if (token === "Do") return localize.ordinalNumber(dayOfYear, {
- unit: "dayOfYear"
- });
- return (0, $1hDC1.default)(dayOfYear, token.length);
- },
- // Day of week
- E: function E(date, token, localize) {
- var dayOfWeek = date.getUTCDay();
- switch(token){
- // Tue
- case "E":
- case "EE":
- case "EEE":
- return localize.day(dayOfWeek, {
- width: "abbreviated",
- context: "formatting"
- });
- // T
- case "EEEEE":
- return localize.day(dayOfWeek, {
- width: "narrow",
- context: "formatting"
- });
- // Tu
- case "EEEEEE":
- return localize.day(dayOfWeek, {
- width: "short",
- context: "formatting"
- });
- // Tuesday
- case "EEEE":
- default:
- return localize.day(dayOfWeek, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // Local day of week
- e: function e(date, token, localize, options) {
- var dayOfWeek = date.getUTCDay();
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
- switch(token){
- // Numerical value (Nth day of week with current locale or weekStartsOn)
- case "e":
- return String(localDayOfWeek);
- // Padded numerical value
- case "ee":
- return (0, $1hDC1.default)(localDayOfWeek, 2);
- // 1st, 2nd, ..., 7th
- case "eo":
- return localize.ordinalNumber(localDayOfWeek, {
- unit: "day"
- });
- case "eee":
- return localize.day(dayOfWeek, {
- width: "abbreviated",
- context: "formatting"
- });
- // T
- case "eeeee":
- return localize.day(dayOfWeek, {
- width: "narrow",
- context: "formatting"
- });
- // Tu
- case "eeeeee":
- return localize.day(dayOfWeek, {
- width: "short",
- context: "formatting"
- });
- // Tuesday
- case "eeee":
- default:
- return localize.day(dayOfWeek, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // Stand-alone local day of week
- c: function c(date, token, localize, options) {
- var dayOfWeek = date.getUTCDay();
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
- switch(token){
- // Numerical value (same as in `e`)
- case "c":
- return String(localDayOfWeek);
- // Padded numerical value
- case "cc":
- return (0, $1hDC1.default)(localDayOfWeek, token.length);
- // 1st, 2nd, ..., 7th
- case "co":
- return localize.ordinalNumber(localDayOfWeek, {
- unit: "day"
- });
- case "ccc":
- return localize.day(dayOfWeek, {
- width: "abbreviated",
- context: "standalone"
- });
- // T
- case "ccccc":
- return localize.day(dayOfWeek, {
- width: "narrow",
- context: "standalone"
- });
- // Tu
- case "cccccc":
- return localize.day(dayOfWeek, {
- width: "short",
- context: "standalone"
- });
- // Tuesday
- case "cccc":
- default:
- return localize.day(dayOfWeek, {
- width: "wide",
- context: "standalone"
- });
- }
- },
- // ISO day of week
- i: function i(date, token, localize) {
- var dayOfWeek = date.getUTCDay();
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
- switch(token){
- // 2
- case "i":
- return String(isoDayOfWeek);
- // 02
- case "ii":
- return (0, $1hDC1.default)(isoDayOfWeek, token.length);
- // 2nd
- case "io":
- return localize.ordinalNumber(isoDayOfWeek, {
- unit: "day"
- });
- // Tue
- case "iii":
- return localize.day(dayOfWeek, {
- width: "abbreviated",
- context: "formatting"
- });
- // T
- case "iiiii":
- return localize.day(dayOfWeek, {
- width: "narrow",
- context: "formatting"
- });
- // Tu
- case "iiiiii":
- return localize.day(dayOfWeek, {
- width: "short",
- context: "formatting"
- });
- // Tuesday
- case "iiii":
- default:
- return localize.day(dayOfWeek, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // AM or PM
- a: function a(date, token, localize) {
- var hours = date.getUTCHours();
- var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
- switch(token){
- case "a":
- case "aa":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "abbreviated",
- context: "formatting"
- });
- case "aaa":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "abbreviated",
- context: "formatting"
- }).toLowerCase();
- case "aaaaa":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "narrow",
- context: "formatting"
- });
- case "aaaa":
- default:
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // AM, PM, midnight, noon
- b: function b(date, token, localize) {
- var hours = date.getUTCHours();
- var dayPeriodEnumValue;
- if (hours === 12) dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.noon;
- else if (hours === 0) dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.midnight;
- else dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
- switch(token){
- case "b":
- case "bb":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "abbreviated",
- context: "formatting"
- });
- case "bbb":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "abbreviated",
- context: "formatting"
- }).toLowerCase();
- case "bbbbb":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "narrow",
- context: "formatting"
- });
- case "bbbb":
- default:
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // in the morning, in the afternoon, in the evening, at night
- B: function B(date, token, localize) {
- var hours = date.getUTCHours();
- var dayPeriodEnumValue;
- if (hours >= 17) dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.evening;
- else if (hours >= 12) dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.afternoon;
- else if (hours >= 4) dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.morning;
- else dayPeriodEnumValue = $a2ec1796ce6ef2a0$var$dayPeriodEnum.night;
- switch(token){
- case "B":
- case "BB":
- case "BBB":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "abbreviated",
- context: "formatting"
- });
- case "BBBBB":
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "narrow",
- context: "formatting"
- });
- case "BBBB":
- default:
- return localize.dayPeriod(dayPeriodEnumValue, {
- width: "wide",
- context: "formatting"
- });
- }
- },
- // Hour [1-12]
- h: function h(date, token, localize) {
- if (token === "ho") {
- var hours = date.getUTCHours() % 12;
- if (hours === 0) hours = 12;
- return localize.ordinalNumber(hours, {
- unit: "hour"
- });
- }
- return (0, $gXPe6.default).h(date, token);
- },
- // Hour [0-23]
- H: function H(date, token, localize) {
- if (token === "Ho") return localize.ordinalNumber(date.getUTCHours(), {
- unit: "hour"
- });
- return (0, $gXPe6.default).H(date, token);
- },
- // Hour [0-11]
- K: function K(date, token, localize) {
- var hours = date.getUTCHours() % 12;
- if (token === "Ko") return localize.ordinalNumber(hours, {
- unit: "hour"
- });
- return (0, $1hDC1.default)(hours, token.length);
- },
- // Hour [1-24]
- k: function k(date, token, localize) {
- var hours = date.getUTCHours();
- if (hours === 0) hours = 24;
- if (token === "ko") return localize.ordinalNumber(hours, {
- unit: "hour"
- });
- return (0, $1hDC1.default)(hours, token.length);
- },
- // Minute
- m: function m(date, token, localize) {
- if (token === "mo") return localize.ordinalNumber(date.getUTCMinutes(), {
- unit: "minute"
- });
- return (0, $gXPe6.default).m(date, token);
- },
- // Second
- s: function s(date, token, localize) {
- if (token === "so") return localize.ordinalNumber(date.getUTCSeconds(), {
- unit: "second"
- });
- return (0, $gXPe6.default).s(date, token);
- },
- // Fraction of second
- S: function S(date, token) {
- return (0, $gXPe6.default).S(date, token);
- },
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
- X: function X(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timezoneOffset = originalDate.getTimezoneOffset();
- if (timezoneOffset === 0) return "Z";
- switch(token){
- // Hours and optional minutes
- case "X":
- return $a2ec1796ce6ef2a0$var$formatTimezoneWithOptionalMinutes(timezoneOffset);
- // Hours, minutes and optional seconds without `:` delimiter
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
- // so this token always has the same output as `XX`
- case "XXXX":
- case "XX":
- // Hours and minutes without `:` delimiter
- return $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset);
- // Hours, minutes and optional seconds with `:` delimiter
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
- // so this token always has the same output as `XXX`
- case "XXXXX":
- case "XXX":
- default:
- return $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset, ":");
- }
- },
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
- x: function x(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timezoneOffset = originalDate.getTimezoneOffset();
- switch(token){
- // Hours and optional minutes
- case "x":
- return $a2ec1796ce6ef2a0$var$formatTimezoneWithOptionalMinutes(timezoneOffset);
- // Hours, minutes and optional seconds without `:` delimiter
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
- // so this token always has the same output as `xx`
- case "xxxx":
- case "xx":
- // Hours and minutes without `:` delimiter
- return $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset);
- // Hours, minutes and optional seconds with `:` delimiter
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
- // so this token always has the same output as `xxx`
- case "xxxxx":
- case "xxx":
- default:
- return $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset, ":");
- }
- },
- // Timezone (GMT)
- O: function O(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timezoneOffset = originalDate.getTimezoneOffset();
- switch(token){
- // Short
- case "O":
- case "OO":
- case "OOO":
- return "GMT" + $a2ec1796ce6ef2a0$var$formatTimezoneShort(timezoneOffset, ":");
- // Long
- case "OOOO":
- default:
- return "GMT" + $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset, ":");
- }
- },
- // Timezone (specific non-location)
- z: function z(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timezoneOffset = originalDate.getTimezoneOffset();
- switch(token){
- // Short
- case "z":
- case "zz":
- case "zzz":
- return "GMT" + $a2ec1796ce6ef2a0$var$formatTimezoneShort(timezoneOffset, ":");
- // Long
- case "zzzz":
- default:
- return "GMT" + $a2ec1796ce6ef2a0$var$formatTimezone(timezoneOffset, ":");
- }
- },
- // Seconds timestamp
- t: function t(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timestamp = Math.floor(originalDate.getTime() / 1000);
- return (0, $1hDC1.default)(timestamp, token.length);
- },
- // Milliseconds timestamp
- T: function T(date, token, _localize, options) {
- var originalDate = options._originalDate || date;
- var timestamp = originalDate.getTime();
- return (0, $1hDC1.default)(timestamp, token.length);
- }
-};
-function $a2ec1796ce6ef2a0$var$formatTimezoneShort(offset, dirtyDelimiter) {
- var sign = offset > 0 ? "-" : "+";
- var absOffset = Math.abs(offset);
- var hours = Math.floor(absOffset / 60);
- var minutes = absOffset % 60;
- if (minutes === 0) return sign + String(hours);
- var delimiter = dirtyDelimiter || "";
- return sign + String(hours) + delimiter + (0, $1hDC1.default)(minutes, 2);
-}
-function $a2ec1796ce6ef2a0$var$formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
- if (offset % 60 === 0) {
- var sign = offset > 0 ? "-" : "+";
- return sign + (0, $1hDC1.default)(Math.abs(offset) / 60, 2);
- }
- return $a2ec1796ce6ef2a0$var$formatTimezone(offset, dirtyDelimiter);
-}
-function $a2ec1796ce6ef2a0$var$formatTimezone(offset, dirtyDelimiter) {
- var delimiter = dirtyDelimiter || "";
- var sign = offset > 0 ? "-" : "+";
- var absOffset = Math.abs(offset);
- var hours = (0, $1hDC1.default)(Math.floor(absOffset / 60), 2);
- var minutes = (0, $1hDC1.default)(absOffset % 60, 2);
- return sign + hours + delimiter + minutes;
-}
-var $a2ec1796ce6ef2a0$export$2e2bcd8739ae039 = $a2ec1796ce6ef2a0$var$formatters;
-
-});
-parcelRegister("adSi5", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $77153b4d927bbcae$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-var $77153b4d927bbcae$var$MILLISECONDS_IN_DAY = 86400000;
-function $77153b4d927bbcae$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var timestamp = date.getTime();
- date.setUTCMonth(0, 1);
- date.setUTCHours(0, 0, 0, 0);
- var startOfYearTimestamp = date.getTime();
- var difference = timestamp - startOfYearTimestamp;
- return Math.floor(difference / $77153b4d927bbcae$var$MILLISECONDS_IN_DAY) + 1;
-}
-
-});
-
-parcelRegister("gE8AU", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $c1e70c716b924c88$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $h0GOq = parcelRequire("h0GOq");
-
-var $3T8v2 = parcelRequire("3T8v2");
-
-var $k5qMt = parcelRequire("k5qMt");
-var $c1e70c716b924c88$var$MILLISECONDS_IN_WEEK = 604800000;
-function $c1e70c716b924c88$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var diff = (0, $h0GOq.default)(date).getTime() - (0, $3T8v2.default)(date).getTime();
- // Round the number of days to the nearest integer
- // because the number of milliseconds in a week is not constant
- // (e.g. it's different in the week of the daylight saving time clock shift)
- return Math.round(diff / $c1e70c716b924c88$var$MILLISECONDS_IN_WEEK) + 1;
-}
-
-});
-parcelRegister("h0GOq", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $c623a55fa868e783$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $c623a55fa868e783$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var weekStartsOn = 1;
- var date = (0, $9b910.default)(dirtyDate);
- var day = date.getUTCDay();
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
- date.setUTCDate(date.getUTCDate() - diff);
- date.setUTCHours(0, 0, 0, 0);
- return date;
-}
-
-});
-
-parcelRegister("3T8v2", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $2d4d19fa14e2995c$export$2e2bcd8739ae039);
-
-var $3WmpF = parcelRequire("3WmpF");
-
-var $h0GOq = parcelRequire("h0GOq");
-
-var $k5qMt = parcelRequire("k5qMt");
-function $2d4d19fa14e2995c$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var year = (0, $3WmpF.default)(dirtyDate);
- var fourthOfJanuary = new Date(0);
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
- var date = (0, $h0GOq.default)(fourthOfJanuary);
- return date;
-}
-
-});
-parcelRegister("3WmpF", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $2de82c9d44c36073$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $h0GOq = parcelRequire("h0GOq");
-function $2de82c9d44c36073$export$2e2bcd8739ae039(dirtyDate) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var year = date.getUTCFullYear();
- var fourthOfJanuaryOfNextYear = new Date(0);
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
- var startOfNextYear = (0, $h0GOq.default)(fourthOfJanuaryOfNextYear);
- var fourthOfJanuaryOfThisYear = new Date(0);
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
- var startOfThisYear = (0, $h0GOq.default)(fourthOfJanuaryOfThisYear);
- if (date.getTime() >= startOfNextYear.getTime()) return year + 1;
- else if (date.getTime() >= startOfThisYear.getTime()) return year;
- else return year - 1;
-}
-
-});
-
-
-
-parcelRegister("kwqeF", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $ef0b25a1602580f7$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $hrDtz = parcelRequire("hrDtz");
-
-var $iWHq0 = parcelRequire("iWHq0");
-
-var $k5qMt = parcelRequire("k5qMt");
-var $ef0b25a1602580f7$var$MILLISECONDS_IN_WEEK = 604800000;
-function $ef0b25a1602580f7$export$2e2bcd8739ae039(dirtyDate, options) {
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var diff = (0, $hrDtz.default)(date, options).getTime() - (0, $iWHq0.default)(date, options).getTime();
- // Round the number of days to the nearest integer
- // because the number of milliseconds in a week is not constant
- // (e.g. it's different in the week of the daylight saving time clock shift)
- return Math.round(diff / $ef0b25a1602580f7$var$MILLISECONDS_IN_WEEK) + 1;
-}
-
-});
-parcelRegister("hrDtz", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $cb33945ef52fae2b$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $bc5Aj = parcelRequire("bc5Aj");
-
-var $bzIGi = parcelRequire("bzIGi");
-function $cb33945ef52fae2b$export$2e2bcd8739ae039(dirtyDate, options) {
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
- (0, $k5qMt.default)(1, arguments);
- var defaultOptions = (0, $bzIGi.getDefaultOptions)();
- var weekStartsOn = (0, $bc5Aj.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
- var date = (0, $9b910.default)(dirtyDate);
- var day = date.getUTCDay();
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
- date.setUTCDate(date.getUTCDate() - diff);
- date.setUTCHours(0, 0, 0, 0);
- return date;
-}
-
-});
-
-parcelRegister("iWHq0", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $dcaf52cc6383d362$export$2e2bcd8739ae039);
-
-var $04uWM = parcelRequire("04uWM");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $hrDtz = parcelRequire("hrDtz");
-
-var $bc5Aj = parcelRequire("bc5Aj");
-
-var $bzIGi = parcelRequire("bzIGi");
-function $dcaf52cc6383d362$export$2e2bcd8739ae039(dirtyDate, options) {
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
- (0, $k5qMt.default)(1, arguments);
- var defaultOptions = (0, $bzIGi.getDefaultOptions)();
- var firstWeekContainsDate = (0, $bc5Aj.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
- var year = (0, $04uWM.default)(dirtyDate, options);
- var firstWeek = new Date(0);
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
- firstWeek.setUTCHours(0, 0, 0, 0);
- var date = (0, $hrDtz.default)(firstWeek, options);
- return date;
-}
-
-});
-parcelRegister("04uWM", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $00d86147aac44076$export$2e2bcd8739ae039);
-
-var $9b910 = parcelRequire("9b910");
-
-var $k5qMt = parcelRequire("k5qMt");
-
-var $hrDtz = parcelRequire("hrDtz");
-
-var $bc5Aj = parcelRequire("bc5Aj");
-
-var $bzIGi = parcelRequire("bzIGi");
-function $00d86147aac44076$export$2e2bcd8739ae039(dirtyDate, options) {
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
- (0, $k5qMt.default)(1, arguments);
- var date = (0, $9b910.default)(dirtyDate);
- var year = date.getUTCFullYear();
- var defaultOptions = (0, $bzIGi.getDefaultOptions)();
- var firstWeekContainsDate = (0, $bc5Aj.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
- var firstWeekOfNextYear = new Date(0);
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
- var startOfNextYear = (0, $hrDtz.default)(firstWeekOfNextYear, options);
- var firstWeekOfThisYear = new Date(0);
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
- var startOfThisYear = (0, $hrDtz.default)(firstWeekOfThisYear, options);
- if (date.getTime() >= startOfNextYear.getTime()) return year + 1;
- else if (date.getTime() >= startOfThisYear.getTime()) return year;
- else return year - 1;
-}
-
-});
-
-
-
-parcelRegister("1hDC1", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $0ef61b255e1ac2d1$export$2e2bcd8739ae039);
-function $0ef61b255e1ac2d1$export$2e2bcd8739ae039(number, targetLength) {
- var sign = number < 0 ? "-" : "";
- var output = Math.abs(number).toString();
- while(output.length < targetLength)output = "0" + output;
- return sign + output;
-}
-
-});
-
-parcelRegister("gXPe6", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $c599e48a3bd13bdc$export$2e2bcd8739ae039);
-
-var $1hDC1 = parcelRequire("1hDC1");
-/*
- * | | Unit | | Unit |
- * |-----|--------------------------------|-----|--------------------------------|
- * | a | AM, PM | A* | |
- * | d | Day of month | D | |
- * | h | Hour [1-12] | H | Hour [0-23] |
- * | m | Minute | M | Month |
- * | s | Second | S | Fraction of second |
- * | y | Year (abs) | Y | |
- *
- * Letters marked by * are not implemented but reserved by Unicode standard.
- */ var $c599e48a3bd13bdc$var$formatters = {
- // Year
- y: function y(date, token) {
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
- // | Year | y | yy | yyy | yyyy | yyyyy |
- // |----------|-------|----|-------|-------|-------|
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
- var signedYear = date.getUTCFullYear();
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
- return (0, $1hDC1.default)(token === "yy" ? year % 100 : year, token.length);
- },
- // Month
- M: function M(date, token) {
- var month = date.getUTCMonth();
- return token === "M" ? String(month + 1) : (0, $1hDC1.default)(month + 1, 2);
- },
- // Day of the month
- d: function d(date, token) {
- return (0, $1hDC1.default)(date.getUTCDate(), token.length);
- },
- // AM or PM
- a: function a(date, token) {
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am";
- switch(token){
- case "a":
- case "aa":
- return dayPeriodEnumValue.toUpperCase();
- case "aaa":
- return dayPeriodEnumValue;
- case "aaaaa":
- return dayPeriodEnumValue[0];
- case "aaaa":
- default:
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
- }
- },
- // Hour [1-12]
- h: function h(date, token) {
- return (0, $1hDC1.default)(date.getUTCHours() % 12 || 12, token.length);
- },
- // Hour [0-23]
- H: function H(date, token) {
- return (0, $1hDC1.default)(date.getUTCHours(), token.length);
- },
- // Minute
- m: function m(date, token) {
- return (0, $1hDC1.default)(date.getUTCMinutes(), token.length);
- },
- // Second
- s: function s(date, token) {
- return (0, $1hDC1.default)(date.getUTCSeconds(), token.length);
- },
- // Fraction of second
- S: function S(date, token) {
- var numberOfDigits = token.length;
- var milliseconds = date.getUTCMilliseconds();
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
- return (0, $1hDC1.default)(fractionalSeconds, token.length);
- }
-};
-var $c599e48a3bd13bdc$export$2e2bcd8739ae039 = $c599e48a3bd13bdc$var$formatters;
-
-});
-
-
-parcelRegister("3oAoR", function(module, exports) {
-
-$parcel$export(module.exports, "default", () => $278fd9454f80a3e9$export$2e2bcd8739ae039);
-var $278fd9454f80a3e9$var$dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
- switch(pattern){
- case "P":
- return formatLong.date({
- width: "short"
- });
- case "PP":
- return formatLong.date({
- width: "medium"
- });
- case "PPP":
- return formatLong.date({
- width: "long"
- });
- case "PPPP":
- default:
- return formatLong.date({
- width: "full"
- });
- }
-};
-var $278fd9454f80a3e9$var$timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
- switch(pattern){
- case "p":
- return formatLong.time({
- width: "short"
- });
- case "pp":
- return formatLong.time({
- width: "medium"
- });
- case "ppp":
- return formatLong.time({
- width: "long"
- });
- case "pppp":
- default:
- return formatLong.time({
- width: "full"
- });
- }
-};
-var $278fd9454f80a3e9$var$dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
- var datePattern = matchResult[1];
- var timePattern = matchResult[2];
- if (!timePattern) return $278fd9454f80a3e9$var$dateLongFormatter(pattern, formatLong);
- var dateTimeFormat;
- switch(datePattern){
- case "P":
- dateTimeFormat = formatLong.dateTime({
- width: "short"
- });
- break;
- case "PP":
- dateTimeFormat = formatLong.dateTime({
- width: "medium"
- });
- break;
- case "PPP":
- dateTimeFormat = formatLong.dateTime({
- width: "long"
- });
- break;
- case "PPPP":
- default:
- dateTimeFormat = formatLong.dateTime({
- width: "full"
- });
- break;
- }
- return dateTimeFormat.replace("{{date}}", $278fd9454f80a3e9$var$dateLongFormatter(datePattern, formatLong)).replace("{{time}}", $278fd9454f80a3e9$var$timeLongFormatter(timePattern, formatLong));
-};
-var $278fd9454f80a3e9$var$longFormatters = {
- p: $278fd9454f80a3e9$var$timeLongFormatter,
- P: $278fd9454f80a3e9$var$dateTimeLongFormatter
-};
-var $278fd9454f80a3e9$export$2e2bcd8739ae039 = $278fd9454f80a3e9$var$longFormatters;
-
-});
-
-parcelRegister("b5PrA", function(module, exports) {
-
-$parcel$export(module.exports, "isProtectedDayOfYearToken", () => $813811096164e580$export$c6cc36aa33304772);
-$parcel$export(module.exports, "isProtectedWeekYearToken", () => $813811096164e580$export$c6b49d6dceb604a1);
-$parcel$export(module.exports, "throwProtectedError", () => $813811096164e580$export$8073c1ae88f0e727);
-var $813811096164e580$var$protectedDayOfYearTokens = [
- "D",
- "DD"
-];
-var $813811096164e580$var$protectedWeekYearTokens = [
- "YY",
- "YYYY"
-];
-function $813811096164e580$export$c6cc36aa33304772(token) {
- return $813811096164e580$var$protectedDayOfYearTokens.indexOf(token) !== -1;
-}
-function $813811096164e580$export$c6b49d6dceb604a1(token) {
- return $813811096164e580$var$protectedWeekYearTokens.indexOf(token) !== -1;
-}
-function $813811096164e580$export$8073c1ae88f0e727(token, format, input) {
- if (token === "YYYY") throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
- else if (token === "YY") throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
- else if (token === "D") throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
- else if (token === "DD") throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
-}
-
-});
-
-
-
-
-parcelRegister("fGSV5", function(module, exports) {
-
-$parcel$export(module.exports, "InternalAPI", () => $d2c0a5f412e219e1$export$76bce36b77a871ea);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $j4Xk5 = parcelRequire("j4Xk5");
-
-var $dNzBT = parcelRequire("dNzBT");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $3i93m = parcelRequire("3i93m");
-
-var $isbAn = parcelRequire("isbAn");
-const $d2c0a5f412e219e1$export$76bce36b77a871ea = ({ close: close, checkApi: checkApi })=>{
- const local = (0, $4WfNn.useLocal)({
- status: "...",
- loading: false,
- prasiApiDbPull: false,
- clearingCache: false
- });
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const config = p.site;
- const reloadStatus = ()=>{
- if (p.site) {
- const s = api.srvapi_check.bind({
- apiUrl: "https://api.prasi.app"
- });
- s(p.site.id).then((e)=>{
- local.status = e;
- checkApi(e === "started");
- local.render();
- });
- }
- };
- (0, $63SH6.useEffect)(()=>{
- reloadStatus();
- }, []);
- if (local.status === "installing") setTimeout(()=>{
- reloadStatus();
- }, 1000);
- if (local.loading || local.status === "installing") return /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex flex-1 self-stretch",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "internal",
- backdrop: false
- })
- });
- let url = "";
- const port = config?.api_prasi?.port;
- if (location.hostname !== "prasi.app" && location.hostname !== "localhost") url = `http://${location.hostname}:${port}`;
- else url = `https://${port}.prasi.world`;
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-col self-stretch flex-1 items-stretch space-y-2",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between items-center",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex space-x-2",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "space-x-1 flex items-center",
- children: [
- local.status === "started" && /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "text-green-700 text-[6px]",
- children: "\u25CF"
- }),
- " ",
- local.status === "stopped" && /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "text-red-700 text-[6px]",
- children: "\u25CF"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("span", {
- className: "capitalize",
- children: local.status
- })
- ]
- }),
- local.status === "started" && /*#__PURE__*/ (0, $lAN3N.jsx)("a", {
- href: url,
- target: "_blank",
- className: "text-blue-500 hover:underline border px-1",
- children: url
- })
- ]
- }),
- local.status === "started" && /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex space-x-1",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border border-slate-500 hover:bg-red-100 hover:border-red-500 px-2 rounded cursor-pointer",
- onClick: async ()=>{
- if (p.site) {
- const s = api.srvapi_op.bind({
- apiUrl: "https://api.prasi.app"
- });
- await s(p.site.id, "stop");
- }
- reloadStatus();
- },
- children: "Stop"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border border-slate-500 hover:bg-purple-100 hover:border-purple-500 px-2 rounded cursor-pointer",
- onClick: async ()=>{
- if (p.site) {
- const s = api.srvapi_op.bind({
- apiUrl: "https://api.prasi.app"
- });
- await s(p.site.id, "stop");
- }
- local.loading = true;
- local.render();
- setTimeout(()=>{
- local.loading = false;
- local.render();
- reloadStatus();
- }, 500);
- },
- children: "Restart"
- })
- ]
- }),
- local.status === "stopped" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex space-x-1",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border border-slate-500 hover:bg-green-100 hover:border-green-500 px-2 rounded cursor-pointer",
- onClick: async ()=>{
- if (p.site) {
- const s = api.srvapi_op.bind({
- apiUrl: "https://api.prasi.app"
- });
- await s(p.site.id, "start");
- }
- reloadStatus();
- },
- children: "Start"
- })
- })
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex flex-col border-t space-y-2 -mx-2 px-2 pt-2",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $j4Xk5.AutoHeightTextarea), {
- placeholder: "DATABASE_URL",
- className: "p-2 border",
- value: p.site.api_prasi.db || "",
- spellCheck: false,
- onChange: (e)=>{
- if (p.site.api_prasi) p.site.api_prasi.db = e.currentTarget.value;
- local.render();
- }
- }),
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "flex justify-between",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "flex space-x-1 items-center",
- children: (0, $3i93m.w).prasiApiDbPull ? "Pullling..." : /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border border-slate-500 hover:bg-purple-100 hover:border-purple-500 px-2 rounded cursor-pointer",
- onClick: async ()=>{
- if (p.site) {
- (0, $3i93m.w).prasiApiDbPull = true;
- local.render();
- await api.srvapi_dbpull(p.site.id, p.site.api_prasi.db || "");
- (0, $3i93m.w).prasiApiDbPull = false;
- local.render();
- try {
- if (config) {
- config.api_url = `https://${p.site.api_prasi.port}.prasi.world`;
- const base = (0, (/*@__PURE__*/$parcel$interopDefault($dNzBT)))(config.api_url, "/");
- try {
- await (0, $isbAn.reloadDBAPI)(base);
- } catch (e) {}
- }
- } catch (e) {
- console.log(e);
- }
- alert("DB PULL SUCCESS");
- }
- },
- children: "DB Pull"
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: cx("cursor-pointer hover:underline"),
- onClick: async ()=>{
- local.clearingCache = true;
- local.render();
- try {
- await (0, $isbAn.reloadDBAPI)(p.site.api_url, "dev");
- } catch (e) {}
- local.clearingCache = false;
- local.render();
- alert("API Cache Cleared");
- },
- children: local.clearingCache ? "Clearing Cache..." : "Clear API Cache"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "border border-slate-500 hover:bg-red-100 hover:border-red-500 px-2 rounded cursor-pointer",
- onClick: async ()=>{
- if (p.site) {
- if (confirm("Are you sure ?")) {
- local.loading = true;
- local.render();
- await api.srvapi_destroy(p.site.id);
- p.site.api_url = "";
- p.site.api_prasi.db = "";
- p.site.api_prasi.port = "";
- local.loading = false;
- local.render();
- close();
- }
- }
- },
- children: "Destroy"
- })
- ]
- })
- ]
- })
- ]
- });
-};
-const $d2c0a5f412e219e1$var$loadText = async (url)=>{
- const res = await fetch(url);
- return await res.text();
-};
-
-});
-parcelRegister("j4Xk5", function(module, exports) {
-
-$parcel$export(module.exports, "PanelLink", () => $107b50f57d0fe3f2$export$71aeeb4608606946);
-$parcel$export(module.exports, "AutoHeightTextarea", () => $107b50f57d0fe3f2$export$def8fbe0eadc4343);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $bjM6F = parcelRequire("bjM6F");
-
-var $4WfNn = parcelRequire("4WfNn");
-const $107b50f57d0fe3f2$export$71aeeb4608606946 = ({ value: value, update: update, mode: mode })=>{
- const linktag = (0, $bjM6F.responsiveVal)(value, "linktag", mode, {});
- const local = (0, $4WfNn.useLocal)({
- link: linktag.link
- });
- (0, $63SH6.useEffect)(()=>{
- local.link = linktag.link;
- local.render();
- }, [
- linktag.link
- ]);
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($107b50f57d0fe3f2$export$def8fbe0eadc4343, {
- spellCheck: false,
- minRows: 1,
- className: cx("flex-1 border border-slate-300 p-1 h-[25px]"),
- value: local.link || "",
- placeholder: "Link Href",
- onChange: (e)=>{
- local.link = e.currentTarget.value;
- local.render();
- },
- onBlur: ()=>{
- update("linktag", {
- ...linktag,
- link: local.link
- });
- }
- })
- });
-};
-function $107b50f57d0fe3f2$export$def8fbe0eadc4343({ minRows: minRows = 1, ...props }) {
- const ref = (0, $63SH6.useRef)(null);
- const calculateAndSetHeight = (0, $63SH6.useCallback)(()=>{
- if (!ref.current) return;
- const { borderBottomWidth: borderBottomWidth, borderTopWidth: borderTopWidth, boxSizing: boxSizing, lineHeight: lineHeight, paddingBottom: paddingBottom, paddingTop: paddingTop } = window.getComputedStyle(ref.current);
- ref.current.style.height = lineHeight; // set height temporarily to a single row to obtain scrollHeight, disregarding empty space after text (otherwise, scrollHeight would be equal to the height of the element) - this solves auto-shrinking of the textarea (it's not needed for auto-growing it)
- const { scrollHeight: scrollHeight } = ref.current; // scrollHeight = content height + padding top + padding bottom
- if (boxSizing === "border-box") {
- const minHeight = parseFloat(lineHeight) * minRows + parseFloat(paddingTop) + parseFloat(paddingBottom) + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth);
- const allTextHeight = scrollHeight + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth);
- ref.current.style.height = `${Math.max(minHeight, allTextHeight)}px`;
- } else if (boxSizing === "content-box") {
- const minHeight = parseFloat(lineHeight) * minRows;
- const allTextHeight = scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom);
- ref.current.style.height = `${Math.max(minHeight, allTextHeight)}px`;
- } else console.error("Unknown box-sizing value.");
- }, [
- minRows
- ]);
- (0, $63SH6.useEffect)(()=>{
- calculateAndSetHeight();
- }, [
- calculateAndSetHeight
- ]);
- const handleChange = (e)=>{
- calculateAndSetHeight();
- if (props.onChange) props.onChange(e);
- };
- calculateAndSetHeight();
- return /*#__PURE__*/ (0, $lAN3N.jsx)("textarea", {
- ...props,
- onChange: handleChange,
- ref: ref
- });
-}
-
-});
-
-
-
-
-parcelRegister("4U53m", function(module, exports) {
-
-$parcel$export(module.exports, "ToolbarLeft", () => $8d45e96fe10a2210$export$a2f712f845a8803d);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $9DqRZ = parcelRequire("9DqRZ");
-
-var $eoQBx = parcelRequire("eoQBx");
-const $8d45e96fe10a2210$export$a2f712f845a8803d = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const pageName = p.page?.name || "";
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("toolbar-left", "flex space-x-2 pl-1"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- "Site ",
- p.site.name
- ]
- }),
- onClick () {
- p.manager.site = true;
- p.render();
- }
- }
- ],
- labelMenu: [
- {
- label: "Logout",
- onClick: ()=>{
- api.logout().then(()=>{
- location.href = "/login";
- });
- }
- }
- ],
- label: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($8d45e96fe10a2210$var$SiteIcon, {})
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: pageName.startsWith("layout:") ? /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), {
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-green-700 text-white text-[10px] px-2 mr-1 -ml-2",
- children: "LAYOUT"
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- children: pageName.substring(7)
- })
- ]
- }) : `Page ${pageName}`
- }),
- onClick () {
- p.manager.page = true;
- p.render();
- }
- }
- ],
- label: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($8d45e96fe10a2210$var$PageIcon, {})
- })
- })
- ]
- });
-};
-const $8d45e96fe10a2210$var$PageIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "12",
- height: "12",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M3 2.5a.5.5 0 01.5-.5h5.586a.5.5 0 01.353.146l2.415 2.415a.5.5 0 01.146.353V12.5a.5.5 0 01-.5.5h-8a.5.5 0 01-.5-.5v-10zM3.5 1A1.5 1.5 0 002 2.5v10A1.5 1.5 0 003.5 14h8a1.5 1.5 0 001.5-1.5V4.914a1.5 1.5 0 00-.44-1.06l-2.414-2.415A1.5 1.5 0 009.086 1H3.5zm1 3a.5.5 0 000 1h3a.5.5 0 000-1h-3zm0 3a.5.5 0 000 1h6a.5.5 0 000-1h-6zm0 3a.5.5 0 000 1h6a.5.5 0 000-1h-6z",
- clipRule: "evenodd"
- })
- });
-const $8d45e96fe10a2210$var$SiteIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "12",
- height: "12",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M2.5 3a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h10a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5h-10zM1 9.5a1.5 1.5 0 001 1.415v.585A1.5 1.5 0 003.5 13h8a1.5 1.5 0 001.5-1.5v-.585A1.5 1.5 0 0014 9.5v-6A1.5 1.5 0 0012.5 2h-10A1.5 1.5 0 001 3.5v6zm11 2V11H3v.5a.5.5 0 00.5.5h8a.5.5 0 00.5-.5zM5.5 6a.5.5 0 000 1h4a.5.5 0 000-1h-4z",
- clipRule: "evenodd"
- })
- });
-
-});
-
-parcelRegister("cXVqu", function(module, exports) {
-
-$parcel$export(module.exports, "ToolbarRight", () => $e532641db4419d0d$export$d0b18490ed1b753f);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $bTIRf = parcelRequire("bTIRf");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $8AAMi = parcelRequire("8AAMi");
-
-var $aFghw = parcelRequire("aFghw");
-
-var $9DqRZ = parcelRequire("9DqRZ");
-
-var $emJmR = parcelRequire("emJmR");
-const $e532641db4419d0d$export$d0b18490ed1b753f = ()=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- pingOpen: false
- });
- return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("toolbar-right", "flex mr-2"),
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), {
- className: "flex items-center mr-2",
- open: local.pingOpen,
- onOpenChange: (open)=>{
- local.pingOpen = open;
- local.render();
- },
- content: p.wsPing < 0 ? `Disconnected` : `Ping: ${p.wsPing}ms`,
- placement: "left",
- children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: cx("cursor-pointer p-[1px] border rounded-sm flex items-center justify-center"),
- onClick: ()=>{
- local.pingOpen = true;
- local.render();
- },
- children: [
- p.wsPing < 0 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-red-500 w-[10px] h-[10px] rounded-sm"
- }),
- p.wsPing <= 250 && p.wsPing >= 0 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-green-500 w-[10px] h-[10px] rounded-sm"
- }),
- p.wsPing > 250 && p.wsPing < 1000 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-orange-300 w-[10px] h-[10px] rounded-sm"
- }),
- p.wsPing >= 1000 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "bg-red-500 w-[10px] h-[10px] rounded-sm"
- })
- ]
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- content: "Preview",
- onClick: ()=>{
- window.open(`${location.hostname === "localhost" ? "http://localhost:4550" : "https://prasi.app"}/live/${p.site.id}/${p.page?.id}`, "_blank");
- }
- },
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- backdrop: false,
- popoverClassName: "bg-white",
- placement: "bottom",
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $aFghw.AutoHeightTextarea), {
- className: "p-2 border border-blue-500 font-mono text-[11px] w-[300px] outline-none",
- autoFocus: true,
- spellCheck: false,
- onFocus: (e)=>{
- e.currentTarget.select();
- },
- value: `${location.hostname === "localhost" ? "http://localhost:4550" : "https://prasi.app"}/live/${p.site.id}/${p.page?.id}`
- }),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)($e532641db4419d0d$var$URLIcon, {})
- })
- },
- {
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), {
- autoFocus: false,
- backdrop: false,
- popoverClassName: "bg-white",
- placement: "bottom",
- content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $aFghw.AutoHeightTextarea), {
- className: "p-2 border border-blue-500 font-mono text-[11px] w-[300px] outline-none",
- autoFocus: true,
- spellCheck: false,
- onFocus: (e)=>{
- e.currentTarget.select();
- },
- value: `${location.hostname === "localhost" ? "http://localhost:12300" : "https://api.prasi.app"}/site/${p.site.id}/${p.page?.id}`
- }),
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M4.625 4h-.061c-.523 0-.857 0-1.146.055-1.18.225-2.12 1.116-2.36 2.275C1 6.613 1 6.94 1 7.437v.126c0 .497 0 .824.058 1.107.24 1.16 1.18 2.05 2.36 2.275.289.055.623.055 1.146.055H5.5a.5.5 0 100-1h-.875c-.604 0-.836-.002-1.02-.037-.802-.154-1.413-.752-1.568-1.496C2.002 8.297 2 8.083 2 7.5c0-.582.002-.798.037-.967.155-.744.766-1.342 1.569-1.496C3.789 5.002 4.02 5 4.625 5H5.5a.5.5 0 000-1h-.875zm5.75 1c.604 0 .835.002 1.019.037.803.154 1.414.752 1.568 1.496.035.17.038.385.038.967 0 .583-.003.798-.038.967-.154.744-.765 1.342-1.568 1.496-.184.035-.415.037-1.02.037H9.5a.5.5 0 000 1h.935c.523 0 .857 0 1.146-.055 1.18-.225 2.12-1.116 2.36-2.275C14 8.387 14 8.06 14 7.563v-.126c0-.497 0-.824-.059-1.107-.24-1.16-1.18-2.05-2.36-2.275C11.293 4 10.958 4 10.435 4H9.5a.5.5 0 000 1h.875zM5 7a.5.5 0 000 1h5a.5.5 0 000-1H5z",
- clipRule: "evenodd"
- })
- })
- })
- }
- ],
- className: cx(css`
- margin-right: 5px !important;
- `)
- }),
- p.site.responsive === "all" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $8AAMi.ResponsiveToggle), {})
- ]
- });
-};
-const $e532641db4419d0d$var$URLIcon = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "13",
- height: "13",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M8.512 3.005c.676-.46 1.531-.468 2.167-.05.144.094.298.244.71.656.412.412.562.566.657.71.417.636.408 1.49-.051 2.167-.105.155-.267.32-.694.747l-.62.619a.5.5 0 00.708.707l.619-.619.043-.043c.37-.37.606-.606.771-.849.675-.994.71-2.287.06-3.278-.159-.241-.39-.472-.741-.823l-.045-.045-.044-.045c-.352-.351-.583-.582-.824-.74-.99-.65-2.284-.616-3.278.06-.243.164-.48.4-.85.77l-.042.043-.619.62a.5.5 0 10.707.706l.62-.618c.426-.427.592-.59.746-.695zM4.318 7.147a.5.5 0 00-.707-.707l-.619.618-.043.043c-.37.37-.606.606-.771.85-.675.993-.71 2.287-.06 3.277.159.242.39.473.741.824l.045.045.044.044c.352.351.583.583.824.741.99.65 2.284.616 3.278-.06.243-.165.48-.401.849-.771l.043-.043.619-.619a.5.5 0 10-.708-.707l-.618.619c-.427.427-.593.59-.747.694-.676.46-1.532.469-2.167.051-.144-.094-.298-.245-.71-.657-.412-.412-.562-.566-.657-.71-.417-.635-.408-1.49.051-2.167.105-.154.267-.32.694-.747l.619-.618zm5.304-1.061a.5.5 0 00-.707-.708L5.379 8.914a.5.5 0 10.707.707l3.536-3.535z",
- clipRule: "evenodd"
- })
- });
-
-});
-parcelRegister("8AAMi", function(module, exports) {
-
-$parcel$export(module.exports, "ResponsiveToggle", () => $da5c9b8696cd8def$export$990bc2b2cdaf908a);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $9DqRZ = parcelRequire("9DqRZ");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $3i93m = parcelRequire("3i93m");
-const $da5c9b8696cd8def$export$990bc2b2cdaf908a = ()=>{
- const c = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const mode = c.mode;
- const activeModeClassName = "border-b-2 border-blue-500";
- return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9DqRZ.ToolbarBox), {
- items: [
- {
- onClick () {
- c.mode = "mobile";
- (0, $3i93m.w).isMobile = true;
- (0, $3i93m.w).isDesktop = false;
- localStorage.setItem("prasi-editor-mode", "mobile");
- c.render();
- },
- className: cx(mode === "mobile" && activeModeClassName),
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M4 2.5a.5.5 0 01.5-.5h6a.5.5 0 01.5.5v10a.5.5 0 01-.5.5h-6a.5.5 0 01-.5-.5v-10zM4.5 1A1.5 1.5 0 003 2.5v10A1.5 1.5 0 004.5 14h6a1.5 1.5 0 001.5-1.5v-10A1.5 1.5 0 0010.5 1h-6zM6 11.65a.35.35 0 100 .7h3a.35.35 0 100-.7H6z",
- clipRule: "evenodd"
- })
- })
- },
- {
- onClick () {
- c.mode = "desktop";
- (0, $3i93m.w).isMobile = false;
- (0, $3i93m.w).isDesktop = true;
- localStorage.setItem("prasi-editor-mode", "desktop");
- c.render();
- },
- className: cx(mode === "desktop" && activeModeClassName),
- content: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", {
- xmlns: "http://www.w3.org/2000/svg",
- width: "15",
- height: "15",
- fill: "none",
- viewBox: "0 0 15 15",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", {
- fill: "currentColor",
- fillRule: "evenodd",
- d: "M1 3.25A.25.25 0 011.25 3h12.5a.25.25 0 01.25.25v7.5a.25.25 0 01-.25.25H1.25a.25.25 0 01-.25-.25v-7.5zM1.25 2C.56 2 0 2.56 0 3.25v7.5C0 11.44.56 12 1.25 12h3.823l-.243 1.299a.55.55 0 00.54.651h4.26a.55.55 0 00.54-.651L9.927 12h3.823c.69 0 1.25-.56 1.25-1.25v-7.5C15 2.56 14.44 2 13.75 2H1.25zm7.76 10H5.99l-.198 1.05h3.416L9.01 12z",
- clipRule: "evenodd"
- })
- })
- }
- ]
- });
-};
-
-});
-
-
-
-parcelRegister("8yVvO", function(module, exports) {
-
-
-
-
-module.exports = Promise.all([
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("4I5N5")),
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("7HtMj"))
-]).then(()=>parcelRequire("4RKhA"));
-
-});
-
-parcelRegister("7WO2G", function(module, exports) {
-
-
-module.exports = (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("j6HXa")).then(()=>parcelRequire("aEVUc"));
-
-});
-
-parcelRegister("hN3z8", function(module, exports) {
-
-
-module.exports = (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("dkgqB")).then(()=>parcelRequire("4Alzp"));
-
-});
-
-parcelRegister("1aNFf", function(module, exports) {
-
-
-
-
-module.exports = Promise.all([
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("4I5N5")),
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("2LjQB"))
-]).then(()=>parcelRequire("217yT"));
-
-});
-
-
-parcelRegister("7PhiD", function(module, exports) {
-
-$parcel$export(module.exports, "routeEditor", () => $5294164d0e1a026a$export$c76a869101fcd889);
-
-var $5NYeV = parcelRequire("5NYeV");
-
-var $4y8Np = parcelRequire("4y8Np");
-
-var $iEVTn = parcelRequire("iEVTn");
-
-var $3xp7a = parcelRequire("3xp7a");
-const $5294164d0e1a026a$export$2a8a804c6eb9a95d = {};
-const $5294164d0e1a026a$var$loadingCounter = {};
-const $5294164d0e1a026a$export$c76a869101fcd889 = (p, page_id)=>{
- if (p.status !== "loading") {
- if (!p.mpage || p.mpage.getMap("map").get("id") !== page_id) {
- p.status = "loading";
- $5294164d0e1a026a$var$loadPage(p, page_id).then(async ()=>{
- await $5294164d0e1a026a$var$loadNpmPage(page_id);
- p.status = "ready";
- p.render();
- if (!p.mpage || p.mpage.getMap("map").get("id") !== page_id) {
- if (!$5294164d0e1a026a$var$loadingCounter[page_id]) $5294164d0e1a026a$var$loadingCounter[page_id] = 1;
- else $5294164d0e1a026a$var$loadingCounter[page_id]++;
- if ($5294164d0e1a026a$var$loadingCounter[page_id] > 2) {
- p.status = "reload";
- p.render();
- p.mpageLoaded = ()=>{
- p.status = "ready";
- p.render();
- };
- await api.page_reload(page_id);
- }
- }
- });
- }
- }
-};
-const $5294164d0e1a026a$var$loadNpmPage = async (id)=>{
- try {
- if (typeof window.exports === "undefined") window.exports = {};
- await (0, $iEVTn.default)(`${serverurl}/npm/page/${id}/page.js`);
- } catch (e) {
- console.error(e);
- }
-};
-const $5294164d0e1a026a$var$loadPage = (p, id)=>{
- window.prasiPageID = id;
- if (id === p.site.layout_id) (0, $3xp7a.w).isLayout = true;
- else (0, $3xp7a.w).isLayout = false;
- return new Promise(async (resolve)=>{
- await (0, $4y8Np.editorWS)(p);
- p.mpageLoaded = async (mpage)=>{
- const dbpage = mpage.getMap("map").toJSON();
- const page = {
- id: dbpage.id,
- name: dbpage.name,
- url: dbpage.url,
- content_tree: dbpage.content_tree,
- js: dbpage.js_compiled
- };
- if (page && page.content_tree) {
- p.mpage = mpage;
- p.page = page;
- await (0, $5NYeV.loadComponent)(p, page.content_tree);
- }
- resolve(mpage);
- };
- (0, $4y8Np.wsend)(p, JSON.stringify({
- type: "get_page",
- page_id: id
- }));
- });
-};
-
-});
-
-parcelRegister("aK4GE", function(module, exports) {
-
-$parcel$export(module.exports, "undoManager", () => $aad053250a2407e3$export$6e8fbfedbd25bd0d);
-
-var $4y8Np = parcelRequire("4y8Np");
-const $aad053250a2407e3$export$6e8fbfedbd25bd0d = {
- undo (p) {
- let sendmsg;
- if (p.comp?.id) sendmsg = {
- type: "undo",
- mode: "comp",
- id: p.comp.id
- };
- else sendmsg = {
- type: "undo",
- mode: "page",
- id: p.page?.id || ""
- };
- (0, $4y8Np.wsend)(p, JSON.stringify(sendmsg));
- },
- redo (p) {
- let sendmsg;
- if (p.comp?.id) sendmsg = {
- type: "redo",
- mode: "comp",
- id: p.comp.id
- };
- else sendmsg = {
- type: "redo",
- mode: "page",
- id: p.page?.id || ""
- };
- (0, $4y8Np.wsend)(p, JSON.stringify(sendmsg));
- }
-};
-
-});
-
-
-})();
-//# sourceMappingURL=editor.73d38fbd.js.map
diff --git a/app/web/static/editor.9f6769c5.css b/app/web/static/editor.9f6769c5.css
deleted file mode 100644
index 12cdd82d..00000000
--- a/app/web/static/editor.9f6769c5.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.ContextMenu {
- background: #fff;
- border: 1px solid #ccc;
- outline: 0;
-}
-
-.MenuItem {
- text-align: left;
- background: #fff;
- border-bottom: 1px solid #ececeb;
- outline: 0;
- justify-content: space-between;
- width: 100%;
- margin: 0;
- padding: 3px 20px 3px 10px;
- font-size: 14px;
- line-height: 1.5;
- display: flex;
-}
-
-.MenuItem:last-child {
- border-bottom: 0;
-}
-
-.MenuItem.open {
- background: #ddd;
-}
-
-.MenuItem:disabled {
- color: #ccc;
-}
-
-.MenuItem:focus, .MenuItem:not([disabled]):active {
- color: #fff;
- background: #527dff;
-}
-
-/*# sourceMappingURL=editor.9f6769c5.css.map */
diff --git a/app/web/static/editor.b81cc496.js b/app/web/static/editor.b81cc496.js
deleted file mode 100644
index 9ef43641..00000000
--- a/app/web/static/editor.b81cc496.js
+++ /dev/null
@@ -1,337 +0,0 @@
-(() => {
-
-function $parcel$defineInteropFlag(a) {
- Object.defineProperty(a, '__esModule', {value: true, configurable: true});
-}
-
-function $parcel$export(e, n, v, s) {
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
-}
-
- var $parcel$global = globalThis;
- var parcelRequire = $parcel$global["parcelRequire2d1f"];
-var parcelRegister = parcelRequire.register;
-parcelRegister("9g3KG", function(module, exports) {
-
-$parcel$defineInteropFlag(module.exports);
-
-$parcel$export(module.exports, "default", () => $4ee48e7a58a06add$export$2e2bcd8739ae039);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $63SH6 = parcelRequire("63SH6");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-
-var $1CiVi = parcelRequire("1CiVi");
-
-var $4ee48e7a58a06add$export$2e2bcd8739ae039 = (0, $4WfNn.page)({
- url: "/editor/:site_id/:page_id",
- component: ({})=>{
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- const local = (0, $4WfNn.useLocal)({
- loading: true,
- session: null,
- notfound: false,
- init: false,
- Editor: null
- });
- const site_id = params.site_id === "_" ? "" : params.site_id;
- const page_id = params.page_id === "_" ? "" : params.page_id;
- (0, $63SH6.useEffect)(()=>{
- if (!local.init) (async ()=>{
- if (!local.Editor) local.Editor = (await (parcelRequire("3Hy9x"))).Editor;
- let ses = null;
- try {
- ses = JSON.parse(localStorage.getItem("prasi-session") || "");
- } catch (e) {}
- await new Promise(async (done)=>{
- try {
- if (!!ses) done();
- let e = await api.session();
- if (!e) {
- window.redirectTo = location.pathname;
- navigate("/login");
- localStorage.removeItem("prasi-session");
- } else localStorage.setItem("prasi-session", JSON.stringify(e));
- if (!ses) {
- ses = e;
- done();
- }
- } catch (e) {
- console.error(e);
- }
- });
- if (ses) {
- local.session = ses;
- if (!site_id) {
- const res = await db.site.findFirst({
- where: {
- is_deleted: false,
- org: {
- org_user: {
- some: {
- id_user: ses.data.user.id
- }
- }
- }
- },
- select: {
- id: true
- }
- });
- if (res) {
- const page = await db.page.findFirst({
- where: {
- id_site: res.id,
- is_deleted: false
- },
- select: {
- id: true
- }
- });
- if (page) {
- local.loading = false;
- local.render();
- navigate(`/editor/${res.id}/${page.id}`);
- return;
- }
- } else {
- local.loading = false;
- local.render();
- return;
- }
- } else if (!page_id) {
- let res = await db.page.findFirst({
- where: {
- id_site: site_id,
- is_deleted: false
- },
- select: {
- id: true
- }
- });
- if (!res) res = await db.page.create({
- data: {
- content_tree: {
- childs: [],
- id: "root",
- type: "root"
- },
- name: "home",
- url: "/",
- id_site: site_id
- }
- });
- if (res) {
- local.loading = false;
- local.render();
- navigate(`/editor/${site_id}/${res.id}`);
- return;
- }
- }
- }
- local.init = true;
- local.loading = false;
- local.render();
- })();
- }, [
- local.init
- ]);
- const Editor = local.Editor;
- if (local.loading || !Editor) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {
- note: "base-page"
- });
- const sw = navigator.serviceWorker.controller;
- if (sw) sw.postMessage({
- type: "add-cache",
- url: location.href
- });
- return /*#__PURE__*/ (0, $lAN3N.jsx)(Editor, {
- session: local.session,
- site_id: site_id,
- page_id: page_id
- });
- }
-});
-
-});
-parcelRegister("eoQBx", function(module, exports) {
-
-$parcel$export(module.exports, "EditorGlobal", () => $de9a4354d7eb3ed2$export$e6753382eac59df2);
-
-var $9hNJ9 = parcelRequire("9hNJ9");
-const $de9a4354d7eb3ed2$export$e6753382eac59df2 = {
- /** ui */ mode: "",
- status: "init",
- focused: "",
- pendingRebuild: false,
- localReloading: {},
- manager: {
- page: false,
- site: false,
- comp: false,
- compActionLabel: "Pick",
- compCallback: (comp)=>{},
- compPreviewRendered: new Set()
- },
- script: {
- siteActive: false,
- siteTypes: {},
- prop: null,
- toolbar: null,
- active: false,
- type: "js",
- db: null,
- api: null,
- onClose: undefined,
- doEdit: null
- },
- item: {
- active: "",
- activeOriginalId: "",
- hover: "",
- sideHover: false,
- selectMode: "single",
- selection: [],
- copy: {
- mode: "single"
- }
- },
- preventTreeScroll: false,
- softRender: {
- tree: ()=>{},
- page: ()=>{},
- side: ()=>{},
- addEl: ()=>{},
- topR: ()=>{},
- all () {
- this.tree();
- this.page();
- this.side();
- this.addEl();
- this.topR();
- }
- },
- /** read-only */ session: {
- id: "",
- data: {
- user: {
- id: "",
- username: ""
- }
- }
- },
- lsite: null,
- site: {
- id: "",
- api_url: "",
- api_prasi: {
- port: "",
- db: ""
- },
- responsive: "all",
- domain: "",
- name: "",
- js: "",
- js_compiled: ""
- },
- layout: {
- section: null,
- content: null
- },
- site_dts: "",
- page: null,
- /** content tree */ treeFlat: [],
- treeFlatTemp: [],
- treeMeta: {},
- /** components */ comp: null,
- comps: {
- pending: {},
- resolve: {},
- doc: {}
- },
- compProp: {
- backToInstance: false,
- edit: false,
- inherit: true
- },
- compDirectEdit: false,
- compLoading: {},
- compInstance: {},
- /** routing */ pagePreload: {},
- route: (0, $9hNJ9.createRouter)(),
- /** write-only */ mpage: null,
- mpageLoaded: null,
- /** connection */ ws: null,
- wsPing: -1,
- wsPingTs: 0,
- wsPingInterval: null,
- wsRetry: {
- fast: false,
- localIP: false,
- disabled: false,
- reconnecting: false
- },
- ui: {
- loading: null,
- preload: null,
- notfound: null,
- error: null
- }
-};
-
-});
-
-parcelRegister("3Hy9x", function(module, exports) {
-
-
-
-
-
-
-module.exports = Promise.all([
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("3skqg")),
- (parcelRequire("gzJBT"))((parcelRequire("5XuQH")).resolve("kdLjZ")),
- (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("dgRmX"))
-]).then(()=>parcelRequire("h08Qa"));
-
-});
-parcelRegister("gzJBT", function(module, exports) {
-"use strict";
-
-var $53O9c = parcelRequire("53O9c");
-module.exports = $53O9c(function(bundle) {
- return new Promise(function(resolve, reject) {
- // Don't insert the same link element twice (e.g. if it was already in the HTML)
- var existingLinks = document.getElementsByTagName("link");
- if ([].concat(existingLinks).some(function isCurrentBundle(link) {
- return link.href === bundle && link.rel.indexOf("stylesheet") > -1;
- })) {
- resolve();
- return;
- }
- var link = document.createElement("link");
- link.rel = "stylesheet";
- link.href = bundle;
- link.onerror = function(e) {
- link.onerror = link.onload = null;
- link.remove();
- reject(e);
- };
- link.onload = function() {
- link.onerror = link.onload = null;
- resolve();
- };
- document.getElementsByTagName("head")[0].appendChild(link);
- });
-});
-
-});
-
-
-
-})();
-//# sourceMappingURL=editor.b81cc496.js.map
diff --git a/app/web/static/editor.ed238427.js b/app/web/static/editor.ed238427.js
deleted file mode 100644
index 78909be1..00000000
--- a/app/web/static/editor.ed238427.js
+++ /dev/null
@@ -1,15259 +0,0 @@
-(() => {
-
-function $parcel$export(e, n, v, s) {
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
-}
-
-function $parcel$interopDefault(a) {
- return a && a.__esModule ? a.default : a;
-}
-
- var $parcel$global = globalThis;
- var parcelRequire = $parcel$global["parcelRequire2d1f"];
-var parcelRegister = parcelRequire.register;
-parcelRegister("KfUSb", function(module, exports) {
-
-$parcel$export(module.exports, "ErrorBox", () => $6f57cf00b9107dc2$export$f04a3ea04edc0e04);
-
-var $lAN3N = parcelRequire("lAN3N");
-
-var $6YscK = parcelRequire("6YscK");
-
-var $4WfNn = parcelRequire("4WfNn");
-
-var $eoQBx = parcelRequire("eoQBx");
-const $6f57cf00b9107dc2$export$f04a3ea04edc0e04 = (0, $6YscK.withErrorBoundary)(({ children: children, meta: meta, id: id })=>{
- const local = (0, $4WfNn.useLocal)({
- retrying: false
- });
- const [error, resetError] = (0, $6YscK.useErrorBoundary)((error, errorInfo)=>{
- console.warn(error);
- });
- let _meta = meta;
- if (id) {
- const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR");
- _meta = p.treeMeta[id];
- }
- if (error) return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "bg-red-100 border border-red-300 rounded-sm text-xs flex flex-col items-center",
- children: [
- /*#__PURE__*/ (0, $lAN3N.jsxs)("div", {
- className: "text-[10px] font-bold text-red-900 self-stretch px-1",
- children: [
- "ERROR ",
- _meta?.item.name ? "[" + _meta.item.name + "]:" : ""
- ]
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("p", {
- className: "border-b border-red-300 px-1 pb-1 min-w-[100px]",
- children: !local.retrying ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: error.message
- }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {
- children: "Retrying..."
- })
- }),
- /*#__PURE__*/ (0, $lAN3N.jsx)("div", {
- className: "p-1",
- children: /*#__PURE__*/ (0, $lAN3N.jsx)("button", {
- onClick: ()=>{
- local.retrying = true;
- local.render();
- setTimeout(()=>{
- local.retrying = false;
- local.render();
- resetError();
- }, 100);
- },
- className: "bg-white border border-white hover:border-red-400 hover:bg-red-50 rounded px-2",
- children: "Try again"
- })
- })
- ]
- });
- return children;
-});
-
-});
-parcelRegister("6YscK", function(module, exports) {
-
-$parcel$export(module.exports, "withErrorBoundary", () => $513e398b8d7c384a$export$f0c7a449e0cfaec7);
-$parcel$export(module.exports, "useErrorBoundary", () => $513e398b8d7c384a$export$c052f6604b7d51fe);
-
-var $63SH6 = parcelRequire("63SH6");
-class $513e398b8d7c384a$var$ErrorBoundary extends (0, $63SH6.Component) {
- displayName = "ReactUseErrorBoundary";
- componentDidCatch(...args) {
- this.setState({});
- this.props.onError(...args);
- }
- render() {
- return this.props.children;
- }
-}
-const $513e398b8d7c384a$var$noop = ()=>false;
-const $513e398b8d7c384a$var$errorBoundaryContext = (0, $63SH6.createContext)({
- componentDidCatch: {
- current: undefined
- },
- error: undefined,
- setError: $513e398b8d7c384a$var$noop
-});
-function $513e398b8d7c384a$export$b16d9fb1a22de840({ children: children }) {
- const [error, setError] = (0, $63SH6.useState)();
- const componentDidCatch = (0, $63SH6.useRef)();
- const ctx = (0, $63SH6.useMemo)(()=>({
- componentDidCatch: componentDidCatch,
- error: error,
- setError: setError
- }), [
- error
- ]);
- return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($513e398b8d7c384a$var$errorBoundaryContext.Provider, {
- value: ctx
- }, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($513e398b8d7c384a$var$ErrorBoundary, {
- error: error,
- onError: (error, errorInfo)=>{
- setError(error);
- componentDidCatch.current?.(error, errorInfo);
- }
- }, children));
-}
-$513e398b8d7c384a$export$b16d9fb1a22de840.displayName = "ReactUseErrorBoundaryContext";
-function $513e398b8d7c384a$export$f0c7a449e0cfaec7(WrappedComponent) {
- function WithErrorBoundary(props) {
- return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($513e398b8d7c384a$export$b16d9fb1a22de840, null, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(WrappedComponent, {
- key: "WrappedComponent",
- ...props
- }));
- }
- WithErrorBoundary.displayName = `WithErrorBoundary(${WrappedComponent.displayName ?? WrappedComponent.name ?? "Component"})`;
- return WithErrorBoundary;
-}
-function $513e398b8d7c384a$export$c052f6604b7d51fe(componentDidCatch) {
- const ctx = (0, $63SH6.useContext)($513e398b8d7c384a$var$errorBoundaryContext);
- ctx.componentDidCatch.current = componentDidCatch;
- const resetError = (0, $63SH6.useCallback)(()=>{
- ctx.setError(undefined);
- }, []);
- return [
- ctx.error,
- resetError
- ];
-}
-
-});
-
-
-parcelRegister("cc0Z8", function(module, exports) {
-
-$parcel$export(module.exports, "produceCSS", () => $a5136eecc56dd26b$export$9aa016b1e696fa5);
-
-var $97sHp = parcelRequire("97sHp");
-
-var $6h4bB = parcelRequire("6h4bB");
-
-var $4DQaz = parcelRequire("4DQaz");
-
-var $5OYrM = parcelRequire("5OYrM");
-
-var $hP8yR = parcelRequire("hP8yR");
-
-var $7aIlQ = parcelRequire("7aIlQ");
-
-var $8DV5m = parcelRequire("8DV5m");
-
-var $kXTha = parcelRequire("kXTha");
-const $a5136eecc56dd26b$export$9aa016b1e696fa5 = (item, arg)=>{
- try {
- return cx([
- css`
- display: flex;
- position: relative;
- user-select: none;
- ${(0, $8DV5m.cssLayout)(item, arg.mode)}
- ${(0, $kXTha.cssPadding)(item, arg.mode)}
- ${(0, $5OYrM.cssDimension)(item, arg.mode, arg?.editor)}
- ${(0, $4DQaz.cssBorder)(item, arg.mode)}
- ${(0, $6h4bB.cssBackground)(item, arg.mode)}
- ${(0, $7aIlQ.cssFont)(item, arg.mode)}
- `,
- (arg?.hover || arg?.active) && (0, $hP8yR.cssEditor)({
- item: item,
- hover: arg?.hover,
- active: arg?.active
- }),
- (0, $97sHp.cssAdv)(item, arg.mode)
- ]);
- } catch (e) {
- console.log(e);
- }
- return cx([]);
-};
-
-});
-parcelRegister("97sHp", function(module, exports) {
-
-$parcel$export(module.exports, "cssAdv", () => $3be87ae1f3b1a139$export$e31c5a57cedf6cc4);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $3be87ae1f3b1a139$export$e31c5a57cedf6cc4 = (cur, mode)=>{
- const adv = (0, $bjM6F.responsiveVal)(cur, "adv", mode, {});
- if (typeof adv.css === "string") {
- const hasCSS = adv.css.trim();
- if (hasCSS) return cx(css`
- ${adv.css}
- `, "cel", mode);
- }
- return "";
-};
-
-});
-parcelRegister("bjM6F", function(module, exports) {
-
-$parcel$export(module.exports, "responsiveVal", () => $6e7c56e8133f20c8$export$95f6a25db452441e);
-const $6e7c56e8133f20c8$export$95f6a25db452441e = (item, key, mode, defaultVal)=>{
- let value = item[key];
- if (mode === "desktop" || !mode) {
- if (!value && item.mobile && item.mobile[key]) value = item.mobile[key];
- } else if (item.mobile && item.mobile[key]) value = item.mobile[key];
- if (!value) value = defaultVal;
- return value;
-};
-
-});
-
-
-parcelRegister("6h4bB", function(module, exports) {
-
-$parcel$export(module.exports, "cssBackground", () => $d7ca42aaee6dc748$export$84db22eb9d90f957);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $d7ca42aaee6dc748$export$84db22eb9d90f957 = (cur, mode)=>{
- const bg = (0, $bjM6F.responsiveVal)(cur, "bg", mode, {
- size: "contain",
- pos: "center"
- });
- let bgurl = `${serverurl}${bg.url}`;
- if (bg && bg.url && bg.url.startsWith("http")) bgurl = bg.url;
- return cx(`
- background-repeat: no-repeat;
- `, bg.color && `
- background-color: ${bg.color};
- `, bg.url && typeof siteApiUrl === "string" && `
- background-image: url("${bgurl}");
- `, bg.size && `
- background-size: ${bg.size};
- `, bg.pos && `
- background-position: ${bg.pos};
- `);
-};
-
-});
-
-parcelRegister("4DQaz", function(module, exports) {
-
-$parcel$export(module.exports, "cssBorder", () => $08be68fb51c3d33e$export$ff51516858af6918);
-
-var $cfpVL = parcelRequire("cfpVL");
-
-var $bjM6F = parcelRequire("bjM6F");
-const $08be68fb51c3d33e$export$ff51516858af6918 = (cur, mode)=>{
- const border = (0, $bjM6F.responsiveVal)(cur, "border", mode, {
- style: "solid",
- stroke: {},
- rounded: {
- tr: 0,
- tl: 0,
- bl: 0,
- br: 0
- },
- color: "transparent"
- });
- return cx($08be68fb51c3d33e$var$pick(border, "stroke.l", "border-left-width"), $08be68fb51c3d33e$var$pick(border, "stroke.r", "border-right-width"), $08be68fb51c3d33e$var$pick(border, "stroke.b", "border-bottom-width"), $08be68fb51c3d33e$var$pick(border, "stroke.t", "border-top-width"), $08be68fb51c3d33e$var$pick(border, "color", "border-color", "transparent"), $08be68fb51c3d33e$var$pick(border, "style", "border-style", "dashed"), $08be68fb51c3d33e$var$pick(border, "rounded.tl", "border-top-left-radius"), $08be68fb51c3d33e$var$pick(border, "rounded.tr", "border-top-right-radius"), $08be68fb51c3d33e$var$pick(border, "rounded.bl", "border-bottom-left-radius"), $08be68fb51c3d33e$var$pick(border, "rounded.br", "border-bottom-right-radius"));
-};
-const $08be68fb51c3d33e$var$pick = (obj, key, attr, notpx)=>{
- const val = (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(obj, key);
- if (notpx) {
- if (val) return `${attr}: ${val};`;
- else return `${attr}: ${notpx};`;
- } else if (val) return `${attr}: ${val}px;`;
-};
-
-});
-parcelRegister("cfpVL", function(module, exports) {
-/**
- * lodash (Custom Build)
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */ /** Used as the `TypeError` message for "Functions" methods. */ var $024d14a53d6ce9fd$var$FUNC_ERROR_TEXT = "Expected a function";
-/** Used to stand-in for `undefined` hash values. */ var $024d14a53d6ce9fd$var$HASH_UNDEFINED = "__lodash_hash_undefined__";
-/** Used as references for various `Number` constants. */ var $024d14a53d6ce9fd$var$INFINITY = 1 / 0;
-/** `Object#toString` result references. */ var $024d14a53d6ce9fd$var$funcTag = "[object Function]", $024d14a53d6ce9fd$var$genTag = "[object GeneratorFunction]", $024d14a53d6ce9fd$var$symbolTag = "[object Symbol]";
-/** Used to match property names within property paths. */ var $024d14a53d6ce9fd$var$reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $024d14a53d6ce9fd$var$reIsPlainProp = /^\w*$/, $024d14a53d6ce9fd$var$reLeadingDot = /^\./, $024d14a53d6ce9fd$var$rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */ var $024d14a53d6ce9fd$var$reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to match backslashes in property paths. */ var $024d14a53d6ce9fd$var$reEscapeChar = /\\(\\)?/g;
-/** Used to detect host constructors (Safari). */ var $024d14a53d6ce9fd$var$reIsHostCtor = /^\[object .+?Constructor\]$/;
-/** Detect free variable `global` from Node.js. */ var $024d14a53d6ce9fd$var$freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global;
-/** Detect free variable `self`. */ var $024d14a53d6ce9fd$var$freeSelf = typeof self == "object" && self && self.Object === Object && self;
-/** Used as a reference to the global object. */ var $024d14a53d6ce9fd$var$root = $024d14a53d6ce9fd$var$freeGlobal || $024d14a53d6ce9fd$var$freeSelf || Function("return this")();
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */ function $024d14a53d6ce9fd$var$getValue(object, key) {
- return object == null ? undefined : object[key];
-}
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */ function $024d14a53d6ce9fd$var$isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != "function") try {
- result = !!(value + "");
- } catch (e) {}
- return result;
-}
-/** Used for built-in method references. */ var $024d14a53d6ce9fd$var$arrayProto = Array.prototype, $024d14a53d6ce9fd$var$funcProto = Function.prototype, $024d14a53d6ce9fd$var$objectProto = Object.prototype;
-/** Used to detect overreaching core-js shims. */ var $024d14a53d6ce9fd$var$coreJsData = $024d14a53d6ce9fd$var$root["__core-js_shared__"];
-/** Used to detect methods masquerading as native. */ var $024d14a53d6ce9fd$var$maskSrcKey = function() {
- var uid = /[^.]+$/.exec($024d14a53d6ce9fd$var$coreJsData && $024d14a53d6ce9fd$var$coreJsData.keys && $024d14a53d6ce9fd$var$coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
-}();
-/** Used to resolve the decompiled source of functions. */ var $024d14a53d6ce9fd$var$funcToString = $024d14a53d6ce9fd$var$funcProto.toString;
-/** Used to check objects for own properties. */ var $024d14a53d6ce9fd$var$hasOwnProperty = $024d14a53d6ce9fd$var$objectProto.hasOwnProperty;
-/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */ var $024d14a53d6ce9fd$var$objectToString = $024d14a53d6ce9fd$var$objectProto.toString;
-/** Used to detect if a method is native. */ var $024d14a53d6ce9fd$var$reIsNative = RegExp("^" + $024d14a53d6ce9fd$var$funcToString.call($024d14a53d6ce9fd$var$hasOwnProperty).replace($024d14a53d6ce9fd$var$reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
-/** Built-in value references. */ var $024d14a53d6ce9fd$var$Symbol = $024d14a53d6ce9fd$var$root.Symbol, $024d14a53d6ce9fd$var$splice = $024d14a53d6ce9fd$var$arrayProto.splice;
-/* Built-in method references that are verified to be native. */ var $024d14a53d6ce9fd$var$Map = $024d14a53d6ce9fd$var$getNative($024d14a53d6ce9fd$var$root, "Map"), $024d14a53d6ce9fd$var$nativeCreate = $024d14a53d6ce9fd$var$getNative(Object, "create");
-/** Used to convert symbols to primitives and strings. */ var $024d14a53d6ce9fd$var$symbolProto = $024d14a53d6ce9fd$var$Symbol ? $024d14a53d6ce9fd$var$Symbol.prototype : undefined, $024d14a53d6ce9fd$var$symbolToString = $024d14a53d6ce9fd$var$symbolProto ? $024d14a53d6ce9fd$var$symbolProto.toString : undefined;
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $024d14a53d6ce9fd$var$Hash(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */ function $024d14a53d6ce9fd$var$hashClear() {
- this.__data__ = $024d14a53d6ce9fd$var$nativeCreate ? $024d14a53d6ce9fd$var$nativeCreate(null) : {};
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $024d14a53d6ce9fd$var$hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
-}
-/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $024d14a53d6ce9fd$var$hashGet(key) {
- var data = this.__data__;
- if ($024d14a53d6ce9fd$var$nativeCreate) {
- var result = data[key];
- return result === $024d14a53d6ce9fd$var$HASH_UNDEFINED ? undefined : result;
- }
- return $024d14a53d6ce9fd$var$hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $024d14a53d6ce9fd$var$hashHas(key) {
- var data = this.__data__;
- return $024d14a53d6ce9fd$var$nativeCreate ? data[key] !== undefined : $024d14a53d6ce9fd$var$hasOwnProperty.call(data, key);
-}
-/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */ function $024d14a53d6ce9fd$var$hashSet(key, value) {
- var data = this.__data__;
- data[key] = $024d14a53d6ce9fd$var$nativeCreate && value === undefined ? $024d14a53d6ce9fd$var$HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-$024d14a53d6ce9fd$var$Hash.prototype.clear = $024d14a53d6ce9fd$var$hashClear;
-$024d14a53d6ce9fd$var$Hash.prototype["delete"] = $024d14a53d6ce9fd$var$hashDelete;
-$024d14a53d6ce9fd$var$Hash.prototype.get = $024d14a53d6ce9fd$var$hashGet;
-$024d14a53d6ce9fd$var$Hash.prototype.has = $024d14a53d6ce9fd$var$hashHas;
-$024d14a53d6ce9fd$var$Hash.prototype.set = $024d14a53d6ce9fd$var$hashSet;
-/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $024d14a53d6ce9fd$var$ListCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */ function $024d14a53d6ce9fd$var$listCacheClear() {
- this.__data__ = [];
-}
-/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $024d14a53d6ce9fd$var$listCacheDelete(key) {
- var data = this.__data__, index = $024d14a53d6ce9fd$var$assocIndexOf(data, key);
- if (index < 0) return false;
- var lastIndex = data.length - 1;
- if (index == lastIndex) data.pop();
- else $024d14a53d6ce9fd$var$splice.call(data, index, 1);
- return true;
-}
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $024d14a53d6ce9fd$var$listCacheGet(key) {
- var data = this.__data__, index = $024d14a53d6ce9fd$var$assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
-}
-/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $024d14a53d6ce9fd$var$listCacheHas(key) {
- return $024d14a53d6ce9fd$var$assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */ function $024d14a53d6ce9fd$var$listCacheSet(key, value) {
- var data = this.__data__, index = $024d14a53d6ce9fd$var$assocIndexOf(data, key);
- if (index < 0) data.push([
- key,
- value
- ]);
- else data[index][1] = value;
- return this;
-}
-// Add methods to `ListCache`.
-$024d14a53d6ce9fd$var$ListCache.prototype.clear = $024d14a53d6ce9fd$var$listCacheClear;
-$024d14a53d6ce9fd$var$ListCache.prototype["delete"] = $024d14a53d6ce9fd$var$listCacheDelete;
-$024d14a53d6ce9fd$var$ListCache.prototype.get = $024d14a53d6ce9fd$var$listCacheGet;
-$024d14a53d6ce9fd$var$ListCache.prototype.has = $024d14a53d6ce9fd$var$listCacheHas;
-$024d14a53d6ce9fd$var$ListCache.prototype.set = $024d14a53d6ce9fd$var$listCacheSet;
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */ function $024d14a53d6ce9fd$var$MapCache(entries) {
- var index = -1, length = entries ? entries.length : 0;
- this.clear();
- while(++index < length){
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */ function $024d14a53d6ce9fd$var$mapCacheClear() {
- this.__data__ = {
- "hash": new $024d14a53d6ce9fd$var$Hash,
- "map": new ($024d14a53d6ce9fd$var$Map || $024d14a53d6ce9fd$var$ListCache),
- "string": new $024d14a53d6ce9fd$var$Hash
- };
-}
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */ function $024d14a53d6ce9fd$var$mapCacheDelete(key) {
- return $024d14a53d6ce9fd$var$getMapData(this, key)["delete"](key);
-}
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */ function $024d14a53d6ce9fd$var$mapCacheGet(key) {
- return $024d14a53d6ce9fd$var$getMapData(this, key).get(key);
-}
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */ function $024d14a53d6ce9fd$var$mapCacheHas(key) {
- return $024d14a53d6ce9fd$var$getMapData(this, key).has(key);
-}
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */ function $024d14a53d6ce9fd$var$mapCacheSet(key, value) {
- $024d14a53d6ce9fd$var$getMapData(this, key).set(key, value);
- return this;
-}
-// Add methods to `MapCache`.
-$024d14a53d6ce9fd$var$MapCache.prototype.clear = $024d14a53d6ce9fd$var$mapCacheClear;
-$024d14a53d6ce9fd$var$MapCache.prototype["delete"] = $024d14a53d6ce9fd$var$mapCacheDelete;
-$024d14a53d6ce9fd$var$MapCache.prototype.get = $024d14a53d6ce9fd$var$mapCacheGet;
-$024d14a53d6ce9fd$var$MapCache.prototype.has = $024d14a53d6ce9fd$var$mapCacheHas;
-$024d14a53d6ce9fd$var$MapCache.prototype.set = $024d14a53d6ce9fd$var$mapCacheSet;
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */ function $024d14a53d6ce9fd$var$assocIndexOf(array, key) {
- var length = array.length;
- while(length--){
- if ($024d14a53d6ce9fd$var$eq(array[length][0], key)) return length;
- }
- return -1;
-}
-/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */ function $024d14a53d6ce9fd$var$baseGet(object, path) {
- path = $024d14a53d6ce9fd$var$isKey(path, object) ? [
- path
- ] : $024d14a53d6ce9fd$var$castPath(path);
- var index = 0, length = path.length;
- while(object != null && index < length)object = object[$024d14a53d6ce9fd$var$toKey(path[index++])];
- return index && index == length ? object : undefined;
-}
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */ function $024d14a53d6ce9fd$var$baseIsNative(value) {
- if (!$024d14a53d6ce9fd$var$isObject(value) || $024d14a53d6ce9fd$var$isMasked(value)) return false;
- var pattern = $024d14a53d6ce9fd$var$isFunction(value) || $024d14a53d6ce9fd$var$isHostObject(value) ? $024d14a53d6ce9fd$var$reIsNative : $024d14a53d6ce9fd$var$reIsHostCtor;
- return pattern.test($024d14a53d6ce9fd$var$toSource(value));
-}
-/**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */ function $024d14a53d6ce9fd$var$baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == "string") return value;
- if ($024d14a53d6ce9fd$var$isSymbol(value)) return $024d14a53d6ce9fd$var$symbolToString ? $024d14a53d6ce9fd$var$symbolToString.call(value) : "";
- var result = value + "";
- return result == "0" && 1 / value == -$024d14a53d6ce9fd$var$INFINITY ? "-0" : result;
-}
-/**
- * Casts `value` to a path array if it's not one.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Array} Returns the cast property path array.
- */ function $024d14a53d6ce9fd$var$castPath(value) {
- return $024d14a53d6ce9fd$var$isArray(value) ? value : $024d14a53d6ce9fd$var$stringToPath(value);
-}
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */ function $024d14a53d6ce9fd$var$getMapData(map, key) {
- var data = map.__data__;
- return $024d14a53d6ce9fd$var$isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
-}
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */ function $024d14a53d6ce9fd$var$getNative(object, key) {
- var value = $024d14a53d6ce9fd$var$getValue(object, key);
- return $024d14a53d6ce9fd$var$baseIsNative(value) ? value : undefined;
-}
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */ function $024d14a53d6ce9fd$var$isKey(value, object) {
- if ($024d14a53d6ce9fd$var$isArray(value)) return false;
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || $024d14a53d6ce9fd$var$isSymbol(value)) return true;
- return $024d14a53d6ce9fd$var$reIsPlainProp.test(value) || !$024d14a53d6ce9fd$var$reIsDeepProp.test(value) || object != null && value in Object(object);
-}
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */ function $024d14a53d6ce9fd$var$isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
-}
-/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */ function $024d14a53d6ce9fd$var$isMasked(func) {
- return !!$024d14a53d6ce9fd$var$maskSrcKey && $024d14a53d6ce9fd$var$maskSrcKey in func;
-}
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */ var $024d14a53d6ce9fd$var$stringToPath = $024d14a53d6ce9fd$var$memoize(function(string) {
- string = $024d14a53d6ce9fd$var$toString(string);
- var result = [];
- if ($024d14a53d6ce9fd$var$reLeadingDot.test(string)) result.push("");
- string.replace($024d14a53d6ce9fd$var$rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace($024d14a53d6ce9fd$var$reEscapeChar, "$1") : number || match);
- });
- return result;
-});
-/**
- * Converts `value` to a string key if it's not a string or symbol.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {string|symbol} Returns the key.
- */ function $024d14a53d6ce9fd$var$toKey(value) {
- if (typeof value == "string" || $024d14a53d6ce9fd$var$isSymbol(value)) return value;
- var result = value + "";
- return result == "0" && 1 / value == -$024d14a53d6ce9fd$var$INFINITY ? "-0" : result;
-}
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */ function $024d14a53d6ce9fd$var$toSource(func) {
- if (func != null) {
- try {
- return $024d14a53d6ce9fd$var$funcToString.call(func);
- } catch (e) {}
- try {
- return func + "";
- } catch (e) {}
- }
- return "";
-}
-/**
- * Creates a function that memoizes the result of `func`. If `resolver` is
- * provided, it determines the cache key for storing the result based on the
- * arguments provided to the memoized function. By default, the first argument
- * provided to the memoized function is used as the map cache key. The `func`
- * is invoked with the `this` binding of the memoized function.
- *
- * **Note:** The cache is exposed as the `cache` property on the memoized
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
- * method interface of `delete`, `get`, `has`, and `set`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to have its output memoized.
- * @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoized function.
- * @example
- *
- * var object = { 'a': 1, 'b': 2 };
- * var other = { 'c': 3, 'd': 4 };
- *
- * var values = _.memoize(_.values);
- * values(object);
- * // => [1, 2]
- *
- * values(other);
- * // => [3, 4]
- *
- * object.a = 2;
- * values(object);
- * // => [1, 2]
- *
- * // Modify the result cache.
- * values.cache.set(object, ['a', 'b']);
- * values(object);
- * // => ['a', 'b']
- *
- * // Replace `_.memoize.Cache`.
- * _.memoize.Cache = WeakMap;
- */ function $024d14a53d6ce9fd$var$memoize(func, resolver) {
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError($024d14a53d6ce9fd$var$FUNC_ERROR_TEXT);
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) return cache.get(key);
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result);
- return result;
- };
- memoized.cache = new ($024d14a53d6ce9fd$var$memoize.Cache || $024d14a53d6ce9fd$var$MapCache);
- return memoized;
-}
-// Assign cache to `_.memoize`.
-$024d14a53d6ce9fd$var$memoize.Cache = $024d14a53d6ce9fd$var$MapCache;
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */ function $024d14a53d6ce9fd$var$eq(value, other) {
- return value === other || value !== value && other !== other;
-}
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */ var $024d14a53d6ce9fd$var$isArray = Array.isArray;
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */ function $024d14a53d6ce9fd$var$isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = $024d14a53d6ce9fd$var$isObject(value) ? $024d14a53d6ce9fd$var$objectToString.call(value) : "";
- return tag == $024d14a53d6ce9fd$var$funcTag || tag == $024d14a53d6ce9fd$var$genTag;
-}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */ function $024d14a53d6ce9fd$var$isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
-}
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */ function $024d14a53d6ce9fd$var$isObjectLike(value) {
- return !!value && typeof value == "object";
-}
-/**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */ function $024d14a53d6ce9fd$var$isSymbol(value) {
- return typeof value == "symbol" || $024d14a53d6ce9fd$var$isObjectLike(value) && $024d14a53d6ce9fd$var$objectToString.call(value) == $024d14a53d6ce9fd$var$symbolTag;
-}
-/**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */ function $024d14a53d6ce9fd$var$toString(value) {
- return value == null ? "" : $024d14a53d6ce9fd$var$baseToString(value);
-}
-/**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is returned in its place.
- *
- * @static
- * @memberOf _
- * @since 3.7.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */ function $024d14a53d6ce9fd$var$get(object, path, defaultValue) {
- var result = object == null ? undefined : $024d14a53d6ce9fd$var$baseGet(object, path);
- return result === undefined ? defaultValue : result;
-}
-module.exports = $024d14a53d6ce9fd$var$get;
-
-});
-
-
-parcelRegister("5OYrM", function(module, exports) {
-
-$parcel$export(module.exports, "cssDimension", () => $e97d39c9eeea8f30$export$8332787d62a8b259);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $e97d39c9eeea8f30$export$8332787d62a8b259 = (cur, mode, editor)=>{
- const dim = (0, $bjM6F.responsiveVal)(cur, "dim", mode, {
- h: "fit",
- w: "fit"
- });
- if (dim.w === "full" && dim.h === "full") return `
- width:100%;
- height:100%;
- flex:1;
- `;
- return cx(dim.w === "fit" && `
- & > .txt-box > * {
- white-space: nowrap !important;
- }
- `, dim.w === "full" && `
- width: 100%;
- `, dim.w && typeof dim.w === "number" && dim.w >= 0 && `
- width: ${dim.w}${dim.wUnit || "px"};
- overflow-x: clip;
- `, dim.h === "full" && `
- height: ${editor ? "100%" : "100" + (cur.type === "section" ? mode === "mobile" ? "vh" : "vh" : "%")};
- margin-bottom: auto;
- `, dim.h && typeof dim.h === "number" && dim.h >= 0 && `
- height: ${dim.h}${dim.hUnit || "px"};
- overflow-y: clip;
- `);
-};
-
-});
-
-parcelRegister("hP8yR", function(module, exports) {
-
-$parcel$export(module.exports, "cssEditor", () => $030198a0121d3861$export$e95d45482966d82e);
-const $030198a0121d3861$export$e95d45482966d82e = ({ item: item, hover: hover, active: active })=>{
- return cx(hover && css`
- & {
- box-shadow: inset 0 0 0px 3px #bae3fd;
- > img {
- opacity: 0.6;
- }
- }
- `, active && css`
- box-shadow: inset 0 0 0px 2px #009cff !important;
- > img {
- opacity: 0.6;
- }
- `);
-};
-
-});
-
-parcelRegister("7aIlQ", function(module, exports) {
-
-$parcel$export(module.exports, "cssFont", () => $fcd82c898ee5312d$export$d123feaf05ec1c83);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $fcd82c898ee5312d$export$47010e6cb2852826 = window;
-const $fcd82c898ee5312d$export$d123feaf05ec1c83 = (cur, mode)=>{
- const font = (0, $bjM6F.responsiveVal)(cur, "font", mode, {});
- if (font.family) {
- if (!$fcd82c898ee5312d$export$47010e6cb2852826.loadedFonts) $fcd82c898ee5312d$export$47010e6cb2852826.loadedFonts = [];
- const weight = `:wght@${[
- 300,
- 400,
- 500,
- 600
- ].join(";")}`;
- const fontName = font.family.replace(/ /g, "+");
- if ($fcd82c898ee5312d$export$47010e6cb2852826.loadedFonts.indexOf(font.family) < 0) {
- $fcd82c898ee5312d$export$47010e6cb2852826.loadedFonts.push(font.family);
- const doc = document;
- const _href = `https://fonts.googleapis.com/css2?family=${fontName}${weight}&display=block`;
- if (!doc.querySelector(`link[href="${_href}]`)) {
- const link = doc.createElement("link");
- link.type = "text/css";
- link.rel = "stylesheet";
- link.href = _href;
- doc.head.appendChild(link);
- }
- }
- }
- if (!font.family && $fcd82c898ee5312d$export$47010e6cb2852826.defaultFont) font.family = $fcd82c898ee5312d$export$47010e6cb2852826.defaultFont;
- return cx(font.color && `
- color: ${font.color};
- `, `
- word-break: ${font.whitespace === "whitespace-normal" ? "break-word" : "normal"};
- `, font.color && `
- color: ${font.color};
- `, `
- text-align: ${font.align ? font.align : "left"};
- `, font.size && `
- font-size: ${font.size || 15}px;
- `, font.height && `
- line-height: ${font.height === "auto" ? "normal" : `${font.height}%`};
- `, font.family && `
- font-family: ${font.family};
- `);
-};
-
-});
-
-parcelRegister("8DV5m", function(module, exports) {
-
-$parcel$export(module.exports, "cssLayout", () => $d5c91ba13c38aefc$export$5c677b0cb632cad);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $d5c91ba13c38aefc$export$5c677b0cb632cad = (cur, mode)=>{
- const result = [];
- let layout = (0, $bjM6F.responsiveVal)(cur, "layout", mode, {
- dir: "col",
- align: "top-left",
- gap: 0,
- wrap: undefined
- });
- if (layout) {
- if (layout.wrap) result.push(layout.wrap === "flex-wrap" ? "flex-wrap: wrap;" : "flex-wrap: nowrap;");
- if (layout.dir.startsWith("col")) {
- if (layout.dir === "col") result.push("flex-direction: column;");
- else if (layout.dir === "col-reverse") result.push("flex-direction: column-reverse;");
- if (layout.gap === "auto") {
- if (layout.align === "left") result.push("align-items:start; justify-content: space-between;");
- if (layout.align === "center") result.push("align-items:center; justify-content: space-between;");
- if (layout.align === "right") result.push("align-items:end; justify-content: space-between;");
- } else {
- result.push(`gap: ${layout.gap}px;`);
- if (layout.align === "top-left") result.push("align-items:start; justify-content: start;");
- if (layout.align === "top-center") result.push("align-items:center; justify-content: start;");
- if (layout.align === "top-right") result.push("align-items:end; justify-content: start;");
- if (layout.align === "left") result.push("align-items:start; justify-content: center;");
- if (layout.align === "center") result.push("align-items:center; justify-content: center;");
- if (layout.align === "right") result.push("align-items:end; justify-content: center;");
- if (layout.align === "bottom-left") result.push("align-items:start; justify-content: end;");
- if (layout.align === "bottom-center") result.push("align-items:center; justify-content: end;");
- if (layout.align === "bottom-right") result.push("align-items:end; justify-content: end;");
- }
- } else {
- if (layout.dir === "row") result.push("flex-direction: row;");
- else if (layout.dir === "row-reverse") result.push("flex-direction: row-reverse;");
- if (layout.gap === "auto") {
- if (layout.align === "top") result.push("align-items:start; justify-content: space-between;");
- if (layout.align === "center") result.push("align-items:center; justify-content: space-between;");
- if (layout.align === "bottom") result.push("align-items:end; justify-content: space-between;");
- } else {
- result.push(`
- gap: ${layout.gap}px;
- `);
- if (layout.align === "top-left") result.push("align-items:start; justify-content: start;");
- if (layout.align === "top-center") result.push("align-items:start; justify-content: center;");
- if (layout.align === "top-right") result.push("align-items:start; justify-content: end;");
- if (layout.align === "left") result.push("align-items:center; justify-content: start;");
- if (layout.align === "center") result.push("align-items:center; justify-content: center;");
- if (layout.align === "right") result.push("align-items:center; justify-content: end;");
- if (layout.align === "bottom-left") result.push("align-items:end; justify-content: start;");
- if (layout.align === "bottom-center") result.push("align-items:end; justify-content: center;");
- if (layout.align === "bottom-right") result.push("align-items:end; justify-content: end;");
- }
- }
- } else return "flex-direction:column; align-items:start; justify-content: start;";
- return result.join("\n ").trim();
-};
-
-});
-
-parcelRegister("kXTha", function(module, exports) {
-
-$parcel$export(module.exports, "cssPadding", () => $ed2a90866c5a1750$export$e9df5348ba4716b1);
-
-var $bjM6F = parcelRequire("bjM6F");
-const $ed2a90866c5a1750$export$e9df5348ba4716b1 = (cur, mode)=>{
- const padding = (0, $bjM6F.responsiveVal)(cur, "padding", mode, {
- l: 0,
- b: 0,
- t: 0,
- r: 0
- });
- return cx(padding.l !== undefined && `
- padding-left: ${padding.l}px;
- `, padding.r !== undefined && `
- padding-right: ${padding.r}px;
- `, padding.b !== undefined && `
- padding-bottom: ${padding.b}px;
- `, padding.t !== undefined && `
- padding-top: ${padding.t}px;
- `);
-};
-
-});
-
-
-parcelRegister("aVHaH", function(module, exports) {
-
-$parcel$export(module.exports, "Doc", () => $52a83e33f2b9e935$export$bceacc74c2212615);
-$parcel$export(module.exports, "Array", () => $52a83e33f2b9e935$export$c4be6576ca6fe4aa);
-$parcel$export(module.exports, "Text", () => $52a83e33f2b9e935$export$5f1af8db9871e1d6);
-$parcel$export(module.exports, "Map", () => $52a83e33f2b9e935$export$a5c7b93649eaf8f8);
-$parcel$export(module.exports, "applyUpdate", () => $52a83e33f2b9e935$export$c271737a9c02e925);
-$parcel$export(module.exports, "encodeStateAsUpdate", () => $52a83e33f2b9e935$export$e5848df80e65bd53);
-$parcel$export(module.exports, "encodeStateVector", () => $52a83e33f2b9e935$export$3e2f5393f32e71f);
-
-var $9XqiC = parcelRequire("9XqiC");
-
-var $7sfdv = parcelRequire("7sfdv");
-
-var $kuitL = parcelRequire("kuitL");
-
-var $e6DQe = parcelRequire("e6DQe");
-
-var $1p1sv = parcelRequire("1p1sv");
-
-var $f5RS8 = parcelRequire("f5RS8");
-
-var $TGOcE = parcelRequire("TGOcE");
-
-var $jKNqA = parcelRequire("jKNqA");
-
-var $lB8LX = parcelRequire("lB8LX");
-
-var $akmFO = parcelRequire("akmFO");
-
-var $1GdQd = parcelRequire("1GdQd");
-
-var $kXTKb = parcelRequire("kXTKb");
-
-var $gB6ZU = parcelRequire("gB6ZU");
-
-var $dcfNU = parcelRequire("dcfNU");
-var $7i7Pw = parcelRequire("7i7Pw");
-
-var $1oyOX = parcelRequire("1oyOX");
-
-var $6rcMi = parcelRequire("6rcMi");
-
-var $aP2RX = parcelRequire("aP2RX");
-
-var $97qUn = parcelRequire("97qUn");
-/**
- * This is an abstract interface that all Connectors should implement to keep them interchangeable.
- *
- * @note This interface is experimental and it is not advised to actually inherit this class.
- * It just serves as typing information.
- *
- * @extends {Observable}
- */ class $52a83e33f2b9e935$export$c3faceeb92aa39dd extends (0, $9XqiC.Observable) {
- /**
- * @param {Doc} ydoc
- * @param {any} awareness
- */ constructor(ydoc, awareness){
- super();
- this.doc = ydoc;
- this.awareness = awareness;
- }
-}
-class $52a83e33f2b9e935$var$DeleteItem {
- /**
- * @param {number} clock
- * @param {number} len
- */ constructor(clock, len){
- /**
- * @type {number}
- */ this.clock = clock;
- /**
- * @type {number}
- */ this.len = len;
- }
-}
-/**
- * We no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed.
- * - When created in a transaction, it must only be accessed after sorting, and merging
- * - This DeleteSet is send to other clients
- * - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore
- * - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged.
- */ class $52a83e33f2b9e935$var$DeleteSet {
- constructor(){
- /**
- * @type {Map>}
- */ this.clients = new Map();
- }
-}
-/**
- * Iterate over all structs that the DeleteSet gc's.
- *
- * @param {Transaction} transaction
- * @param {DeleteSet} ds
- * @param {function(GC|Item):void} f
- *
- * @function
- */ const $52a83e33f2b9e935$export$8afefebbaf4e4c78 = (transaction, ds, f)=>ds.clients.forEach((deletes, clientid)=>{
- const structs = /** @type {Array} */ transaction.doc.store.clients.get(clientid);
- for(let i = 0; i < deletes.length; i++){
- const del = deletes[i];
- $52a83e33f2b9e935$var$iterateStructs(transaction, structs, del.clock, del.len, f);
- }
- });
-/**
- * @param {Array} dis
- * @param {number} clock
- * @return {number|null}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$findIndexDS = (dis, clock)=>{
- let left = 0;
- let right = dis.length - 1;
- while(left <= right){
- const midindex = $kuitL.floor((left + right) / 2);
- const mid = dis[midindex];
- const midclock = mid.clock;
- if (midclock <= clock) {
- if (clock < midclock + mid.len) return midindex;
- left = midindex + 1;
- } else right = midindex - 1;
- }
- return null;
-};
-/**
- * @param {DeleteSet} ds
- * @param {ID} id
- * @return {boolean}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$dcb04af092e44fde = (ds, id)=>{
- const dis = ds.clients.get(id.client);
- return dis !== undefined && $52a83e33f2b9e935$var$findIndexDS(dis, id.clock) !== null;
-};
-/**
- * @param {DeleteSet} ds
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$sortAndMergeDeleteSet = (ds)=>{
- ds.clients.forEach((dels)=>{
- dels.sort((a, b)=>a.clock - b.clock);
- // merge items without filtering or splicing the array
- // i is the current pointer
- // j refers to the current insert position for the pointed item
- // try to merge dels[i] into dels[j-1] or set dels[j]=dels[i]
- let i, j;
- for(i = 1, j = 1; i < dels.length; i++){
- const left = dels[j - 1];
- const right = dels[i];
- if (left.clock + left.len >= right.clock) left.len = $kuitL.max(left.len, right.clock + right.len - left.clock);
- else {
- if (j < i) dels[j] = right;
- j++;
- }
- }
- dels.length = j;
- });
-};
-/**
- * @param {Array} dss
- * @return {DeleteSet} A fresh DeleteSet
- */ const $52a83e33f2b9e935$var$mergeDeleteSets = (dss)=>{
- const merged = new $52a83e33f2b9e935$var$DeleteSet();
- for(let dssI = 0; dssI < dss.length; dssI++)dss[dssI].clients.forEach((delsLeft, client)=>{
- if (!merged.clients.has(client)) {
- // Write all missing keys from current ds and all following.
- // If merged already contains `client` current ds has already been added.
- /**
- * @type {Array}
- */ const dels = delsLeft.slice();
- for(let i = dssI + 1; i < dss.length; i++)$7sfdv.appendTo(dels, dss[i].clients.get(client) || []);
- merged.clients.set(client, dels);
- }
- });
- $52a83e33f2b9e935$var$sortAndMergeDeleteSet(merged);
- return merged;
-};
-/**
- * @param {DeleteSet} ds
- * @param {number} client
- * @param {number} clock
- * @param {number} length
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$addToDeleteSet = (ds, client, clock, length)=>{
- $e6DQe.setIfUndefined(ds.clients, client, ()=>/** @type {Array} */ []).push(new $52a83e33f2b9e935$var$DeleteItem(clock, length));
-};
-const $52a83e33f2b9e935$export$8cbac0d946238699 = ()=>new $52a83e33f2b9e935$var$DeleteSet();
-/**
- * @param {StructStore} ss
- * @return {DeleteSet} Merged and sorted DeleteSet
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$8450d668bec558e2 = (ss)=>{
- const ds = $52a83e33f2b9e935$export$8cbac0d946238699();
- ss.clients.forEach((structs, client)=>{
- /**
- * @type {Array}
- */ const dsitems = [];
- for(let i = 0; i < structs.length; i++){
- const struct = structs[i];
- if (struct.deleted) {
- const clock = struct.id.clock;
- let len = struct.length;
- if (i + 1 < structs.length) for(let next = structs[i + 1]; i + 1 < structs.length && next.deleted; next = structs[++i + 1])len += next.length;
- dsitems.push(new $52a83e33f2b9e935$var$DeleteItem(clock, len));
- }
- }
- if (dsitems.length > 0) ds.clients.set(client, dsitems);
- });
- return ds;
-};
-/**
- * @param {DSEncoderV1 | DSEncoderV2} encoder
- * @param {DeleteSet} ds
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$writeDeleteSet = (encoder, ds)=>{
- $1p1sv.writeVarUint(encoder.restEncoder, ds.clients.size);
- // Ensure that the delete set is written in a deterministic order
- $7sfdv.from(ds.clients.entries()).sort((a, b)=>b[0] - a[0]).forEach(([client, dsitems])=>{
- encoder.resetDsCurVal();
- $1p1sv.writeVarUint(encoder.restEncoder, client);
- const len = dsitems.length;
- $1p1sv.writeVarUint(encoder.restEncoder, len);
- for(let i = 0; i < len; i++){
- const item = dsitems[i];
- encoder.writeDsClock(item.clock);
- encoder.writeDsLen(item.len);
- }
- });
-};
-/**
- * @param {DSDecoderV1 | DSDecoderV2} decoder
- * @return {DeleteSet}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$readDeleteSet = (decoder)=>{
- const ds = new $52a83e33f2b9e935$var$DeleteSet();
- const numClients = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < numClients; i++){
- decoder.resetDsCurVal();
- const client = $f5RS8.readVarUint(decoder.restDecoder);
- const numberOfDeletes = $f5RS8.readVarUint(decoder.restDecoder);
- if (numberOfDeletes > 0) {
- const dsField = $e6DQe.setIfUndefined(ds.clients, client, ()=>/** @type {Array} */ []);
- for(let i = 0; i < numberOfDeletes; i++)dsField.push(new $52a83e33f2b9e935$var$DeleteItem(decoder.readDsClock(), decoder.readDsLen()));
- }
- }
- return ds;
-};
-/**
- * @todo YDecoder also contains references to String and other Decoders. Would make sense to exchange YDecoder.toUint8Array for YDecoder.DsToUint8Array()..
- */ /**
- * @param {DSDecoderV1 | DSDecoderV2} decoder
- * @param {Transaction} transaction
- * @param {StructStore} store
- * @return {Uint8Array|null} Returns a v2 update containing all deletes that couldn't be applied yet; or null if all deletes were applied successfully.
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$readAndApplyDeleteSet = (decoder, transaction, store)=>{
- const unappliedDS = new $52a83e33f2b9e935$var$DeleteSet();
- const numClients = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < numClients; i++){
- decoder.resetDsCurVal();
- const client = $f5RS8.readVarUint(decoder.restDecoder);
- const numberOfDeletes = $f5RS8.readVarUint(decoder.restDecoder);
- const structs = store.clients.get(client) || [];
- const state = $52a83e33f2b9e935$export$50fdfeece43146fd(store, client);
- for(let i = 0; i < numberOfDeletes; i++){
- const clock = decoder.readDsClock();
- const clockEnd = clock + decoder.readDsLen();
- if (clock < state) {
- if (state < clockEnd) $52a83e33f2b9e935$var$addToDeleteSet(unappliedDS, client, state, clockEnd - state);
- let index = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, clock);
- /**
- * We can ignore the case of GC and Delete structs, because we are going to skip them
- * @type {Item}
- */ // @ts-ignore
- let struct = structs[index];
- // split the first item if necessary
- if (!struct.deleted && struct.id.clock < clock) {
- structs.splice(index + 1, 0, $52a83e33f2b9e935$var$splitItem(transaction, struct, clock - struct.id.clock));
- index++; // increase we now want to use the next struct
- }
- while(index < structs.length){
- // @ts-ignore
- struct = structs[index++];
- if (struct.id.clock < clockEnd) {
- if (!struct.deleted) {
- if (clockEnd < struct.id.clock + struct.length) structs.splice(index, 0, $52a83e33f2b9e935$var$splitItem(transaction, struct, clockEnd - struct.id.clock));
- struct.delete(transaction);
- }
- } else break;
- }
- } else $52a83e33f2b9e935$var$addToDeleteSet(unappliedDS, client, clock, clockEnd - clock);
- }
- }
- if (unappliedDS.clients.size > 0) {
- const ds = new $52a83e33f2b9e935$var$UpdateEncoderV2();
- $1p1sv.writeVarUint(ds.restEncoder, 0); // encode 0 structs
- $52a83e33f2b9e935$var$writeDeleteSet(ds, unappliedDS);
- return ds.toUint8Array();
- }
- return null;
-};
-/**
- * @param {DeleteSet} ds1
- * @param {DeleteSet} ds2
- */ const $52a83e33f2b9e935$export$9697b72c46fd3a5d = (ds1, ds2)=>{
- if (ds1.clients.size !== ds2.clients.size) return false;
- for (const [client, deleteItems1] of ds1.clients.entries()){
- const deleteItems2 = /** @type {Array} */ ds2.clients.get(client);
- if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false;
- for(let i = 0; i < deleteItems1.length; i++){
- const di1 = deleteItems1[i];
- const di2 = deleteItems2[i];
- if (di1.clock !== di2.clock || di1.len !== di2.len) return false;
- }
- }
- return true;
-};
-/**
- * @module Y
- */ const $52a83e33f2b9e935$var$generateNewClientId = $TGOcE.uint32;
-/**
- * @typedef {Object} DocOpts
- * @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true)
- * @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.
- * @property {string} [DocOpts.guid] Define a globally unique identifier for this document
- * @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection.
- * @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.
- * @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.
- * @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()
- */ /**
- * A Yjs instance handles the state of shared data.
- * @extends Observable
- */ class $52a83e33f2b9e935$export$bceacc74c2212615 extends (0, $9XqiC.Observable) {
- /**
- * @param {DocOpts} opts configuration
- */ constructor({ guid: guid = $TGOcE.uuidv4(), collectionid: collectionid = null, gc: gc = true, gcFilter: gcFilter = ()=>true, meta: meta = null, autoLoad: autoLoad = false, shouldLoad: shouldLoad = true } = {}){
- super();
- this.gc = gc;
- this.gcFilter = gcFilter;
- this.clientID = $52a83e33f2b9e935$var$generateNewClientId();
- this.guid = guid;
- this.collectionid = collectionid;
- /**
- * @type {Map>>}
- */ this.share = new Map();
- this.store = new $52a83e33f2b9e935$var$StructStore();
- /**
- * @type {Transaction | null}
- */ this._transaction = null;
- /**
- * @type {Array}
- */ this._transactionCleanups = [];
- /**
- * @type {Set}
- */ this.subdocs = new Set();
- /**
- * If this document is a subdocument - a document integrated into another document - then _item is defined.
- * @type {Item?}
- */ this._item = null;
- this.shouldLoad = shouldLoad;
- this.autoLoad = autoLoad;
- this.meta = meta;
- /**
- * This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires.
- * Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database.
- *
- * @type {boolean}
- */ this.isLoaded = false;
- /**
- * This is set to true when the connection provider has successfully synced with a backend.
- * Note that when using peer-to-peer providers this event may not provide very useful.
- * Also note that not all providers implement this feature. Provider authors are encouraged to fire
- * the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is
- * lost (with false as a parameter).
- */ this.isSynced = false;
- /**
- * Promise that resolves once the document has been loaded from a presistence provider.
- */ this.whenLoaded = $jKNqA.create((resolve)=>{
- this.on("load", ()=>{
- this.isLoaded = true;
- resolve(this);
- });
- });
- const provideSyncedPromise = ()=>$jKNqA.create((resolve)=>{
- /**
- * @param {boolean} isSynced
- */ const eventHandler = (isSynced)=>{
- if (isSynced === undefined || isSynced === true) {
- this.off("sync", eventHandler);
- resolve();
- }
- };
- this.on("sync", eventHandler);
- });
- this.on("sync", (isSynced)=>{
- if (isSynced === false && this.isSynced) this.whenSynced = provideSyncedPromise();
- this.isSynced = isSynced === undefined || isSynced === true;
- if (!this.isLoaded) this.emit("load", []);
- });
- /**
- * Promise that resolves once the document has been synced with a backend.
- * This promise is recreated when the connection is lost.
- * Note the documentation about the `isSynced` property.
- */ this.whenSynced = provideSyncedPromise();
- }
- /**
- * Notify the parent document that you request to load data into this subdocument (if it is a subdocument).
- *
- * `load()` might be used in the future to request any provider to load the most current data.
- *
- * It is safe to call `load()` multiple times.
- */ load() {
- const item = this._item;
- if (item !== null && !this.shouldLoad) $52a83e33f2b9e935$export$dac1bad6146b2469(/** @type {any} */ item.parent.doc, (transaction)=>{
- transaction.subdocsLoaded.add(this);
- }, null, true);
- this.shouldLoad = true;
- }
- getSubdocs() {
- return this.subdocs;
- }
- getSubdocGuids() {
- return new Set($7sfdv.from(this.subdocs).map((doc)=>doc.guid));
- }
- /**
- * Changes that happen inside of a transaction are bundled. This means that
- * the observer fires _after_ the transaction is finished and that all changes
- * that happened inside of the transaction are sent as one message to the
- * other peers.
- *
- * @template T
- * @param {function(Transaction):T} f The function that should be executed as a transaction
- * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin
- * @return T
- *
- * @public
- */ transact(f, origin = null) {
- return $52a83e33f2b9e935$export$dac1bad6146b2469(this, f, origin);
- }
- /**
- * Define a shared data type.
- *
- * Multiple calls of `y.get(name, TypeConstructor)` yield the same result
- * and do not overwrite each other. I.e.
- * `y.define(name, Y.Array) === y.define(name, Y.Array)`
- *
- * After this method is called, the type is also available on `y.share.get(name)`.
- *
- * *Best Practices:*
- * Define all types right after the Yjs instance is created and store them in a separate object.
- * Also use the typed methods `getText(name)`, `getArray(name)`, ..
- *
- * @example
- * const y = new Y(..)
- * const appState = {
- * document: y.getText('document')
- * comments: y.getArray('comments')
- * }
- *
- * @param {string} name
- * @param {Function} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ...
- * @return {AbstractType} The created type. Constructed with TypeConstructor
- *
- * @public
- */ get(name, TypeConstructor = $52a83e33f2b9e935$export$c265dc8338484497) {
- const type = $e6DQe.setIfUndefined(this.share, name, ()=>{
- // @ts-ignore
- const t = new TypeConstructor();
- t._integrate(this, null);
- return t;
- });
- const Constr = type.constructor;
- if (TypeConstructor !== $52a83e33f2b9e935$export$c265dc8338484497 && Constr !== TypeConstructor) {
- if (Constr === $52a83e33f2b9e935$export$c265dc8338484497) {
- // @ts-ignore
- const t = new TypeConstructor();
- t._map = type._map;
- type._map.forEach(/** @param {Item?} n */ (n)=>{
- for(; n !== null; n = n.left)// @ts-ignore
- n.parent = t;
- });
- t._start = type._start;
- for(let n = t._start; n !== null; n = n.right)n.parent = t;
- t._length = type._length;
- this.share.set(name, t);
- t._integrate(this, null);
- return t;
- } else throw new Error(`Type with the name ${name} has already been defined with a different constructor`);
- }
- return type;
- }
- /**
- * @template T
- * @param {string} [name]
- * @return {YArray}
- *
- * @public
- */ getArray(name = "") {
- // @ts-ignore
- return this.get(name, $52a83e33f2b9e935$export$c4be6576ca6fe4aa);
- }
- /**
- * @param {string} [name]
- * @return {YText}
- *
- * @public
- */ getText(name = "") {
- // @ts-ignore
- return this.get(name, $52a83e33f2b9e935$export$5f1af8db9871e1d6);
- }
- /**
- * @template T
- * @param {string} [name]
- * @return {YMap}
- *
- * @public
- */ getMap(name = "") {
- // @ts-ignore
- return this.get(name, $52a83e33f2b9e935$export$a5c7b93649eaf8f8);
- }
- /**
- * @param {string} [name]
- * @return {YXmlFragment}
- *
- * @public
- */ getXmlFragment(name = "") {
- // @ts-ignore
- return this.get(name, $52a83e33f2b9e935$export$d5ce8c3e1731f1a7);
- }
- /**
- * Converts the entire document into a js object, recursively traversing each yjs type
- * Doesn't log types that have not been defined (using ydoc.getType(..)).
- *
- * @deprecated Do not use this method and rather call toJSON directly on the shared types.
- *
- * @return {Object}
- */ toJSON() {
- /**
- * @type {Object}
- */ const doc = {};
- this.share.forEach((value, key)=>{
- doc[key] = value.toJSON();
- });
- return doc;
- }
- /**
- * Emit `destroy` event and unregister all event handlers.
- */ destroy() {
- $7sfdv.from(this.subdocs).forEach((subdoc)=>subdoc.destroy());
- const item = this._item;
- if (item !== null) {
- this._item = null;
- const content = /** @type {ContentDoc} */ item.content;
- content.doc = new $52a83e33f2b9e935$export$bceacc74c2212615({
- guid: this.guid,
- ...content.opts,
- shouldLoad: false
- });
- content.doc._item = item;
- $52a83e33f2b9e935$export$dac1bad6146b2469(/** @type {any} */ item.parent.doc, (transaction)=>{
- const doc = content.doc;
- if (!item.deleted) transaction.subdocsAdded.add(doc);
- transaction.subdocsRemoved.add(this);
- }, null, true);
- }
- this.emit("destroyed", [
- true
- ]);
- this.emit("destroy", [
- this
- ]);
- super.destroy();
- }
- /**
- * @param {string} eventName
- * @param {function(...any):any} f
- */ on(eventName, f) {
- super.on(eventName, f);
- }
- /**
- * @param {string} eventName
- * @param {function} f
- */ off(eventName, f) {
- super.off(eventName, f);
- }
-}
-class $52a83e33f2b9e935$var$DSDecoderV1 {
- /**
- * @param {decoding.Decoder} decoder
- */ constructor(decoder){
- this.restDecoder = decoder;
- }
- resetDsCurVal() {
- // nop
- }
- /**
- * @return {number}
- */ readDsClock() {
- return $f5RS8.readVarUint(this.restDecoder);
- }
- /**
- * @return {number}
- */ readDsLen() {
- return $f5RS8.readVarUint(this.restDecoder);
- }
-}
-class $52a83e33f2b9e935$var$UpdateDecoderV1 extends $52a83e33f2b9e935$var$DSDecoderV1 {
- /**
- * @return {ID}
- */ readLeftID() {
- return $52a83e33f2b9e935$export$6c7d4e6171d008d0($f5RS8.readVarUint(this.restDecoder), $f5RS8.readVarUint(this.restDecoder));
- }
- /**
- * @return {ID}
- */ readRightID() {
- return $52a83e33f2b9e935$export$6c7d4e6171d008d0($f5RS8.readVarUint(this.restDecoder), $f5RS8.readVarUint(this.restDecoder));
- }
- /**
- * Read the next client id.
- * Use this in favor of readID whenever possible to reduce the number of objects created.
- */ readClient() {
- return $f5RS8.readVarUint(this.restDecoder);
- }
- /**
- * @return {number} info An unsigned 8-bit integer
- */ readInfo() {
- return $f5RS8.readUint8(this.restDecoder);
- }
- /**
- * @return {string}
- */ readString() {
- return $f5RS8.readVarString(this.restDecoder);
- }
- /**
- * @return {boolean} isKey
- */ readParentInfo() {
- return $f5RS8.readVarUint(this.restDecoder) === 1;
- }
- /**
- * @return {number} info An unsigned 8-bit integer
- */ readTypeRef() {
- return $f5RS8.readVarUint(this.restDecoder);
- }
- /**
- * Write len of a struct - well suited for Opt RLE encoder.
- *
- * @return {number} len
- */ readLen() {
- return $f5RS8.readVarUint(this.restDecoder);
- }
- /**
- * @return {any}
- */ readAny() {
- return $f5RS8.readAny(this.restDecoder);
- }
- /**
- * @return {Uint8Array}
- */ readBuf() {
- return $lB8LX.copyUint8Array($f5RS8.readVarUint8Array(this.restDecoder));
- }
- /**
- * Legacy implementation uses JSON parse. We use any-decoding in v2.
- *
- * @return {any}
- */ readJSON() {
- return JSON.parse($f5RS8.readVarString(this.restDecoder));
- }
- /**
- * @return {string}
- */ readKey() {
- return $f5RS8.readVarString(this.restDecoder);
- }
-}
-class $52a83e33f2b9e935$var$DSDecoderV2 {
- /**
- * @param {decoding.Decoder} decoder
- */ constructor(decoder){
- /**
- * @private
- */ this.dsCurrVal = 0;
- this.restDecoder = decoder;
- }
- resetDsCurVal() {
- this.dsCurrVal = 0;
- }
- /**
- * @return {number}
- */ readDsClock() {
- this.dsCurrVal += $f5RS8.readVarUint(this.restDecoder);
- return this.dsCurrVal;
- }
- /**
- * @return {number}
- */ readDsLen() {
- const diff = $f5RS8.readVarUint(this.restDecoder) + 1;
- this.dsCurrVal += diff;
- return diff;
- }
-}
-class $52a83e33f2b9e935$var$UpdateDecoderV2 extends $52a83e33f2b9e935$var$DSDecoderV2 {
- /**
- * @param {decoding.Decoder} decoder
- */ constructor(decoder){
- super(decoder);
- /**
- * List of cached keys. If the keys[id] does not exist, we read a new key
- * from stringEncoder and push it to keys.
- *
- * @type {Array}
- */ this.keys = [];
- $f5RS8.readVarUint(decoder); // read feature flag - currently unused
- this.keyClockDecoder = new $f5RS8.IntDiffOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- this.clientDecoder = new $f5RS8.UintOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- this.leftClockDecoder = new $f5RS8.IntDiffOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- this.rightClockDecoder = new $f5RS8.IntDiffOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- this.infoDecoder = new $f5RS8.RleDecoder($f5RS8.readVarUint8Array(decoder), $f5RS8.readUint8);
- this.stringDecoder = new $f5RS8.StringDecoder($f5RS8.readVarUint8Array(decoder));
- this.parentInfoDecoder = new $f5RS8.RleDecoder($f5RS8.readVarUint8Array(decoder), $f5RS8.readUint8);
- this.typeRefDecoder = new $f5RS8.UintOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- this.lenDecoder = new $f5RS8.UintOptRleDecoder($f5RS8.readVarUint8Array(decoder));
- }
- /**
- * @return {ID}
- */ readLeftID() {
- return new $52a83e33f2b9e935$export$8be180ec26319f9f(this.clientDecoder.read(), this.leftClockDecoder.read());
- }
- /**
- * @return {ID}
- */ readRightID() {
- return new $52a83e33f2b9e935$export$8be180ec26319f9f(this.clientDecoder.read(), this.rightClockDecoder.read());
- }
- /**
- * Read the next client id.
- * Use this in favor of readID whenever possible to reduce the number of objects created.
- */ readClient() {
- return this.clientDecoder.read();
- }
- /**
- * @return {number} info An unsigned 8-bit integer
- */ readInfo() {
- return /** @type {number} */ this.infoDecoder.read();
- }
- /**
- * @return {string}
- */ readString() {
- return this.stringDecoder.read();
- }
- /**
- * @return {boolean}
- */ readParentInfo() {
- return this.parentInfoDecoder.read() === 1;
- }
- /**
- * @return {number} An unsigned 8-bit integer
- */ readTypeRef() {
- return this.typeRefDecoder.read();
- }
- /**
- * Write len of a struct - well suited for Opt RLE encoder.
- *
- * @return {number}
- */ readLen() {
- return this.lenDecoder.read();
- }
- /**
- * @return {any}
- */ readAny() {
- return $f5RS8.readAny(this.restDecoder);
- }
- /**
- * @return {Uint8Array}
- */ readBuf() {
- return $f5RS8.readVarUint8Array(this.restDecoder);
- }
- /**
- * This is mainly here for legacy purposes.
- *
- * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.
- *
- * @return {any}
- */ readJSON() {
- return $f5RS8.readAny(this.restDecoder);
- }
- /**
- * @return {string}
- */ readKey() {
- const keyClock = this.keyClockDecoder.read();
- if (keyClock < this.keys.length) return this.keys[keyClock];
- else {
- const key = this.stringDecoder.read();
- this.keys.push(key);
- return key;
- }
- }
-}
-class $52a83e33f2b9e935$var$DSEncoderV1 {
- constructor(){
- this.restEncoder = $1p1sv.createEncoder();
- }
- toUint8Array() {
- return $1p1sv.toUint8Array(this.restEncoder);
- }
- resetDsCurVal() {
- // nop
- }
- /**
- * @param {number} clock
- */ writeDsClock(clock) {
- $1p1sv.writeVarUint(this.restEncoder, clock);
- }
- /**
- * @param {number} len
- */ writeDsLen(len) {
- $1p1sv.writeVarUint(this.restEncoder, len);
- }
-}
-class $52a83e33f2b9e935$export$99171b804d9c5b54 extends $52a83e33f2b9e935$var$DSEncoderV1 {
- /**
- * @param {ID} id
- */ writeLeftID(id) {
- $1p1sv.writeVarUint(this.restEncoder, id.client);
- $1p1sv.writeVarUint(this.restEncoder, id.clock);
- }
- /**
- * @param {ID} id
- */ writeRightID(id) {
- $1p1sv.writeVarUint(this.restEncoder, id.client);
- $1p1sv.writeVarUint(this.restEncoder, id.clock);
- }
- /**
- * Use writeClient and writeClock instead of writeID if possible.
- * @param {number} client
- */ writeClient(client) {
- $1p1sv.writeVarUint(this.restEncoder, client);
- }
- /**
- * @param {number} info An unsigned 8-bit integer
- */ writeInfo(info) {
- $1p1sv.writeUint8(this.restEncoder, info);
- }
- /**
- * @param {string} s
- */ writeString(s) {
- $1p1sv.writeVarString(this.restEncoder, s);
- }
- /**
- * @param {boolean} isYKey
- */ writeParentInfo(isYKey) {
- $1p1sv.writeVarUint(this.restEncoder, isYKey ? 1 : 0);
- }
- /**
- * @param {number} info An unsigned 8-bit integer
- */ writeTypeRef(info) {
- $1p1sv.writeVarUint(this.restEncoder, info);
- }
- /**
- * Write len of a struct - well suited for Opt RLE encoder.
- *
- * @param {number} len
- */ writeLen(len) {
- $1p1sv.writeVarUint(this.restEncoder, len);
- }
- /**
- * @param {any} any
- */ writeAny(any) {
- $1p1sv.writeAny(this.restEncoder, any);
- }
- /**
- * @param {Uint8Array} buf
- */ writeBuf(buf) {
- $1p1sv.writeVarUint8Array(this.restEncoder, buf);
- }
- /**
- * @param {any} embed
- */ writeJSON(embed) {
- $1p1sv.writeVarString(this.restEncoder, JSON.stringify(embed));
- }
- /**
- * @param {string} key
- */ writeKey(key) {
- $1p1sv.writeVarString(this.restEncoder, key);
- }
-}
-class $52a83e33f2b9e935$var$DSEncoderV2 {
- constructor(){
- this.restEncoder = $1p1sv.createEncoder(); // encodes all the rest / non-optimized
- this.dsCurrVal = 0;
- }
- toUint8Array() {
- return $1p1sv.toUint8Array(this.restEncoder);
- }
- resetDsCurVal() {
- this.dsCurrVal = 0;
- }
- /**
- * @param {number} clock
- */ writeDsClock(clock) {
- const diff = clock - this.dsCurrVal;
- this.dsCurrVal = clock;
- $1p1sv.writeVarUint(this.restEncoder, diff);
- }
- /**
- * @param {number} len
- */ writeDsLen(len) {
- if (len === 0) $akmFO.unexpectedCase();
- $1p1sv.writeVarUint(this.restEncoder, len - 1);
- this.dsCurrVal += len;
- }
-}
-class $52a83e33f2b9e935$var$UpdateEncoderV2 extends $52a83e33f2b9e935$var$DSEncoderV2 {
- constructor(){
- super();
- /**
- * @type {Map}
- */ this.keyMap = new Map();
- /**
- * Refers to the next uniqe key-identifier to me used.
- * See writeKey method for more information.
- *
- * @type {number}
- */ this.keyClock = 0;
- this.keyClockEncoder = new $1p1sv.IntDiffOptRleEncoder();
- this.clientEncoder = new $1p1sv.UintOptRleEncoder();
- this.leftClockEncoder = new $1p1sv.IntDiffOptRleEncoder();
- this.rightClockEncoder = new $1p1sv.IntDiffOptRleEncoder();
- this.infoEncoder = new $1p1sv.RleEncoder($1p1sv.writeUint8);
- this.stringEncoder = new $1p1sv.StringEncoder();
- this.parentInfoEncoder = new $1p1sv.RleEncoder($1p1sv.writeUint8);
- this.typeRefEncoder = new $1p1sv.UintOptRleEncoder();
- this.lenEncoder = new $1p1sv.UintOptRleEncoder();
- }
- toUint8Array() {
- const encoder = $1p1sv.createEncoder();
- $1p1sv.writeVarUint(encoder, 0); // this is a feature flag that we might use in the future
- $1p1sv.writeVarUint8Array(encoder, this.keyClockEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, this.clientEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, this.leftClockEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, this.rightClockEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, $1p1sv.toUint8Array(this.infoEncoder));
- $1p1sv.writeVarUint8Array(encoder, this.stringEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, $1p1sv.toUint8Array(this.parentInfoEncoder));
- $1p1sv.writeVarUint8Array(encoder, this.typeRefEncoder.toUint8Array());
- $1p1sv.writeVarUint8Array(encoder, this.lenEncoder.toUint8Array());
- // @note The rest encoder is appended! (note the missing var)
- $1p1sv.writeUint8Array(encoder, $1p1sv.toUint8Array(this.restEncoder));
- return $1p1sv.toUint8Array(encoder);
- }
- /**
- * @param {ID} id
- */ writeLeftID(id) {
- this.clientEncoder.write(id.client);
- this.leftClockEncoder.write(id.clock);
- }
- /**
- * @param {ID} id
- */ writeRightID(id) {
- this.clientEncoder.write(id.client);
- this.rightClockEncoder.write(id.clock);
- }
- /**
- * @param {number} client
- */ writeClient(client) {
- this.clientEncoder.write(client);
- }
- /**
- * @param {number} info An unsigned 8-bit integer
- */ writeInfo(info) {
- this.infoEncoder.write(info);
- }
- /**
- * @param {string} s
- */ writeString(s) {
- this.stringEncoder.write(s);
- }
- /**
- * @param {boolean} isYKey
- */ writeParentInfo(isYKey) {
- this.parentInfoEncoder.write(isYKey ? 1 : 0);
- }
- /**
- * @param {number} info An unsigned 8-bit integer
- */ writeTypeRef(info) {
- this.typeRefEncoder.write(info);
- }
- /**
- * Write len of a struct - well suited for Opt RLE encoder.
- *
- * @param {number} len
- */ writeLen(len) {
- this.lenEncoder.write(len);
- }
- /**
- * @param {any} any
- */ writeAny(any) {
- $1p1sv.writeAny(this.restEncoder, any);
- }
- /**
- * @param {Uint8Array} buf
- */ writeBuf(buf) {
- $1p1sv.writeVarUint8Array(this.restEncoder, buf);
- }
- /**
- * This is mainly here for legacy purposes.
- *
- * Initial we incoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.
- *
- * @param {any} embed
- */ writeJSON(embed) {
- $1p1sv.writeAny(this.restEncoder, embed);
- }
- /**
- * Property keys are often reused. For example, in y-prosemirror the key `bold` might
- * occur very often. For a 3d application, the key `position` might occur very often.
- *
- * We cache these keys in a Map and refer to them via a unique number.
- *
- * @param {string} key
- */ writeKey(key) {
- const clock = this.keyMap.get(key);
- if (clock === undefined) {
- /**
- * @todo uncomment to introduce this feature finally
- *
- * Background. The ContentFormat object was always encoded using writeKey, but the decoder used to use readString.
- * Furthermore, I forgot to set the keyclock. So everything was working fine.
- *
- * However, this feature here is basically useless as it is not being used (it actually only consumes extra memory).
- *
- * I don't know yet how to reintroduce this feature..
- *
- * Older clients won't be able to read updates when we reintroduce this feature. So this should probably be done using a flag.
- *
- */ // this.keyMap.set(key, this.keyClock)
- this.keyClockEncoder.write(this.keyClock++);
- this.stringEncoder.write(key);
- } else this.keyClockEncoder.write(clock);
- }
-}
-/**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- * @param {Array} structs All structs by `client`
- * @param {number} client
- * @param {number} clock write structs starting with `ID(client,clock)`
- *
- * @function
- */ const $52a83e33f2b9e935$var$writeStructs = (encoder, structs, client, clock)=>{
- // write first id
- clock = $kuitL.max(clock, structs[0].id.clock); // make sure the first id exists
- const startNewStructs = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, clock);
- // write # encoded structs
- $1p1sv.writeVarUint(encoder.restEncoder, structs.length - startNewStructs);
- encoder.writeClient(client);
- $1p1sv.writeVarUint(encoder.restEncoder, clock);
- const firstStruct = structs[startNewStructs];
- // write first struct with an offset
- firstStruct.write(encoder, clock - firstStruct.id.clock);
- for(let i = startNewStructs + 1; i < structs.length; i++)structs[i].write(encoder, 0);
-};
-/**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- * @param {StructStore} store
- * @param {Map} _sm
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$writeClientsStructs = (encoder, store, _sm)=>{
- // we filter all valid _sm entries into sm
- const sm = new Map();
- _sm.forEach((clock, client)=>{
- // only write if new structs are available
- if ($52a83e33f2b9e935$export$50fdfeece43146fd(store, client) > clock) sm.set(client, clock);
- });
- $52a83e33f2b9e935$var$getStateVector(store).forEach((_clock, client)=>{
- if (!_sm.has(client)) sm.set(client, 0);
- });
- // write # states that were updated
- $1p1sv.writeVarUint(encoder.restEncoder, sm.size);
- // Write items with higher client ids first
- // This heavily improves the conflict algorithm.
- $7sfdv.from(sm.entries()).sort((a, b)=>b[0] - a[0]).forEach(([client, clock])=>{
- $52a83e33f2b9e935$var$writeStructs(encoder, /** @type {Array} */ store.clients.get(client), client, clock);
- });
-};
-/**
- * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from.
- * @param {Doc} doc
- * @return {Map }>}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$readClientsStructRefs = (decoder, doc)=>{
- /**
- * @type {Map }>}
- */ const clientRefs = $e6DQe.create();
- const numOfStateUpdates = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < numOfStateUpdates; i++){
- const numberOfStructs = $f5RS8.readVarUint(decoder.restDecoder);
- /**
- * @type {Array}
- */ const refs = new Array(numberOfStructs);
- const client = decoder.readClient();
- let clock = $f5RS8.readVarUint(decoder.restDecoder);
- // const start = performance.now()
- clientRefs.set(client, {
- i: 0,
- refs: refs
- });
- for(let i = 0; i < numberOfStructs; i++){
- const info = decoder.readInfo();
- switch($1GdQd.BITS5 & info){
- case 0:
- {
- const len = decoder.readLen();
- refs[i] = new $52a83e33f2b9e935$export$12d259ff017e6b58($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), len);
- clock += len;
- break;
- }
- case 10:
- {
- // @todo we could reduce the amount of checks by adding Skip struct to clientRefs so we know that something is missing.
- const len = $f5RS8.readVarUint(decoder.restDecoder);
- refs[i] = new $52a83e33f2b9e935$var$Skip($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), len);
- clock += len;
- break;
- }
- default:
- {
- /**
- * The optimized implementation doesn't use any variables because inlining variables is faster.
- * Below a non-optimized version is shown that implements the basic algorithm with
- * a few comments
- */ const cantCopyParentInfo = (info & ($1GdQd.BIT7 | $1GdQd.BIT8)) === 0;
- // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`
- // and we read the next string as parentYKey.
- // It indicates how we store/retrieve parent from `y.share`
- // @type {string|null}
- const struct = new $52a83e33f2b9e935$export$6d08773d2e66f8f2($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), null, (info & $1GdQd.BIT8) === $1GdQd.BIT8 ? decoder.readLeftID() : null, null, (info & $1GdQd.BIT7) === $1GdQd.BIT7 ? decoder.readRightID() : null, cantCopyParentInfo ? decoder.readParentInfo() ? doc.get(decoder.readString()) : decoder.readLeftID() : null, cantCopyParentInfo && (info & $1GdQd.BIT6) === $1GdQd.BIT6 ? decoder.readString() : null, $52a83e33f2b9e935$var$readItemContent(decoder, info) // item content
- );
- /* A non-optimized implementation of the above algorithm:
-
- // The item that was originally to the left of this item.
- const origin = (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null
- // The item that was originally to the right of this item.
- const rightOrigin = (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null
- const cantCopyParentInfo = (info & (binary.BIT7 | binary.BIT8)) === 0
- const hasParentYKey = cantCopyParentInfo ? decoder.readParentInfo() : false
- // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`
- // and we read the next string as parentYKey.
- // It indicates how we store/retrieve parent from `y.share`
- // @type {string|null}
- const parentYKey = cantCopyParentInfo && hasParentYKey ? decoder.readString() : null
-
- const struct = new Item(
- createID(client, clock),
- null, // leftd
- origin, // origin
- null, // right
- rightOrigin, // right origin
- cantCopyParentInfo && !hasParentYKey ? decoder.readLeftID() : (parentYKey !== null ? doc.get(parentYKey) : null), // parent
- cantCopyParentInfo && (info & binary.BIT6) === binary.BIT6 ? decoder.readString() : null, // parentSub
- readItemContent(decoder, info) // item content
- )
- */ refs[i] = struct;
- clock += struct.length;
- }
- }
- }
- // console.log('time to read: ', performance.now() - start) // @todo remove
- }
- return clientRefs;
-};
-/**
- * Resume computing structs generated by struct readers.
- *
- * While there is something to do, we integrate structs in this order
- * 1. top element on stack, if stack is not empty
- * 2. next element from current struct reader (if empty, use next struct reader)
- *
- * If struct causally depends on another struct (ref.missing), we put next reader of
- * `ref.id.client` on top of stack.
- *
- * At some point we find a struct that has no causal dependencies,
- * then we start emptying the stack.
- *
- * It is not possible to have circles: i.e. struct1 (from client1) depends on struct2 (from client2)
- * depends on struct3 (from client1). Therefore the max stack size is eqaul to `structReaders.length`.
- *
- * This method is implemented in a way so that we can resume computation if this update
- * causally depends on another update.
- *
- * @param {Transaction} transaction
- * @param {StructStore} store
- * @param {Map} clientsStructRefs
- * @return { null | { update: Uint8Array, missing: Map } }
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$integrateStructs = (transaction, store, clientsStructRefs)=>{
- /**
- * @type {Array- }
- */ const stack = [];
- // sort them so that we take the higher id first, in case of conflicts the lower id will probably not conflict with the id from the higher user.
- let clientsStructRefsIds = $7sfdv.from(clientsStructRefs.keys()).sort((a, b)=>a - b);
- if (clientsStructRefsIds.length === 0) return null;
- const getNextStructTarget = ()=>{
- if (clientsStructRefsIds.length === 0) return null;
- let nextStructsTarget = /** @type {{i:number,refs:Array}} */ clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]);
- while(nextStructsTarget.refs.length === nextStructsTarget.i){
- clientsStructRefsIds.pop();
- if (clientsStructRefsIds.length > 0) nextStructsTarget = /** @type {{i:number,refs:Array}} */ clientsStructRefs.get(clientsStructRefsIds[clientsStructRefsIds.length - 1]);
- else return null;
- }
- return nextStructsTarget;
- };
- let curStructsTarget = getNextStructTarget();
- if (curStructsTarget === null && stack.length === 0) return null;
- /**
- * @type {StructStore}
- */ const restStructs = new $52a83e33f2b9e935$var$StructStore();
- const missingSV = new Map();
- /**
- * @param {number} client
- * @param {number} clock
- */ const updateMissingSv = (client, clock)=>{
- const mclock = missingSV.get(client);
- if (mclock == null || mclock > clock) missingSV.set(client, clock);
- };
- /**
- * @type {GC|Item}
- */ let stackHead = /** @type {any} */ curStructsTarget.refs[/** @type {any} */ curStructsTarget.i++];
- // caching the state because it is used very often
- const state = new Map();
- const addStackToRestSS = ()=>{
- for (const item of stack){
- const client = item.id.client;
- const unapplicableItems = clientsStructRefs.get(client);
- if (unapplicableItems) {
- // decrement because we weren't able to apply previous operation
- unapplicableItems.i--;
- restStructs.clients.set(client, unapplicableItems.refs.slice(unapplicableItems.i));
- clientsStructRefs.delete(client);
- unapplicableItems.i = 0;
- unapplicableItems.refs = [];
- } else // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue
- restStructs.clients.set(client, [
- item
- ]);
- // remove client from clientsStructRefsIds to prevent users from applying the same update again
- clientsStructRefsIds = clientsStructRefsIds.filter((c)=>c !== client);
- }
- stack.length = 0;
- };
- // iterate over all struct readers until we are done
- while(true){
- if (stackHead.constructor !== $52a83e33f2b9e935$var$Skip) {
- const localClock = $e6DQe.setIfUndefined(state, stackHead.id.client, ()=>$52a83e33f2b9e935$export$50fdfeece43146fd(store, stackHead.id.client));
- const offset = localClock - stackHead.id.clock;
- if (offset < 0) {
- // update from the same client is missing
- stack.push(stackHead);
- updateMissingSv(stackHead.id.client, stackHead.id.clock - 1);
- // hid a dead wall, add all items from stack to restSS
- addStackToRestSS();
- } else {
- const missing = stackHead.getMissing(transaction, store);
- if (missing !== null) {
- stack.push(stackHead);
- // get the struct reader that has the missing struct
- /**
- * @type {{ refs: Array, i: number }}
- */ const structRefs = clientsStructRefs.get(/** @type {number} */ missing) || {
- refs: [],
- i: 0
- };
- if (structRefs.refs.length === structRefs.i) {
- // This update message causally depends on another update message that doesn't exist yet
- updateMissingSv(/** @type {number} */ missing, $52a83e33f2b9e935$export$50fdfeece43146fd(store, missing));
- addStackToRestSS();
- } else {
- stackHead = structRefs.refs[structRefs.i++];
- continue;
- }
- } else if (offset === 0 || offset < stackHead.length) {
- // all fine, apply the stackhead
- stackHead.integrate(transaction, offset);
- state.set(stackHead.id.client, stackHead.id.clock + stackHead.length);
- }
- }
- }
- // iterate to next stackHead
- if (stack.length > 0) stackHead = /** @type {GC|Item} */ stack.pop();
- else if (curStructsTarget !== null && curStructsTarget.i < curStructsTarget.refs.length) stackHead = /** @type {GC|Item} */ curStructsTarget.refs[curStructsTarget.i++];
- else {
- curStructsTarget = getNextStructTarget();
- if (curStructsTarget === null) break;
- else stackHead = /** @type {GC|Item} */ curStructsTarget.refs[curStructsTarget.i++];
- }
- }
- if (restStructs.clients.size > 0) {
- const encoder = new $52a83e33f2b9e935$var$UpdateEncoderV2();
- $52a83e33f2b9e935$var$writeClientsStructs(encoder, restStructs, new Map());
- // write empty deleteset
- // writeDeleteSet(encoder, new DeleteSet())
- $1p1sv.writeVarUint(encoder.restEncoder, 0); // => no need for an extra function call, just write 0 deletes
- return {
- missing: missingSV,
- update: encoder.toUint8Array()
- };
- }
- return null;
-};
-/**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- * @param {Transaction} transaction
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$writeStructsFromTransaction = (encoder, transaction)=>$52a83e33f2b9e935$var$writeClientsStructs(encoder, transaction.doc.store, transaction.beforeState);
-/**
- * Read and apply a document update.
- *
- * This function has the same effect as `applyUpdate` but accepts an decoder.
- *
- * @param {decoding.Decoder} decoder
- * @param {Doc} ydoc
- * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`
- * @param {UpdateDecoderV1 | UpdateDecoderV2} [structDecoder]
- *
- * @function
- */ const $52a83e33f2b9e935$export$7abe492a0b891b4d = (decoder, ydoc, transactionOrigin, structDecoder = new $52a83e33f2b9e935$var$UpdateDecoderV2(decoder))=>$52a83e33f2b9e935$export$dac1bad6146b2469(ydoc, (transaction)=>{
- // force that transaction.local is set to non-local
- transaction.local = false;
- let retry = false;
- const doc = transaction.doc;
- const store = doc.store;
- // let start = performance.now()
- const ss = $52a83e33f2b9e935$var$readClientsStructRefs(structDecoder, doc);
- // console.log('time to read structs: ', performance.now() - start) // @todo remove
- // start = performance.now()
- // console.log('time to merge: ', performance.now() - start) // @todo remove
- // start = performance.now()
- const restStructs = $52a83e33f2b9e935$var$integrateStructs(transaction, store, ss);
- const pending = store.pendingStructs;
- if (pending) {
- // check if we can apply something
- for (const [client, clock] of pending.missing)if (clock < $52a83e33f2b9e935$export$50fdfeece43146fd(store, client)) {
- retry = true;
- break;
- }
- if (restStructs) {
- // merge restStructs into store.pending
- for (const [client, clock] of restStructs.missing){
- const mclock = pending.missing.get(client);
- if (mclock == null || mclock > clock) pending.missing.set(client, clock);
- }
- pending.update = $52a83e33f2b9e935$export$ce273d78de0331d1([
- pending.update,
- restStructs.update
- ]);
- }
- } else store.pendingStructs = restStructs;
- // console.log('time to integrate: ', performance.now() - start) // @todo remove
- // start = performance.now()
- const dsRest = $52a83e33f2b9e935$var$readAndApplyDeleteSet(structDecoder, transaction, store);
- if (store.pendingDs) {
- // @todo we could make a lower-bound state-vector check as we do above
- const pendingDSUpdate = new $52a83e33f2b9e935$var$UpdateDecoderV2($f5RS8.createDecoder(store.pendingDs));
- $f5RS8.readVarUint(pendingDSUpdate.restDecoder); // read 0 structs, because we only encode deletes in pendingdsupdate
- const dsRest2 = $52a83e33f2b9e935$var$readAndApplyDeleteSet(pendingDSUpdate, transaction, store);
- if (dsRest && dsRest2) // case 1: ds1 != null && ds2 != null
- store.pendingDs = $52a83e33f2b9e935$export$ce273d78de0331d1([
- dsRest,
- dsRest2
- ]);
- else // case 2: ds1 != null
- // case 3: ds2 != null
- // case 4: ds1 == null && ds2 == null
- store.pendingDs = dsRest || dsRest2;
- } else // Either dsRest == null && pendingDs == null OR dsRest != null
- store.pendingDs = dsRest;
- // console.log('time to cleanup: ', performance.now() - start) // @todo remove
- // start = performance.now()
- // console.log('time to resume delete readers: ', performance.now() - start) // @todo remove
- // start = performance.now()
- if (retry) {
- const update = /** @type {{update: Uint8Array}} */ store.pendingStructs.update;
- store.pendingStructs = null;
- $52a83e33f2b9e935$export$acc3b0324aabf1b6(transaction.doc, update);
- }
- }, transactionOrigin, false);
-/**
- * Read and apply a document update.
- *
- * This function has the same effect as `applyUpdate` but accepts an decoder.
- *
- * @param {decoding.Decoder} decoder
- * @param {Doc} ydoc
- * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`
- *
- * @function
- */ const $52a83e33f2b9e935$export$d67ac8d73b7d336c = (decoder, ydoc, transactionOrigin)=>$52a83e33f2b9e935$export$7abe492a0b891b4d(decoder, ydoc, transactionOrigin, new $52a83e33f2b9e935$var$UpdateDecoderV1(decoder));
-/**
- * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.
- *
- * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.
- *
- * @param {Doc} ydoc
- * @param {Uint8Array} update
- * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`
- * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]
- *
- * @function
- */ const $52a83e33f2b9e935$export$acc3b0324aabf1b6 = (ydoc, update, transactionOrigin, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- const decoder = $f5RS8.createDecoder(update);
- $52a83e33f2b9e935$export$7abe492a0b891b4d(decoder, ydoc, transactionOrigin, new YDecoder(decoder));
-};
-/**
- * Apply a document update created by, for example, `y.on('update', update => ..)` or `update = encodeStateAsUpdate()`.
- *
- * This function has the same effect as `readUpdate` but accepts an Uint8Array instead of a Decoder.
- *
- * @param {Doc} ydoc
- * @param {Uint8Array} update
- * @param {any} [transactionOrigin] This will be stored on `transaction.origin` and `.on('update', (update, origin))`
- *
- * @function
- */ const $52a83e33f2b9e935$export$c271737a9c02e925 = (ydoc, update, transactionOrigin)=>$52a83e33f2b9e935$export$acc3b0324aabf1b6(ydoc, update, transactionOrigin, $52a83e33f2b9e935$var$UpdateDecoderV1);
-/**
- * Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will
- * only write the operations that are missing.
- *
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- * @param {Doc} doc
- * @param {Map} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs
- *
- * @function
- */ const $52a83e33f2b9e935$var$writeStateAsUpdate = (encoder, doc, targetStateVector = new Map())=>{
- $52a83e33f2b9e935$var$writeClientsStructs(encoder, doc.store, targetStateVector);
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, $52a83e33f2b9e935$export$8450d668bec558e2(doc.store));
-};
-/**
- * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will
- * only write the operations that are missing.
- *
- * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder
- *
- * @param {Doc} doc
- * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs
- * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder]
- * @return {Uint8Array}
- *
- * @function
- */ const $52a83e33f2b9e935$export$90338e0798f6f64f = (doc, encodedTargetStateVector = new Uint8Array([
- 0
-]), encoder = new $52a83e33f2b9e935$var$UpdateEncoderV2())=>{
- const targetStateVector = $52a83e33f2b9e935$export$324ac6fb20a844e3(encodedTargetStateVector);
- $52a83e33f2b9e935$var$writeStateAsUpdate(encoder, doc, targetStateVector);
- const updates = [
- encoder.toUint8Array()
- ];
- // also add the pending updates (if there are any)
- if (doc.store.pendingDs) updates.push(doc.store.pendingDs);
- if (doc.store.pendingStructs) updates.push($52a83e33f2b9e935$export$a8143edf39d2ad8e(doc.store.pendingStructs.update, encodedTargetStateVector));
- if (updates.length > 1) {
- if (encoder.constructor === $52a83e33f2b9e935$export$99171b804d9c5b54) return $52a83e33f2b9e935$export$6319871659fd2460(updates.map((update, i)=>i === 0 ? update : $52a83e33f2b9e935$export$afffbdeed14adbd(update)));
- else if (encoder.constructor === $52a83e33f2b9e935$var$UpdateEncoderV2) return $52a83e33f2b9e935$export$ce273d78de0331d1(updates);
- }
- return updates[0];
-};
-/**
- * Write all the document as a single update message that can be applied on the remote document. If you specify the state of the remote client (`targetState`) it will
- * only write the operations that are missing.
- *
- * Use `writeStateAsUpdate` instead if you are working with lib0/encoding.js#Encoder
- *
- * @param {Doc} doc
- * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs
- * @return {Uint8Array}
- *
- * @function
- */ const $52a83e33f2b9e935$export$e5848df80e65bd53 = (doc, encodedTargetStateVector)=>$52a83e33f2b9e935$export$90338e0798f6f64f(doc, encodedTargetStateVector, new $52a83e33f2b9e935$export$99171b804d9c5b54());
-/**
- * Read state vector from Decoder and return as Map
- *
- * @param {DSDecoderV1 | DSDecoderV2} decoder
- * @return {Map} Maps `client` to the number next expected `clock` from that client.
- *
- * @function
- */ const $52a83e33f2b9e935$var$readStateVector = (decoder)=>{
- const ss = new Map();
- const ssLength = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < ssLength; i++){
- const client = $f5RS8.readVarUint(decoder.restDecoder);
- const clock = $f5RS8.readVarUint(decoder.restDecoder);
- ss.set(client, clock);
- }
- return ss;
-};
-/**
- * Read decodedState and return State as Map.
- *
- * @param {Uint8Array} decodedState
- * @return {Map} Maps `client` to the number next expected `clock` from that client.
- *
- * @function
- */ // export const decodeStateVectorV2 = decodedState => readStateVector(new DSDecoderV2(decoding.createDecoder(decodedState)))
-/**
- * Read decodedState and return State as Map.
- *
- * @param {Uint8Array} decodedState
- * @return {Map} Maps `client` to the number next expected `clock` from that client.
- *
- * @function
- */ const $52a83e33f2b9e935$export$324ac6fb20a844e3 = (decodedState)=>$52a83e33f2b9e935$var$readStateVector(new $52a83e33f2b9e935$var$DSDecoderV1($f5RS8.createDecoder(decodedState)));
-/**
- * @param {DSEncoderV1 | DSEncoderV2} encoder
- * @param {Map} sv
- * @function
- */ const $52a83e33f2b9e935$var$writeStateVector = (encoder, sv)=>{
- $1p1sv.writeVarUint(encoder.restEncoder, sv.size);
- $7sfdv.from(sv.entries()).sort((a, b)=>b[0] - a[0]).forEach(([client, clock])=>{
- $1p1sv.writeVarUint(encoder.restEncoder, client); // @todo use a special client decoder that is based on mapping
- $1p1sv.writeVarUint(encoder.restEncoder, clock);
- });
- return encoder;
-};
-/**
- * @param {DSEncoderV1 | DSEncoderV2} encoder
- * @param {Doc} doc
- *
- * @function
- */ const $52a83e33f2b9e935$var$writeDocumentStateVector = (encoder, doc)=>$52a83e33f2b9e935$var$writeStateVector(encoder, $52a83e33f2b9e935$var$getStateVector(doc.store));
-/**
- * Encode State as Uint8Array.
- *
- * @param {Doc|Map} doc
- * @param {DSEncoderV1 | DSEncoderV2} [encoder]
- * @return {Uint8Array}
- *
- * @function
- */ const $52a83e33f2b9e935$var$encodeStateVectorV2 = (doc, encoder = new $52a83e33f2b9e935$var$DSEncoderV2())=>{
- if (doc instanceof Map) $52a83e33f2b9e935$var$writeStateVector(encoder, doc);
- else $52a83e33f2b9e935$var$writeDocumentStateVector(encoder, doc);
- return encoder.toUint8Array();
-};
-/**
- * Encode State as Uint8Array.
- *
- * @param {Doc|Map} doc
- * @return {Uint8Array}
- *
- * @function
- */ const $52a83e33f2b9e935$export$3e2f5393f32e71f = (doc)=>$52a83e33f2b9e935$var$encodeStateVectorV2(doc, new $52a83e33f2b9e935$var$DSEncoderV1());
-/**
- * General event handler implementation.
- *
- * @template ARG0, ARG1
- *
- * @private
- */ class $52a83e33f2b9e935$var$EventHandler {
- constructor(){
- /**
- * @type {Array}
- */ this.l = [];
- }
-}
-/**
- * @template ARG0,ARG1
- * @returns {EventHandler}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$createEventHandler = ()=>new $52a83e33f2b9e935$var$EventHandler();
-/**
- * Adds an event listener that is called when
- * {@link EventHandler#callEventListeners} is called.
- *
- * @template ARG0,ARG1
- * @param {EventHandler} eventHandler
- * @param {function(ARG0,ARG1):void} f The event handler.
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$addEventHandlerListener = (eventHandler, f)=>eventHandler.l.push(f);
-/**
- * Removes an event listener.
- *
- * @template ARG0,ARG1
- * @param {EventHandler} eventHandler
- * @param {function(ARG0,ARG1):void} f The event handler that was added with
- * {@link EventHandler#addEventListener}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$removeEventHandlerListener = (eventHandler, f)=>{
- const l = eventHandler.l;
- const len = l.length;
- eventHandler.l = l.filter((g)=>f !== g);
- if (len === eventHandler.l.length) console.error("[yjs] Tried to remove event handler that doesn't exist.");
-};
-/**
- * Call all event listeners that were added via
- * {@link EventHandler#addEventListener}.
- *
- * @template ARG0,ARG1
- * @param {EventHandler} eventHandler
- * @param {ARG0} arg0
- * @param {ARG1} arg1
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$callEventHandlerListeners = (eventHandler, arg0, arg1)=>$kXTKb.callAll(eventHandler.l, [
- arg0,
- arg1
- ]);
-class $52a83e33f2b9e935$export$8be180ec26319f9f {
- /**
- * @param {number} client client id
- * @param {number} clock unique per client id, continuous number
- */ constructor(client, clock){
- /**
- * Client id
- * @type {number}
- */ this.client = client;
- /**
- * unique per client id, continuous number
- * @type {number}
- */ this.clock = clock;
- }
-}
-/**
- * @param {ID | null} a
- * @param {ID | null} b
- * @return {boolean}
- *
- * @function
- */ const $52a83e33f2b9e935$export$c0af976e7e459c02 = (a, b)=>a === b || a !== null && b !== null && a.client === b.client && a.clock === b.clock;
-/**
- * @param {number} client
- * @param {number} clock
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$6c7d4e6171d008d0 = (client, clock)=>new $52a83e33f2b9e935$export$8be180ec26319f9f(client, clock);
-/**
- * @param {encoding.Encoder} encoder
- * @param {ID} id
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$writeID = (encoder, id)=>{
- $1p1sv.writeVarUint(encoder, id.client);
- $1p1sv.writeVarUint(encoder, id.clock);
-};
-/**
- * Read ID.
- * * If first varUint read is 0xFFFFFF a RootID is returned.
- * * Otherwise an ID is returned
- *
- * @param {decoding.Decoder} decoder
- * @return {ID}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$readID = (decoder)=>$52a83e33f2b9e935$export$6c7d4e6171d008d0($f5RS8.readVarUint(decoder), $f5RS8.readVarUint(decoder));
-/**
- * The top types are mapped from y.share.get(keyname) => type.
- * `type` does not store any information about the `keyname`.
- * This function finds the correct `keyname` for `type` and throws otherwise.
- *
- * @param {AbstractType} type
- * @return {string}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$e726a40920d54663 = (type)=>{
- // @ts-ignore _y must be defined, otherwise unexpected case
- for (const [key, value] of type.doc.share.entries()){
- if (value === type) return key;
- }
- throw $akmFO.unexpectedCase();
-};
-/**
- * Check if `parent` is a parent of `child`.
- *
- * @param {AbstractType} parent
- * @param {Item|null} child
- * @return {Boolean} Whether `parent` is a parent of `child`.
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$3c81af374b054d6a = (parent, child)=>{
- while(child !== null){
- if (child.parent === parent) return true;
- child = /** @type {AbstractType} */ child.parent._item;
- }
- return false;
-};
-/**
- * Convenient helper to log type information.
- *
- * Do not use in productive systems as the output can be immense!
- *
- * @param {AbstractType} type
- */ const $52a83e33f2b9e935$export$e9068ad704ba2f79 = (type)=>{
- const res = [];
- let n = type._start;
- while(n){
- res.push(n);
- n = n.right;
- }
- console.log("Children: ", res);
- console.log("Children content: ", res.filter((m)=>!m.deleted).map((m)=>m.content));
-};
-class $52a83e33f2b9e935$export$b9e8b5fa1162ca4e {
- /**
- * @param {Doc} doc
- * @param {YMap} [storeType]
- */ constructor(doc, storeType = doc.getMap("users")){
- /**
- * @type {Map}
- */ const dss = new Map();
- this.yusers = storeType;
- this.doc = doc;
- /**
- * Maps from clientid to userDescription
- *
- * @type {Map}
- */ this.clients = new Map();
- this.dss = dss;
- /**
- * @param {YMap} user
- * @param {string} userDescription
- */ const initUser = (user, userDescription)=>{
- /**
- * @type {YArray}
- */ const ds = user.get("ds");
- const ids = user.get("ids");
- const addClientId = /** @param {number} clientid */ (clientid)=>this.clients.set(clientid, userDescription);
- ds.observe(/** @param {YArrayEvent} event */ (event)=>{
- event.changes.added.forEach((item)=>{
- item.content.getContent().forEach((encodedDs)=>{
- if (encodedDs instanceof Uint8Array) this.dss.set(userDescription, $52a83e33f2b9e935$var$mergeDeleteSets([
- this.dss.get(userDescription) || $52a83e33f2b9e935$export$8cbac0d946238699(),
- $52a83e33f2b9e935$var$readDeleteSet(new $52a83e33f2b9e935$var$DSDecoderV1($f5RS8.createDecoder(encodedDs)))
- ]));
- });
- });
- });
- this.dss.set(userDescription, $52a83e33f2b9e935$var$mergeDeleteSets(ds.map((encodedDs)=>$52a83e33f2b9e935$var$readDeleteSet(new $52a83e33f2b9e935$var$DSDecoderV1($f5RS8.createDecoder(encodedDs))))));
- ids.observe(/** @param {YArrayEvent} event */ (event)=>event.changes.added.forEach((item)=>item.content.getContent().forEach(addClientId)));
- ids.forEach(addClientId);
- };
- // observe users
- storeType.observe((event)=>{
- event.keysChanged.forEach((userDescription)=>initUser(storeType.get(userDescription), userDescription));
- });
- // add intial data
- storeType.forEach(initUser);
- }
- /**
- * @param {Doc} doc
- * @param {number} clientid
- * @param {string} userDescription
- * @param {Object} conf
- * @param {function(Transaction, DeleteSet):boolean} [conf.filter]
- */ setUserMapping(doc, clientid, userDescription, { filter: filter = ()=>true } = {}) {
- const users = this.yusers;
- let user = users.get(userDescription);
- if (!user) {
- user = new $52a83e33f2b9e935$export$a5c7b93649eaf8f8();
- user.set("ids", new $52a83e33f2b9e935$export$c4be6576ca6fe4aa());
- user.set("ds", new $52a83e33f2b9e935$export$c4be6576ca6fe4aa());
- users.set(userDescription, user);
- }
- user.get("ids").push([
- clientid
- ]);
- users.observe((_event)=>{
- setTimeout(()=>{
- const userOverwrite = users.get(userDescription);
- if (userOverwrite !== user) {
- // user was overwritten, port all data over to the next user object
- // @todo Experiment with Y.Sets here
- user = userOverwrite;
- // @todo iterate over old type
- this.clients.forEach((_userDescription, clientid)=>{
- if (userDescription === _userDescription) user.get("ids").push([
- clientid
- ]);
- });
- const encoder = new $52a83e33f2b9e935$var$DSEncoderV1();
- const ds = this.dss.get(userDescription);
- if (ds) {
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, ds);
- user.get("ds").push([
- encoder.toUint8Array()
- ]);
- }
- }
- }, 0);
- });
- doc.on("afterTransaction", /** @param {Transaction} transaction */ (transaction)=>{
- setTimeout(()=>{
- const yds = user.get("ds");
- const ds = transaction.deleteSet;
- if (transaction.local && ds.clients.size > 0 && filter(transaction, ds)) {
- const encoder = new $52a83e33f2b9e935$var$DSEncoderV1();
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, ds);
- yds.push([
- encoder.toUint8Array()
- ]);
- }
- });
- });
- }
- /**
- * @param {number} clientid
- * @return {any}
- */ getUserByClientId(clientid) {
- return this.clients.get(clientid) || null;
- }
- /**
- * @param {ID} id
- * @return {string | null}
- */ getUserByDeletedId(id) {
- for (const [userDescription, ds] of this.dss.entries()){
- if ($52a83e33f2b9e935$export$dcb04af092e44fde(ds, id)) return userDescription;
- }
- return null;
- }
-}
-/**
- * A relative position is based on the Yjs model and is not affected by document changes.
- * E.g. If you place a relative position before a certain character, it will always point to this character.
- * If you place a relative position at the end of a type, it will always point to the end of the type.
- *
- * A numeric position is often unsuited for user selections, because it does not change when content is inserted
- * before or after.
- *
- * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position.
- *
- * One of the properties must be defined.
- *
- * @example
- * // Current cursor position is at position 10
- * const relativePosition = createRelativePositionFromIndex(yText, 10)
- * // modify yText
- * yText.insert(0, 'abc')
- * yText.delete(3, 10)
- * // Compute the cursor position
- * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition)
- * absolutePosition.type === yText // => true
- * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3
- *
- */ class $52a83e33f2b9e935$export$da21a415c5907662 {
- /**
- * @param {ID|null} type
- * @param {string|null} tname
- * @param {ID|null} item
- * @param {number} assoc
- */ constructor(type, tname, item, assoc = 0){
- /**
- * @type {ID|null}
- */ this.type = type;
- /**
- * @type {string|null}
- */ this.tname = tname;
- /**
- * @type {ID | null}
- */ this.item = item;
- /**
- * A relative position is associated to a specific character. By default
- * assoc >= 0, the relative position is associated to the character
- * after the meant position.
- * I.e. position 1 in 'ab' is associated to character 'b'.
- *
- * If assoc < 0, then the relative position is associated to the caharacter
- * before the meant position.
- *
- * @type {number}
- */ this.assoc = assoc;
- }
-}
-/**
- * @param {RelativePosition} rpos
- * @return {any}
- */ const $52a83e33f2b9e935$export$a783b081767a452e = (rpos)=>{
- const json = {};
- if (rpos.type) json.type = rpos.type;
- if (rpos.tname) json.tname = rpos.tname;
- if (rpos.item) json.item = rpos.item;
- if (rpos.assoc != null) json.assoc = rpos.assoc;
- return json;
-};
-/**
- * @param {any} json
- * @return {RelativePosition}
- *
- * @function
- */ const $52a83e33f2b9e935$export$ddad8a1b8f7475d8 = (json)=>new $52a83e33f2b9e935$export$da21a415c5907662(json.type == null ? null : $52a83e33f2b9e935$export$6c7d4e6171d008d0(json.type.client, json.type.clock), json.tname || null, json.item == null ? null : $52a83e33f2b9e935$export$6c7d4e6171d008d0(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc);
-class $52a83e33f2b9e935$export$64c95a3fb7344864 {
- /**
- * @param {AbstractType} type
- * @param {number} index
- * @param {number} [assoc]
- */ constructor(type, index, assoc = 0){
- /**
- * @type {AbstractType}
- */ this.type = type;
- /**
- * @type {number}
- */ this.index = index;
- this.assoc = assoc;
- }
-}
-/**
- * @param {AbstractType} type
- * @param {number} index
- * @param {number} [assoc]
- *
- * @function
- */ const $52a83e33f2b9e935$var$createAbsolutePosition = (type, index, assoc = 0)=>new $52a83e33f2b9e935$export$64c95a3fb7344864(type, index, assoc);
-/**
- * @param {AbstractType} type
- * @param {ID|null} item
- * @param {number} [assoc]
- *
- * @function
- */ const $52a83e33f2b9e935$var$createRelativePosition = (type, item, assoc)=>{
- let typeid = null;
- let tname = null;
- if (type._item === null) tname = $52a83e33f2b9e935$export$e726a40920d54663(type);
- else typeid = $52a83e33f2b9e935$export$6c7d4e6171d008d0(type._item.id.client, type._item.id.clock);
- return new $52a83e33f2b9e935$export$da21a415c5907662(typeid, tname, item, assoc);
-};
-/**
- * Create a relativePosition based on a absolute position.
- *
- * @param {AbstractType} type The base type (e.g. YText or YArray).
- * @param {number} index The absolute position.
- * @param {number} [assoc]
- * @return {RelativePosition}
- *
- * @function
- */ const $52a83e33f2b9e935$export$197e7d99e3857e88 = (type, index, assoc = 0)=>{
- let t = type._start;
- if (assoc < 0) {
- // associated to the left character or the beginning of a type, increment index if possible.
- if (index === 0) return $52a83e33f2b9e935$var$createRelativePosition(type, null, assoc);
- index--;
- }
- while(t !== null){
- if (!t.deleted && t.countable) {
- if (t.length > index) // case 1: found position somewhere in the linked list
- return $52a83e33f2b9e935$var$createRelativePosition(type, $52a83e33f2b9e935$export$6c7d4e6171d008d0(t.id.client, t.id.clock + index), assoc);
- index -= t.length;
- }
- if (t.right === null && assoc < 0) // left-associated position, return last available id
- return $52a83e33f2b9e935$var$createRelativePosition(type, t.lastId, assoc);
- t = t.right;
- }
- return $52a83e33f2b9e935$var$createRelativePosition(type, null, assoc);
-};
-/**
- * @param {encoding.Encoder} encoder
- * @param {RelativePosition} rpos
- *
- * @function
- */ const $52a83e33f2b9e935$var$writeRelativePosition = (encoder, rpos)=>{
- const { type: type, tname: tname, item: item, assoc: assoc } = rpos;
- if (item !== null) {
- $1p1sv.writeVarUint(encoder, 0);
- $52a83e33f2b9e935$var$writeID(encoder, item);
- } else if (tname !== null) {
- // case 2: found position at the end of the list and type is stored in y.share
- $1p1sv.writeUint8(encoder, 1);
- $1p1sv.writeVarString(encoder, tname);
- } else if (type !== null) {
- // case 3: found position at the end of the list and type is attached to an item
- $1p1sv.writeUint8(encoder, 2);
- $52a83e33f2b9e935$var$writeID(encoder, type);
- } else throw $akmFO.unexpectedCase();
- $1p1sv.writeVarInt(encoder, assoc);
- return encoder;
-};
-/**
- * @param {RelativePosition} rpos
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$c5c95ef724203575 = (rpos)=>{
- const encoder = $1p1sv.createEncoder();
- $52a83e33f2b9e935$var$writeRelativePosition(encoder, rpos);
- return $1p1sv.toUint8Array(encoder);
-};
-/**
- * @param {decoding.Decoder} decoder
- * @return {RelativePosition}
- *
- * @function
- */ const $52a83e33f2b9e935$var$readRelativePosition = (decoder)=>{
- let type = null;
- let tname = null;
- let itemID = null;
- switch($f5RS8.readVarUint(decoder)){
- case 0:
- // case 1: found position somewhere in the linked list
- itemID = $52a83e33f2b9e935$var$readID(decoder);
- break;
- case 1:
- // case 2: found position at the end of the list and type is stored in y.share
- tname = $f5RS8.readVarString(decoder);
- break;
- case 2:
- // case 3: found position at the end of the list and type is attached to an item
- type = $52a83e33f2b9e935$var$readID(decoder);
- }
- const assoc = $f5RS8.hasContent(decoder) ? $f5RS8.readVarInt(decoder) : 0;
- return new $52a83e33f2b9e935$export$da21a415c5907662(type, tname, itemID, assoc);
-};
-/**
- * @param {Uint8Array} uint8Array
- * @return {RelativePosition}
- */ const $52a83e33f2b9e935$export$58a46cebc90e7851 = (uint8Array)=>$52a83e33f2b9e935$var$readRelativePosition($f5RS8.createDecoder(uint8Array));
-/**
- * @param {RelativePosition} rpos
- * @param {Doc} doc
- * @return {AbsolutePosition|null}
- *
- * @function
- */ const $52a83e33f2b9e935$export$8fc3152f62fb7ed1 = (rpos, doc)=>{
- const store = doc.store;
- const rightID = rpos.item;
- const typeID = rpos.type;
- const tname = rpos.tname;
- const assoc = rpos.assoc;
- let type = null;
- let index = 0;
- if (rightID !== null) {
- if ($52a83e33f2b9e935$export$50fdfeece43146fd(store, rightID.client) <= rightID.clock) return null;
- const res = $52a83e33f2b9e935$var$followRedone(store, rightID);
- const right = res.item;
- if (!(right instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2)) return null;
- type = /** @type {AbstractType} */ right.parent;
- if (type._item === null || !type._item.deleted) {
- index = right.deleted || !right.countable ? 0 : res.diff + (assoc >= 0 ? 0 : 1); // adjust position based on left association if necessary
- let n = right.left;
- while(n !== null){
- if (!n.deleted && n.countable) index += n.length;
- n = n.left;
- }
- }
- } else {
- if (tname !== null) type = doc.get(tname);
- else if (typeID !== null) {
- if ($52a83e33f2b9e935$export$50fdfeece43146fd(store, typeID.client) <= typeID.clock) // type does not exist yet
- return null;
- const { item: item } = $52a83e33f2b9e935$var$followRedone(store, typeID);
- if (item instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && item.content instanceof $52a83e33f2b9e935$export$e2e108cbe2e4f865) type = item.content.type;
- else // struct is garbage collected
- return null;
- } else throw $akmFO.unexpectedCase();
- if (assoc >= 0) index = type._length;
- else index = 0;
- }
- return $52a83e33f2b9e935$var$createAbsolutePosition(type, index, rpos.assoc);
-};
-/**
- * @param {RelativePosition|null} a
- * @param {RelativePosition|null} b
- * @return {boolean}
- *
- * @function
- */ const $52a83e33f2b9e935$export$fc8bd253c948b475 = (a, b)=>a === b || a !== null && b !== null && a.tname === b.tname && $52a83e33f2b9e935$export$c0af976e7e459c02(a.item, b.item) && $52a83e33f2b9e935$export$c0af976e7e459c02(a.type, b.type) && a.assoc === b.assoc;
-class $52a83e33f2b9e935$export$c963130a5525248f {
- /**
- * @param {DeleteSet} ds
- * @param {Map} sv state map
- */ constructor(ds, sv){
- /**
- * @type {DeleteSet}
- */ this.ds = ds;
- /**
- * State Map
- * @type {Map}
- */ this.sv = sv;
- }
-}
-/**
- * @param {Snapshot} snap1
- * @param {Snapshot} snap2
- * @return {boolean}
- */ const $52a83e33f2b9e935$export$742742a0f55b273d = (snap1, snap2)=>{
- const ds1 = snap1.ds.clients;
- const ds2 = snap2.ds.clients;
- const sv1 = snap1.sv;
- const sv2 = snap2.sv;
- if (sv1.size !== sv2.size || ds1.size !== ds2.size) return false;
- for (const [key, value] of sv1.entries()){
- if (sv2.get(key) !== value) return false;
- }
- for (const [client, dsitems1] of ds1.entries()){
- const dsitems2 = ds2.get(client) || [];
- if (dsitems1.length !== dsitems2.length) return false;
- for(let i = 0; i < dsitems1.length; i++){
- const dsitem1 = dsitems1[i];
- const dsitem2 = dsitems2[i];
- if (dsitem1.clock !== dsitem2.clock || dsitem1.len !== dsitem2.len) return false;
- }
- }
- return true;
-};
-/**
- * @param {Snapshot} snapshot
- * @param {DSEncoderV1 | DSEncoderV2} [encoder]
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$b946cadc55f8e512 = (snapshot, encoder = new $52a83e33f2b9e935$var$DSEncoderV2())=>{
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, snapshot.ds);
- $52a83e33f2b9e935$var$writeStateVector(encoder, snapshot.sv);
- return encoder.toUint8Array();
-};
-/**
- * @param {Snapshot} snapshot
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$a6d29989648e995 = (snapshot)=>$52a83e33f2b9e935$export$b946cadc55f8e512(snapshot, new $52a83e33f2b9e935$var$DSEncoderV1());
-/**
- * @param {Uint8Array} buf
- * @param {DSDecoderV1 | DSDecoderV2} [decoder]
- * @return {Snapshot}
- */ const $52a83e33f2b9e935$export$b0049fa299f4f58e = (buf, decoder = new $52a83e33f2b9e935$var$DSDecoderV2($f5RS8.createDecoder(buf)))=>{
- return new $52a83e33f2b9e935$export$c963130a5525248f($52a83e33f2b9e935$var$readDeleteSet(decoder), $52a83e33f2b9e935$var$readStateVector(decoder));
-};
-/**
- * @param {Uint8Array} buf
- * @return {Snapshot}
- */ const $52a83e33f2b9e935$export$5c696daccf32bd2e = (buf)=>$52a83e33f2b9e935$export$b0049fa299f4f58e(buf, new $52a83e33f2b9e935$var$DSDecoderV1($f5RS8.createDecoder(buf)));
-/**
- * @param {DeleteSet} ds
- * @param {Map} sm
- * @return {Snapshot}
- */ const $52a83e33f2b9e935$export$548fae0445f878fd = (ds, sm)=>new $52a83e33f2b9e935$export$c963130a5525248f(ds, sm);
-const $52a83e33f2b9e935$export$d4568a81dd107a34 = $52a83e33f2b9e935$export$548fae0445f878fd($52a83e33f2b9e935$export$8cbac0d946238699(), new Map());
-/**
- * @param {Doc} doc
- * @return {Snapshot}
- */ const $52a83e33f2b9e935$export$b8801ea43165ed7d = (doc)=>$52a83e33f2b9e935$export$548fae0445f878fd($52a83e33f2b9e935$export$8450d668bec558e2(doc.store), $52a83e33f2b9e935$var$getStateVector(doc.store));
-/**
- * @param {Item} item
- * @param {Snapshot|undefined} snapshot
- *
- * @protected
- * @function
- */ const $52a83e33f2b9e935$var$isVisible = (item, snapshot)=>snapshot === undefined ? !item.deleted : snapshot.sv.has(item.id.client) && (snapshot.sv.get(item.id.client) || 0) > item.id.clock && !$52a83e33f2b9e935$export$dcb04af092e44fde(snapshot.ds, item.id);
-/**
- * @param {Transaction} transaction
- * @param {Snapshot} snapshot
- */ const $52a83e33f2b9e935$var$splitSnapshotAffectedStructs = (transaction, snapshot)=>{
- const meta = $e6DQe.setIfUndefined(transaction.meta, $52a83e33f2b9e935$var$splitSnapshotAffectedStructs, $gB6ZU.create);
- const store = transaction.doc.store;
- // check if we already split for this snapshot
- if (!meta.has(snapshot)) {
- snapshot.sv.forEach((clock, client)=>{
- if (clock < $52a83e33f2b9e935$export$50fdfeece43146fd(store, client)) $52a83e33f2b9e935$var$getItemCleanStart(transaction, $52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock));
- });
- $52a83e33f2b9e935$export$8afefebbaf4e4c78(transaction, snapshot.ds, (_item)=>{});
- meta.add(snapshot);
- }
-};
-/**
- * @example
- * const ydoc = new Y.Doc({ gc: false })
- * ydoc.getText().insert(0, 'world!')
- * const snapshot = Y.snapshot(ydoc)
- * ydoc.getText().insert(0, 'hello ')
- * const restored = Y.createDocFromSnapshot(ydoc, snapshot)
- * assert(restored.getText().toString() === 'world!')
- *
- * @param {Doc} originDoc
- * @param {Snapshot} snapshot
- * @param {Doc} [newDoc] Optionally, you may define the Yjs document that receives the data from originDoc
- * @return {Doc}
- */ const $52a83e33f2b9e935$export$5be4ae1e1e56a014 = (originDoc, snapshot, newDoc = new $52a83e33f2b9e935$export$bceacc74c2212615())=>{
- if (originDoc.gc) // we should not try to restore a GC-ed document, because some of the restored items might have their content deleted
- throw new Error("Garbage-collection must be disabled in `originDoc`!");
- const { sv: sv, ds: ds } = snapshot;
- const encoder = new $52a83e33f2b9e935$var$UpdateEncoderV2();
- originDoc.transact((transaction)=>{
- let size = 0;
- sv.forEach((clock)=>{
- if (clock > 0) size++;
- });
- $1p1sv.writeVarUint(encoder.restEncoder, size);
- // splitting the structs before writing them to the encoder
- for (const [client, clock] of sv){
- if (clock === 0) continue;
- if (clock < $52a83e33f2b9e935$export$50fdfeece43146fd(originDoc.store, client)) $52a83e33f2b9e935$var$getItemCleanStart(transaction, $52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock));
- const structs = originDoc.store.clients.get(client) || [];
- const lastStructIndex = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, clock - 1);
- // write # encoded structs
- $1p1sv.writeVarUint(encoder.restEncoder, lastStructIndex + 1);
- encoder.writeClient(client);
- // first clock written is 0
- $1p1sv.writeVarUint(encoder.restEncoder, 0);
- for(let i = 0; i <= lastStructIndex; i++)structs[i].write(encoder, 0);
- }
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, ds);
- });
- $52a83e33f2b9e935$export$acc3b0324aabf1b6(newDoc, encoder.toUint8Array(), "snapshot");
- return newDoc;
-};
-/**
- * @param {Snapshot} snapshot
- * @param {Uint8Array} update
- * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]
- */ const $52a83e33f2b9e935$var$snapshotContainsUpdateV2 = (snapshot, update, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- const updateDecoder = new YDecoder($f5RS8.createDecoder(update));
- const lazyDecoder = new $52a83e33f2b9e935$var$LazyStructReader(updateDecoder, false);
- for(let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()){
- if ((snapshot.sv.get(curr.id.client) || 0) < curr.id.clock + curr.length) return false;
- }
- const mergedDS = $52a83e33f2b9e935$var$mergeDeleteSets([
- snapshot.ds,
- $52a83e33f2b9e935$var$readDeleteSet(updateDecoder)
- ]);
- return $52a83e33f2b9e935$export$9697b72c46fd3a5d(snapshot.ds, mergedDS);
-};
-/**
- * @param {Snapshot} snapshot
- * @param {Uint8Array} update
- */ const $52a83e33f2b9e935$export$f938135bed5d8db7 = (snapshot, update)=>$52a83e33f2b9e935$var$snapshotContainsUpdateV2(snapshot, update, $52a83e33f2b9e935$var$UpdateDecoderV1);
-class $52a83e33f2b9e935$var$StructStore {
- constructor(){
- /**
- * @type {Map>}
- */ this.clients = new Map();
- /**
- * @type {null | { missing: Map, update: Uint8Array }}
- */ this.pendingStructs = null;
- /**
- * @type {null | Uint8Array}
- */ this.pendingDs = null;
- }
-}
-/**
- * Return the states as a Map.
- * Note that clock refers to the next expected clock id.
- *
- * @param {StructStore} store
- * @return {Map}
- *
- * @public
- * @function
- */ const $52a83e33f2b9e935$var$getStateVector = (store)=>{
- const sm = new Map();
- store.clients.forEach((structs, client)=>{
- const struct = structs[structs.length - 1];
- sm.set(client, struct.id.clock + struct.length);
- });
- return sm;
-};
-/**
- * @param {StructStore} store
- * @param {number} client
- * @return {number}
- *
- * @public
- * @function
- */ const $52a83e33f2b9e935$export$50fdfeece43146fd = (store, client)=>{
- const structs = store.clients.get(client);
- if (structs === undefined) return 0;
- const lastStruct = structs[structs.length - 1];
- return lastStruct.id.clock + lastStruct.length;
-};
-/**
- * @param {StructStore} store
- * @param {GC|Item} struct
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$addStruct = (store, struct)=>{
- let structs = store.clients.get(struct.id.client);
- if (structs === undefined) {
- structs = [];
- store.clients.set(struct.id.client, structs);
- } else {
- const lastStruct = structs[structs.length - 1];
- if (lastStruct.id.clock + lastStruct.length !== struct.id.clock) throw $akmFO.unexpectedCase();
- }
- structs.push(struct);
-};
-/**
- * Perform a binary search on a sorted array
- * @param {Array
- } structs
- * @param {number} clock
- * @return {number}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$5f8f02523cf47b58 = (structs, clock)=>{
- let left = 0;
- let right = structs.length - 1;
- let mid = structs[right];
- let midclock = mid.id.clock;
- if (midclock === clock) return right;
- // @todo does it even make sense to pivot the search?
- // If a good split misses, it might actually increase the time to find the correct item.
- // Currently, the only advantage is that search with pivoting might find the item on the first try.
- let midindex = $kuitL.floor(clock / (midclock + mid.length - 1) * right); // pivoting the search
- while(left <= right){
- mid = structs[midindex];
- midclock = mid.id.clock;
- if (midclock <= clock) {
- if (clock < midclock + mid.length) return midindex;
- left = midindex + 1;
- } else right = midindex - 1;
- midindex = $kuitL.floor((left + right) / 2);
- }
- // Always check state before looking for a struct in StructStore
- // Therefore the case of not finding a struct is unexpected
- throw $akmFO.unexpectedCase();
-};
-/**
- * Expects that id is actually in store. This function throws or is an infinite loop otherwise.
- *
- * @param {StructStore} store
- * @param {ID} id
- * @return {GC|Item}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$find = (store, id)=>{
- /**
- * @type {Array}
- */ // @ts-ignore
- const structs = store.clients.get(id.client);
- return structs[$52a83e33f2b9e935$export$5f8f02523cf47b58(structs, id.clock)];
-};
-/**
- * Expects that id is actually in store. This function throws or is an infinite loop otherwise.
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$f92dfeb71e9bb569 = /** @type {function(StructStore,ID):Item} */ $52a83e33f2b9e935$var$find;
-/**
- * @param {Transaction} transaction
- * @param {Array
- } structs
- * @param {number} clock
- */ const $52a83e33f2b9e935$var$findIndexCleanStart = (transaction, structs, clock)=>{
- const index = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, clock);
- const struct = structs[index];
- if (struct.id.clock < clock && struct instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2) {
- structs.splice(index + 1, 0, $52a83e33f2b9e935$var$splitItem(transaction, struct, clock - struct.id.clock));
- return index + 1;
- }
- return index;
-};
-/**
- * Expects that id is actually in store. This function throws or is an infinite loop otherwise.
- *
- * @param {Transaction} transaction
- * @param {ID} id
- * @return {Item}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$getItemCleanStart = (transaction, id)=>{
- const structs = /** @type {Array
- } */ transaction.doc.store.clients.get(id.client);
- return structs[$52a83e33f2b9e935$var$findIndexCleanStart(transaction, structs, id.clock)];
-};
-/**
- * Expects that id is actually in store. This function throws or is an infinite loop otherwise.
- *
- * @param {Transaction} transaction
- * @param {StructStore} store
- * @param {ID} id
- * @return {Item}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$getItemCleanEnd = (transaction, store, id)=>{
- /**
- * @type {Array
- }
- */ // @ts-ignore
- const structs = store.clients.get(id.client);
- const index = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, id.clock);
- const struct = structs[index];
- if (id.clock !== struct.id.clock + struct.length - 1 && struct.constructor !== $52a83e33f2b9e935$export$12d259ff017e6b58) structs.splice(index + 1, 0, $52a83e33f2b9e935$var$splitItem(transaction, struct, id.clock - struct.id.clock + 1));
- return struct;
-};
-/**
- * Replace `item` with `newitem` in store
- * @param {StructStore} store
- * @param {GC|Item} struct
- * @param {GC|Item} newStruct
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$replaceStruct = (store, struct, newStruct)=>{
- const structs = /** @type {Array} */ store.clients.get(struct.id.client);
- structs[$52a83e33f2b9e935$export$5f8f02523cf47b58(structs, struct.id.clock)] = newStruct;
-};
-/**
- * Iterate over a range of structs
- *
- * @param {Transaction} transaction
- * @param {Array
- } structs
- * @param {number} clockStart Inclusive start
- * @param {number} len
- * @param {function(GC|Item):void} f
- *
- * @function
- */ const $52a83e33f2b9e935$var$iterateStructs = (transaction, structs, clockStart, len, f)=>{
- if (len === 0) return;
- const clockEnd = clockStart + len;
- let index = $52a83e33f2b9e935$var$findIndexCleanStart(transaction, structs, clockStart);
- let struct;
- do {
- struct = structs[index++];
- if (clockEnd < struct.id.clock + struct.length) $52a83e33f2b9e935$var$findIndexCleanStart(transaction, structs, clockEnd);
- f(struct);
- }while (index < structs.length && structs[index].id.clock < clockEnd);
-};
-/**
- * A transaction is created for every change on the Yjs model. It is possible
- * to bundle changes on the Yjs model in a single transaction to
- * minimize the number on messages sent and the number of observer calls.
- * If possible the user of this library should bundle as many changes as
- * possible. Here is an example to illustrate the advantages of bundling:
- *
- * @example
- * const map = y.define('map', YMap)
- * // Log content when change is triggered
- * map.observe(() => {
- * console.log('change triggered')
- * })
- * // Each change on the map type triggers a log message:
- * map.set('a', 0) // => "change triggered"
- * map.set('b', 0) // => "change triggered"
- * // When put in a transaction, it will trigger the log after the transaction:
- * y.transact(() => {
- * map.set('a', 1)
- * map.set('b', 1)
- * }) // => "change triggered"
- *
- * @public
- */ class $52a83e33f2b9e935$export$febc5573c75cefb0 {
- /**
- * @param {Doc} doc
- * @param {any} origin
- * @param {boolean} local
- */ constructor(doc, origin, local){
- /**
- * The Yjs instance.
- * @type {Doc}
- */ this.doc = doc;
- /**
- * Describes the set of deleted items by ids
- * @type {DeleteSet}
- */ this.deleteSet = new $52a83e33f2b9e935$var$DeleteSet();
- /**
- * Holds the state before the transaction started.
- * @type {Map}
- */ this.beforeState = $52a83e33f2b9e935$var$getStateVector(doc.store);
- /**
- * Holds the state after the transaction.
- * @type {Map}
- */ this.afterState = new Map();
- /**
- * All types that were directly modified (property added or child
- * inserted/deleted). New types are not included in this Set.
- * Maps from type to parentSubs (`item.parentSub = null` for YArray)
- * @type {Map>,Set>}
- */ this.changed = new Map();
- /**
- * Stores the events for the types that observe also child elements.
- * It is mainly used by `observeDeep`.
- * @type {Map>,Array>>}
- */ this.changedParentTypes = new Map();
- /**
- * @type {Array}
- */ this._mergeStructs = [];
- /**
- * @type {any}
- */ this.origin = origin;
- /**
- * Stores meta information on the transaction
- * @type {Map}
- */ this.meta = new Map();
- /**
- * Whether this change originates from this doc.
- * @type {boolean}
- */ this.local = local;
- /**
- * @type {Set}
- */ this.subdocsAdded = new Set();
- /**
- * @type {Set}
- */ this.subdocsRemoved = new Set();
- /**
- * @type {Set}
- */ this.subdocsLoaded = new Set();
- /**
- * @type {boolean}
- */ this._needFormattingCleanup = false;
- }
-}
-/**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- * @param {Transaction} transaction
- * @return {boolean} Whether data was written.
- */ const $52a83e33f2b9e935$var$writeUpdateMessageFromTransaction = (encoder, transaction)=>{
- if (transaction.deleteSet.clients.size === 0 && !$e6DQe.any(transaction.afterState, (clock, client)=>transaction.beforeState.get(client) !== clock)) return false;
- $52a83e33f2b9e935$var$sortAndMergeDeleteSet(transaction.deleteSet);
- $52a83e33f2b9e935$var$writeStructsFromTransaction(encoder, transaction);
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, transaction.deleteSet);
- return true;
-};
-/**
- * If `type.parent` was added in current transaction, `type` technically
- * did not change, it was just added and we should not fire events for `type`.
- *
- * @param {Transaction} transaction
- * @param {AbstractType>} type
- * @param {string|null} parentSub
- */ const $52a83e33f2b9e935$var$addChangedTypeToTransaction = (transaction, type, parentSub)=>{
- const item = type._item;
- if (item === null || item.id.clock < (transaction.beforeState.get(item.id.client) || 0) && !item.deleted) $e6DQe.setIfUndefined(transaction.changed, type, $gB6ZU.create).add(parentSub);
-};
-/**
- * @param {Array} structs
- * @param {number} pos
- * @return {number} # of merged structs
- */ const $52a83e33f2b9e935$var$tryToMergeWithLefts = (structs, pos)=>{
- let right = structs[pos];
- let left = structs[pos - 1];
- let i = pos;
- for(; i > 0; right = left, left = structs[--i - 1]){
- if (left.deleted === right.deleted && left.constructor === right.constructor) {
- if (left.mergeWith(right)) {
- if (right instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && right.parentSub !== null && /** @type {AbstractType} */ right.parent._map.get(right.parentSub) === right) /** @type {AbstractType} */ right.parent._map.set(right.parentSub, /** @type {Item} */ left);
- continue;
- }
- }
- break;
- }
- const merged = pos - i;
- if (merged) // remove all merged structs from the array
- structs.splice(pos + 1 - merged, merged);
- return merged;
-};
-/**
- * @param {DeleteSet} ds
- * @param {StructStore} store
- * @param {function(Item):boolean} gcFilter
- */ const $52a83e33f2b9e935$var$tryGcDeleteSet = (ds, store, gcFilter)=>{
- for (const [client, deleteItems] of ds.clients.entries()){
- const structs = /** @type {Array} */ store.clients.get(client);
- for(let di = deleteItems.length - 1; di >= 0; di--){
- const deleteItem = deleteItems[di];
- const endDeleteItemClock = deleteItem.clock + deleteItem.len;
- for(let si = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, deleteItem.clock), struct = structs[si]; si < structs.length && struct.id.clock < endDeleteItemClock; struct = structs[++si]){
- const struct = structs[si];
- if (deleteItem.clock + deleteItem.len <= struct.id.clock) break;
- if (struct instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && struct.deleted && !struct.keep && gcFilter(struct)) struct.gc(store, false);
- }
- }
- }
-};
-/**
- * @param {DeleteSet} ds
- * @param {StructStore} store
- */ const $52a83e33f2b9e935$var$tryMergeDeleteSet = (ds, store)=>{
- // try to merge deleted / gc'd items
- // merge from right to left for better efficiecy and so we don't miss any merge targets
- ds.clients.forEach((deleteItems, client)=>{
- const structs = /** @type {Array} */ store.clients.get(client);
- for(let di = deleteItems.length - 1; di >= 0; di--){
- const deleteItem = deleteItems[di];
- // start with merging the item next to the last deleted item
- const mostRightIndexToCheck = $kuitL.min(structs.length - 1, 1 + $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, deleteItem.clock + deleteItem.len - 1));
- for(let si = mostRightIndexToCheck, struct = structs[si]; si > 0 && struct.id.clock >= deleteItem.clock; struct = structs[si])si -= 1 + $52a83e33f2b9e935$var$tryToMergeWithLefts(structs, si);
- }
- });
-};
-/**
- * @param {DeleteSet} ds
- * @param {StructStore} store
- * @param {function(Item):boolean} gcFilter
- */ const $52a83e33f2b9e935$export$c2e5de00fc43f658 = (ds, store, gcFilter)=>{
- $52a83e33f2b9e935$var$tryGcDeleteSet(ds, store, gcFilter);
- $52a83e33f2b9e935$var$tryMergeDeleteSet(ds, store);
-};
-/**
- * @param {Array} transactionCleanups
- * @param {number} i
- */ const $52a83e33f2b9e935$var$cleanupTransactions = (transactionCleanups, i)=>{
- if (i < transactionCleanups.length) {
- const transaction = transactionCleanups[i];
- const doc = transaction.doc;
- const store = doc.store;
- const ds = transaction.deleteSet;
- const mergeStructs = transaction._mergeStructs;
- try {
- $52a83e33f2b9e935$var$sortAndMergeDeleteSet(ds);
- transaction.afterState = $52a83e33f2b9e935$var$getStateVector(transaction.doc.store);
- doc.emit("beforeObserverCalls", [
- transaction,
- doc
- ]);
- /**
- * An array of event callbacks.
- *
- * Each callback is called even if the other ones throw errors.
- *
- * @type {Array}
- */ const fs = [];
- // observe events on changed types
- transaction.changed.forEach((subs, itemtype)=>fs.push(()=>{
- if (itemtype._item === null || !itemtype._item.deleted) itemtype._callObserver(transaction, subs);
- }));
- fs.push(()=>{
- // deep observe events
- transaction.changedParentTypes.forEach((events, type)=>{
- // We need to think about the possibility that the user transforms the
- // Y.Doc in the event.
- if (type._dEH.l.length > 0 && (type._item === null || !type._item.deleted)) {
- events = events.filter((event)=>event.target._item === null || !event.target._item.deleted);
- events.forEach((event)=>{
- event.currentTarget = type;
- // path is relative to the current target
- event._path = null;
- });
- // sort events by path length so that top-level events are fired first.
- events.sort((event1, event2)=>event1.path.length - event2.path.length);
- // We don't need to check for events.length
- // because we know it has at least one element
- $52a83e33f2b9e935$var$callEventHandlerListeners(type._dEH, events, transaction);
- }
- });
- });
- fs.push(()=>doc.emit("afterTransaction", [
- transaction,
- doc
- ]));
- (0, $kXTKb.callAll)(fs, []);
- if (transaction._needFormattingCleanup) $52a83e33f2b9e935$var$cleanupYTextAfterTransaction(transaction);
- } finally{
- // Replace deleted items with ItemDeleted / GC.
- // This is where content is actually remove from the Yjs Doc.
- if (doc.gc) $52a83e33f2b9e935$var$tryGcDeleteSet(ds, store, doc.gcFilter);
- $52a83e33f2b9e935$var$tryMergeDeleteSet(ds, store);
- // on all affected store.clients props, try to merge
- transaction.afterState.forEach((clock, client)=>{
- const beforeClock = transaction.beforeState.get(client) || 0;
- if (beforeClock !== clock) {
- const structs = /** @type {Array} */ store.clients.get(client);
- // we iterate from right to left so we can safely remove entries
- const firstChangePos = $kuitL.max($52a83e33f2b9e935$export$5f8f02523cf47b58(structs, beforeClock), 1);
- for(let i = structs.length - 1; i >= firstChangePos;)i -= 1 + $52a83e33f2b9e935$var$tryToMergeWithLefts(structs, i);
- }
- });
- // try to merge mergeStructs
- // @todo: it makes more sense to transform mergeStructs to a DS, sort it, and merge from right to left
- // but at the moment DS does not handle duplicates
- for(let i = mergeStructs.length - 1; i >= 0; i--){
- const { client: client, clock: clock } = mergeStructs[i].id;
- const structs = /** @type {Array} */ store.clients.get(client);
- const replacedStructPos = $52a83e33f2b9e935$export$5f8f02523cf47b58(structs, clock);
- if (replacedStructPos + 1 < structs.length) {
- if ($52a83e33f2b9e935$var$tryToMergeWithLefts(structs, replacedStructPos + 1) > 1) continue; // no need to perform next check, both are already merged
- }
- if (replacedStructPos > 0) $52a83e33f2b9e935$var$tryToMergeWithLefts(structs, replacedStructPos);
- }
- if (!transaction.local && transaction.afterState.get(doc.clientID) !== transaction.beforeState.get(doc.clientID)) {
- $dcfNU.print($7i7Pw.ORANGE, $7i7Pw.BOLD, "[yjs] ", $7i7Pw.UNBOLD, $7i7Pw.RED, "Changed the client-id because another client seems to be using it.");
- doc.clientID = $52a83e33f2b9e935$var$generateNewClientId();
- }
- // @todo Merge all the transactions into one and provide send the data as a single update message
- doc.emit("afterTransactionCleanup", [
- transaction,
- doc
- ]);
- if (doc._observers.has("update")) {
- const encoder = new $52a83e33f2b9e935$export$99171b804d9c5b54();
- const hasContent = $52a83e33f2b9e935$var$writeUpdateMessageFromTransaction(encoder, transaction);
- if (hasContent) doc.emit("update", [
- encoder.toUint8Array(),
- transaction.origin,
- doc,
- transaction
- ]);
- }
- if (doc._observers.has("updateV2")) {
- const encoder = new $52a83e33f2b9e935$var$UpdateEncoderV2();
- const hasContent = $52a83e33f2b9e935$var$writeUpdateMessageFromTransaction(encoder, transaction);
- if (hasContent) doc.emit("updateV2", [
- encoder.toUint8Array(),
- transaction.origin,
- doc,
- transaction
- ]);
- }
- const { subdocsAdded: subdocsAdded, subdocsLoaded: subdocsLoaded, subdocsRemoved: subdocsRemoved } = transaction;
- if (subdocsAdded.size > 0 || subdocsRemoved.size > 0 || subdocsLoaded.size > 0) {
- subdocsAdded.forEach((subdoc)=>{
- subdoc.clientID = doc.clientID;
- if (subdoc.collectionid == null) subdoc.collectionid = doc.collectionid;
- doc.subdocs.add(subdoc);
- });
- subdocsRemoved.forEach((subdoc)=>doc.subdocs.delete(subdoc));
- doc.emit("subdocs", [
- {
- loaded: subdocsLoaded,
- added: subdocsAdded,
- removed: subdocsRemoved
- },
- doc,
- transaction
- ]);
- subdocsRemoved.forEach((subdoc)=>subdoc.destroy());
- }
- if (transactionCleanups.length <= i + 1) {
- doc._transactionCleanups = [];
- doc.emit("afterAllTransactions", [
- doc,
- transactionCleanups
- ]);
- } else $52a83e33f2b9e935$var$cleanupTransactions(transactionCleanups, i + 1);
- }
- }
-};
-/**
- * Implements the functionality of `y.transact(()=>{..})`
- *
- * @template T
- * @param {Doc} doc
- * @param {function(Transaction):T} f
- * @param {any} [origin=true]
- * @return {T}
- *
- * @function
- */ const $52a83e33f2b9e935$export$dac1bad6146b2469 = (doc, f, origin = null, local = true)=>{
- const transactionCleanups = doc._transactionCleanups;
- let initialCall = false;
- /**
- * @type {any}
- */ let result = null;
- if (doc._transaction === null) {
- initialCall = true;
- doc._transaction = new $52a83e33f2b9e935$export$febc5573c75cefb0(doc, origin, local);
- transactionCleanups.push(doc._transaction);
- if (transactionCleanups.length === 1) doc.emit("beforeAllTransactions", [
- doc
- ]);
- doc.emit("beforeTransaction", [
- doc._transaction,
- doc
- ]);
- }
- try {
- result = f(doc._transaction);
- } finally{
- if (initialCall) {
- const finishCleanup = doc._transaction === transactionCleanups[0];
- doc._transaction = null;
- if (finishCleanup) // The first transaction ended, now process observer calls.
- // Observer call may create new transactions for which we need to call the observers and do cleanup.
- // We don't want to nest these calls, so we execute these calls one after
- // another.
- // Also we need to ensure that all cleanups are called, even if the
- // observes throw errors.
- // This file is full of hacky try {} finally {} blocks to ensure that an
- // event can throw errors and also that the cleanup is called.
- $52a83e33f2b9e935$var$cleanupTransactions(transactionCleanups, 0);
- }
- }
- return result;
-};
-class $52a83e33f2b9e935$var$StackItem {
- /**
- * @param {DeleteSet} deletions
- * @param {DeleteSet} insertions
- */ constructor(deletions, insertions){
- this.insertions = insertions;
- this.deletions = deletions;
- /**
- * Use this to save and restore metadata like selection range
- */ this.meta = new Map();
- }
-}
-/**
- * @param {Transaction} tr
- * @param {UndoManager} um
- * @param {StackItem} stackItem
- */ const $52a83e33f2b9e935$var$clearUndoManagerStackItem = (tr, um, stackItem)=>{
- $52a83e33f2b9e935$export$8afefebbaf4e4c78(tr, stackItem.deletions, (item)=>{
- if (item instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && um.scope.some((type)=>$52a83e33f2b9e935$export$3c81af374b054d6a(type, item))) $52a83e33f2b9e935$var$keepItem(item, false);
- });
-};
-/**
- * @param {UndoManager} undoManager
- * @param {Array} stack
- * @param {string} eventType
- * @return {StackItem?}
- */ const $52a83e33f2b9e935$var$popStackItem = (undoManager, stack, eventType)=>{
- /**
- * Whether a change happened
- * @type {StackItem?}
- */ let result = null;
- /**
- * Keep a reference to the transaction so we can fire the event with the changedParentTypes
- * @type {any}
- */ let _tr = null;
- const doc = undoManager.doc;
- const scope = undoManager.scope;
- $52a83e33f2b9e935$export$dac1bad6146b2469(doc, (transaction)=>{
- while(stack.length > 0 && result === null){
- const store = doc.store;
- const stackItem = /** @type {StackItem} */ stack.pop();
- /**
- * @type {Set
- }
- */ const itemsToRedo = new Set();
- /**
- * @type {Array
- }
- */ const itemsToDelete = [];
- let performedChange = false;
- $52a83e33f2b9e935$export$8afefebbaf4e4c78(transaction, stackItem.insertions, (struct)=>{
- if (struct instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2) {
- if (struct.redone !== null) {
- let { item: item, diff: diff } = $52a83e33f2b9e935$var$followRedone(store, struct.id);
- if (diff > 0) item = $52a83e33f2b9e935$var$getItemCleanStart(transaction, $52a83e33f2b9e935$export$6c7d4e6171d008d0(item.id.client, item.id.clock + diff));
- struct = item;
- }
- if (!struct.deleted && scope.some((type)=>$52a83e33f2b9e935$export$3c81af374b054d6a(type, /** @type {Item} */ struct))) itemsToDelete.push(struct);
- }
- });
- $52a83e33f2b9e935$export$8afefebbaf4e4c78(transaction, stackItem.deletions, (struct)=>{
- if (struct instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && scope.some((type)=>$52a83e33f2b9e935$export$3c81af374b054d6a(type, struct)) && // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.
- !$52a83e33f2b9e935$export$dcb04af092e44fde(stackItem.insertions, struct.id)) itemsToRedo.add(struct);
- });
- itemsToRedo.forEach((struct)=>{
- performedChange = $52a83e33f2b9e935$var$redoItem(transaction, struct, itemsToRedo, stackItem.insertions, undoManager.ignoreRemoteMapChanges, undoManager) !== null || performedChange;
- });
- // We want to delete in reverse order so that children are deleted before
- // parents, so we have more information available when items are filtered.
- for(let i = itemsToDelete.length - 1; i >= 0; i--){
- const item = itemsToDelete[i];
- if (undoManager.deleteFilter(item)) {
- item.delete(transaction);
- performedChange = true;
- }
- }
- result = performedChange ? stackItem : null;
- }
- transaction.changed.forEach((subProps, type)=>{
- // destroy search marker if necessary
- if (subProps.has(null) && type._searchMarker) type._searchMarker.length = 0;
- });
- _tr = transaction;
- }, undoManager);
- if (result != null) {
- const changedParentTypes = _tr.changedParentTypes;
- undoManager.emit("stack-item-popped", [
- {
- stackItem: result,
- type: eventType,
- changedParentTypes: changedParentTypes
- },
- undoManager
- ]);
- }
- return result;
-};
-/**
- * @typedef {Object} UndoManagerOptions
- * @property {number} [UndoManagerOptions.captureTimeout=500]
- * @property {function(Transaction):boolean} [UndoManagerOptions.captureTransaction] Do not capture changes of a Transaction if result false.
- * @property {function(Item):boolean} [UndoManagerOptions.deleteFilter=()=>true] Sometimes
- * it is necessary to filter what an Undo/Redo operation can delete. If this
- * filter returns false, the type/item won't be deleted even it is in the
- * undo/redo scope.
- * @property {Set} [UndoManagerOptions.trackedOrigins=new Set([null])]
- * @property {boolean} [ignoreRemoteMapChanges] Experimental. By default, the UndoManager will never overwrite remote changes. Enable this property to enable overwriting remote changes on key-value changes (Y.Map, properties on Y.Xml, etc..).
- * @property {Doc} [doc] The document that this UndoManager operates on. Only needed if typeScope is empty.
- */ /**
- * Fires 'stack-item-added' event when a stack item was added to either the undo- or
- * the redo-stack. You may store additional stack information via the
- * metadata property on `event.stackItem.meta` (it is a `Map` of metadata properties).
- * Fires 'stack-item-popped' event when a stack item was popped from either the
- * undo- or the redo-stack. You may restore the saved stack information from `event.stackItem.meta`.
- *
- * @extends {Observable<'stack-item-added'|'stack-item-popped'|'stack-cleared'|'stack-item-updated'>}
- */ class $52a83e33f2b9e935$export$932a3f9a7e88971c extends (0, $9XqiC.Observable) {
- /**
- * @param {AbstractType|Array>} typeScope Accepts either a single type, or an array of types
- * @param {UndoManagerOptions} options
- */ constructor(typeScope, { captureTimeout: captureTimeout = 500, captureTransaction: captureTransaction = (_tr)=>true, deleteFilter: deleteFilter = ()=>true, trackedOrigins: trackedOrigins = new Set([
- null
- ]), ignoreRemoteMapChanges: ignoreRemoteMapChanges = false, doc: doc = /** @type {Doc} */ $7sfdv.isArray(typeScope) ? typeScope[0].doc : typeScope.doc } = {}){
- super();
- /**
- * @type {Array>}
- */ this.scope = [];
- this.doc = doc;
- this.addToScope(typeScope);
- this.deleteFilter = deleteFilter;
- trackedOrigins.add(this);
- this.trackedOrigins = trackedOrigins;
- this.captureTransaction = captureTransaction;
- /**
- * @type {Array}
- */ this.undoStack = [];
- /**
- * @type {Array}
- */ this.redoStack = [];
- /**
- * Whether the client is currently undoing (calling UndoManager.undo)
- *
- * @type {boolean}
- */ this.undoing = false;
- this.redoing = false;
- this.lastChange = 0;
- this.ignoreRemoteMapChanges = ignoreRemoteMapChanges;
- this.captureTimeout = captureTimeout;
- /**
- * @param {Transaction} transaction
- */ this.afterTransactionHandler = (transaction)=>{
- // Only track certain transactions
- if (!this.captureTransaction(transaction) || !this.scope.some((type)=>transaction.changedParentTypes.has(type)) || !this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) return;
- const undoing = this.undoing;
- const redoing = this.redoing;
- const stack = undoing ? this.redoStack : this.undoStack;
- if (undoing) this.stopCapturing(); // next undo should not be appended to last stack item
- else if (!redoing) // neither undoing nor redoing: delete redoStack
- this.clear(false, true);
- const insertions = new $52a83e33f2b9e935$var$DeleteSet();
- transaction.afterState.forEach((endClock, client)=>{
- const startClock = transaction.beforeState.get(client) || 0;
- const len = endClock - startClock;
- if (len > 0) $52a83e33f2b9e935$var$addToDeleteSet(insertions, client, startClock, len);
- });
- const now = $1oyOX.getUnixTime();
- let didAdd = false;
- if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {
- // append change to last stack op
- const lastOp = stack[stack.length - 1];
- lastOp.deletions = $52a83e33f2b9e935$var$mergeDeleteSets([
- lastOp.deletions,
- transaction.deleteSet
- ]);
- lastOp.insertions = $52a83e33f2b9e935$var$mergeDeleteSets([
- lastOp.insertions,
- insertions
- ]);
- } else {
- // create a new stack op
- stack.push(new $52a83e33f2b9e935$var$StackItem(transaction.deleteSet, insertions));
- didAdd = true;
- }
- if (!undoing && !redoing) this.lastChange = now;
- // make sure that deleted structs are not gc'd
- $52a83e33f2b9e935$export$8afefebbaf4e4c78(transaction, transaction.deleteSet, /** @param {Item|GC} item */ (item)=>{
- if (item instanceof $52a83e33f2b9e935$export$6d08773d2e66f8f2 && this.scope.some((type)=>$52a83e33f2b9e935$export$3c81af374b054d6a(type, item))) $52a83e33f2b9e935$var$keepItem(item, true);
- });
- const changeEvent = [
- {
- stackItem: stack[stack.length - 1],
- origin: transaction.origin,
- type: undoing ? "redo" : "undo",
- changedParentTypes: transaction.changedParentTypes
- },
- this
- ];
- if (didAdd) this.emit("stack-item-added", changeEvent);
- else this.emit("stack-item-updated", changeEvent);
- };
- this.doc.on("afterTransaction", this.afterTransactionHandler);
- this.doc.on("destroy", ()=>{
- this.destroy();
- });
- }
- /**
- * @param {Array> | AbstractType} ytypes
- */ addToScope(ytypes) {
- ytypes = $7sfdv.isArray(ytypes) ? ytypes : [
- ytypes
- ];
- ytypes.forEach((ytype)=>{
- if (this.scope.every((yt)=>yt !== ytype)) {
- if (ytype.doc !== this.doc) $dcfNU.warn("[yjs#509] Not same Y.Doc"); // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509
- this.scope.push(ytype);
- }
- });
- }
- /**
- * @param {any} origin
- */ addTrackedOrigin(origin) {
- this.trackedOrigins.add(origin);
- }
- /**
- * @param {any} origin
- */ removeTrackedOrigin(origin) {
- this.trackedOrigins.delete(origin);
- }
- clear(clearUndoStack = true, clearRedoStack = true) {
- if (clearUndoStack && this.canUndo() || clearRedoStack && this.canRedo()) this.doc.transact((tr)=>{
- if (clearUndoStack) {
- this.undoStack.forEach((item)=>$52a83e33f2b9e935$var$clearUndoManagerStackItem(tr, this, item));
- this.undoStack = [];
- }
- if (clearRedoStack) {
- this.redoStack.forEach((item)=>$52a83e33f2b9e935$var$clearUndoManagerStackItem(tr, this, item));
- this.redoStack = [];
- }
- this.emit("stack-cleared", [
- {
- undoStackCleared: clearUndoStack,
- redoStackCleared: clearRedoStack
- }
- ]);
- });
- }
- /**
- * UndoManager merges Undo-StackItem if they are created within time-gap
- * smaller than `options.captureTimeout`. Call `um.stopCapturing()` so that the next
- * StackItem won't be merged.
- *
- *
- * @example
- * // without stopCapturing
- * ytext.insert(0, 'a')
- * ytext.insert(1, 'b')
- * um.undo()
- * ytext.toString() // => '' (note that 'ab' was removed)
- * // with stopCapturing
- * ytext.insert(0, 'a')
- * um.stopCapturing()
- * ytext.insert(0, 'b')
- * um.undo()
- * ytext.toString() // => 'a' (note that only 'b' was removed)
- *
- */ stopCapturing() {
- this.lastChange = 0;
- }
- /**
- * Undo last changes on type.
- *
- * @return {StackItem?} Returns StackItem if a change was applied
- */ undo() {
- this.undoing = true;
- let res;
- try {
- res = $52a83e33f2b9e935$var$popStackItem(this, this.undoStack, "undo");
- } finally{
- this.undoing = false;
- }
- return res;
- }
- /**
- * Redo last undo operation.
- *
- * @return {StackItem?} Returns StackItem if a change was applied
- */ redo() {
- this.redoing = true;
- let res;
- try {
- res = $52a83e33f2b9e935$var$popStackItem(this, this.redoStack, "redo");
- } finally{
- this.redoing = false;
- }
- return res;
- }
- /**
- * Are undo steps available?
- *
- * @return {boolean} `true` if undo is possible
- */ canUndo() {
- return this.undoStack.length > 0;
- }
- /**
- * Are redo steps available?
- *
- * @return {boolean} `true` if redo is possible
- */ canRedo() {
- return this.redoStack.length > 0;
- }
- destroy() {
- this.trackedOrigins.delete(this);
- this.doc.off("afterTransaction", this.afterTransactionHandler);
- super.destroy();
- }
-}
-/**
- * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
- */ function* $52a83e33f2b9e935$var$lazyStructReaderGenerator(decoder) {
- const numOfStateUpdates = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < numOfStateUpdates; i++){
- const numberOfStructs = $f5RS8.readVarUint(decoder.restDecoder);
- const client = decoder.readClient();
- let clock = $f5RS8.readVarUint(decoder.restDecoder);
- for(let i = 0; i < numberOfStructs; i++){
- const info = decoder.readInfo();
- // @todo use switch instead of ifs
- if (info === 10) {
- const len = $f5RS8.readVarUint(decoder.restDecoder);
- yield new $52a83e33f2b9e935$var$Skip($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), len);
- clock += len;
- } else if (($1GdQd.BITS5 & info) !== 0) {
- const cantCopyParentInfo = (info & ($1GdQd.BIT7 | $1GdQd.BIT8)) === 0;
- // If parent = null and neither left nor right are defined, then we know that `parent` is child of `y`
- // and we read the next string as parentYKey.
- // It indicates how we store/retrieve parent from `y.share`
- // @type {string|null}
- const struct = new $52a83e33f2b9e935$export$6d08773d2e66f8f2($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), null, (info & $1GdQd.BIT8) === $1GdQd.BIT8 ? decoder.readLeftID() : null, null, (info & $1GdQd.BIT7) === $1GdQd.BIT7 ? decoder.readRightID() : null, // @ts-ignore Force writing a string here.
- cantCopyParentInfo ? decoder.readParentInfo() ? decoder.readString() : decoder.readLeftID() : null, cantCopyParentInfo && (info & $1GdQd.BIT6) === $1GdQd.BIT6 ? decoder.readString() : null, $52a83e33f2b9e935$var$readItemContent(decoder, info) // item content
- );
- yield struct;
- clock += struct.length;
- } else {
- const len = decoder.readLen();
- yield new $52a83e33f2b9e935$export$12d259ff017e6b58($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock), len);
- clock += len;
- }
- }
- }
-}
-class $52a83e33f2b9e935$var$LazyStructReader {
- /**
- * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
- * @param {boolean} filterSkips
- */ constructor(decoder, filterSkips){
- this.gen = $52a83e33f2b9e935$var$lazyStructReaderGenerator(decoder);
- /**
- * @type {null | Item | Skip | GC}
- */ this.curr = null;
- this.done = false;
- this.filterSkips = filterSkips;
- this.next();
- }
- /**
- * @return {Item | GC | Skip |null}
- */ next() {
- // ignore "Skip" structs
- do this.curr = this.gen.next().value || null;
- while (this.filterSkips && this.curr !== null && this.curr.constructor === $52a83e33f2b9e935$var$Skip);
- return this.curr;
- }
-}
-/**
- * @param {Uint8Array} update
- *
- */ const $52a83e33f2b9e935$export$d6235ced6e55ace9 = (update)=>$52a83e33f2b9e935$export$624b3f0248c2dc40(update, $52a83e33f2b9e935$var$UpdateDecoderV1);
-/**
- * @param {Uint8Array} update
- * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]
- *
- */ const $52a83e33f2b9e935$export$624b3f0248c2dc40 = (update, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- const structs = [];
- const updateDecoder = new YDecoder($f5RS8.createDecoder(update));
- const lazyDecoder = new $52a83e33f2b9e935$var$LazyStructReader(updateDecoder, false);
- for(let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next())structs.push(curr);
- $dcfNU.print("Structs: ", structs);
- const ds = $52a83e33f2b9e935$var$readDeleteSet(updateDecoder);
- $dcfNU.print("DeleteSet: ", ds);
-};
-/**
- * @param {Uint8Array} update
- *
- */ const $52a83e33f2b9e935$export$aa45cba8121663dc = (update)=>$52a83e33f2b9e935$export$2fed33908eb23d71(update, $52a83e33f2b9e935$var$UpdateDecoderV1);
-/**
- * @param {Uint8Array} update
- * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]
- *
- */ const $52a83e33f2b9e935$export$2fed33908eb23d71 = (update, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- const structs = [];
- const updateDecoder = new YDecoder($f5RS8.createDecoder(update));
- const lazyDecoder = new $52a83e33f2b9e935$var$LazyStructReader(updateDecoder, false);
- for(let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next())structs.push(curr);
- return {
- structs: structs,
- ds: $52a83e33f2b9e935$var$readDeleteSet(updateDecoder)
- };
-};
-class $52a83e33f2b9e935$var$LazyStructWriter {
- /**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
- */ constructor(encoder){
- this.currClient = 0;
- this.startClock = 0;
- this.written = 0;
- this.encoder = encoder;
- /**
- * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.
- *
- * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder.
- *
- * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are.
- * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information.
- *
- * @type {Array<{ written: number, restEncoder: Uint8Array }>}
- */ this.clientStructs = [];
- }
-}
-/**
- * @param {Array} updates
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$6319871659fd2460 = (updates)=>$52a83e33f2b9e935$export$ce273d78de0331d1(updates, $52a83e33f2b9e935$var$UpdateDecoderV1, $52a83e33f2b9e935$export$99171b804d9c5b54);
-/**
- * @param {Uint8Array} update
- * @param {typeof DSEncoderV1 | typeof DSEncoderV2} YEncoder
- * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$ed51750cf3ab2381 = (update, YEncoder = $52a83e33f2b9e935$var$DSEncoderV2, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- const encoder = new YEncoder();
- const updateDecoder = new $52a83e33f2b9e935$var$LazyStructReader(new YDecoder($f5RS8.createDecoder(update)), false);
- let curr = updateDecoder.curr;
- if (curr !== null) {
- let size = 0;
- let currClient = curr.id.client;
- let stopCounting = curr.id.clock !== 0; // must start at 0
- let currClock = stopCounting ? 0 : curr.id.clock + curr.length;
- for(; curr !== null; curr = updateDecoder.next()){
- if (currClient !== curr.id.client) {
- if (currClock !== 0) {
- size++;
- // We found a new client
- // write what we have to the encoder
- $1p1sv.writeVarUint(encoder.restEncoder, currClient);
- $1p1sv.writeVarUint(encoder.restEncoder, currClock);
- }
- currClient = curr.id.client;
- currClock = 0;
- stopCounting = curr.id.clock !== 0;
- }
- // we ignore skips
- if (curr.constructor === $52a83e33f2b9e935$var$Skip) stopCounting = true;
- if (!stopCounting) currClock = curr.id.clock + curr.length;
- }
- // write what we have
- if (currClock !== 0) {
- size++;
- $1p1sv.writeVarUint(encoder.restEncoder, currClient);
- $1p1sv.writeVarUint(encoder.restEncoder, currClock);
- }
- // prepend the size of the state vector
- const enc = $1p1sv.createEncoder();
- $1p1sv.writeVarUint(enc, size);
- $1p1sv.writeBinaryEncoder(enc, encoder.restEncoder);
- encoder.restEncoder = enc;
- return encoder.toUint8Array();
- } else {
- $1p1sv.writeVarUint(encoder.restEncoder, 0);
- return encoder.toUint8Array();
- }
-};
-/**
- * @param {Uint8Array} update
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$5c451fd8502b011f = (update)=>$52a83e33f2b9e935$export$ed51750cf3ab2381(update, $52a83e33f2b9e935$var$DSEncoderV1, $52a83e33f2b9e935$var$UpdateDecoderV1);
-/**
- * @param {Uint8Array} update
- * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} YDecoder
- * @return {{ from: Map, to: Map }}
- */ const $52a83e33f2b9e935$export$8212a58b2178fdcf = (update, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2)=>{
- /**
- * @type {Map}
- */ const from = new Map();
- /**
- * @type {Map}
- */ const to = new Map();
- const updateDecoder = new $52a83e33f2b9e935$var$LazyStructReader(new YDecoder($f5RS8.createDecoder(update)), false);
- let curr = updateDecoder.curr;
- if (curr !== null) {
- let currClient = curr.id.client;
- let currClock = curr.id.clock;
- // write the beginning to `from`
- from.set(currClient, currClock);
- for(; curr !== null; curr = updateDecoder.next()){
- if (currClient !== curr.id.client) {
- // We found a new client
- // write the end to `to`
- to.set(currClient, currClock);
- // write the beginning to `from`
- from.set(curr.id.client, curr.id.clock);
- // update currClient
- currClient = curr.id.client;
- }
- currClock = curr.id.clock + curr.length;
- }
- // write the end to `to`
- to.set(currClient, currClock);
- }
- return {
- from: from,
- to: to
- };
-};
-/**
- * @param {Uint8Array} update
- * @return {{ from: Map, to: Map }}
- */ const $52a83e33f2b9e935$export$e212b06fd4bf78fd = (update)=>$52a83e33f2b9e935$export$8212a58b2178fdcf(update, $52a83e33f2b9e935$var$UpdateDecoderV1);
-/**
- * This method is intended to slice any kind of struct and retrieve the right part.
- * It does not handle side-effects, so it should only be used by the lazy-encoder.
- *
- * @param {Item | GC | Skip} left
- * @param {number} diff
- * @return {Item | GC}
- */ const $52a83e33f2b9e935$var$sliceStruct = (left, diff)=>{
- if (left.constructor === $52a83e33f2b9e935$export$12d259ff017e6b58) {
- const { client: client, clock: clock } = left.id;
- return new $52a83e33f2b9e935$export$12d259ff017e6b58($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock + diff), left.length - diff);
- } else if (left.constructor === $52a83e33f2b9e935$var$Skip) {
- const { client: client, clock: clock } = left.id;
- return new $52a83e33f2b9e935$var$Skip($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock + diff), left.length - diff);
- } else {
- const leftItem = /** @type {Item} */ left;
- const { client: client, clock: clock } = leftItem.id;
- return new $52a83e33f2b9e935$export$6d08773d2e66f8f2($52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock + diff), null, $52a83e33f2b9e935$export$6c7d4e6171d008d0(client, clock + diff - 1), null, leftItem.rightOrigin, leftItem.parent, leftItem.parentSub, leftItem.content.splice(diff));
- }
-};
-/**
- *
- * This function works similarly to `readUpdateV2`.
- *
- * @param {Array} updates
- * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]
- * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]
- * @return {Uint8Array}
- */ const $52a83e33f2b9e935$export$ce273d78de0331d1 = (updates, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2, YEncoder = $52a83e33f2b9e935$var$UpdateEncoderV2)=>{
- if (updates.length === 1) return updates[0];
- const updateDecoders = updates.map((update)=>new YDecoder($f5RS8.createDecoder(update)));
- let lazyStructDecoders = updateDecoders.map((decoder)=>new $52a83e33f2b9e935$var$LazyStructReader(decoder, true));
- /**
- * @todo we don't need offset because we always slice before
- * @type {null | { struct: Item | GC | Skip, offset: number }}
- */ let currWrite = null;
- const updateEncoder = new YEncoder();
- // write structs lazily
- const lazyStructEncoder = new $52a83e33f2b9e935$var$LazyStructWriter(updateEncoder);
- // Note: We need to ensure that all lazyStructDecoders are fully consumed
- // Note: Should merge document updates whenever possible - even from different updates
- // Note: Should handle that some operations cannot be applied yet ()
- while(true){
- // Write higher clients first ⇒ sort by clientID & clock and remove decoders without content
- lazyStructDecoders = lazyStructDecoders.filter((dec)=>dec.curr !== null);
- lazyStructDecoders.sort(/** @type {function(any,any):number} */ (dec1, dec2)=>{
- if (dec1.curr.id.client === dec2.curr.id.client) {
- const clockDiff = dec1.curr.id.clock - dec2.curr.id.clock;
- if (clockDiff === 0) // @todo remove references to skip since the structDecoders must filter Skips.
- return dec1.curr.constructor === dec2.curr.constructor ? 0 : dec1.curr.constructor === $52a83e33f2b9e935$var$Skip ? 1 : -1 // we are filtering skips anyway.
- ;
- else return clockDiff;
- } else return dec2.curr.id.client - dec1.curr.id.client;
- });
- if (lazyStructDecoders.length === 0) break;
- const currDecoder = lazyStructDecoders[0];
- // write from currDecoder until the next operation is from another client or if filler-struct
- // then we need to reorder the decoders and find the next operation to write
- const firstClient = /** @type {Item | GC} */ currDecoder.curr.id.client;
- if (currWrite !== null) {
- let curr = /** @type {Item | GC | null} */ currDecoder.curr;
- let iterated = false;
- // iterate until we find something that we haven't written already
- // remember: first the high client-ids are written
- while(curr !== null && curr.id.clock + curr.length <= currWrite.struct.id.clock + currWrite.struct.length && curr.id.client >= currWrite.struct.id.client){
- curr = currDecoder.next();
- iterated = true;
- }
- if (curr === null || // current decoder is empty
- curr.id.client !== firstClient || // check whether there is another decoder that has has updates from `firstClient`
- iterated && curr.id.clock > currWrite.struct.id.clock + currWrite.struct.length // the above while loop was used and we are potentially missing updates
- ) continue;
- if (firstClient !== currWrite.struct.id.client) {
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);
- currWrite = {
- struct: curr,
- offset: 0
- };
- currDecoder.next();
- } else if (currWrite.struct.id.clock + currWrite.struct.length < curr.id.clock) {
- // @todo write currStruct & set currStruct = Skip(clock = currStruct.id.clock + currStruct.length, length = curr.id.clock - self.clock)
- if (currWrite.struct.constructor === $52a83e33f2b9e935$var$Skip) // extend existing skip
- currWrite.struct.length = curr.id.clock + curr.length - currWrite.struct.id.clock;
- else {
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);
- const diff = curr.id.clock - currWrite.struct.id.clock - currWrite.struct.length;
- /**
- * @type {Skip}
- */ const struct = new $52a83e33f2b9e935$var$Skip($52a83e33f2b9e935$export$6c7d4e6171d008d0(firstClient, currWrite.struct.id.clock + currWrite.struct.length), diff);
- currWrite = {
- struct: struct,
- offset: 0
- };
- }
- } else {
- const diff = currWrite.struct.id.clock + currWrite.struct.length - curr.id.clock;
- if (diff > 0) {
- if (currWrite.struct.constructor === $52a83e33f2b9e935$var$Skip) // prefer to slice Skip because the other struct might contain more information
- currWrite.struct.length -= diff;
- else curr = $52a83e33f2b9e935$var$sliceStruct(curr, diff);
- }
- if (!currWrite.struct.mergeWith(/** @type {any} */ curr)) {
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);
- currWrite = {
- struct: curr,
- offset: 0
- };
- currDecoder.next();
- }
- }
- } else {
- currWrite = {
- struct: /** @type {Item | GC} */ currDecoder.curr,
- offset: 0
- };
- currDecoder.next();
- }
- for(let next = currDecoder.curr; next !== null && next.id.client === firstClient && next.id.clock === currWrite.struct.id.clock + currWrite.struct.length && next.constructor !== $52a83e33f2b9e935$var$Skip; next = currDecoder.next()){
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);
- currWrite = {
- struct: next,
- offset: 0
- };
- }
- }
- if (currWrite !== null) {
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructEncoder, currWrite.struct, currWrite.offset);
- currWrite = null;
- }
- $52a83e33f2b9e935$var$finishLazyStructWriting(lazyStructEncoder);
- const dss = updateDecoders.map((decoder)=>$52a83e33f2b9e935$var$readDeleteSet(decoder));
- const ds = $52a83e33f2b9e935$var$mergeDeleteSets(dss);
- $52a83e33f2b9e935$var$writeDeleteSet(updateEncoder, ds);
- return updateEncoder.toUint8Array();
-};
-/**
- * @param {Uint8Array} update
- * @param {Uint8Array} sv
- * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]
- * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]
- */ const $52a83e33f2b9e935$export$a8143edf39d2ad8e = (update, sv, YDecoder = $52a83e33f2b9e935$var$UpdateDecoderV2, YEncoder = $52a83e33f2b9e935$var$UpdateEncoderV2)=>{
- const state = $52a83e33f2b9e935$export$324ac6fb20a844e3(sv);
- const encoder = new YEncoder();
- const lazyStructWriter = new $52a83e33f2b9e935$var$LazyStructWriter(encoder);
- const decoder = new YDecoder($f5RS8.createDecoder(update));
- const reader = new $52a83e33f2b9e935$var$LazyStructReader(decoder, false);
- while(reader.curr){
- const curr = reader.curr;
- const currClient = curr.id.client;
- const svClock = state.get(currClient) || 0;
- if (reader.curr.constructor === $52a83e33f2b9e935$var$Skip) {
- // the first written struct shouldn't be a skip
- reader.next();
- continue;
- }
- if (curr.id.clock + curr.length > svClock) {
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructWriter, curr, $kuitL.max(svClock - curr.id.clock, 0));
- reader.next();
- while(reader.curr && reader.curr.id.client === currClient){
- $52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyStructWriter, reader.curr, 0);
- reader.next();
- }
- } else // read until something new comes up
- while(reader.curr && reader.curr.id.client === currClient && reader.curr.id.clock + reader.curr.length <= svClock)reader.next();
- }
- $52a83e33f2b9e935$var$finishLazyStructWriting(lazyStructWriter);
- // write ds
- const ds = $52a83e33f2b9e935$var$readDeleteSet(decoder);
- $52a83e33f2b9e935$var$writeDeleteSet(encoder, ds);
- return encoder.toUint8Array();
-};
-/**
- * @param {Uint8Array} update
- * @param {Uint8Array} sv
- */ const $52a83e33f2b9e935$export$bf60b51d6c283426 = (update, sv)=>$52a83e33f2b9e935$export$a8143edf39d2ad8e(update, sv, $52a83e33f2b9e935$var$UpdateDecoderV1, $52a83e33f2b9e935$export$99171b804d9c5b54);
-/**
- * @param {LazyStructWriter} lazyWriter
- */ const $52a83e33f2b9e935$var$flushLazyStructWriter = (lazyWriter)=>{
- if (lazyWriter.written > 0) {
- lazyWriter.clientStructs.push({
- written: lazyWriter.written,
- restEncoder: $1p1sv.toUint8Array(lazyWriter.encoder.restEncoder)
- });
- lazyWriter.encoder.restEncoder = $1p1sv.createEncoder();
- lazyWriter.written = 0;
- }
-};
-/**
- * @param {LazyStructWriter} lazyWriter
- * @param {Item | GC} struct
- * @param {number} offset
- */ const $52a83e33f2b9e935$var$writeStructToLazyStructWriter = (lazyWriter, struct, offset)=>{
- // flush curr if we start another client
- if (lazyWriter.written > 0 && lazyWriter.currClient !== struct.id.client) $52a83e33f2b9e935$var$flushLazyStructWriter(lazyWriter);
- if (lazyWriter.written === 0) {
- lazyWriter.currClient = struct.id.client;
- // write next client
- lazyWriter.encoder.writeClient(struct.id.client);
- // write startClock
- $1p1sv.writeVarUint(lazyWriter.encoder.restEncoder, struct.id.clock + offset);
- }
- struct.write(lazyWriter.encoder, offset);
- lazyWriter.written++;
-};
-/**
- * Call this function when we collected all parts and want to
- * put all the parts together. After calling this method,
- * you can continue using the UpdateEncoder.
- *
- * @param {LazyStructWriter} lazyWriter
- */ const $52a83e33f2b9e935$var$finishLazyStructWriting = (lazyWriter)=>{
- $52a83e33f2b9e935$var$flushLazyStructWriter(lazyWriter);
- // this is a fresh encoder because we called flushCurr
- const restEncoder = lazyWriter.encoder.restEncoder;
- /**
- * Now we put all the fragments together.
- * This works similarly to `writeClientsStructs`
- */ // write # states that were updated - i.e. the clients
- $1p1sv.writeVarUint(restEncoder, lazyWriter.clientStructs.length);
- for(let i = 0; i < lazyWriter.clientStructs.length; i++){
- const partStructs = lazyWriter.clientStructs[i];
- /**
- * Works similarly to `writeStructs`
- */ // write # encoded structs
- $1p1sv.writeVarUint(restEncoder, partStructs.written);
- // write the rest of the fragment
- $1p1sv.writeUint8Array(restEncoder, partStructs.restEncoder);
- }
-};
-/**
- * @param {Uint8Array} update
- * @param {function(Item|GC|Skip):Item|GC|Skip} blockTransformer
- * @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} YDecoder
- * @param {typeof UpdateEncoderV2 | typeof UpdateEncoderV1 } YEncoder
- */ const $52a83e33f2b9e935$var$convertUpdateFormat = (update, blockTransformer, YDecoder, YEncoder)=>{
- const updateDecoder = new YDecoder($f5RS8.createDecoder(update));
- const lazyDecoder = new $52a83e33f2b9e935$var$LazyStructReader(updateDecoder, false);
- const updateEncoder = new YEncoder();
- const lazyWriter = new $52a83e33f2b9e935$var$LazyStructWriter(updateEncoder);
- for(let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next())$52a83e33f2b9e935$var$writeStructToLazyStructWriter(lazyWriter, blockTransformer(curr), 0);
- $52a83e33f2b9e935$var$finishLazyStructWriting(lazyWriter);
- const ds = $52a83e33f2b9e935$var$readDeleteSet(updateDecoder);
- $52a83e33f2b9e935$var$writeDeleteSet(updateEncoder, ds);
- return updateEncoder.toUint8Array();
-};
-/**
- * @typedef {Object} ObfuscatorOptions
- * @property {boolean} [ObfuscatorOptions.formatting=true]
- * @property {boolean} [ObfuscatorOptions.subdocs=true]
- * @property {boolean} [ObfuscatorOptions.yxml=true] Whether to obfuscate nodeName / hookName
- */ /**
- * @param {ObfuscatorOptions} obfuscator
- */ const $52a83e33f2b9e935$var$createObfuscator = ({ formatting: formatting = true, subdocs: subdocs = true, yxml: yxml = true } = {})=>{
- let i = 0;
- const mapKeyCache = $e6DQe.create();
- const nodeNameCache = $e6DQe.create();
- const formattingKeyCache = $e6DQe.create();
- const formattingValueCache = $e6DQe.create();
- formattingValueCache.set(null, null); // end of a formatting range should always be the end of a formatting range
- /**
- * @param {Item|GC|Skip} block
- * @return {Item|GC|Skip}
- */ return (block)=>{
- switch(block.constructor){
- case $52a83e33f2b9e935$export$12d259ff017e6b58:
- case $52a83e33f2b9e935$var$Skip:
- return block;
- case $52a83e33f2b9e935$export$6d08773d2e66f8f2:
- {
- const item = /** @type {Item} */ block;
- const content = item.content;
- switch(content.constructor){
- case $52a83e33f2b9e935$export$3b06e0b3a2ece602:
- break;
- case $52a83e33f2b9e935$export$e2e108cbe2e4f865:
- if (yxml) {
- const type = /** @type {ContentType} */ content.type;
- if (type instanceof $52a83e33f2b9e935$export$4db87581d3ca170d) type.nodeName = $e6DQe.setIfUndefined(nodeNameCache, type.nodeName, ()=>"node-" + i);
- if (type instanceof $52a83e33f2b9e935$export$ec64c1dd5e7a264) type.hookName = $e6DQe.setIfUndefined(nodeNameCache, type.hookName, ()=>"hook-" + i);
- }
- break;
- case $52a83e33f2b9e935$export$1d788b93bbb631a0:
- {
- const c = /** @type {ContentAny} */ content;
- c.arr = c.arr.map(()=>i);
- break;
- }
- case $52a83e33f2b9e935$export$e8d530cdf62d1cbd:
- {
- const c = /** @type {ContentBinary} */ content;
- c.content = new Uint8Array([
- i
- ]);
- break;
- }
- case $52a83e33f2b9e935$var$ContentDoc:
- {
- const c = /** @type {ContentDoc} */ content;
- if (subdocs) {
- c.opts = {};
- c.doc.guid = i + "";
- }
- break;
- }
- case $52a83e33f2b9e935$export$c3787ba7f6086664:
- {
- const c = /** @type {ContentEmbed} */ content;
- c.embed = {};
- break;
- }
- case $52a83e33f2b9e935$export$3194899188fb5a88:
- {
- const c = /** @type {ContentFormat} */ content;
- if (formatting) {
- c.key = $e6DQe.setIfUndefined(formattingKeyCache, c.key, ()=>i + "");
- c.value = $e6DQe.setIfUndefined(formattingValueCache, c.value, ()=>({
- i: i
- }));
- }
- break;
- }
- case $52a83e33f2b9e935$export$6a907ea8f733ecf3:
- {
- const c = /** @type {ContentJSON} */ content;
- c.arr = c.arr.map(()=>i);
- break;
- }
- case $52a83e33f2b9e935$export$ee670b2cf091bbb6:
- {
- const c = /** @type {ContentString} */ content;
- c.str = $6rcMi.repeat(i % 10 + "", c.str.length);
- break;
- }
- default:
- // unknown content type
- $akmFO.unexpectedCase();
- }
- if (item.parentSub) item.parentSub = $e6DQe.setIfUndefined(mapKeyCache, item.parentSub, ()=>i + "");
- i++;
- return block;
- }
- default:
- // unknown block-type
- $akmFO.unexpectedCase();
- }
- };
-};
-/**
- * This function obfuscates the content of a Yjs update. This is useful to share
- * buggy Yjs documents while significantly limiting the possibility that a
- * developer can on the user. Note that it might still be possible to deduce
- * some information by analyzing the "structure" of the document or by analyzing
- * the typing behavior using the CRDT-related metadata that is still kept fully
- * intact.
- *
- * @param {Uint8Array} update
- * @param {ObfuscatorOptions} [opts]
- */ const $52a83e33f2b9e935$export$2dc24d59ec48a24e = (update, opts)=>$52a83e33f2b9e935$var$convertUpdateFormat(update, $52a83e33f2b9e935$var$createObfuscator(opts), $52a83e33f2b9e935$var$UpdateDecoderV1, $52a83e33f2b9e935$export$99171b804d9c5b54);
-/**
- * @param {Uint8Array} update
- * @param {ObfuscatorOptions} [opts]
- */ const $52a83e33f2b9e935$export$90648fb14f8c31aa = (update, opts)=>$52a83e33f2b9e935$var$convertUpdateFormat(update, $52a83e33f2b9e935$var$createObfuscator(opts), $52a83e33f2b9e935$var$UpdateDecoderV2, $52a83e33f2b9e935$var$UpdateEncoderV2);
-/**
- * @param {Uint8Array} update
- */ const $52a83e33f2b9e935$export$162408325d5832c = (update)=>$52a83e33f2b9e935$var$convertUpdateFormat(update, $kXTKb.id, $52a83e33f2b9e935$var$UpdateDecoderV1, $52a83e33f2b9e935$var$UpdateEncoderV2);
-/**
- * @param {Uint8Array} update
- */ const $52a83e33f2b9e935$export$afffbdeed14adbd = (update)=>$52a83e33f2b9e935$var$convertUpdateFormat(update, $kXTKb.id, $52a83e33f2b9e935$var$UpdateDecoderV2, $52a83e33f2b9e935$export$99171b804d9c5b54);
-const $52a83e33f2b9e935$var$errorComputeChanges = "You must not compute changes after the event-handler fired.";
-/**
- * @template {AbstractType} T
- * YEvent describes the changes on a YType.
- */ class $52a83e33f2b9e935$export$80fac438977fb51c {
- /**
- * @param {T} target The changed type.
- * @param {Transaction} transaction
- */ constructor(target, transaction){
- /**
- * The type on which this event was created on.
- * @type {T}
- */ this.target = target;
- /**
- * The current target on which the observe callback is called.
- * @type {AbstractType}
- */ this.currentTarget = target;
- /**
- * The transaction that triggered this event.
- * @type {Transaction}
- */ this.transaction = transaction;
- /**
- * @type {Object|null}
- */ this._changes = null;
- /**
- * @type {null | Map}
- */ this._keys = null;
- /**
- * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>}
- */ this._delta = null;
- /**
- * @type {Array|null}
- */ this._path = null;
- }
- /**
- * Computes the path from `y` to the changed type.
- *
- * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with.
- *
- * The following property holds:
- * @example
- * let type = y
- * event.path.forEach(dir => {
- * type = type.get(dir)
- * })
- * type === event.target // => true
- */ get path() {
- return this._path || (this._path = $52a83e33f2b9e935$var$getPathTo(this.currentTarget, this.target));
- }
- /**
- * Check if a struct is deleted by this event.
- *
- * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
- *
- * @param {AbstractStruct} struct
- * @return {boolean}
- */ deletes(struct) {
- return $52a83e33f2b9e935$export$dcb04af092e44fde(this.transaction.deleteSet, struct.id);
- }
- /**
- * @type {Map}
- */ get keys() {
- if (this._keys === null) {
- if (this.transaction.doc._transactionCleanups.length === 0) throw $akmFO.create($52a83e33f2b9e935$var$errorComputeChanges);
- const keys = new Map();
- const target = this.target;
- const changed = /** @type Set */ this.transaction.changed.get(target);
- changed.forEach((key)=>{
- if (key !== null) {
- const item = /** @type {Item} */ target._map.get(key);
- /**
- * @type {'delete' | 'add' | 'update'}
- */ let action;
- let oldValue;
- if (this.adds(item)) {
- let prev = item.left;
- while(prev !== null && this.adds(prev))prev = prev.left;
- if (this.deletes(item)) {
- if (prev !== null && this.deletes(prev)) {
- action = "delete";
- oldValue = $7sfdv.last(prev.content.getContent());
- } else return;
- } else if (prev !== null && this.deletes(prev)) {
- action = "update";
- oldValue = $7sfdv.last(prev.content.getContent());
- } else {
- action = "add";
- oldValue = undefined;
- }
- } else {
- if (this.deletes(item)) {
- action = "delete";
- oldValue = $7sfdv.last(/** @type {Item} */ item.content.getContent());
- } else return; // nop
- }
- keys.set(key, {
- action: action,
- oldValue: oldValue
- });
- }
- });
- this._keys = keys;
- }
- return this._keys;
- }
- /**
- * This is a computed property. Note that this can only be safely computed during the
- * event call. Computing this property after other changes happened might result in
- * unexpected behavior (incorrect computation of deltas). A safe way to collect changes
- * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.
- *
- * @type {Array<{insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object}>}
- */ get delta() {
- return this.changes.delta;
- }
- /**
- * Check if a struct is added by this event.
- *
- * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
- *
- * @param {AbstractStruct} struct
- * @return {boolean}
- */ adds(struct) {
- return struct.id.clock >= (this.transaction.beforeState.get(struct.id.client) || 0);
- }
- /**
- * This is a computed property. Note that this can only be safely computed during the
- * event call. Computing this property after other changes happened might result in
- * unexpected behavior (incorrect computation of deltas). A safe way to collect changes
- * is to store the `changes` or the `delta` object. Avoid storing the `transaction` object.
- *
- * @type {{added:Set
- ,deleted:Set
- ,keys:Map,delta:Array<{insert?:Array|string, delete?:number, retain?:number}>}}
- */ get changes() {
- let changes = this._changes;
- if (changes === null) {
- if (this.transaction.doc._transactionCleanups.length === 0) throw $akmFO.create($52a83e33f2b9e935$var$errorComputeChanges);
- const target = this.target;
- const added = $gB6ZU.create();
- const deleted = $gB6ZU.create();
- /**
- * @type {Array<{insert:Array}|{delete:number}|{retain:number}>}
- */ const delta = [];
- changes = {
- added: added,
- deleted: deleted,
- delta: delta,
- keys: this.keys
- };
- const changed = /** @type Set */ this.transaction.changed.get(target);
- if (changed.has(null)) {
- /**
- * @type {any}
- */ let lastOp = null;
- const packOp = ()=>{
- if (lastOp) delta.push(lastOp);
- };
- for(let item = target._start; item !== null; item = item.right){
- if (item.deleted) {
- if (this.deletes(item) && !this.adds(item)) {
- if (lastOp === null || lastOp.delete === undefined) {
- packOp();
- lastOp = {
- delete: 0
- };
- }
- lastOp.delete += item.length;
- deleted.add(item);
- } // else nop
- } else if (this.adds(item)) {
- if (lastOp === null || lastOp.insert === undefined) {
- packOp();
- lastOp = {
- insert: []
- };
- }
- lastOp.insert = lastOp.insert.concat(item.content.getContent());
- added.add(item);
- } else {
- if (lastOp === null || lastOp.retain === undefined) {
- packOp();
- lastOp = {
- retain: 0
- };
- }
- lastOp.retain += item.length;
- }
- }
- if (lastOp !== null && lastOp.retain === undefined) packOp();
- }
- this._changes = changes;
- }
- return /** @type {any} */ changes;
- }
-}
-/**
- * Compute the path from this type to the specified target.
- *
- * @example
- * // `child` should be accessible via `type.get(path[0]).get(path[1])..`
- * const path = type.getPathTo(child)
- * // assuming `type instanceof YArray`
- * console.log(path) // might look like => [2, 'key1']
- * child === type.get(path[0]).get(path[1])
- *
- * @param {AbstractType} parent
- * @param {AbstractType} child target
- * @return {Array} Path to the target
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$getPathTo = (parent, child)=>{
- const path = [];
- while(child._item !== null && child !== parent){
- if (child._item.parentSub !== null) // parent is map-ish
- path.unshift(child._item.parentSub);
- else {
- // parent is array-ish
- let i = 0;
- let c = /** @type {AbstractType} */ child._item.parent._start;
- while(c !== child._item && c !== null){
- if (!c.deleted) i++;
- c = c.right;
- }
- path.unshift(i);
- }
- child = /** @type {AbstractType} */ child._item.parent;
- }
- return path;
-};
-const $52a83e33f2b9e935$var$maxSearchMarker = 80;
-/**
- * A unique timestamp that identifies each marker.
- *
- * Time is relative,.. this is more like an ever-increasing clock.
- *
- * @type {number}
- */ let $52a83e33f2b9e935$var$globalSearchMarkerTimestamp = 0;
-class $52a83e33f2b9e935$var$ArraySearchMarker {
- /**
- * @param {Item} p
- * @param {number} index
- */ constructor(p, index){
- p.marker = true;
- this.p = p;
- this.index = index;
- this.timestamp = $52a83e33f2b9e935$var$globalSearchMarkerTimestamp++;
- }
-}
-/**
- * @param {ArraySearchMarker} marker
- */ const $52a83e33f2b9e935$var$refreshMarkerTimestamp = (marker)=>{
- marker.timestamp = $52a83e33f2b9e935$var$globalSearchMarkerTimestamp++;
-};
-/**
- * This is rather complex so this function is the only thing that should overwrite a marker
- *
- * @param {ArraySearchMarker} marker
- * @param {Item} p
- * @param {number} index
- */ const $52a83e33f2b9e935$var$overwriteMarker = (marker, p, index)=>{
- marker.p.marker = false;
- marker.p = p;
- p.marker = true;
- marker.index = index;
- marker.timestamp = $52a83e33f2b9e935$var$globalSearchMarkerTimestamp++;
-};
-/**
- * @param {Array} searchMarker
- * @param {Item} p
- * @param {number} index
- */ const $52a83e33f2b9e935$var$markPosition = (searchMarker, p, index)=>{
- if (searchMarker.length >= $52a83e33f2b9e935$var$maxSearchMarker) {
- // override oldest marker (we don't want to create more objects)
- const marker = searchMarker.reduce((a, b)=>a.timestamp < b.timestamp ? a : b);
- $52a83e33f2b9e935$var$overwriteMarker(marker, p, index);
- return marker;
- } else {
- // create new marker
- const pm = new $52a83e33f2b9e935$var$ArraySearchMarker(p, index);
- searchMarker.push(pm);
- return pm;
- }
-};
-/**
- * Search marker help us to find positions in the associative array faster.
- *
- * They speed up the process of finding a position without much bookkeeping.
- *
- * A maximum of `maxSearchMarker` objects are created.
- *
- * This function always returns a refreshed marker (updated timestamp)
- *
- * @param {AbstractType} yarray
- * @param {number} index
- */ const $52a83e33f2b9e935$var$findMarker = (yarray, index)=>{
- if (yarray._start === null || index === 0 || yarray._searchMarker === null) return null;
- const marker = yarray._searchMarker.length === 0 ? null : yarray._searchMarker.reduce((a, b)=>$kuitL.abs(index - a.index) < $kuitL.abs(index - b.index) ? a : b);
- let p = yarray._start;
- let pindex = 0;
- if (marker !== null) {
- p = marker.p;
- pindex = marker.index;
- $52a83e33f2b9e935$var$refreshMarkerTimestamp(marker); // we used it, we might need to use it again
- }
- // iterate to right if possible
- while(p.right !== null && pindex < index){
- if (!p.deleted && p.countable) {
- if (index < pindex + p.length) break;
- pindex += p.length;
- }
- p = p.right;
- }
- // iterate to left if necessary (might be that pindex > index)
- while(p.left !== null && pindex > index){
- p = p.left;
- if (!p.deleted && p.countable) pindex -= p.length;
- }
- // we want to make sure that p can't be merged with left, because that would screw up everything
- // in that cas just return what we have (it is most likely the best marker anyway)
- // iterate to left until p can't be merged with left
- while(p.left !== null && p.left.id.client === p.id.client && p.left.id.clock + p.left.length === p.id.clock){
- p = p.left;
- if (!p.deleted && p.countable) pindex -= p.length;
- }
- // @todo remove!
- // assure position
- // {
- // let start = yarray._start
- // let pos = 0
- // while (start !== p) {
- // if (!start.deleted && start.countable) {
- // pos += start.length
- // }
- // start = /** @type {Item} */ (start.right)
- // }
- // if (pos !== pindex) {
- // debugger
- // throw new Error('Gotcha position fail!')
- // }
- // }
- // if (marker) {
- // if (window.lengthes == null) {
- // window.lengthes = []
- // window.getLengthes = () => window.lengthes.sort((a, b) => a - b)
- // }
- // window.lengthes.push(marker.index - pindex)
- // console.log('distance', marker.index - pindex, 'len', p && p.parent.length)
- // }
- if (marker !== null && $kuitL.abs(marker.index - pindex) < /** @type {YText|YArray} */ p.parent.length / $52a83e33f2b9e935$var$maxSearchMarker) {
- // adjust existing marker
- $52a83e33f2b9e935$var$overwriteMarker(marker, p, pindex);
- return marker;
- } else // create new marker
- return $52a83e33f2b9e935$var$markPosition(yarray._searchMarker, p, pindex);
-};
-/**
- * Update markers when a change happened.
- *
- * This should be called before doing a deletion!
- *
- * @param {Array} searchMarker
- * @param {number} index
- * @param {number} len If insertion, len is positive. If deletion, len is negative.
- */ const $52a83e33f2b9e935$var$updateMarkerChanges = (searchMarker, index, len)=>{
- for(let i = searchMarker.length - 1; i >= 0; i--){
- const m = searchMarker[i];
- if (len > 0) {
- /**
- * @type {Item|null}
- */ let p = m.p;
- p.marker = false;
- // Ideally we just want to do a simple position comparison, but this will only work if
- // search markers don't point to deleted items for formats.
- // Iterate marker to prev undeleted countable position so we know what to do when updating a position
- while(p && (p.deleted || !p.countable)){
- p = p.left;
- if (p && !p.deleted && p.countable) // adjust position. the loop should break now
- m.index -= p.length;
- }
- if (p === null || p.marker === true) {
- // remove search marker if updated position is null or if position is already marked
- searchMarker.splice(i, 1);
- continue;
- }
- m.p = p;
- p.marker = true;
- }
- if (index < m.index || len > 0 && index === m.index) m.index = $kuitL.max(index, m.index + len);
- }
-};
-/**
- * Accumulate all (list) children of a type and return them as an Array.
- *
- * @param {AbstractType} t
- * @return {Array
- }
- */ const $52a83e33f2b9e935$export$5418d693f13991b3 = (t)=>{
- let s = t._start;
- const arr = [];
- while(s){
- arr.push(s);
- s = s.right;
- }
- return arr;
-};
-/**
- * Call event listeners with an event. This will also add an event to all
- * parents (for `.observeDeep` handlers).
- *
- * @template EventType
- * @param {AbstractType} type
- * @param {Transaction} transaction
- * @param {EventType} event
- */ const $52a83e33f2b9e935$var$callTypeObservers = (type, transaction, event)=>{
- const changedType = type;
- const changedParentTypes = transaction.changedParentTypes;
- while(true){
- // @ts-ignore
- $e6DQe.setIfUndefined(changedParentTypes, type, ()=>[]).push(event);
- if (type._item === null) break;
- type = /** @type {AbstractType} */ type._item.parent;
- }
- $52a83e33f2b9e935$var$callEventHandlerListeners(changedType._eH, event, transaction);
-};
-/**
- * @template EventType
- * Abstract Yjs Type class
- */ class $52a83e33f2b9e935$export$c265dc8338484497 {
- constructor(){
- /**
- * @type {Item|null}
- */ this._item = null;
- /**
- * @type {Map}
- */ this._map = new Map();
- /**
- * @type {Item|null}
- */ this._start = null;
- /**
- * @type {Doc|null}
- */ this.doc = null;
- this._length = 0;
- /**
- * Event handlers
- * @type {EventHandler}
- */ this._eH = $52a83e33f2b9e935$var$createEventHandler();
- /**
- * Deep event handlers
- * @type {EventHandler>,Transaction>}
- */ this._dEH = $52a83e33f2b9e935$var$createEventHandler();
- /**
- * @type {null | Array}
- */ this._searchMarker = null;
- }
- /**
- * @return {AbstractType|null}
- */ get parent() {
- return this._item ? /** @type {AbstractType} */ this._item.parent : null;
- }
- /**
- * Integrate this type into the Yjs instance.
- *
- * * Save this struct in the os
- * * This type is sent to other client
- * * Observer functions are fired
- *
- * @param {Doc} y The Yjs instance
- * @param {Item|null} item
- */ _integrate(y, item) {
- this.doc = y;
- this._item = item;
- }
- /**
- * @return {AbstractType}
- */ _copy() {
- throw $akmFO.methodUnimplemented();
- }
- /**
- * @return {AbstractType}
- */ clone() {
- throw $akmFO.methodUnimplemented();
- }
- /**
- * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
- */ _write(_encoder) {}
- /**
- * The first non-deleted item
- */ get _first() {
- let n = this._start;
- while(n !== null && n.deleted)n = n.right;
- return n;
- }
- /**
- * Creates YEvent and calls all type observers.
- * Must be implemented by each type.
- *
- * @param {Transaction} transaction
- * @param {Set} _parentSubs Keys changed on this type. `null` if list was modified.
- */ _callObserver(transaction, _parentSubs) {
- if (!transaction.local && this._searchMarker) this._searchMarker.length = 0;
- }
- /**
- * Observe all events that are created on this type.
- *
- * @param {function(EventType, Transaction):void} f Observer function
- */ observe(f) {
- $52a83e33f2b9e935$var$addEventHandlerListener(this._eH, f);
- }
- /**
- * Observe all events that are created by this type and its children.
- *
- * @param {function(Array>,Transaction):void} f Observer function
- */ observeDeep(f) {
- $52a83e33f2b9e935$var$addEventHandlerListener(this._dEH, f);
- }
- /**
- * Unregister an observer function.
- *
- * @param {function(EventType,Transaction):void} f Observer function
- */ unobserve(f) {
- $52a83e33f2b9e935$var$removeEventHandlerListener(this._eH, f);
- }
- /**
- * Unregister an observer function.
- *
- * @param {function(Array>,Transaction):void} f Observer function
- */ unobserveDeep(f) {
- $52a83e33f2b9e935$var$removeEventHandlerListener(this._dEH, f);
- }
- /**
- * @abstract
- * @return {any}
- */ toJSON() {}
-}
-/**
- * @param {AbstractType} type
- * @param {number} start
- * @param {number} end
- * @return {Array}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListSlice = (type, start, end)=>{
- if (start < 0) start = type._length + start;
- if (end < 0) end = type._length + end;
- let len = end - start;
- const cs = [];
- let n = type._start;
- while(n !== null && len > 0){
- if (n.countable && !n.deleted) {
- const c = n.content.getContent();
- if (c.length <= start) start -= c.length;
- else {
- for(let i = start; i < c.length && len > 0; i++){
- cs.push(c[i]);
- len--;
- }
- start = 0;
- }
- }
- n = n.right;
- }
- return cs;
-};
-/**
- * @param {AbstractType} type
- * @return {Array}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListToArray = (type)=>{
- const cs = [];
- let n = type._start;
- while(n !== null){
- if (n.countable && !n.deleted) {
- const c = n.content.getContent();
- for(let i = 0; i < c.length; i++)cs.push(c[i]);
- }
- n = n.right;
- }
- return cs;
-};
-/**
- * @param {AbstractType} type
- * @param {Snapshot} snapshot
- * @return {Array}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$export$9de42b6dda4c7e48 = (type, snapshot)=>{
- const cs = [];
- let n = type._start;
- while(n !== null){
- if (n.countable && $52a83e33f2b9e935$var$isVisible(n, snapshot)) {
- const c = n.content.getContent();
- for(let i = 0; i < c.length; i++)cs.push(c[i]);
- }
- n = n.right;
- }
- return cs;
-};
-/**
- * Executes a provided function on once on overy element of this YArray.
- *
- * @param {AbstractType} type
- * @param {function(any,number,any):void} f A function to execute on every element of this YArray.
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListForEach = (type, f)=>{
- let index = 0;
- let n = type._start;
- while(n !== null){
- if (n.countable && !n.deleted) {
- const c = n.content.getContent();
- for(let i = 0; i < c.length; i++)f(c[i], index++, type);
- }
- n = n.right;
- }
-};
-/**
- * @template C,R
- * @param {AbstractType} type
- * @param {function(C,number,AbstractType):R} f
- * @return {Array}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListMap = (type, f)=>{
- /**
- * @type {Array}
- */ const result = [];
- $52a83e33f2b9e935$var$typeListForEach(type, (c, i)=>{
- result.push(f(c, i, type));
- });
- return result;
-};
-/**
- * @param {AbstractType} type
- * @return {IterableIterator}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListCreateIterator = (type)=>{
- let n = type._start;
- /**
- * @type {Array|null}
- */ let currentContent = null;
- let currentContentIndex = 0;
- return {
- [Symbol.iterator] () {
- return this;
- },
- next: ()=>{
- // find some content
- if (currentContent === null) {
- while(n !== null && n.deleted)n = n.right;
- // check if we reached the end, no need to check currentContent, because it does not exist
- if (n === null) return {
- done: true,
- value: undefined
- };
- // we found n, so we can set currentContent
- currentContent = n.content.getContent();
- currentContentIndex = 0;
- n = n.right; // we used the content of n, now iterate to next
- }
- const value = currentContent[currentContentIndex++];
- // check if we need to empty currentContent
- if (currentContent.length <= currentContentIndex) currentContent = null;
- return {
- done: false,
- value: value
- };
- }
- };
-};
-/**
- * @param {AbstractType} type
- * @param {number} index
- * @return {any}
- *
- * @private
- * @function
- */ const $52a83e33f2b9e935$var$typeListGet = (type, index)=>{
- const marker = $52a83e33f2b9e935$var$findMarker(type, index);
- let n = type._start;
- if (marker !== null) {
- n = marker.p;
- index -= marker.index;
- }
- for(; n !== null; n = n.right)if (!n.deleted && n.countable) {
- if (index < n.length) return n.content.getContent()[index];
- index -= n.length;
- }
-};
-/**
- * @param {Transaction} transaction
- * @param {AbstractType} parent
- * @param {Item?} referenceItem
- * @param {Array