2024-06-23 09:25:48 +00:00
import { c as create _ssr _component , v as validate _component , a as each , e as escape , s as spread , f as escape _object , d as escape _attribute _value , b as add _attribute } from './ssr-ipqebOFl.js' ;
import { T as Table , a as Table _header , b as Table _row , c as Table _head , d as Table _body , e as Table _cell } from './table-row-C8VhAaUk.js' ;
2024-05-29 18:43:41 +00:00
import 'clsx' ;
2024-06-23 09:25:48 +00:00
import { q as buttonVariants , i as is _void , o as omit , w as withGet , m as makeElement , b as executeCallbacks , d as addMeltEventListener , c as createElHelpers , j as addEventListener , r as isTouch , t as removeUndefined$1 , s as styleToString , p as portalAttr , e as effect , h as isBrowser , v as dequal , x as isObject , y as stripValues , l as disabledAttr , k as kbd , z as isHTMLButtonElement , a as isHTMLElement , F as FIRST _LAST _KEYS , f as isElementDisabled , u as useEscapeKeydown , A as isElement , B as createHiddenInput , g as safeOnMount , n as noop , C as isDocument , D as getElementByMeltId , E as isHTMLLabelElement , G as isHTMLInputElement } from './index3-4H3SMWet.js' ;
import { c as compute _rest _props , a as subscribe , o as onDestroy , s as setContext , b as getContext , g as get _store _value } from './lifecycle-px-3doLe.js' ;
import { d as derived , a as readonly , w as writable } from './index2-D4yenS_5.js' ;
import { t as tick } from './scheduler-1Ju9dhbL.js' ;
import { f as toast , c as createDispatcher , a as createBitAttrs , r as removeUndefined , g as getOptionUpdater , o as overridable , e as toWritableStores } from './index-pRP-dlMc.js' ;
import { D as Dialog _content$1 , a as Dialog _close , X as X$1 , b as Dialog , c as Dialog _trigger , x as getCtx$3 , d as Dialog _portal$1 , e as Dialog _overlay$1 , y as scale , h as fade , k as generateIds , m as getPortalDestination , o as usePortal , z as useFloating , g as generateId , i as getPositioningUpdater , j as createTypeaheadSearch , l as derivedVisible , A as last , B as back , C as forward , E as prev , F as next , u as usePopper , G as generateId$1 , w as addHighlight , r as removeHighlight , q as removeScroll , H as toggle } from './x-BYSy-ttj.js' ;
import { B as Button , c as cn , f as flyAndScale } from './button-CeH7Xj2c.js' ;
2024-06-13 19:47:09 +00:00
import { tv } from 'tailwind-variants' ;
2024-07-21 13:35:30 +00:00
import { F as Form _field , C as Control , a as Form _label , I as Input$1 , b as Form _field _errors , L as Label , S as Switch , T as Textarea , c as createLabel } from './textarea-CILqUx6U.js' ;
2024-06-23 09:25:48 +00:00
import { p as page } from './stores-Cv0rQqhp.js' ;
import { g as superForm } from './index-CUXxL1oq.js' ;
2024-05-29 18:43:41 +00:00
import './index-Ddp2AB5f.js' ;
2024-06-23 09:25:48 +00:00
import { b as zodClient } from './zod-D1iX83g6.js' ;
2024-07-22 20:12:35 +00:00
import { c as createFormSchema , e as editFormSchema } from './5-Cg0lGduq.js' ;
2024-06-23 09:25:48 +00:00
import { I as Icon$1 } from './Icon-a6cUNPyd.js' ;
2024-06-07 14:10:14 +00:00
import './config-BHx687w1.js' ;
2024-05-29 18:43:41 +00:00
import './ssr2-BVSPLo1E.js' ;
import 'tailwind-merge' ;
import './exports-DuWZopOC.js' ;
import './stringify-D5iWhcfN.js' ;
import 'zod' ;
2024-05-29 19:31:10 +00:00
import './shared-server-i79vVjEm.js' ;
2024-05-29 18:43:41 +00:00
function getOptions ( el ) {
return Array . from ( el . querySelectorAll ( '[role="option"]:not([data-disabled])' ) ) . filter ( ( el2 ) => isHTMLElement ( el2 ) ) ;
}
2024-06-21 23:07:29 +00:00
function makeHull ( points ) {
const newPoints = points . slice ( ) ;
newPoints . sort ( POINT _COMPARATOR ) ;
return makeHullPresorted ( newPoints ) ;
}
function makeHullPresorted ( points ) {
if ( points . length <= 1 )
return points . slice ( ) ;
const upperHull = [ ] ;
for ( let i = 0 ; i < points . length ; i ++ ) {
const p = points [ i ] ;
while ( upperHull . length >= 2 ) {
const q = upperHull [ upperHull . length - 1 ] ;
const r = upperHull [ upperHull . length - 2 ] ;
if ( ( q . x - r . x ) * ( p . y - r . y ) >= ( q . y - r . y ) * ( p . x - r . x ) )
upperHull . pop ( ) ;
else
break ;
}
upperHull . push ( p ) ;
}
upperHull . pop ( ) ;
const lowerHull = [ ] ;
for ( let i = points . length - 1 ; i >= 0 ; i -- ) {
const p = points [ i ] ;
while ( lowerHull . length >= 2 ) {
const q = lowerHull [ lowerHull . length - 1 ] ;
const r = lowerHull [ lowerHull . length - 2 ] ;
if ( ( q . x - r . x ) * ( p . y - r . y ) >= ( q . y - r . y ) * ( p . x - r . x ) )
lowerHull . pop ( ) ;
else
break ;
}
lowerHull . push ( p ) ;
}
lowerHull . pop ( ) ;
if ( upperHull . length == 1 && lowerHull . length == 1 && upperHull [ 0 ] . x == lowerHull [ 0 ] . x && upperHull [ 0 ] . y == lowerHull [ 0 ] . y )
return upperHull ;
else
return upperHull . concat ( lowerHull ) ;
}
function POINT _COMPARATOR ( a , b ) {
if ( a . x < b . x )
return - 1 ;
else if ( a . x > b . x )
return 1 ;
else if ( a . y < b . y )
return - 1 ;
else if ( a . y > b . y )
return 1 ;
else
return 0 ;
}
function getPointsFromEl ( el ) {
const rect = el . getBoundingClientRect ( ) ;
return [
{ x : rect . left , y : rect . top } ,
{ x : rect . right , y : rect . top } ,
{ x : rect . right , y : rect . bottom } ,
{ x : rect . left , y : rect . bottom }
] ;
}
function makeHullFromElements ( els ) {
const points = els . flatMap ( ( el ) => getPointsFromEl ( el ) ) ;
return makeHull ( points ) ;
}
function pointInPolygon ( point , polygon ) {
let inside = false ;
for ( let i = 0 , j = polygon . length - 1 ; i < polygon . length ; j = i ++ ) {
const xi = polygon [ i ] . x ;
const yi = polygon [ i ] . y ;
const xj = polygon [ j ] . x ;
const yj = polygon [ j ] . y ;
const intersect = yi > point . y !== yj > point . y && point . x < ( xj - xi ) * ( point . y - yi ) / ( yj - yi ) + xi ;
if ( intersect )
inside = ! inside ;
}
return inside ;
}
2024-05-29 18:43:41 +00:00
function createClickOutsideIgnore ( meltId ) {
return ( e ) => {
const target = e . target ;
const triggerEl = getElementByMeltId ( meltId ) ;
if ( ! triggerEl || ! isElement ( target ) )
return false ;
const id = triggerEl . id ;
if ( isHTMLLabelElement ( target ) && id === target . htmlFor ) {
return true ;
}
if ( target . closest ( ` label[for=" ${ id } "] ` ) ) {
return true ;
}
return false ;
} ;
}
const INTERACTION _KEYS = [ kbd . ARROW _LEFT , kbd . ESCAPE , kbd . ARROW _RIGHT , kbd . SHIFT , kbd . CAPS _LOCK , kbd . CONTROL , kbd . ALT , kbd . META , kbd . ENTER , kbd . F1 , kbd . F2 , kbd . F3 , kbd . F4 , kbd . F5 , kbd . F6 , kbd . F7 , kbd . F8 , kbd . F9 , kbd . F10 , kbd . F11 , kbd . F12 ] ;
2024-06-21 23:07:29 +00:00
const defaults$2 = {
2024-05-29 18:43:41 +00:00
positioning : {
placement : "bottom" ,
sameWidth : true
} ,
scrollAlignment : "nearest" ,
loop : true ,
defaultOpen : false ,
closeOnOutsideClick : true ,
preventScroll : true ,
closeOnEscape : true ,
forceVisible : false ,
portal : void 0 ,
builder : "listbox" ,
disabled : false ,
required : false ,
name : void 0 ,
typeahead : true ,
highlightOnHover : true ,
onOutsideClick : void 0
} ;
const listboxIdParts = [ "trigger" , "menu" , "label" ] ;
function createListbox ( props ) {
2024-06-21 23:07:29 +00:00
const withDefaults = { ... defaults$2 , ... props } ;
2024-05-29 18:43:41 +00:00
const activeTrigger = withGet ( writable ( null ) ) ;
const highlightedItem = withGet ( writable ( null ) ) ;
const selectedWritable = withDefaults . selected ? ? writable ( withDefaults . defaultSelected ) ;
const selected = overridable ( selectedWritable , withDefaults ? . onSelectedChange ) ;
const highlighted = derived ( highlightedItem , ( $highlightedItem ) => $highlightedItem ? getOptionProps ( $highlightedItem ) : void 0 ) ;
const openWritable = withDefaults . open ? ? writable ( withDefaults . defaultOpen ) ;
const open = overridable ( openWritable , withDefaults ? . onOpenChange ) ;
const options = toWritableStores ( {
... omit ( withDefaults , "open" , "defaultOpen" , "builder" , "ids" ) ,
multiple : withDefaults . multiple ? ? false
} ) ;
const { scrollAlignment , loop , closeOnOutsideClick , closeOnEscape , preventScroll , portal , forceVisible , positioning , multiple , arrowSize , disabled , required , typeahead , name : nameProp , highlightOnHover , onOutsideClick } = options ;
const { name : name2 , selector : selector2 } = createElHelpers ( withDefaults . builder ) ;
const ids = toWritableStores ( { ... generateIds ( listboxIdParts ) , ... withDefaults . ids } ) ;
const { handleTypeaheadSearch } = createTypeaheadSearch ( {
onMatch : ( element ) => {
highlightedItem . set ( element ) ;
element . scrollIntoView ( { block : scrollAlignment . get ( ) } ) ;
} ,
getCurrentItem ( ) {
return highlightedItem . get ( ) ;
}
} ) ;
function getOptionProps ( el ) {
const value = el . getAttribute ( "data-value" ) ;
const label2 = el . getAttribute ( "data-label" ) ;
const disabled2 = el . hasAttribute ( "data-disabled" ) ;
return {
value : value ? JSON . parse ( value ) : value ,
label : label2 ? ? el . textContent ? ? void 0 ,
disabled : disabled2 ? true : false
} ;
}
const setOption = ( newOption ) => {
selected . update ( ( $option ) => {
const $multiple = multiple . get ( ) ;
if ( $multiple ) {
const optionArr = Array . isArray ( $option ) ? [ ... $option ] : [ ] ;
return toggle ( newOption , optionArr , ( itemA , itemB ) => dequal ( itemA . value , itemB . value ) ) ;
}
return newOption ;
} ) ;
} ;
function selectItem ( item ) {
const props2 = getOptionProps ( item ) ;
setOption ( props2 ) ;
}
async function openMenu ( ) {
open . set ( true ) ;
const triggerEl = document . getElementById ( ids . trigger . get ( ) ) ;
if ( ! triggerEl )
return ;
if ( triggerEl !== activeTrigger . get ( ) )
activeTrigger . set ( triggerEl ) ;
await tick ( ) ;
const menuElement = document . getElementById ( ids . menu . get ( ) ) ;
if ( ! isHTMLElement ( menuElement ) )
return ;
const selectedItem = menuElement . querySelector ( "[aria-selected=true]" ) ;
if ( ! isHTMLElement ( selectedItem ) )
return ;
highlightedItem . set ( selectedItem ) ;
}
function closeMenu ( ) {
open . set ( false ) ;
highlightedItem . set ( null ) ;
}
const isVisible = derivedVisible ( { open , forceVisible , activeTrigger } ) ;
const isSelected = derived ( [ selected ] , ( [ $selected ] ) => {
return ( value ) => {
if ( Array . isArray ( $selected ) ) {
return $selected . some ( ( o ) => dequal ( o . value , value ) ) ;
}
if ( isObject ( value ) ) {
return dequal ( $selected ? . value , stripValues ( value , void 0 ) ) ;
}
return dequal ( $selected ? . value , value ) ;
} ;
} ) ;
const isHighlighted = derived ( [ highlighted ] , ( [ $value ] ) => {
return ( item ) => {
return dequal ( $value ? . value , item ) ;
} ;
} ) ;
const trigger = makeElement ( name2 ( "trigger" ) , {
stores : [ open , highlightedItem , disabled , ids . menu , ids . trigger , ids . label ] ,
returned : ( [ $open , $highlightedItem , $disabled , $menuId , $triggerId , $labelId ] ) => {
return {
"aria-activedescendant" : $highlightedItem ? . id ,
"aria-autocomplete" : "list" ,
"aria-controls" : $menuId ,
"aria-expanded" : $open ,
"aria-labelledby" : $labelId ,
// autocomplete: 'off',
id : $triggerId ,
role : "combobox" ,
disabled : disabledAttr ( $disabled ) ,
type : withDefaults . builder === "select" ? "button" : void 0
} ;
} ,
action : ( node ) => {
const isInput = isHTMLInputElement ( node ) ;
const unsubscribe = executeCallbacks (
addMeltEventListener ( node , "click" , ( ) => {
node . focus ( ) ;
const $open = open . get ( ) ;
if ( $open ) {
closeMenu ( ) ;
} else {
openMenu ( ) ;
}
} ) ,
// Handle all input key events including typing, meta, and navigation.
addMeltEventListener ( node , "keydown" , ( e ) => {
const $open = open . get ( ) ;
if ( ! $open ) {
if ( INTERACTION _KEYS . includes ( e . key ) ) {
return ;
}
if ( e . key === kbd . TAB ) {
return ;
}
if ( e . key === kbd . BACKSPACE && isInput && node . value === "" ) {
return ;
}
if ( e . key === kbd . SPACE && isHTMLButtonElement ( node ) ) {
return ;
}
openMenu ( ) ;
tick ( ) . then ( ( ) => {
const $selectedItem = selected . get ( ) ;
if ( $selectedItem )
return ;
const menuEl = document . getElementById ( ids . menu . get ( ) ) ;
if ( ! isHTMLElement ( menuEl ) )
return ;
const enabledItems = Array . from ( menuEl . querySelectorAll ( ` ${ selector2 ( "item" ) } :not([data-disabled]):not([data-hidden]) ` ) ) . filter ( ( item ) => isHTMLElement ( item ) ) ;
if ( ! enabledItems . length )
return ;
if ( e . key === kbd . ARROW _DOWN ) {
highlightedItem . set ( enabledItems [ 0 ] ) ;
enabledItems [ 0 ] . scrollIntoView ( { block : scrollAlignment . get ( ) } ) ;
} else if ( e . key === kbd . ARROW _UP ) {
highlightedItem . set ( last ( enabledItems ) ) ;
last ( enabledItems ) . scrollIntoView ( { block : scrollAlignment . get ( ) } ) ;
}
} ) ;
}
if ( e . key === kbd . TAB ) {
closeMenu ( ) ;
return ;
}
if ( e . key === kbd . ENTER && ! e . isComposing || e . key === kbd . SPACE && isHTMLButtonElement ( node ) ) {
e . preventDefault ( ) ;
const $highlightedItem = highlightedItem . get ( ) ;
if ( $highlightedItem ) {
selectItem ( $highlightedItem ) ;
}
if ( ! multiple . get ( ) ) {
closeMenu ( ) ;
}
}
if ( e . key === kbd . ARROW _UP && e . altKey ) {
closeMenu ( ) ;
}
if ( FIRST _LAST _KEYS . includes ( e . key ) ) {
e . preventDefault ( ) ;
const menuElement = document . getElementById ( ids . menu . get ( ) ) ;
if ( ! isHTMLElement ( menuElement ) )
return ;
const itemElements = getOptions ( menuElement ) ;
if ( ! itemElements . length )
return ;
const candidateNodes = itemElements . filter ( ( opt ) => ! isElementDisabled ( opt ) && opt . dataset . hidden === void 0 ) ;
const $currentItem = highlightedItem . get ( ) ;
const currentIndex = $currentItem ? candidateNodes . indexOf ( $currentItem ) : - 1 ;
const $loop = loop . get ( ) ;
const $scrollAlignment = scrollAlignment . get ( ) ;
let nextItem ;
switch ( e . key ) {
case kbd . ARROW _DOWN :
nextItem = next ( candidateNodes , currentIndex , $loop ) ;
break ;
case kbd . ARROW _UP :
nextItem = prev ( candidateNodes , currentIndex , $loop ) ;
break ;
case kbd . PAGE _DOWN :
nextItem = forward ( candidateNodes , currentIndex , 10 , $loop ) ;
break ;
case kbd . PAGE _UP :
nextItem = back ( candidateNodes , currentIndex , 10 , $loop ) ;
break ;
case kbd . HOME :
nextItem = candidateNodes [ 0 ] ;
break ;
case kbd . END :
nextItem = last ( candidateNodes ) ;
break ;
default :
return ;
}
highlightedItem . set ( nextItem ) ;
nextItem ? . scrollIntoView ( { block : $scrollAlignment } ) ;
} else if ( typeahead . get ( ) ) {
const menuEl = document . getElementById ( ids . menu . get ( ) ) ;
if ( ! isHTMLElement ( menuEl ) )
return ;
handleTypeaheadSearch ( e . key , getOptions ( menuEl ) ) ;
}
} )
) ;
let unsubEscapeKeydown = noop ;
const escape2 = useEscapeKeydown ( node , {
handler : closeMenu ,
enabled : derived ( [ open , closeOnEscape ] , ( [ $open , $closeOnEscape ] ) => {
return $open && $closeOnEscape ;
} )
} ) ;
if ( escape2 && escape2 . destroy ) {
unsubEscapeKeydown = escape2 . destroy ;
}
return {
destroy ( ) {
unsubscribe ( ) ;
unsubEscapeKeydown ( ) ;
}
} ;
}
} ) ;
const menu = makeElement ( name2 ( "menu" ) , {
stores : [ isVisible , ids . menu ] ,
returned : ( [ $isVisible , $menuId ] ) => {
return {
hidden : $isVisible ? void 0 : true ,
id : $menuId ,
role : "listbox" ,
style : styleToString ( { display : $isVisible ? void 0 : "none" } )
} ;
} ,
action : ( node ) => {
let unsubPopper = noop ;
const unsubscribe = executeCallbacks (
// Bind the popper portal to the input element.
effect ( [ isVisible , portal , closeOnOutsideClick , positioning , activeTrigger ] , ( [ $isVisible , $portal , $closeOnOutsideClick , $positioning , $activeTrigger ] ) => {
unsubPopper ( ) ;
if ( ! $isVisible || ! $activeTrigger )
return ;
tick ( ) . then ( ( ) => {
unsubPopper ( ) ;
const ignoreHandler = createClickOutsideIgnore ( ids . trigger . get ( ) ) ;
unsubPopper = usePopper ( node , {
anchorElement : $activeTrigger ,
open ,
options : {
floating : $positioning ,
focusTrap : null ,
modal : {
closeOnInteractOutside : $closeOnOutsideClick ,
onClose : closeMenu ,
open : $isVisible ,
shouldCloseOnInteractOutside : ( e ) => {
onOutsideClick . get ( ) ? . ( e ) ;
if ( e . defaultPrevented )
return false ;
const target = e . target ;
if ( ! isElement ( target ) )
return false ;
if ( target === $activeTrigger || $activeTrigger . contains ( target ) ) {
return false ;
}
if ( ignoreHandler ( e ) )
return false ;
return true ;
}
} ,
escapeKeydown : null ,
portal : getPortalDestination ( node , $portal )
}
} ) . destroy ;
} ) ;
} )
) ;
return {
destroy : ( ) => {
unsubscribe ( ) ;
unsubPopper ( ) ;
}
} ;
}
} ) ;
const { elements : { root : labelBuilder } } = createLabel ( ) ;
const { action : labelAction } = get _store _value ( labelBuilder ) ;
const label = makeElement ( name2 ( "label" ) , {
stores : [ ids . label , ids . trigger ] ,
returned : ( [ $labelId , $triggerId ] ) => {
return {
id : $labelId ,
for : $triggerId
} ;
} ,
action : labelAction
} ) ;
const option = makeElement ( name2 ( "option" ) , {
stores : [ isSelected ] ,
returned : ( [ $isSelected ] ) => ( props2 ) => {
const selected2 = $isSelected ( props2 . value ) ;
return {
"data-value" : JSON . stringify ( props2 . value ) ,
"data-label" : props2 . label ,
"data-disabled" : disabledAttr ( props2 . disabled ) ,
"aria-disabled" : props2 . disabled ? true : void 0 ,
"aria-selected" : selected2 ,
"data-selected" : selected2 ? "" : void 0 ,
id : generateId$1 ( ) ,
role : "option"
} ;
} ,
action : ( node ) => {
const unsubscribe = executeCallbacks ( addMeltEventListener ( node , "click" , ( e ) => {
if ( isElementDisabled ( node ) ) {
e . preventDefault ( ) ;
return ;
}
selectItem ( node ) ;
if ( ! multiple . get ( ) ) {
closeMenu ( ) ;
}
} ) , effect ( highlightOnHover , ( $highlightOnHover ) => {
if ( ! $highlightOnHover )
return ;
const unsub = executeCallbacks ( addMeltEventListener ( node , "mouseover" , ( ) => {
highlightedItem . set ( node ) ;
} ) , addMeltEventListener ( node , "mouseleave" , ( ) => {
highlightedItem . set ( null ) ;
} ) ) ;
return unsub ;
} ) ) ;
return { destroy : unsubscribe } ;
}
} ) ;
const group = makeElement ( name2 ( "group" ) , {
returned : ( ) => {
return ( groupId ) => ( {
role : "group" ,
"aria-labelledby" : groupId
} ) ;
}
} ) ;
const groupLabel = makeElement ( name2 ( "group-label" ) , {
returned : ( ) => {
return ( groupId ) => ( {
id : groupId
} ) ;
}
} ) ;
const hiddenInput = createHiddenInput ( {
value : derived ( [ selected ] , ( [ $selected ] ) => {
const value = Array . isArray ( $selected ) ? $selected . map ( ( o ) => o . value ) : $selected ? . value ;
return typeof value === "string" ? value : JSON . stringify ( value ) ;
} ) ,
name : readonly ( nameProp ) ,
required ,
prefix : withDefaults . builder
} ) ;
const arrow = makeElement ( name2 ( "arrow" ) , {
stores : arrowSize ,
returned : ( $arrowSize ) => ( {
"data-arrow" : true ,
style : styleToString ( {
position : "absolute" ,
width : ` var(--arrow-size, ${ $arrowSize } px) ` ,
height : ` var(--arrow-size, ${ $arrowSize } px) `
} )
} )
} ) ;
safeOnMount ( ( ) => {
if ( ! isBrowser )
return ;
const menuEl = document . getElementById ( ids . menu . get ( ) ) ;
const triggerEl = document . getElementById ( ids . trigger . get ( ) ) ;
if ( triggerEl ) {
activeTrigger . set ( triggerEl ) ;
}
if ( ! menuEl )
return ;
const selectedEl = menuEl . querySelector ( "[data-selected]" ) ;
if ( ! isHTMLElement ( selectedEl ) )
return ;
} ) ;
effect ( [ highlightedItem ] , ( [ $highlightedItem ] ) => {
if ( ! isBrowser )
return ;
const menuElement = document . getElementById ( ids . menu . get ( ) ) ;
if ( ! isHTMLElement ( menuElement ) )
return ;
getOptions ( menuElement ) . forEach ( ( node ) => {
if ( node === $highlightedItem ) {
addHighlight ( node ) ;
} else {
removeHighlight ( node ) ;
}
} ) ;
} ) ;
effect ( [ open ] , ( [ $open ] ) => {
if ( ! isBrowser )
return ;
let unsubScroll = noop ;
if ( preventScroll . get ( ) && $open ) {
unsubScroll = removeScroll ( ) ;
}
return ( ) => {
unsubScroll ( ) ;
} ;
} ) ;
return {
ids ,
elements : {
trigger ,
group ,
option ,
menu ,
groupLabel ,
label ,
hiddenInput ,
arrow
} ,
states : {
open ,
selected ,
highlighted ,
highlightedItem
} ,
helpers : {
isSelected ,
isHighlighted ,
closeMenu
} ,
options
} ;
}
function getPageItems ( { page : page2 = 1 , totalPages , siblingCount = 1 } ) {
const pageItems = [ ] ;
const pagesToShow = /* @__PURE__ */ new Set ( [ 1 , totalPages ] ) ;
const firstItemWithSiblings = 3 + siblingCount ;
const lastItemWithSiblings = totalPages - 2 - siblingCount ;
if ( firstItemWithSiblings > lastItemWithSiblings ) {
for ( let p = 2 ; p <= totalPages - 1 ; p ++ ) {
pagesToShow . add ( p ) ;
}
} else if ( page2 < firstItemWithSiblings ) {
for ( let p = 2 ; p <= Math . min ( firstItemWithSiblings , totalPages ) ; p ++ ) {
pagesToShow . add ( p ) ;
}
} else if ( page2 > lastItemWithSiblings ) {
for ( let p = totalPages - 1 ; p >= Math . max ( lastItemWithSiblings , 2 ) ; p -- ) {
pagesToShow . add ( p ) ;
}
} else {
for ( let p = Math . max ( page2 - siblingCount , 2 ) ; p <= Math . min ( page2 + siblingCount , totalPages ) ; p ++ ) {
pagesToShow . add ( p ) ;
}
}
const addPage = ( value ) => {
pageItems . push ( { type : "page" , value , key : ` page- ${ value } ` } ) ;
} ;
const addEllipsis = ( ) => {
pageItems . push ( { type : "ellipsis" , key : ` ellipsis- ${ pageItems . length } ` } ) ;
} ;
let lastNumber = 0 ;
for ( const page3 of Array . from ( pagesToShow ) . sort ( ( a , b ) => a - b ) ) {
if ( page3 - lastNumber > 1 ) {
addEllipsis ( ) ;
}
addPage ( page3 ) ;
lastNumber = page3 ;
}
return pageItems ;
}
2024-06-21 23:07:29 +00:00
const defaults$1 = {
2024-05-29 18:43:41 +00:00
perPage : 1 ,
siblingCount : 1 ,
defaultPage : 1
} ;
2024-06-21 23:07:29 +00:00
const { name : name$1 , selector } = createElHelpers ( "pagination" ) ;
2024-05-29 18:43:41 +00:00
function createPagination ( props ) {
2024-06-21 23:07:29 +00:00
const withDefaults = { ... defaults$1 , ... props } ;
2024-05-29 18:43:41 +00:00
const pageWritable = withDefaults . page ? ? writable ( withDefaults . defaultPage ) ;
const page2 = overridable ( pageWritable , withDefaults ? . onPageChange ) ;
const options = toWritableStores ( omit ( withDefaults , "page" , "onPageChange" , "defaultPage" ) ) ;
const { perPage , siblingCount , count } = options ;
const totalPages = withGet . derived ( [ count , perPage ] , ( [ $count , $perPage ] ) => {
return Math . ceil ( $count / $perPage ) ;
} ) ;
const range = derived ( [ page2 , perPage , count ] , ( [ $page , $perPage , $count ] ) => {
const start = ( $page - 1 ) * $perPage ;
const end = Math . min ( start + $perPage , $count ) ;
return { start , end } ;
} ) ;
2024-06-21 23:07:29 +00:00
const root = makeElement ( name$1 ( ) , {
2024-05-29 18:43:41 +00:00
returned : ( ) => ( {
"data-scope" : "pagination"
} )
} ) ;
const pages = derived ( [ page2 , totalPages , siblingCount ] , ( [ $page , $totalPages , $siblingCount ] ) => {
return getPageItems ( { page : $page , totalPages : $totalPages , siblingCount : $siblingCount } ) ;
} ) ;
const keydown = ( e ) => {
const thisEl = e . target ;
if ( ! isHTMLElement ( thisEl ) )
return ;
const rootEl = thisEl . closest ( '[data-scope="pagination"]' ) ;
if ( ! isHTMLElement ( rootEl ) )
return ;
const triggers = Array . from ( rootEl . querySelectorAll ( selector ( "page" ) ) ) . filter ( ( el ) => isHTMLElement ( el ) ) ;
const prevButton2 = rootEl . querySelector ( selector ( "prev" ) ) ;
const nextButton2 = rootEl . querySelector ( selector ( "next" ) ) ;
if ( isHTMLElement ( prevButton2 ) ) {
triggers . unshift ( prevButton2 ) ;
}
if ( isHTMLElement ( nextButton2 ) ) {
triggers . push ( nextButton2 ) ;
}
const index = triggers . indexOf ( thisEl ) ;
if ( e . key === kbd . ARROW _LEFT && index !== 0 ) {
e . preventDefault ( ) ;
triggers [ index - 1 ] . focus ( ) ;
} else if ( e . key === kbd . ARROW _RIGHT && index !== triggers . length - 1 ) {
e . preventDefault ( ) ;
triggers [ index + 1 ] . focus ( ) ;
} else if ( e . key === kbd . HOME ) {
e . preventDefault ( ) ;
triggers [ 0 ] . focus ( ) ;
} else if ( e . key === kbd . END ) {
e . preventDefault ( ) ;
triggers [ triggers . length - 1 ] . focus ( ) ;
}
} ;
2024-06-21 23:07:29 +00:00
const pageTrigger = makeElement ( name$1 ( "page" ) , {
2024-05-29 18:43:41 +00:00
stores : page2 ,
returned : ( $page ) => {
return ( pageItem ) => {
return {
"aria-label" : ` Page ${ pageItem . value } ` ,
"data-value" : pageItem . value ,
"data-selected" : pageItem . value === $page ? "" : void 0
} ;
} ;
} ,
action : ( node ) => {
const unsub = executeCallbacks ( addMeltEventListener ( node , "click" , ( ) => {
const value = node . dataset . value ;
if ( ! value || Number . isNaN ( + value ) )
return ;
page2 . set ( Number ( value ) ) ;
} ) , addMeltEventListener ( node , "keydown" , keydown ) ) ;
return {
destroy : unsub
} ;
}
} ) ;
2024-06-21 23:07:29 +00:00
const prevButton = makeElement ( name$1 ( "prev" ) , {
2024-05-29 18:43:41 +00:00
stores : page2 ,
returned : ( $page ) => {
return {
"aria-label" : "Previous" ,
disabled : $page <= 1
} ;
} ,
action : ( node ) => {
const unsub = executeCallbacks ( addMeltEventListener ( node , "click" , ( ) => {
page2 . update ( ( p ) => Math . max ( p - 1 , 1 ) ) ;
} ) , addMeltEventListener ( node , "keydown" , keydown ) ) ;
return {
destroy : unsub
} ;
}
} ) ;
2024-06-21 23:07:29 +00:00
const nextButton = makeElement ( name$1 ( "next" ) , {
2024-05-29 18:43:41 +00:00
stores : [ page2 , totalPages ] ,
returned : ( [ $page , $totalPages ] ) => {
return {
"aria-label" : "Next" ,
disabled : $page >= $totalPages
} ;
} ,
action : ( node ) => {
const unsub = executeCallbacks ( addMeltEventListener ( node , "click" , ( ) => {
const $totalPages = totalPages . get ( ) ;
page2 . update ( ( p ) => Math . min ( p + 1 , $totalPages ) ) ;
} ) , addMeltEventListener ( node , "keydown" , keydown ) ) ;
return {
destroy : unsub
} ;
}
} ) ;
return {
elements : {
root ,
pageTrigger ,
prevButton ,
nextButton
} ,
states : {
range : readonly ( range ) ,
page : page2 ,
pages : readonly ( pages ) ,
totalPages : readonly ( totalPages )
} ,
options
} ;
}
function createSelect ( props ) {
const listbox = createListbox ( { ... props , builder : "select" } ) ;
const selectedLabel = derived ( listbox . states . selected , ( $selected ) => {
if ( Array . isArray ( $selected ) ) {
return $selected . map ( ( o ) => o . label ) . join ( ", " ) ;
}
return $selected ? . label ? ? "" ;
} ) ;
return {
... listbox ,
elements : {
... listbox . elements
} ,
states : {
... listbox . states ,
selectedLabel
}
} ;
}
2024-06-21 23:07:29 +00:00
const defaults = {
positioning : {
placement : "bottom"
} ,
arrowSize : 8 ,
defaultOpen : false ,
closeOnPointerDown : true ,
openDelay : 1e3 ,
closeDelay : 0 ,
forceVisible : false ,
portal : void 0 ,
closeOnEscape : true ,
disableHoverableContent : false ,
group : void 0
} ;
const { name } = createElHelpers ( "tooltip" ) ;
const groupMap = /* @__PURE__ */ new Map ( ) ;
const tooltipIdParts = [ "trigger" , "content" ] ;
function createTooltip ( props ) {
const withDefaults = { ... defaults , ... props } ;
const options = toWritableStores ( omit ( withDefaults , "open" , "ids" ) ) ;
const { positioning , arrowSize , closeOnPointerDown , openDelay , closeDelay , forceVisible , portal , closeOnEscape , disableHoverableContent , group } = options ;
const openWritable = withDefaults . open ? ? writable ( withDefaults . defaultOpen ) ;
const open = overridable ( openWritable , withDefaults ? . onOpenChange ) ;
const openReason = writable ( null ) ;
const ids = toWritableStores ( { ... generateIds ( tooltipIdParts ) , ... withDefaults . ids } ) ;
let clickedTrigger = false ;
const getEl = ( part ) => {
if ( ! isBrowser )
return null ;
return document . getElementById ( ids [ part ] . get ( ) ) ;
} ;
let openTimeout = null ;
let closeTimeout = null ;
function openTooltip ( reason ) {
if ( closeTimeout ) {
window . clearTimeout ( closeTimeout ) ;
closeTimeout = null ;
}
if ( ! openTimeout ) {
openTimeout = window . setTimeout ( ( ) => {
open . set ( true ) ;
openReason . update ( ( prev2 ) => prev2 ? ? reason ) ;
openTimeout = null ;
} , openDelay . get ( ) ) ;
}
}
function closeTooltip ( isBlur ) {
if ( openTimeout ) {
window . clearTimeout ( openTimeout ) ;
openTimeout = null ;
}
if ( isBlur && isMouseInTooltipArea ) {
openReason . set ( "pointer" ) ;
return ;
}
if ( ! closeTimeout ) {
closeTimeout = window . setTimeout ( ( ) => {
open . set ( false ) ;
openReason . set ( null ) ;
if ( isBlur )
clickedTrigger = false ;
closeTimeout = null ;
} , closeDelay . get ( ) ) ;
}
}
const isVisible = derived ( [ open , forceVisible ] , ( [ $open , $forceVisible ] ) => {
return $open || $forceVisible ;
} ) ;
const trigger = makeElement ( name ( "trigger" ) , {
stores : [ ids . content , ids . trigger , open ] ,
returned : ( [ $contentId , $triggerId , $open ] ) => {
return {
"aria-describedby" : $contentId ,
id : $triggerId ,
"data-state" : $open ? "open" : "closed"
} ;
} ,
action : ( node ) => {
const keydownHandler = ( e ) => {
if ( closeOnEscape . get ( ) && e . key === kbd . ESCAPE ) {
if ( openTimeout ) {
window . clearTimeout ( openTimeout ) ;
openTimeout = null ;
}
open . set ( false ) ;
}
} ;
const unsub = executeCallbacks ( addMeltEventListener ( node , "pointerdown" , ( ) => {
const $closeOnPointerDown = closeOnPointerDown . get ( ) ;
if ( ! $closeOnPointerDown )
return ;
open . set ( false ) ;
clickedTrigger = true ;
if ( openTimeout ) {
window . clearTimeout ( openTimeout ) ;
openTimeout = null ;
}
} ) , addMeltEventListener ( node , "pointerenter" , ( e ) => {
if ( isTouch ( e ) )
return ;
openTooltip ( "pointer" ) ;
} ) , addMeltEventListener ( node , "pointerleave" , ( e ) => {
if ( isTouch ( e ) )
return ;
if ( openTimeout ) {
window . clearTimeout ( openTimeout ) ;
openTimeout = null ;
}
} ) , addMeltEventListener ( node , "focus" , ( ) => {
if ( clickedTrigger )
return ;
openTooltip ( "focus" ) ;
} ) , addMeltEventListener ( node , "blur" , ( ) => closeTooltip ( true ) ) , addMeltEventListener ( node , "keydown" , keydownHandler ) , addEventListener ( document , "keydown" , keydownHandler ) ) ;
return {
destroy : unsub
} ;
}
} ) ;
const content = makeElement ( name ( "content" ) , {
stores : [ isVisible , open , portal , ids . content ] ,
returned : ( [ $isVisible , $open , $portal , $contentId ] ) => {
return removeUndefined$1 ( {
role : "tooltip" ,
hidden : $isVisible ? void 0 : true ,
tabindex : - 1 ,
style : $isVisible ? void 0 : styleToString ( { display : "none" } ) ,
id : $contentId ,
"data-portal" : portalAttr ( $portal ) ,
"data-state" : $open ? "open" : "closed"
} ) ;
} ,
action : ( node ) => {
let unsubFloating = noop ;
let unsubPortal = noop ;
const unsubDerived = effect ( [ isVisible , positioning , portal ] , ( [ $isVisible , $positioning , $portal ] ) => {
unsubPortal ( ) ;
unsubFloating ( ) ;
const triggerEl = getEl ( "trigger" ) ;
if ( ! $isVisible || ! triggerEl )
return ;
tick ( ) . then ( ( ) => {
unsubPortal ( ) ;
unsubFloating ( ) ;
const portalDest = getPortalDestination ( node , $portal ) ;
if ( portalDest )
unsubPortal = usePortal ( node , portalDest ) . destroy ;
unsubFloating = useFloating ( triggerEl , node , $positioning ) . destroy ;
} ) ;
} ) ;
function handleScroll ( e ) {
if ( ! open . get ( ) )
return ;
const target = e . target ;
if ( ! isElement ( target ) && ! isDocument ( target ) )
return ;
const triggerEl = getEl ( "trigger" ) ;
if ( triggerEl && target . contains ( triggerEl ) ) {
closeTooltip ( ) ;
}
}
const unsubEvents = executeCallbacks ( addMeltEventListener ( node , "pointerenter" , ( ) => openTooltip ( "pointer" ) ) , addMeltEventListener ( node , "pointerdown" , ( ) => openTooltip ( "pointer" ) ) , addEventListener ( window , "scroll" , handleScroll , { capture : true } ) ) ;
return {
destroy ( ) {
unsubEvents ( ) ;
unsubPortal ( ) ;
unsubFloating ( ) ;
unsubDerived ( ) ;
}
} ;
}
} ) ;
const arrow = makeElement ( name ( "arrow" ) , {
stores : arrowSize ,
returned : ( $arrowSize ) => ( {
"data-arrow" : true ,
style : styleToString ( {
position : "absolute" ,
width : ` var(--arrow-size, ${ $arrowSize } px) ` ,
height : ` var(--arrow-size, ${ $arrowSize } px) `
} )
} )
} ) ;
let isMouseInTooltipArea = false ;
effect ( open , ( $open ) => {
const currentGroup = group . get ( ) ;
if ( currentGroup === void 0 || currentGroup === false ) {
return ;
}
if ( ! $open ) {
if ( groupMap . get ( currentGroup ) === open ) {
groupMap . delete ( currentGroup ) ;
}
return ;
}
const currentOpen = groupMap . get ( currentGroup ) ;
currentOpen ? . set ( false ) ;
groupMap . set ( currentGroup , open ) ;
} ) ;
effect ( [ open , openReason ] , ( [ $open , $openReason ] ) => {
if ( ! $open || ! isBrowser )
return ;
return executeCallbacks ( addEventListener ( document , "mousemove" , ( e ) => {
const contentEl = getEl ( "content" ) ;
const triggerEl = getEl ( "trigger" ) ;
if ( ! contentEl || ! triggerEl )
return ;
const polygonElements = disableHoverableContent . get ( ) ? [ triggerEl ] : [ triggerEl , contentEl ] ;
const polygon = makeHullFromElements ( polygonElements ) ;
isMouseInTooltipArea = pointInPolygon ( {
x : e . clientX ,
y : e . clientY
} , polygon ) ;
if ( $openReason !== "pointer" )
return ;
if ( ! isMouseInTooltipArea ) {
closeTooltip ( ) ;
}
} ) ) ;
} ) ;
return {
ids ,
elements : {
trigger ,
content ,
arrow
} ,
states : { open } ,
options
} ;
}
2024-05-29 18:43:41 +00:00
function arraysAreEqual ( arr1 , arr2 ) {
if ( arr1 . length !== arr2 . length ) {
return false ;
}
return arr1 . every ( ( value , index ) => value === arr2 [ index ] ) ;
}
const Dialog _title$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "level" , "asChild" , "id" , "el" ] ) ;
let $title , $$unsubscribe _title ;
let { level = "h2" } = $$props ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { title } , ids , getAttrs } = getCtx$3 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _title = subscribe ( title , ( value ) => $title = value ) ;
const attrs = getAttrs ( "title" ) ;
if ( $$props . level === void 0 && $$bindings . level && level !== void 0 )
$$bindings . level ( level ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . title . set ( id ) ;
}
}
builder = $title ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _title ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` ${ ( ( tag ) => {
return tag ? ` < ${ level } ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ is _void ( tag ) ? "" : ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` } ${ is _void ( tag ) ? "" : ` </ ${ tag } > ` } ` : "" ;
} ) ( level ) } ` } ` ;
} ) ;
const Dialog _description$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "id" , "el" ] ) ;
let $description , $$unsubscribe _description ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { description } , ids , getAttrs } = getCtx$3 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _description = subscribe ( description , ( value ) => $description = value ) ;
const attrs = getAttrs ( "description" ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . description . set ( id ) ;
}
}
builder = $description ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _description ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` } ` ;
} ) ;
function getPaginationData ( ) {
const NAME = "pagination" ;
const PARTS = [ "root" , "prev-button" , "next-button" , "page" ] ;
return {
NAME ,
PARTS
} ;
}
2024-06-21 23:07:29 +00:00
function setCtx$2 ( props ) {
2024-05-29 18:43:41 +00:00
const { NAME , PARTS } = getPaginationData ( ) ;
const getAttrs = createBitAttrs ( NAME , PARTS ) ;
const pagination = { ... createPagination ( removeUndefined ( props ) ) , getAttrs } ;
setContext ( NAME , pagination ) ;
return {
... pagination ,
updateOption : getOptionUpdater ( pagination . options )
} ;
}
2024-06-21 23:07:29 +00:00
function getCtx$2 ( ) {
2024-05-29 18:43:41 +00:00
const { NAME } = getPaginationData ( ) ;
return getContext ( NAME ) ;
}
const Pagination$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "count" , "page" , "onPageChange" , "perPage" , "siblingCount" , "asChild" , "el" ] ) ;
let $root , $$unsubscribe _root ;
let $pages , $$unsubscribe _pages ;
let $range , $$unsubscribe _range ;
let { count } = $$props ;
let { page : page2 = void 0 } = $$props ;
let { onPageChange = void 0 } = $$props ;
let { perPage = void 0 } = $$props ;
let { siblingCount = void 0 } = $$props ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { root } , states : { pages , range , page : localPage } , getAttrs , updateOption } = setCtx$2 ( {
2024-05-29 18:43:41 +00:00
count ,
perPage ,
siblingCount ,
defaultPage : page2 ,
onPageChange : ( { next : next2 } ) => {
if ( page2 !== next2 ) {
onPageChange ? . ( next2 ) ;
page2 = next2 ;
}
return next2 ;
}
} ) ;
$$unsubscribe _root = subscribe ( root , ( value ) => $root = value ) ;
$$unsubscribe _pages = subscribe ( pages , ( value ) => $pages = value ) ;
$$unsubscribe _range = subscribe ( range , ( value ) => $range = value ) ;
const attrs = getAttrs ( "root" ) ;
if ( $$props . count === void 0 && $$bindings . count && count !== void 0 )
$$bindings . count ( count ) ;
if ( $$props . page === void 0 && $$bindings . page && page2 !== void 0 )
$$bindings . page ( page2 ) ;
if ( $$props . onPageChange === void 0 && $$bindings . onPageChange && onPageChange !== void 0 )
$$bindings . onPageChange ( onPageChange ) ;
if ( $$props . perPage === void 0 && $$bindings . perPage && perPage !== void 0 )
$$bindings . perPage ( perPage ) ;
if ( $$props . siblingCount === void 0 && $$bindings . siblingCount && siblingCount !== void 0 )
$$bindings . siblingCount ( siblingCount ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
page2 !== void 0 && localPage . set ( page2 ) ;
builder = $root ;
{
Object . assign ( builder , attrs ) ;
}
{
updateOption ( "count" , count ) ;
}
{
updateOption ( "perPage" , perPage ) ;
}
{
updateOption ( "siblingCount" , siblingCount ) ;
}
$$unsubscribe _root ( ) ;
$$unsubscribe _pages ( ) ;
$$unsubscribe _range ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder , pages : $pages , range : $range } ) : ` ` } ` : ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder , pages : $pages , range : $range } ) : ` ` }</div> ` } ` ;
} ) ;
const Pagination _page = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "page" , "el" ] ) ;
let $pageTrigger , $$unsubscribe _pageTrigger ;
let { asChild = void 0 } = $$props ;
let { page : page2 } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { pageTrigger } , getAttrs } = getCtx$2 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _pageTrigger = subscribe ( pageTrigger , ( value ) => $pageTrigger = value ) ;
const attrs = getAttrs ( "page" ) ;
createDispatcher ( ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . page === void 0 && $$bindings . page && page2 !== void 0 )
$$bindings . page ( page2 ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
builder = $pageTrigger ( page2 ) ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _pageTrigger ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <button ${ spread ( [ { type : "button" } , escape_object(builder), escape_object( $ $ restProps)], {})} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` $ { escape ( page2 . value ) } ` } < / b u t t o n > ` } ` ;
} ) ;
function getSelectData ( ) {
const NAME = "select" ;
const GROUP _NAME = "select-group" ;
const ITEM _NAME = "select-item" ;
const PARTS = [
"arrow" ,
"content" ,
"group" ,
"item" ,
"indicator" ,
"input" ,
"label" ,
"trigger" ,
"value"
] ;
return {
NAME ,
GROUP _NAME ,
ITEM _NAME ,
PARTS
} ;
}
2024-06-21 23:07:29 +00:00
function getCtx$1 ( ) {
2024-05-29 18:43:41 +00:00
const { NAME } = getSelectData ( ) ;
return getContext ( NAME ) ;
}
2024-06-21 23:07:29 +00:00
function setCtx$1 ( props ) {
2024-05-29 18:43:41 +00:00
const { NAME , PARTS } = getSelectData ( ) ;
const getAttrs = createBitAttrs ( NAME , PARTS ) ;
const select = {
... createSelect ( { ... removeUndefined ( props ) , forceVisible : true } ) ,
getAttrs
} ;
setContext ( NAME , select ) ;
return {
... select ,
updateOption : getOptionUpdater ( select . options )
} ;
}
function setGroupCtx ( ) {
const { GROUP _NAME } = getSelectData ( ) ;
const id = generateId ( ) ;
setContext ( GROUP _NAME , id ) ;
2024-06-21 23:07:29 +00:00
const { elements : { group } , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
return { group , id , getAttrs } ;
}
function setItemCtx ( value ) {
const { ITEM _NAME } = getSelectData ( ) ;
2024-06-21 23:07:29 +00:00
const select = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
setContext ( ITEM _NAME , value ) ;
return select ;
}
function getItemIndicator ( ) {
const { ITEM _NAME } = getSelectData ( ) ;
2024-06-21 23:07:29 +00:00
const { helpers : { isSelected } , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
const value = getContext ( ITEM _NAME ) ;
return {
value ,
isSelected ,
getAttrs
} ;
}
2024-06-21 23:07:29 +00:00
function updatePositioning$1 ( props ) {
2024-05-29 18:43:41 +00:00
const defaultPlacement = {
side : "bottom" ,
align : "center" ,
sameWidth : true
} ;
const withDefaults = { ... defaultPlacement , ... props } ;
2024-06-21 23:07:29 +00:00
const { options : { positioning } } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
const updater = getPositioningUpdater ( positioning ) ;
updater ( withDefaults ) ;
}
const Select = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $idValues , $$unsubscribe _idValues ;
let { required = void 0 } = $$props ;
let { disabled = void 0 } = $$props ;
let { preventScroll = void 0 } = $$props ;
let { loop = void 0 } = $$props ;
let { closeOnEscape = void 0 } = $$props ;
let { closeOnOutsideClick = void 0 } = $$props ;
let { portal = void 0 } = $$props ;
let { name : name2 = void 0 } = $$props ;
let { multiple = false } = $$props ;
let { selected = void 0 } = $$props ;
let { onSelectedChange = void 0 } = $$props ;
let { open = void 0 } = $$props ;
let { onOpenChange = void 0 } = $$props ;
let { items = [ ] } = $$props ;
let { onOutsideClick = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { states : { open : localOpen , selected : localSelected } , updateOption , ids } = setCtx$1 ( {
2024-05-29 18:43:41 +00:00
required ,
disabled ,
preventScroll ,
loop ,
closeOnEscape ,
closeOnOutsideClick ,
portal ,
name : name2 ,
onOutsideClick ,
multiple ,
forceVisible : true ,
defaultSelected : Array . isArray ( selected ) ? [ ... selected ] : selected ,
defaultOpen : open ,
onSelectedChange : ( { next : next2 } ) => {
if ( Array . isArray ( next2 ) ) {
if ( ! Array . isArray ( selected ) || ! arraysAreEqual ( selected , next2 ) ) {
onSelectedChange ? . ( next2 ) ;
selected = next2 ;
return next2 ;
}
return next2 ;
}
if ( selected !== next2 ) {
onSelectedChange ? . ( next2 ) ;
selected = next2 ;
}
return next2 ;
} ,
onOpenChange : ( { next : next2 } ) => {
if ( open !== next2 ) {
onOpenChange ? . ( next2 ) ;
open = next2 ;
}
return next2 ;
} ,
items
} ) ;
const idValues = derived ( [ ids . menu , ids . trigger , ids . label ] , ( [ $menuId , $triggerId , $labelId ] ) => ( {
menu : $menuId ,
trigger : $triggerId ,
label : $labelId
} ) ) ;
$$unsubscribe _idValues = subscribe ( idValues , ( value ) => $idValues = value ) ;
if ( $$props . required === void 0 && $$bindings . required && required !== void 0 )
$$bindings . required ( required ) ;
if ( $$props . disabled === void 0 && $$bindings . disabled && disabled !== void 0 )
$$bindings . disabled ( disabled ) ;
if ( $$props . preventScroll === void 0 && $$bindings . preventScroll && preventScroll !== void 0 )
$$bindings . preventScroll ( preventScroll ) ;
if ( $$props . loop === void 0 && $$bindings . loop && loop !== void 0 )
$$bindings . loop ( loop ) ;
if ( $$props . closeOnEscape === void 0 && $$bindings . closeOnEscape && closeOnEscape !== void 0 )
$$bindings . closeOnEscape ( closeOnEscape ) ;
if ( $$props . closeOnOutsideClick === void 0 && $$bindings . closeOnOutsideClick && closeOnOutsideClick !== void 0 )
$$bindings . closeOnOutsideClick ( closeOnOutsideClick ) ;
if ( $$props . portal === void 0 && $$bindings . portal && portal !== void 0 )
$$bindings . portal ( portal ) ;
if ( $$props . name === void 0 && $$bindings . name && name2 !== void 0 )
$$bindings . name ( name2 ) ;
if ( $$props . multiple === void 0 && $$bindings . multiple && multiple !== void 0 )
$$bindings . multiple ( multiple ) ;
if ( $$props . selected === void 0 && $$bindings . selected && selected !== void 0 )
$$bindings . selected ( selected ) ;
if ( $$props . onSelectedChange === void 0 && $$bindings . onSelectedChange && onSelectedChange !== void 0 )
$$bindings . onSelectedChange ( onSelectedChange ) ;
if ( $$props . open === void 0 && $$bindings . open && open !== void 0 )
$$bindings . open ( open ) ;
if ( $$props . onOpenChange === void 0 && $$bindings . onOpenChange && onOpenChange !== void 0 )
$$bindings . onOpenChange ( onOpenChange ) ;
if ( $$props . items === void 0 && $$bindings . items && items !== void 0 )
$$bindings . items ( items ) ;
if ( $$props . onOutsideClick === void 0 && $$bindings . onOutsideClick && onOutsideClick !== void 0 )
$$bindings . onOutsideClick ( onOutsideClick ) ;
open !== void 0 && localOpen . set ( open ) ;
selected !== void 0 && localSelected . set ( Array . isArray ( selected ) ? [ ... selected ] : selected ) ;
{
updateOption ( "required" , required ) ;
}
{
updateOption ( "disabled" , disabled ) ;
}
{
updateOption ( "preventScroll" , preventScroll ) ;
}
{
updateOption ( "loop" , loop ) ;
}
{
updateOption ( "closeOnEscape" , closeOnEscape ) ;
}
{
updateOption ( "closeOnOutsideClick" , closeOnOutsideClick ) ;
}
{
updateOption ( "portal" , portal ) ;
}
{
updateOption ( "name" , name2 ) ;
}
{
updateOption ( "multiple" , multiple ) ;
}
{
updateOption ( "onOutsideClick" , onOutsideClick ) ;
}
$$unsubscribe _idValues ( ) ;
return ` ${ slots . default ? slots . default ( { ids : $idValues } ) : ` ` } ` ;
} ) ;
const Select _content$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [
"transition" ,
"transitionConfig" ,
"inTransition" ,
"inTransitionConfig" ,
"outTransition" ,
"outTransitionConfig" ,
"asChild" ,
"id" ,
"side" ,
"align" ,
"sideOffset" ,
"alignOffset" ,
"collisionPadding" ,
"avoidCollisions" ,
"collisionBoundary" ,
"sameWidth" ,
"fitViewport" ,
"strategy" ,
"overlap" ,
"el"
] ) ;
let $open , $$unsubscribe _open ;
let $menu , $$unsubscribe _menu ;
let { transition = void 0 } = $$props ;
let { transitionConfig = void 0 } = $$props ;
let { inTransition = void 0 } = $$props ;
let { inTransitionConfig = void 0 } = $$props ;
let { outTransition = void 0 } = $$props ;
let { outTransitionConfig = void 0 } = $$props ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { side = "bottom" } = $$props ;
let { align = "center" } = $$props ;
let { sideOffset = 0 } = $$props ;
let { alignOffset = 0 } = $$props ;
let { collisionPadding = 8 } = $$props ;
let { avoidCollisions = true } = $$props ;
let { collisionBoundary = void 0 } = $$props ;
let { sameWidth = true } = $$props ;
let { fitViewport = false } = $$props ;
let { strategy = "absolute" } = $$props ;
let { overlap = false } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { menu } , states : { open } , ids , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _menu = subscribe ( menu , ( value ) => $menu = value ) ;
$$unsubscribe _open = subscribe ( open , ( value ) => $open = value ) ;
createDispatcher ( ) ;
const attrs = getAttrs ( "content" ) ;
if ( $$props . transition === void 0 && $$bindings . transition && transition !== void 0 )
$$bindings . transition ( transition ) ;
if ( $$props . transitionConfig === void 0 && $$bindings . transitionConfig && transitionConfig !== void 0 )
$$bindings . transitionConfig ( transitionConfig ) ;
if ( $$props . inTransition === void 0 && $$bindings . inTransition && inTransition !== void 0 )
$$bindings . inTransition ( inTransition ) ;
if ( $$props . inTransitionConfig === void 0 && $$bindings . inTransitionConfig && inTransitionConfig !== void 0 )
$$bindings . inTransitionConfig ( inTransitionConfig ) ;
if ( $$props . outTransition === void 0 && $$bindings . outTransition && outTransition !== void 0 )
$$bindings . outTransition ( outTransition ) ;
if ( $$props . outTransitionConfig === void 0 && $$bindings . outTransitionConfig && outTransitionConfig !== void 0 )
$$bindings . outTransitionConfig ( outTransitionConfig ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . side === void 0 && $$bindings . side && side !== void 0 )
$$bindings . side ( side ) ;
if ( $$props . align === void 0 && $$bindings . align && align !== void 0 )
$$bindings . align ( align ) ;
if ( $$props . sideOffset === void 0 && $$bindings . sideOffset && sideOffset !== void 0 )
$$bindings . sideOffset ( sideOffset ) ;
if ( $$props . alignOffset === void 0 && $$bindings . alignOffset && alignOffset !== void 0 )
$$bindings . alignOffset ( alignOffset ) ;
if ( $$props . collisionPadding === void 0 && $$bindings . collisionPadding && collisionPadding !== void 0 )
$$bindings . collisionPadding ( collisionPadding ) ;
if ( $$props . avoidCollisions === void 0 && $$bindings . avoidCollisions && avoidCollisions !== void 0 )
$$bindings . avoidCollisions ( avoidCollisions ) ;
if ( $$props . collisionBoundary === void 0 && $$bindings . collisionBoundary && collisionBoundary !== void 0 )
$$bindings . collisionBoundary ( collisionBoundary ) ;
if ( $$props . sameWidth === void 0 && $$bindings . sameWidth && sameWidth !== void 0 )
$$bindings . sameWidth ( sameWidth ) ;
if ( $$props . fitViewport === void 0 && $$bindings . fitViewport && fitViewport !== void 0 )
$$bindings . fitViewport ( fitViewport ) ;
if ( $$props . strategy === void 0 && $$bindings . strategy && strategy !== void 0 )
$$bindings . strategy ( strategy ) ;
if ( $$props . overlap === void 0 && $$bindings . overlap && overlap !== void 0 )
$$bindings . overlap ( overlap ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . menu . set ( id ) ;
}
}
builder = $menu ;
{
Object . assign ( builder , attrs ) ;
}
{
if ( $open ) {
2024-06-21 23:07:29 +00:00
updatePositioning$1 ( {
2024-05-29 18:43:41 +00:00
side ,
align ,
sideOffset ,
alignOffset ,
collisionPadding ,
avoidCollisions ,
collisionBoundary ,
sameWidth ,
fitViewport ,
strategy ,
overlap
} ) ;
}
}
$$unsubscribe _open ( ) ;
$$unsubscribe _menu ( ) ;
return ` ${ asChild && $open ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` ${ transition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ inTransition && outTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ inTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ outTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ` } ` } ` } ` } ` } ` } ` ;
} ) ;
const Select _group = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "el" ] ) ;
let $group , $$unsubscribe _group ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
const { group , id , getAttrs } = setGroupCtx ( ) ;
$$unsubscribe _group = subscribe ( group , ( value ) => $group = value ) ;
const attrs = getAttrs ( "group" ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
builder = $group ( id ) ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _group ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` } ` ;
} ) ;
const Select _input = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let attrs ;
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "el" ] ) ;
let $hiddenInput , $$unsubscribe _hiddenInput ;
let $disabled , $$unsubscribe _disabled ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { hiddenInput } , options : { disabled } , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _hiddenInput = subscribe ( hiddenInput , ( value ) => $hiddenInput = value ) ;
$$unsubscribe _disabled = subscribe ( disabled , ( value ) => $disabled = value ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
attrs = {
... getAttrs ( "input" ) ,
disabled : $disabled ? true : void 0
} ;
builder = $hiddenInput ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _hiddenInput ( ) ;
$$unsubscribe _disabled ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <input ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ` } ` ;
} ) ;
const Select _item$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let isSelected ;
let $$restProps = compute _rest _props ( $$props , [ "value" , "disabled" , "label" , "asChild" , "el" ] ) ;
let $isSelectedStore , $$unsubscribe _isSelectedStore ;
let $item , $$unsubscribe _item ;
let { value } = $$props ;
let { disabled = void 0 } = $$props ;
let { label = void 0 } = $$props ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
const { elements : { option : item } , helpers : { isSelected : isSelectedStore } , getAttrs } = setItemCtx ( value ) ;
$$unsubscribe _item = subscribe ( item , ( value2 ) => $item = value2 ) ;
$$unsubscribe _isSelectedStore = subscribe ( isSelectedStore , ( value2 ) => $isSelectedStore = value2 ) ;
createDispatcher ( ) ;
const attrs = getAttrs ( "item" ) ;
if ( $$props . value === void 0 && $$bindings . value && value !== void 0 )
$$bindings . value ( value ) ;
if ( $$props . disabled === void 0 && $$bindings . disabled && disabled !== void 0 )
$$bindings . disabled ( disabled ) ;
if ( $$props . label === void 0 && $$bindings . label && label !== void 0 )
$$bindings . label ( label ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
builder = $item ( { value , disabled , label } ) ;
{
Object . assign ( builder , attrs ) ;
}
isSelected = $isSelectedStore ( value ) ;
$$unsubscribe _isSelectedStore ( ) ;
$$unsubscribe _item ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder , isSelected } ) : ` ` } ` : ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder , isSelected } ) : ` $ { escape ( label || value ) } ` } < / d i v > ` } ` ;
} ) ;
const Select _item _indicator = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "el" ] ) ;
let $isSelected , $$unsubscribe _isSelected ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
const { isSelected , value , getAttrs } = getItemIndicator ( ) ;
$$unsubscribe _isSelected = subscribe ( isSelected , ( value2 ) => $isSelected = value2 ) ;
const attrs = getAttrs ( "indicator" ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
$$unsubscribe _isSelected ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { attrs , isSelected : $isSelected ( value ) } ) : ` ` } ` : ` <div ${ spread ( [ escape _object ( $$restProps ) , escape _object ( attrs ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ $isSelected ( value ) ? ` ${ slots . default ? slots . default ( { attrs , isSelected : $isSelected ( value ) } ) : ` ` } ` : ` ` } </div> ` } ` ;
} ) ;
2024-07-21 13:35:30 +00:00
const Select _trigger = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
2024-05-29 18:43:41 +00:00
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "id" , "el" ] ) ;
let $trigger , $$unsubscribe _trigger ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { elements : { trigger } , ids , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _trigger = subscribe ( trigger , ( value ) => $trigger = value ) ;
createDispatcher ( ) ;
const attrs = getAttrs ( "trigger" ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . trigger . set ( id ) ;
}
}
builder = $trigger ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _trigger ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <button ${ spread ( [ escape _object ( builder ) , { type : "button" } , escape_object( $ $ restProps)], {})} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</button> ` } ` ;
} ) ;
const Select _value = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let label ;
let $$restProps = compute _rest _props ( $$props , [ "placeholder" , "asChild" , "el" ] ) ;
let $selectedLabel , $$unsubscribe _selectedLabel ;
let { placeholder = "" } = $$props ;
let { asChild = false } = $$props ;
let { el = void 0 } = $$props ;
2024-06-21 23:07:29 +00:00
const { states : { selectedLabel } , getAttrs } = getCtx$1 ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _selectedLabel = subscribe ( selectedLabel , ( value ) => $selectedLabel = value ) ;
const attrs = getAttrs ( "value" ) ;
if ( $$props . placeholder === void 0 && $$bindings . placeholder && placeholder !== void 0 )
$$bindings . placeholder ( placeholder ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
label = $selectedLabel ;
$$unsubscribe _selectedLabel ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { label , attrs } ) : ` ` } ` : ` <span ${ spread (
[
escape _object ( $$restProps ) ,
escape _object ( attrs ) ,
{
"data-placeholder" : escape _attribute _value ( ! label ? "" : void 0 )
}
] ,
{ }
) } $ { add _attribute ( "this" , el , 0 ) } > $ { escape ( label || placeholder ) } < / s p a n > ` } ` ;
} ) ;
2024-06-21 23:07:29 +00:00
function getTooltipData ( ) {
const NAME = "tooltip" ;
const PARTS = [ "arrow" , "content" , "trigger" ] ;
return {
NAME ,
PARTS
} ;
}
function setCtx ( props ) {
const { NAME , PARTS } = getTooltipData ( ) ;
const getAttrs = createBitAttrs ( NAME , PARTS ) ;
const tooltip = {
... createTooltip ( {
positioning : {
placement : "top" ,
gutter : 0
} ,
openDelay : 700 ,
... removeUndefined ( props ) ,
forceVisible : true
} ) ,
getAttrs
} ;
setContext ( NAME , tooltip ) ;
return {
... tooltip ,
updateOption : getOptionUpdater ( tooltip . options )
} ;
}
function getCtx ( ) {
const { NAME } = getTooltipData ( ) ;
return getContext ( NAME ) ;
}
function updatePositioning ( props ) {
const defaultPlacement = {
side : "top" ,
align : "center" ,
sideOffset : 1
} ;
const withDefaults = { ... defaultPlacement , ... props } ;
const { options : { positioning } } = getCtx ( ) ;
const updater = getPositioningUpdater ( positioning ) ;
updater ( { ... withDefaults } ) ;
}
const Tooltip = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $idValues , $$unsubscribe _idValues ;
let { closeOnEscape = void 0 } = $$props ;
let { portal = void 0 } = $$props ;
let { closeOnPointerDown = void 0 } = $$props ;
let { openDelay = void 0 } = $$props ;
let { closeDelay = void 0 } = $$props ;
let { open = void 0 } = $$props ;
let { onOpenChange = void 0 } = $$props ;
let { disableHoverableContent = void 0 } = $$props ;
let { group = void 0 } = $$props ;
const { states : { open : localOpen } , updateOption , ids } = setCtx ( {
closeOnEscape ,
portal ,
closeOnPointerDown ,
openDelay ,
closeDelay ,
forceVisible : true ,
defaultOpen : open ,
disableHoverableContent ,
group ,
onOpenChange : ( { next : next2 } ) => {
if ( open !== next2 ) {
onOpenChange ? . ( next2 ) ;
open = next2 ;
}
return next2 ;
} ,
positioning : { gutter : 0 , offset : { mainAxis : 1 } }
} ) ;
const idValues = derived ( [ ids . content , ids . trigger ] , ( [ $contentId , $triggerId ] ) => ( { content : $contentId , trigger : $triggerId } ) ) ;
$$unsubscribe _idValues = subscribe ( idValues , ( value ) => $idValues = value ) ;
if ( $$props . closeOnEscape === void 0 && $$bindings . closeOnEscape && closeOnEscape !== void 0 )
$$bindings . closeOnEscape ( closeOnEscape ) ;
if ( $$props . portal === void 0 && $$bindings . portal && portal !== void 0 )
$$bindings . portal ( portal ) ;
if ( $$props . closeOnPointerDown === void 0 && $$bindings . closeOnPointerDown && closeOnPointerDown !== void 0 )
$$bindings . closeOnPointerDown ( closeOnPointerDown ) ;
if ( $$props . openDelay === void 0 && $$bindings . openDelay && openDelay !== void 0 )
$$bindings . openDelay ( openDelay ) ;
if ( $$props . closeDelay === void 0 && $$bindings . closeDelay && closeDelay !== void 0 )
$$bindings . closeDelay ( closeDelay ) ;
if ( $$props . open === void 0 && $$bindings . open && open !== void 0 )
$$bindings . open ( open ) ;
if ( $$props . onOpenChange === void 0 && $$bindings . onOpenChange && onOpenChange !== void 0 )
$$bindings . onOpenChange ( onOpenChange ) ;
if ( $$props . disableHoverableContent === void 0 && $$bindings . disableHoverableContent && disableHoverableContent !== void 0 )
$$bindings . disableHoverableContent ( disableHoverableContent ) ;
if ( $$props . group === void 0 && $$bindings . group && group !== void 0 )
$$bindings . group ( group ) ;
open !== void 0 && localOpen . set ( open ) ;
{
updateOption ( "closeOnEscape" , closeOnEscape ) ;
}
{
updateOption ( "portal" , portal ) ;
}
{
updateOption ( "closeOnPointerDown" , closeOnPointerDown ) ;
}
{
updateOption ( "openDelay" , openDelay ) ;
}
{
updateOption ( "closeDelay" , closeDelay ) ;
}
{
updateOption ( "group" , group ) ;
}
{
updateOption ( "disableHoverableContent" , disableHoverableContent ) ;
}
$$unsubscribe _idValues ( ) ;
return ` ${ slots . default ? slots . default ( { ids : $idValues } ) : ` ` } ` ;
} ) ;
const Tooltip _content$1 = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [
"transition" ,
"transitionConfig" ,
"inTransition" ,
"inTransitionConfig" ,
"outTransition" ,
"outTransitionConfig" ,
"asChild" ,
"id" ,
"side" ,
"align" ,
"sideOffset" ,
"alignOffset" ,
"collisionPadding" ,
"avoidCollisions" ,
"collisionBoundary" ,
"sameWidth" ,
"fitViewport" ,
"strategy" ,
"overlap" ,
"el"
] ) ;
let $open , $$unsubscribe _open ;
let $content , $$unsubscribe _content ;
let { transition = void 0 } = $$props ;
let { transitionConfig = void 0 } = $$props ;
let { inTransition = void 0 } = $$props ;
let { inTransitionConfig = void 0 } = $$props ;
let { outTransition = void 0 } = $$props ;
let { outTransitionConfig = void 0 } = $$props ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { side = "top" } = $$props ;
let { align = "center" } = $$props ;
let { sideOffset = 0 } = $$props ;
let { alignOffset = 0 } = $$props ;
let { collisionPadding = 8 } = $$props ;
let { avoidCollisions = true } = $$props ;
let { collisionBoundary = void 0 } = $$props ;
let { sameWidth = false } = $$props ;
let { fitViewport = false } = $$props ;
let { strategy = "absolute" } = $$props ;
let { overlap = false } = $$props ;
let { el = void 0 } = $$props ;
const { elements : { content } , states : { open } , ids , getAttrs } = getCtx ( ) ;
$$unsubscribe _content = subscribe ( content , ( value ) => $content = value ) ;
$$unsubscribe _open = subscribe ( open , ( value ) => $open = value ) ;
createDispatcher ( ) ;
const attrs = getAttrs ( "content" ) ;
if ( $$props . transition === void 0 && $$bindings . transition && transition !== void 0 )
$$bindings . transition ( transition ) ;
if ( $$props . transitionConfig === void 0 && $$bindings . transitionConfig && transitionConfig !== void 0 )
$$bindings . transitionConfig ( transitionConfig ) ;
if ( $$props . inTransition === void 0 && $$bindings . inTransition && inTransition !== void 0 )
$$bindings . inTransition ( inTransition ) ;
if ( $$props . inTransitionConfig === void 0 && $$bindings . inTransitionConfig && inTransitionConfig !== void 0 )
$$bindings . inTransitionConfig ( inTransitionConfig ) ;
if ( $$props . outTransition === void 0 && $$bindings . outTransition && outTransition !== void 0 )
$$bindings . outTransition ( outTransition ) ;
if ( $$props . outTransitionConfig === void 0 && $$bindings . outTransitionConfig && outTransitionConfig !== void 0 )
$$bindings . outTransitionConfig ( outTransitionConfig ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . side === void 0 && $$bindings . side && side !== void 0 )
$$bindings . side ( side ) ;
if ( $$props . align === void 0 && $$bindings . align && align !== void 0 )
$$bindings . align ( align ) ;
if ( $$props . sideOffset === void 0 && $$bindings . sideOffset && sideOffset !== void 0 )
$$bindings . sideOffset ( sideOffset ) ;
if ( $$props . alignOffset === void 0 && $$bindings . alignOffset && alignOffset !== void 0 )
$$bindings . alignOffset ( alignOffset ) ;
if ( $$props . collisionPadding === void 0 && $$bindings . collisionPadding && collisionPadding !== void 0 )
$$bindings . collisionPadding ( collisionPadding ) ;
if ( $$props . avoidCollisions === void 0 && $$bindings . avoidCollisions && avoidCollisions !== void 0 )
$$bindings . avoidCollisions ( avoidCollisions ) ;
if ( $$props . collisionBoundary === void 0 && $$bindings . collisionBoundary && collisionBoundary !== void 0 )
$$bindings . collisionBoundary ( collisionBoundary ) ;
if ( $$props . sameWidth === void 0 && $$bindings . sameWidth && sameWidth !== void 0 )
$$bindings . sameWidth ( sameWidth ) ;
if ( $$props . fitViewport === void 0 && $$bindings . fitViewport && fitViewport !== void 0 )
$$bindings . fitViewport ( fitViewport ) ;
if ( $$props . strategy === void 0 && $$bindings . strategy && strategy !== void 0 )
$$bindings . strategy ( strategy ) ;
if ( $$props . overlap === void 0 && $$bindings . overlap && overlap !== void 0 )
$$bindings . overlap ( overlap ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . content . set ( id ) ;
}
}
builder = $content ;
{
Object . assign ( builder , attrs ) ;
}
{
if ( $open ) {
updatePositioning ( {
side ,
align ,
sideOffset ,
alignOffset ,
collisionPadding ,
avoidCollisions ,
collisionBoundary ,
sameWidth ,
fitViewport ,
strategy ,
overlap
} ) ;
}
}
$$unsubscribe _open ( ) ;
$$unsubscribe _content ( ) ;
return ` ${ asChild && $open ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` ${ transition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ inTransition && outTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ inTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ outTransition && $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ${ $open ? ` <div ${ spread ( [ escape _object ( builder ) , escape _object ( $$restProps ) ] , { } )} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</div> ` : ` ` } ` } ` } ` } ` } ` } ` ;
} ) ;
const Tooltip _trigger = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let builder ;
let $$restProps = compute _rest _props ( $$props , [ "asChild" , "id" , "el" ] ) ;
let $trigger , $$unsubscribe _trigger ;
let { asChild = false } = $$props ;
let { id = void 0 } = $$props ;
let { el = void 0 } = $$props ;
const { elements : { trigger } , ids , getAttrs } = getCtx ( ) ;
$$unsubscribe _trigger = subscribe ( trigger , ( value ) => $trigger = value ) ;
createDispatcher ( ) ;
const attrs = getAttrs ( "trigger" ) ;
if ( $$props . asChild === void 0 && $$bindings . asChild && asChild !== void 0 )
$$bindings . asChild ( asChild ) ;
if ( $$props . id === void 0 && $$bindings . id && id !== void 0 )
$$bindings . id ( id ) ;
if ( $$props . el === void 0 && $$bindings . el && el !== void 0 )
$$bindings . el ( el ) ;
{
if ( id ) {
ids . trigger . set ( id ) ;
}
}
builder = $trigger ;
{
Object . assign ( builder , attrs ) ;
}
$$unsubscribe _trigger ( ) ;
return ` ${ asChild ? ` ${ slots . default ? slots . default ( { builder } ) : ` ` } ` : ` <button ${ spread ( [ escape _object ( builder ) , { type : "button" } , escape_object( $ $ restProps)], {})} ${ add _attribute ( "this" , el , 0 ) } > ${ slots . default ? slots . default ( { builder } ) : ` ` }</button> ` } ` ;
} ) ;
2024-05-29 18:43:41 +00:00
const Check = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [ [ "path" , { "d" : "M20 6 9 17l-5-5" } ] ] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "check" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Check$1 = Check ;
2024-07-21 13:35:30 +00:00
const Dialog _title = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` ${ validate _component ( Dialog _title$1 , "DialogPrimitive.Title" ) . $$render (
$$result ,
Object . assign (
{ } ,
{
class : cn ( "text-lg font-semibold leading-none tracking-tight" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
}
) } ` ;
} ) ;
const Dialog _portal = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ ] ) ;
return ` ${ validate _component ( Dialog _portal$1 , "DialogPrimitive.Portal" ) . $$render ( $$result , Object . assign ( { } , $ $ restProps), {}, {
2024-05-29 18:43:41 +00:00
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
2024-07-21 13:35:30 +00:00
const Dialog _footer = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` <div ${ spread (
[
{
class : escape _attribute _value ( cn ( "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2" , className ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { slots . default ? slots . default ( { } ) : ` ` } < / d i v > ` ;
} ) ;
const Dialog _header = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` <div ${ spread (
[
{
class : escape _attribute _value ( cn ( "flex flex-col space-y-1.5 text-center sm:text-left" , className ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { slots . default ? slots . default ( { } ) : ` ` } < / d i v > ` ;
} ) ;
const Dialog _overlay = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "transition" , "transitionConfig" ] ) ;
let { class : className = void 0 } = $$props ;
let { transition = fade } = $$props ;
let { transitionConfig = { duration : 150 } } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . transition === void 0 && $$bindings . transition && transition !== void 0 )
$$bindings . transition ( transition ) ;
if ( $$props . transitionConfig === void 0 && $$bindings . transitionConfig && transitionConfig !== void 0 )
$$bindings . transitionConfig ( transitionConfig ) ;
return ` ${ validate _component ( Dialog _overlay$1 , "DialogPrimitive.Overlay" ) . $$render (
$$result ,
Object . assign (
{ } ,
{ transition } ,
{ transitionConfig } ,
{
class : cn ( "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm" , className )
} ,
$$restProps
) ,
{ } ,
{ }
) } ` ;
} ) ;
const Dialog _content = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "transition" , "transitionConfig" ] ) ;
let { class : className = void 0 } = $$props ;
let { transition = flyAndScale } = $$props ;
let { transitionConfig = { duration : 200 } } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . transition === void 0 && $$bindings . transition && transition !== void 0 )
$$bindings . transition ( transition ) ;
if ( $$props . transitionConfig === void 0 && $$bindings . transitionConfig && transitionConfig !== void 0 )
$$bindings . transitionConfig ( transitionConfig ) ;
return ` ${ validate _component ( Dialog _portal , "Dialog.Portal" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Dialog _overlay , "Dialog.Overlay" ) . $$render ( $$result , { } , {}, {})} ${ validate _component ( Dialog _content$1 , "DialogPrimitive.Content" ) . $$render (
$$result ,
Object . assign (
{ } ,
{ transition } ,
{ transitionConfig } ,
{
class : cn ( "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg sm:rounded-lg md:w-full" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ${ validate _component ( Dialog _close , "DialogPrimitive.Close" ) . $$render (
$$result ,
{
class : "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
} ,
{ } ,
{
default : ( ) => {
return ` ${ validate _component ( X$1 , "X" ) . $$render ( $$result , { class : "h-4 w-4" } , {}, {})} <span class="sr-only" data-svelte-h="svelte-1pewzs3">Close</span> ` ;
}
}
) } ` ;
}
}
) } ` ;
}
} ) } ` ;
} ) ;
const Dialog _description = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` ${ validate _component ( Dialog _description$1 , "DialogPrimitive.Description" ) . $$render (
$$result ,
Object . assign (
{ } ,
{
class : cn ( "text-sm text-muted-foreground" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
}
) } ` ;
} ) ;
const Root$2 = Dialog ;
const Trigger$1 = Dialog _trigger ;
2024-05-29 18:43:41 +00:00
const Ellipsis = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[ "circle" , { "cx" : "12" , "cy" : "12" , "r" : "1" } ] ,
[ "circle" , { "cx" : "19" , "cy" : "12" , "r" : "1" } ] ,
[ "circle" , { "cx" : "5" , "cy" : "12" , "r" : "1" } ]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "ellipsis" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Ellipsis$1 = Ellipsis ;
const External _link = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[ "path" , { "d" : "M15 3h6v6" } ] ,
[ "path" , { "d" : "M10 14 21 3" } ] ,
[
"path" ,
{
"d" : "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}
]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "external-link" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const ExternalLink = External _link ;
const Eye _off = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[ "path" , { "d" : "M9.88 9.88a3 3 0 1 0 4.24 4.24" } ] ,
[
"path" ,
{
"d" : "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"
}
] ,
[
"path" ,
{
"d" : "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"
}
] ,
[
"line" ,
{
"x1" : "2" ,
"x2" : "22" ,
"y1" : "2" ,
"y2" : "22"
}
]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "eye-off" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const EyeOff = Eye _off ;
const Eye = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[
"path" ,
{
"d" : "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"
}
] ,
[ "circle" , { "cx" : "12" , "cy" : "12" , "r" : "3" } ]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "eye" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Eye$1 = Eye ;
const Loader _circle = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [ [ "path" , { "d" : "M21 12a9 9 0 1 1-6.219-8.56" } ] ] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "loader-circle" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Loader2 = Loader _circle ;
const Pen = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[
"path" ,
{
"d" : "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"
}
]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "pen" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Pen$1 = Pen ;
const Trash = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
const iconNode = [
[ "path" , { "d" : "M3 6h18" } ] ,
[
"path" ,
{
"d" : "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"
}
] ,
[
"path" ,
{
"d" : "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
}
]
] ;
return ` ${ validate _component ( Icon$1 , "Icon" ) . $$render ( $$result , Object . assign ( { } , { name: "trash" }, $ $ props, { iconNode }), {}, {
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
} ) } ` ;
} ) ;
const Trash$1 = Trash ;
2024-06-21 23:07:29 +00:00
const Tooltip _content = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "sideOffset" , "transition" , "transitionConfig" ] ) ;
let { class : className = void 0 } = $$props ;
let { sideOffset = 4 } = $$props ;
let { transition = flyAndScale } = $$props ;
let { transitionConfig = { y : 8 , duration : 150 } } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . sideOffset === void 0 && $$bindings . sideOffset && sideOffset !== void 0 )
$$bindings . sideOffset ( sideOffset ) ;
if ( $$props . transition === void 0 && $$bindings . transition && transition !== void 0 )
$$bindings . transition ( transition ) ;
if ( $$props . transitionConfig === void 0 && $$bindings . transitionConfig && transitionConfig !== void 0 )
$$bindings . transitionConfig ( transitionConfig ) ;
return ` ${ validate _component ( Tooltip _content$1 , "TooltipPrimitive.Content" ) . $$render (
$$result ,
Object . assign (
{ } ,
{ transition } ,
{ transitionConfig } ,
{ sideOffset } ,
{
class : cn ( "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
}
) } ` ;
} ) ;
2024-07-21 13:35:30 +00:00
const Root$1 = Tooltip ;
const Trigger = Tooltip _trigger ;
2024-05-29 18:43:41 +00:00
const Tooltipbutton = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let { tip = "" } = $$props ;
let { variant = "" } = $$props ;
let { size = "" } = $$props ;
let { class : className = "" } = $$props ;
if ( $$props . tip === void 0 && $$bindings . tip && tip !== void 0 )
$$bindings . tip ( tip ) ;
if ( $$props . variant === void 0 && $$bindings . variant && variant !== void 0 )
$$bindings . variant ( variant ) ;
if ( $$props . size === void 0 && $$bindings . size && size !== void 0 )
$$bindings . size ( size ) ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
2024-07-21 13:35:30 +00:00
return ` ${ validate _component ( Root$1 , "Tooltip.Root" ) . $$render ( $$result , { } , {}, {
2024-05-29 18:43:41 +00:00
default : ( ) => {
2024-07-21 13:35:30 +00:00
return ` ${ validate _component ( Trigger , "Tooltip.Trigger" ) . $$render ( $$result , { asChild : true } , {}, {
2024-05-29 18:43:41 +00:00
default : ( { builder } ) => {
return ` ${ validate _component ( Button , "Button" ) . $$render (
$$result ,
{
class : className ,
builders : [ builder ] ,
variant ,
size
} ,
{ } ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` ` } ` ;
}
}
) } ` ;
}
} ) } $ { validate _component ( Tooltip _content , "Tooltip.Content" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` <p> ${ escape ( tip ) } </p> ` ;
}
} ) } ` ;
}
} ) } ` ;
} ) ;
2024-06-21 23:07:29 +00:00
const Badge = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "href" , "variant" ] ) ;
let { class : className = void 0 } = $$props ;
let { href = void 0 } = $$props ;
let { variant = "default" } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . href === void 0 && $$bindings . href && href !== void 0 )
$$bindings . href ( href ) ;
if ( $$props . variant === void 0 && $$bindings . variant && variant !== void 0 )
$$bindings . variant ( variant ) ;
return ` ${ ( ( tag ) => {
return tag ? ` < ${ href ? "a" : "span" } ${ spread (
[
{ href : escape _attribute _value ( href ) } ,
{
class : escape _attribute _value ( cn ( badgeVariants ( { variant , className } ) ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { is _void ( tag ) ? "" : ` ${ slots . default ? slots . default ( { } ) : ` ` } ` } $ { is _void ( tag ) ? "" : ` </ ${ tag } > ` } ` : "";
} ) ( href ? "a" : "span" ) } ` ;
} ) ;
const badgeVariants = tv ( {
2024-05-29 18:43:41 +00:00
base : "inline-flex select-none items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2" ,
variants : {
variant : {
default : "border-transparent bg-primary text-primary-foreground hover:bg-primary/80" ,
secondary : "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80" ,
destructive : "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80" ,
outline : "text-foreground"
}
} ,
defaultVariants : {
variant : "default"
}
} ) ;
const Select _item = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "value" , "label" , "disabled" ] ) ;
let { class : className = void 0 } = $$props ;
let { value } = $$props ;
let { label = void 0 } = $$props ;
let { disabled = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . value === void 0 && $$bindings . value && value !== void 0 )
$$bindings . value ( value ) ;
if ( $$props . label === void 0 && $$bindings . label && label !== void 0 )
$$bindings . label ( label ) ;
if ( $$props . disabled === void 0 && $$bindings . disabled && disabled !== void 0 )
$$bindings . disabled ( disabled ) ;
return ` ${ validate _component ( Select _item$1 , "SelectPrimitive.Item" ) . $$render (
$$result ,
Object . assign (
{ } ,
{ value } ,
{ disabled } ,
{ label } ,
{
class : cn ( "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` <span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> ${ validate _component ( Select _item _indicator , "SelectPrimitive.ItemIndicator" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Check$1 , "Check" ) . $$render ( $$result , { class : "h-4 w-4" } , {}, {})} ` ;
}
} ) } < / s p a n > $ { s l o t s . d e f a u l t ? s l o t s . d e f a u l t ( { } ) : ` $ { e s c a p e ( l a b e l | | v a l u e ) } ` } ` ;
}
}
) } ` ;
} ) ;
const Select _content = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [
"sideOffset" ,
"inTransition" ,
"inTransitionConfig" ,
"outTransition" ,
"outTransitionConfig" ,
"class"
] ) ;
let { sideOffset = 4 } = $$props ;
let { inTransition = flyAndScale } = $$props ;
let { inTransitionConfig = void 0 } = $$props ;
let { outTransition = scale } = $$props ;
let { outTransitionConfig = { start : 0.95 , opacity : 0 , duration : 50 } } = $$props ;
let { class : className = void 0 } = $$props ;
if ( $$props . sideOffset === void 0 && $$bindings . sideOffset && sideOffset !== void 0 )
$$bindings . sideOffset ( sideOffset ) ;
if ( $$props . inTransition === void 0 && $$bindings . inTransition && inTransition !== void 0 )
$$bindings . inTransition ( inTransition ) ;
if ( $$props . inTransitionConfig === void 0 && $$bindings . inTransitionConfig && inTransitionConfig !== void 0 )
$$bindings . inTransitionConfig ( inTransitionConfig ) ;
if ( $$props . outTransition === void 0 && $$bindings . outTransition && outTransition !== void 0 )
$$bindings . outTransition ( outTransition ) ;
if ( $$props . outTransitionConfig === void 0 && $$bindings . outTransitionConfig && outTransitionConfig !== void 0 )
$$bindings . outTransitionConfig ( outTransitionConfig ) ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` ${ validate _component ( Select _content$1 , "SelectPrimitive.Content" ) . $$render (
$$result ,
Object . assign (
{ } ,
{ inTransition } ,
{ inTransitionConfig } ,
{ outTransition } ,
{ outTransitionConfig } ,
{ sideOffset } ,
{
class : cn ( "relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md outline-none" , className )
} ,
$$restProps
) ,
{ } ,
{
default : ( ) => {
return ` <div class="w-full p-1"> ${ slots . default ? slots . default ( { } ) : ` ` }</div> ` ;
}
}
) } ` ;
} ) ;
const Root = Select ;
const Group = Select _group ;
const Input = Select _input ;
const CreateArticleDialog = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
2024-06-10 19:21:30 +00:00
let $$restProps = compute _rest _props ( $$props , [ "videos" , "tier" , "form" ] ) ;
let $formData , $$unsubscribe _formData ;
2024-05-29 18:43:41 +00:00
let $$unsubscribe _errors ;
let $page , $$unsubscribe _page ;
$$unsubscribe _page = subscribe ( page , ( value ) => $page = value ) ;
let { videos } = $$props ;
let { tier } = $$props ;
let { form : data = $page . data . switch } = $$props ;
const form = superForm ( data , { validators : zodClient ( createFormSchema ) } ) ;
const { form : formData , enhance , errors } = form ;
$$unsubscribe _formData = subscribe ( formData , ( value ) => $formData = value ) ;
$$unsubscribe _errors = subscribe ( errors , ( value ) => value ) ;
let open = false ;
errors . subscribe ( ( x ) => {
x . _errors ? . forEach ( ( x2 ) => toast . error ( x2 , { dismissable : true , duration : 0 } ) ) ;
} ) ;
if ( $$props . videos === void 0 && $$bindings . videos && videos !== void 0 )
$$bindings . videos ( videos ) ;
if ( $$props . tier === void 0 && $$bindings . tier && tier !== void 0 )
$$bindings . tier ( tier ) ;
if ( $$props . form === void 0 && $$bindings . form && data !== void 0 )
$$bindings . form ( data ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
2024-06-10 19:21:30 +00:00
{
{
console . log ( $formData . video _id ) ;
}
}
2024-07-21 13:35:30 +00:00
$$rendered = ` ${ validate _component ( Root$2 , "Dialog.Root" ) . $$render (
2024-05-29 18:43:41 +00:00
$$result ,
{ open } ,
{
open : ( $$value ) => {
open = $$value ;
$$settled = false ;
}
} ,
{
default : ( ) => {
2024-07-21 13:35:30 +00:00
return ` ${ validate _component ( Trigger$1 , "Dialog.Trigger" ) . $$render (
2024-05-29 18:43:41 +00:00
$$result ,
{
class : buttonVariants ( { variant : "default" } )
} ,
{ } ,
{
default : ( ) => {
return ` Create Article ` ;
}
}
) } $ { validate _component ( Dialog _content , "Dialog.Content" ) . $$render ( $$result , { class : "w-full sm:max-w-[750px]" } , { } , {
default : ( ) => {
return ` ${ validate _component ( Dialog _header , "Dialog.Header" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Dialog _title , "Dialog.Title" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` Create Article ` ;
}
} ) } $ { validate _component ( Dialog _description , "Dialog.Description" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` Configure your article and let our AI do the writing! ` ;
}
} ) } ` ;
}
} ) } < form method = "POST" name = "blog-converter" id = "blog-converter" action = "?/create" > $ { validate _component ( Form _field , "Form.Field" ) . $$render ( $$result , { form , name : "video_id" } , { } , {
default : ( ) => {
return ` ${ validate _component ( Control , "Form.Control" ) . $$render ( $$result , { } , {}, {
default : ( { attrs } ) => {
2024-06-10 19:21:30 +00:00
return ` <div class="mb-4 grid gap-4" style="margin-bottom: 0.5rem !important"><div class="grid grid-cols-4 items-center gap-4"> ${ validate _component ( Form _label , "Form.Label" ) . $$render ( $$result , { class : "text-right" } , {}, {
2024-05-29 18:43:41 +00:00
default : ( ) => {
2024-06-10 19:21:30 +00:00
return ` Youtube video link* ` ;
2024-05-29 18:43:41 +00:00
}
} ) } $ { validate _component ( Root , "Select.Root" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
2024-07-21 13:35:30 +00:00
return ` ${ validate _component ( Select _trigger , "SelectPrimitive.Trigger" ) . $$render (
2024-06-10 19:21:30 +00:00
$$result ,
Object . assign (
{ } ,
{
class : cn ( "col-span-2 flex h-10 w-[300px] items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1" )
} ,
$$restProps ,
{ asChild : true }
) ,
{ } ,
{
default : ( { builder } ) => {
return ` <div ${ spread (
[
escape _object ( builder ) ,
{ class : "col-span-2 w-[300px]" }
] ,
{ }
) } > $ { validate _component ( Select _value , "SelectPrimitive.Value" ) . $$render ( $$result , { asChild : true } , { } , {
default : ( ) => {
return ` ${ validate _component ( Input$1 , "Input" ) . $$render (
$$result ,
Object . assign (
{ } ,
{
placeholder : "Paste a video link or select a video"
} ,
{ class : "col-span-2 w-[300px]" } ,
attrs ,
{ value : $formData . video _id }
) ,
{
value : ( $$value ) => {
$formData . video _id = $$value ;
$$settled = false ;
}
} ,
{ }
) } ` ;
}
} ) } < / d i v > ` ;
}
2024-05-29 18:43:41 +00:00
}
2024-06-10 19:21:30 +00:00
) } $ { validate _component ( Select _content , "Select.Content" ) . $$render ( $$result , { } , { } , {
2024-05-29 18:43:41 +00:00
default : ( ) => {
return ` ${ validate _component ( Group , "Select.Group" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ each ( videos , ( video ) => {
return ` ${ validate _component ( Select _item , "Select.Item" ) . $$render (
$$result ,
{
value : video . snippet . resourceId . videoId ,
label : video . snippet . title
} ,
{ } ,
{
default : ( ) => {
2024-06-10 19:21:30 +00:00
return ` ${ escape ( video . snippet . title ) } ` ;
2024-05-29 18:43:41 +00:00
}
}
) } ` ;
} ) } ` ;
}
} ) } ` ;
}
} ) } $ { validate _component ( Input , "Select.Input" ) . $$render (
$$result ,
Object . assign ( { } , attrs , { value : $formData . video _id } ) ,
{
value : ( $$value ) => {
$formData . video _id = $$value ;
$$settled = false ;
}
} ,
{ }
) } ` ;
}
2024-06-10 19:21:30 +00:00
} ) } < / d i v > < / d i v > ` ;
2024-05-29 18:43:41 +00:00
}
2024-06-10 19:21:30 +00:00
} ) } < div class = "grid grid-cols-4 items-center gap-4 mb" style = "margin-top: 0.5rem !important" > $ { validate _component ( Form _field _errors , "Form.FieldErrors" ) . $$render ( $$result , { class : "col-start-2 mb-2" } , { } , { } ) } < / d i v > ` ;
2024-05-29 18:43:41 +00:00
}
2024-07-21 13:35:30 +00:00
} ) } < / f o r m > $ { v a l i d a t e _ c o m p o n e n t ( D i a l o g _ f o o t e r , " D i a l o g . F o o t e r " ) . $ $ r e n d e r ( $ $ r e s u l t , { } , { } , {
2024-05-29 18:43:41 +00:00
default : ( ) => {
return ` ${ validate _component ( Button , "Button" ) . $$render ( $$result , { type : "submit" , form : "blog-converter" } , {}, {
default : ( ) => {
return ` Create ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } ` ;
}
}
) } ` ;
} while ( ! $$settled ) ;
2024-06-10 19:21:30 +00:00
$$unsubscribe _formData ( ) ;
2024-05-29 18:43:41 +00:00
$$unsubscribe _errors ( ) ;
$$unsubscribe _page ( ) ;
return $$rendered ;
} ) ;
const EditArticleDialog = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $page , $$unsubscribe _page ;
let $formData , $$unsubscribe _formData ;
$$unsubscribe _page = subscribe ( page , ( value ) => $page = value ) ;
let { form : data = $page . data . switch } = $$props ;
let { article _data } = $$props ;
const form = superForm ( data , {
validators : zodClient ( editFormSchema ) ,
onSubmit : ( { } ) => {
toast . success ( "Article edited successfully." ) ;
article _data = null ;
}
} ) ;
const { form : formData , enhance } = form ;
$$unsubscribe _formData = subscribe ( formData , ( value ) => $formData = value ) ;
if ( $$props . form === void 0 && $$bindings . form && data !== void 0 )
$$bindings . form ( data ) ;
if ( $$props . article _data === void 0 && $$bindings . article _data && article _data !== void 0 )
$$bindings . article _data ( article _data ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
{
{
if ( article _data !== null )
formData . set ( article _data || { } ) ;
}
}
2024-07-21 13:35:30 +00:00
$$rendered = ` ${ validate _component ( Root$2 , "Dialog.Root" ) . $$render ( $$result , { open : article _data !== null } , {}, {
2024-05-29 18:43:41 +00:00
default : ( ) => {
return ` ${ validate _component ( Dialog _content , "Dialog.Content" ) . $$render ( $$result , { class : "w-full sm:max-w-[750px]" } , {}, {
default : ( ) => {
return ` ${ validate _component ( Dialog _header , "Dialog.Header" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Dialog _title , "Dialog.Title" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` Edit Article ` ;
}
} ) } $ { validate _component ( Dialog _description , "Dialog.Description" ) . $$render ( $$result , { } , { } , { } ) } ` ;
}
} ) } < form id = "blog_editor" action = "?/edit" method = "post" > $ { validate _component ( Form _field , "Form.Field" ) . $$render ( $$result , { form , name : "blog_editor" } , { } , {
default : ( ) => {
return ` ${ validate _component ( Control , "Form.Control" ) . $$render ( $$result , { } , {}, {
default : ( { attrs } ) => {
return ` ${ validate _component ( Input$1 , "Input" ) . $$render (
$$result ,
{
name : "id" ,
id : "id" ,
value : article _data ? . id ,
class : "hidden" ,
readonly : true
} ,
{ } ,
{ }
) } < div > $ { validate _component ( Label , "Label" ) . $$render ( $$result , { for : "is_public_switch" } , { } , {
default : ( ) => {
return ` Public ` ;
}
} ) } $ { validate _component ( Switch , "Switch" ) . $$render (
$$result ,
{
name : "is_public" ,
checked : $formData . is _public
} ,
{
checked : ( $$value ) => {
$formData . is _public = $$value ;
$$settled = false ;
}
} ,
{ }
) } < / d i v > < d i v > $ { v a l i d a t e _ c o m p o n e n t ( I n p u t $ 1 , " I n p u t " ) . $ $ r e n d e r (
$$result ,
{
value : article _data ? . title ,
name : "title"
} ,
{ } ,
{ }
) } < / d i v > < d i v > $ { v a l i d a t e _ c o m p o n e n t ( T e x t a r e a , " T e x t a r e a " ) . $ $ r e n d e r (
$$result ,
{
name : "content" ,
value : article _data ? . content ,
class : "h-80"
} ,
{ } ,
{ }
) } < p class = "text-sm text-muted-foreground" data - svelte - h = "svelte-1cl6ia" > Manually edit your article with < a href = "https://www.markdownguide.org/basic-syntax" class = "font-bold underline" > Markdown < / a > < / p > < / d i v > ` ;
}
} ) } ` ;
}
} ) } < / f o r m > $ { v a l i d a t e _ c o m p o n e n t ( D i a l o g _ f o o t e r , " D i a l o g . F o o t e r " ) . $ $ r e n d e r ( $ $ r e s u l t , { } , { } , {
default : ( ) => {
return ` ${ validate _component ( Button , "Button" ) . $$render ( $$result , { type : "submit" , form : "blog_editor" } , {}, {
default : ( ) => {
return ` Submit ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } ` ;
} while ( ! $$settled ) ;
$$unsubscribe _page ( ) ;
$$unsubscribe _formData ( ) ;
return $$rendered ;
} ) ;
2024-06-21 23:07:29 +00:00
const ArticleQueue = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let queue ;
let open = false ;
onDestroy ( ( ) => {
} ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
2024-07-21 13:35:30 +00:00
$$rendered = ` ${ validate _component ( Root$2 , "Dialog.Root" ) . $$render (
2024-06-21 23:07:29 +00:00
$$result ,
{ open } ,
{
open : ( $$value ) => {
open = $$value ;
$$settled = false ;
}
} ,
{
default : ( ) => {
2024-07-21 13:35:30 +00:00
return ` ${ validate _component ( Trigger$1 , "Dialog.Trigger" ) . $$render (
2024-06-21 23:07:29 +00:00
$$result ,
{
class : buttonVariants ( { variant : "outline" } )
} ,
{ } ,
{
default : ( ) => {
return ` ${ validate _component ( Badge , "Badge" ) . $$render ( $$result , { class : "p-1.5 w-5 h-5 text-center mr-2" } , {}, {
default : ( ) => {
2024-07-21 13:35:30 +00:00
return ` ${ escape ( 0 ) } ` ;
2024-06-21 23:07:29 +00:00
}
} ) } Queue ` ;
}
}
) } $ { validate _component ( Dialog _content , "Dialog.Content" ) . $$render ( $$result , { class : "w-full sm:max-w-[750px]" } , { } , {
default : ( ) => {
return ` ${ validate _component ( Dialog _header , "Dialog.Header" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Dialog _title , "Dialog.Title" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` Queue ` ;
}
} ) } $ { validate _component ( Dialog _description , "Dialog.Description" ) . $$render ( $$result , { } , { } , { } ) } ` ;
}
2024-07-21 13:35:30 +00:00
} ) } $ { queue . find ( ( x ) => ! [ "done" , "error" ] . includes ( x . status ) ) === 0 ? ` <p class="pt-12 text-center text-gray-400" data-svelte-h="svelte-khfoxh">No articles are currently being generated!</p> ` : ` ${ validate _component ( Table , "Table.Root" ) . $$render ( $$result , { } , {}, {
2024-06-21 23:07:29 +00:00
default : ( ) => {
return ` ${ validate _component ( Table _header , "Table.Header" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Table _row , "Table.Row" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "w-[100px]" } , {}, {
default : ( ) => {
return ` Video ID ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "w-[200px]" } , { } , {
default : ( ) => {
return ` Title ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` Status ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } $ { validate _component ( Table _body , "Table.Body" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` ${ each ( queue , ( item , i ) => {
return ` ${ validate _component ( Table _row , "Table.Row" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "font-medium" } , {}, {
default : ( ) => {
2024-07-22 20:12:35 +00:00
return ` <p class="w-[100px] overflow-hidden text-ellipsis whitespace-nowrap text-nowrap font-medium"> ${ escape ( item . source _id ) } </p> ` ;
2024-06-21 23:07:29 +00:00
}
} ) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "w-[200px]" } , { } , {
default : ( ) => {
return ` <p class="w-[200px] overflow-hidden text-ellipsis whitespace-nowrap text-nowrap font-medium"> ${ escape ( item . title ) } </p> ` ;
}
} ) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` ${ escape ( item . status ) } ` ;
}
} ) } ` ;
}
} ) } ` ;
} ) } ` ;
}
} ) } ` ;
}
} ) } ` } ${ validate _component ( Dialog _footer , "Dialog.Footer" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Button , "Button" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` Close ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } ` ;
}
}
) } ` ;
} while ( ! $$settled ) ;
return $$rendered ;
} ) ;
2024-05-29 18:43:41 +00:00
const Pagination = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let currentPage ;
let $$restProps = compute _rest _props ( $$props , [ "class" , "count" , "perPage" , "page" , "siblingCount" ] ) ;
let { class : className = void 0 } = $$props ;
let { count = 0 } = $$props ;
let { perPage = 10 } = $$props ;
let { page : page2 = 1 } = $$props ;
let { siblingCount = 1 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . count === void 0 && $$bindings . count && count !== void 0 )
$$bindings . count ( count ) ;
if ( $$props . perPage === void 0 && $$bindings . perPage && perPage !== void 0 )
$$bindings . perPage ( perPage ) ;
if ( $$props . page === void 0 && $$bindings . page && page2 !== void 0 )
$$bindings . page ( page2 ) ;
if ( $$props . siblingCount === void 0 && $$bindings . siblingCount && siblingCount !== void 0 )
$$bindings . siblingCount ( siblingCount ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
currentPage = page2 ;
$$rendered = ` ${ validate _component ( Pagination$1 , "PaginationPrimitive.Root" ) . $$render (
$$result ,
Object . assign ( { } , { count } , { perPage } , { siblingCount } , { asChild : true } , $$restProps , { page : page2 } ) ,
{
page : ( $$value ) => {
page2 = $$value ;
$$settled = false ;
}
} ,
{
default : ( { builder , pages , range } ) => {
return ` <nav ${ spread (
[
escape _object ( builder ) ,
{
class : escape _attribute _value ( cn ( "mx-auto flex w-full flex-col items-center" , className ) )
}
] ,
{ }
) } > $ { slots . default ? slots . default ( { pages , range , currentPage } ) : ` ` } < / n a v > ` ;
}
}
) } ` ;
} while ( ! $$settled ) ;
return $$rendered ;
} ) ;
const Pagination _content = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` <ul ${ spread (
[
{
class : escape _attribute _value ( cn ( "flex flex-row items-center gap-1" , className ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { slots . default ? slots . default ( { } ) : ` ` } < / u l > ` ;
} ) ;
const Pagination _item = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` <li ${ spread (
[
{
class : escape _attribute _value ( cn ( "" , className ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { slots . default ? slots . default ( { } ) : ` ` } < / l i > ` ;
} ) ;
const Pagination _link = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" , "page" , "size" , "isActive" ] ) ;
let { class : className = void 0 } = $$props ;
let { page : page2 } = $$props ;
let { size = "icon" } = $$props ;
let { isActive = false } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
if ( $$props . page === void 0 && $$bindings . page && page2 !== void 0 )
$$bindings . page ( page2 ) ;
if ( $$props . size === void 0 && $$bindings . size && size !== void 0 )
$$bindings . size ( size ) ;
if ( $$props . isActive === void 0 && $$bindings . isActive && isActive !== void 0 )
$$bindings . isActive ( isActive ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
$$rendered = ` ${ validate _component ( Pagination _page , "PaginationPrimitive.Page" ) . $$render (
$$result ,
Object . assign (
{ } ,
{
class : cn (
buttonVariants ( {
variant : isActive ? "outline" : "ghost" ,
size
} ) ,
className
)
} ,
$$restProps ,
{ page : page2 }
) ,
{
page : ( $$value ) => {
page2 = $$value ;
$$settled = false ;
}
} ,
{
default : ( ) => {
return ` ${ slots . default ? slots . default ( { } ) : ` $ { escape ( page2 . value ) } ` } ` ;
}
}
) } ` ;
} while ( ! $$settled ) ;
return $$rendered ;
} ) ;
const Pagination _ellipsis = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let $$restProps = compute _rest _props ( $$props , [ "class" ] ) ;
let { class : className = void 0 } = $$props ;
if ( $$props . class === void 0 && $$bindings . class && className !== void 0 )
$$bindings . class ( className ) ;
return ` <span ${ spread (
[
{ "aria-hidden" : true } ,
{
class : escape _attribute _value ( cn ( "flex h-9 w-9 items-center justify-center" , className ) )
} ,
escape _object ( $$restProps )
] ,
{ }
) } > $ { validate _component ( Ellipsis$1 , "Ellipsis" ) . $$render ( $$result , { class : "h-4 w-4" } , { } , { } ) } < span class = "sr-only" data - svelte - h = "svelte-1krwd1q" > More pages < / s p a n > < / s p a n > ` ;
} ) ;
2024-07-21 13:35:30 +00:00
const articlesPerPage = 10 ;
2024-05-29 18:43:41 +00:00
const Page = create _ssr _component ( ( $$result , $$props , $$bindings , slots ) => {
let { data } = $$props ;
let editingContent = null ;
2024-07-21 13:35:30 +00:00
let currentPage ;
2024-05-29 18:43:41 +00:00
let isLoading = true ;
if ( $$props . data === void 0 && $$bindings . data && data !== void 0 )
$$bindings . data ( data ) ;
let $$settled ;
let $$rendered ;
let previous _head = $$result . head ;
do {
$$settled = true ;
$$result . head = previous _head ;
{
{
if ( data ) {
isLoading = false ;
}
}
}
$$rendered = ` <div class="mx-auto w-full max-w-[1000px] relative"> ${ validate _component ( CreateArticleDialog , "CreateArticleDialog" ) . $$render (
$$result ,
{
form : data . createForm ,
videos : data . videos ,
tier : data . me . subscription _tier
} ,
{ } ,
{ }
2024-06-21 23:07:29 +00:00
) } < div class = "float-right" > $ { validate _component ( ArticleQueue , "ArticleQueue" ) . $$render ( $$result , { } , { } , { } ) } < / d i v > $ { d a t a . a r t i c l e s . l e n g t h > 0 ? ` $ { i s L o a d i n g ? ` < d i v c l a s s = " w - f u l l h - f u l l b g - [ r g b ( 2 5 5 2 5 5 2 5 5 / 2 0 % ) ] b a c k d r o p - b l u r - s m a b s o l u t e z - 4 0 f l e x j u s t i f y - c e n t e r i t e m s - c e n t e r " > $ { v a l i d a t e _ c o m p o n e n t ( L o a d e r 2 , " L o a d e r 2 " ) . $ $ r e n d e r (
2024-05-29 18:43:41 +00:00
$$result ,
{
class : "w-12 h-12 z-50 text-white animate-spin"
} ,
{ } ,
{ }
) } < / d i v > ` : ` ` } $ { v a l i d a t e _ c o m p o n e n t ( T a b l e , " T a b l e . R o o t " ) . $ $ r e n d e r ( $ $ r e s u l t , { } , { } , {
default : ( ) => {
return ` ${ validate _component ( Table _header , "Table.Header" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Table _row , "Table.Row" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "w-[25px]" } , {}, {
default : ( ) => {
return ` Visibility ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "max-w-[300px]" } , { } , {
default : ( ) => {
return ` Title ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "text-end" } , { } , {
default : ( ) => {
return ` Source ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "text-end" } , { } , {
default : ( ) => {
return ` Views ` ;
}
} ) } $ { validate _component ( Table _head , "Table.Head" ) . $$render ( $$result , { class : "text-end" } , { } , {
default : ( ) => {
return ` Actions ` ;
}
} ) } ` ;
}
} ) } ` ;
}
} ) } $ { validate _component ( Table _body , "Table.Body" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` ${ each ( data . articles , ( article , i ) => {
2024-06-07 14:10:14 +00:00
return ` ${ validate _component ( Table _row , "Table.Row" ) . $$render ( $$result , { name : "article-row-" + article . id } , {}, {
2024-05-29 18:43:41 +00:00
default : ( ) => {
return ` ${ validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "font-medium" } , {}, {
default : ( ) => {
return ` ${ article . is _public ? ` ${ validate _component ( Eye$1 , "Eye" ) . $$render ( $$result , { class : "mx-auto h-5 w-5" } , {}, {})} ` : ` ${ validate _component ( EyeOff , "EyeOff" ) . $$render ( $$result , { class : "mx-auto h-5 w-5" } , {}, {})} ` } ` ;
}
} ) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render (
$$result ,
{
class : "max-w-[300px] overflow-hidden overflow-ellipsis text-nowrap"
} ,
{ } ,
{
default : ( ) => {
return ` ${ escape ( article . title ) } ` ;
}
}
) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "text-end" } , { } , {
default : ( ) => {
return ` ${ escape ( "Youtube" ) } ` ;
}
} ) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "text-end" } , { } , {
default : ( ) => {
return ` ${ escape ( article . views ) } ` ;
}
} ) } $ { validate _component ( Table _cell , "Table.Cell" ) . $$render ( $$result , { class : "w-fit text-end" } , { } , {
default : ( ) => {
return ` ${ validate _component ( Tooltipbutton , "TooltipButton" ) . $$render (
$$result ,
{
class : "hover:bg-blue-600" ,
variant : "outline" ,
size : "icon" ,
tip : "Preview"
} ,
{ } ,
{
default : ( ) => {
return ` ${ validate _component ( ExternalLink , "ExternalLink" ) . $$render ( $$result , { size : "1rem" } , {}, {})} ` ;
}
}
) } $ { validate _component ( Tooltipbutton , "TooltipButton" ) . $$render (
$$result ,
{
variant : "outline" ,
size : "icon" ,
tip : "Edit"
} ,
{ } ,
{
default : ( ) => {
return ` ${ validate _component ( Pen$1 , "Pen" ) . $$render ( $$result , { size : "1rem" } , {}, {})} ` ;
}
}
) } $ { validate _component ( Tooltipbutton , "TooltipButton" ) . $$render (
$$result ,
{
class : "hover:bg-red-600" ,
variant : "outline" ,
size : "icon" ,
tip : "Delete"
} ,
{ } ,
{
default : ( ) => {
return ` ${ validate _component ( Trash$1 , "Trash" ) . $$render ( $$result , { size : "1rem" } , {}, {})} ` ;
}
}
) } ` ;
}
} ) } ` ;
}
} ) } ` ;
} ) } ` ;
}
} ) } ` ;
}
} ) } $ { validate _component ( Pagination , "Pagination.Root" ) . $$render (
$$result ,
{
count : data . total _articles ,
2024-07-21 13:35:30 +00:00
perPage : articlesPerPage ,
2024-05-29 18:43:41 +00:00
currentPage
} ,
{ } ,
{
default : ( { pages } ) => {
return ` ${ validate _component ( Pagination _content , "Pagination.Content" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ each ( pages , ( page2 ) => {
return ` ${ page2 . type === "ellipsis" ? ` ${ validate _component ( Pagination _item , "Pagination.Item" ) . $$render ( $$result , { } , {}, {
default : ( ) => {
return ` ${ validate _component ( Pagination _ellipsis , "Pagination.Ellipsis" ) . $$render ( $$result , { } , {}, {})} ` ;
}
} ) } ` : ` $ { validate _component ( Pagination _item , "Pagination.Item" ) . $$render ( $$result , { } , { } , {
default : ( ) => {
return ` ${ validate _component ( Pagination _link , "Pagination.Link" ) . $$render (
$$result ,
{
page : page2 ,
isActive : currentPage === page2 . value
} ,
{ } ,
{
default : ( ) => {
return ` ${ escape ( page2 . value ) } ` ;
}
}
) } ` ;
}
} ) } ` } ` ;
} ) } ` ;
}
} ) } ` ;
}
}
) } ` : ` < p class = "pt-12 text-center text-gray-400" data - svelte - h = "svelte-8zzzra" > You don & # 39 ; t have any articles yet . Start by making one ! < / p > ` } < / d i v > $ { v a l i d a t e _ c o m p o n e n t ( E d i t A r t i c l e D i a l o g , " E d i t A r t i c l e D i a l o g " ) . $ $ r e n d e r (
$$result ,
{
form : data . editForm ,
article _data : editingContent
} ,
{
article _data : ( $$value ) => {
editingContent = $$value ;
$$settled = false ;
}
} ,
{ }
) } ` ;
} while ( ! $$settled ) ;
return $$rendered ;
} ) ;
export { Page as default } ;
2024-07-22 20:12:35 +00:00
//# sourceMappingURL=_page.svelte-CsX7178s.js.map