[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\nindent_size = 4\nindent_style = space\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n\n[*.{yml,yaml}]\nindent_size = 2\n"
  },
  {
    "path": ".gitattributes",
    "content": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and documentation with \"export-ignore\".\n/.github            export-ignore\n/.gitattributes     export-ignore\n/.gitignore         export-ignore\n/.gitmodules        export-ignore\n/phpunit.xml.dist   export-ignore\n/art                export-ignore\n/docs               export-ignore\n/demo               export-ignore\n/tests              export-ignore\n/workbench          export-ignore\n/.editorconfig      export-ignore\n/.php_cs.dist.php   export-ignore\n/psalm.xml          export-ignore\n/psalm.xml.dist     export-ignore\n/testbench.yaml     export-ignore\n/UPGRADING.md       export-ignore\n/phpstan.neon.dist  export-ignore\n/phpstan-baseline.neon  export-ignore\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "# Contributing\n\nContributions are **welcome** and will be fully **credited**.\n\nPlease read and understand the contribution guide before creating an issue or pull request.\n\n## Etiquette\n\nThis project is open source, and as such, the maintainers give their free time to build and maintain the source code\nheld within. They make the code freely available in the hope that it will be of use to other developers. It would be\nextremely unfair for them to suffer abuse or anger for their hard work.\n\nPlease be considerate towards maintainers when raising issues or presenting pull requests. Let's show the\nworld that developers are civilized and selfless people.\n\nIt's the duty of the maintainer to ensure that all submissions to the project are of sufficient\nquality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.\n\n## Viability\n\nWhen requesting or submitting new features, first consider whether it might be useful to others. Open\nsource projects are used by many developers, who may have entirely different needs to your own. Think about\nwhether or not your feature is likely to be used by other users of the project.\n\n## Procedure\n\nBefore filing an issue:\n\n- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.\n- Check to make sure your feature suggestion isn't already present within the project.\n- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.\n- Check the pull requests tab to ensure that the feature isn't already in progress.\n\nBefore submitting a pull request:\n\n- Check the codebase to ensure that your feature doesn't already exist.\n- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.\n\n## Requirements\n\nIf the project maintainer has any additional requirements, you will find them listed here.\n\n- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).\n\n- **Add tests!** - Your patch won't be accepted if it doesn't have tests.\n\n- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.\n\n- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.\n\n- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.\n\n- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.\n\n**Happy coding**!\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: GuavaCZ\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.yml",
    "content": "name: Bug Report\ndescription: Report an Issue or Bug with the Package\ntitle: \"[Bug]: \"\nlabels: [\"bug\"]\nbody:\n    - type: markdown\n      attributes:\n          value: |\n              We're sorry to hear you have a problem. Can you help us solve it by providing the following details.\n    - type: textarea\n      id: what-happened\n      attributes:\n          label: What happened?\n          description: What did you expect to happen?\n          placeholder: I cannot currently do X thing because when I do, it breaks X thing.\n      validations:\n          required: true\n    - type: textarea\n      id: how-to-reproduce\n      attributes:\n          label: How to reproduce the bug\n          description: How did this occur, please add any config values used and provide a set of reliable steps if possible.\n          placeholder: When I do X I see Y.\n      validations:\n          required: true\n    - type: input\n      id: package-version\n      attributes:\n          label: Package Version\n          description: What version of our Package are you running? Please be as specific as possible\n          placeholder: 2.0.0\n      validations:\n          required: true\n    - type: input\n      id: php-version\n      attributes:\n          label: PHP Version\n          description: What version of PHP are you running? Please be as specific as possible\n          placeholder: 8.2.0\n      validations:\n          required: true\n    - type: input\n      id: laravel-version\n      attributes:\n        label: Laravel Version\n        description: What version of Laravel are you running? Please be as specific as possible\n        placeholder: 9.0.0\n      validations:\n        required: true\n    - type: dropdown\n      id: operating-systems\n      attributes:\n        label: Which operating systems does with happen with?\n        description: You may select more than one.\n        multiple: true\n        options:\n        - macOS\n        - Windows\n        - Linux\n    - type: textarea\n      id: notes\n      attributes:\n          label: Notes\n          description: Use this field to provide any other notes that you feel might be relevant to the issue.\n      validations:\n          required: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: Ask a question\n    url: https://github.com/GuavaCZ/calendar/discussions/new?category=q-a\n    about: Ask the community for help\n  - name: Request a feature\n    url: https://github.com/GuavaCZ/calendar/discussions/new?category=ideas\n    about: Share ideas for new features\n  - name: Report a security issue\n    url: https://github.com/GuavaCZ/calendar/security/policy\n    about: Learn how to notify us for sensitive bugs\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.yml",
    "content": "name: Feature Request\ndescription: Create a feature request\ntitle: \"[Request]: \"\nbody:\n    - type: textarea\n      id: feature-request\n      attributes:\n          label: What feature would you like to add?\n          description: Please describe the new feature as thoroughly as possible.\n      validations:\n          required: true\n\n    - type: textarea\n      id: notes\n      attributes:\n          label: Notes\n          description: Use this field to provide any other notes that you feel might be relevant to the issue.\n      validations:\n          required: false\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "# Security Policy\n\nIf you discover any security related issues, please email office@guava.cz instead of using the issue tracker.\n"
  },
  {
    "path": ".github/workflows/phpstan.yml",
    "content": "name: PHPStan\n\non:\n  push:\n    paths:\n      - '**.php'\n      - 'phpstan.neon.dist'\n\njobs:\n  phpstan:\n    name: phpstan\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup PHP\n        uses: shivammathur/setup-php@v2\n        with:\n          php-version: '8.1'\n          coverage: none\n\n      - name: Install composer dependencies\n        uses: ramsey/composer-install@v3\n\n      - name: Run PHPStan\n        run: ./vendor/bin/phpstan --error-format=github\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  push:\n    branches:\n      - master\n      - main\n      - beta\n      - alpha\n      - ?.[xX]\n      - ?.?.[xX]\n\npermissions:\n  contents: write # to be able to publish a GitHub release\n  issues: write # to be able to comment on released issues\n  pull-requests: write # to be able to comment on released pull requests\n  id-token: write # to enable use of OIDC for npm provenance\n\njobs:\n  release:\n    name: Release\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write # to be able to publish a GitHub release\n      issues: write # to be able to comment on released issues\n      pull-requests: write # to be able to comment on released pull requests\n      id-token: write # to enable use of OIDC for npm provenance\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Fix PHP code style issues\n        uses: aglipanci/laravel-pint-action@2.5\n\n      - name: Commit changes\n        uses: stefanzweifel/git-auto-commit-action@v5\n        with:\n          commit_message: \"style: fix code styling\"\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v4\n        with:\n          node-version: \"lts/*\"\n\n      - name: Install dependencies\n        run: npm clean-install\n\n      - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies\n        run: npm audit signatures\n\n      - name: Release\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n        run: npx semantic-release\n"
  },
  {
    "path": ".github/workflows/run-tests.yml",
    "content": "name: run-tests\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  test:\n    runs-on: ${{ matrix.os }}\n\n    strategy:\n      fail-fast: true\n      matrix:\n        os: [ubuntu-latest, windows-latest]\n        php: ['8.1', '8.2', '8.3', '8.4', '8.5']\n        laravel: ['10.*', '13.*']\n        stability: [prefer-lowest, prefer-stable]\n        include:\n          - laravel: 10.*\n            testbench: 8.*\n            carbon: ^2.63\n        exclude:\n          - laravel: 13.*\n            php: '8.1'\n          - laravel: 13.*\n            php: '8.2'\n\n    name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Setup PHP\n        uses: shivammathur/setup-php@v2\n        with:\n          php-version: ${{ matrix.php }}\n          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo\n          coverage: none\n\n      - name: Setup problem matchers\n        run: |\n          echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"\n          echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"\n\n      - name: Install dependencies\n        run: |\n          composer require \"laravel/framework:${{ matrix.laravel }}\" \"orchestra/testbench:${{ matrix.testbench }}\" \"nesbot/carbon:${{ matrix.carbon }}\" --no-interaction --no-update\n          composer update --${{ matrix.stability }} --prefer-dist --no-interaction\n\n      - name: List Installed Dependencies\n        run: composer show -D\n\n      - name: Execute tests\n        run: vendor/bin/pest --ci\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea\n.phpunit.cache\nbuild\ncomposer.lock\ncoverage\nphpunit.xml\nphpstan.neon\ntestbench.yaml\nvendor\nnode_modules\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"demo\"]\n\tpath = demo\n\turl = https://github.com/GuavaCZ/calendar-demo\n\tbranch = main\n"
  },
  {
    "path": ".releaserc.json",
    "content": "{\n    \"plugins\": [\n        [\n            \"@semantic-release/commit-analyzer\",\n            {\n                \"preset\": \"conventionalcommits\",\n                \"releaseRules\": [\n                    {\n                        \"scope\": \"no-release\",\n                        \"release\": false\n                    }\n                ]\n            }\n        ],\n        [\n            \"@semantic-release/release-notes-generator\",\n            {\n                \"preset\": \"conventionalcommits\",\n                \"presetConfig\": {\n                    \"types\": [\n                        {\n                            \"type\": \"feat\",\n                            \"section\": \"Features\"\n                        },\n                        {\n                            \"type\": \"fix\",\n                            \"section\": \"Bug Fixes\"\n                        },\n                        {\n                            \"type\": \"refactor\",\n                            \"section\": \"Refactor\"\n                        },\n                        {\n                            \"type\": \"docs\",\n                            \"section\": \"Documentation\"\n                        },\n                        {\n                            \"type\": \"chore\",\n                            \"section\": \"Chore\"\n                        },\n                        {\n                            \"type\": \"style\",\n                            \"section\": \"Style\"\n                        },\n                        {\n                            \"type\": \"perf\",\n                            \"section\": \"Performance\"\n                        },\n                        {\n                            \"type\": \"test\",\n                            \"section\": \"Tests\"\n                        }\n                    ]\n                }\n            }\n        ],\n        \"@semantic-release/github\"\n    ],\n    \"branches\": [\n        \"+([0-9])?(.{+([0-9]),x}).x\",\n        \"main\",\n        \"master\",\n        {\n            \"name\": \"beta\",\n            \"prerelease\": true\n        },\n        {\n            \"name\": \"alpha\",\n            \"prerelease\": true\n        }\n    ],\n    \"tagFormat\": \"${version}\"\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to `calendar` will be documented in this file.\n"
  },
  {
    "path": "LICENSE.md",
    "content": "The MIT License (MIT)\n\nCopyright (c) Guava <lukas.frey@guava.cz>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "![calendar Banner](https://github.com/GuavaCZ/calendar/raw/main/docs/images/banner.jpg)\n\n\n# Adds support for vkurko/calendar to Filament PHP.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/guava/calendar.svg?style=flat-square)](https://packagist.org/packages/guava/calendar)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/guava/calendar/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/GuavaCZ/calendar/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/guava/calendar/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/GuavaCZ/calendar/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/guava/calendar.svg?style=flat-square)](https://packagist.org/packages/guava/calendar)\n\nThis package adds support for [vkurko/calendar](https://github.com/vkurko/calendar) (free, open-source alternative to FullCalendar) to your FilamentPHP panels.\n\nIt allows you to create a widget with a calendar with support for **multiple** models and even resources you can group your events into. For example, you could have lessons (events) that are held in different rooms (resources).\n\n## Version compatibility\n| Filament version | Plugin version |\n| ---------------- |:--------------:| \n| 3.x              | 1.x            |\n| 4.x              | 2.x            |\n| 5.x              | 3.x            |\n\n## Showcase\n![Showcase 01](https://github.com/GuavaCZ/calendar/raw/main/docs/images/showcase_01.png)\n![Showcase 02](https://github.com/GuavaCZ/calendar/raw/main/docs/images/showcase_02.png)\n\n\n\nhttps://github.com/user-attachments/assets/fc7828ab-ccd2-4252-942a-9679af1e7687\n\n<video width=\"320\" height=\"240\" controls>\n  <source src=\"https://github.com/user-attachments/assets/fc7828ab-ccd2-4252-942a-9679af1e7687\" type=\"video/mp4\">\n</video>\n\n\n<video width=\"320\" height=\"240\" controls>\n  <source src=\"https://github.com/GuavaCZ/calendar/raw/main/docs/images/demo_preview.mp4\" type=\"video/mp4\">\n</video>\n\nhttps://github.com/user-attachments/assets/a4460084-e8a8-4b1b-9ccd-4d887895155b\n\n\n![Resources Screenshot 01](https://github.com/GuavaCZ/calendar/raw/main/docs/images/resources_screenshot_01.png)\n\n<video width=\"320\" height=\"240\" controls>\n  <source src=\"https://github.com/GuavaCZ/calendar/raw/main/docs/images/context_menu_preview.mp4\" type=\"video/mp4\">\n</video>\n\nhttps://github.com/user-attachments/assets/a2641b40-9cbd-4c40-b360-7621caa86c40\n\n<video width=\"320\" height=\"240\" controls>\n  <source src=\"https://github.com/GuavaCZ/calendar/raw/main/docs/images/context_menu_preview_2.mp4\" type=\"video/mp4\">\n</video>\n\n\nhttps://github.com/user-attachments/assets/4996cc6a-7cee-4c7d-976a-60d3a4368f76\n\n\n<video width=\"320\" height=\"240\" controls>\n  <source src=\"https://github.com/GuavaCZ/calendar/raw/main/docs/images/no_events_context_menu.mp4\" type=\"video/mp4\">\n</video>\n\nhttps://github.com/user-attachments/assets/7c2537d5-8acf-459f-a9a8-be02d4018448\n\n\n## Support us\n\nYour support is key to the continual advancement of our plugin. We appreciate every user who has contributed to our journey so far.\n\nWhile our plugin is available for all to use, if you are utilizing it for commercial purposes and believe it adds significant value to your business, we kindly ask you to consider supporting us through GitHub Sponsors. This sponsorship will assist us in continuous development and maintenance to keep our plugin robust and up-to-date. Any amount you contribute will greatly help towards reaching our goals. Join us in making this plugin even better and driving further innovation.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require guava/calendar\n```\n\nMake sure to publish the package assets using:\n\n```bash\nphp artisan filament:assets\n```\n\nFinally, make sure you have a **custom filament theme** (read [here](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) how to create one) and add the following to your **theme.css** file:\n\nThis ensures that the CSS is properly built:\n```css\n@source '../../../../vendor/guava/calendar/resources/**/*';\n```\n\nThis is optional but highly recommended as it will apply styles to better fit with the (default) filament theme:\n```css\n@import '../../../../vendor/guava/calendar/resources/css/theme.css';\n```\n\nThe paths might be a little bit different if your theme.css is located in a non-standard path. Adjust accordingly.\n\n## Usage\n\n# Creating the calendar Widget\nFirst you need to create a custom widget and extend the `CalendarWidget` class. Make sure to remove the `view` property from the generated widget class!\n\nEither use the artisan command or simply create an empty class and extend `CalendarWidget`:\n```bash\nphp artisan make:filament-widget\n```\n\nThe widget class should look like this:\n```php\nuse \\Guava\\Calendar\\Filament\\CalendarWidget;\n\nclass MyCalendarWidget extends CalendarWidget\n{\n}\n```\n\nAdd the widget like a regular widget to any filament page you like, such as your `Dashboard`.\n\nCongrats! You now have a working calendar in filament!\n\n## Customizing the calendar view\nBy default, we show the `DayGridMonth` view. You can customize the view by overriding the `calendarView` property on the widget class:\n\n```php\nuse Guava\\Calendar\\Enums\\CalendarViewType;\n\nprotected CalendarViewType $calendarView = CalendarViewType::ResourceTimeGridWeek;\n```\n\nThe `CalendarViewType` enum contains all available views that you can use.\n\n## Adding events\nYou have probably noticed that your calendar is still empty.\n\nTo add events, override the `getEvents` method, described in more detail below.\n\n```php\nprotected function getEvents(FetchInfo $info): Collection | array | Builder {}\n```\n\nFetchInfo is a ValueObject we provide which type hints all parameters that are made available to you. This helps you scope the query to only retrieve models which are visible in the view.\n\nTo learn more about FetchInfo and other Value Objects, please refer to the Value Object documentation.\n\nThere are two distinct ways on how to provide Events to the calendar. Which way you use depends on your personal preference and the source of your events.\n\n### 1. From Eloquent\n> [!IMPORTANT]\n> Make sure that the Model class implements `Eventable`. Without it we are not able to map your model into a calendar event.\n> \n> For more information, please refer to the [Calendar Events section](#calendar-events).\n\nIn the majority of cases, you will most likely want to display your eloquent models as events inside the calendar.\n\nThe easiest way to do that is to just return your Eloquent Query, and we will handle the rest.\n\n```php\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\nuse Guava\\Calendar\\ValueObjects\\FetchInfo;\n\nprotected function getEvents(FetchInfo $info): Collection | array | Builder\n{\n    // The simplest way:\n    return Foo::query();\n    \n    // You probably want to query only visible events:\n    return Foo::query()\n        ->whereDate('ends_at', '>=', $info->start)\n        ->whereDate('starts_at', '<=', $info->end);\n        \n   // If you need to display multiple types of models,\n   // you will need to combine the results of each\n   // query builder manually:\n   return collect()\n       ->push(...Foo::query()->get())\n       ->push(...Bar::query()->get())\n   ;   \n}\n```\n\n### 2. From Array/Collection\n\nSometimes, however, you might want to display events from an API or an array.\n\nTo do that, you can return an array or collection of `CalendarEvent` objects directly.\n\n```php\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\nuse Guava\\Calendar\\ValueObjects\\FetchInfo;\n\nprotected function getEvents(FetchInfo $info): Collection | array | Builder\n{\n    return [\n        CalendarEvent::make()\n            ->title('My first calendar')\n            ->start(now())\n            ->end(now()->addHours(2)),\n    ];\n}\n```\n\n## Calendar events\nAs seen above, the calendar expects `CalendarEvent` objects, which are configurable ValueObjects that help you build the required calendar object.\n\nFor this purpose, we have an `Eventable` interface which you can add to **any class** that you want to be able to display as an event in your calendars.\n\nIn most cases, you will add this interface to your **eloquent models**, but you are not limited to it. Feel free to add it to any class you want.\n\nHere is an example:\n\n```php\nuse Guava\\Calendar\\Contracts\\Eventable;\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\n\nclass Foo extends Model implements Eventable\n{\n    // ...\n    \n    // This is where you map your model into a calendar object\n    public function toCalendarEvent(): CalendarEvent\n    {\n        // For eloquent models, make sure to pass the model to the constructor\n        return CalendarEvent::make($this)\n            ->title($this->name)\n            ->start($this->starts_at)\n            ->end($this->ends_at);\n    }\n}\n```\n\nNotice that the model instance is passed to the `Event` constructor in the `make` method. This sets the `key` and `model` properties to the calendar object, so it can be used to trigger actions.\n\nThis is a crucial step, if you forget to add this, we will not be able to identify the model when the event is interacted with (for example, when clicked).\n\n### Configuration\nThe `CalendarEvent` takes all available options like the underlying calendar package, for more info [read here](https://github.com/vkurko/calendar?tab=readme-ov-file#event-object).\n\nBelow is a list of available methods on the calendar object:\n\n#### Setting the title\nSets the title of the event that is rendered in the calendar.\n```php\nCalendarEvent::make()->title('My event');\n```\n\nTo output Html in the title pass in a `HtmlString` or other class that implements `Htmlable` :\n\n```php\nCalendarEvent::make()\n->title(new HtmlString('<b>My Event</b>'));\n```\n\n\n#### Customizing the start/end date\nSets the start or end date (and time) of the calendar in the calendar.\n```php\nCalendarEvent::make()\n    ->start(today())\n    ->end(today()->addDays(3));\n```\n\n#### Making the calendar all-day\nSets whether the calendar is an all-day calendar or not.\n```php\nCalendarEvent::make()->allDay();\n```\n\n#### Customizing the background / text color\nSets the background color of the calendar (by default, it is the primary color of your filament panel).\n```php\nCalendarEvent::make()\n->backgroundColor('#ff0000')\n->textColor('#ffffff');\n```\n\n#### Customizing Event Styles\n\nYou can add custom styles to your calendar elements by using the styles method. This method accepts an array where each entry can be a CSS style declaration. The styles will be directly applied to the calendar element in the view. You can define styles in three ways:\n\n- As a key-value pair where the key is the CSS property and value is the condition under which the style should apply.\n- As a key-value pair where the key is the CSS property and the value is directly the CSS value.\n- As a single string for static styles that always apply.\n\nHere's how you can use it:\n\n```php\nCalendarEvent::make()->styles([\n    'color: red' => true,            // Applies the style if the condition (true) is met\n    'background-color' => '#ffff00', // Directly applies the background color\n    'font-size: 12px'                // Always applies this font size\n]);\n```\n\n##### Usage Notes:\n\n- The first format ('color: red' => true) is useful for conditional styling based on dynamic conditions. For instance, changing the text color based on an calendar's type or status.\n\n- The second format ('background-color' => '#ffff00') is straightforward for applying styles where the values do not depend on conditions.\n- The third format ('font-size: 12px') is used when the style does not require any condition and is always applied to the calendar.\nThis flexibility allows you to easily customize the appearance of events based on dynamic conditions or predefined settings.\n\n#### Customizing Event Classes\n\nFollowing the same pattern as with the styles property, it is possible to inject custom classes into the Event element using the `classNames` or `classes` property.\n\nHere's how you can use it:\n\n```php\nCalendarEvent::make()->classNames([\n    'class-1',            \n    'class-2' => true  // Applies the class if the condition (true) is met\n]);\n```\n\n##### Usage Notes:\n\n- The second format ('class-2' => true) is useful for conditional classes based on dynamic conditions.\n\n#### Customizing the display\nBy default, events are rendered as `blocks`. This is when the display is set to `auto`, which it is by default. You can also change the calendar to be rendered as a background calendar, which then fills the whole date cell. To do so, you can set `display` to `background` on the calendar:\n\nThis doesn't always work though, it only works on all day events and in specific views. If the `background` calendar is unsupported, the calendar will not be rendered at all.\n\n```php\nCalendarEvent::make()\n->display('background') // or 'auto'\n->displayAuto() // short-hand for ->display('auto')\n->displayBackground(); // short-hand for ->display('background')\n```\n\n#### Setting the action on click\nThis sets the action that should be mounted when the calendar is clicked. It can be any name of a filament action you defined in your widget, such as `edit` or `view`.\n\nBy default, all `CalendarWidget` classes already include a `view` and `edit` action.\n\n```php\nCalendarEvent::make()->action('edit');\n```\n\n#### Set the model and record key\nTo mount the action with the correct record, we need to pass the model type and primary key of the record.\n\nThe model is also required if you want to display multiple types of events and have each be rendered differently (see customizing calendar content).\n\n```php\n$record = MyModel::find(1);\n// 1. variant\nCalendarEvent::make($record);\n\n// 2. variant\nCalendarEvent::make()\n    ->model($record::class)\n    ->key($record->getKey());\n```\n\n#### Linking to resources\nIf you use resources in your calendar, you need to tell your events which resource(s) they belong to.\n\nTo do this, pass an array of resource IDs to the event:\n```php\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\nCalendarEvent::make()\n    ->resourceId('foo') // Pass a single resource ID, you can repeat this call multiple times\n    ->resourceIds(['bar', 'baz']); // Pass multiple resource IDs at once\n```\n\n#### Passing custom data\nYou can pass any custom data to the event that you wish:\n```php\nCalendarEvent::make()\n->extendedProp('foo', 'bar')\n// or\n->extendedProps(['baz' => 'qux', 'quux' => 'corge']);\n```\n\n## Adding Resources\nIf you configure your calendar to use a `resource` view, you will need to also define which resources to display in the calendar.\n\nSimilarly to events, There are two distinct ways on how to provide Resources to the calendar.\n\n### 1. From Eloquent\n\n> [!IMPORTANT]\n> Make sure that the Model class implements `Resourceable`. Without it, we are not able to map your model into a calendar resource.\n>\n> For more information, please refer to the [Calendar Resources section](#calendar-resources).\n\nIn the majority of cases, you will most likely want to display your eloquent models as resources inside the calendar.\n\nThe easiest way to do that is to just return your Eloquent Query, and we will handle the rest.\n\n```php\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\n\npublic function getResources(): Collection | array| Builder\n{\n    return [\n        Bar::query()\n    ];\n}\n```\n\n### 2. From Array/Collection\n\nSometimes, however, you might want to display resources from an API or an array.\n\nTo do that, you can return an array or collection of `CalendarResource` objects directly.\n\n```php\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\nuse Guava\\Calendar\\ValueObjects\\CalendarResource;\nuse Guava\\Calendar\\ValueObjects\\FetchInfo;\n\nprotected function getResources(): Collection | array | Builder\n{\n    return [\n        CalendarResource::make('baz') // This has to be unique ID\n            ->title('My resource'),\n    ];\n}\n```\n\n### Link events to resources\nNow we successfully display resources in the calendar, but we still need to add the events to their corresponding resource.\n\nTo do this, update your `CalendarEvent` objects (either directly in the `getEvents` method or in your classes implementing `Eventable`, depending on which approach you chose) and include the resource IDs it belongs to.\n\nPlease refer to the [Calendar Event: linking to resources section](#linking-to-resources) to learn how to do it.\n\n## Calendar Resources\n\nAs seen above, the calendar expects `CalendarResource` objects, which are configurable ValueObjects that help you build the required calendar object.\n\nFor this purpose, we have a `Resourceable` interface which you can add to **any class** that you want to be able to display as a resource in your calendars.\n\nIn most cases, you will add this interface to your **eloquent models**, but you are not limited to it. Feel free to add it to any class you want.\n\nHere is an example:\n\n```php\nuse Guava\\Calendar\\Contracts\\Resourceable;\nuse Guava\\Calendar\\ValueObjects\\CalendarResource;\n\nclass Bar extends Model implements Resourceable\n{\n    // ...\n    \n    // This is where you map your model into a calendar resource object\n    public function toCalendarResource(): CalendarResource\n    {\n        return CalendarResource::make('my-unique-id')\n            ->title($this->name);\n    }\n}\n```\n\n### Configuration\nThe `CalendarResource` takes all available options like the underlying calendar package, for more info [read here](https://github.com/vkurko/calendar?tab=readme-ov-file#resource-object).\n\nBelow is a list of available methods on the calendar object:\n\n#### Setting the title\nSets the title of the resource that is rendered in the calendar.\n```php\nCalendarResource::make()->title('My resource');\n```\n\n#### Setting the event background color\nSets the default background color of the resource's events\n```php\nCalendarResource::make()->eventBackgroundColor('#FF0000');\n```\n\n#### Setting the event text color\nSets the default text color of the resource's events\n```php\nCalendarResource::make()->eventTextColor('#FFFFFF');\n```\n\n#### Passing custom data\nYou can pass any custom data to the resource that you wish:\n```php\nCalendarResource::make()\n    ->extendedProp('foo', 'bar')\n    // or\n    ->extendedProps(['baz' => 'qux', 'quux' => 'corge']);\n```\n\n## Available Methods\nThe calendar widget class itself contains a few useful methods.\n\n### Refresh events\nIf you need to trigger a refresh of the events in the calendar, you can call `refreshRecords()` on the widget.\n\n```php\n$this->refreshRecords();\n```\n\n### Refresh resources\nIf you need to trigger a refresh of the resources in the calendar, you can call `refreshResources()` on the widget.\n\n```php\n$this->refreshResources();\n```\n\n### Set Option\nTo change any calendar option during runtime, you can use the `setOption()` method on the widget.\n\nFor example, to programmatically change the date, you can use:\n```php\n$this->setOption('date', today()->addDay()->toIso8601String());\n```\n\n## Customization\nNow that we know how to create a working calendar widget, we can learn how to customize the calendar to our liking.\n\nThe calendar widget contains a bunch of properties and methods that you can override in order to customize the widget.\n\nIn this section we will go through each of these options.\n\n### Calendar view\nThe calendar comes with a variety of views. You can the calendar view per widget by overriding the `calendarView` property:\n\n```php\nuse Guava\\Calendar\\Enums\\CalendarViewType;\n\nprotected CalendarViewType $calendarView = CalendarViewType::ListWeek;\n```\n\nCheck the `CalendarViewType` enum for a list of available views.\n\n### Locale\nBy default, the calendar will use your app's locale.\n\nThe underlying calendar package doesn't support locales as a combination of language and region/country code, so locales such as `fr_CA` or `en_US` become invalid.\n\nWe attempt to resolve this by only using the first language part of the locale. If you still run into any issues with the localization, you can override the calendar's locale manually using the `locale` property:\n\n```php\nprotected ?string $locale = 'en';\n```\n\n### First Day\nBy default, the calendar will use `Monday` as the first day.\n\nYou can customize this by overriding the `firstDay` property:\n```php\nuse Carbon\\WeekDay;\n\nprotected WeekDay $firstDay = WeekDay::Sunday;\n```\n\n### Day Max Events\nDetermines the maximum number of stacked event levels for a given day in the dayGrid view.\n\nIf there are too many events, a link like +2 more is displayed.\n\nCurrently, only a boolean value is supported. When set to true, it limits the number of events to the height of the day cell. When set to false (default) there is no limit.\n     \n```php\nprotected bool $dayMaxEvents = true;\n```\n\n### Use Filament Timezone\n\n> [!CAUTION]\n> While we still recommend setting this property to true, it **does** come with some potential side effects that you need to keep in mind. Keep reading to learn more.\n\nThe underlying Event Calendar does **not support** working with timezones. Thus, everything the user sees in their calendar is rendered in their **local browser time**.\n\nThis can cause confusion when adding interactivity to your calendar (such as editing events or creating events using filament modals), because filament will display the time **not** in the user's local browser time, but in the **app's timezone** (as configured in config/app.php).\n\nHowever, as of Filament v4, a `FilamentTimezone` can be configured which will make Filament automatically convert between the Apps timezone setting and your filament timezone.  This allows you to store users preferred timezone and convert it back and forth when displaying it to the user, for example via a DatePicker.\n\nTo learn more about the `FilamentTimezone` setting, please refer to the [Filament documentation](https://filamentphp.com/docs/4.x/forms/date-time-picker#timezones). \n\nIf you want your calendar to use the same timezone as configured via `FilamentTimezone`, you can use the `useFilamentTimezone` property to do so:\n\n```php\nprotected bool $useFilamentTimezone = true;\n```\n\nTo achieve this, we intercept dates sent from / to the calendar and override the timezone with the filament's timezone.\n\nHowever, please keep in mind that this currently comes with a few side effects, as we are not able to override all dates / times used internally by the calendar.\n\nFor example, if you enable the `now indicator`, it will still use the user's local browser time. We are trying to find a solution to fix this.\n\n### Heading\nBy default, the Heading displays the content of the `translations.heading` key (by default, it just says `Calendar`).\n\nYou can customize the heading of your calendar widget by overriding the `$heading` property or `getHeading` method:\n\n```php\n// Setting to null will disable the heading completely\nprotected string | HtmlString | bool | null $heading = null;\n\n// Or to render HTML, you can override the method directly and return a HtmlString\npublic function getHeading(): string|HtmlString\n{\n    return  new HtmlString('<div>some html</div>');\n}\n```\n\n## Interactivity\n\nBy now you should have a perfectly fine and working calendar. However, it is still very static - you can view your events, but there is no way to interact with them.\n\nThe calendar supports many ways to interact with, which will be described below individually.\n\n### Actions\n> [!CAUTION]\n> Actions have no default authorization. This means, anyone can use any action.\n> \n> Please check the [Authorization section](#authorization) to learn how to authorize actions.\n\nBefore you read about the different ways to add interactions to your calendar, you need to understand how actions in the calendar work.\n\nActions used within the Calendar context need the `CalendarAction` trait to work properly.\n\nWe provide a few drop-in replacements of the regular Filament actions that already implement everything necessary:\n\n- CreateAction\n- ViewAction\n- EditAction\n- DeleteAction\n\nWhenever you want to use one of these actions, **make sure** you use the actions from our package. All they do is extend the regular filament action and add a few important setUp calls.\n\nSo, instead of using `Filament\\Actions\\CreateAction` you would use `Guava\\Calendar\\Filament\\Actions\\CreateAction`.\n\n#### Defining actions\nEvery action you use in the calendar should be defined as a public method in the widget class, just as usual when adding an [Action to a Livewire component](https://filamentphp.com/docs/4.x/components/action#adding-the-action) in filament.\n\n`View`, `Edit` and `Delete` actions are already present for you. You do not need to add them anymore.\n\nFor create actions, you still need to create them, since for each model a different create action needs to be added. There is a helper method available for you to help with this.\n\nFor example, to add a `createFooAction` (where `Foo` is a model in your app), you would add this method:\n\n```php\nuse Guava\\Calendar\\Filament\\Actions\\CreateAction;\n\npublic function createFooAction(): CreateAction\n{\n    // You can use our helper method\n    return $this->createAction(Foo::class);\n    \n    // Or you can add it manually, both variants are equivalent:\n    return CreateAction::make('createFoo')\n        ->model(Foo::class);\n}\n```\n\nBoth variants are equal, and it's just up to your personal preference which one you want to use.\n\n#### Mounting actions\nwhenever you want to mount an action programmatically within a calendar context, such as in the `onDateClick` method (more on this later), you can use the `mountAction` method. \n\n```php\nprotected function onDateClick(DateClickInfo $info): void {\n    $this->mountAction('createFoo');\n}\n```\n\nIn the background, we pass a few more arguments to the mount method.\nThanks to that, you can type hint the contextual info in your actions:\n\n```php\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\ValueObjects\\DateClickInfo;\nuse Guava\\Calendar\\ValueObjects\\DateSelectInfo;\n\npublic function createFooAction(): CreateAction\n{\n    return $this->createAction(Foo::class)\n        ->mountUsing(function (?ContextualInfo $info) {\n            // You can now access contextual info from the calendar using the $info argument \n            if ($info instanceof DateClickInfo) {\n                // do something on date click\n            }\n            \n            // Both comparison checks are equal, but instanceof is better for IDE help\n            if ($info->getContext() === Context::DateSelect) {\n                // do something on date select\n            }\n        })\n        // You could also type hint each contextual info directly:\n        ->mountUsing(fn(?DateClickInfo $dateClick, ?DateSelectInfo $dateSelect))\n    ;\n}\n```\n\n#### Accessing context information\nAs seen above, we provide various contextual information for you when using calendar actions:\n\n| Parameter         | Description                                                                            |\n|-------------------|----------------------------------------------------------------------------------------|\n| Context           | The current context enum or null if not in calendar context                            |\n| DateClickInfo     | If in the DateClick context, it will contain the DateClickInfo, otherwise null         |\n| DateSelectInfo    | If in the DateSelect context, it will contain the DateSelectInfo, otherwise null       |\n| EventClickInfo    | If in the EventClick context, it will contain the EventClickInfo, otherwise null       |\n| NoEventsClickInfo | If in the NoEventsClick context, it will contain the NoEventsClickInfo, otherwise null |\n\nYou simply need to type hint the parameter correctly and it will be injected for you if available.\n\nThese are not only limited to `mountUsing`, almost all action methods will have access to these.\n\nFor example, to conditionally hide an action in the DateClick context:\n```php\nuse Guava\\Calendar\\Enums\\Context;\n\n$this->createAction(Foo::class)\n    ->hidden(function (?ContextualInfo $info) {\n        return $info->getContext() === Context::DateClick;\n    });\n```\n\n### Schemas\n\nThe `create`, `view` and `edit` actions should work out of the box and use the correct schemas.\n\nWe attempt to guess your Resource and reuse the appropriate schema: `Create` and `Edit` actions will use your **Form Schema**, while `View` actions will reuse your **Infolist Schema** or fall-back to the **Form Schema** if no Infolist is present.\n\nBut sometimes, you might want to customize the Schema that will be used in your Calendar Modals.\n\nYou have a few options available:\n- Stick to auto discovery, in which case you are ready to go :-),\n- if your calendar works with a single model only or you reuse the same schema for multiple models, you can implement the `schema` or `defaultSchema` method,\n- or you can implement a schema per model\n\n#### Implementing a default schema\n\nIf you only work with a single model, or you want to share the same schema across multiple models, you can implement the `schema` or `defaultSchema` method (both are equivalent) in your calendar widget:\n\n```php\npublic function defaultSchema(Schema $schema): Schema\n{\n    return $schema->components([\n        // ...\n    ]);\n}\n```\n\n#### Implementing a schema for a specific model\n\nIf you need to set a specific schema for a model, you have two options:\n- Define a method with any name you want and add the `#[CalendarSchema()]` attribute,\n- or define a method in the format `camelCaseModelNameSchema`, such as `fooBarSchema`\n\n```php\n// Variant 1\npublic function fooBarSchema(Schema $schema): Schema\n{\n    return $schema->components([\n        // ...\n    ]);\n}\n\n// Variant 2\nuse Guava\\Calendar\\Attributes\\CalendarSchema;\n\n#[CalendarSchema(FooBar::class)]\npublic function baz(Schema $schema): Schema\n{\n    return $schema->components([\n        // ...\n    ]);\n}\n```\n\n### Date Click\n\nA date click event is triggered when a date cell is clicked in the calendar.\n\nTo handle date clicks, first enable them by overriding the `dateClickEnabled` property:\n\n```php\nprotected bool $dateClickEnabled = true;\n```\n\nNow date clicks are enabled and a request will be sent to livewire each time a date cell is clicked.\n\nBut by default, nothing happens, and each date click will be silently ignored.\n\nYou can now choose to either:\n- implement your own logic\n- or use our context menu feature\n\n#### Implementing your own logic\n\nIf you want to take full control over what happens when a date cell is clicked, override the `onDateClick` method and implement your own custom logic:\n\n```php\nuse Guava\\Calendar\\ValueObjects\\DateClickInfo;\n\nprotected function onDateClick(DateClickInfo $info): void\n{\n    // Validate the data and handle the event\n    // For example, you might want to mount a create action\n    $this->mountAction('createFoo');\n}\n```\n\n#### Using the context menu feature\nAnother option is to use our context menu feature. When enabled, a context menu will be rendered at your mouse cursor when you click a date cell, which you can populate with actions.\n\nTo use the context menu feature, all you need to do is implement the `getDateClickContextMenuActions` method:\n\n```php\nprotected function getDateClickContextMenuActions(): array\n{\n    return [\n        $this->createFooAction(),\n        $this->createBarAction(),\n        // Any other action you want\n    ];\n}\n```\n\nThe context menu has a higher priority, so if it returns a non-empty array, it will always take precedence over your custom handler.\n\n### Date Select\n\nSimilarly, a date select event is triggered when a date cell is dragged to create a selection in the calendar.\n\nTo handle date selects, first enable them by overriding the `dateSelectEnabled` property:\n\n```php\nprotected bool $dateSelectEnabled = true;\n```\n\nNow date selects are enabled and a request will be sent to livewire each time a date selection is made.\n\nBut by default, nothing happens, and each date select will be silently ignored.\n\nYou can now choose to either:\n- implement your own logic\n- or use our context menu feature\n\n#### Implementing your own logic\n\nIf you want to take full control over what happens when a date selection is made, override the `onDateSelect` method and implement your own custom logic:\n\n```php\nuse Guava\\Calendar\\ValueObjects\\DateSelectInfo;\n\nprotected function onDateSelect(DateSelectInfo $info): void\n{\n    // Validate the data and handle the event\n    // For example, you might want to mount a create action\n    $this->mountAction('createFoo');\n}\n```\n\n#### Using the context menu feature\nAnother option is to use our context menu feature. When enabled, a context menu will be rendered at your mouse cursor when you complete your date selection, which you can populate with actions.\n\nTo use the context menu feature, all you need to do is implement the `getDateSelectContextMenuActions` method:\n\n```php\nprotected function getDateSelectContextMenuActions(): array\n{\n    return [\n        $this->createFooAction(),\n        $this->createBarAction(),\n        // Any other action you want\n    ];\n}\n```\n\nThe context menu has a higher priority, so if it returns a non-empty array, it will always take precedence over your custom handler.\n\n### Event Click\n\nAn event click event is triggered when an event is clicked in the calendar.\n\nTo handle event clicks, first enable them by overriding the `eventClickEnabled` property:\n\n```php\nprotected bool $eventClickEnabled = true;\n```\n\nNow event clicks are enabled and a request will be sent to livewire each time an event is clicked.\n\nBy default, a view action will be mounted with prefilled information about the event.\n\nYou can set the default click action by overriding the `defaultEventClickAction` property of the widget. This simply needs to be the name of an action that you can freely define in your widget, like regular Filament actions:\n\n```php\nprotected ?string $defaultEventClickAction = 'edit'; // view and edit actions are provided by us, but you can choose any action you want, even your own custom ones\n```\n\nYou can now choose to either:\n- keep the default behavior,\n- implement your own logic\n- or use our context menu feature\n\n#### Implementing your own logic\n\nIf you want to take full control over what happens when an event is clicked, override the `onEventClick` method and implement your own custom logic:\n\n```php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Guava\\Calendar\\ValueObjects\\EventClickInfo;\n\nprotected function onEventClick(EventClickInfo $info, Model $event, ?string $action = null): void\n{\n    // Validate the data and handle the event click\n    // $event contains the clicked event record\n    // you can also access it via $info->record\n}\n```\n\n#### Using the context menu feature\nAnother option is to use our context menu feature. When enabled, a context menu will be rendered at your mouse cursor when you click an event, which you can populate with actions.\n\nTo use the context menu feature, all you need to do is implement the `getEventClickContextMenuActions` method:\n\n```php\nprotected function getEventClickContextMenuActions(): array\n{\n    return [\n        $this->viewAction(),\n        $this->editAction(),\n        $this->deleteAction(),\n    ];\n}\n```\n\nThe context menu has a higher priority, so if it returns a non-empty array, it will always take precedence over your custom handler.\n\n### No Events Click\n> [!NOTE]  \n> This has affect only in list views.\n\nA no events click event is triggered when a list view has no events to display and the calendar content was clicked.\n\nTo handle no events clicks, first enable them by overriding the `noEventsClickEnabled` property:\n\n```php\nprotected bool $noEventsClickEnabled = true;\n```\n\nNow no events clicks are enabled and a request will be sent to livewire each time a click is made.\n\nBut by default, nothing happens, and each click will be silently ignored.\n\nYou can now choose to either:\n- implement your own logic\n- or use our context menu feature\n\n#### Implementing your own logic\n\nIf you want to take full control over what happens when a click is made, override the `onNoEventsClick` method and implement your own custom logic:\n\n```php\nuse Guava\\Calendar\\ValueObjects\\NoEventsClickInfo;\n\nprotected function onNoEventsClick(NoEventsClickInfo $info): void\n{\n    // Validate the data and handle the event\n    // For example, you might want to mount a create action\n    $this->mountAction('createFoo');\n}\n```\n\n#### Using the context menu feature\nAnother option is to use our context menu feature. When enabled, a context menu will be rendered at your mouse cursor when you click, which you can populate with actions.\n\nTo use the context menu feature, all you need to do is implement the `getNoEventsClickContextMenuActions` method:\n\n```php\nprotected function getNoEventsClickContextMenuActions(): array\n{\n    return [\n        $this->createFooAction(),\n        $this->createBarAction(),\n        // Any other action you want\n    ];\n}\n```\n\nThe context menu has a higher priority, so if it returns a non-empty array, it will always take precedence over your custom handler.\n\n### Event Resize\n\nCallback function that is triggered when you finish resizing an event in your calendar.\n\nTo handle the callback, first enable it by overriding the `eventResizeEnabled` property:\n\n```php\nprotected bool $eventResizeEnabled = true;\n```\n\nNow it is enabled and a request will be sent to livewire after you complete the resize of an event.\n\n#### Implementing your own logic\n\n> [!IMPORTANT]  \n> Notice that unlike the other callbacks, this callback returns a boolean value.\n> \n> This is used to control whether the event resize should be reverted visually on the frontend or not.\n\nTo handle the callback, override the `onEventResize` method and implement your own custom logic:\n\n```php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Guava\\Calendar\\ValueObjects\\EventResizeInfo;\n\nprotected function onEventResize(EventResizeInfo $info, Model $event): bool\n{\n    // Validate the data and handle the event\n    // Most likely you will want to update the event with the new start /end dates to persist the resize in the database\n\n    return true;\n}\n```\n\n### Event Drag & Drop\n\nCallback function that is triggered when you finish dragging and drop an event to a date cell in your calendar.\n\nTo handle the callback, first enable it by overriding the `eventDragEnabled` property:\n\n```php\nprotected bool $eventDragEnabled = true;\n```\n\nNow it is enabled and a request will be sent to livewire after you drop the event to a date cell in the calendar.\n\n#### Implementing your own logic\n\n> [!IMPORTANT]  \n> Notice that unlike the other callbacks, this callback returns a boolean value.\n>\n> This is used to control whether the event should be reverted visually to it's original position on the frontend or not.\n\nTo handle the callback, override the `onEventDrop` method and implement your own custom logic:\n\n```php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Guava\\Calendar\\ValueObjects\\EventDropInfo;\n\nprotected function onEventDrop(EventDropInfo $info, Model $event): bool\n{\n     // Access the updated dates using getter methods\n    $newStart = $info->event->getStart();\n    $newEnd = $info->event->getEnd();\n      // Update the event with the new start/end dates to persist the drag & drop\n    $event->update([\n        'start_time' => $newStart,\n        'end_time' => $newEnd,\n    ]);\n     // Return true to accept the drop and keep the event in the new position\n    return true;\n    \n}\n```\n\n### Dates Set\n\nWhen the date range of the calendar was originally set or changed by clicking the previous/next buttons, changing the view, manipulating the current date via the API, etc. a Dates Set event is triggered.\n\nTo handle the Dates Set callback, first enable it by overriding the `datesSetEnabled` property:\n\n```php\nprotected bool $datesSetEnabled = true;\n```\n\nNow it is enabled and a request will be sent to livewire each time the calendar date range is changed (or initially set).\n\n#### Implementing your own logic\n\nTo handle the callback, override the `onDatesSet` method and implement your own custom logic:\n\n```php\nuse Guava\\Calendar\\ValueObjects\\DatesSetInfo;\n\nprotected function onDatesSet(DatesSetInfo $info): void\n{\n    // Validate the data and handle the event\n    // For example, you might want to store the date range in a cookie or session\n    // to remember the date range across page refreshes\n}\n```\n\n### View Did Mount\n\nCallback function that is triggered right after the view has been added to the DOM.\n\nTo handle the callback, first enable it by overriding the `viewDidMountEnabled` property:\n\n```php\nprotected bool $viewDidMountEnabled = true;\n```\n\nNow it is enabled and a request will be sent to livewire right after the calendar view has been added to the DOM.\n\n#### Implementing your own logic\n\nTo handle the callback, override the `onViewDidMount` method and implement your own custom logic:\n\n```php\nuse Guava\\Calendar\\ValueObjects\\ViewDidMountInfo;\n\nprotected function onViewDidMount(ViewDidMountInfo $info): void\n{\n    // Validate the data and handle the event\n    // For example, you might want to store the date range in a cookie or session\n    // to remember the date range across page refreshes\n}\n```\n\n## Custom Event Content\nBy default, we use the default view from the calendar package. However, you are able to use your own content.\n\nTo keep things performant, the blade view is rendered **once** on the server and then re-used for every event. Thus, you **cannot** access the calendar event data from the server side via Blade or Laravel, or do any server-side operations.\n\nHowever, each event is wrapped in an alpine component, which exposes the event data that you can freely use using [AlpineJS](https://alpinejs.dev/).\n\nIf you only have one type of events or events that render the same way, you can simply return a view or a HtmlString from the `defaultEventContent` or `eventContent` method:\n\n```php\nuse Illuminate\\Support\\HtmlString;\n\nprotected function eventContent(): HtmlString|string\n{\n    // return a blade view\n    return view('calendar.event');\n    \n    // return a HtmlString\n    return new HtmlString('<div>My event</div>');\n}\n```\n\nExample of the `calendar.event` view blade file: \n```bladehtml\n<div class=\"flex flex-col items-start\">\n    <span x-text=\"event.title\"></span>\n    <template x-for=\"user in event.extendedProps.users\">\n        <span x-text=\"user.name\"></span>\n    </template>\n</div>\n```\n\nIf you want to render events differently based on their model type, you can implement an Event Content method for each model, by using the `CalendarEventContent` attribute or by using a specific naming convention for the method - `camelCaseModelNameEventContent` such as `fooEventContent` (where Foo is your model):\n```php\nuse Illuminate\\Support\\HtmlString;\nuse Guava\\Calendar\\Attributes\\CalendarEventContent;\n\n// Variant 1.\n#[CalendarEventContent(Foo::class)]\nprotected function eventContentForFoo(): HtmlString|string\n{\n    return view('calendar.foo-model-event');\n}\n\n// Variant 2.\nprotected function barEventContent(): HtmlString|string\n{\n    return view('calendar.bar-model-event');\n}\n```\n\nBoth variants are equal, it's up to your personal preference which one you want to use.\n\n## Custom Resource Label Content\nBy default, we use the default view from the calendar package. However, you are able to use your own content.\n\nTo keep things performant, the blade view is rendered **once** on the server and then re-used for every resource. Thus, you **cannot** access the calendar resource data from the server side via Blade or Laravel, or do any server-side operations.\n\nHowever, each resource is wrapped in an alpine component, which exposes the resource data that you can freely use using [AlpineJS](https://alpinejs.dev/).\n\nIf you only have one type of resources or resources that render the same way, you can simply return a view or a HtmlString from the `defaultResourceLabelContent` or `resourceLabelContent` method:\n\n```php\nuse Illuminate\\Support\\HtmlString;\n\nprotected function resourceLabelContent(): HtmlString|string\n{\n    // return a blade view\n    return view('calendar.resource');\n    \n    // return a HtmlString\n    return new HtmlString('<div>My resource</div>');\n}\n```\n\nExample of the `calendar.resource` view blade file:\n```bladehtml\n<div class=\"flex flex-col items-start\">\n    <span x-text=\"resource.title\"></span>\n</div>\n```\n\nIf you want to render resources differently based on their model type, you can implement a Resource Label Content method for each model, by using the `CalendarResourceLabelContent` attribute or by using a specific naming convention for the method - `camelCaseModelNameResourceLabelContent` such as `fooResourceLabelContent` (where Foo is your model):\n```php\nuse Illuminate\\Support\\HtmlString;\nuse Guava\\Calendar\\Attributes\\CalendarResourceLabelContent;\n\n// Variant 1.\n#[CalendarResourceLabel(Foo::class)]\nprotected function resourceLabelContentForFoo(): HtmlString|string\n{\n    return view('calendar.foo-model-resource');\n}\n\n// Variant 2.\nprotected function barResourceLabelContent(): HtmlString|string\n{\n    return view('calendar.bar-model-resource');\n}\n```\n\nBoth variants are equal, it's up to your personal preference which one you want to use.\n\n## Authorization\n\nBy default, everyone can use all actions! The package does not handle authorization, this is your responsibility.\n\nSince we use regular filament actions, adding authorizations is a breeze. \n\nFor example to add authorization to the createTaskAction:\n\n```php\nuse Guava\\Calendar\\Filament\\Actions\\CreateAction;\n\npublic function createFooAction(): CreateAction\n{\n    return $this->createAction(Foo::class)\n        ->authorize('create', Foo::class)\n        // At this point, it will authorize against the FooPolicy\n        //\n        // However, you might want to give the user some feedback:\n        ->authorizationNotification()\n        // Now it will send a notification with the response message from your policy\n        //\n        // For context menu actions, you can instead use:\n        ->authorizationTooltip()\n        // which will disable the action and show a tooltip with the response message\n    ;\n}\n```\n\nFor detailed information, please follow the default filament documentation on how to add [authorization to actions](https://filamentphp.com/docs/4.x/actions/overview#authorization).\n\n## Utility Classes\nWe provide various helper and utility classes to provide you with type hints for various arguments that are being passed from the calendar to your widget.\n\n### CalendarViewType\nThis enum contains all available calendar views that you can use in your calendar widget.\n\n### FetchInfo\nWhen the calendar retrieves events, it provides you with a `FetchInfo` object which contains information about the current calendar view.\n\nUse this to query only models that are visible in the current view.\n\n| Property | Description                                                                                                     |\n|--------|-----------------------------------------------------------------------------------------------------------------|\n| start  | Start date of the range the calendar needs events for. Events before this date are not visible in the calendar. |\n| end    | End date of the range the calendar needs events for. Events after this date are not visible in the calendar.    |\n\n## Troubleshooting\n### Context menu actions don't work\nIf you encounter issues with the context menu, make sure that the name of the action is unique across the whole widget. If there is another action with the same name, it might be mounted instead of the one you want.\n\n### Record vs Event record\nWhen working with resource widgets, `$record` is the record of the currently opened resource record, whereas `$eventRecord` is the record of the calendar event (during calendar actions, context menus, etc.).\n\n## Security measures\nKeep in mind that a lot of the data in this package comes from the client side JavaScript and could be tampered with. Always validate the data on the server side and never trust the data from the client side.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n- [Lukas Frey](https://github.com/GuavaCZ)\n- [All Contributors](../../contributors)\n- Spatie - Our package skeleton is a modified version of [Spatie's Package Skeleton](https://github.com/spatie/package-skeleton-laravel)\n- [vkurko/calendar](https://github.com/vkurko/calendar) - free, open-source alternative to FullCalendar\n- [saade/filament-fullcalendar](https://github.com/saade/filament-fullcalendar) - heavy inspiration for this package\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n"
  },
  {
    "path": "bin/build.js",
    "content": "import esbuild from 'esbuild'\n\nconst isDev = process.argv.includes('--dev')\n\nasync function compile(options) {\n    const context = await esbuild.context(options)\n\n    if (isDev) {\n        await context.watch()\n    } else {\n        await context.rebuild()\n        await context.dispose()\n    }\n}\n\nconst defaultOptions = {\n    define: {\n        'process.env.NODE_ENV': isDev ? `'development'` : `'production'`,\n    },\n    bundle: true,\n    mainFields: ['module', 'main'],\n    platform: 'neutral',\n    sourcemap: isDev ? 'inline' : false,\n    sourcesContent: isDev,\n    treeShaking: true,\n    target: ['es2020'],\n    minify: !isDev,\n    plugins: [{\n        name: 'watchPlugin',\n        setup: function (build) {\n            build.onStart(() => {\n                console.log(`Build started at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)\n            })\n\n            build.onEnd((result) => {\n                if (result.errors.length > 0) {\n                    console.log(`Build failed at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`, result.errors)\n                } else {\n                    console.log(`Build finished at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)\n                }\n            })\n        }\n    }],\n}\n\ncompile({\n    ...defaultOptions,\n    entryPoints: ['./resources/js/calendar.js'],\n    outfile: './dist/js/calendar.js',\n})\n\ncompile({\n    ...defaultOptions,\n    entryPoints: ['./resources/js/calendar-context-menu.js'],\n    outfile: './dist/js/calendar-context-menu.js',\n})\n\ncompile({\n    ...defaultOptions,\n    entryPoints: ['./resources/js/calendar-event.js'],\n    outfile: './dist/js/calendar-event.js',\n})\n\n// compile({\n//     ...defaultOptions,\n//     entryPoints: ['./resources/js/calendar-context-menu.js'],\n//     outfile: './dist/js/calendar-context-menu.js',\n// })\n//\n// compile({\n//     ...defaultOptions,\n//     entryPoints: ['./resources/js/event.js'],\n//     outfile: './dist/js/event.js',\n// })\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"guava/calendar\",\n    \"description\": \"Adds support for vkurko/calendar to Filament PHP.\",\n    \"keywords\": [\n        \"Guava\",\n        \"laravel\",\n        \"calendar\"\n    ],\n    \"homepage\": \"https://github.com/GuavaCZ/calendar\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \"Lukas Frey\",\n            \"email\": \"lukas.frey@guava.cz\",\n            \"role\": \"Developer\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"^8.1|^8.2\",\n        \"filament/filament\": \"^5.0\",\n        \"illuminate/contracts\": \"^11.0|^12.0|^13.0\",\n        \"spatie/laravel-package-tools\": \"^1.14.0\"\n    },\n    \"require-dev\": {\n        \"laravel/pint\": \"^1.0\",\n        \"nunomaduro/collision\": \"^7.8|^8.0\",\n        \"nunomaduro/larastan\": \"^2.0.1\",\n        \"orchestra/testbench\": \"^9.0|^10.0|^11.0\",\n        \"pestphp/pest\": \"^2.36|^4.4\",\n        \"pestphp/pest-plugin\": \"^2.1.1|^4.0\",\n        \"pestphp/pest-plugin-arch\": \"^2.0|^4.0\",\n        \"pestphp/pest-plugin-laravel\": \"^2.0|^4.1\",\n        \"phpstan/extension-installer\": \"^1.1\",\n        \"phpstan/phpstan-deprecation-rules\": \"^1.0|^2.0\",\n        \"phpstan/phpstan-phpunit\": \"^1.0|^2.0\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"Guava\\\\Calendar\\\\\": \"src/\",\n            \"Guava\\\\Calendar\\\\Database\\\\Factories\\\\\": \"database/factories/\"\n        },\n        \"files\": [\n            \"src/helpers.php\"\n        ]\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"Guava\\\\Calendar\\\\Tests\\\\\": \"tests/\",\n            \"Workbench\\\\App\\\\\": \"workbench/app/\"\n        }\n    },\n    \"scripts\": {\n        \"post-autoload-dump\": \"@composer run prepare\",\n        \"clear\": \"@php vendor/bin/testbench package:purge-calendar --ansi\",\n        \"prepare\": \"@php vendor/bin/testbench package:discover --ansi\",\n        \"build\": [\n            \"@composer run prepare\",\n            \"@php vendor/bin/testbench workbench:build --ansi\"\n        ],\n        \"start\": [\n            \"Composer\\\\Config::disableProcessTimeout\",\n            \"@composer run build\",\n            \"@php vendor/bin/testbench serve\"\n        ],\n        \"analyse\": \"vendor/bin/phpstan analyse\",\n        \"test\": \"vendor/bin/pest\",\n        \"test-coverage\": \"vendor/bin/pest --coverage\",\n        \"format\": \"vendor/bin/pint\"\n    },\n    \"config\": {\n        \"sort-packages\": true,\n        \"allow-plugins\": {\n            \"pestphp/pest-plugin\": true,\n            \"phpstan/extension-installer\": true\n        }\n    },\n    \"extra\": {\n        \"laravel\": {\n            \"providers\": [\n                \"Guava\\\\Calendar\\\\CalendarServiceProvider\"\n            ]\n        }\n    },\n    \"minimum-stability\": \"beta\",\n    \"prefer-stable\": false\n}\n"
  },
  {
    "path": "config/calendar.php",
    "content": "<?php\n\n// config for Guava/Calendar\nreturn [\n\n];\n"
  },
  {
    "path": "database/factories/ModelFactory.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Database\\Factories;\n\nuse Illuminate\\Database\\Eloquent\\Factories\\Factory;\n\n/*\nclass ModelFactory extends Factory\n{\n    protected $model = YourModel::class;\n\n    public function definition()\n    {\n        return [\n\n        ];\n    }\n}\n*/\n"
  },
  {
    "path": "database/migrations/create_calendar_table.php.stub",
    "content": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nreturn new class extends Migration\n{\n    public function up()\n    {\n        Schema::create('calendar_table', function (Blueprint $table) {\n            $table->id();\n\n            // add fields\n\n            $table->timestamps();\n        });\n    }\n};\n"
  },
  {
    "path": "dist/js/calendar-context-menu.js",
    "content": "function d({getContextMenuActionsUsing:o}){return{open:!1,size:{width:0,height:0},position:{x:0,y:0},mountData:{},context:null,actions:[],isLoading:!1,onCloseCallback:null,menu:{\"x-show\"(){return this.open},\"x-bind:style\"(){return`\n                    position: absolute;\n                    z-index: 40;\n                    top: ${this.position.y}px;\n                    left: ${this.position.x}px;\n                `},\"x-on:click.away\"(){this.closeMenu()}},init:async function(){let t=this.$el.querySelector('[x-bind=\"menu\"]');this.size={width:t.offsetWidth,height:t.offsetHeight},this.$el.addEventListener(\"calendar--open-menu\",e=>this.openMenu(e))},loadActions:async function(t,e={}){this.isLoading=!0,this.actions=[],o(t,e).then(n=>{this.actions=n}).finally(()=>this.isLoading=!1)},openMenu:async function(t,e=null){this.$nextTick(()=>{let n=t.clientX,i=t.clientY,s=t.pageX,c=t.pageY,a=n+this.size.width>window.innerWidth?n+this.size.width-window.innerWidth:0,h=i+this.size.height>window.innerHeight?i+this.size.height-window.innerHeight:0;if(this.position.x=s-a,this.position.y=c-h,this.open=!0,e){let l=e.getAttribute(\"data-event-id\");document.querySelectorAll(`.ec-event[data-event-id=\"${l}\"]`).forEach(u=>u.classList.add(\"gu-context-menu-open\"))}})},closeMenu:function(){this.open=!1,document.querySelectorAll(\".ec-event.gu-context-menu-open\").forEach(t=>t.classList.remove(\"gu-context-menu-open\")),this.onCloseCallback&&this.onCloseCallback()}}}export{d as default};\n"
  },
  {
    "path": "dist/js/calendar-event.js",
    "content": "function o({event:t,timeText:r,view:d,hasContextMenu:n}){return{event:t,contextMenu:null,init:function(){n&&this.initializeContextMenu(),this.$el.setAttribute(\"data-event-id\",t.id),this.$el.addEventListener(\"mouseenter\",()=>{document.querySelectorAll(`.ec-event[data-event-id=\"${t.id}\"]`).forEach(e=>{e.classList.add(\"gu-hover\")})}),this.$el.addEventListener(\"mouseleave\",()=>{document.querySelectorAll(`.ec-event[data-event-id=\"${t.id}\"]`).forEach(e=>{e.classList.remove(\"gu-hover\")})})},initializeContextMenu:function(){let e=document.querySelector(\"[calendar-context-menu]\");this.contextMenu=Alpine.$data(e)},onClick:function(e){if(e.event.extendedProps.url){window.open(this.event.extendedProps.url,this.event.extendedProps.url_target??\"_blank\");return}let i={event:e.event,view:e.view,tzOffset:-new Date().getTimezoneOffset()};if(n){this.contextMenu.loadActions(\"eventClick\",i),this.contextMenu.openMenu(e.jsEvent,this.$el);return}this.$wire.onEventClickJs(i)}}}export{o as default};\n"
  },
  {
    "path": "dist/js/calendar.js",
    "content": "function M({view:c=\"dayGridMonth\",locale:v=\"en\",firstDay:f=1,dayMaxEvents:w=!1,eventContent:l=null,eventClickEnabled:m=!1,eventDragEnabled:i=!1,eventResizeEnabled:d=!1,noEventsClickEnabled:h=!1,dateClickEnabled:D=!1,dateSelectEnabled:o=!1,datesSetEnabled:E=!1,viewDidMountEnabled:S=!1,eventAllUpdatedEnabled:O=!1,hasDateClickContextMenu:g=null,hasDateSelectContextMenu:p=null,hasEventClickContextMenu:z=null,hasNoEventsClickContextMenu:x=null,resources:C=null,resourceLabelContent:r=null,theme:u=null,options:$={},eventAssetUrl:y}){return{init:function(){let n=this.mountCalendar();window.addEventListener(\"calendar--refresh\",()=>{n.refetchEvents()}),this.$wire.on(\"calendar--set\",e=>{n.setOption(e.key,e.value)})},mountCalendar:function(){return EventCalendar.create(this.$el.querySelector(\"[data-calendar]\"),this.getSettings())},getSettings:function(){let n={view:c,locale:v,firstDay:f,dayMaxEvents:w,eventSources:[{events:e=>this.$wire.getEventsJs({...e,tzOffset:-new Date().getTimezoneOffset()})}],resources:C,selectable:o,eventStartEditable:i,eventDurationEditable:d,dayCellFormat:e=>e.getDate().toString()};return l!==null&&(n.eventContent=e=>{let t=e.event.extendedProps.model,s=l[t]??l._default;if(s!==void 0)return{html:s}}),r!==null&&(n.resourceLabelContent=e=>{let t=e.resource.extendedProps.model,s=r[t]??r._default;if(s!==void 0)return{html:this.wrapContent(s,e)}}),D&&(n.dateClick=e=>{let t={date:e.date,dateStr:e.dateStr,allDay:e.allDay,view:e.view,resource:e.resource,tzOffset:-new Date().getTimezoneOffset()};g?this.openContextMenu(e.jsEvent,t,\"dateClick\"):this.$wire.onDateClickJs(t)}),o&&(n.select=e=>{let t={start:e.start,startStr:e.startStr,end:e.end,endStr:e.endStr,allDay:e.allDay,view:e.view,resource:e.resource,tzOffset:-new Date().getTimezoneOffset()};p?this.openContextMenu(e.jsEvent,t,\"dateSelect\"):this.$wire.onDateSelectJs(t)}),E&&(n.datesSet=e=>{this.$wire.onDatesSetJs({start:e.start,startStr:e.startStr,end:e.end,endStr:e.endStr,view:e.view,tzOffset:-new Date().getTimezoneOffset()})}),m&&(n.eventClick=e=>{Alpine.$data(e.el).onClick(e)}),n.eventResize=async e=>{let t=e.event.durationEditable,s=d;t!==void 0&&(s=t),s&&await this.$wire.onEventResizeJs({event:e.event,oldEvent:e.oldEvent,endDelta:e.endDelta,view:e.view,tzOffset:-new Date().getTimezoneOffset()}).then(a=>{a===!1&&e.revert()})},n.eventDrop=async e=>{let t=e.event.startEditable,s=i;t!==void 0&&(s=t),s&&await this.$wire.onEventDropJs({event:e.event,oldEvent:e.oldEvent,oldResource:e.oldResource,newResource:e.newResource,delta:e.delta,view:e.view,tzOffset:-new Date().getTimezoneOffset()}).then(a=>{a===!1&&e.revert()})},n.eventDidMount=e=>{e.el.setAttribute(\"x-load\"),e.el.setAttribute(\"x-load-src\",y),e.el.setAttribute(\"x-data\",`calendarEvent({\n                    event: ${JSON.stringify(e.event)},\n                    timeText: \"${e.timeText}\",\n                    view: ${JSON.stringify(e.view)},\n                    hasContextMenu: ${z},\n                })`)},h&&(n.noEventsClick=e=>{let t={view:e.view,tzOffset:-new Date().getTimezoneOffset()};x?this.openContextMenu(e.jsEvent,t,\"noEventsClick\"):this.$wire.onNoEventsClickJs(t)}),S&&(n.viewDidMount=e=>{this.$wire.onViewDidMountJs({view:e.view,tzOffset:-new Date().getTimezoneOffset()})}),O&&(n.eventAllUpdated=e=>{this.$wire.onEventAllUpdatedJs({view:e.view,tzOffset:-new Date().getTimezoneOffset()})}),u&&(n.theme=function(e){return{...e,...u}}),{...n,...$}},wrapContent:function(n,e){let t=document.createElement(\"div\");return t.innerHTML=n,t.setAttribute(\"x-data\",JSON.stringify(e)),t.classList.add(\"w-full\"),t.outerHTML},openContextMenu:function(n,e,t){let s=document.querySelector(\"[calendar-context-menu]\"),a=Alpine.$data(s);a.loadActions(t,e),a.openMenu(n)}}}export{M as default};\n"
  },
  {
    "path": "package.json",
    "content": "{\n    \"devDependencies\": {\n        \"@event-calendar/core\": \"^4.5.0\",\n        \"conventional-changelog-conventionalcommits\": \"^7.0.2\",\n        \"esbuild\": \"^0.21.3\",\n        \"semantic-release\": \"^22.0.5\"\n    },\n    \"type\": \"module\",\n    \"dependencies\": {\n        \"@awcodes/alpine-floating-ui\": \"^3.6.3\",\n        \"@event-calendar/day-grid\": \"^3.0.0\",\n        \"@event-calendar/time-grid\": \"^3.0.0\"\n    }\n}\n"
  },
  {
    "path": "phpstan-baseline.neon",
    "content": ""
  },
  {
    "path": "phpstan.neon.dist",
    "content": "includes:\n    - phpstan-baseline.neon\n    - ./vendor/nunomaduro/larastan/extension.neon\n\nparameters:\n    level: 4\n    paths:\n        - src\n        - config\n        - database\n    tmpDir: build/phpstan\n    checkOctaneCompatibility: true\n    checkModelProperties: true\n    checkMissingIterableValueType: false\n\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/10.2/phpunit.xsd\"\n    backupGlobals=\"false\"\n    bootstrap=\"vendor/autoload.php\"\n    colors=\"true\"\n    processIsolation=\"false\"\n    stopOnFailure=\"false\"\n    executionOrder=\"random\"\n    failOnWarning=\"true\"\n    failOnRisky=\"true\"\n    failOnEmptyTestSuite=\"true\"\n    beStrictAboutOutputDuringTests=\"true\"\n    cacheDirectory=\".phpunit.cache\"\n    backupStaticProperties=\"false\"\n>\n    <testsuites>\n        <testsuite name=\"Guava Test Suite\">\n            <directory>tests</directory>\n        </testsuite>\n    </testsuites>\n    <coverage>\n        <report>\n            <html outputDirectory=\"build/coverage\"/>\n            <text outputFile=\"build/coverage.txt\"/>\n            <clover outputFile=\"build/logs/clover.xml\"/>\n        </report>\n    </coverage>\n    <logging>\n        <junit outputFile=\"build/report.junit.xml\"/>\n    </logging>\n    <source>\n        <include>\n            <directory suffix=\".php\">./src</directory>\n        </include>\n    </source>\n</phpunit>\n"
  },
  {
    "path": "pint.json",
    "content": "{\n    \"preset\": \"laravel\",\n    \"rules\": {\n        \"method_argument_space\": true,\n        \"multiline_whitespace_before_semicolons\": {\n            \"strategy\": \"new_line_for_chained_calls\"\n        },\n        \"types_spaces\": {\n            \"space\": \"single\"\n        },\n        \"concat_space\": false\n    }\n}\n"
  },
  {
    "path": "resources/css/theme.css",
    "content": ".ec {\n    --ec-list-day-bg-color: white;\n    --ec-today-bg-color: var(--color-50);\n\n    /*--ec-text-color: var(--gray-500);*/\n\n    --ec-event-bg-color: var(--bg);\n    --ec-event-text-color: var(--text);\n    --ec-bg-event-color: var(--color-50);\n    --ec-border-color: var(--gray-200);\n    --ec-button-bg-color: var(--bg);\n    --ec-button-text-color: var(--text);\n    --ec-button-active-bg-color: var(--hover-bg);\n    --ec-button-active-text-color: var(--hover-text);\n}\n.dark .ec {\n    --ec-list-day-bg-color: var(--gray-900);\n    --ec-today-bg-color: color-mix(in oklab, var(--color-500) 20%, transparent);\n\n    /*--ec-text-color: var(--gray-200);*/\n\n    --ec-event-bg-color: var(--dark-bg);\n    --ec-event-text-color: var(--dark-text);\n    --ec-border-color: rgba(255, 255, 255, 0.1);\n    --ec-button-bg-color: var(--dark-bg);\n    --ec-button-text-color: var(--dark-text);\n    --ec-button-active-bg-color: var(--dark-hover-bg);\n    --ec-button-active-text-color: var(--dark-hover-text);\n}\n\n\n.ec-button {\n    @apply rounded-lg border-0 text-sm py-2 px-3 font-medium;\n\n    &:disabled {\n        @apply opacity-70 bg-[var(--ec-button-bg-color)] text-[var(--ec-button-text-color)];\n    }\n}\n\n/* This adds the \"divider\" between buttons in a button group */\n.ec-button-group {\n    & .ec-button {\n        @apply me-px;\n        &:not(:first-child) {\n            @apply border-s border-s-white dark:border-s-gray-950;\n        }\n    }\n}\n\n.ec-title {\n    @apply text-base font-semibold text-gray-950 dark:text-white;\n}\n\n.ec-header {\n    .ec-day {\n        @apply font-semibold text-gray-950 dark:text-white;\n    }\n}\n\n.ec-day-grid,\n.ec-time-grid {\n    & .ec-header {\n        @apply rounded-ss-lg rounded-se-lg;\n    }\n\n    & .ec-body {\n        @apply rounded-es-lg rounded-ee-lg;\n    }\n}\n.ec-timeline {\n    & .ec-sidebar {\n        @apply rounded-ss-lg rounded-es-lg;\n    }\n    & .ec-main .ec-header {\n        @apply rounded-se-lg;\n    }\n\n    & .ec-main .ec-body {\n        @apply rounded-ee-lg;\n    }\n}\n.ec-list {\n    & .ec-body {\n        @apply rounded-lg;\n    }\n}\n\n/*.ec-event {*/\n/*    @apply bg-[var(--bg)] dark:bg-[var(--dark-bg)];*/\n/*    & .ec-event-body {*/\n/*        @apply text-[var(--text)] dark:text-[(var(--dark-text))];*/\n/*    }*/\n/*}*/\n\n/* Only apply these settings in day and time grid views (not in list views) */\n.ec-day-grid,\n.ec-time-grid {\n\n    & .ec-time {\n        @apply text-gray-400 dark:text-gray-400;\n    }\n    & .ec-event {\n        /* We need to apply hover using our custom class since one event is split into multiple elements if wrapped inside multiple calendar rows */\n        &.gu-hover {\n            /*@apply bg-red-400;*/\n            @apply text-[var(--hover-text)] dark:text-[var(--dark-hover-text)] bg-[var(--hover-bg)] dark:bg-[var(--dark-hover-bg)];\n        }\n\n        &.gu-context-menu-open {\n            @apply text-[var(--hover-text)] dark:text-[var(--dark-hover-text)] bg-[var(--hover-bg)] dark:bg-[var(--dark-hover-bg)];\n        }\n    }\n}\n"
  },
  {
    "path": "resources/js/calendar-context-menu.js",
    "content": "export default function calendarContextMenu({\n                                                getContextMenuActionsUsing,\n                                            }) {\n    return {\n        open: false,\n\n        size: {\n            width: 0,\n            height: 0,\n        },\n        position: {\n            x: 0,\n            y: 0,\n        },\n        mountData: {},\n        context: null,\n        actions: [],\n        isLoading: false,\n        onCloseCallback: null,\n\n        menu: {\n            ['x-show']() {\n                return this.open\n            },\n            ['x-bind:style']() {\n                return `\n                    position: absolute;\n                    z-index: 40;\n                    top: ${this.position.y}px;\n                    left: ${this.position.x}px;\n                `\n            },\n            ['x-on:click.away']() {\n                this.closeMenu()\n            }\n        },\n\n        init: async function () {\n            const menu = this.$el.querySelector('[x-bind=\"menu\"]')\n            this.size = {\n                width: menu.offsetWidth,\n                height: menu.offsetHeight,\n            }\n\n            this.$el.addEventListener('calendar--open-menu', (event) => this.openMenu(event))\n        },\n\n        loadActions: async function (context, data = {}) {\n            this.isLoading = true\n            this.actions = []\n            getContextMenuActionsUsing(context, data)\n                .then((actions) => {\n                    this.actions = actions\n                })\n                .finally(() => this.isLoading = false)\n        },\n\n        openMenu: async function (event, eventElement = null) {\n            this.$nextTick(() => {\n                const clientX = event.clientX;\n                const clientY = event.clientY;\n                const pageX = event.pageX;\n                const pageY = event.pageY;\n\n                const offsetX = clientX + this.size.width > window.innerWidth\n                    ? clientX + this.size.width - window.innerWidth\n                    : 0;\n                const offsetY = clientY + this.size.height > window.innerHeight\n                    ? clientY + this.size.height - window.innerHeight\n                    : 0;\n\n                this.position.x = pageX - offsetX;\n                this.position.y = pageY - offsetY;\n                this.open = true;\n\n                if (eventElement) {\n                    const eventId = eventElement.getAttribute('data-event-id')\n\n                    document.querySelectorAll(`.ec-event[data-event-id=\"${eventId}\"]`).forEach(\n                        el => el.classList.add('gu-context-menu-open')\n                    )\n                }\n            });\n        },\n\n        closeMenu: function () {\n            this.open = false;\n\n            document.querySelectorAll('.ec-event.gu-context-menu-open').forEach(\n                event => event.classList.remove('gu-context-menu-open')\n            )\n            if (this.onCloseCallback) {\n                this.onCloseCallback();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "resources/js/calendar-event.js",
    "content": "export default function calendarEvent({\n                                          event,\n                                          timeText,\n                                          view,\n                                          hasContextMenu,\n                                      }\n) {\n    return {\n        event,\n        contextMenu: null,\n\n        init: function () {\n            if (hasContextMenu) {\n                this.initializeContextMenu()\n            }\n            this.$el.setAttribute('data-event-id', event.id)\n\n            this.$el.addEventListener('mouseenter', () => {\n                document.querySelectorAll(`.ec-event[data-event-id=\"${event.id}\"]`).forEach(el => {\n                    el.classList.add('gu-hover')\n                })\n            })\n\n            this.$el.addEventListener('mouseleave', () => {\n                document.querySelectorAll(`.ec-event[data-event-id=\"${event.id}\"]`).forEach(el => {\n                    el.classList.remove('gu-hover')\n                })\n            })\n            // Preloading\n            // this.$el.addEventListener('mouseenter', () => {\n            //     this.contextMenu.loadActions(this.event)\n            // })\n        },\n\n        initializeContextMenu: function () {\n            const element = document.querySelector('[calendar-context-menu]')\n            this.contextMenu = Alpine.$data(element)\n        },\n\n        /**\n         * Called when an event is clicked, if event clicking is enabled in the calendar.\n         * @param info\n         */\n        onClick: function (info) {\n            if (info.event.extendedProps.url) {\n                window.open(\n                    this.event.extendedProps.url,\n                    this.event.extendedProps.url_target ?? '_blank'\n                )\n                return\n            }\n\n            const data = {\n                event: info.event,\n                view: info.view,\n                tzOffset: -new Date().getTimezoneOffset()\n            }\n\n            if (hasContextMenu) {\n                this.contextMenu.loadActions('eventClick', data)\n                this.contextMenu.openMenu(\n                    info.jsEvent,\n                    this.$el\n                )\n                return\n            }\n\n            this.$wire.onEventClickJs(data)\n        },\n    }\n}\n"
  },
  {
    "path": "resources/js/calendar.js",
    "content": "export default function calendar({\n                                     view = 'dayGridMonth',\n                                     locale = 'en',\n                                     firstDay = 1,\n                                     dayMaxEvents = false,\n                                     eventContent = null,\n                                     eventClickEnabled = false,\n                                     eventDragEnabled = false,\n                                     eventResizeEnabled = false,\n                                     noEventsClickEnabled = false,\n                                     dateClickEnabled = false,\n                                     dateSelectEnabled = false,\n                                     datesSetEnabled = false,\n                                     viewDidMountEnabled = false,\n                                     eventAllUpdatedEnabled = false,\n                                     hasDateClickContextMenu = null,\n                                     hasDateSelectContextMenu = null,\n                                     hasEventClickContextMenu = null,\n                                     hasNoEventsClickContextMenu = null,\n                                     resources = null,\n                                     resourceLabelContent = null,\n                                     theme = null,\n                                     options = {},\n                                     eventAssetUrl,\n                                 }\n) {\n    return {\n\n        init: function () {\n            const ec = this.mountCalendar()\n\n            window.addEventListener('calendar--refresh', () => {\n                ec.refetchEvents()\n            })\n\n            this.$wire.on('calendar--set', (data) => {\n                ec.setOption(data.key, data.value)\n            })\n        },\n\n        mountCalendar: function () {\n            return EventCalendar.create(\n                this.$el.querySelector('[data-calendar]'),\n                this.getSettings(),\n            )\n        },\n\n        getSettings: function () {\n            let settings = {\n                view: view,\n                locale: locale,\n                firstDay: firstDay,\n                dayMaxEvents: dayMaxEvents,\n                eventSources: [\n                    {\n                        events: (fetchInfo) => this.$wire.getEventsJs({\n                            ...fetchInfo,\n                            tzOffset: -new Date().getTimezoneOffset(),\n                        })\n                    }\n                ],\n                resources: resources,\n                selectable: dateSelectEnabled,\n                eventStartEditable: eventDragEnabled,\n                eventDurationEditable: eventResizeEnabled,\n                dayCellFormat: (date) => date.getDate().toString()\n            }\n\n            if (eventContent !== null) {\n                settings.eventContent = (info) => {\n                    const model = info.event.extendedProps.model\n                    const content = eventContent[model] ?? eventContent['_default']\n\n                    if (content === undefined) {\n                        return undefined\n                    }\n\n                    return {\n                        html: content,\n                    }\n                }\n            }\n\n            if (resourceLabelContent !== null) {\n                settings.resourceLabelContent = (info) => {\n                    const model = info.resource.extendedProps.model\n                    const content = resourceLabelContent[model] ?? resourceLabelContent['_default']\n\n                    if (content === undefined) {\n                        return undefined\n                    }\n\n                    return {\n                        html: this.wrapContent(content, info),\n                    }\n                };\n            }\n\n            if (dateClickEnabled) {\n                settings.dateClick = (info) => {\n                    const data = {\n                        date: info.date,\n                        dateStr: info.dateStr,\n                        allDay: info.allDay,\n                        view: info.view,\n                        resource: info.resource,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    }\n\n                    if (hasDateClickContextMenu) {\n                        this.openContextMenu(info.jsEvent, data, 'dateClick')\n                    } else {\n                        this.$wire.onDateClickJs(data)\n                    }\n                }\n            }\n\n            if (dateSelectEnabled) {\n                settings.select = (info) => {\n                    const data = {\n                        start: info.start,\n                        startStr: info.startStr,\n                        end: info.end,\n                        endStr: info.endStr,\n                        allDay: info.allDay,\n                        view: info.view,\n                        resource: info.resource,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    }\n\n                    if (hasDateSelectContextMenu) {\n                        this.openContextMenu(info.jsEvent, data, 'dateSelect')\n                    } else {\n                        this.$wire.onDateSelectJs(data)\n                    }\n                }\n            }\n\n            if (datesSetEnabled) {\n                settings.datesSet = (info) => {\n                    this.$wire.onDatesSetJs({\n                        start: info.start,\n                        startStr: info.startStr,\n                        end: info.end,\n                        endStr: info.endStr,\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    })\n                }\n            }\n\n            if (eventClickEnabled) {\n                settings.eventClick = (info) => {\n                    const component = Alpine.$data(info.el)\n                    component.onClick(info)\n                }\n            }\n\n            settings.eventResize = async (info) => {\n                const durationEditable = info.event.durationEditable\n                let enabled = eventResizeEnabled\n\n                if (durationEditable !== undefined) {\n                    enabled = durationEditable\n                }\n\n                if (enabled) {\n                    await this.$wire.onEventResizeJs({\n                        event: info.event,\n                        oldEvent: info.oldEvent,\n                        endDelta: info.endDelta,\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    }).then((result) => {\n                        if (result === false) {\n                            info.revert()\n                        }\n                    })\n                }\n            };\n\n            settings.eventDrop = async (info) => {\n                const startEditable = info.event.startEditable\n                let enabled = eventDragEnabled\n\n                if (startEditable !== undefined) {\n                    enabled = startEditable\n                }\n\n                if (enabled) {\n                    await this.$wire.onEventDropJs({\n                        event: info.event,\n                        oldEvent: info.oldEvent,\n                        oldResource: info.oldResource,\n                        newResource: info.newResource,\n                        delta: info.delta,\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    }).then((result) => {\n                        if (result === false) {\n                            info.revert()\n                        }\n                    })\n                }\n            }\n\n            settings.eventDidMount = (info) => {\n                info.el.setAttribute('x-load')\n                info.el.setAttribute('x-load-src', eventAssetUrl)\n                info.el.setAttribute('x-data', `calendarEvent({\n                    event: ${JSON.stringify(info.event)},\n                    timeText: \"${info.timeText}\",\n                    view: ${JSON.stringify(info.view)},\n                    hasContextMenu: ${hasEventClickContextMenu},\n                })`)\n            }\n\n            if (noEventsClickEnabled) {\n                settings.noEventsClick = (info) => {\n                    const data = {\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    }\n\n                    if (hasNoEventsClickContextMenu) {\n                        this.openContextMenu(info.jsEvent, data, 'noEventsClick')\n                    } else {\n                        this.$wire.onNoEventsClickJs(data)\n                    }\n                }\n            }\n\n            if (viewDidMountEnabled) {\n                settings.viewDidMount = (info) => {\n                    this.$wire.onViewDidMountJs({\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    })\n                }\n            }\n\n            if (eventAllUpdatedEnabled) {\n                settings.eventAllUpdated = (info) => {\n                    this.$wire.onEventAllUpdatedJs({\n                        view: info.view,\n                        tzOffset: -new Date().getTimezoneOffset()\n                    })\n                }\n            }\n\n            if (theme) {\n                settings.theme = function (defaultTheme) {\n                    return {\n                        ...defaultTheme,\n                        ...theme\n                    }\n                }\n            }\n\n            return {\n                ...settings,\n                ...options,\n            }\n        },\n\n        wrapContent: function (content, info) {\n            let container = document.createElement('div')\n            container.innerHTML = content\n\n            // Add alpine data and classes\n            container.setAttribute('x-data', JSON.stringify(info))\n            container.classList.add('w-full')\n\n            // Get the modified HTML\n            return container.outerHTML\n        },\n\n        openContextMenu: function (jsEvent, data, context) {\n            const element = document.querySelector('[calendar-context-menu]')\n            const contextMenu = Alpine.$data(element)\n            contextMenu.loadActions(context, data)\n            contextMenu.openMenu(jsEvent)\n        }\n    }\n}\n"
  },
  {
    "path": "resources/lang/cs/translations.php",
    "content": "<?php\n\nreturn [\n    'heading' => 'Kalendář',\n];\n"
  },
  {
    "path": "resources/lang/de/translations.php",
    "content": "<?php\n\nreturn [\n    'heading' => 'Kalender',\n];\n"
  },
  {
    "path": "resources/lang/en/translations.php",
    "content": "<?php\n\nreturn [\n    'heading' => 'Calendar',\n];\n"
  },
  {
    "path": "resources/lang/fr/translations.php",
    "content": "<?php\n\nreturn [\n    'heading' => 'Calendrier',\n];\n"
  },
  {
    "path": "resources/views/.gitkeep",
    "content": ""
  },
  {
    "path": "resources/views/components/context-menu.blade.php",
    "content": "@php\n    use Filament\\Support\\Facades\\FilamentAsset;\n    use Guava\\Calendar\\Enums\\Context;\n\n    use function Filament\\Support\\generate_loading_indicator_html;\n@endphp\n\n<div x-ignore\n     x-load\n     x-load-src=\"{{ FilamentAsset::getAlpineComponentSrc('calendar-context-menu', 'guava/calendar') }}\"\n     x-data=\"calendarContextMenu({\n            getContextMenuActionsUsing: async (context, data) => {\n                return await $wire.getContextMenuActionsUsing(context, data)\n            },\n         })\"\n     calendar-context-menu\n     {{--     x-teleport=\"body\"--}}\n     class=\"absolute top-0 left-0 z-30\"\n>\n    <div x-bind=\"menu\"\n         x-transition:enter-start=\"fi-opacity-0\" x-transition:leave-end=\"fi-opacity-0\"\n        @class([\n           \"fi-dropdown-panel absolute w-screen max-w-xs divide-y divide-gray-100 rounded-lg bg-white shadow-lg ring-1 ring-gray-950/5 transition dark:divide-white/5 dark:bg-gray-800 dark:ring-white/10\",\n       ])\n    >\n        {{--        <div class=\"w-full flex items-center justify-center p-2\">{{generate_loading_indicator_html()}}</div>--}}\n        <div wire:loading.flex wire:target=\"getContextMenuActionsUsing\" class=\"w-full flex items-center justify-center p-2\">{{generate_loading_indicator_html()}}</div>\n        <x-filament::dropdown.list>\n            {{--                    <div x-html=\"renderedActions\"></div>--}}\n            <template x-for=\"action in actions\">\n                <div x-html=\"action\"></div>\n            </template>\n            {{--                    @foreach ($dateClickContextMenuActions as $action)--}}\n            {{--                        {{ $action }}--}}\n            {{--                    @endforeach--}}\n        </x-filament::dropdown.list>\n        <div>\n            {{--                <x-filament::dropdown.list x-show=\"context == '{{Context::DateClick}}'\">--}}\n            {{--                    @foreach ($dateClickContextMenuActions as $action)--}}\n            {{--                        {{ $action }}--}}\n            {{--                    @endforeach--}}\n            {{--                </x-filament::dropdown.list>--}}\n            {{--                <x-filament::dropdown.list x-show=\"context == '{{Context::DateSelect}}'\">--}}\n            {{--                    @foreach ($dateSelectContextMenuActions as $action)--}}\n            {{--                        {{ $action }}--}}\n            {{--                    @endforeach--}}\n            {{--                </x-filament::dropdown.list>--}}\n            {{--            <x-filament::dropdown.list>--}}\n            {{--                @foreach ($eventClickContextMenuActions as $action)--}}\n            {{--                    {{ $action }}--}}\n            {{--                @endforeach--}}\n            {{--            </x-filament::dropdown.list>--}}\n            {{--                <x-filament::dropdown.list x-show=\"context == '{{Context::NoEventsClick}}'\">--}}\n            {{--                    @foreach ($noEventsClickContextMenuActions as $action)--}}\n            {{--                        {{ $action }}--}}\n            {{--                    @endforeach--}}\n            {{--                </x-filament::dropdown.list>--}}\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "resources/views/widgets/calendar-widget.blade.php",
    "content": "@php\n    use Filament\\Support\\Facades\\FilamentAsset;\n    use Guava\\Calendar\\Enums\\Context;\n    use Filament\\Support\\Facades\\FilamentColor;\n    use Filament\\Support\\View\\Components\\ButtonComponent;\n@endphp\n\n<x-filament-widgets::widget>\n    <x-filament::section\n        :after-header=\"$this->getCachedHeaderActionsComponent()\"\n        :footer=\"$this->getCachedFooterActionsComponent()\"\n    >\n\n        <style>\n            .ec-event.ec-preview,\n            .ec-now-indicator {\n                z-index: 30;\n            }\n        </style>\n\n        @if($heading = $this->getHeading())\n            <x-slot name=\"heading\">\n                {{ $this->getHeading() }}\n            </x-slot>\n        @endif\n\n        <div\n            wire:ignore\n            x-load\n            x-load-src=\"{{ FilamentAsset::getAlpineComponentSrc('calendar', 'guava/calendar') }}\"\n            x-data=\"calendar({\n                view: @js($this->getCalendarView()),\n                locale: @js($this->getLocale()),\n                firstDay: @js($this->getFirstDay()),\n                dayMaxEvents: @js($this->getDayMaxEvents()),\n                eventContent: @js($this->getEventContentJs()),\n                eventClickEnabled: @js($this->isEventClickEnabled()),\n                eventDragEnabled: @js($this->isEventDragEnabled()),\n                eventResizeEnabled: @js($this->isEventResizeEnabled()),\n                noEventsClickEnabled: @js($this->isNoEventsClickEnabled()),\n                dateClickEnabled: @js($this->isDateClickEnabled()),\n                dateSelectEnabled: @js($this->isDateSelectEnabled()),\n                datesSetEnabled: @js($this->isDatesSetEnabled()),\n                viewDidMountEnabled: @js($this->isViewDidMountEnabled()),\n                eventAllUpdatedEnabled: @js($this->isEventAllUpdatedEnabled()),\n                hasDateClickContextMenu: @js($this->hasContextMenu(Context::DateClick)),\n                hasDateSelectContextMenu: @js($this->hasContextMenu(Context::DateSelect)),\n                hasEventClickContextMenu: @js($this->hasContextMenu(Context::EventClick)),\n                hasNoEventsClickContextMenu: @js($this->hasContextMenu(Context::NoEventsClick)),\n                resources: @js($this->getResourcesJs()),\n                resourceLabelContent: @js($this->getResourceLabelContentJs()),\n                theme: @js($this->getTheme()),\n                options: @js($this->getOptions()),\n                eventAssetUrl: @js(FilamentAsset::getAlpineComponentSrc('calendar-event', 'guava/calendar')),\n            })\"\n            @class(FilamentColor::getComponentClasses(ButtonComponent::class, 'primary'))\n        >\n            <div data-calendar></div>\n            @if($this->hasContextMenu())\n                <x-guava-calendar::context-menu/>\n            @endif\n        </div>\n    </x-filament::section>\n        <x-filament-actions::modals/>\n</x-filament-widgets::widget>\n"
  },
  {
    "path": "src/Attributes/CalendarEventContent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Attributes;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\n#[\\Attribute(\\Attribute::TARGET_METHOD)]\nclass CalendarEventContent\n{\n    /**\n     * @param  class-string<Model>  $model\n     */\n    public function __construct(public string $model) {}\n}\n"
  },
  {
    "path": "src/Attributes/CalendarResourceLabelContent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Attributes;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\n#[\\Attribute(\\Attribute::TARGET_METHOD)]\nclass CalendarResourceLabelContent\n{\n    /**\n     * @param  class-string<Model>  $model\n     */\n    public function __construct(public string $model) {}\n}\n"
  },
  {
    "path": "src/Attributes/CalendarSchema.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Attributes;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\n#[\\Attribute(\\Attribute::TARGET_METHOD)]\nclass CalendarSchema\n{\n    /**\n     * @param  class-string<Model>  $model\n     */\n    public function __construct(public string $model) {}\n}\n"
  },
  {
    "path": "src/CalendarPlugin.php",
    "content": "<?php\n\nnamespace Guava\\Calendar;\n\nuse Filament\\Contracts\\Plugin;\nuse Filament\\Panel;\n\nclass CalendarPlugin implements Plugin\n{\n    public function getId(): string\n    {\n        return 'guava-calendar';\n    }\n\n    public function register(Panel $panel): void {}\n\n    public function boot(Panel $panel): void {}\n\n    public static function make(): static\n    {\n        return app(static::class);\n    }\n}\n"
  },
  {
    "path": "src/CalendarServiceProvider.php",
    "content": "<?php\n\nnamespace Guava\\Calendar;\n\nuse Filament\\Support\\Assets\\AlpineComponent;\nuse Filament\\Support\\Assets\\Css;\nuse Filament\\Support\\Assets\\Js;\nuse Filament\\Support\\Facades\\FilamentAsset;\nuse Spatie\\LaravelPackageTools\\Package;\nuse Spatie\\LaravelPackageTools\\PackageServiceProvider;\n\nclass CalendarServiceProvider extends PackageServiceProvider\n{\n    public function configurePackage(Package $package): void\n    {\n        /*\n         * This class is a Package Service Provider\n         *\n         * More info: https://github.com/spatie/laravel-package-tools\n         */\n        $package\n            ->name('guava-calendar')\n            ->hasTranslations()\n            ->hasViews()\n        ;\n    }\n\n    public function packageBooted(): void\n    {\n        FilamentAsset::register(\n            assets: [\n                AlpineComponent::make(\n                    'calendar',\n                    __DIR__ . '/../dist/js/calendar.js',\n                ),\n                AlpineComponent::make(\n                    'calendar-context-menu',\n                    __DIR__ . '/../dist/js/calendar-context-menu.js',\n                ),\n                AlpineComponent::make(\n                    'calendar-event',\n                    __DIR__ . '/../dist/js/calendar-event.js',\n                ),\n                Css::make('calendar-styles', 'https://cdn.jsdelivr.net/npm/@event-calendar/build@5.5.1/dist/event-calendar.min.css'),\n                Js::make('calendar-script', 'https://cdn.jsdelivr.net/npm/@event-calendar/build@5.5.1/dist/event-calendar.min.js'),\n            ],\n            package: 'guava/calendar'\n        );\n    }\n}\n"
  },
  {
    "path": "src/Concerns/CalendarAction.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\DateClickInfo;\nuse Guava\\Calendar\\ValueObjects\\DateSelectInfo;\nuse Guava\\Calendar\\ValueObjects\\EventClickInfo;\nuse Guava\\Calendar\\ValueObjects\\NoEventsClickInfo;\n\ntrait CalendarAction\n{\n    protected function resolveDefaultClosureDependencyForEvaluationByType(string $parameterType): array\n    {\n        /** @var InteractsWithCalendar $livewire */\n        $livewire = $this->getLivewire();\n\n        // Action is used outside the calendar\n        if (! ($livewire instanceof HasCalendar)) {\n            return parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType);\n        }\n\n        $expectedContext = match ($parameterType) {\n            DateClickInfo::class => Context::DateClick,\n            DateSelectInfo::class => Context::DateSelect,\n            EventClickInfo::class => Context::EventClick,\n            NoEventsClickInfo::class => Context::NoEventsClick,\n            ContextualInfo::class => null,\n            default => false,\n        };\n\n        if ($expectedContext !== false) {\n            $contextInfo = $livewire->getCalendarContextInfo();\n\n            return ($expectedContext === null || $contextInfo->getContext() === $expectedContext)\n                ? [$contextInfo]\n                : [null];\n        }\n\n        return parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType);\n    }\n}\n"
  },
  {
    "path": "src/Concerns/CanRefreshCalendar.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait CanRefreshCalendar\n{\n    public function refreshRecords(): static\n    {\n        $this->dispatch('calendar--refresh');\n\n        return $this;\n    }\n\n    public function refreshResources(): static\n    {\n        $this->setOption('resources', $this->getResourcesJs());\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/CanUseFilamentTimezone.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait CanUseFilamentTimezone\n{\n    protected bool $useFilamentTimezone = false;\n\n    public function shouldUseFilamentTimezone(): bool\n    {\n        return $this->useFilamentTimezone;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesDateClick.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\DateClickInfo;\nuse phpDocumentor\\Reflection\\Types\\This;\n\ntrait HandlesDateClick\n{\n    /**\n     * Sets whether clicking on a date cell should be enabled for the calendar or not.\n     *\n     * To enable date click, set this to true and override `onDateClick` to implement your logic.\n     */\n    protected bool $dateClickEnabled = false;\n\n    /**\n     * Implement your date click logic here.\n     *\n     * This method will only be fired when `$dateClickEnabled` is set to true.\n     *\n     * @param  DateClickInfo  $info  contains information about the clicked date cell\n     */\n    protected function onDateClick(DateClickInfo $info): void {}\n\n    /**\n     * Sets whether clicking on a date cell should be enabled for the calendar or not.\n     *\n     * To enable date click, return true and override `onDateClick` to implement your logic.\n     */\n    public function isDateClickEnabled(): bool\n    {\n        return $this->dateClickEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onDateClick` instead\n     */\n    public function onDateClickJs(array $data): void\n    {\n        // Check if date click is enabled\n        if (! $this->isDateClickEnabled()) {\n            return;\n        }\n\n        $this->setRawCalendarContextData(Context::DateClick, $data);\n\n        $this->onDateClick($this->getCalendarContextInfo());\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesDateSelect.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\DateSelectInfo;\n\ntrait HandlesDateSelect\n{\n    /**\n     * Sets whether selecting a date range should be enabled for the calendar or not.\n     *\n     * To enable date select, set this to true and override `onDateSelect` to implement your logic.\n     */\n    protected bool $dateSelectEnabled = false;\n\n    /**\n     * Implement your date select logic here.\n     *\n     * This method will only be fired when `$dateSelectEnabled` is set to true.\n     *\n     * @param  DateSelectInfo  $info  contains information about the selected date range\n     */\n    protected function onDateSelect(DateSelectInfo $info): void {}\n\n    /**\n     * Sets whether selecting a date range should be enabled for the calendar or not.\n     *\n     * To enable date select, return true and override `onDateSelect` to implement your logic.\n     */\n    public function isDateSelectEnabled(): bool\n    {\n        return $this->dateSelectEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onDateSelect` instead\n     */\n    public function onDateSelectJs(array $data): void\n    {\n        // Check if date select is enabled\n        if (! $this->isDateSelectEnabled()) {\n            return;\n        }\n\n        $this->setRawCalendarContextData(Context::DateSelect, $data);\n\n        $this->onDateSelect($this->getCalendarContextInfo());\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesDatesSet.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\ValueObjects\\DatesSetInfo;\n\ntrait HandlesDatesSet\n{\n    /**\n     * Sets whether the Dates Set callback should be enabled or not.\n     *\n     * To enable the Dates Set callback, set this to true and override `onDatesSet` to implement your logic.\n     */\n    protected bool $datesSetEnabled = false;\n\n    /**\n     * Implement your dates set callback logic here.\n     *\n     * This method will only be fired when `$datesSetEnabled` is set to true.\n     *\n     * When enabled, this will be called when the date range of the calendar was originally set or changed by clicking the previous/next buttons, changing the view, manipulating the current date via the API, etc.\n     *\n     * @param  DatesSetInfo  $info  contains information about the current calendar view\n     */\n    protected function onDatesSet(DatesSetInfo $info): void {}\n\n    /**\n     * Sets whether the Dates Set callback be enabled or not.\n     *\n     * To enable the Dates Set callback, return true and override `onDatesSet` to implement your logic.\n     */\n    public function isDatesSetEnabled(): bool\n    {\n        return $this->datesSetEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onDatesSet` instead\n     */\n    public function onDatesSetJs(array $data): void\n    {\n        // Check if dates set is enabled\n        if (! $this->isDatesSetEnabled()) {\n            return;\n        }\n\n        $this->onDatesSet(new DatesSetInfo($data, $this->shouldUseFilamentTimezone()));\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesEventAllUpdated.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\ValueObjects\\EventAllUpdatedInfo;\n\ntrait HandlesEventAllUpdated\n{\n    protected bool $eventAllUpdatedEnabled = false;\n\n    protected function onEventAllUpdated(EventAllUpdatedInfo $info): void {}\n\n    public function isEventAllUpdatedEnabled(): bool\n    {\n        return $this->eventAllUpdatedEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onEventAllUpdated()` instead\n     */\n    public function onEventAllUpdatedJs(array $info): void\n    {\n        // Check if dates set is enabled\n        if (! $this->isEventAllUpdatedEnabled()) {\n            return;\n        }\n\n        $this->onEventAllUpdated(new EventAllUpdatedInfo($info, $this->shouldUseFilamentTimezone()));\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesEventClick.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\EventClickInfo;\nuse Illuminate\\Database\\Eloquent\\Model;\n\ntrait HandlesEventClick\n{\n    protected bool $eventClickEnabled = false;\n\n    protected ?string $defaultEventClickAction = 'view';\n\n    /**\n     * @throws \\Exception\n     */\n    protected function onEventClick(EventClickInfo $info, Model $event, ?string $action = null): void\n    {\n        // No action to trigger\n        if (! $action) {\n            return;\n        }\n\n        $this->mountAction($action);\n    }\n\n    public function isEventClickEnabled(): bool\n    {\n        return $this->eventClickEnabled;\n    }\n\n    public function getDefaultEventClickAction(): ?string\n    {\n        return $this->evaluate($this->defaultEventClickAction);\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onEventClick` instead\n     */\n    public function onEventClickJs(array $data = [], ?string $action = null): void\n    {\n        // Check if event click is enabled\n        if (! $this->isEventClickEnabled()) {\n            return;\n        }\n\n        $this->setRawCalendarContextData(Context::EventClick, $data);\n\n        $action ??= $this->getRawCalendarContextData('event.extendedProps.action');\n        $action ??= $this->getDefaultEventClickAction();\n\n        // TODO: Similar to how Schemas work, allow users to define a method for each Event Model Type\n        // TODO: using attributes. such as #[CalendarEventClick(Sprint::class)] above a method\n        // TODO: such as onSprintEventClick would be only called for Sprint.\n        $this->onEventClick($this->getCalendarContextInfo(), $this->getEventRecord(), $action);\n    }\n\n    // TODO: Might be worth looking into to automatically choose between view /edit action based on the permissions\n    //\n    //    protected function resolveDefaultEventClickAction() {\n    //        foreach (['view', 'edit'] as $action) {\n    //            $action = $this->getAction($action);\n    //\n    //            if (! $action) {\n    //                continue;\n    //            }\n    //\n    //            $action = clone $action;\n    //\n    //            $action->record($record);\n    //            $action->getGroup()?->record($record);\n    //\n    //            if ($action->isHidden()) {\n    //                continue;\n    //            }\n    //\n    //            $url = $action->getUrl();\n    //\n    //            if (! $url) {\n    //                continue;\n    //            }\n    //\n    //            return $url;\n    //        }\n    //\n    //    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesEventDragAndDrop.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\EventDropInfo;\nuse Illuminate\\Database\\Eloquent\\Model;\n\ntrait HandlesEventDragAndDrop\n{\n    protected bool $eventDragEnabled = false;\n\n    // TODO: Add a default implementation\n    // TODO: for that we need to add two methods to Eventable interface:\n    // TODO: -> getStartAttribute()\n    // TODO: -> getEndAttribute()\n    // TODO: where the user needs to define which attributes is the start/end date\n    // TODO: Then we can handle the update outselves by default\n    protected function onEventDrop(EventDropInfo $info, Model $event): bool\n    {\n        return true;\n    }\n\n    public function isEventDragEnabled(): bool\n    {\n        return $this->eventDragEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onEventDrop()` instead\n     */\n    public function onEventDropJs(array $data): bool\n    {\n        // Check if event drag and drop is enabled\n        if (! $this->isEventDragEnabled()) {\n            return false;\n        }\n\n        $this->setRawCalendarContextData(Context::EventDragAndDrop, $data);\n\n        return $this->onEventDrop($this->getCalendarContextInfo(), $this->getEventRecord());\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesEventResize.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\EventResizeInfo;\nuse Illuminate\\Database\\Eloquent\\Model;\n\ntrait HandlesEventResize\n{\n    protected bool $eventResizeEnabled = false;\n\n    // TODO: Add a default implementation\n    // TODO: for that we need to add two methods to Eventable interface:\n    // TODO: -> getStartAttribute()\n    // TODO: -> getEndAttribute()\n    // TODO: where the user needs to define which attributes is the start/end date\n    // TODO: Then we can handle the update outselves by default\n    protected function onEventResize(EventResizeInfo $info, Model $event): bool\n    {\n        return true;\n    }\n\n    public function isEventResizeEnabled(): bool\n    {\n        return $this->eventResizeEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onEventResize()` instead\n     */\n    public function onEventResizeJs(array $data): bool\n    {\n        // Check if event resize is enabled\n        if (! $this->isEventResizeEnabled()) {\n            return false;\n        }\n\n        $this->setRawCalendarContextData(Context::EventResize, $data);\n\n        return $this->onEventResize($this->getCalendarContextInfo(), $this->getEventRecord());\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesNoEventsClick.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\NoEventsClickInfo;\n\ntrait HandlesNoEventsClick\n{\n    protected bool $noEventsClickEnabled = false;\n\n    protected function onNoEventsClick(NoEventsClickInfo $info): void {}\n\n    public function isNoEventsClickEnabled(): bool\n    {\n        return $this->noEventsClickEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onDateClick` instead\n     */\n    public function onNoEventsClickJs(array $data): void\n    {\n        // Check if no events click is enabled\n        if (! $this->isNoEventsClickEnabled()) {\n            return;\n        }\n\n        $this->setRawCalendarContextData(Context::NoEventsClick, $data);\n\n        $this->onNoEventsClick($this->getCalendarContextInfo());\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HandlesViewDidMount.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\ValueObjects\\ViewDidMountInfo;\n\ntrait HandlesViewDidMount\n{\n    protected bool $viewDidMountEnabled = false;\n\n    protected function onViewDidMount(ViewDidMountInfo $info): void {}\n\n    public function isViewDidMountEnabled(): bool\n    {\n        return $this->viewDidMountEnabled;\n    }\n\n    /**\n     * @internal Do not override, internal purpose only. Use `onViewDidMount` instead\n     */\n    public function onViewDidMountJs(array $data): void\n    {\n        // Check if viewDidMount is enabled\n        if (! $this->isViewDidMountEnabled()) {\n            return;\n        }\n\n        $this->onViewDidMount(new ViewDidMountInfo($data, $this->shouldUseFilamentTimezone()));\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasAuthorization.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Illuminate\\Auth\\Access\\Response;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nuse function Filament\\get_authorization_response;\n\ntrait HasAuthorization\n{\n    protected bool $shouldSkipAuthorization = false;\n\n    public function shouldSkipAuthorization(): bool\n    {\n        return $this->shouldSkipAuthorization;\n    }\n\n    public function getAuthorizationResponse(string $action, null | Model | string $recordOrModel = null): Response\n    {\n        $action = $this->transformActionName($action);\n\n        if ($this->shouldSkipAuthorization()) {\n            return Response::allow();\n        }\n\n        return get_authorization_response($action, $recordOrModel);\n        //        return get_authorization_response($action, $this->getEventRecord(), static::shouldCheckPolicyExistence());\n    }\n\n    /**\n     * Filament uses 'edit' while laravel uses 'update'.\n     * This transforms the action name so laravel's default policy names work.\n     */\n    protected function transformActionName(string $action): string\n    {\n        return match ($action) {\n            'edit' => 'update',\n            default => $action,\n        };\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasCalendarContextData.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\nuse Guava\\Calendar\\ValueObjects\\DateClickInfo;\nuse Guava\\Calendar\\ValueObjects\\DateSelectInfo;\nuse Guava\\Calendar\\ValueObjects\\EventClickInfo;\nuse Guava\\Calendar\\ValueObjects\\EventDropInfo;\nuse Guava\\Calendar\\ValueObjects\\EventResizeInfo;\nuse Guava\\Calendar\\ValueObjects\\NoEventsClickInfo;\n\ntrait HasCalendarContextData\n{\n    protected ?array $rawCalendarContextData = null;\n\n    protected function setRawCalendarContextData(Context $context, array $data): void\n    {\n        $this->rawCalendarContextData = [\n            'context' => $context,\n            'data' => $data,\n            'useFilamentTimezone' => $this->shouldUseFilamentTimezone(),\n        ];\n\n        if ($context->interactsWithRecord()) {\n            $this->resolveEventRecord();\n        }\n    }\n\n    public function getRawCalendarContextData(?string $key = null): array | string | null\n    {\n        if ($key) {\n            return data_get($this->rawCalendarContextData, \"data.$key\");\n        }\n\n        if (empty($data = $this->rawCalendarContextData)) {\n            return null;\n        }\n\n        return $data;\n    }\n\n    public function getCalendarContextInfo(): ?ContextualInfo\n    {\n        $rawContextData = $this->getRawCalendarContextData() ?? $this->getMountedAction()?->getArguments();\n\n        // No contextual data available\n        if (! $rawContextData) {\n            return null;\n        }\n\n        $context = data_get($rawContextData, 'context');\n        $data = data_get($rawContextData, 'data');\n        $useFilamentTimezone = data_get($rawContextData, 'useFilamentTimezone');\n\n        if (is_string($context)) {\n            $context = Context::from($context);\n        }\n\n        return match ($context) {\n            Context::DateClick => new DateClickInfo($data, $useFilamentTimezone),\n            Context::DateSelect => new DateSelectInfo($data, $useFilamentTimezone),\n            Context::EventClick => new EventClickInfo($data, $this->getEventRecord(), $useFilamentTimezone),\n            Context::NoEventsClick => new NoEventsClickInfo($data, $useFilamentTimezone),\n            Context::EventResize => new EventResizeInfo($data, $this->getEventRecord(), $useFilamentTimezone),\n            Context::EventDragAndDrop => new EventDropInfo($data, $this->getEventRecord(), $useFilamentTimezone),\n        };\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasCalendarView.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Enums\\CalendarViewType;\n\ntrait HasCalendarView\n{\n    protected CalendarViewType $calendarView = CalendarViewType::DayGridMonth;\n\n    public function getCalendarView(): CalendarViewType\n    {\n        return $this->calendarView;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasContextMenu.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Actions\\Action;\nuse Guava\\Calendar\\Enums\\Context;\nuse Illuminate\\Support\\Collection;\nuse InvalidArgumentException;\n\ntrait HasContextMenu\n{\n    protected array $cachedContextMenuActions = [];\n\n    public function bootedHasContextMenu(): void\n    {\n        $this->cacheContextMenuActions();\n    }\n\n    public function getContextMenuActionsUsing(Context $context, array $data = []): Collection\n    {\n        $this->setRawCalendarContextData($context, $data);\n\n        $actions = match ($context) {\n            Context::EventClick => $this->getCachedEventClickContextMenuActions(),\n            Context::DateClick => $this->getCachedDateClickContextMenuActions(),\n            Context::DateSelect => $this->getCachedDateSelectContextMenuActions(),\n            Context::NoEventsClick => $this->getCachedNoEventsClickContextMenuActions()\n        };\n\n        return collect($actions)\n            ->filter(fn (Action $action) => $action->isVisible())\n            ->map(\n                fn (Action $action) => $action\n                    ->arguments($this->getRawCalendarContextData())\n                    ->toHtml()\n            )\n        ;\n    }\n\n    public function hasContextMenu(?Context $context = null): bool\n    {\n        return match ($context) {\n            Context::DateClick => ! empty($this->getCachedDateClickContextMenuActions()),\n            Context::DateSelect => ! empty($this->getCachedDateSelectContextMenuActions()),\n            Context::EventClick => ! empty($this->getCachedEventClickContextMenuActions()),\n            Context::NoEventsClick => ! empty($this->getCachedNoEventsClickContextMenuActions()),\n            default => ! empty($this->getCachedContextMenuActions()),\n        };\n    }\n\n    protected function cacheContextMenuActions(): void\n    {\n        foreach ($this->getDateClickContextMenuActions() as $action) {\n            $this->cacheContextMenuAction($action, Context::DateClick);\n        }\n        foreach ($this->getDateSelectContextMenuActions() as $action) {\n            $this->cacheContextMenuAction($action, Context::DateSelect);\n        }\n        foreach ($this->getEventClickContextMenuActions() as $action) {\n            $this->cacheContextMenuAction($action, Context::EventClick);\n        }\n        foreach ($this->getNoEventsClickContextMenuActions() as $action) {\n            $this->cacheContextMenuAction($action, Context::NoEventsClick);\n        }\n    }\n\n    protected function getCachedContextMenuActions(): array\n    {\n        return $this->cachedContextMenuActions;\n    }\n\n    protected function getDateClickContextMenuActions(): array\n    {\n        return [];\n    }\n\n    protected function getDateSelectContextMenuActions(): array\n    {\n        return [];\n    }\n\n    protected function getEventClickContextMenuActions(): array\n    {\n        return [];\n    }\n\n    protected function getNoEventsClickContextMenuActions(): array\n    {\n        return [];\n    }\n\n    protected function getCachedDateClickContextMenuActions(): array\n    {\n        return data_get($this->getCachedContextMenuActions(), Context::DateClick->value, []);\n    }\n\n    protected function getCachedDateSelectContextMenuActions(): array\n    {\n        return data_get($this->getCachedContextMenuActions(), Context::DateSelect->value, []);\n    }\n\n    protected function getCachedEventClickContextMenuActions(): array\n    {\n        return data_get($this->getCachedContextMenuActions(), Context::EventClick->value, []);\n    }\n\n    protected function getCachedNoEventsClickContextMenuActions(): array\n    {\n        return data_get($this->getCachedContextMenuActions(), Context::NoEventsClick->value, []);\n    }\n\n    private function cacheContextMenuAction(Action $action, Context $context): void\n    {\n        $action = $action\n            ->grouped()\n        ;\n\n        if (! $action instanceof Action) {\n            throw new InvalidArgumentException('Context menu actions must be an instance of ' . Action::class . '.');\n        }\n\n        $this->cacheAction($action);\n        $cachedActions = data_get($this->cachedContextMenuActions, $context->value, []);\n        $this->cachedContextMenuActions[$context->value] = [\n            ...$cachedActions,\n            $action,\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasDayMaxEvents.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait HasDayMaxEvents\n{\n    /**\n     * Determines the maximum number of stacked event levels for a given day in the dayGrid view.\n     *\n     * If there are too many events, a link like +2 more is displayed.\n     *\n     * Currently, only a boolean value is supported. When set to true, it limits the number of events to the height of the day cell. When set to false (default) there is no limit.\n     */\n    protected bool $dayMaxEvents = false;\n\n    /**\n     * Determines the maximum number of stacked event levels for a given day in the dayGrid view.\n     *\n     * If there are too many events, a link like +2 more is displayed.\n     *\n     * Currently, only a boolean value is supported. When set to true, it limits the number of events to the height of the day cell. When set to false (default) there is no limit.\n     */\n    public function getDayMaxEvents(): bool\n    {\n        return $this->dayMaxEvents;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasDefaultActions.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Actions\\Action;\nuse Guava\\Calendar\\Filament\\Actions\\CreateAction;\nuse Guava\\Calendar\\Filament\\Actions\\DeleteAction;\nuse Guava\\Calendar\\Filament\\Actions\\EditAction;\nuse Guava\\Calendar\\Filament\\Actions\\ViewAction;\nuse Illuminate\\Support\\Str;\n\ntrait HasDefaultActions\n{\n    /**\n     * Returns a create action configured for the specified model.\n     *\n     * @param  string  $model  The model class for which you want to make a create action.\n     */\n    protected function createAction(string $model, ?string $name = null): CreateAction\n    {\n        if (! $name) {\n            $name = Str::of('create')->append(Str::pascal(class_basename($model)))->toString();\n        }\n\n        return CreateAction::make($name)\n            ->model($model)\n        ;\n    }\n\n    public function viewAction(): ViewAction\n    {\n        return ViewAction::make();\n    }\n\n    public function editAction(): EditAction\n    {\n        return EditAction::make();\n    }\n\n    public function deleteAction(): DeleteAction\n    {\n        return DeleteAction::make();\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasEventContent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Attributes\\CalendarEventContent;\nuse Illuminate\\Contracts\\Support\\Htmlable;\nuse ReflectionClass;\n\ntrait HasEventContent\n{\n    public function getEventContentJs(): ?array\n    {\n        // Try finding a method with a CalendarEventContent attribute\n        $reflectionClass = new ReflectionClass($this);\n\n        $views = [];\n        foreach ($reflectionClass->getMethods(\\ReflectionMethod::IS_PUBLIC + \\ReflectionMethod::IS_PROTECTED) as $method) {\n            $attributes = $method->getAttributes(CalendarEventContent::class);\n\n            foreach ($attributes as $attribute) {\n                $content = $this->{$method->getName()}();\n                $views[$attribute->newInstance()->model] = $content instanceof Htmlable ? $content->toHtml() : $content;\n            }\n        }\n\n        // Try finding a \"defaultEventContent\" or \"eventContent\" method.\n        if (method_exists($this, 'defaultEventContent')) {\n            $views['_default'] = $this->defaultEventContent();\n        }\n\n        // Try finding a \"defaultEventContent\" or \"eventContent\" method.\n        if (method_exists($this, 'eventContent')) {\n            $views['_default'] = $this->eventContent();\n        }\n\n        if (! empty($views)) {\n            return $views;\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasEvents.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Contracts\\Eventable;\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\nuse Guava\\Calendar\\ValueObjects\\FetchInfo;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\n\ntrait HasEvents\n{\n    abstract protected function getEvents(FetchInfo $info): Collection | array | Builder;\n\n    public function getEventsJs(array $info): array\n    {\n        $events = $this->getEvents(new FetchInfo($info));\n\n        if ($events instanceof Builder) {\n            $events = $events->get();\n        }\n\n        if (is_array($events)) {\n            $events = collect($events);\n        }\n\n        return $events\n            ->map(function (Builder | Collection | Eventable | CalendarEvent $event) use ($info): array {\n                if ($event instanceof Eventable) {\n                    $event = $event->toCalendarEvent();\n                }\n\n                return $event->toCalendarObject(\n                    data_get($info, 'tzOffset'),\n                    $this->shouldUseFilamentTimezone()\n                );\n            })\n            ->all()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasFirstDay.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Carbon\\WeekDay;\n\ntrait HasFirstDay\n{\n    /**\n     * The day that each week begins at, where Sunday is 0, Monday is 1, etc. Saturday is 6.\n     */\n    protected WeekDay $firstDay = WeekDay::Monday;\n\n    /**\n     * The day that each week begins at, where Sunday is 0, Monday is 1, etc. Saturday is 6.\n     */\n    public function getFirstDay(): WeekDay\n    {\n        return $this->firstDay;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasFooterActions.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Actions\\Action;\nuse Filament\\Actions\\ActionGroup;\nuse Filament\\Schemas\\Components\\Actions;\nuse Filament\\Schemas\\Schema;\nuse InvalidArgumentException;\n\ntrait HasFooterActions\n{\n    protected array $cachedFooterActions = [];\n\n    public function bootedHasFooterActions(): void\n    {\n        $this->cacheFooterActions();\n    }\n\n    protected function cacheFooterActions(): void\n    {\n        /** @var Action $action */\n        foreach ($this->getFooterActions() as $action) {\n\n            if ($action instanceof ActionGroup) {\n                $action->livewire($this);\n\n                /** @var array<string, Action> $flatActions */\n                $flatActions = $action->getFlatActions();\n\n                $this->mergeCachedActions($flatActions);\n                $this->cachedFooterActions[] = $action;\n\n                continue;\n            }\n\n            if (! $action instanceof Action) {\n                throw new InvalidArgumentException('Footer actions must be an instance of ' . Action::class . ', or ' . ActionGroup::class . '.');\n            }\n\n            $this->cacheAction($action);\n            $this->cachedFooterActions[] = $action;\n        }\n    }\n\n    public function getCachedFooterActions(): array\n    {\n        return $this->cachedFooterActions;\n    }\n\n    public function getFooterActions(): array\n    {\n        return [];\n    }\n\n    public function getCachedFooterActionsComponent(): Actions\n    {\n        return Actions::make($this->getCachedFooterActions())\n            ->container(Schema::make($this))\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasHeaderActions.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Actions\\Action;\nuse Filament\\Actions\\ActionGroup;\nuse Filament\\Schemas\\Components\\Actions;\nuse Filament\\Schemas\\Schema;\nuse InvalidArgumentException;\n\ntrait HasHeaderActions\n{\n    protected array $cachedHeaderActions = [];\n\n    public function bootedHasHeaderActions(): void\n    {\n        $this->cacheHeaderActions();\n    }\n\n    protected function cacheHeaderActions(): void\n    {\n        /** @var Action $action */\n        foreach ($this->getHeaderActions() as $action) {\n            if ($action instanceof ActionGroup) {\n                $action->livewire($this);\n\n                /** @var array<string, Action> $flatActions */\n                $flatActions = $action->getFlatActions();\n\n                $this->mergeCachedActions($flatActions);\n                $this->cachedHeaderActions[] = $action;\n\n                continue;\n            }\n\n            if (! $action instanceof Action) {\n                throw new InvalidArgumentException('Header actions must be an instance of ' . Action::class . ', or ' . ActionGroup::class . '.');\n            }\n\n            $this->cacheAction($action);\n            $this->cachedHeaderActions[] = $action;\n        }\n    }\n\n    public function getCachedHeaderActions(): array\n    {\n        return $this->cachedHeaderActions;\n    }\n\n    public function getHeaderActions(): array\n    {\n        return [];\n    }\n\n    public function getCachedHeaderActionsComponent(): Actions\n    {\n        return Actions::make($this->getCachedHeaderActions())\n            ->container(Schema::make($this))\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasHeading.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Illuminate\\Support\\HtmlString;\n\ntrait HasHeading\n{\n    protected string | HtmlString | null | bool $heading = true;\n\n    public function getHeading(): null | string | HtmlString\n    {\n        if ($this->heading === false || is_null($this->heading)) {\n            return null;\n        }\n\n        if ($this->heading === true) {\n            return __('guava-calendar::translations.heading');\n        }\n\n        return $this->heading;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasLocale.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait HasLocale\n{\n    /**\n     * Defines the locale parameter for the native JavaScript Intl.DateTimeFormat object that EventCalendar uses to format date and time strings in options such as dayHeaderFormat, eventTimeFormat, etc.\n     */\n    protected ?string $locale = null;\n\n    /**\n     * Defines the locale parameter for the native JavaScript Intl.DateTimeFormat object that EventCalendar uses to format date and time strings in options such as dayHeaderFormat, eventTimeFormat, etc.\n     */\n    public function getLocale(): string\n    {\n        return $this->locale ?? $this->getDefaultLocale();\n    }\n\n    private function getDefaultLocale(): string\n    {\n        return str(app()->getLocale())\n            ->before('_')\n            ->toString()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasMoreLinkContent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Illuminate\\View\\View;\n\ntrait HasMoreLinkContent\n{\n    protected ?string $moreLinkContent = null;\n\n    /**\n     * vkurko/calendar doesn't support async method calls in moreLinkContent,\n     * that's why we need to pass all views to the client side.\n     *\n     * @return string|array|null null to use default, string to use single view\n     */\n    public function getMoreLinkContent(): null | string | array\n    {\n        return $this->moreLinkContent;\n    }\n\n    public function getMoreLinkContentJs(): ?string\n    {\n        return $this->getMoreLinkContent();\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasNotifications.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Notifications\\Notification;\nuse Illuminate\\Auth\\Access\\Response;\n\ntrait HasNotifications\n{\n    public function sendUnauthorizedNotification(Response $response): static\n    {\n        $notification = $this->getUnauthorizedNotification($response);\n\n        if (filled($notification?->getTitle())) {\n            $notification->send();\n        }\n\n        return $this;\n    }\n\n    protected function getUnauthorizedNotification(Response $response): ?Notification\n    {\n        return Notification::make()\n            ->danger()\n            ->title($this->getUnauthorizedNotificationTitle($response))\n            ->persistent()\n        ;\n    }\n\n    protected function getUnauthorizedNotificationTitle(Response $response): ?string\n    {\n        return $response->message();\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasOptions.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait HasOptions\n{\n    protected array $options = [];\n\n    /**\n     * Allows you to set vkurko/calendar options directly in case a helper method was not provided by the package.\n     */\n    public function getOptions(): array\n    {\n        return $this->options;\n    }\n\n    public function setOption(string $key, mixed $value): static\n    {\n        $this->dispatch('calendar--set', key: $key, value: $value);\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasResourceLabelContent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Attributes\\CalendarResourceLabelContent;\nuse Illuminate\\Contracts\\Support\\Htmlable;\nuse ReflectionClass;\n\ntrait HasResourceLabelContent\n{\n    public function getResourceLabelContentJs(): ?array\n    {\n        // Try finding a method with a CalendarEventContent attribute\n        $reflectionClass = new ReflectionClass($this);\n\n        $views = [];\n        foreach ($reflectionClass->getMethods(\\ReflectionMethod::IS_PUBLIC + \\ReflectionMethod::IS_PROTECTED) as $method) {\n            $attributes = $method->getAttributes(CalendarResourceLabelContent::class);\n\n            foreach ($attributes as $attribute) {\n                $content = $this->{$method->getName()}();\n                $views[$attribute->newInstance()->model] = $content instanceof Htmlable ? $content->toHtml() : $content;\n            }\n        }\n\n        // Try finding a \"defaultResourceLabelContent\" or \"resourceLabelContent\" method.\n        if (method_exists($this, 'defaultResourceLabelContent')) {\n            $views['_default'] = $this->defaultResourceLabelContent();\n        }\n\n        // Try finding a \"defaultResourceLabelContent\" or \"resourceLabelContent\" method.\n        if (method_exists($this, 'resourceLabelContent')) {\n            $views['_default'] = $this->resourceLabelContent();\n        }\n\n        if (! empty($views)) {\n            return $views;\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasResources.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Guava\\Calendar\\Contracts\\Resourceable;\nuse Guava\\Calendar\\ValueObjects\\CalendarResource;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Collection;\n\ntrait HasResources\n{\n    protected function getResources(): Collection | array | Builder\n    {\n        return [];\n    }\n\n    public function getResourcesJs(): array\n    {\n        $resources = $this->getResources();\n\n        if ($resources instanceof Builder) {\n            $resources = $resources->get();\n        }\n\n        if (is_array($resources)) {\n            $resources = collect($resources);\n        }\n\n        return $resources\n            ->map(static function (Resourceable | CalendarResource $resource): array {\n                if ($resource instanceof Resourceable) {\n                    $resource = $resource->toCalendarResource();\n                }\n\n                return $resource->toCalendarObject();\n            })\n            ->toArray()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasSchema.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Facades\\Filament;\nuse Filament\\Resources\\Resource;\nuse Filament\\Schemas\\Schema;\nuse Guava\\Calendar\\Attributes\\CalendarSchema;\nuse Guava\\Calendar\\Exceptions\\SchemaNotFoundException;\nuse Illuminate\\Support\\Str;\nuse ReflectionClass;\nuse ReflectionMethod;\n\ntrait HasSchema\n{\n    /**\n     * @throws SchemaNotFoundException\n     */\n    public function getSchemaForModel(Schema $schema, ?string $model = null): Schema\n    {\n        // Try finding a method with a ForModel attribute\n        $reflectionClass = new ReflectionClass($this);\n\n        foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC + ReflectionMethod::IS_PROTECTED) as $method) {\n            $attributes = $method->getAttributes(CalendarSchema::class);\n\n            foreach ($attributes as $attribute) {\n                if ($model === $attribute->newInstance()->model) {\n                    return $this->{$method->getName()}($schema);\n                }\n            }\n        }\n\n        // Try guessing and finding a method with the correct name (<camelCaseModel>Schema, such as fooBarSchema)\n        $methodName = Str::of(class_basename($model))\n            ->camel()\n            ->append('Schema')\n            ->toString()\n        ;\n        if (method_exists($this, $methodName)) {\n            return $this->{$methodName}($schema);\n        }\n\n        // Try finding a \"defaultSchema\" or \"schema\" method.\n        if (method_exists($this, 'defaultSchema')) {\n            return $this->defaultSchema($schema);\n        }\n\n        if (method_exists($this, 'schema')) {\n            return $this->schema($schema);\n        }\n\n        throw new SchemaNotFoundException;\n    }\n\n    /**\n     * @throws SchemaNotFoundException\n     */\n    public function getFormSchemaForModel(Schema $schema, ?string $model = null): Schema\n    {\n        try {\n            return $this->getSchemaForModel($schema, $model);\n        } catch (SchemaNotFoundException $e) {\n            // Try to find form schema in resource\n            /** @var resource $resource */\n            if ($resource = Filament::getModelResource($model)) {\n                return $resource::form($schema);\n            }\n\n            throw $e;\n        }\n    }\n\n    /**\n     * @throws SchemaNotFoundException\n     */\n    public function getInfolistSchemaForModel(Schema $schema, ?string $model = null): Schema\n    {\n        try {\n            return $this->getSchemaForModel($schema, $model);\n        } catch (SchemaNotFoundException $e) {\n            // Try to find infolist schema in resource\n            /** @var resource $resource */\n            if ($resource = Filament::getModelResource($model)) {\n                return $resource::infolist($schema);\n            }\n\n            throw $e;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Concerns/HasTheme.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\ntrait HasTheme\n{\n    public function getTheme(): ?array\n    {\n        return [];\n    }\n}\n"
  },
  {
    "path": "src/Concerns/InteractsWithCalendar.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Filament\\Actions\\Concerns\\InteractsWithActions;\nuse Filament\\Schemas\\Concerns\\InteractsWithSchemas;\nuse Filament\\Support\\Concerns\\EvaluatesClosures;\n\ntrait InteractsWithCalendar\n{\n    use CanRefreshCalendar;\n    use CanUseFilamentTimezone;\n    use EvaluatesClosures;\n    use HandlesDateClick;\n    use HandlesDateSelect;\n    use HandlesDatesSet;\n    use HandlesEventAllUpdated;\n    use HandlesEventClick;\n    use HandlesEventDragAndDrop;\n    use HandlesEventResize;\n    use HandlesNoEventsClick;\n    use HandlesViewDidMount;\n    use HasCalendarContextData;\n    use HasCalendarView;\n    use HasContextMenu;\n    use HasDayMaxEvents;\n    use HasDefaultActions;\n    use HasEventContent;\n    use HasEvents;\n    use HasFirstDay;\n    use HasFooterActions;\n    use HasHeaderActions;\n    use HasHeading;\n    use HasLocale;\n    use HasMoreLinkContent;\n    use HasOptions;\n    use HasResourceLabelContent;\n    use HasResources;\n    use HasSchema;\n    use HasTheme;\n    use InteractsWithActions {\n        InteractsWithActions::mountAction as baseMountAction;\n    }\n    use InteractsWithEventRecord;\n    use InteractsWithSchemas;\n\n    public function mountAction(string $name, array $arguments = [], array $context = []): mixed\n    {\n        return $this->baseMountAction($name, [\n            ...$arguments,\n            ...$this->getRawCalendarContextData() ?? [],\n        ], $context);\n    }\n}\n"
  },
  {
    "path": "src/Concerns/InteractsWithEventRecord.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Concerns;\n\nuse Exception;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Database\\Eloquent\\ModelNotFoundException;\nuse Livewire\\Attributes\\Locked;\n\ntrait InteractsWithEventRecord\n{\n    #[Locked]\n    public ?Model $eventRecord = null;\n\n    public function getEventRecord(): ?Model\n    {\n        return $this->eventRecord;\n    }\n\n    public function getEventModel(): ?string\n    {\n        if ($record = $this->getEventRecord()) {\n            return $record::class;\n        }\n\n        return null;\n    }\n\n    protected function resolveEventRecord(): ?Model\n    {\n        $model = $this->getRawCalendarContextData('event.extendedProps.model');\n        $key = $this->getRawCalendarContextData('event.extendedProps.key');\n\n        // Cannot resolve event record\n        if (! $model || ! $key) {\n            throw new Exception('Could not resolve event record. A [model] or [key] property set in the [extendedProps] of the mounted event was missing.');\n        }\n\n        if ($record = $this->resolveEventRecordRouteBinding($model, $key)) {\n            return $this->eventRecord = $record;\n        }\n\n        throw (new ModelNotFoundException)->setModel($model, [$key]);\n    }\n\n    protected function resolveEventRecordRouteBinding(string $model, mixed $key): ?Model\n    {\n        return app($model)\n            ->resolveRouteBindingQuery($this->getEloquentQuery($model), $key, $this->getEventRecordRouteKeyName($model))\n            ->first()\n        ;\n    }\n\n    protected function getEloquentQuery(string $model): Builder\n    {\n        return app($model)::query();\n    }\n\n    protected function getEventRecordRouteKeyName(?string $model = null): ?string\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Contracts/ContextualInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Contracts;\n\nuse Guava\\Calendar\\Enums\\Context;\n\ninterface ContextualInfo\n{\n    public function getContext(): Context;\n}\n"
  },
  {
    "path": "src/Contracts/Eventable.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Contracts;\n\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\n\ninterface Eventable\n{\n    public function toCalendarEvent(): CalendarEvent;\n}\n"
  },
  {
    "path": "src/Contracts/HasCalendar.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Contracts;\n\ninterface HasCalendar {}\n"
  },
  {
    "path": "src/Contracts/Resourceable.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Contracts;\n\nuse Guava\\Calendar\\ValueObjects\\CalendarResource;\n\ninterface Resourceable\n{\n    public function toCalendarResource(): CalendarResource;\n}\n"
  },
  {
    "path": "src/Enums/CalendarViewType.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Enums;\n\nenum CalendarViewType: string\n{\n    case DayGridMonth = 'dayGridMonth';\n    case ListDay = 'listDay';\n    case ListWeek = 'listWeek';\n    case ListMonth = 'listMonth';\n    case ListYear = 'listYear';\n    case ResourceTimeGridDay = 'resourceTimeGridDay';\n    case ResourceTimeGridWeek = 'resourceTimeGridWeek';\n    case ResourceTimelineDay = 'resourceTimelineDay';\n    case ResourceTimelineWeek = 'resourceTimelineWeek';\n    case ResourceTimelineMonth = 'resourceTimelineMonth';\n    case TimeGridDay = 'timeGridDay';\n    case TimeGridWeek = 'timeGridWeek';\n\n}\n"
  },
  {
    "path": "src/Enums/Context.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Enums;\n\nenum Context: string\n{\n    case DateClick = 'dateClick';\n    case DateSelect = 'dateSelect';\n    case EventClick = 'eventClick';\n    case NoEventsClick = 'noEventsClick';\n    case EventResize = 'eventResize';\n    case EventDragAndDrop = 'eventDragAndDrop';\n\n    public function interactsWithRecord(): bool\n    {\n        return match ($this) {\n            self::EventClick, self::EventResize, self::EventDragAndDrop => true,\n            default => false\n        };\n    }\n}\n"
  },
  {
    "path": "src/Exceptions/SchemaNotFoundException.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Exceptions;\n\nuse Exception;\n\nclass SchemaNotFoundException extends Exception {}\n"
  },
  {
    "path": "src/Filament/Actions/CreateAction.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Filament\\Actions;\n\nuse Filament\\Schemas\\Schema;\nuse Guava\\Calendar\\Concerns\\CalendarAction;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\n\nclass CreateAction extends \\Filament\\Actions\\CreateAction\n{\n    use CalendarAction;\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $this\n            ->schema(\n                fn (Schema $schema, CreateAction $action, HasCalendar $livewire) => $livewire\n                    ->getFormSchemaForModel($schema, $action->getModel())\n            )\n            ->after(fn (HasCalendar $livewire) => $livewire->refreshRecords())\n            ->cancelParentActions()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Filament/Actions/DeleteAction.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Filament\\Actions;\n\nuse Guava\\Calendar\\Concerns\\CalendarAction;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass DeleteAction extends \\Filament\\Actions\\DeleteAction\n{\n    use CalendarAction;\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $this->model(fn (HasCalendar $livewire) => $livewire->getEventModel());\n        $this->record(fn (HasCalendar $livewire) => $livewire->getEventRecord());\n\n        $this->after(function (HasCalendar $livewire) {\n            $livewire->eventRecord = null;\n            $livewire->refreshRecords();\n        });\n\n        $this->hidden(static function (?Model $record): bool {\n            if (! $record) {\n                return false;\n            }\n\n            if (! method_exists($record, 'trashed')) {\n                return false;\n            }\n\n            return $record->trashed();\n        });\n\n        $this->cancelParentActions();\n    }\n}\n"
  },
  {
    "path": "src/Filament/Actions/EditAction.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Filament\\Actions;\n\nuse Filament\\Schemas\\Schema;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\n\nclass EditAction extends \\Filament\\Actions\\EditAction\n{\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $this\n            ->model(fn (HasCalendar $livewire) => $livewire->getEventModel())\n            ->record(fn (HasCalendar $livewire) => $livewire->getEventRecord())\n            ->schema(\n                fn (EditAction $action, Schema $schema, HasCalendar $livewire): Schema => $livewire\n                    ->getFormSchemaForModel($schema, $action->getModel())\n                    ->record($livewire->getEventRecord())\n            )->after(fn (HasCalendar $livewire) => $livewire->refreshRecords())\n            ->cancelParentActions()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Filament/Actions/ViewAction.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Filament\\Actions;\n\nuse Filament\\Schemas\\Schema;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\n\nclass ViewAction extends \\Filament\\Actions\\ViewAction\n{\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $this\n            ->model(fn (HasCalendar $livewire) => $livewire->getEventModel())\n            ->record(fn (HasCalendar $livewire) => $livewire->getEventRecord())\n            ->schema(\n                fn (ViewAction $action, Schema $schema, HasCalendar $livewire) => $livewire\n                    ->getInfolistSchemaForModel($schema, $action->getModel())\n                    ->record($livewire->getEventRecord()),\n            )\n            ->cancelParentActions()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Filament/CalendarWidget.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Filament;\n\nuse Filament\\Actions\\Contracts\\HasActions;\nuse Filament\\Schemas\\Contracts\\HasSchemas;\nuse Filament\\Widgets\\Widget;\nuse Guava\\Calendar\\Concerns\\InteractsWithCalendar;\nuse Guava\\Calendar\\Contracts\\HasCalendar;\n\nabstract class CalendarWidget extends Widget implements HasActions, HasCalendar, HasSchemas\n{\n    use InteractsWithCalendar;\n\n    protected string $view = 'guava-calendar::widgets.calendar-widget';\n\n    protected int | string | array $columnSpan = 'full';\n}\n"
  },
  {
    "path": "src/ValueObjects/CalendarEvent.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\Carbon;\nuse Filament\\Support\\Facades\\FilamentTimezone;\nuse Illuminate\\Contracts\\Support\\Htmlable;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\HtmlString;\nuse Illuminate\\Support\\Str;\n\nuse function Guava\\Calendar\\utc_to_user_local_time;\n\nclass CalendarEvent\n{\n    protected string | Htmlable $title;\n\n    protected Carbon $start;\n\n    protected Carbon $end;\n\n    protected bool $allDay = false;\n\n    protected ?string $backgroundColor = null;\n\n    protected ?string $textColor = null;\n\n    protected ?string $display = null;\n\n    protected ?bool $editable = null;\n\n    protected ?bool $startEditable = null;\n\n    protected ?bool $durationEditable = null;\n\n    protected array $resourceIds = [];\n\n    protected array $extendedProps = [];\n\n    protected array $styles = [];\n\n    protected array $classNames = [];\n\n    protected ?string $timezone = null;\n\n    private function __construct(?Model $model = null)\n    {\n        if ($model) {\n            $this->key($model->getKey());\n            $this->model($model::class);\n        }\n    }\n\n    public function start(string | Carbon $start): static\n    {\n        $start = is_string($start)\n            ? Carbon::make($start)\n            : $start;\n\n        $this->start = $start; // ->setTimezone(FilamentTimezone::get());\n        //        $this->start = $start->setTimezone(FilamentTimezone::get());\n\n        return $this;\n    }\n\n    public function getStart(): Carbon\n    {\n        return $this->start;\n    }\n\n    public function end(string | Carbon $end): static\n    {\n        $end = is_string($end)\n            ? Carbon::make($end)\n            : $end;\n\n        $this->end = $end; // ->setTimezone(FilamentTimezone::get());\n        //        $this->end = $end->setTimezone(FilamentTimezone::get());\n\n        return $this;\n    }\n\n    public function getEnd(): Carbon\n    {\n        return $this->end;\n    }\n\n    public function allDay(bool $allDay = true): static\n    {\n        $this->allDay = $allDay;\n\n        return $this;\n    }\n\n    public function getAllDay(): bool\n    {\n        return $this->allDay;\n    }\n\n    public function title(string | Htmlable $title): static\n    {\n        $this->title = $title;\n\n        return $this;\n    }\n\n    public function getTitle(): string | Htmlable\n    {\n        return $this->title;\n    }\n\n    // TODO: Support arrays (such as Color::Rose from Filament) and shade selection (default 400 or 600)\n    // TODO: also support filament color names, such as 'primary' or 'danger'\n    public function backgroundColor(string $color): static\n    {\n        $this->backgroundColor = $color;\n\n        return $this;\n    }\n\n    public function getBackgroundColor(): ?string\n    {\n        return $this->backgroundColor;\n    }\n\n    public function textColor(string $color): static\n    {\n        $this->textColor = $color;\n\n        return $this;\n    }\n\n    public function getTextColor(): ?string\n    {\n        return $this->textColor;\n    }\n\n    public function classes(array $classes): static\n    {\n        return $this->classNames($classes);\n    }\n\n    public function classNames(array $classNames): static\n    {\n        $this->classNames = $classNames;\n\n        return $this;\n    }\n\n    public function getClassNames(): string\n    {\n        return Arr::toCssClasses($this->classNames);\n    }\n\n    public function styles(array $styles): static\n    {\n        $this->styles = $styles;\n\n        return $this;\n    }\n\n    public function getStyles(): string\n    {\n        $styles = [];\n\n        foreach ($this->styles as $key => $value) {\n            if (is_int($key)) {\n                $styles[] = Str::finish($value, ';');\n            } elseif (! is_bool($value)) {\n                $styles[] = Str::finish(\"$key: $value\", ';');\n            } elseif ($value) {\n                $styles[] = Str::finish($key, ';');\n            }\n        }\n\n        return implode(' ', $styles);\n    }\n\n    public function display(string $display): static\n    {\n        $this->display = $display;\n\n        return $this;\n    }\n\n    public function getDisplay(): ?string\n    {\n        return $this->display;\n    }\n\n    public function displayAuto(): static\n    {\n        return $this->display('auto');\n    }\n\n    public function displayBackground(): static\n    {\n        return $this->display('background');\n    }\n\n    public function editable(bool $editable = true): static\n    {\n        $this->editable = $editable;\n\n        return $this;\n    }\n\n    public function getEditable(): ?bool\n    {\n        return $this->editable;\n    }\n\n    public function startEditable(bool $startEditable = true): static\n    {\n        $this->startEditable = $startEditable;\n\n        return $this;\n    }\n\n    public function getStartEditable(): ?bool\n    {\n        return $this->startEditable;\n    }\n\n    public function durationEditable(bool $durationEditable = true): static\n    {\n        $this->durationEditable = $durationEditable;\n\n        return $this;\n    }\n\n    public function getDurationEditable(): ?bool\n    {\n        return $this->durationEditable;\n    }\n\n    public function resourceId(int | string | CalendarResource $resource): static\n    {\n        $this->resourceIds([$resource]);\n\n        return $this;\n    }\n\n    public function resourceIds(array $resourceIds): static\n    {\n        $this->resourceIds = [\n            ...$this->resourceIds,\n            ...$resourceIds,\n        ];\n\n        return $this;\n    }\n\n    public function getResourceIds(): array\n    {\n        return $this->resourceIds;\n    }\n\n    public function url(string $url, string $target = '_blank'): static\n    {\n        $this->extendedProp('url', $url);\n        $this->extendedProp('url_target', $target);\n\n        return $this;\n    }\n\n    public function key(string $key): static\n    {\n        $this->extendedProp('key', $key);\n\n        return $this;\n    }\n\n    public function model(string $model): static\n    {\n        $this->extendedProp('model', $model);\n\n        return $this;\n    }\n\n    public function action(string $action): static\n    {\n        $this->extendedProp('action', $action);\n\n        return $this;\n    }\n\n    public function extendedProp(string $key, mixed $value): static\n    {\n        data_set($this->extendedProps, $key, $value);\n\n        return $this;\n    }\n\n    public function extendedProps(array $props): static\n    {\n        $this->extendedProps = [\n            ...$this->extendedProps,\n            ...$props,\n        ];\n\n        return $this;\n    }\n\n    public function timezone(string $timezone): static\n    {\n        $this->timezone = $timezone;\n\n        return $this;\n    }\n\n    public function getExtendedProps(): array\n    {\n        return $this->extendedProps;\n    }\n\n    public static function make(?Model $model = null): static\n    {\n        return new static($model);\n    }\n\n    public function toCalendarObject(int $timezoneOffset, bool $useFilamentTimezone): array\n    {\n        $array = [\n            'title' => $this->getTitle() instanceof Htmlable ? ['html' => $this->getTitle()->toHtml()] : $this->getTitle(),\n            'start' => $useFilamentTimezone\n                ? $this->getStart()->setTimezone($this->timezone ?? FilamentTimezone::get())->toIso8601String()\n                : $this->getStart()->utcOffset($timezoneOffset)->toIso8601String(),\n            'end' => $useFilamentTimezone\n                ? $this->getEnd()->setTimezone($this->timezone ?? FilamentTimezone::get())->toIso8601String()\n                : $this->getEnd()->utcOffset($timezoneOffset)->toIso8601String(),\n            'allDay' => $this->getAllDay(),\n            'backgroundColor' => $this->getBackgroundColor(),\n            'textColor' => $this->getTextColor(),\n            'styles' => $this->getStyles(),\n            'classNames' => $this->getClassNames(),\n            'resourceIds' => $this->getResourceIds(),\n            'extendedProps' => $this->getExtendedProps(),\n        ];\n\n        if (($editable = $this->getEditable()) !== null) {\n            $array['editable'] = $editable;\n        }\n\n        if (($startEditable = $this->getStartEditable()) !== null) {\n            $array['startEditable'] = $startEditable;\n        }\n\n        if (($durationEditable = $this->getDurationEditable()) !== null) {\n            $array['durationEditable'] = $durationEditable;\n        }\n\n        if (($display = $this->getDisplay()) !== null) {\n            $array['display'] = $display;\n        }\n\n        return $array;\n    }\n\n    public function fromCalendarObject(array $data, int $timezoneOffset, bool $useFilamentTimezone): static\n    {\n        $title = $data['title'];\n        if (is_array($data['title']) && array_key_exists('html', $data['title'])) {\n            $title = new HtmlString($data['title']['html']);\n        }\n        $this\n            ->title($title)\n            ->start(utc_to_user_local_time($data['start'], $timezoneOffset, $useFilamentTimezone))\n            ->end(utc_to_user_local_time($data['end'], $timezoneOffset, $useFilamentTimezone))\n            ->allDay($data['allDay'])\n            ->styles($data['styles'])\n            ->classNames($data['classNames'])\n            ->extendedProps($data['extendedProps'])\n            ->display($data['display'])\n            ->resourceIds($data['resourceIds'])\n        ;\n\n        if ($backgroundColor = data_get($data, 'backgroundColor')) {\n            $this->backgroundColor($backgroundColor);\n        }\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/CalendarResource.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Illuminate\\Contracts\\Support\\Htmlable;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass CalendarResource\n{\n    protected int | string $id;\n\n    protected string | Htmlable $title;\n\n    protected ?string $eventBackgroundColor = null;\n\n    protected ?string $eventTextColor = null;\n\n    protected array $children = [];\n\n    protected array $extendedProps = [];\n\n    private function __construct(Model | int | string $id)\n    {\n        if ($id instanceof Model) {\n            $this->id = $id->getKey();\n        } else {\n            $this->id = $id;\n        }\n    }\n\n    public function getId(): int | string\n    {\n        return $this->id;\n    }\n\n    public function title(string | Htmlable $title): static\n    {\n        $this->title = $title;\n\n        return $this;\n    }\n\n    public function getTitle(): string\n    {\n        return $this->title;\n    }\n\n    // TODO: Support arrays (such as Color::Rose from Filament) and shade selection (default 400 or 600)\n    // TODO: also support filament color names, such as 'primary' or 'danger'\n    public function eventBackgroundColor(string $color): static\n    {\n        $this->eventBackgroundColor = $color;\n\n        return $this;\n    }\n\n    public function getEventBackgroundColor(): ?string\n    {\n        return $this->eventBackgroundColor;\n    }\n\n    public function eventTextColor(string $color): static\n    {\n        $this->eventTextColor = $color;\n\n        return $this;\n    }\n\n    public function getEventTextColor(): ?string\n    {\n        return $this->eventTextColor;\n    }\n\n    public function child(array | CalendarResource $child): static\n    {\n        return $this->children([$child]);\n    }\n\n    public function children(array $children): static\n    {\n        $this->children = [\n            ...$this->children,\n            ...$children,\n        ];\n\n        return $this;\n    }\n\n    public function getChildren(): array\n    {\n        return $this->children;\n    }\n\n    public function extendedProp(string $key, mixed $value): static\n    {\n        data_set($this->extendedProps, $key, $value);\n\n        return $this;\n    }\n\n    public function extendedProps(array $props): static\n    {\n        $this->extendedProps = [\n            ...$this->extendedProps,\n            ...$props,\n        ];\n\n        return $this;\n    }\n\n    public function getExtendedProps(): array\n    {\n        return $this->extendedProps;\n    }\n\n    public static function make(Model | int | string $id): static\n    {\n        return new static($id);\n    }\n\n    public function toCalendarObject(): array\n    {\n        return [\n            'id' => $this->id,\n            'title' => $this->getTitle() instanceof Htmlable ? ['html' => $this->getTitle()->toHtml()] : $this->getTitle(),\n            'eventBackgroundColor' => $this->getEventBackgroundColor(),\n            'eventTextColor' => $this->getEventTextColor(),\n            'children' => collect($this->getChildren())->toArray(),\n            'extendedProps' => $this->getExtendedProps(),\n        ];\n    }\n\n    public static function fromCalendarObject(array $data): CalendarResource\n    {\n        $resource = CalendarResource::make(data_get($data, 'id'));\n\n        $resource->title(data_get($data, 'title'));\n\n        if ($eventBackgroundColor = data_get($data, 'eventBackgroundColor')) {\n            $resource->eventBackgroundColor($eventBackgroundColor);\n        }\n\n        if ($eventTextColor = data_get($data, 'eventTextColor')) {\n            $resource->eventTextColor($eventTextColor);\n        }\n\n        if ($extendedProps = data_get($data, 'extendedProps')) {\n            $resource->extendedProps($extendedProps);\n        }\n\n        return $resource;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/CalendarView.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\CarbonImmutable;\nuse Guava\\Calendar\\Enums\\CalendarViewType;\n\nuse function Guava\\Calendar\\utc_to_user_local_time;\n\nreadonly class CalendarView\n{\n    public CalendarViewType $type;\n\n    public string $title;\n\n    public CalendarView $view;\n\n    public CarbonImmutable $currentStart;\n\n    public CarbonImmutable $currentEnd;\n\n    public CarbonImmutable $activeStart;\n\n    public CarbonImmutable $activeEnd;\n\n    protected array $originalData;\n\n    public function __construct(array $data, int $timezoneOffset, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->type = CalendarViewType::tryFrom(data_get($data, 'type'));\n        $this->title = data_get($data, 'title');\n        $this->currentStart = utc_to_user_local_time(data_get($data, 'currentStart'), $timezoneOffset, $useFilamentTimezone);\n        $this->currentEnd = utc_to_user_local_time(data_get($data, 'currentEnd'), $timezoneOffset, $useFilamentTimezone);\n        $this->activeStart = utc_to_user_local_time(data_get($data, 'activeStart'), $timezoneOffset, $useFilamentTimezone);\n        $this->activeEnd = utc_to_user_local_time(data_get($data, 'activeEnd'), $timezoneOffset, $useFilamentTimezone);\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/DateClickInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\CarbonImmutable;\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\n\nuse function Guava\\Calendar\\utc_to_user_local_time;\n\nreadonly class DateClickInfo implements ContextualInfo\n{\n    public CarbonImmutable $date;\n\n    public bool $allDay;\n\n    public CalendarView $view;\n\n    public ?CalendarResource $resource;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->date = utc_to_user_local_time(\n            data_get($data, 'date'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        $this->allDay = data_get($data, 'allDay');\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        if ($resource = data_get($data, 'resource')) {\n            $this->resource = CalendarResource::fromCalendarObject($resource);\n        } else {\n            $this->resource = null;\n        }\n    }\n\n    public function getContext(): Context\n    {\n        return Context::DateClick;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/DateSelectInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\CarbonImmutable;\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\n\nuse function Guava\\Calendar\\utc_to_user_local_time;\n\nreadonly class DateSelectInfo implements ContextualInfo\n{\n    public CarbonImmutable $start;\n\n    public CarbonImmutable $end;\n\n    public bool $allDay;\n\n    public CalendarView $view;\n\n    public ?CalendarResource $resource;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->start = utc_to_user_local_time(\n            data_get($data, 'start'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        $this->end = utc_to_user_local_time(\n            data_get($data, 'end'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        $this->allDay = data_get($data, 'allDay');\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        if ($resource = data_get($data, 'resource')) {\n            $this->resource = CalendarResource::fromCalendarObject($resource);\n        } else {\n            $this->resource = null;\n        }\n    }\n\n    public function getContext(): Context\n    {\n        return Context::DateSelect;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/DatesSetInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\CarbonImmutable;\n\nuse function Guava\\Calendar\\utc_to_user_local_time;\n\nreadonly class DatesSetInfo\n{\n    public CarbonImmutable $start;\n\n    public CarbonImmutable $end;\n\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->start = utc_to_user_local_time(\n            data_get($data, 'start'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        $this->end = utc_to_user_local_time(\n            data_get($data, 'end'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/EventAllUpdatedInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nreadonly class EventAllUpdatedInfo\n{\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/EventClickInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nreadonly class EventClickInfo implements ContextualInfo\n{\n    public Model $record;\n\n    public CalendarEvent $event;\n\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, Model $record, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->record = $record;\n\n        $this->event = CalendarEvent::make($record)\n            ->fromCalendarObject(\n                data_get($data, 'event'),\n                data_get($data, 'tzOffset'),\n                $useFilamentTimezone\n            )\n        ;\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n\n    public function getContext(): Context\n    {\n        return Context::EventClick;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/EventDropInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nreadonly class EventDropInfo implements ContextualInfo\n{\n    public Model $record;\n\n    public CalendarEvent $event;\n\n    public CalendarEvent $oldEvent;\n\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, Model $record, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->record = $record;\n\n        $this->event = CalendarEvent::make($record)\n            ->fromCalendarObject(\n                data_get($data, 'event'),\n                data_get($data, 'tzOffset'),\n                $useFilamentTimezone\n            )\n        ;\n\n        $this->oldEvent = CalendarEvent::make($record)\n            ->fromCalendarObject(\n                data_get($data, 'oldEvent'),\n                data_get($data, 'tzOffset'),\n                $useFilamentTimezone\n            )\n        ;\n\n        // todo: resource and old resource\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n\n    public function getContext(): Context\n    {\n        return Context::EventDragAndDrop;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/EventResizeInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\nuse Illuminate\\Database\\Eloquent\\Model;\n\nreadonly class EventResizeInfo implements ContextualInfo\n{\n    public Model $record;\n\n    public CalendarEvent $event;\n\n    public CalendarEvent $oldEvent;\n\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, Model $record, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->record = $record;\n\n        $this->event = CalendarEvent::make($record)\n            ->fromCalendarObject(\n                data_get($data, 'event'),\n                data_get($data, 'tzOffset'),\n                $useFilamentTimezone\n            )\n        ;\n\n        $this->oldEvent = CalendarEvent::make($record)\n            ->fromCalendarObject(\n                data_get($data, 'oldEvent'),\n                data_get($data, 'tzOffset'),\n                $useFilamentTimezone\n            )\n        ;\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n\n    public function getContext(): Context\n    {\n        return Context::EventResize;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/FetchInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Carbon\\CarbonImmutable;\n\nuse function Guava\\Calendar\\browser_date_to_app_date;\n\nreadonly class FetchInfo\n{\n    public CarbonImmutable $start;\n\n    public CarbonImmutable $end;\n\n    protected array $originalData;\n\n    public function __construct(array $data)\n    {\n        $this->originalData = $data;\n\n        $this->start = browser_date_to_app_date(CarbonImmutable::make($data['startStr']));\n        $this->end = browser_date_to_app_date(CarbonImmutable::make($data['endStr']));\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/NoEventsClickInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nuse Guava\\Calendar\\Contracts\\ContextualInfo;\nuse Guava\\Calendar\\Enums\\Context;\n\nreadonly class NoEventsClickInfo implements ContextualInfo\n{\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n\n    public function getContext(): Context\n    {\n        return Context::NoEventsClick;\n    }\n}\n"
  },
  {
    "path": "src/ValueObjects/ViewDidMountInfo.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\ValueObjects;\n\nreadonly class ViewDidMountInfo\n{\n    public CalendarView $view;\n\n    protected array $originalData;\n\n    public function __construct(array $data, bool $useFilamentTimezone)\n    {\n        $this->originalData = $data;\n\n        $this->view = new CalendarView(\n            data_get($data, 'view'),\n            data_get($data, 'tzOffset'),\n            $useFilamentTimezone\n        );\n    }\n}\n"
  },
  {
    "path": "src/helpers.php",
    "content": "<?php\n\nnamespace Guava\\Calendar;\n\nuse Carbon\\CarbonImmutable;\nuse Filament\\Support\\Facades\\FilamentTimezone;\n\nif (! function_exists('Guava\\Calendar\\browser_date_to_user_date')) {\n    /**\n     * The underlying EventCalendar does not support timezones and thus all times in the calendar\n     * are provided in either UTC or their local browser locale.\n     *\n     * To work out of the box in any filament installation and support filament v4 timezone settings,\n     * this method converts the users local browser date into the filament timezone and then converts\n     * it into the apps timezone.\n     */\n    function browser_date_to_user_date(CarbonImmutable | string $date): CarbonImmutable\n    {\n        if (is_string($date)) {\n            $date = CarbonImmutable::make($date);\n        }\n\n        return $date->shiftTimezone(FilamentTimezone::get());\n    }\n}\n\nif (! function_exists('Guava\\Calendar\\browser_date_to_app_date')) {\n    /**\n     * The underlying EventCalendar does not support timezones and thus all times in the calendar\n     * are provided in either UTC or their local browser locale.\n     *\n     * To work out of the box in any filament installation and support filament v4 timezone settings,\n     * this method converts the users local browser date into the filament timezone and then converts\n     * it into the apps timezone.\n     */\n    function browser_date_to_app_date(CarbonImmutable | string $date): CarbonImmutable\n    {\n        if (is_string($date)) {\n            $date = CarbonImmutable::make($date);\n        }\n\n        return browser_date_to_user_date($date)->setTimezone(config('app.timezone'));\n    }\n}\n\nif (! function_exists('Guava\\Calendar\\utc_to_user_local_time')) {\n    /**\n     * The underlying EventCalendar does not support timezones and thus all times in the calendar\n     * are provided in either UTC or their local browser locale.\n     *\n     * To work out of the box in any filament installation and support filament v4 timezone settings,\n     * this method converts the users local browser date into the filament timezone and then converts\n     * it into the apps timezone.\n     */\n    function utc_to_user_local_time(CarbonImmutable | string $date, int $timezoneOffset, bool $useFilamentTimezone = false): CarbonImmutable\n    {\n        if (is_string($date)) {\n            $date = CarbonImmutable::make($date);\n        }\n\n        // This converts the UTC time to the user's local time, by offsetting the timezone\n        // This will result in a time in the user's local browser time\n        $date = $date->utcOffset($timezoneOffset);\n\n        // This will shift the timezone to the timezone set by filament,\n        // essentially treating the user's local browser timezone as the one set by filament\n        // This basically overrides the timezone and \"adds support\" for setting the timezone\n        // despite EventCalendar not supporting timezones.\n        if ($useFilamentTimezone) {\n            $date = $date->shiftTimezone(FilamentTimezone::get());\n        }\n\n        return $date;\n    }\n}\n"
  },
  {
    "path": "tests/ArchTest.php",
    "content": "<?php\n\nit('will not use debugging functions')\n    ->expect(['dd', 'dump', 'ray'])\n    ->each->not->toBeUsed()\n;\n"
  },
  {
    "path": "tests/Pest.php",
    "content": "<?php\n\n/*\n|--------------------------------------------------------------------------\n| Test Case\n|--------------------------------------------------------------------------\n|\n| The closure you provide to your test functions is always bound to a specific PHPUnit test\n| case class. By default, that class is \"PHPUnit\\Framework\\TestCase\". Of course, you may\n| need to change it using the \"uses()\" function to bind a different classes or traits.\n|\n*/\n\n// uses(Tests\\TestCase::class)->in('Feature');\n\n/*\n|--------------------------------------------------------------------------\n| Expectations\n|--------------------------------------------------------------------------\n|\n| When you're writing tests, you often need to check that values meet certain conditions. The\n| \"expect()\" function gives you access to a set of \"expectations\" methods that you can use\n| to assert different things. Of course, you may extend the Expectation API at any time.\n|\n*/\n\nexpect()->extend('toBeOne', function () {\n    return $this->toBe(1);\n});\n\n/*\n|--------------------------------------------------------------------------\n| Functions\n|--------------------------------------------------------------------------\n|\n| While Pest is very powerful out-of-the-box, you may have some testing code specific to your\n| project that you don't want to repeat in every file. Here you can also expose helpers as\n| global functions to help you to reduce the number of lines of code in your test files.\n|\n*/\n\nfunction something()\n{\n    // ..\n}\n"
  },
  {
    "path": "tests/TestCase.php",
    "content": "<?php\n\nnamespace Guava\\Calendar\\Tests;\n\nuse Guava\\Calendar\\CalendarServiceProvider;\nuse Illuminate\\Database\\Eloquent\\Factories\\Factory;\nuse PHPUnit\\Framework\\TestCase as BaseTestCase;\n\nabstract class TestCase extends BaseTestCase\n{\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        Factory::guessFactoryNamesUsing(\n            fn (string $modelName) => 'Guava\\\\Calendar\\\\Database\\\\Factories\\\\'.class_basename($modelName).'Factory'\n        );\n    }\n\n    protected function getPackageProviders($app)\n    {\n        return [\n            CalendarServiceProvider::class,\n        ];\n    }\n\n    public function getEnvironmentSetUp($app)\n    {\n        config()->set('database.default', 'testing');\n\n        /*\n        $migration = include __DIR__.'/../database/migrations/create_calendar_table.php.stub';\n        $migration->up();\n        */\n    }\n}\n"
  },
  {
    "path": "tests/Unit/ValueObjects/EventTest.php",
    "content": "<?php\n\nuse Carbon\\Carbon;\nuse Guava\\Calendar\\ValueObjects\\CalendarEvent;\nuse Illuminate\\Support\\HtmlString;\n\nbeforeEach(function () {\n    $this->event = CalendarEvent::make();\n});\n\nit('should set start and end', function () {\n    $start = Carbon::now();\n    $end = Carbon::now()->addHour();\n\n    $this->event->start($start);\n    $this->event->end($end);\n\n    expect($this->event->getStart())->toBe($start);\n    expect($this->event->getEnd())->toBe($end);\n});\n\nit('should set all day', function () {\n    $this->event->allDay(true);\n\n    expect($this->event->getAllDay())->toBeTrue();\n});\n\nit('should set the title', function () {\n    $title = 'Test Event';\n    $this->event->title($title);\n\n    expect($this->event->getTitle())->toBe($title);\n});\n\nit('should set the html title', function () {\n    $title = new HtmlString('<strong>Test Event</strong>');\n    $this->event->title($title);\n\n    expect($this->event->getTitle())->toBe($title);\n});\n\nit('should set the background color', function () {\n    $color = '#ff0000';\n    $this->event->backgroundColor($color);\n\n    expect($this->event->getBackgroundColor())->toBe($color);\n});\n\nit('should set the text color', function () {\n    $color = '#00ff00';\n    $this->event->textColor($color);\n\n    expect($this->event->getTextColor())->toBe($color);\n});\n\nit('should set the styles', function () {\n    $styles = [\n        'color: red',\n        'display: flex; flex-direction: row;',\n        'font-size' => '12px',\n        'opacity' => 1,\n        'background-color: blue' => false,\n        'border-color: red' => true,\n    ];\n    $this->event->styles($styles);\n\n    expect($this->event->getStyles())->toBe('color: red; display: flex; flex-direction: row; font-size: 12px; opacity: 1; border-color: red;');\n});\n\nit('should set some classes', function () {\n    $classes = ['class-1', 'class-2' => true, 'class3' => false];\n    $this->event->classNames($classes);\n\n    expect($this->event->getClassNames())->toBe('class-1 class-2');\n});\n\nit('should set the display', function () {\n    $display = 'block';\n    $this->event->display($display);\n\n    expect($this->event->getDisplay())->toBe($display);\n});\n\nit('should set the editable features', function () {\n    $this->event->editable(true);\n    expect($this->event->getEditable())->toBeTrue();\n\n    $this->event->startEditable(true);\n    expect($this->event->getStartEditable())->toBeTrue();\n\n    $this->event->durationEditable(true);\n    expect($this->event->getDurationEditable())->toBeTrue();\n});\n\nit('should set resource ids', function () {\n    $resourceIds = [1, 2, 3];\n    $this->event->resourceIds($resourceIds);\n\n    expect($this->event->getResourceIds())->toBe($resourceIds);\n});\n\nit('should set some extended props', function () {\n    $props = ['key' => 'value', 'another_key' => 'another_value'];\n    $this->event->extendedProps($props);\n\n    expect($this->event->getExtendedProps())->toBe($props);\n});\n\nit('should return props to array', function () {\n    $start = Carbon::now();\n    $end = Carbon::now()->addHour();\n    $title = 'Test Event';\n    $backgroundColor = '#ff0000';\n    $textColor = '#00ff00';\n    $styles = ['color' => 'red', 'font-size' => '12px', 'background-color' => false, 'border-color: red' => true];\n    $classNames = ['class-1', 'class-2' => true, 'class-3' => false];\n    $resourceIds = [1, 2, 3];\n    $extendedProps = ['key' => 'value', 'another_key' => 'another_value'];\n\n    $this->event->start($start)->end($end)->title($title)->backgroundColor($backgroundColor)\n        ->textColor($textColor)->styles($styles)->classNames($classNames)->resourceIds($resourceIds)->extendedProps($extendedProps)\n    ;\n\n    $array = $this->event->toArray();\n\n    expect($array)->toMatchArray([\n        'title' => $title,\n        'start' => $start,\n        'end' => $end,\n        'backgroundColor' => $backgroundColor,\n        'textColor' => $textColor,\n        'styles' => 'color: red; font-size: 12px; border-color: red;',\n        'classNames' => 'class-1 class-2',\n        'resourceIds' => $resourceIds,\n        'extendedProps' => $extendedProps,\n    ]);\n});\n\nit('should return title with string', function () {\n    $title = 'Test Event';\n\n    $this->event->title($title)->start(Carbon::now())->end(Carbon::now()->addHour());\n\n    expect($this->event->toCalendarObject(0, false))\n        ->toMatchArray([\n            'title' => 'Test Event',\n        ])\n    ;\n});\n\nit('should return html props with htmlable', function () {\n    $title = new HtmlString('<strong>Test Event</strong>');\n\n    $this->event->title($title)->start(Carbon::now())->end(Carbon::now()->addHour());\n\n    expect($this->event->toCalendarObject(0, false))\n        ->toMatchArray([\n            'title' => [\n                'html' => '<strong>Test Event</strong>',\n            ],\n        ])\n    ;\n});\n"
  },
  {
    "path": "workbench/app/Providers/WorkbenchServiceProvider.php",
    "content": "<?php\n\nnamespace Workbench\\App\\Providers;\n\nuse Illuminate\\Support\\Facades\\Route;\nuse Illuminate\\Support\\ServiceProvider;\n\nclass WorkbenchServiceProvider extends ServiceProvider\n{\n    /**\n     * Register services.\n     */\n    public function register(): void\n    {\n        //\n    }\n\n    /**\n     * Bootstrap services.\n     */\n    public function boot(): void\n    {\n        Route::view('/', 'welcome');\n    }\n}\n"
  }
]